@fugood/bricks-cli 2.25.0-beta.6 → 2.25.0-beta.60

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/117.js CHANGED
@@ -1,6 +1,6 @@
1
- export const __rspack_esm_id=117;export const __rspack_esm_ids=[117];export const __webpack_modules__={98372(e,i,t){t.r(i),t.d(i,{startStdioServer:()=>t0});var n,a,o,r,s,d,c={};t.r(c),t.d(c,{lI:()=>ed,F3:()=>er,mJ:()=>es,AW:()=>eu,$V:()=>el,J6:()=>ep,Wt:()=>em,qq:()=>ec,gw:()=>e_,Yi:()=>eo});var l={};t.r(l),t.d(l,{applicationFragment:()=>ed,applicationShortFragment:()=>ey,deviceFragment:()=>er,deviceGroupFragment:()=>es,deviceShortFragment:()=>e$,instanceVersionFragment:()=>eu,mediaBoxFragment:()=>eh,mediaFileFragment:()=>eb,mediaWorkspaceFragment:()=>ev,moduleFragment:()=>el,moduleShortFragment:()=>ep,operationFragment:()=>em,publicApplicationBasicInfoFragment:()=>ec,userFavoriteFragment:()=>e_,workspaceFragment:()=>eg,workspaceShortFragment:()=>ef});var p={};t.r(p),t.d(p,{application:()=>eK,applicationByDevice:()=>eP,applicationReleaseVersion:()=>eU,applicationReleaseVersions:()=>eE,applicationTestsByDevice:()=>eO,applications:()=>eY,checkBindDevicePasscode:()=>eF,deviceUsage:()=>eL,devices:()=>eG,devicesByGroup:()=>eq,devicesByUniqueId:()=>eN,me:()=>ew,module:()=>eC,moduleReleaseVersion:()=>eR,moduleReleaseVersions:()=>eM,modules:()=>eT,publicModules:()=>ex,publicModulesByIdList:()=>eB,workspace:()=>ej,workspacePricingPlans:()=>eW,workspaces:()=>eV});var u={};t.r(u),t.d(u,{addUserFavorite:()=>iC,assignGroupPermissions:()=>iD,bindApplication:()=>ia,bindApplicationWithDeviceGroup:()=>is,changeWorkspaceAdditionalLimitSpending:()=>iB,changeWorkspaceSubscriptionPlan:()=>ix,controlDevice:()=>e2,createApplication:()=>ie,createApplicationWithShareVersion:()=>ii,createConfigChangeOperation:()=>ih,createDevice:()=>eQ,createDeviceGroup:()=>e5,createDeviceGroupWithApp:()=>il,createModule:()=>i_,createVirtualDevice:()=>eZ,createWorkspace:()=>eH,createWorkspaceOTP:()=>iE,dispatchDeviceGroupAction:()=>e3,doOperation:()=>ib,duplicateApplication:()=>iu,duplicateModule:()=>i$,forkApplication:()=>ip,moveApplication:()=>ic,moveDevice:()=>e1,moveModule:()=>iy,registerFCMNotification:()=>iA,registerRemoteDebug:()=>iS,removeApplication:()=>im,removeDevice:()=>e6,removeDeviceGroup:()=>e8,removeModule:()=>iv,removeOperation:()=>ik,removeUserFavorite:()=>iT,removeWorkspace:()=>e7,revokeWorkspaceOTP:()=>iU,shareAccessToken:()=>iw,shareApplication:()=>id,toggleShortEditApplication:()=>io,updateApplication:()=>it,updateApplicationViewportPreset:()=>ir,updateDevice:()=>e0,updateDeviceGroup:()=>e9,updateModule:()=>ig,updateOperation:()=>iI,updateVirtualDevice:()=>e4,updateWorkspace:()=>eJ,updateWorkspaceTokens:()=>eX});var m={};t.r(m),t.d(m,{application:()=>iF,applicationByDevice:()=>iN,applications:()=>iO,device:()=>iV,deviceUsage:()=>iK,devices:()=>ij,devicesByApplication:()=>iY,mediaBox:()=>iz,mediaBoxes:()=>iL,mediaFile:()=>iJ,mediaFiles:()=>iH,mediaWorkspace:()=>iG,module:()=>iW,modules:()=>iq,workspace:()=>iP});var _={};t.r(_),t.d(_,{bindApplication:()=>iZ,copyMediaFiles:()=>i3,createApplication:()=>iX,createModule:()=>i1,deleteMediaBoxFiles:()=>i7,deleteMediaFiles:()=>i8,requestFileUpload:()=>i6,setMediaFileAsBoxPreview:()=>i9,unbindApplication:()=>i0,updateApplication:()=>iQ,updateMediaFile:()=>i2,updateMediaFiles:()=>i5,updateModule:()=>i4});var g={};t.r(g),t.d(g,{mediaBox:()=>tv,mediaBoxes:()=>ty,mediaFile:()=>tb,mediaFiles:()=>th,mediaWorkspace:()=>t$,mediaWorkspaces:()=>tf});var f={};t.r(f),t.d(f,{assignGroupPermissions:()=>tU,copyMediaFiles:()=>tB,createMediaBox:()=>tD,createMediaWorkspace:()=>tI,deleteMediaFiles:()=>tx,moveMediaBox:()=>tA,requestFileUpload:()=>tw,setMediaFileAsBoxPreview:()=>tE,updateMediaBox:()=>tS,updateMediaFile:()=>tC,updateMediaFiles:()=>tT,updateMediaWorkspace:()=>tk});var y={};t.r(y),t.d(y,{mediaBox:()=>tR,mediaFile:()=>tO,mediaFiles:()=>tP});var $={};t.r($),t.d($,{deleteMediaFiles:()=>tW,requestFileUpload:()=>tF,updateMediaFile:()=>tN,updateMediaFiles:()=>tq});var v=t(99436),h=t(25326),b=t(66029),I={info:"info",manage_signature:"sign",query_application:"qa",query_device:"qd",query_device_group:"qdg",query_module:"qm",query_activity_log:"qal",create_application:"ca",create_device:"cd",create_device_group:"cdg",create_module:"cm",update_application:"ua",bind_application:"ba",short_edit_application:"uas",canvas_control_application:"uacc",update_device:"ud",update_device_group:"udg",update_module:"um",short_edit_module:"ums",remove_application:"ra",remove_device:"rd",remove_device_group:"rdg",remove_module:"rm",control_device:"ctld",control_application_device:"ctlad",control_device_group:"ctldg",query_media_flow:"qmf",write_media_flow:"wmf",access_unstable_feature:"UNSTABLE"},k=Object.entries(I).reduce((e,[i,t])=>(e[t]=i,e),{}),D=["HS256","RS256"],A=["https://auth0.bricks.tools/","https://mybigday.auth0.com/"],S=t(84867);let w='# Getting Started with BRICKS\n\nBRICKS (方塊磚) is a comprehensive platform for creating interactive multimedia display applications specifically designed for digital signage screens. It enables users to design complete applications without programming, using a visual, component-based approach.\n\n**Important**: Users interact through a visual GUI editor, not raw configuration files. Always 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 details\n\n## Core Philosophy\n\nBRICKS operates as a **Launcher system** that reads configuration files from the cloud (or cached locally) and must maintain normal operation even when offline. The system periodically reports health status and supports watchdog timers for automatic restart or maintenance mode activation.\n\n## Fundamental Architecture\n\n### The Three Core Elements\n\n#### 1. Canvas (畫布)\n- **Definition**: The visual container that defines what users see on screen\n- **Behavior**: Screen transitions occur by switching between different canvases\n- **Smart Transitions**: When switching canvases, BRICKS automatically compares shared elements and smoothly animates their position/size changes\n- **Properties**:\n - `Showing Timeout`: Auto-advance to next canvas after specified time\n - `Next Canvas ID`: Target canvas for timeout transitions\n - `Background Color`: Canvas background\n - `Dismiss Keyboard On Press`: Touch behavior for keyboard dismissal\n- **Events**: `CANVAS_FIRST_ENTER`, `CANVAS_ENTER`, `CANVAS_SHOWING_TIMEOUT`, `CANVAS_EXIT`\n\n#### 2. Brick (方塊)\n- **Definition**: Visual components that display content and handle user interactions\n- **Animation System**: All bricks support three animation phases:\n - **Enter Animation**: How the brick appears on screen\n - **Display Animation**: Ongoing animations while visible\n - **Exit Animation**: How the brick disappears\n- **Positioning**: Uses grid-based positioning system for resolution independence\n- **Interaction**: Can respond to touch events and trigger system actions\n\nAvailable template:\n[:BRICK_IDS:]\n\n#### 3. Generator (處理器)\n- **Definition**: Invisible processing units that handle non-visual functionality\n- **Purpose**: Handle hardware interactions (camera, sensors), data processing, network communication\n- **Input**: Receives parameters exclusively through Property Bank\n- **Output**: Returns results exclusively through Property Bank\n- **Triggers**: Activated by Events connected to their Actions\n\nAvailable template:\n[:GENERATOR_IDS:]\n\n### Data (Property Bank, 參數庫)\nThe central data management system that serves as the backbone of BRICKS applications:\n\n#### Key Features\n- **KEY-VALUE Structure**: Simple, accessible data storage\n- **Dual Events**: Each property supports both "Update" and "Value Change" events\n- **Auto-Refresh**: UI elements automatically update when linked data changes\n- **Cross-Subspace Communication**: Properties can be shared between different subspaces\n- **Data Types**: `string`, `number`, `bool`, `object`, `array`, `any`\n- **Special Kinds**: `color`, `datetime`, `id`, `media-resource-*`, `lottie-file-uri`\n- **Units**: `grid`, `px`, `ms` for different measurement types\n\n#### Routing Options\n- **read-only**: Cannot be changed from other subspaces\n- **Default**: Accepts changes from other subspaces\n\nTerminology note: We refer to the central data system as "Data" in docs and UI. Internally, it remains "Property Bank" and uses `PROPERTY_BANK_*` identifiers.\n\n### Event System\nBRICKS uses a comprehensive event-driven architecture:\n\n#### Event Sources\n- **System Events**: Property Bank changes, timer events, canvas transitions\n- **Brick Events**: User interactions (press, focus, value changes)\n- **Generator Events**: Hardware responses, network callbacks, processing completions\n\n#### Event Handling\n- **Sequential Processing**: Events trigger Actions in defined order\n- **Parameter Passing**: All parameters passed through Property Bank\n- **Action Types**: System actions or Generator actions\n\n### Subspace (子空間)\nAdvanced modularity system for complex applications:\n\n#### Concept\n- **Nested Systems**: Complete BRICKS system within a brick\n- **Independent Operation**: Own canvases, bricks, and property banks\n- **Modular Behavior**: Can be positioned, scaled, and animated like regular bricks\n\n#### Communication\n- **Input**: External Property Bank values copied to internal Property Bank\n- **Output**: Internal Property Bank changes trigger external events\n- **Data Flow**: Call-by-value copying maintains isolation while enabling communication\n\n## Grid System\n\n### Resolution Independence\n- **Default Grid**: 96\xd754 units (optimized for HD displays)\n- **Automatic Scaling**: Grid units convert to pixels based on device resolution\n- **Calculation**: `grid_unit_size_px = device_width_px / app_grid_width`\n\n### Examples\n| Device Resolution | App Grid Size | Grid Unit Size |\n|------------------|---------------|----------------|\n| 1920\xd71080 | 96\xd754 | 20px |\n| 3840\xd72160 | 96\xd754 | 40px |\n| 1280\xd7720 | 96\xd754 | 13.33px |\n\n### Positioning Features\n- **Overflow Support**: Elements can extend beyond visible area\n- **Partial Display**: Elements at negative positions show partial content\n- **Performance Optimization**: Completely off-screen elements are automatically ignored\n\n## Configuration Structure\n\n### Hierarchy\n```\nApplication (應用程式)\n├── Root Subspace\n├── Subspace Map\n│ ├── Canvas Map\n│ ├── Brick Map\n│ └── Generator Map\n├── Property Bank\n├── Property Bank Calc\n├── Event Map\n└── Automation Map\n```\n\n### Item property\nProperties can set constant value or link data like this\n\n```js\n{\n "example1": 123,\n "example2": "PROPERTY_BANK#<Data Node ID>", // Link Data\n "example3": {\n "PROPERTY_BANK#<Data Node ID>", // Link Data in object, we recommend direct link without middle object data\n }\n}\n```\n\n### Item outlet\nData output from brick or generator, you can link it to data\n\n```js\n{\n OUTLET_NAME: \'<Data Node ID>\'\n}\n```\n\n### Event actions\nOn handling event can do actions with this schema\n\n```js\n[\n {\n "action": "string",\n "handler": "string",\n "parameter_list": [\n {\n "input_to_receiver": "string", // Argument\n "result_from_sender": "string" // Link data\n }\n ],\n "wait_async": "boolean"\n }\n]\n```\n\n- `handler: SYSTEM`\n[:SYSTEM_ACTIONS:]\n- `handler: GENERATOR_<UUID>`\n- `handler: BRICK_<UUID>`\n\n## Development Workflow\n\n### 1. Design Phase\n- Define grid layout (usually 96\xd754)\n- Plan canvas flow and transitions\n- Identify required data flows\n\n### 2. Implementation\n- Use `create_item` to constuct config\n- Create subspaces for different app sections\n- Add canvases for each screen/state\n- Place and configure bricks for UI elements\n- Add generators for processing logic\n- Connect events to actions\n\n### 3. Data Management\n- Set up Property Bank structure\n- Configure property types and routing\n- Link UI elements to data sources\n- Implement data processing flows\n\n#### Mental Model\n- Reactive architecture: events trigger actions; actions update Data; UI and generators react to Data changes.\n- Calculations: optional graphs transform Data using Data Calculation (command/data nodes or script).\n- Always read/write via Data. Generators receive input from Data and write outputs back to Data.\n\n#### Common Patterns\n- Event → Action → Data update or Outlet → Data update\n- Data change → Triggers downstream calculations → Updates target Data\n- Cross-subspace routing: respect `read-only` vs `default`\n\n### 4. Testing & Deployment\n- Use automation maps for testing\n- Validate configuration schema\n- Deploy to target devices\n- Monitor system health\n\n## Best Practices\n\n### Performance\n- Use 96\xd754 grid for standard content\n- Minimize off-screen elements\n- Optimize property bank access patterns\n- Cache media resources appropriately\n\n### User Experience\n- Always use enter/exit animations (avoid sudden appearances)\n- Maintain consistent transition timing\n- Design for offline operation\n- Implement proper error handling\n\n### Architecture\n- Keep subspaces focused and modular\n- Use generators for all non-visual processing\n- Minimize cross-subspace dependencies\n- Design for reusability through modules\n\n## Network & Offline Behavior\n\n### Online Operation\n- Configuration sync from cloud\n- Media resource loading\n- Real-time data updates\n- Health status reporting\n\n### Offline Requirements\n- **Display Continuity**: All display and reading functions must work offline\n- **Data Caching**: Write operations cached locally and synced when online\n- **Resource Management**: Media and assets preloaded during online periods\n- **Graceful Degradation**: Non-essential features disabled, core functionality maintained\n\nThis comprehensive foundation enables the creation of sophisticated, interactive digital signage applications that are both powerful and maintainable.\n\n## Local Sync\n\nLocal Sync enables near real-time intranet communication between devices for seamless multi-screen display splicing.\n\n- Data Sync: Synchronize selected data (Property Bank/Data nodes) across devices so UI updates remain consistent.\n- Canvas Sync: Optionally synchronize active canvas to orchestrate state transitions across screens.\n- Typical Use: Video walls, tiled displays, or clustered players that must behave as one.\n- Transport: LAN/intranet only; optimized for low latency and reliability inside the local network.\n- Resilience: Designed to tolerate temporary disconnections; devices rejoin and resynchronize state.\n\nConfiguration hints (high level):\n- Subspaces can define local sync behavior (e.g., whether to sync canvas changes).\n- Generators may opt into specific local sync run modes.\n- Keep payloads small and data normalized for best performance.';var C=t(20181),T=(e,i={})=>({content:[C.Buffer.isBuffer(e)?{...i,blob:e.toString("base64"),type:"blob"}:{...i,text:"string"==typeof e?e:JSON.stringify(e,null,2),type:"text"}],isError:!1}),x=t(68832),B=t(79657),E=t(79861),U=t(46123),M=t(80211),R=t(45907),P=t(99548),O=t(96423),F=M.ajv.getSchema("http://display.bricks.tools/root.schema.json5"),N=(0,O.A)(["subspace_map.*.property_bank_calc_map.*.script_config"]);function q(e){var i=[];try{var t=M(e);i.push(...(0,P.L)({errors:t,schema:F,data:e}).map(({path:e,message:i})=>`${e}: ${i}`));try{i.push(...R(e).map(({field:e,message:i})=>`${e}: ${i}`))}catch(e){i.push(`Component reference validation failed: ${e.message}`)}return N(e).forEach(t=>{var n=t.slice(0,-1),a=U(e,n),o=n.join(".");if(0===Object.keys(a.map).length)i.push(`${o}.map is empty`);else{var r=a.script_config,s=r.inputs,d=r.output,c=r.outputs,l=r.error;s&&Object.keys(s).forEach(e=>{a.map[e]||i.push(`${o}.map.${e} is missing`)}),d&&!a.map[d]&&i.push(`${o}.map.${d} is missing`),c&&Object.values(c).forEach(e=>{a.map[e]||i.push(`${o}.map.${e} is missing`)}),l&&!a.map[l]&&i.push(`${o}.map.${l} is missing`)}}),{valid:0===i.length,errors:i}}catch(e){return{valid:!1,errors:[`Validation failed: ${e.message}`]}}}var W=t(49741),j=t(63981),V=(e,i="en-us")=>"object"==typeof e&&null!==e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,"object"!=typeof t||Array.isArray(t)?t:t[i]??V(t,i)])):e,Y=V(W.t),K=Object.entries(W.systemActions).map(([e,{propertyNameType:i,property:t}])=>` - \`${e}\`: ${Y[e]}
1
+ export const __rspack_esm_id=117;export const __rspack_esm_ids=[117];export const __webpack_modules__={98372(e,i,t){t.r(i),t.d(i,{startStdioServer:()=>tX});var n,a,o,r,s,d,c={};t.r(c),t.d(c,{applicationFragment:()=>ed,applicationShortFragment:()=>ey,deviceFragment:()=>er,deviceGroupFragment:()=>es,deviceShortFragment:()=>e$,instanceVersionFragment:()=>eu,mediaBoxFragment:()=>eh,mediaFileFragment:()=>eb,mediaWorkspaceFragment:()=>ev,moduleFragment:()=>el,moduleShortFragment:()=>ep,operationFragment:()=>em,publicApplicationBasicInfoFragment:()=>ec,userFavoriteFragment:()=>e_,workspaceFragment:()=>eg,workspaceShortFragment:()=>ef});var l={};t.r(l),t.d(l,{application:()=>ej,applicationByDevice:()=>eU,applicationReleaseVersion:()=>ex,applicationReleaseVersions:()=>eT,applicationTestsByDevice:()=>eM,applications:()=>eW,checkBindDevicePasscode:()=>eR,deviceUsage:()=>eK,devices:()=>eV,devicesByGroup:()=>eO,devicesByUniqueId:()=>eP,me:()=>eD,module:()=>eA,moduleReleaseVersion:()=>eE,moduleReleaseVersions:()=>eB,modules:()=>eS,publicModules:()=>ew,publicModulesByIdList:()=>eC,workspace:()=>eN,workspacePricingPlans:()=>eF,workspaces:()=>eq});var p={};t.r(p),t.d(p,{addUserFavorite:()=>iA,assignGroupPermissions:()=>ib,bindApplication:()=>ie,bindApplicationWithDeviceGroup:()=>ia,changeWorkspaceAdditionalLimitSpending:()=>iC,changeWorkspaceSubscriptionPlan:()=>iw,controlDevice:()=>e1,createApplication:()=>e3,createApplicationWithShareVersion:()=>e8,createConfigChangeOperation:()=>iy,createDevice:()=>eH,createDeviceGroup:()=>e4,createDeviceGroupWithApp:()=>is,createModule:()=>ip,createVirtualDevice:()=>eJ,createWorkspace:()=>eG,createWorkspaceOTP:()=>iT,dispatchDeviceGroupAction:()=>e2,doOperation:()=>i$,duplicateApplication:()=>ic,duplicateModule:()=>i_,forkApplication:()=>id,moveApplication:()=>ir,moveDevice:()=>eQ,moveModule:()=>im,registerFCMNotification:()=>iI,registerRemoteDebug:()=>ik,removeApplication:()=>il,removeDevice:()=>e0,removeDeviceGroup:()=>e5,removeModule:()=>ig,removeOperation:()=>ih,removeUserFavorite:()=>iS,removeWorkspace:()=>e9,revokeWorkspaceOTP:()=>ix,shareAccessToken:()=>iD,shareApplication:()=>io,toggleShortEditApplication:()=>ii,updateApplication:()=>e7,updateApplicationViewportPreset:()=>it,updateDevice:()=>eX,updateDeviceGroup:()=>e6,updateModule:()=>iu,updateOperation:()=>iv,updateVirtualDevice:()=>eZ,updateWorkspace:()=>eL,updateWorkspaceTokens:()=>ez});var u={};t.r(u),t.d(u,{application:()=>iR,applicationByDevice:()=>iP,applications:()=>iM,device:()=>iq,deviceUsage:()=>ij,devices:()=>iN,devicesByApplication:()=>iW,mediaBox:()=>iY,mediaBoxes:()=>iK,mediaFile:()=>iL,mediaFiles:()=>iG,mediaWorkspace:()=>iV,module:()=>iF,modules:()=>iO,workspace:()=>iU});var m={};t.r(m),t.d(m,{bindApplication:()=>iJ,copyMediaFiles:()=>i2,createApplication:()=>iz,createModule:()=>iQ,deleteMediaBoxFiles:()=>i9,deleteMediaFiles:()=>i5,requestFileUpload:()=>i0,setMediaFileAsBoxPreview:()=>i6,unbindApplication:()=>iX,updateApplication:()=>iH,updateMediaFile:()=>i1,updateMediaFiles:()=>i4,updateModule:()=>iZ});var _={};t.r(_),t.d(_,{mediaBox:()=>tf,mediaBoxes:()=>t_,mediaFile:()=>t$,mediaFiles:()=>ty,mediaWorkspace:()=>tg,mediaWorkspaces:()=>tm});var g={};t.r(g),t.d(g,{assignGroupPermissions:()=>tx,copyMediaFiles:()=>tC,createMediaBox:()=>tb,createMediaWorkspace:()=>tv,deleteMediaFiles:()=>tw,moveMediaBox:()=>tI,requestFileUpload:()=>tD,setMediaFileAsBoxPreview:()=>tT,updateMediaBox:()=>tk,updateMediaFile:()=>tA,updateMediaFiles:()=>tS,updateMediaWorkspace:()=>th});var f={};t.r(f),t.d(f,{mediaBox:()=>tE,mediaFile:()=>tM,mediaFiles:()=>tU});var y={};t.r(y),t.d(y,{deleteMediaFiles:()=>tF,requestFileUpload:()=>tR,updateMediaFile:()=>tP,updateMediaFiles:()=>tO});var $=t(99436),v=t(25326),h=t(66029),b={info:"info",manage_signature:"sign",query_application:"qa",query_device:"qd",query_device_group:"qdg",query_module:"qm",query_activity_log:"qal",create_application:"ca",create_device:"cd",create_device_group:"cdg",create_module:"cm",update_application:"ua",bind_application:"ba",short_edit_application:"uas",canvas_control_application:"uacc",update_device:"ud",update_device_group:"udg",update_module:"um",short_edit_module:"ums",remove_application:"ra",remove_device:"rd",remove_device_group:"rdg",remove_module:"rm",control_device:"ctld",control_application_device:"ctlad",control_device_group:"ctldg",query_media_flow:"qmf",write_media_flow:"wmf",access_unstable_feature:"UNSTABLE"},I=Object.entries(b).reduce((e,[i,t])=>(e[t]=i,e),{}),k=["HS256","RS256"],D=["https://auth0.bricks.tools/","https://mybigday.auth0.com/"],A=t(84867);let S='# Getting Started with BRICKS\n\nBRICKS (方塊磚) is a comprehensive platform for creating interactive multimedia display applications specifically designed for digital signage screens. It enables users to design complete applications without programming, using a visual, component-based approach.\n\n**Important**: Users interact through a visual GUI editor, not raw configuration files. Always 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 details\n\n## Core Philosophy\n\nBRICKS operates as a **Launcher system** that reads configuration files from the cloud (or cached locally) and must maintain normal operation even when offline. The system periodically reports health status and supports watchdog timers for automatic restart or maintenance mode activation.\n\n## Fundamental Architecture\n\n### The Three Core Elements\n\n#### 1. Canvas (畫布)\n- **Definition**: The visual container that defines what users see on screen\n- **Behavior**: Screen transitions occur by switching between different canvases\n- **Smart Transitions**: When switching canvases, BRICKS automatically compares shared elements and smoothly animates their position/size changes\n- **Properties**:\n - `Showing Timeout`: Auto-advance to next canvas after specified time\n - `Next Canvas ID`: Target canvas for timeout transitions\n - `Background Color`: Canvas background\n - `Dismiss Keyboard On Press`: Touch behavior for keyboard dismissal\n- **Events**: `CANVAS_FIRST_ENTER`, `CANVAS_ENTER`, `CANVAS_SHOWING_TIMEOUT`, `CANVAS_EXIT`\n\n#### 2. Brick (方塊)\n- **Definition**: Visual components that display content and handle user interactions\n- **Animation System**: All bricks support three animation phases:\n - **Enter Animation**: How the brick appears on screen\n - **Display Animation**: Ongoing animations while visible\n - **Exit Animation**: How the brick disappears\n- **Positioning**: Uses grid-based positioning system for resolution independence\n- **Interaction**: Can respond to touch events and trigger system actions\n\nAvailable template:\n[:BRICK_IDS:]\n\n#### 3. Generator (處理器)\n- **Definition**: Invisible processing units that handle non-visual functionality\n- **Purpose**: Handle hardware interactions (camera, sensors), data processing, network communication\n- **Input**: Receives parameters exclusively through Property Bank\n- **Output**: Returns results exclusively through Property Bank\n- **Triggers**: Activated by Events connected to their Actions\n\nAvailable template:\n[:GENERATOR_IDS:]\n\n### Data (Property Bank, 參數庫)\nThe central data management system that serves as the backbone of BRICKS applications:\n\n#### Key Features\n- **KEY-VALUE Structure**: Simple, accessible data storage\n- **Dual Events**: Each property supports both "Update" and "Value Change" events\n- **Auto-Refresh**: UI elements automatically update when linked data changes\n- **Cross-Subspace Communication**: Properties can be shared between different subspaces\n- **Data Types**: `string`, `number`, `bool`, `object`, `array`, `any`\n- **Special Kinds**: `color`, `datetime`, `id`, `media-resource-*`, `lottie-file-uri`\n- **Units**: `grid`, `px`, `ms` for different measurement types\n\n#### Routing Options\n- **read-only**: Cannot be changed from other subspaces\n- **Default**: Accepts changes from other subspaces\n\nTerminology note: We refer to the central data system as "Data" in docs and UI. Internally, it remains "Property Bank" and uses `PROPERTY_BANK_*` identifiers.\n\n### Event System\nBRICKS uses a comprehensive event-driven architecture:\n\n#### Event Sources\n- **System Events**: Property Bank changes, timer events, canvas transitions\n- **Brick Events**: User interactions (press, focus, value changes)\n- **Generator Events**: Hardware responses, network callbacks, processing completions\n\n#### Event Handling\n- **Sequential Processing**: Events trigger Actions in defined order\n- **Parameter Passing**: All parameters passed through Property Bank\n- **Action Types**: System actions or Generator actions\n\n### Subspace (子空間)\nAdvanced modularity system for complex applications:\n\n#### Concept\n- **Nested Systems**: Complete BRICKS system within a brick\n- **Independent Operation**: Own canvases, bricks, and property banks\n- **Modular Behavior**: Can be positioned, scaled, and animated like regular bricks\n\n#### Communication\n- **Input**: External Property Bank values copied to internal Property Bank\n- **Output**: Internal Property Bank changes trigger external events\n- **Data Flow**: Call-by-value copying maintains isolation while enabling communication\n\n## Grid System\n\n### Resolution Independence\n- **Default Grid**: 96\xd754 units (optimized for HD displays)\n- **Automatic Scaling**: Grid units convert to pixels based on device resolution\n- **Calculation**: `grid_unit_size_px = device_width_px / app_grid_width`\n\n### Examples\n| Device Resolution | App Grid Size | Grid Unit Size |\n|------------------|---------------|----------------|\n| 1920\xd71080 | 96\xd754 | 20px |\n| 3840\xd72160 | 96\xd754 | 40px |\n| 1280\xd7720 | 96\xd754 | 13.33px |\n\n### Positioning Features\n- **Overflow Support**: Elements can extend beyond visible area\n- **Partial Display**: Elements at negative positions show partial content\n- **Performance Optimization**: Completely off-screen elements are automatically ignored\n\n## Configuration Structure\n\n### Hierarchy\n```\nApplication (應用程式)\n├── Root Subspace\n├── Subspace Map\n│ ├── Canvas Map\n│ ├── Brick Map\n│ └── Generator Map\n├── Property Bank\n├── Property Bank Calc\n├── Event Map\n└── Automation Map\n```\n\n### Item property\nProperties can set constant value or link data like this\n\n```js\n{\n "example1": 123,\n "example2": "PROPERTY_BANK#<Data Node ID>", // Link Data\n "example3": {\n "PROPERTY_BANK#<Data Node ID>", // Link Data in object, we recommend direct link without middle object data\n }\n}\n```\n\n### Item outlet\nData output from brick or generator, you can link it to data\n\n```js\n{\n OUTLET_NAME: \'<Data Node ID>\'\n}\n```\n\n### Event actions\nOn handling event can do actions with this schema\n\n```js\n[\n {\n "action": "string",\n "handler": "string",\n "parameter_list": [\n {\n "input_to_receiver": "string", // Argument\n "result_from_sender": "string" // Link data\n }\n ],\n "wait_async": "boolean"\n }\n]\n```\n\n- `handler: SYSTEM`\n[:SYSTEM_ACTIONS:]\n- `handler: GENERATOR_<UUID>`\n- `handler: BRICK_<UUID>`\n\n## Development Workflow\n\n### 1. Design Phase\n- Define grid layout (usually 96\xd754)\n- Plan canvas flow and transitions\n- Identify required data flows\n\n### 2. Implementation\n- Use `create_item` to constuct config\n- Create subspaces for different app sections\n- Add canvases for each screen/state\n- Place and configure bricks for UI elements\n- Add generators for processing logic\n- Connect events to actions\n\n### 3. Data Management\n- Set up Property Bank structure\n- Configure property types and routing\n- Link UI elements to data sources\n- Implement data processing flows\n\n#### Mental Model\n- Reactive architecture: events trigger actions; actions update Data; UI and generators react to Data changes.\n- Calculations: optional graphs transform Data using Data Calculation (command/data nodes or script).\n- Always read/write via Data. Generators receive input from Data and write outputs back to Data.\n\n#### Common Patterns\n- Event → Action → Data update or Outlet → Data update\n- Data change → Triggers downstream calculations → Updates target Data\n- Cross-subspace routing: respect `read-only` vs `default`\n\n### 4. Testing & Deployment\n- Use automation maps for testing\n- Validate configuration schema\n- Deploy to target devices\n- Monitor system health\n\n## Best Practices\n\n### Performance\n- Use 96\xd754 grid for standard content\n- Minimize off-screen elements\n- Optimize property bank access patterns\n- Cache media resources appropriately\n\n### User Experience\n- Always use enter/exit animations (avoid sudden appearances)\n- Maintain consistent transition timing\n- Design for offline operation\n- Implement proper error handling\n\n### Architecture\n- Keep subspaces focused and modular\n- Use generators for all non-visual processing\n- Minimize cross-subspace dependencies\n- Design for reusability through modules\n\n## Network & Offline Behavior\n\n### Online Operation\n- Configuration sync from cloud\n- Media resource loading\n- Real-time data updates\n- Health status reporting\n\n### Offline Requirements\n- **Display Continuity**: All display and reading functions must work offline\n- **Data Caching**: Write operations cached locally and synced when online\n- **Resource Management**: Media and assets preloaded during online periods\n- **Graceful Degradation**: Non-essential features disabled, core functionality maintained\n\nThis comprehensive foundation enables the creation of sophisticated, interactive digital signage applications that are both powerful and maintainable.\n\n## Local Sync\n\nLocal Sync enables near real-time intranet communication between devices for seamless multi-screen display splicing.\n\n- Data Sync: Synchronize selected data (Property Bank/Data nodes) across devices so UI updates remain consistent.\n- Canvas Sync: Optionally synchronize active canvas to orchestrate state transitions across screens.\n- Typical Use: Video walls, tiled displays, or clustered players that must behave as one.\n- Transport: LAN/intranet only; optimized for low latency and reliability inside the local network.\n- Resilience: Designed to tolerate temporary disconnections; devices rejoin and resynchronize state.\n\nConfiguration hints (high level):\n- Subspaces can define local sync behavior (e.g., whether to sync canvas changes).\n- Generators may opt into specific local sync run modes.\n- Keep payloads small and data normalized for best performance.';var w=t(20181),C=(e,i={})=>({content:[w.Buffer.isBuffer(e)?{...i,blob:e.toString("base64"),type:"blob"}:{...i,text:"string"==typeof e?e:JSON.stringify(e,null,2),type:"text"}],isError:!1}),T=t(68832),x=t(79657),B=t(79861),E=t(46123),U=t(80211),M=t(45907),R=t(99548),P=t(96423),O=U.ajv.getSchema("http://display.bricks.tools/root.schema.json5"),F=(0,P.A)(["subspace_map.*.property_bank_calc_map.*.script_config"]),N=e=>e&&"object"==typeof e?e:{};function q(e){var i=[];try{var t=U(e);i.push(...(0,R.L)({errors:t,schema:O,data:e}).map(({path:e,message:i})=>`${e}: ${i}`));try{i.push(...M(e).map(({field:e,message:i})=>`${e}: ${i}`))}catch(e){i.push(`Component reference validation failed: ${e.message}`)}return F(e).forEach(t=>{var n=t.slice(0,-1),a=E(e,n),o=n.join("."),r=N(a?.map),s=N(a?.script_config);if(0===Object.keys(r).length)i.push(`${o}.map is empty`);else{var d=s.inputs,c=s.output,l=s.outputs,p=s.error,u=N(d),m=N(l);d&&Object.keys(u).forEach(e=>{r[e]||i.push(`${o}.map.${e} is missing`)}),c&&!r[c]&&i.push(`${o}.map.${c} is missing`),l&&Object.values(m).forEach(e=>{r[e]||i.push(`${o}.map.${e} is missing`)}),p&&!r[p]&&i.push(`${o}.map.${p} is missing`)}}),{valid:0===i.length,errors:i}}catch(e){return{valid:!1,errors:[`Validation failed: ${e.message}`]}}}var W=t(49741),j=t(63981),V=(e,i="en-us")=>"object"==typeof e&&null!==e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,"object"!=typeof t||Array.isArray(t)?t:t[i]??V(t,i)])):e,K=V(W.t),Y=Object.entries(W.systemActions).map(([e,{propertyNameType:i,property:t}])=>` - \`${e}\`: ${K[e]}
2
2
  ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i])=>` - \`${e}\`: ${JSON.stringify(i)}`).join("\n");case"property_bank":return" - `PROPERTY_BANK_DATA_NODE_*`: Value";default:return""}})(i,t)}
3
- `.trim()).join("\n"),G=Object.keys(j.brickMapping).map(e=>`- \`${e}\``).join("\n"),L=Object.keys(j.generatorMapping).map(e=>`- \`${e}\``).join("\n");let z=w.replace("[:SYSTEM_ACTIONS:]",K).replace("[:BRICK_IDS:]",G).replace("[:GENERATOR_IDS:]",L);var H=t(44668),J=t(5018),X=t(63315),Q=t(30409),Z=t(40906),ee=t(79760),ei=t(22268),et=t(7068),en=t(26197),ea=t(94370);let eo=(0,ea.default)`
3
+ `.trim()).join("\n"),G=Object.keys(j.brickMapping).map(e=>`- \`${e}\``).join("\n"),L=Object.keys(j.generatorMapping).map(e=>`- \`${e}\``).join("\n");let z=S.replace("[:SYSTEM_ACTIONS:]",Y).replace("[:BRICK_IDS:]",G).replace("[:GENERATOR_IDS:]",L);var H=t(44668),J=t(5018),X=t(63315),Q=t(30409),Z=t(40906),ee=t(79760),ei=t(22268),et=t(7068),en=t(26197),ea=t(94370);let eo=(0,ea.default)`
4
4
  fragment workspaceArguments on Workspace {
5
5
  __typename
6
6
  _id
@@ -234,6 +234,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
234
234
  lock {
235
235
  enabled
236
236
  }
237
+ enable_web_lan_discovery
237
238
  env {
238
239
  variables
239
240
  virtual_dev_url_query {
@@ -797,70 +798,70 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
797
798
  systemTags
798
799
  }
799
800
  }
800
- `,eI={query:"query",mutation:"mutate"},ek=H(function e(i,t,n,a,o){J(this,e),this.baseUrl=i,this.token=t,this.endpoint=n;var r=(0,ee.$)({uri:`${i}${n}`}),s=(0,en.o)((e,{headers:i})=>({headers:{...i,authorization:`Bearer ${t}`}}));this.apolloClient=new ei.R({link:s.concat(r),cache:new et.D,defaultOptions:{watchQuery:{errorPolicy:"all",fetchPolicy:"no-cache"},query:{errorPolicy:"all",fetchPolicy:"no-cache"}}}),this.fragments=l,this.queries=a,this.mutations=o,this.generateMethods()},[{key:"generateMethods",value:function(){var e=this,i=i=>([t,n])=>{if(this[t])throw Error(`Overwriting client.${t}`);this[t]=v(function*(a={},o={}){try{var r=e.apolloClient[eI[i]],s=yield r({[i]:n,variables:a,...o}),d=s.data,c=s.errors;if(n.needResetStore)try{yield e.apolloClient.resetStore()}catch(e){console.error(e)}if(c)throw Error(c.map(({message:e})=>e).join("\n"));return d[t]}catch(e){if(e.cause)if(e.cause.result?.errors)throw Error(e.cause.result.errors.map(({message:e})=>e).join("\n"));else console.error(e.cause);throw e}})};Object.entries(this.queries).forEach(i("query")),Object.entries(this.mutations).forEach(i("mutation"))}},{key:"query",value:(n=v(function*(e,i={}){var t=yield this.apolloClient.query({query:e,variables:i,fetchPolicy:"no-cache"}),n=t.data,a=t.errors,o=t.error,r=t.message;if(o&&r)throw Error(r);if(a&&a.length>0)throw Error(a.map(({message:e})=>e).join("\n"));return n}),function(e){return n.apply(this,arguments)})},{key:"mutate",value:(a=v(function*(e,i={}){var t=yield this.apolloClient.mutate({mutation:e,variables:i}),n=t.data,a=t.errors,o=t.error,r=t.message;if(o&&r)throw Error(r);if(a&&a.length>0)throw Error(a.map(({message:e})=>e).join("\n"));return n}),function(e){return a.apply(this,arguments)})}]);let{$V:eD,J6:eA,AW:eS}=c,ew=(0,ea.default)`
801
+ `,eI={query:"query",mutation:"mutate"},ek=H(function e(i,t,n,a,o){J(this,e),this.baseUrl=i,this.token=t,this.endpoint=n;var r=(0,ee.$)({uri:`${i}${n}`}),s=(0,en.o)((e,{headers:i})=>({headers:{...i,authorization:`Bearer ${t}`}}));this.apolloClient=new ei.R({link:s.concat(r),cache:new et.D,defaultOptions:{watchQuery:{errorPolicy:"all",fetchPolicy:"no-cache"},query:{errorPolicy:"all",fetchPolicy:"no-cache"}}}),this.fragments=c,this.queries=a,this.mutations=o,this.generateMethods()},[{key:"generateMethods",value:function(){var e=this,i=i=>([t,n])=>{if(this[t])throw Error(`Overwriting client.${t}`);this[t]=$(function*(a={},o={}){try{var r=e.apolloClient[eI[i]],s=yield r({[i]:n,variables:a,...o}),d=s.data,c=s.errors;if(n.needResetStore)try{yield e.apolloClient.resetStore()}catch(e){console.error(e)}if(c)throw Error(c.map(({message:e})=>e).join("\n"));return d[t]}catch(e){if(e.cause)if(e.cause.result?.errors)throw Error(e.cause.result.errors.map(({message:e})=>e).join("\n"));else console.error(e.cause);throw e}})};Object.entries(this.queries).forEach(i("query")),Object.entries(this.mutations).forEach(i("mutation"))}},{key:"query",value:(n=$(function*(e,i={}){var t=yield this.apolloClient.query({query:e,variables:i,fetchPolicy:"no-cache"}),n=t.data,a=t.errors,o=t.error,r=t.message;if(o&&r)throw Error(r);if(a&&a.length>0)throw Error(a.map(({message:e})=>e).join("\n"));return n}),function(e){return n.apply(this,arguments)})},{key:"mutate",value:(a=$(function*(e,i={}){var t=yield this.apolloClient.mutate({mutation:e,variables:i}),n=t.data,a=t.errors,o=t.error,r=t.message;if(o&&r)throw Error(r);if(a&&a.length>0)throw Error(a.map(({message:e})=>e).join("\n"));return n}),function(e){return a.apply(this,arguments)})}]);let eD=(0,ea.default)`
801
802
  query ControllerClient_me {
802
803
  me {
803
804
  _id
804
805
  id_from_user
805
806
  }
806
807
  }
807
- `,eC=(0,ea.default)`
808
+ `,eA=(0,ea.default)`
808
809
  query ControllerClient_module($id: ID!) {
809
810
  module(id: $id) {
810
811
  ...moduleArguments
811
812
  }
812
813
  }
813
- ${eD}
814
- `,eT=(0,ea.default)`
814
+ ${el}
815
+ `,eS=(0,ea.default)`
815
816
  query ControllerClient_modules($workspaceId: ID, $limit: Int) {
816
817
  modules(workspaceId: $workspaceId, paginate: { limit: $limit }) {
817
818
  ...moduleShortArguments
818
819
  }
819
820
  }
820
- ${eA}
821
- `,ex=(0,ea.default)`
821
+ ${ep}
822
+ `,ew=(0,ea.default)`
822
823
  query ControllerClient_publicModules($keyword: String!, $limit: Int) {
823
824
  publicModules(keyword: $keyword, paginate: { limit: $limit }) {
824
825
  ...moduleShortArguments
825
826
  }
826
827
  }
827
- ${eA}
828
- `,eB=(0,ea.default)`
828
+ ${ep}
829
+ `,eC=(0,ea.default)`
829
830
  query ControllerClient_publicModulesByIdList($idList: [ID]) {
830
831
  publicModulesByIdList(idList: $idList) {
831
832
  ...moduleShortArguments
832
833
  }
833
834
  }
834
- ${eA}
835
- `,eE=(0,ea.default)`
835
+ ${ep}
836
+ `,eT=(0,ea.default)`
836
837
  query ControllerClient_applicationReleaseVersions($id: ID!) {
837
838
  applicationReleaseVersions(id: $id) {
838
839
  ...instanceVersionArguments
839
840
  }
840
841
  }
841
- ${eS}
842
- `,eU=(0,ea.default)`
842
+ ${eu}
843
+ `,ex=(0,ea.default)`
843
844
  query ControllerClient_applicationReleaseVersion($id: ID!, $versionId: ID!) {
844
845
  applicationReleaseVersion(id: $id, versionId: $versionId) {
845
846
  ...applicationReleaseVersionArguments
846
847
  }
847
848
  }
848
- ${eS}
849
- `,eM=(0,ea.default)`
849
+ ${eu}
850
+ `,eB=(0,ea.default)`
850
851
  query ControllerClient_moduleReleaseVersions($id: ID!) {
851
852
  moduleReleaseVersions(id: $id) {
852
853
  ...instanceVersionArguments
853
854
  }
854
855
  }
855
- ${eS}
856
- `,eR=(0,ea.default)`
856
+ ${eu}
857
+ `,eE=(0,ea.default)`
857
858
  query ControllerClient_moduleReleaseVersion($id: ID!, $versionId: ID!) {
858
859
  moduleReleaseVersion(id: $id, versionId: $versionId) {
859
860
  ...instanceVersionArguments
860
861
  }
861
862
  }
862
- ${eS}
863
- `,eP=(0,ea.default)`
863
+ ${eu}
864
+ `,eU=(0,ea.default)`
864
865
  query ControllerClient_applicationByDevice(
865
866
  $deviceId: ID!
866
867
  $debug: Boolean
@@ -878,7 +879,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
878
879
  }
879
880
  }
880
881
  ${ed}
881
- `,eO=(0,ea.default)`
882
+ `,eM=(0,ea.default)`
882
883
  query ControllerClient_applicationTestsByDevice($deviceId: ID!) {
883
884
  applicationTestsByDevice: applicationByDevice(
884
885
  deviceId: $deviceId
@@ -891,18 +892,18 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
891
892
  config_tests
892
893
  }
893
894
  }
894
- `,eF=(0,ea.default)`
895
+ `,eR=(0,ea.default)`
895
896
  query ControllerClient_checkBindDevicePasscode($passcode: String!) {
896
897
  checkBindDevicePasscode(passcode: $passcode)
897
898
  }
898
- `,eN=(0,ea.default)`
899
+ `,eP=(0,ea.default)`
899
900
  query ControllerClient_devicesByUniqueId($uniqueID: String!, $unbindApplication: Boolean) {
900
901
  devicesByUniqueId(uniqueID: $uniqueID, unbindApplication: $unbindApplication) {
901
902
  ...deviceArguments
902
903
  }
903
904
  }
904
905
  ${er}
905
- `,eq=(0,ea.default)`
906
+ `,eO=(0,ea.default)`
906
907
  query ControllerClient_devicesByGroup($id: ID!) {
907
908
  devicesByGroup(id: $id) {
908
909
  device {
@@ -953,46 +954,46 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
953
954
  target_name
954
955
  }
955
956
  }
956
- `,eW=(0,ea.default)`
957
+ `,eF=(0,ea.default)`
957
958
  query ControllerClient_workspacePricingPlans {
958
959
  workspacePricingPlans
959
960
  }
960
- `;var ej=(0,ea.default)`
961
+ `;var eN=(0,ea.default)`
961
962
  query User_workspace($id: ID!) {
962
963
  workspace(id: $id) {
963
964
  ...mcpWorkspaceArguments
964
965
  }
965
966
  }
966
967
  ${eg}
967
- `,eV=(0,ea.default)`
968
+ `,eq=(0,ea.default)`
968
969
  query User_workspaces($paginate: Paginate) {
969
970
  workspaces(paginate: $paginate) {
970
971
  ...mcpWorkspaceShortArguments
971
972
  }
972
973
  }
973
974
  ${ef}
974
- `,eY=(0,ea.default)`
975
+ `,eW=(0,ea.default)`
975
976
  query User_applications {
976
977
  applications {
977
978
  ...mcpApplicationShortArguments
978
979
  }
979
980
  }
980
981
  ${ey}
981
- `,eK=(0,ea.default)`
982
+ `,ej=(0,ea.default)`
982
983
  query User_application($id: ID!) {
983
984
  application(id: $id) {
984
985
  ...applicationArguments
985
986
  }
986
987
  }
987
988
  ${ed}
988
- `,eG=(0,ea.default)`
989
+ `,eV=(0,ea.default)`
989
990
  query User_devices {
990
991
  devices {
991
992
  ...mcpDeviceShortArguments
992
993
  }
993
994
  }
994
995
  ${e$}
995
- `,eL=(0,ea.default)`
996
+ `,eK=(0,ea.default)`
996
997
  query User_deviceUsage($deviceId: ID, $startDate: Date, $endDate: Date) {
997
998
  deviceUsage(deviceId: $deviceId, startDate: $startDate, endDate: $endDate) {
998
999
  _id
@@ -1011,14 +1012,14 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1011
1012
  }
1012
1013
  }
1013
1014
  }
1014
- `;let ez=e=>(e.needResetStore=!0,e),eH=ez((0,ea.default)`
1015
+ `;let eY=e=>(e.needResetStore=!0,e),eG=eY((0,ea.default)`
1015
1016
  mutation ControllerClient_createWorkspace($name: String, $description: String) {
1016
1017
  createWorkspace(name: $name, description: $description) {
1017
1018
  ...workspaceArguments
1018
1019
  }
1019
1020
  }
1020
1021
  ${eo}
1021
- `),eJ=ez((0,ea.default)`
1022
+ `),eL=eY((0,ea.default)`
1022
1023
  mutation ControllerClient_updateWorkspace(
1023
1024
  $id: ID!
1024
1025
  $name: String
@@ -1047,7 +1048,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1047
1048
  }
1048
1049
  }
1049
1050
  ${eo}
1050
- `),eX=ez((0,ea.default)`
1051
+ `),ez=eY((0,ea.default)`
1051
1052
  mutation ControllerClient_updateWorkspaceTokens(
1052
1053
  $id: ID!
1053
1054
  $tokens: [WorkspaceTokenInput]
@@ -1064,7 +1065,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1064
1065
  }
1065
1066
  }
1066
1067
  ${eo}
1067
- `),eQ=ez((0,ea.default)`
1068
+ `),eH=eY((0,ea.default)`
1068
1069
  mutation ControllerClient_createDevice(
1069
1070
  $workspaceId: ID
1070
1071
  $name: String
@@ -1087,7 +1088,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1087
1088
  }
1088
1089
  }
1089
1090
  ${er}
1090
- `),eZ=ez((0,ea.default)`
1091
+ `),eJ=eY((0,ea.default)`
1091
1092
  mutation ControllerClient_createVirtualDevice(
1092
1093
  $workspaceId: ID
1093
1094
  $name: String
@@ -1104,7 +1105,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1104
1105
  }
1105
1106
  }
1106
1107
  ${er}
1107
- `),e0=ez((0,ea.default)`
1108
+ `),eX=eY((0,ea.default)`
1108
1109
  mutation ControllerClient_updateDevice(
1109
1110
  $id: ID!
1110
1111
  $name: String
@@ -1117,6 +1118,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1117
1118
  $preload: PreloadInput
1118
1119
  $applicationUpdate: ApplicationUpdateInput
1119
1120
  $lock: DeviceLockInput
1121
+ $enableWebLanDiscovery: Boolean
1120
1122
  $env: DeviceEnvInput
1121
1123
  $accessControl: DeviceAccessControlInput
1122
1124
  $forceNotifyDevice: Boolean
@@ -1133,6 +1135,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1133
1135
  preload: $preload
1134
1136
  applicationUpdate: $applicationUpdate
1135
1137
  lock: $lock
1138
+ enableWebLanDiscovery: $enableWebLanDiscovery
1136
1139
  env: $env
1137
1140
  accessControl: $accessControl
1138
1141
  forceNotifyDevice: $forceNotifyDevice
@@ -1141,7 +1144,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1141
1144
  }
1142
1145
  }
1143
1146
  ${er}
1144
- `),e1=ez((0,ea.default)`
1147
+ `),eQ=eY((0,ea.default)`
1145
1148
  mutation ControllerClient_moveDevice(
1146
1149
  $id: ID!
1147
1150
  $workspaceId: ID!
@@ -1160,7 +1163,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1160
1163
  }
1161
1164
  }
1162
1165
  ${er}
1163
- `),e4=ez((0,ea.default)`
1166
+ `),eZ=eY((0,ea.default)`
1164
1167
  mutation ControllerClient_updateVirtualDevice(
1165
1168
  $id: ID!
1166
1169
  $tokens: [DeviceTokenInput]
@@ -1177,18 +1180,18 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1177
1180
  }
1178
1181
  }
1179
1182
  ${er}
1180
- `),e6=ez((0,ea.default)`
1183
+ `),e0=eY((0,ea.default)`
1181
1184
  mutation ControllerClient_removeDevice($id: ID!) {
1182
1185
  removeDevice(id: $id)
1183
1186
  }
1184
- `),e2=ez((0,ea.default)`
1187
+ `),e1=eY((0,ea.default)`
1185
1188
  mutation ControllerClient_controlDevice($id: ID!, $type: String!, $eventPayload: JSON) {
1186
1189
  controlDevice(id: $id, type: $type, eventPayload: $eventPayload) {
1187
1190
  ...deviceArguments
1188
1191
  }
1189
1192
  }
1190
1193
  ${er}
1191
- `),e5=ez((0,ea.default)`
1194
+ `),e4=eY((0,ea.default)`
1192
1195
  mutation ControllerClient_createDeviceGroup(
1193
1196
  $workspaceId: ID!
1194
1197
  $name: String!
@@ -1199,7 +1202,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1199
1202
  }
1200
1203
  }
1201
1204
  ${es}
1202
- `),e9=ez((0,ea.default)`
1205
+ `),e6=eY((0,ea.default)`
1203
1206
  mutation ControllerClient_updateDeviceGroup(
1204
1207
  $id: ID!
1205
1208
  $name: String
@@ -1224,22 +1227,22 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1224
1227
  }
1225
1228
  }
1226
1229
  ${es}
1227
- `),e3=ez((0,ea.default)`
1230
+ `),e2=eY((0,ea.default)`
1228
1231
  mutation ControllerClient_dispatchDeviceGroupAction($id: ID!, $action: String!) {
1229
1232
  dispatchDeviceGroupAction(id: $id, action: $action) {
1230
1233
  devices
1231
1234
  dispatched
1232
1235
  }
1233
1236
  }
1234
- `),e8=ez((0,ea.default)`
1237
+ `),e5=eY((0,ea.default)`
1235
1238
  mutation ControllerClient_removeDeviceGroup($id: ID!) {
1236
1239
  removeDeviceGroup(id: $id)
1237
1240
  }
1238
- `),e7=ez((0,ea.default)`
1241
+ `),e9=eY((0,ea.default)`
1239
1242
  mutation ControllerClient_removeWorkspace($id: ID!) {
1240
1243
  removeWorkspace(id: $id)
1241
1244
  }
1242
- `),ie=ez((0,ea.default)`
1245
+ `),e3=eY((0,ea.default)`
1243
1246
  mutation ControllerClient_createApplication(
1244
1247
  $workspaceId: ID
1245
1248
  $name: String
@@ -1260,7 +1263,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1260
1263
  }
1261
1264
  }
1262
1265
  ${ed}
1263
- `),ii=ez((0,ea.default)`
1266
+ `),e8=eY((0,ea.default)`
1264
1267
  mutation ControllerClient_createApplicationWithShareVersion(
1265
1268
  $workspaceId: ID
1266
1269
  $name: String
@@ -1277,7 +1280,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1277
1280
  }
1278
1281
  }
1279
1282
  ${ed}
1280
- `),it=ez((0,ea.default)`
1283
+ `),e7=eY((0,ea.default)`
1281
1284
  mutation ControllerClient_updateApplication(
1282
1285
  $id: ID!
1283
1286
  $name: String
@@ -1322,7 +1325,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1322
1325
  }
1323
1326
  }
1324
1327
  ${ed}
1325
- `),ia=ez((0,ea.default)`
1328
+ `),ie=eY((0,ea.default)`
1326
1329
  mutation ControllerClient_bindApplication(
1327
1330
  $id: ID!
1328
1331
  $devices: [ID]
@@ -1345,11 +1348,11 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1345
1348
  }
1346
1349
  }
1347
1350
  ${ed}
1348
- `),io=ez((0,ea.default)`
1351
+ `),ii=eY((0,ea.default)`
1349
1352
  mutation ControllerClient_toggleShortEditApplication($id: ID!, $enabled: Boolean!) {
1350
1353
  toggleShortEditApplication(id: $id, enabled: $enabled)
1351
1354
  }
1352
- `),ir=ez((0,ea.default)`
1355
+ `),it=eY((0,ea.default)`
1353
1356
  mutation ControllerClient_updateApplicationViewportPreset(
1354
1357
  $id: ID!
1355
1358
  $newViewportPresets: [ApplicationViewportPresetInput]
@@ -1366,7 +1369,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1366
1369
  }
1367
1370
  }
1368
1371
  ${ed}
1369
- `),is=ez((0,ea.default)`
1372
+ `),ia=eY((0,ea.default)`
1370
1373
  mutation ControllerClient_bindApplicationWithDeviceGroup(
1371
1374
  $id: ID!
1372
1375
  $bindDeviceGroup: ApplicationBindDeviceGroupInput
@@ -1383,7 +1386,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1383
1386
  }
1384
1387
  }
1385
1388
  ${ed}
1386
- `),id=ez((0,ea.default)`
1389
+ `),io=eY((0,ea.default)`
1387
1390
  mutation ControllerClient_shareApplication(
1388
1391
  $id: ID!
1389
1392
  $shareSetting: ApplicationShareSettingInput
@@ -1404,14 +1407,14 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1404
1407
  }
1405
1408
  }
1406
1409
  ${ed}
1407
- `),ic=ez((0,ea.default)`
1410
+ `),ir=eY((0,ea.default)`
1408
1411
  mutation ControllerClient_moveApplication($id: ID!, $workspaceId: ID!) {
1409
1412
  moveApplication(id: $id, workspaceId: $workspaceId) {
1410
1413
  ...applicationArguments
1411
1414
  }
1412
1415
  }
1413
1416
  ${ed}
1414
- `),il=ez((0,ea.default)`
1417
+ `),is=eY((0,ea.default)`
1415
1418
  mutation ControllerClient_createDeviceGroupWithApp(
1416
1419
  $applicationId: ID!
1417
1420
  $name: String!
@@ -1437,14 +1440,14 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1437
1440
  }
1438
1441
  }
1439
1442
  ${ed}
1440
- `),ip=ez((0,ea.default)`
1443
+ `),id=eY((0,ea.default)`
1441
1444
  mutation ControllerClient_forkApplication($id: ID!) {
1442
1445
  forkApplication(id: $id) {
1443
1446
  ...applicationArguments
1444
1447
  }
1445
1448
  }
1446
1449
  ${ed}
1447
- `),iu=ez((0,ea.default)`
1450
+ `),ic=eY((0,ea.default)`
1448
1451
  mutation ControllerClient_duplicateApplication(
1449
1452
  $id: ID!
1450
1453
  $includeVersions: Boolean
@@ -1459,11 +1462,11 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1459
1462
  }
1460
1463
  }
1461
1464
  ${ed}
1462
- `),im=ez((0,ea.default)`
1465
+ `),il=eY((0,ea.default)`
1463
1466
  mutation ControllerClient_removeApplication($id: ID!) {
1464
1467
  removeApplication(id: $id)
1465
1468
  }
1466
- `),i_=ez((0,ea.default)`
1469
+ `),ip=eY((0,ea.default)`
1467
1470
  mutation ControllerClient_createModule(
1468
1471
  $workspaceId: ID
1469
1472
  $name: String
@@ -1490,7 +1493,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1490
1493
  }
1491
1494
  }
1492
1495
  ${el}
1493
- `),ig=ez((0,ea.default)`
1496
+ `),iu=eY((0,ea.default)`
1494
1497
  mutation ControllerClient_updateModule(
1495
1498
  $id: ID!
1496
1499
  $name: String
@@ -1521,25 +1524,25 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1521
1524
  }
1522
1525
  }
1523
1526
  ${el}
1524
- `),iy=ez((0,ea.default)`
1527
+ `),im=eY((0,ea.default)`
1525
1528
  mutation ControllerClient_moveModule($id: ID!, $workspaceId: ID!) {
1526
1529
  moveModule(id: $id, workspaceId: $workspaceId) {
1527
1530
  ...moduleArguments
1528
1531
  }
1529
1532
  }
1530
1533
  ${el}
1531
- `),i$=ez((0,ea.default)`
1534
+ `),i_=eY((0,ea.default)`
1532
1535
  mutation ControllerClient_duplicateModule($id: ID!) {
1533
1536
  duplicateModule(id: $id) {
1534
1537
  ...moduleArguments
1535
1538
  }
1536
1539
  }
1537
1540
  ${el}
1538
- `),iv=ez((0,ea.default)`
1541
+ `),ig=eY((0,ea.default)`
1539
1542
  mutation ControllerClient_removeModule($id: ID!) {
1540
1543
  removeModule(id: $id)
1541
1544
  }
1542
- `),ih=ez((0,ea.default)`
1545
+ `),iy=eY((0,ea.default)`
1543
1546
  mutation ControllerClient_createConfigChangeOperation(
1544
1547
  $applicationId: ID!
1545
1548
  $config: JSON!
@@ -1550,11 +1553,11 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1550
1553
  }
1551
1554
  }
1552
1555
  ${em}
1553
- `),ib=ez((0,ea.default)`
1556
+ `),i$=eY((0,ea.default)`
1554
1557
  mutation ControllerClient_doOperation($id: ID!, $applicationId: ID!) {
1555
1558
  doOperation(id: $id, applicationId: $applicationId)
1556
1559
  }
1557
- `),iI=ez((0,ea.default)`
1560
+ `),iv=eY((0,ea.default)`
1558
1561
  mutation ControllerClient_updateOperation(
1559
1562
  $id: ID!
1560
1563
  $applicationId: ID!
@@ -1566,11 +1569,11 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1566
1569
  }
1567
1570
  }
1568
1571
  ${em}
1569
- `),ik=ez((0,ea.default)`
1572
+ `),ih=eY((0,ea.default)`
1570
1573
  mutation ControllerClient_removeOperation($id: ID!, $applicationId: ID!) {
1571
1574
  removeOperation(id: $id, applicationId: $applicationId)
1572
1575
  }
1573
- `),iD=ez((0,ea.default)`
1576
+ `),ib=eY((0,ea.default)`
1574
1577
  mutation ControllerClient_assignGroupPermissions(
1575
1578
  $roleId: String!
1576
1579
  $instanceType: String!
@@ -1584,18 +1587,18 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1584
1587
  permissions: $permissions
1585
1588
  )
1586
1589
  }
1587
- `),iA=(0,ea.default)`
1590
+ `),iI=(0,ea.default)`
1588
1591
  mutation ControllerClient_registerFCMNotification($workspaceId: ID!, $token: String!) {
1589
1592
  registerFCMNotification(workspaceId: $workspaceId, token: $token)
1590
1593
  }
1591
- `,iS=(0,ea.default)`
1594
+ `,ik=(0,ea.default)`
1592
1595
  mutation ControllerClient_registerRemoteDebug($deviceId: ID!) {
1593
1596
  registerRemoteDebug(deviceId: $deviceId) {
1594
1597
  deviceId
1595
1598
  token
1596
1599
  }
1597
1600
  }
1598
- `,iw=(0,ea.default)`
1601
+ `,iD=(0,ea.default)`
1599
1602
  mutation ControllerClient_shareAccessToken(
1600
1603
  $workspaceId: ID
1601
1604
  $passcode: String!
@@ -1603,7 +1606,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1603
1606
  ) {
1604
1607
  shareAccessToken(workspaceId: $workspaceId, passcode: $passcode, refreshToken: $refreshToken)
1605
1608
  }
1606
- `,iC=ez((0,ea.default)`
1609
+ `,iA=eY((0,ea.default)`
1607
1610
  mutation ControllerClient_addUserFavorite($instanceType: InstanceType!, $instanceId: ID!) {
1608
1611
  addUserFavorite(instanceType: $instanceType, instanceId: $instanceId) {
1609
1612
  _id
@@ -1616,11 +1619,11 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1616
1619
  last_modify_datetime
1617
1620
  }
1618
1621
  }
1619
- `),iT=ez((0,ea.default)`
1622
+ `),iS=eY((0,ea.default)`
1620
1623
  mutation ControllerClient_removeUserFavorite($instanceType: InstanceType!, $instanceId: ID!) {
1621
1624
  removeUserFavorite(instanceType: $instanceType, instanceId: $instanceId)
1622
1625
  }
1623
- `),ix=ez((0,ea.default)`
1626
+ `),iw=eY((0,ea.default)`
1624
1627
  mutation ControllerClient_changeWorkspaceSubscriptionPlan(
1625
1628
  $workspaceId: ID!
1626
1629
  $type: String!
@@ -1628,7 +1631,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1628
1631
  ) {
1629
1632
  changeWorkspaceSubscriptionPlan(workspaceId: $workspaceId, type: $type, period: $period)
1630
1633
  }
1631
- `),iB=ez((0,ea.default)`
1634
+ `),iC=eY((0,ea.default)`
1632
1635
  mutation ControllerClient_changeWorkspaceAdditionalLimitSpending(
1633
1636
  $workspaceId: ID!
1634
1637
  $boundDevicesLimit: Float
@@ -1640,7 +1643,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1640
1643
  groupMembersLimit: $groupMembersLimit
1641
1644
  )
1642
1645
  }
1643
- `),iE=(0,ea.default)`
1646
+ `),iT=(0,ea.default)`
1644
1647
  mutation ControllerClient_createWorkspaceOTP(
1645
1648
  $workspaceId: ID!
1646
1649
  $tokenTypes: [WorkspaceTokenType]!
@@ -1652,32 +1655,32 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1652
1655
  expired_datetime
1653
1656
  }
1654
1657
  }
1655
- `,iU=(0,ea.default)`
1658
+ `,ix=(0,ea.default)`
1656
1659
  mutation ControllerClient_revokeWorkspaceOTP($id: ID!) {
1657
1660
  revokeWorkspaceOTP(id: $id)
1658
1661
  }
1659
- `;function iM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(iM=function(){return!!e})()}var iR=function(e){function i(e,t){var n,a,o;return J(this,i),a=i,o=[e,t,"/api/graphql",p,u],a=Q(a),(n=X(this,iM()?Reflect.construct(a,o||[],Q(this).constructor):a.apply(this,o))).tokenType="user",n}return Z(i,e),H(i)}(ek),iP=(0,ea.default)`
1662
+ `;function iB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(iB=function(){return!!e})()}var iE=function(e){function i(e,t){var n,a,o;return J(this,i),a=i,o=[e,t,"/api/graphql",l,p],a=Q(a),(n=X(this,iB()?Reflect.construct(a,o||[],Q(this).constructor):a.apply(this,o))).tokenType="user",n}return Z(i,e),H(i)}(ek),iU=(0,ea.default)`
1660
1663
  query Workspace_workspace {
1661
1664
  workspace {
1662
1665
  ...mcpWorkspaceArguments
1663
1666
  }
1664
1667
  }
1665
1668
  ${eg}
1666
- `,iO=(0,ea.default)`
1669
+ `,iM=(0,ea.default)`
1667
1670
  query Workspace_applications($keyword: String, $paginate: Paginate) {
1668
1671
  applications(keyword: $keyword, paginate: $paginate) {
1669
1672
  ...mcpApplicationShortArguments
1670
1673
  }
1671
1674
  }
1672
1675
  ${ey}
1673
- `,iF=(0,ea.default)`
1676
+ `,iR=(0,ea.default)`
1674
1677
  query Workspace_application($id: ID!, $composed: Boolean, $debug: Boolean) {
1675
1678
  application(id: $id, composed: $composed, debug: $debug) {
1676
1679
  ...applicationArguments
1677
1680
  }
1678
1681
  }
1679
1682
  ${ed}
1680
- `,iN=(0,ea.default)`
1683
+ `,iP=(0,ea.default)`
1681
1684
  query Workspace_applicationByDevice(
1682
1685
  $deviceId: ID!
1683
1686
  $composeModule: Boolean
@@ -1694,42 +1697,42 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1694
1697
  }
1695
1698
  }
1696
1699
  ${ed}
1697
- `,iq=(0,ea.default)`
1700
+ `,iO=(0,ea.default)`
1698
1701
  query Workspace_modules($keyword: String, $paginate: Paginate) {
1699
1702
  modules(keyword: $keyword, paginate: $paginate) {
1700
1703
  ...moduleShortArguments
1701
1704
  }
1702
1705
  }
1703
1706
  ${ep}
1704
- `,iW=(0,ea.default)`
1707
+ `,iF=(0,ea.default)`
1705
1708
  query Workspace_module($id: ID!) {
1706
1709
  module(id: $id) {
1707
1710
  ...moduleArguments
1708
1711
  }
1709
1712
  }
1710
1713
  ${el}
1711
- `,ij=(0,ea.default)`
1714
+ `,iN=(0,ea.default)`
1712
1715
  query Workspace_devices($keyword: String, $paginate: Paginate) {
1713
1716
  devices(keyword: $keyword, paginate: $paginate) {
1714
1717
  ...deviceArguments
1715
1718
  }
1716
1719
  }
1717
1720
  ${er}
1718
- `,iV=(0,ea.default)`
1721
+ `,iq=(0,ea.default)`
1719
1722
  query Workspace_device($id: ID) {
1720
1723
  device(id: $id) {
1721
1724
  ...deviceArguments
1722
1725
  }
1723
1726
  }
1724
1727
  ${er}
1725
- `,iY=(0,ea.default)`
1728
+ `,iW=(0,ea.default)`
1726
1729
  query Workspace_devicesByApplication($id: ID!) {
1727
1730
  devicesByApplication(id: $id) {
1728
1731
  ...deviceArguments
1729
1732
  }
1730
1733
  }
1731
1734
  ${er}
1732
- `,iK=(0,ea.default)`
1735
+ `,ij=(0,ea.default)`
1733
1736
  query Workspace_deviceUsage($deviceId: ID, $startDate: Date, $endDate: Date) {
1734
1737
  deviceUsage(deviceId: $deviceId, startDate: $startDate, endDate: $endDate) {
1735
1738
  _id
@@ -1748,28 +1751,28 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1748
1751
  }
1749
1752
  }
1750
1753
  }
1751
- `,iG=(0,ea.default)`
1754
+ `,iV=(0,ea.default)`
1752
1755
  query Workspace_mediaWorkspace {
1753
1756
  mediaWorkspace {
1754
1757
  ...workspaceMediaWorkspaceArguments
1755
1758
  }
1756
1759
  }
1757
1760
  ${ev}
1758
- `,iL=(0,ea.default)`
1761
+ `,iK=(0,ea.default)`
1759
1762
  query Workspace_mediaBoxes {
1760
1763
  mediaBoxes {
1761
1764
  ...workspaceMediaBoxArguments
1762
1765
  }
1763
1766
  }
1764
1767
  ${eh}
1765
- `,iz=(0,ea.default)`
1768
+ `,iY=(0,ea.default)`
1766
1769
  query Workspace_mediaBox($boxId: ID!) {
1767
1770
  mediaBox(id: $boxId) {
1768
1771
  ...workspaceMediaBoxArguments
1769
1772
  }
1770
1773
  }
1771
1774
  ${eh}
1772
- `,iH=(0,ea.default)`
1775
+ `,iG=(0,ea.default)`
1773
1776
  query Workspace_mediaFiles(
1774
1777
  $boxId: ID!
1775
1778
  $includeTypes: [String]
@@ -1788,14 +1791,14 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1788
1791
  }
1789
1792
  }
1790
1793
  ${eb}
1791
- `,iJ=(0,ea.default)`
1794
+ `,iL=(0,ea.default)`
1792
1795
  query Workspace_mediaFile($id: ID!) {
1793
1796
  mediaFile(id: $id) {
1794
1797
  ...workspaceMediaFileArguments
1795
1798
  }
1796
1799
  }
1797
1800
  ${eb}
1798
- `,iX=(0,ea.default)`
1801
+ `,iz=(0,ea.default)`
1799
1802
  mutation Workspace_createApplication(
1800
1803
  $name: String
1801
1804
  $description: String
@@ -1813,7 +1816,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1813
1816
  }
1814
1817
  }
1815
1818
  ${ey}
1816
- `,iQ=(0,ea.default)`
1819
+ `,iH=(0,ea.default)`
1817
1820
  mutation Workspace_updateApplication(
1818
1821
  $id: ID!
1819
1822
  $config: String
@@ -1834,7 +1837,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1834
1837
  }
1835
1838
  }
1836
1839
  ${ey}
1837
- `,iZ=(0,ea.default)`
1840
+ `,iJ=(0,ea.default)`
1838
1841
  mutation Workspace_bindApplication($id: ID!, $bindDevices: [ID], $deviceFrames: JSON) {
1839
1842
  bindApplication(id: $id, bindDevices: $bindDevices, deviceFrames: $deviceFrames) {
1840
1843
  _id
@@ -1845,7 +1848,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1845
1848
  }
1846
1849
  }
1847
1850
  }
1848
- `,i0=(0,ea.default)`
1851
+ `,iX=(0,ea.default)`
1849
1852
  mutation Workspace_unbindApplication($id: ID!, $unbindDevices: [ID]) {
1850
1853
  bindApplication(id: $id, unbindDevices: $unbindDevices) {
1851
1854
  _id
@@ -1856,7 +1859,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1856
1859
  }
1857
1860
  }
1858
1861
  }
1859
- `,i1=(0,ea.default)`
1862
+ `,iQ=(0,ea.default)`
1860
1863
  mutation Workspace_createModule(
1861
1864
  $name: String
1862
1865
  $description: String
@@ -1879,7 +1882,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1879
1882
  }
1880
1883
  }
1881
1884
  ${el}
1882
- `,i4=(0,ea.default)`
1885
+ `,iZ=(0,ea.default)`
1883
1886
  mutation Workspace_updateModule(
1884
1887
  $id: ID!
1885
1888
  $config: String
@@ -1898,7 +1901,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1898
1901
  }
1899
1902
  }
1900
1903
  ${el}
1901
- `,i6=(0,ea.default)`
1904
+ `,i0=(0,ea.default)`
1902
1905
  mutation Workspace_createMediaFileUploadRequest(
1903
1906
  $name: String!
1904
1907
  $description: String!
@@ -1929,7 +1932,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1929
1932
  }
1930
1933
  }
1931
1934
  }
1932
- `,i2=(0,ea.default)`
1935
+ `,i1=(0,ea.default)`
1933
1936
  mutation Workspace_updateMediaFile(
1934
1937
  $id: ID!
1935
1938
  $name: String
@@ -1951,7 +1954,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1951
1954
  updatedAt
1952
1955
  }
1953
1956
  }
1954
- `,i5=(0,ea.default)`
1957
+ `,i4=(0,ea.default)`
1955
1958
  mutation Workspace_updateMediaFiles(
1956
1959
  $fileIds: [ID!]!
1957
1960
  $name: String
@@ -1960,23 +1963,23 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1960
1963
  ) {
1961
1964
  updateMediaFiles(fileIds: $fileIds, name: $name, description: $description, userTags: $userTags)
1962
1965
  }
1963
- `,i9=(0,ea.default)`
1966
+ `,i6=(0,ea.default)`
1964
1967
  mutation Workspace_setMediaFileAsBoxPreview($id: ID!) {
1965
1968
  setMediaFileAsBoxPreview(id: $id)
1966
1969
  }
1967
- `,i3=(0,ea.default)`
1970
+ `,i2=(0,ea.default)`
1968
1971
  mutation Workspace_copyMediaFiles($fromBoxId: ID!, $toBoxId: ID!, $fileIds: [ID!]!) {
1969
1972
  copyMediaFiles(fromBoxId: $fromBoxId, toBoxId: $toBoxId, fileIds: $fileIds)
1970
1973
  }
1971
- `,i8=(0,ea.default)`
1974
+ `,i5=(0,ea.default)`
1972
1975
  mutation Workspace_deleteMediaFiles($boxId: ID!, $fileIds: [ID!]!) {
1973
1976
  deleteMediaFiles(boxId: $boxId, fileIds: $fileIds)
1974
1977
  }
1975
- `,i7=(0,ea.default)`
1978
+ `,i9=(0,ea.default)`
1976
1979
  mutation Workspace_deleteMediaBoxFiles($boxId: ID!, $includeTypes: [String]) {
1977
1980
  deleteMediaBoxFiles(boxId: $boxId, includeTypes: $includeTypes)
1978
1981
  }
1979
- `;function te(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(te=function(){return!!e})()}var ti=function(e){function i(e,t){var n,a,o;return J(this,i),a=i,o=[e,t,"/api/graphql-workspace",m,_],a=Q(a),(n=X(this,te()?Reflect.construct(a,o||[],Q(this).constructor):a.apply(this,o))).tokenType="workspace",n}return Z(i,e),H(i)}(ek),tt=t(19074),tn=t(36054),ta=t(78342),to=t(74114),tr=t(42028),ts=t(99815),td=t(79556),tc=t(17681),tl=t.n(tc),tp=t(10655);let tu=(0,ea.default)`
1982
+ `;function i3(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(i3=function(){return!!e})()}var i8=function(e){function i(e,t){var n,a,o;return J(this,i),a=i,o=[e,t,"/api/graphql-workspace",u,m],a=Q(a),(n=X(this,i3()?Reflect.construct(a,o||[],Q(this).constructor):a.apply(this,o))).tokenType="workspace",n}return Z(i,e),H(i)}(ek),i7=t(19074),te=t(36054),ti=t(78342),tt=t(74114),tn=t(42028),ta=t(99815),to=t(79556),tr=t(17681),ts=t.n(tr),td=t(10655);let tc=(0,ea.default)`
1980
1983
  fragment mediaWorkspaceArguments on MediaWorkspace {
1981
1984
  __typename
1982
1985
  id
@@ -1990,7 +1993,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
1990
1993
  sizeLimit
1991
1994
  aiFeaturesEnabled
1992
1995
  }
1993
- `,tm=(0,ea.default)`
1996
+ `,tl=(0,ea.default)`
1994
1997
  fragment boxArguments on MediaBox {
1995
1998
  __typename
1996
1999
  id
@@ -2015,7 +2018,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2015
2018
  previewUrl
2016
2019
  size
2017
2020
  }
2018
- `,t_=(0,ea.default)`
2021
+ `,tp=(0,ea.default)`
2019
2022
  fragment fileArguments on MediaFile {
2020
2023
  __typename
2021
2024
  id
@@ -2072,7 +2075,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2072
2075
  createdAt
2073
2076
  updatedAt
2074
2077
  }
2075
- `,tg=(0,ea.default)`
2078
+ `,tu=(0,ea.default)`
2076
2079
  fragment fileShortArguments on MediaFile {
2077
2080
  __typename
2078
2081
  id
@@ -2120,35 +2123,35 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2120
2123
  createdAt
2121
2124
  updatedAt
2122
2125
  }
2123
- `,tf=(0,ea.default)`
2126
+ `,tm=(0,ea.default)`
2124
2127
  query MediaClient_workspaces {
2125
2128
  mediaWorkspaces {
2126
2129
  ...mediaWorkspaceArguments
2127
2130
  }
2128
2131
  }
2129
- ${tu}
2130
- `,ty=(0,ea.default)`
2132
+ ${tc}
2133
+ `,t_=(0,ea.default)`
2131
2134
  query MediaClient_boxes($workspaceId: UUID, $filter: String) {
2132
2135
  mediaBoxes(workspaceId: $workspaceId, filter: $filter) {
2133
2136
  ...boxArguments
2134
2137
  }
2135
2138
  }
2136
- ${tm}
2137
- `,t$=(0,ea.default)`
2139
+ ${tl}
2140
+ `,tg=(0,ea.default)`
2138
2141
  query MediaClient_workspace($workspaceId: UUID!) {
2139
2142
  mediaWorkspace(id: $workspaceId) {
2140
2143
  ...mediaWorkspaceArguments
2141
2144
  }
2142
2145
  }
2143
- ${tu}
2144
- `,tv=(0,ea.default)`
2146
+ ${tc}
2147
+ `,tf=(0,ea.default)`
2145
2148
  query MediaClient_box($boxId: UUID!) {
2146
2149
  mediaBox(boxId: $boxId) {
2147
2150
  ...boxArguments
2148
2151
  }
2149
2152
  }
2150
- ${tm}
2151
- `,th=(0,ea.default)`
2153
+ ${tl}
2154
+ `,ty=(0,ea.default)`
2152
2155
  query MediaClient_files(
2153
2156
  $boxId: UUID!
2154
2157
  $includeTypes: [FileType!]
@@ -2166,29 +2169,29 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2166
2169
  ...fileShortArguments
2167
2170
  }
2168
2171
  }
2169
- ${tg}
2170
- `,tb=(0,ea.default)`
2172
+ ${tu}
2173
+ `,t$=(0,ea.default)`
2171
2174
  query MediaClient_file($fileId: UUID!) {
2172
2175
  mediaFile(fileId: $fileId) {
2173
2176
  ...fileArguments
2174
2177
  }
2175
2178
  }
2176
- ${t_}
2177
- `,tI=(0,ea.default)`
2179
+ ${tp}
2180
+ `,tv=(0,ea.default)`
2178
2181
  mutation MediaClient_createMediaWorkspace($name: String!, $description: String!) {
2179
2182
  createMediaWorkspace(name: $name, description: $description) {
2180
2183
  ...mediaWorkspaceArguments
2181
2184
  }
2182
2185
  }
2183
- ${tu}
2184
- `,tk=(0,ea.default)`
2186
+ ${tc}
2187
+ `,th=(0,ea.default)`
2185
2188
  mutation MediaClient_updateMediaWorkspace($id: UUID!, $name: String, $description: String) {
2186
2189
  updateMediaWorkspace(id: $id, name: $name, description: $description) {
2187
2190
  ...mediaWorkspaceArguments
2188
2191
  }
2189
2192
  }
2190
- ${tu}
2191
- `,tD=(0,ea.default)`
2193
+ ${tc}
2194
+ `,tb=(0,ea.default)`
2192
2195
  mutation MediaClient_createMediaBox(
2193
2196
  $name: String!
2194
2197
  $description: String!
@@ -2206,15 +2209,15 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2206
2209
  ...boxArguments
2207
2210
  }
2208
2211
  }
2209
- ${tm}
2210
- `,tA=(0,ea.default)`
2212
+ ${tl}
2213
+ `,tI=(0,ea.default)`
2211
2214
  mutation MediaClient_moveMediaBox($id: UUID!, $workspaceId: UUID) {
2212
2215
  moveMediaBox(id: $id, workspaceId: $workspaceId) {
2213
2216
  ...boxArguments
2214
2217
  }
2215
2218
  }
2216
- ${tm}
2217
- `,tS=(0,ea.default)`
2219
+ ${tl}
2220
+ `,tk=(0,ea.default)`
2218
2221
  mutation MediaClient_updateMediaBox(
2219
2222
  $id: UUID!
2220
2223
  $name: String
@@ -2234,8 +2237,8 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2234
2237
  ...boxArguments
2235
2238
  }
2236
2239
  }
2237
- ${tm}
2238
- `,tw=(0,ea.default)`
2240
+ ${tl}
2241
+ `,tD=(0,ea.default)`
2239
2242
  mutation MediaClient_requestFileUpload(
2240
2243
  $name: String!
2241
2244
  $description: String!
@@ -2257,8 +2260,8 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2257
2260
  ...fileArguments
2258
2261
  }
2259
2262
  }
2260
- ${t_}
2261
- `,tC=(0,ea.default)`
2263
+ ${tp}
2264
+ `,tA=(0,ea.default)`
2262
2265
  mutation MediaClient_updateMediaFile(
2263
2266
  $fileId: UUID!
2264
2267
  $name: String!
@@ -2276,8 +2279,8 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2276
2279
  ...fileArguments
2277
2280
  }
2278
2281
  }
2279
- ${t_}
2280
- `,tT=(0,ea.default)`
2282
+ ${tp}
2283
+ `,tS=(0,ea.default)`
2281
2284
  mutation MediaClient_updateMediaFiles(
2282
2285
  $fileIds: [UUID!]!
2283
2286
  $name: String
@@ -2286,19 +2289,19 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2286
2289
  ) {
2287
2290
  updateMediaFiles(fileIds: $fileIds, name: $name, description: $description, userTags: $userTags)
2288
2291
  }
2289
- `,tx=(0,ea.default)`
2292
+ `,tw=(0,ea.default)`
2290
2293
  mutation MediaClient_deleteMediaFiles($boxId: UUID!, $list: [UUID!]!) {
2291
2294
  deleteMediaFiles(boxId: $boxId, list: $list)
2292
2295
  }
2293
- `,tB=(0,ea.default)`
2296
+ `,tC=(0,ea.default)`
2294
2297
  mutation MediaClient_copyMediaFiles($fromBoxId: UUID!, $toBoxId: UUID!, $list: [UUID!]!) {
2295
2298
  copyMediaFiles(fromBoxId: $fromBoxId, toBoxId: $toBoxId, list: $list)
2296
2299
  }
2297
- `,tE=(0,ea.default)`
2300
+ `,tT=(0,ea.default)`
2298
2301
  mutation MediaClient_setMediaFileAsBoxPreview($id: UUID!) {
2299
2302
  setMediaFileAsBoxPreview(id: $id)
2300
2303
  }
2301
- `,tU=(0,ea.default)`
2304
+ `,tx=(0,ea.default)`
2302
2305
  mutation MediaClient_assignGroupPermissions(
2303
2306
  $roleId: String!
2304
2307
  $instanceType: InstanceType!
@@ -2312,7 +2315,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2312
2315
  permissions: $permissions
2313
2316
  )
2314
2317
  }
2315
- `,tM=(0,ea.default)`
2318
+ `,tB=(0,ea.default)`
2316
2319
  subscription MediaClient_listenBoxChanged($boxId: UUID!, $types: [ChangeType!]) {
2317
2320
  mediaBoxChanged(boxId: $boxId, types: $types) {
2318
2321
  createType
@@ -2326,15 +2329,15 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2326
2329
  }
2327
2330
  }
2328
2331
  }
2329
- ${t_}
2330
- `,tR=(0,ea.default)`
2332
+ ${tp}
2333
+ `,tE=(0,ea.default)`
2331
2334
  query MediaClient_box($boxId: UUID!, $passcode: String!) {
2332
2335
  mediaBox(boxId: $boxId, passcode: $passcode) {
2333
2336
  ...boxArguments
2334
2337
  }
2335
2338
  }
2336
- ${tm}
2337
- `,tP=(0,ea.default)`
2339
+ ${tl}
2340
+ `,tU=(0,ea.default)`
2338
2341
  query MediaClient_files(
2339
2342
  $boxId: UUID!
2340
2343
  $passcode: String!
@@ -2354,15 +2357,15 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2354
2357
  ...fileShortArguments
2355
2358
  }
2356
2359
  }
2357
- ${tg}
2358
- `,tO=(0,ea.default)`
2360
+ ${tu}
2361
+ `,tM=(0,ea.default)`
2359
2362
  query MediaClient_file($fileId: UUID!, $passcode: String!) {
2360
2363
  mediaFile(fileId: $fileId, passcode: $passcode) {
2361
2364
  ...fileArguments
2362
2365
  }
2363
2366
  }
2364
- ${t_}
2365
- `,tF=(0,ea.default)`
2367
+ ${tp}
2368
+ `,tR=(0,ea.default)`
2366
2369
  mutation MediaClient_requestFileUpload(
2367
2370
  $name: String!
2368
2371
  $description: String!
@@ -2386,8 +2389,8 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2386
2389
  ...fileArguments
2387
2390
  }
2388
2391
  }
2389
- ${t_}
2390
- `,tN=(0,ea.default)`
2392
+ ${tp}
2393
+ `,tP=(0,ea.default)`
2391
2394
  mutation MediaClient_updateMediaFile(
2392
2395
  $boxId: UUID!
2393
2396
  $passcode: String!
@@ -2409,8 +2412,8 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2409
2412
  ...fileArguments
2410
2413
  }
2411
2414
  }
2412
- ${t_}
2413
- `,tq=(0,ea.default)`
2415
+ ${tp}
2416
+ `,tO=(0,ea.default)`
2414
2417
  mutation MediaClient_updateMediaFiles(
2415
2418
  $boxId: UUID!
2416
2419
  $passcode: String!
@@ -2428,11 +2431,11 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2428
2431
  userTags: $userTags
2429
2432
  )
2430
2433
  }
2431
- `,tW=(0,ea.default)`
2434
+ `,tF=(0,ea.default)`
2432
2435
  mutation MediaClient_deleteMediaFiles($boxId: UUID!, $passcode: String!, $list: [UUID!]!) {
2433
2436
  deleteMediaFiles(boxId: $boxId, passcode: $passcode, list: $list)
2434
2437
  }
2435
- `,tj=(0,ea.default)`
2438
+ `,tN=(0,ea.default)`
2436
2439
  subscription MediaClient_listenBoxChanged(
2437
2440
  $boxId: UUID!
2438
2441
  $passcode: String!
@@ -2450,8 +2453,8 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2450
2453
  }
2451
2454
  }
2452
2455
  }
2453
- ${t_}
2454
- `,tV={query:"query",mutation:"mutate"},tY=(e,i,t)=>([n,a])=>{if(e[n])throw Error(`Overwriting client.${n}`);e[n]=async(o,r={})=>{let s,d,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{let t=await e[tV[i]](c);({data:s,errors:d}=t||{})}if(d)throw Error(d.map(e=>e.message).join("\n"));return s?s[n]:null}},tK=e=>({data:i,errors:t})=>{var n;let a=(n=!i?.mediaBoxChanged&&"Missing mediaBoxChanged payload",t?.length?Error(t.map(e=>e.message).join("\n")):n?Error(n):null);return a?e(a):e(null,i.mediaBoxChanged)};var tG=`
2456
+ ${tp}
2457
+ `,tq={query:"query",mutation:"mutate"},tW=(e,i,t)=>([n,a])=>{if(e[n])throw Error(`Overwriting client.${n}`);e[n]=async(o,r={})=>{let s,d,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{let t=await e[tq[i]](c);({data:s,errors:d}=t||{})}if(d)throw Error(d.map(e=>e.message).join("\n"));return s?s[n]:null}},tj=e=>({data:i,errors:t})=>{var n;let a=(n=!i?.mediaBoxChanged&&"Missing mediaBoxChanged payload",t?.length?Error(t.map(e=>e.message).join("\n")):n?Error(n):null);return a?e(a):e(null,i.mediaBoxChanged)};var tV=`
2455
2458
  query AL_events($filter: EventsFilter!) {
2456
2459
  events(filter: $filter) {
2457
2460
  device_id
@@ -2463,13 +2466,13 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
2463
2466
  timestamp
2464
2467
  }
2465
2468
  }
2466
- `,tL=`
2469
+ `,tK=`
2467
2470
  query AL_screenshots($filter: ScreenshotFilter!) {
2468
2471
  screenshots(filter: $filter) {
2469
2472
  timestamp
2470
2473
  }
2471
2474
  }
2472
- `,tz=H(function e(i,t){J(this,e),this.baseUrl=i,this.token=t,this.graphqlUrl=`${i}/api/graphql`},[{key:"graphql",value:(o=v(function*(e,i){var t=yield(0,B.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 Error(`Activity-log query failed (${t.status}): ${n}`)}var a=yield t.json();if(a.errors?.length)throw Error(a.errors.map(e=>e.message).join("\n"));return a.data}),function(e,i){return o.apply(this,arguments)})},{key:"events",value:(r=v(function*(e,{limit:i,offset:t}={}){var n={...e};return null!=i&&(n.limit=i),null!=t&&(n.offset=t),(yield this.graphql(tG,{filter:n})).events}),function(e){return r.apply(this,arguments)})},{key:"screenshots",value:(s=v(function*(e){return(yield this.graphql(tL,{filter:e})).screenshots}),function(e){return s.apply(this,arguments)})},{key:"downloadScreenshot",value:(d=v(function*(e,i,t){var n=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(i)}/screenshot?ts=${encodeURIComponent(t)}`,a=yield(0,B.Ay)(n,{headers:{Authorization:`Bearer ${this.token}`}});if(!a.ok){var o=yield a.text().catch(()=>"");throw Error(`Screenshot fetch failed (${a.status}): ${o}`)}return Buffer.from((yield a.arrayBuffer()))}),function(e,i,t){return d.apply(this,arguments)})}]);process.env.STAGE,process.env.URL_BASE;var tH="bricks-mcp",tJ={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"};process.env.AUTH0_DOMAIN,process.env.CACHE_URL;var tX=t(1639);let tQ=({type:e,title:i,template_key:t})=>{var n,a,o=(0,tX.M4)(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=V(j.Ji);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,tX.M4)("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=V(j.dK.Basic),d=V(j.brickMapping[t]);if(!d)throw 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 l=V(j.generatorMapping[t]);if(!l)throw Error(`Generator ${t} not found`);n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(l.propTypes).map(([e,i])=>[e,{...i,description:l.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(l.eventTypes).map(([e])=>[e,{description:l.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(l.outletTypes).map(([e])=>[e,{description:l.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(j.qJ.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 p=(0,tX.M4)("property_bank_command"),u=(0,tX.M4)("property_bank_command"),m=(0,tX.M4)("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> | ${p}`,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> | ${p}`,port:"obj | inputs"}]}},[p]:{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:p,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:p,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 T({id:o,example:n,extraInfo:a})};var tZ="2.25.0-beta.6";function t0(){return t1.apply(this,arguments)}function t1(){return(t1=v(function*(e={}){var i,t=e.token||process.env.BRICKS_API_TOKEN;if(!t)throw console.error("Error: API token is required"),console.error("Please provide a token via options or set BRICKS_API_TOKEN environment variable"),Error("API token is required");var n=function(e){try{var i=e.queryStringParameters?.token;if(!i){var t=new Headers(e.headers);i=t.get("authorization")?.replace("Bearer ","")}if(!i)return{success:!1,message:"Authentication failed: No token provided"};var n=function(e){try{var i=e.split(".");if(i.length<3)return null;var t=JSON.parse(Buffer.from(i[0],"base64url").toString());if(!D.includes(t?.alg))return null;return JSON.parse(Buffer.from(i[1],"base64url").toString())}catch{return null}}(i);if(!n)return{success:!1,message:"Authentication failed: Invalid token"};var a=A.includes(n.iss)?"user":"workspace";if("workspace"===a){var o=Array.isArray(n.t)?n.t:[];n.permissions=o.reduce((e,i)=>{var t=k[i];return t&&e.push(t),e},[])}else n.permissions=Object.keys(I);return{success:!0,token:i,tokenInfo:n,tokenType:a}}catch(e){return{success:!1,message:`Authentication failed: ${e.message}`}}}({queryStringParameters:{token:t}});if(!n.success)throw console.error("Error: Invalid BRICKS_API_TOKEN"),console.error(n.message),Error("Invalid BRICKS_API_TOKEN");var a=new h._({name:tH,version:tZ}),o={...n,client:function(e,i,t){switch(t){case"user":return new iR(e,i);case"workspace":return new ti(e,i);default:throw Error(`Invalid token type: ${t}.`)}}(tJ.bricks,n.token,n.tokenType)};a.prompt("getting-started","Getting started with BRICKS",{},v(function*(){return{messages:[{role:"user",content:{type:"text",text:`Welcome to BRICKS — start here.
2475
+ `,tY=H(function e(i,t){J(this,e),this.baseUrl=i,this.token=t,this.graphqlUrl=`${i}/api/graphql`},[{key:"graphql",value:(o=$(function*(e,i){var t=yield(0,x.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 Error(`Activity-log query failed (${t.status}): ${n}`)}var a=yield t.json();if(a.errors?.length)throw Error(a.errors.map(e=>e.message).join("\n"));return a.data}),function(e,i){return o.apply(this,arguments)})},{key:"events",value:(r=$(function*(e,{limit:i,offset:t}={}){var n={...e};return null!=i&&(n.limit=i),null!=t&&(n.offset=t),(yield this.graphql(tV,{filter:n})).events}),function(e){return r.apply(this,arguments)})},{key:"screenshots",value:(s=$(function*(e){return(yield this.graphql(tK,{filter:e})).screenshots}),function(e){return s.apply(this,arguments)})},{key:"downloadScreenshot",value:(d=$(function*(e,i,t){var n=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(i)}/screenshot?ts=${encodeURIComponent(t)}`,a=yield(0,x.Ay)(n,{headers:{Authorization:`Bearer ${this.token}`}});if(!a.ok){var o=yield a.text().catch(()=>"");throw Error(`Screenshot fetch failed (${a.status}): ${o}`)}return Buffer.from((yield a.arrayBuffer()))}),function(e,i,t){return d.apply(this,arguments)})}]);process.env.STAGE,process.env.URL_BASE;var tG="bricks-mcp",tL={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"};process.env.AUTH0_DOMAIN,process.env.CACHE_URL;var tz=t(1639);let tH=({type:e,title:i,template_key:t})=>{var n,a,o=(0,tz.M4)(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=V(j.Ji);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,tz.M4)("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=V(j.dK.Basic),d=V(j.brickMapping[t]);if(!d)throw 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:{}};break;case"generator":var l=V(j.generatorMapping[t]);if(!l)throw Error(`Generator ${t} not found`);n={title:i,template_key:t,property:{$definitions:Object.fromEntries(Object.entries(l.propTypes).map(([e,i])=>[e,{...i,description:l.brickPropDescriptions[e]}]))},event_map:{$definitions:Object.fromEntries(Object.entries(l.eventTypes).map(([e])=>[e,{description:l.brickEventDescriptions[e]}]))},outlet:{$definitions:Object.fromEntries(Object.entries(l.outletTypes).map(([e])=>[e,{description:l.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(j.qJ.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 p=(0,tz.M4)("property_bank_command"),u=(0,tz.M4)("property_bank_command"),m=(0,tz.M4)("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> | ${p}`,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> | ${p}`,port:"obj | inputs"}]}},[p]:{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:p,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:p,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 C({id:o,example:n,extraInfo:a})};var tJ="2.25.0-beta.60";function tX(){return tQ.apply(this,arguments)}function tQ(){return(tQ=$(function*(e={}){var i,t=e.token||process.env.BRICKS_API_TOKEN;if(!t)throw console.error("Error: API token is required"),console.error("Please provide a token via options or set BRICKS_API_TOKEN environment variable"),Error("API token is required");var n=function(e){try{var i=e.queryStringParameters?.token;if(!i){var t=new Headers(e.headers);i=t.get("authorization")?.replace("Bearer ","")}if(!i)return{success:!1,message:"Authentication failed: No token provided"};var n=function(e){try{var i=e.split(".");if(i.length<3)return null;var t=JSON.parse(Buffer.from(i[0],"base64url").toString());if(!k.includes(t?.alg))return null;return JSON.parse(Buffer.from(i[1],"base64url").toString())}catch{return null}}(i);if(!n)return{success:!1,message:"Authentication failed: Invalid token"};var a=D.includes(n.iss)?"user":"workspace";if("workspace"===a){var o=Array.isArray(n.t)?n.t:[];n.permissions=o.reduce((e,i)=>{var t=I[i];return t&&e.push(t),e},[])}else n.permissions=Object.keys(b);return{success:!0,token:i,tokenInfo:n,tokenType:a}}catch(e){return{success:!1,message:`Authentication failed: ${e.message}`}}}({queryStringParameters:{token:t}});if(!n.success)throw console.error("Error: Invalid BRICKS_API_TOKEN"),console.error(n.message),Error("Invalid BRICKS_API_TOKEN");var a=new v._({name:tG,version:tJ}),o={...n,client:function(e,i,t){switch(t){case"user":return new iE(e,i);case"workspace":return new i8(e,i);default:throw Error(`Invalid token type: ${t}.`)}}(tL.bricks,n.token,n.tokenType)};a.prompt("getting-started","Getting started with BRICKS",{},$(function*(){return{messages:[{role:"user",content:{type:"text",text:`Welcome to BRICKS — start here.
2473
2476
 
2474
2477
  Before doing any complex work (application design, deployments, etc.),
2475
2478
  always consult the official docs rather than guessing.
@@ -2507,7 +2510,7 @@ Quick actions:
2507
2510
  - "Deploy an application to a device" → use the \`deploy-to-device\` prompt
2508
2511
 
2509
2512
  Try asking:
2510
- - "Draft a plan to create an app with a text display and deploy it; ask any missing questions first"`}}]}})),a.prompt("create-application","Create a new BRICKS application with guided setup",{app_name:S.Yj().describe("Name for the new application"),description:S.Yj().describe("Short description for the new application").optional()},(i=v(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}".
2513
+ - "Draft a plan to create an app with a text display and deploy it; ask any missing questions first"`}}]}})),a.prompt("create-application","Create a new BRICKS application with guided setup",{app_name:A.Yj().describe("Name for the new application"),description:A.Yj().describe("Short description for the new application").optional()},(i=$(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}".
2511
2514
 
2512
2515
  ${t?`Goal: ${t}`:""}
2513
2516
 
@@ -2540,4 +2543,4 @@ What I'll produce first:
2540
2543
  - Short recap of requirements
2541
2544
  - Clarifying questions (only what's necessary)
2542
2545
  - High-level architecture plan
2543
- - Minimal config skeleton that validates against the schema`}}]}}),function(e){return i.apply(this,arguments)})),a.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"},v(function*(){return T(w,{uri:"file://docs/getting-started.md",mimeType:"text/markdown"})})),function(e,i){var t,n="user"===i.tokenType,a=((e,i=null)=>({name:t,description:n,inputSchema:a,permission:o},r)=>{(!o||i.tokenInfo.permissions?.includes(o)||0)&&e.tool(t,n,a,r)})(e,i),o=e=>({...e,...n?{workspace_id:S.Yj().describe("Workspace ID")}:{}}),r=i.client,s=n?function(e){var i=e.endpoint,t=e.accessToken;if(!i)throw Error("Media API endpoint is required");if(!t)throw Error("Access token is required");return((e={})=>{let i=(({endpoint:e="http://localhost:3002",accessToken:i,boxId:t,passcode:n,enableSubscription:a=!0,enableRetry:o=!0,subscriptionOnConnectionOrError:r,onNetworkError:s}={})=>{let d,c,l,p=t&&n,u=`${e}/api/graphql`;return p&&(u=`${e}/api/graphql_with_passcode`),d=function({endpointURL:e,subscriptionEndpointURL:i,accessToken:t,boxId:n,passcode:a,origin:o,enableSubscription:r,enableRetry:s=!0,subscriptionOnConnectionOrError:d,onNetworkError:c=()=>{}}){let l,p,u,m,_={};o&&(_.origin=o),n&&a||(_.authorization=`Bearer ${t}`);let g=new to.z({uri:e,headers:_}),f=()=>{m&&(clearTimeout(m),m=void 0)};r&&(l=(0,ts.UU)({url:i,lazy:!0,connectionParams:_,retryAttempts:1/0,shouldRetry:()=>!0,keepAlive:1e4,on:{error:e=>{f(),d?.(e)},opened:e=>{d?.(),u=e,f()},ping:e=>{e||(f(),m=setTimeout(()=>{u&&u.readyState===WebSocket.OPEN&&u.close(4205,"Client Restart")},5e3))},pong:e=>{e&&f()},closed:()=>{f()}}}),p=new tr.c(l));let y=tt.C.from([(0,td.S)(({networkError:e,operation:i})=>{if(e){c(e,i);let t=e?.message||"";if("Aborted"===t||e?.name==="AbortError"||t.includes("Too many requests")||e?.response?.status===429||e?.statusCode===429||e?.status===429||"Timeout exceeded"===t||e?.timeout||e?.statusCode===403||e?.status===403)return new tn.c(e=>e.complete())}}),s&&new ta.z({attempts:{max:3,retryIf:e=>{let i="string"==typeof e?.message?e.message:"string"==typeof e?e:"";return!(!e||i.includes("Too many requests")||e?.response?.status===429||e?.statusCode===429||e?.status===429||e?.statusCode===403||e?.status===403||e?.timeout||"Timeout exceeded"===i)&&"Aborted"!==i&&e?.name!=="AbortError"}}}),new(tl())(3e4),r?tt.C.split(({query:e})=>{let{kind:i,operation:t}=(0,tp.Vn)(e);return"OperationDefinition"===i&&"subscription"===t},p,g):g].filter(Boolean));return y.closeSubscriptionClient=()=>r&&l.dispose(),y}({endpointURL:u,subscriptionEndpointURL:u.replace("http:","ws:"),accessToken:i,enableSubscription:!p&&a,enableRetry:o,subscriptionOnConnectionOrError:r,onNetworkError:s}),c=new et.D,(l=new ei.R({link:d,cache:c,defaultOptions:{watchQuery:{fetchPolicy:"no-cache",errorPolicy:"ignore"},query:{fetchPolicy:"no-cache",errorPolicy:"all"}}})).close=()=>d.closeSubscriptionClient(),l})(e);if(e.boxId&&e.passcode){i.type="passcode",i.queries=y,i.mutations=$;let t={boxId:e.boxId,passcode:e.passcode};Object.entries(y).forEach(tY(i,"query",t)),Object.entries($).forEach(tY(i,"mutation",t)),i.listenBoxChanged=(e,n)=>i.subscribe({query:tj,variables:{...t,...e}}).subscribe({next:tK(n),error(e){n(e)}})}else i.accessToken=e.accessToken,i.type="token",i.queries=g,i.mutations=f,Object.entries(g).forEach(tY(i,"query")),Object.entries(f).forEach(tY(i,"mutation")),i.listenBoxChanged=(e,t)=>i.subscribe({query:tM,variables:e}).subscribe({next:tK(t),error(e){t(e)}});return i})({endpoint:i,accessToken:t,enableSubscription:!1,enableRetry:!0})}({endpoint:tJ.media,accessToken:i.token}):r;if(n&&e.tool("list_workspaces","List all workspaces",{},v(function*(){return T((yield r.workspaces()))})),a({name:"get_workspace_overview",description:"Get comprehensive overview of the BRICKS workspace including stats and summary",inputSchema:o({}),permission:"info"},(d=v(function*({workspace_id:e}){var i=x((yield Promise.all([r.workspace({id:e}),r.applications({workspaceId:e,paginate:{limit:50,offset:0}}),r.modules({workspaceId:e,paginate:{limit:50,offset:0}}),r.devices({workspaceId:e,paginate:{limit:50,offset:0}}),n?s.mediaWorkspace({workspaceId:e}).catch(()=>null):s.mediaWorkspace().catch(()=>null),n?s.mediaBoxes({workspaceId:e}).catch(()=>[]):s.mediaBoxes().catch(()=>[])])),6),t=i[0],a=i[1],o=i[2],d=i[3],c=i[4],l=i[5];if(!t)throw Error("Authentication failed, please check your token");return T({workspace:t,stats:{applications:a?.length??"No permission",modules:o?.length??"No permission",devices:d?.length??"No permission",running_apps:a?.filter(e=>e.status?.running).length??"No permission",media_boxes:l?.length??"No permission",media_enabled:!!c,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:c?{workspace_id:c.id,name:c.name,size_used:c.size,size_limit:c.sizeLimit,boxes:l?.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 d.apply(this,arguments)})),a({name:"get_applications",description:"List all applications in the workspace",inputSchema:o({limit:S.ai().describe("Maximum number of applications to return").optional().default(50),offset:S.ai().describe("Number of applications to skip").optional().default(0)}),permission:"query_application"},(c=v(function*({workspace_id:e,limit:i=50,offset:t=0}){return T((yield r.applications({workspaceId:e,paginate:{limit:i,offset:t}})))}),function(e){return c.apply(this,arguments)})),a({name:"get_application",description:"Get detailed info and config of a specific application",inputSchema:o({id:S.Yj().describe("Application ID")}),permission:"query_application"},(l=v(function*({workspace_id:e,id:i}){return T((yield r.application({workspaceId:e,id:i})))}),function(e){return l.apply(this,arguments)})),a({name:"get_modules",description:"List all modules in the workspace",inputSchema:o({limit:S.ai().describe("Maximum number of modules to return").optional().default(50),offset:S.ai().describe("Number of modules to skip").optional().default(0)}),permission:"query_module"},(p=v(function*({workspace_id:e,limit:i=50,offset:t=0}){return T((yield r.modules({workspaceId:e,paginate:{limit:i,offset:t}})))}),function(e){return p.apply(this,arguments)})),a({name:"get_module",description:"Get detailed info and config of a specific module",inputSchema:o({id:S.Yj().describe("Module ID")}),permission:"query_module"},(u=v(function*({workspace_id:e,id:i}){return T((yield r.module({workspaceId:e,id:i})))}),function(e){return u.apply(this,arguments)})),a({name:"update_module_info",description:"Update a specific module info",inputSchema:o({id:S.Yj().describe("Module ID"),name:S.Yj().describe("Module name"),description:S.Yj().describe("Module description")}),permission:"update_module"},(m=v(function*({workspace_id:e,id:i,name:t,description:n}){return T((yield r.updateModule({workspaceId:e,id:i,name:t,description:n})))}),function(e){return m.apply(this,arguments)})),a({name:"update_module_config",description:"Update a specific module configuration",inputSchema:o({id:S.Yj().describe("Module ID"),config:S.Ik({}).passthrough().describe("New configuration object, see file://docs/config-schema.md for schema reference")}),permission:"update_module"},(_=v(function*({workspace_id:e,id:i,config:t}){var n=yield q(t);if(!n.valid)throw Error(`Config validation failed: ${n.errors.join(", ")}`);return T((yield r.updateModule({workspaceId:e,id:i,config:JSON.stringify(t),validateConfig:!0})))}),function(e){return _.apply(this,arguments)})),a({name:"get_devices",description:"List all devices in the workspace",inputSchema:o({limit:S.ai().describe("Maximum number of devices to return").optional().default(50),offset:S.ai().describe("Number of devices to skip").optional().default(0)}),permission:"query_device"},(h=v(function*({workspace_id:e,limit:i=50,offset:t=0}){return T((yield r.devices({workspaceId:e,paginate:{limit:i,offset:t}})))}),function(e){return h.apply(this,arguments)})),a({name:"create_application",description:"Create a new BRICKS application with default grid layout",inputSchema:o({name:S.Yj().describe("Application name"),description:S.Yj().describe("Application description").optional(),grid_width:S.ai().describe("Grid width in units").optional().default(96),grid_height:S.ai().describe("Grid height in units").optional().default(54)}),permission:"create_application"},(b=v(function*({workspace_id:e,name:i,description:t,grid_width:n,grid_height:a}){return T((yield r.createApplication({workspaceId:e,name:i,description:t,gridWidth:n,gridHeight:a})))}),function(e){return b.apply(this,arguments)})),a({name:"update_application_info",description:"Update application info",inputSchema:{id:S.Yj().describe("Application ID"),name:S.Yj().describe("Application name"),description:S.Yj().describe("Application description")},permission:"update_application"},(I=v(function*({id:e,name:i,description:t}){return T((yield r.updateApplication({id:e,name:i,description:t})))}),function(e){return I.apply(this,arguments)})),a({name:"update_application_config",description:"Update application configuration with validation",inputSchema:{id:S.Yj().describe("Application ID"),config:S.Ik({}).passthrough().describe("New application configuration. Please read `getting-started` for BRICKS concepts before changing")},permission:"update_application"},(k=v(function*({id:e,config:i}){var t=yield q(i);if(!t.valid)throw Error(`Config validation failed: ${t.errors.join(", ")}`);return T((yield r.updateApplication({id:e,config:JSON.stringify(i)})))}),function(e){return k.apply(this,arguments)})),a({name:"bind_application",description:"Bind application to device with viewport configuration",inputSchema:{app_id:S.Yj().describe("Application ID"),viewports:S.YO(S.Ik({device_id:S.Yj().describe("Device ID"),x:S.ai().describe("X coordinate"),y:S.ai().describe("Y coordinate"),width:S.ai().describe("Width"),height:S.ai().describe("Height"),rotate:S.ai().describe("Rotation"),rotateType:S.Yj().describe("Rotation type")})).describe("Viewport configuration")},permission:"bind_application"},(D=v(function*({app_id:e,viewports:i}){return T((yield r.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 D.apply(this,arguments)})),a({name:"unbind_application",description:"Unbind application from device",inputSchema:{app_id:S.Yj().describe("Application ID"),device_id:S.Yj().describe("Device ID")},permission:"bind_application"},(A=v(function*({app_id:e,device_id:i}){return T((yield r.bindApplication({id:e,unbindDevices:[i]})))}),function(e){return A.apply(this,arguments)})),n&&a({name:"list_media_workspaces",description:"List all media workspaces",inputSchema:{},permission:"query_media_flow"},v(function*(){return T((yield s.mediaWorkspaces()))})),a({name:"get_media_workspace",description:"Get media workspace information and status",inputSchema:o({}),permission:"query_media_flow"},(w=v(function*({workspace_id:e}){return T((yield s.mediaWorkspace({workspaceId:e})))}),function(e){return w.apply(this,arguments)})),a({name:"list_media_boxes",description:"List all media boxes in the workspace",inputSchema:o({}),permission:"query_media_flow"},(U=v(function*({workspace_id:e}){return T((yield s.mediaBoxes({workspaceId:e})))}),function(e){return U.apply(this,arguments)})),a({name:"get_media_box",description:"Get detailed information about a specific media box",inputSchema:{box_id:S.Yj().describe("Media box ID")},permission:"query_media_flow"},(M=v(function*({box_id:e}){return T((yield s.mediaBox({boxId:e})))}),function(e){return M.apply(this,arguments)})),a({name:"list_media_files",description:"List media files in a specific box with filtering options",inputSchema:{box_id:S.Yj().describe("Media box ID"),include_types:S.YO(S.Yj()).optional().describe('Filter by file types (e.g., ["image", "video", "audio"])'),user_tags:S.YO(S.Yj()).optional().describe("Filter by user tags"),limit:S.ai().optional().default(50).describe("Maximum number of files to return"),offset:S.ai().optional().default(0).describe("Number of files to skip")},permission:"query_media_flow"},(R=v(function*({box_id:e,include_types:i,user_tags:t,limit:n,offset:a}){return T((yield s.mediaFiles({boxId:e,includeTypes:i,userTags:t,limit:n,offset:a})))}),function(e){return R.apply(this,arguments)})),a({name:"get_media_file_meta",description:"Get detailed information about a specific media file",inputSchema:{file_id:S.Yj().describe("Media file ID")},permission:"query_media_flow"},(P=v(function*({file_id:e}){return T((yield s.mediaFile({fileId:e})))}),function(e){return P.apply(this,arguments)})),a({name:"media_box_upload",description:"Upload a file to a media box from URL or base64 data",inputSchema:{box_id:S.Yj().describe("Target media box ID"),name:S.Yj().describe("File name"),description:S.Yj().optional().default("").describe("File description"),file_type:S.k5(["image","video","audio","file"]).describe("File type"),source_url:S.Yj().optional().describe("URL to download the file from"),base64_data:S.Yj().optional().describe("Base64 encoded file data"),user_tags:S.YO(S.Yj()).optional().default([]).describe("User-defined tags for the file")},permission:"write_media_flow"},(O=v(function*({box_id:e,name:i,description:t,source_url:a,base64_data:o,file_type:r,user_tags:d}){if(!a&&!o)throw Error("Either source_url or base64_data must be provided");if(a&&o)throw Error("Provide either source_url OR base64_data, not both");var c=a?null:"application/octet-stream",l=a?yield(0,B.Ay)(a,{agent:(0,E.fJ)(a)}).then(e=>(c=e.headers.get("content-type"),e.blob())):new Blob([C.Buffer.from(o,"base64")],{type:c}),p=yield s.requestFileUpload({name:i,description:t,boxId:e,fileType:n?r.toUpperCase():r,contentType:c,userTags:d,meta:{}}),u=JSON.parse(p?.meta.uploadInfo),m=new FormData;m.append("file",l),m.append("Content-Type",c),m.append("AWSAccessKeyId",u.AWSAccessKeyId),m.append("Signature",u.Signature),m.append("Policy",u.Policy),m.append("acl",u.acl),m.append("key",u.key);var _=yield(0,B.Ay)(u.url,{method:"POST",body:m}).then(e=>e.ok).catch(()=>!1);return T({file_id:p.id,upload_success:_,upload_info:{content_type:c,file_type:r,source_type:a?"url":"base64",processing_note:"File will be processed automatically. Use get_media_file to check processing status."}})}),function(e){return O.apply(this,arguments)})),a({name:"update_media_file_meta",description:"Update media file information",inputSchema:{file_id:S.Yj().describe("Media file ID"),name:S.Yj().optional().describe("New file name"),description:S.Yj().optional().describe("New file description"),user_tags:S.YO(S.Yj()).optional().describe("New user tags")},permission:"write_media_flow"},(F=v(function*({file_id:e,name:i,description:t,user_tags:n}){return T((yield s.updateMediaFile({fileId:e,name:i,description:t,userTags:n,requestUploadAgain:!1})))}),function(e){return F.apply(this,arguments)})),a({name:"copy_media_files",description:"Copy media files from one box to another",inputSchema:{from_box_id:S.Yj().describe("Source media box ID"),to_box_id:S.Yj().describe("Target media box ID"),file_ids:S.YO(S.Yj()).describe("Array of media file IDs to copy")},permission:"write_media_flow"},(N=v(function*({from_box_id:e,to_box_id:i,file_ids:t}){return T((yield s.copyMediaFiles({fromBoxId:e,toBoxId:i,list:t})))}),function(e){return N.apply(this,arguments)})),a({name:"delete_media_files",description:"Delete specific media files from a box",inputSchema:{box_id:S.Yj().describe("Media box ID"),file_ids:S.YO(S.Yj()).describe("Array of media file IDs to delete")},permission:"write_media_flow"},(W=v(function*({box_id:e,file_ids:i}){return T((yield s.deleteMediaFiles({boxId:e,list:i})))}),function(e){return W.apply(this,arguments)})),a({name:"cleanup_media_box",description:"Delete all files in a media box, optionally filtered by type",inputSchema:{box_id:S.Yj().describe("Media box ID"),include_types:S.YO(S.Yj()).optional().describe('Only delete files of these types (e.g., ["image", "video"])')},permission:"write_media_flow"},(j=v(function*({box_id:e,include_types:i}){if("deleteMediaBoxFiles"in s)return T((yield s.deleteMediaBoxFiles({boxId:e,includeTypes:i})));var t=yield s.mediaFiles({boxId:e,includeTypes:i});return T((yield s.deleteMediaFiles({boxId:e,list:t.map(e=>e.id)})))}),function(e){return j.apply(this,arguments)})),e.tool("calculate_grid_layout","Calculate grid layout and pixel conversions for different device resolutions",{device_width:S.ai().describe("Device width in pixels"),device_height:S.ai().describe("Device height in pixels"),app_grid_width:S.ai().describe("Application grid width").optional().default(96),app_grid_height:S.ai().describe("Application grid height").optional().default(54)},(V=v(function*({device_width:e,device_height:i,app_grid_width:t,app_grid_height:n}){var a,o=(a=e/t,{deviceBrickWidth:e/a,deviceBrickHeight:i/a,deviceBrickUnit:a}),r=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 T({device_resolution:{width:e,height:i,aspect_ratio:(e/i).toFixed(2)},current_grid:{width:t,height:n,unit_size_px:o.deviceBrickUnit.toFixed(2),total_pixels:{width:o.deviceBrickWidth.toFixed(2),height:o.deviceBrickHeight.toFixed(2)}},recommended_grid:{width:r.deviceBrickWidth,height:r.deviceBrickHeight,unit_size_px:r.deviceBrickUnit.toFixed(2),note:"Optimized for device aspect ratio"}})}),function(e){return V.apply(this,arguments)})),e.tool("create_item","Use this tool to create new item that you can put in application configuration",{type:S.k5(["subspace","canvas","brick","generator","property_bank","property_bank_calc","property_bank_command","animation","state_group","automation_map"]).describe("Item type"),title:S.Yj().describe("Item title"),template_key:S.Yj().optional().describe("Template key for brick or generator")},tQ),e.tool("getting_started","Get documentation content for getting started",{},v(function*(){return T(z)})),!n){var d,c,l,p,u,m,_,h,b,I,k,D,A,w,U,M,R,P,O,F,N,W,j,V,Y,K,G,L=()=>new tz(tJ.activityLog,i.token);a({name:"activity_log_events",description:"Query activity log events. Returns raw events (general, data, local_sync) with filtering. Max 30-day range.",inputSchema:o({start_time:S.Yj().describe("Start time (ISO 8601)"),end_time:S.Yj().describe("End time (ISO 8601)"),device_id:S.Yj().optional().describe("Filter by device ID"),event_type:S.k5(["general","data","local_sync"]).optional().describe("Filter by event type"),event_name:S.Yj().optional().describe("Filter by event name (e.g. BRICK_xxx_ON_PRESS)"),subspace_id:S.Yj().optional().describe("Filter by subspace ID"),sender:S.Yj().optional().describe("Filter by sender"),limit:S.ai().optional().default(50).describe("Max events to return per page"),offset:S.ai().optional().default(0).describe("Number of events to skip (for pagination)")}),permission:"query_activity_log"},(Y=v(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=L(),l={start_time:e,end_time:i};return t&&(l.device_id=t),n&&(l.event_type=n),a&&(l.event_name=a),o&&(l.subspace_id=o),r&&(l.sender=r),T((yield c.events(l,{limit:s,offset:d})))}),function(e){return Y.apply(this,arguments)})),a({name:"activity_log_screenshots",description:"List available screenshot timestamps for a device in a time range.",inputSchema:o({device_id:S.Yj().describe("Device ID (required)"),start_time:S.Yj().describe("Start time (ISO 8601)"),end_time:S.Yj().describe("End time (ISO 8601)")}),permission:"query_activity_log"},(K=v(function*({device_id:e,start_time:i,end_time:t}){var n=L();return T((yield n.screenshots({device_id:e,start_time:i,end_time:t})))}),function(e){return K.apply(this,arguments)})),a({name:"activity_log_screenshot",description:"Download a device screenshot at a specific timestamp. Returns JPEG image as blob.",inputSchema:o({device_id:S.Yj().describe("Device ID"),ts:S.Yj().describe("Screenshot timestamp (ISO 8601 or epoch ms)")}),permission:"query_activity_log"},(G=v(function*({workspace_id:e,device_id:t,ts:n}){var a=e||i.tokenInfo?.w_id;if(!a)throw Error("Could not determine workspace ID");var o=L(),r=/^\d+$/.test(n)?n:new Date(n).getTime();return T((yield o.downloadScreenshot(a,t,r)),{mimeType:"image/jpeg"})}),function(e){return G.apply(this,arguments)}))}a({name:"get_device_usage",description:"Get device usage metrics (uptime, memory, disk) for a date range. Data from BRICKS main server.",inputSchema:o({device_id:S.Yj().describe("Device ID"),start_date:S.Yj().optional().describe("Start date/time in ISO 8601 format (default: start of today)"),end_date:S.Yj().optional().describe("End date/time in ISO 8601 format (default: now)")}),permission:"query_device"},(t=v(function*({device_id:e,start_date:i,end_date:t}){var n=new Date,a=new Date(n.getFullYear(),n.getMonth(),n.getDate()).toISOString();return T((yield r.deviceUsage({deviceId:e,startDate:i?new Date(i).toISOString():a,endDate:t?new Date(t).toISOString():n.toISOString()})))}),function(e){return t.apply(this,arguments)}))}(a,o);var r=new b.S;try{yield a.connect(r),console.error("BRICKS MCP Server running on STDIO"),console.error(`Server: ${tH} v${tZ}`),console.error(`Token Type: ${n.tokenType}`),console.error(`Permissions: ${n.tokenInfo.permissions.join(", ")}`),console.error("Ready to accept requests...")}catch(e){throw console.error("Failed to start MCP server:",e),e}})).apply(this,arguments)}}};
2546
+ - Minimal config skeleton that validates against the schema`}}]}}),function(e){return i.apply(this,arguments)})),a.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"},$(function*(){return C(S,{uri:"file://docs/getting-started.md",mimeType:"text/markdown"})})),function(e,i){var t,n="user"===i.tokenType,a=((e,i=null)=>({name:t,description:n,inputSchema:a,permission:o},r)=>{(!o||i.tokenInfo.permissions?.includes(o)||0)&&e.tool(t,n,a,r)})(e,i),o=e=>({...e,...n?{workspace_id:A.Yj().describe("Workspace ID")}:{}}),r=i.client,s=n?function(e){var i=e.endpoint,t=e.accessToken;if(!i)throw Error("Media API endpoint is required");if(!t)throw Error("Access token is required");return((e={})=>{let i=(({endpoint:e="http://localhost:3002",accessToken:i,boxId:t,passcode:n,enableSubscription:a=!0,enableRetry:o=!0,subscriptionOnConnectionOrError:r,onNetworkError:s}={})=>{let d,c,l,p=t&&n,u=`${e}/api/graphql`;return p&&(u=`${e}/api/graphql_with_passcode`),d=function({endpointURL:e,subscriptionEndpointURL:i,accessToken:t,boxId:n,passcode:a,origin:o,enableSubscription:r,enableRetry:s=!0,subscriptionOnConnectionOrError:d,onNetworkError:c=()=>{}}){let l,p,u,m,_={};o&&(_.origin=o),n&&a||(_.authorization=`Bearer ${t}`);let g=new tt.z({uri:e,headers:_}),f=()=>{m&&(clearTimeout(m),m=void 0)};r&&(l=(0,ta.UU)({url:i,lazy:!0,connectionParams:_,retryAttempts:1/0,shouldRetry:()=>!0,keepAlive:1e4,on:{error:e=>{f(),d?.(e)},opened:e=>{d?.(),u=e,f()},ping:e=>{e||(f(),m=setTimeout(()=>{u&&u.readyState===WebSocket.OPEN&&u.close(4205,"Client Restart")},5e3))},pong:e=>{e&&f()},closed:()=>{f()}}}),p=new tn.c(l));let y=i7.C.from([(0,to.S)(({networkError:e,operation:i})=>{if(e){c(e,i);let t=e?.message||"";if("Aborted"===t||e?.name==="AbortError"||t.includes("Too many requests")||e?.response?.status===429||e?.statusCode===429||e?.status===429||"Timeout exceeded"===t||e?.timeout||e?.statusCode===403||e?.status===403)return new te.c(e=>e.complete())}}),s&&new ti.z({attempts:{max:3,retryIf:e=>{let i="string"==typeof e?.message?e.message:"string"==typeof e?e:"";return!(!e||i.includes("Too many requests")||e?.response?.status===429||e?.statusCode===429||e?.status===429||e?.statusCode===403||e?.status===403||e?.timeout||"Timeout exceeded"===i)&&"Aborted"!==i&&e?.name!=="AbortError"}}}),new(ts())(3e4),r?i7.C.split(({query:e})=>{let{kind:i,operation:t}=(0,td.Vn)(e);return"OperationDefinition"===i&&"subscription"===t},p,g):g].filter(Boolean));return y.closeSubscriptionClient=()=>r&&l.dispose(),y}({endpointURL:u,subscriptionEndpointURL:u.replace("http:","ws:"),accessToken:i,enableSubscription:!p&&a,enableRetry:o,subscriptionOnConnectionOrError:r,onNetworkError:s}),c=new et.D,(l=new ei.R({link:d,cache:c,defaultOptions:{watchQuery:{fetchPolicy:"no-cache",errorPolicy:"ignore"},query:{fetchPolicy:"no-cache",errorPolicy:"all"}}})).close=()=>d.closeSubscriptionClient(),l})(e);if(e.boxId&&e.passcode){i.type="passcode",i.queries=f,i.mutations=y;let t={boxId:e.boxId,passcode:e.passcode};Object.entries(f).forEach(tW(i,"query",t)),Object.entries(y).forEach(tW(i,"mutation",t)),i.listenBoxChanged=(e,n)=>i.subscribe({query:tN,variables:{...t,...e}}).subscribe({next:tj(n),error(e){n(e)}})}else i.accessToken=e.accessToken,i.type="token",i.queries=_,i.mutations=g,Object.entries(_).forEach(tW(i,"query")),Object.entries(g).forEach(tW(i,"mutation")),i.listenBoxChanged=(e,t)=>i.subscribe({query:tB,variables:e}).subscribe({next:tj(t),error(e){t(e)}});return i})({endpoint:i,accessToken:t,enableSubscription:!1,enableRetry:!0})}({endpoint:tL.media,accessToken:i.token}):r;if(n&&e.tool("list_workspaces","List all workspaces",{},$(function*(){return C((yield r.workspaces()))})),a({name:"get_workspace_overview",description:"Get comprehensive overview of the BRICKS workspace including stats and summary",inputSchema:o({}),permission:"info"},(d=$(function*({workspace_id:e}){var i=T((yield Promise.all([r.workspace({id:e}),r.applications({workspaceId:e,paginate:{limit:50,offset:0}}),r.modules({workspaceId:e,paginate:{limit:50,offset:0}}),r.devices({workspaceId:e,paginate:{limit:50,offset:0}}),n?s.mediaWorkspace({workspaceId:e}).catch(()=>null):s.mediaWorkspace().catch(()=>null),n?s.mediaBoxes({workspaceId:e}).catch(()=>[]):s.mediaBoxes().catch(()=>[])])),6),t=i[0],a=i[1],o=i[2],d=i[3],c=i[4],l=i[5];if(!t)throw Error("Authentication failed, please check your token");return C({workspace:t,stats:{applications:a?.length??"No permission",modules:o?.length??"No permission",devices:d?.length??"No permission",running_apps:a?.filter(e=>e.status?.running).length??"No permission",media_boxes:l?.length??"No permission",media_enabled:!!c,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:c?{workspace_id:c.id,name:c.name,size_used:c.size,size_limit:c.sizeLimit,boxes:l?.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 d.apply(this,arguments)})),a({name:"get_applications",description:"List all applications in the workspace",inputSchema:o({limit:A.ai().describe("Maximum number of applications to return").optional().default(50),offset:A.ai().describe("Number of applications to skip").optional().default(0)}),permission:"query_application"},(c=$(function*({workspace_id:e,limit:i=50,offset:t=0}){return C((yield r.applications({workspaceId:e,paginate:{limit:i,offset:t}})))}),function(e){return c.apply(this,arguments)})),a({name:"get_application",description:"Get detailed info and config of a specific application",inputSchema:o({id:A.Yj().describe("Application ID")}),permission:"query_application"},(l=$(function*({workspace_id:e,id:i}){return C((yield r.application({workspaceId:e,id:i})))}),function(e){return l.apply(this,arguments)})),a({name:"get_modules",description:"List all modules in the workspace",inputSchema:o({limit:A.ai().describe("Maximum number of modules to return").optional().default(50),offset:A.ai().describe("Number of modules to skip").optional().default(0)}),permission:"query_module"},(p=$(function*({workspace_id:e,limit:i=50,offset:t=0}){return C((yield r.modules({workspaceId:e,paginate:{limit:i,offset:t}})))}),function(e){return p.apply(this,arguments)})),a({name:"get_module",description:"Get detailed info and config of a specific module",inputSchema:o({id:A.Yj().describe("Module ID")}),permission:"query_module"},(u=$(function*({workspace_id:e,id:i}){return C((yield r.module({workspaceId:e,id:i})))}),function(e){return u.apply(this,arguments)})),a({name:"update_module_info",description:"Update a specific module info",inputSchema:o({id:A.Yj().describe("Module ID"),name:A.Yj().describe("Module name"),description:A.Yj().describe("Module description")}),permission:"update_module"},(m=$(function*({workspace_id:e,id:i,name:t,description:n}){return C((yield r.updateModule({workspaceId:e,id:i,name:t,description:n})))}),function(e){return m.apply(this,arguments)})),a({name:"update_module_config",description:"Update a specific module configuration",inputSchema:o({id:A.Yj().describe("Module ID"),config:A.Ik({}).passthrough().describe("New configuration object, see file://docs/config-schema.md for schema reference")}),permission:"update_module"},(v=$(function*({workspace_id:e,id:i,config:t}){var n=yield q(t);if(!n.valid)throw Error(`Config validation failed: ${n.errors.join(", ")}`);return C((yield r.updateModule({workspaceId:e,id:i,config:JSON.stringify(t),validateConfig:!0})))}),function(e){return v.apply(this,arguments)})),a({name:"get_devices",description:"List all devices in the workspace",inputSchema:o({limit:A.ai().describe("Maximum number of devices to return").optional().default(50),offset:A.ai().describe("Number of devices to skip").optional().default(0)}),permission:"query_device"},(h=$(function*({workspace_id:e,limit:i=50,offset:t=0}){return C((yield r.devices({workspaceId:e,paginate:{limit:i,offset:t}})))}),function(e){return h.apply(this,arguments)})),a({name:"create_application",description:"Create a new BRICKS application with default grid layout",inputSchema:o({name:A.Yj().describe("Application name"),description:A.Yj().describe("Application description").optional(),grid_width:A.ai().describe("Grid width in units").optional().default(96),grid_height:A.ai().describe("Grid height in units").optional().default(54)}),permission:"create_application"},(b=$(function*({workspace_id:e,name:i,description:t,grid_width:n,grid_height:a}){return C((yield r.createApplication({workspaceId:e,name:i,description:t,gridWidth:n,gridHeight:a})))}),function(e){return b.apply(this,arguments)})),a({name:"update_application_info",description:"Update application info",inputSchema:{id:A.Yj().describe("Application ID"),name:A.Yj().describe("Application name"),description:A.Yj().describe("Application description")},permission:"update_application"},(I=$(function*({id:e,name:i,description:t}){return C((yield r.updateApplication({id:e,name:i,description:t})))}),function(e){return I.apply(this,arguments)})),a({name:"update_application_config",description:"Update application configuration with validation",inputSchema:{id:A.Yj().describe("Application ID"),config:A.Ik({}).passthrough().describe("New application configuration. Please read `getting-started` for BRICKS concepts before changing")},permission:"update_application"},(k=$(function*({id:e,config:i}){var t=yield q(i);if(!t.valid)throw Error(`Config validation failed: ${t.errors.join(", ")}`);return C((yield r.updateApplication({id:e,config:JSON.stringify(i)})))}),function(e){return k.apply(this,arguments)})),a({name:"bind_application",description:"Bind application to device with viewport configuration",inputSchema:{app_id:A.Yj().describe("Application ID"),viewports:A.YO(A.Ik({device_id:A.Yj().describe("Device ID"),x:A.ai().describe("X coordinate"),y:A.ai().describe("Y coordinate"),width:A.ai().describe("Width"),height:A.ai().describe("Height"),rotate:A.ai().describe("Rotation"),rotateType:A.Yj().describe("Rotation type")})).describe("Viewport configuration")},permission:"bind_application"},(D=$(function*({app_id:e,viewports:i}){return C((yield r.bindApplication({id:e,bindDevices:i.map(e=>e.device_id),deviceFrames: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 D.apply(this,arguments)})),a({name:"unbind_application",description:"Unbind application from device",inputSchema:{app_id:A.Yj().describe("Application ID"),device_id:A.Yj().describe("Device ID")},permission:"bind_application"},(S=$(function*({app_id:e,device_id:i}){return C((yield r.bindApplication({id:e,unbindDevices:[i]})))}),function(e){return S.apply(this,arguments)})),n&&a({name:"list_media_workspaces",description:"List all media workspaces",inputSchema:{},permission:"query_media_flow"},$(function*(){return C((yield s.mediaWorkspaces()))})),a({name:"get_media_workspace",description:"Get media workspace information and status",inputSchema:o({}),permission:"query_media_flow"},(E=$(function*({workspace_id:e}){return C((yield s.mediaWorkspace({workspaceId:e})))}),function(e){return E.apply(this,arguments)})),a({name:"list_media_boxes",description:"List all media boxes in the workspace",inputSchema:o({}),permission:"query_media_flow"},(U=$(function*({workspace_id:e}){return C((yield s.mediaBoxes({workspaceId:e})))}),function(e){return U.apply(this,arguments)})),a({name:"get_media_box",description:"Get detailed information about a specific media box",inputSchema:{box_id:A.Yj().describe("Media box ID")},permission:"query_media_flow"},(M=$(function*({box_id:e}){return C((yield s.mediaBox({boxId:e})))}),function(e){return M.apply(this,arguments)})),a({name:"list_media_files",description:"List media files in a specific box with filtering options",inputSchema:{box_id:A.Yj().describe("Media box ID"),include_types:A.YO(A.Yj()).optional().describe('Filter by file types (e.g., ["image", "video", "audio"])'),user_tags:A.YO(A.Yj()).optional().describe("Filter by user tags"),limit:A.ai().optional().default(50).describe("Maximum number of files to return"),offset:A.ai().optional().default(0).describe("Number of files to skip")},permission:"query_media_flow"},(R=$(function*({box_id:e,include_types:i,user_tags:t,limit:n,offset:a}){return C((yield s.mediaFiles({boxId:e,includeTypes:i,userTags:t,limit:n,offset:a})))}),function(e){return R.apply(this,arguments)})),a({name:"get_media_file_meta",description:"Get detailed information about a specific media file",inputSchema:{file_id:A.Yj().describe("Media file ID")},permission:"query_media_flow"},(P=$(function*({file_id:e}){return C((yield s.mediaFile({fileId:e})))}),function(e){return P.apply(this,arguments)})),a({name:"media_box_upload",description:"Upload a file to a media box from URL or base64 data",inputSchema:{box_id:A.Yj().describe("Target media box ID"),name:A.Yj().describe("File name"),description:A.Yj().optional().default("").describe("File description"),file_type:A.k5(["image","video","audio","file"]).describe("File type"),source_url:A.Yj().optional().describe("URL to download the file from"),base64_data:A.Yj().optional().describe("Base64 encoded file data"),user_tags:A.YO(A.Yj()).optional().default([]).describe("User-defined tags for the file")},permission:"write_media_flow"},(O=$(function*({box_id:e,name:i,description:t,source_url:a,base64_data:o,file_type:r,user_tags:d}){if(!a&&!o)throw Error("Either source_url or base64_data must be provided");if(a&&o)throw Error("Provide either source_url OR base64_data, not both");var c=a?null:"application/octet-stream",l=a?yield(0,x.Ay)(a,{agent:(0,B.fJ)(a)}).then(e=>(c=e.headers.get("content-type")||"application/octet-stream",e.blob())):new Blob([w.Buffer.from(o,"base64")],{type:c}),p=yield s.requestFileUpload({name:i,description:t,boxId:e,fileType:n?r.toUpperCase():r,contentType:c,userTags:d,meta:{}}),u=!1;try{var m=JSON.parse(p?.meta.uploadInfo),_=new FormData;_.append("file",l),_.append("Content-Type",c),_.append("AWSAccessKeyId",m.AWSAccessKeyId),_.append("Signature",m.Signature),_.append("Policy",m.Policy),_.append("acl",m.acl),_.append("key",m.key),u=yield(0,x.Ay)(m.url,{method:"POST",body:_}).then(e=>e.ok).catch(()=>!1)}catch{u=!1}return C({file_id:p.id,upload_success:u,upload_info:{content_type:c,file_type:r,source_type:a?"url":"base64",processing_note:"File will be processed automatically. Use get_media_file to check processing status."}})}),function(e){return O.apply(this,arguments)})),a({name:"update_media_file_meta",description:"Update media file information",inputSchema:{file_id:A.Yj().describe("Media file ID"),name:A.Yj().optional().describe("New file name"),description:A.Yj().optional().describe("New file description"),user_tags:A.YO(A.Yj()).optional().describe("New user tags")},permission:"write_media_flow"},(F=$(function*({file_id:e,name:i,description:t,user_tags:n}){return C((yield s.updateMediaFile({fileId:e,name:i,description:t,userTags:n,requestUploadAgain:!1})))}),function(e){return F.apply(this,arguments)})),a({name:"copy_media_files",description:"Copy media files from one box to another",inputSchema:{from_box_id:A.Yj().describe("Source media box ID"),to_box_id:A.Yj().describe("Target media box ID"),file_ids:A.YO(A.Yj()).describe("Array of media file IDs to copy")},permission:"write_media_flow"},(N=$(function*({from_box_id:e,to_box_id:i,file_ids:t}){return C((yield s.copyMediaFiles({fromBoxId:e,toBoxId:i,list:t})))}),function(e){return N.apply(this,arguments)})),a({name:"delete_media_files",description:"Delete specific media files from a box",inputSchema:{box_id:A.Yj().describe("Media box ID"),file_ids:A.YO(A.Yj()).describe("Array of media file IDs to delete")},permission:"write_media_flow"},(W=$(function*({box_id:e,file_ids:i}){return C((yield s.deleteMediaFiles({boxId:e,list:i})))}),function(e){return W.apply(this,arguments)})),a({name:"cleanup_media_box",description:"Delete all files in a media box, optionally filtered by type",inputSchema:{box_id:A.Yj().describe("Media box ID"),include_types:A.YO(A.Yj()).optional().describe('Only delete files of these types (e.g., ["image", "video"])')},permission:"write_media_flow"},(j=$(function*({box_id:e,include_types:i}){if("deleteMediaBoxFiles"in s)return C((yield s.deleteMediaBoxFiles({boxId:e,includeTypes:i})));var t=yield s.mediaFiles({boxId:e,includeTypes:i});return C((yield s.deleteMediaFiles({boxId:e,list:t.map(e=>e.id)})))}),function(e){return j.apply(this,arguments)})),e.tool("calculate_grid_layout","Calculate grid layout and pixel conversions for different device resolutions",{device_width:A.ai().describe("Device width in pixels"),device_height:A.ai().describe("Device height in pixels"),app_grid_width:A.ai().describe("Application grid width").optional().default(96),app_grid_height:A.ai().describe("Application grid height").optional().default(54)},(V=$(function*({device_width:e,device_height:i,app_grid_width:t,app_grid_height:n}){var a,o=(a=e/t,{deviceBrickWidth:e/a,deviceBrickHeight:i/a,deviceBrickUnit:a}),r=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 C({device_resolution:{width:e,height:i,aspect_ratio:(e/i).toFixed(2)},current_grid:{width:t,height:n,unit_size_px:o.deviceBrickUnit.toFixed(2),total_pixels:{width:o.deviceBrickWidth.toFixed(2),height:o.deviceBrickHeight.toFixed(2)}},recommended_grid:{width:r.deviceBrickWidth,height:r.deviceBrickHeight,unit_size_px:r.deviceBrickUnit.toFixed(2),note:"Optimized for device aspect ratio"}})}),function(e){return V.apply(this,arguments)})),e.tool("create_item","Use this tool to create new item that you can put in application configuration",{type:A.k5(["subspace","canvas","brick","generator","property_bank","property_bank_calc","property_bank_command","animation","state_group","automation_map"]).describe("Item type"),title:A.Yj().describe("Item title"),template_key:A.Yj().optional().describe("Template key for brick or generator")},tH),e.tool("getting_started","Get documentation content for getting started",{},$(function*(){return C(z)})),!n){var d,c,l,p,u,m,v,h,b,I,k,D,S,E,U,M,R,P,O,F,N,W,j,V,K,Y,G,L=()=>new tY(tL.activityLog,i.token);a({name:"activity_log_events",description:"Query activity log events. Returns raw events (general, data, local_sync) with filtering. Max 30-day range.",inputSchema:o({start_time:A.Yj().describe("Start time (ISO 8601)"),end_time:A.Yj().describe("End time (ISO 8601)"),device_id:A.Yj().optional().describe("Filter by device ID"),event_type:A.k5(["general","data","local_sync"]).optional().describe("Filter by event type"),event_name:A.Yj().optional().describe("Filter by event name (e.g. BRICK_xxx_ON_PRESS)"),subspace_id:A.Yj().optional().describe("Filter by subspace ID"),sender:A.Yj().optional().describe("Filter by sender"),limit:A.ai().optional().default(50).describe("Max events to return per page"),offset:A.ai().optional().default(0).describe("Number of events to skip (for pagination)")}),permission:"query_activity_log"},(K=$(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=L(),l={start_time:e,end_time:i};return t&&(l.device_id=t),n&&(l.event_type=n),a&&(l.event_name=a),o&&(l.subspace_id=o),r&&(l.sender=r),C((yield c.events(l,{limit:s,offset:d})))}),function(e){return K.apply(this,arguments)})),a({name:"activity_log_screenshots",description:"List available screenshot timestamps for a device in a time range.",inputSchema:o({device_id:A.Yj().describe("Device ID (required)"),start_time:A.Yj().describe("Start time (ISO 8601)"),end_time:A.Yj().describe("End time (ISO 8601)")}),permission:"query_activity_log"},(Y=$(function*({device_id:e,start_time:i,end_time:t}){var n=L();return C((yield n.screenshots({device_id:e,start_time:i,end_time:t})))}),function(e){return Y.apply(this,arguments)})),a({name:"activity_log_screenshot",description:"Download a device screenshot at a specific timestamp. Returns JPEG image as blob.",inputSchema:o({device_id:A.Yj().describe("Device ID"),ts:A.Yj().describe("Screenshot timestamp (ISO 8601 or epoch ms)")}),permission:"query_activity_log"},(G=$(function*({workspace_id:e,device_id:t,ts:n}){var a=e||i.tokenInfo?.w_id;if(!a)throw Error("Could not determine workspace ID");var o=L(),r=/^\d+$/.test(n)?n:new Date(n).getTime();return C((yield o.downloadScreenshot(a,t,r)),{mimeType:"image/jpeg"})}),function(e){return G.apply(this,arguments)}))}a({name:"get_device_usage",description:"Get device usage metrics (uptime, memory, disk) for a date range. Data from BRICKS main server.",inputSchema:o({device_id:A.Yj().describe("Device ID"),start_date:A.Yj().optional().describe("Start date/time in ISO 8601 format (default: start of today)"),end_date:A.Yj().optional().describe("End date/time in ISO 8601 format (default: now)")}),permission:"query_device"},(t=$(function*({device_id:e,start_date:i,end_date:t}){var n=new Date,a=new Date(n.getFullYear(),n.getMonth(),n.getDate()).toISOString();return C((yield r.deviceUsage({deviceId:e,startDate:i?new Date(i).toISOString():a,endDate:t?new Date(t).toISOString():n.toISOString()})))}),function(e){return t.apply(this,arguments)}))}(a,o);var r=new h.S;try{yield a.connect(r),console.error("BRICKS MCP Server running on STDIO"),console.error(`Server: ${tG} v${tJ}`),console.error(`Token Type: ${n.tokenType}`),console.error(`Permissions: ${n.tokenInfo.permissions.join(", ")}`),console.error("Ready to accept requests...")}catch(e){throw console.error("Failed to start MCP server:",e),e}})).apply(this,arguments)}}};