@fugood/bricks-cli 2.25.0-beta.51 → 2.25.0-beta.52
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/10.js +1 -1
- package/lib/117.js +6 -6
- package/lib/index.js +4 -4
- package/package.json +2 -2
package/lib/117.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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:()=>tJ});var n,a,o,r,s,d,c={};t.r(c),t.d(c,{applicationFragment:()=>es,applicationShortFragment:()=>ef,deviceFragment:()=>eo,deviceGroupFragment:()=>er,deviceShortFragment:()=>ey,instanceVersionFragment:()=>ep,mediaBoxFragment:()=>ev,mediaFileFragment:()=>eh,mediaWorkspaceFragment:()=>e$,moduleFragment:()=>ec,moduleShortFragment:()=>el,operationFragment:()=>eu,publicApplicationBasicInfoFragment:()=>ed,userFavoriteFragment:()=>em,workspaceFragment:()=>e_,workspaceShortFragment:()=>eg});var l={};t.r(l),t.d(l,{application:()=>eW,applicationByDevice:()=>eE,applicationReleaseVersion:()=>eT,applicationReleaseVersions:()=>eC,applicationTestsByDevice:()=>eU,applications:()=>eq,checkBindDevicePasscode:()=>eM,deviceUsage:()=>eV,devices:()=>ej,devicesByGroup:()=>eP,devicesByUniqueId:()=>eR,me:()=>ek,module:()=>eD,moduleReleaseVersion:()=>eB,moduleReleaseVersions:()=>ex,modules:()=>eA,publicModules:()=>eS,publicModulesByIdList:()=>ew,workspace:()=>eF,workspacePricingPlans:()=>eO,workspaces:()=>eN});var p={};t.r(p),t.d(p,{addUserFavorite:()=>iD,assignGroupPermissions:()=>ih,bindApplication:()=>e7,bindApplicationWithDeviceGroup:()=>it,changeWorkspaceAdditionalLimitSpending:()=>iw,changeWorkspaceSubscriptionPlan:()=>iS,controlDevice:()=>e0,createApplication:()=>e9,createApplicationWithShareVersion:()=>e3,createConfigChangeOperation:()=>ig,createDevice:()=>ez,createDeviceGroup:()=>e1,createDeviceGroupWithApp:()=>ir,createModule:()=>il,createVirtualDevice:()=>eH,createWorkspace:()=>eY,createWorkspaceOTP:()=>iC,dispatchDeviceGroupAction:()=>e6,doOperation:()=>iy,duplicateApplication:()=>id,duplicateModule:()=>im,forkApplication:()=>is,moveApplication:()=>io,moveDevice:()=>eX,moveModule:()=>iu,registerFCMNotification:()=>ib,registerRemoteDebug:()=>iI,removeApplication:()=>ic,removeDevice:()=>eZ,removeDeviceGroup:()=>e5,removeModule:()=>i_,removeOperation:()=>iv,removeUserFavorite:()=>iA,removeWorkspace:()=>e2,revokeWorkspaceOTP:()=>iT,shareAccessToken:()=>ik,shareApplication:()=>ia,toggleShortEditApplication:()=>ie,updateApplication:()=>e8,updateApplicationViewportPreset:()=>ii,updateDevice:()=>eJ,updateDeviceGroup:()=>e4,updateModule:()=>ip,updateOperation:()=>i$,updateVirtualDevice:()=>eQ,updateWorkspace:()=>eG,updateWorkspaceTokens:()=>eL});var u={};t.r(u),t.d(u,{application:()=>iM,applicationByDevice:()=>iR,applications:()=>iU,device:()=>iN,deviceUsage:()=>iW,devices:()=>iF,devicesByApplication:()=>iq,mediaBox:()=>iK,mediaBoxes:()=>iV,mediaFile:()=>iG,mediaFiles:()=>iY,mediaWorkspace:()=>ij,module:()=>iO,modules:()=>iP,workspace:()=>iE});var m={};t.r(m),t.d(m,{bindApplication:()=>iH,copyMediaFiles:()=>i6,createApplication:()=>iL,createModule:()=>iX,deleteMediaBoxFiles:()=>i2,deleteMediaFiles:()=>i5,requestFileUpload:()=>iZ,setMediaFileAsBoxPreview:()=>i4,unbindApplication:()=>iJ,updateApplication:()=>iz,updateMediaFile:()=>i0,updateMediaFiles:()=>i1,updateModule:()=>iQ});var _={};t.r(_),t.d(_,{mediaBox:()=>tg,mediaBoxes:()=>tm,mediaFile:()=>ty,mediaFiles:()=>tf,mediaWorkspace:()=>t_,mediaWorkspaces:()=>tu});var g={};t.r(g),t.d(g,{assignGroupPermissions:()=>tT,copyMediaFiles:()=>tw,createMediaBox:()=>th,createMediaWorkspace:()=>t$,deleteMediaFiles:()=>tS,moveMediaBox:()=>tb,requestFileUpload:()=>tk,setMediaFileAsBoxPreview:()=>tC,updateMediaBox:()=>tI,updateMediaFile:()=>tD,updateMediaFiles:()=>tA,updateMediaWorkspace:()=>tv});var f={};t.r(f),t.d(f,{mediaBox:()=>tB,mediaFile:()=>tU,mediaFiles:()=>tE});var y={};t.r(y),t.d(y,{deleteMediaFiles:()=>tO,requestFileUpload:()=>tM,updateMediaFile:()=>tR,updateMediaFiles:()=>tP});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"]);function N(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(".");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 q=t(49741),W=t(63981),j=(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]??j(t,i)])):e,V=j(q.t),K=Object.entries(q.systemActions).map(([e,{propertyNameType:i,property:t}])=>` - \`${e}\`: ${V[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:()=>tJ});var n,a,o,r,s,d,c={};t.r(c),t.d(c,{applicationFragment:()=>es,applicationShortFragment:()=>ef,deviceFragment:()=>eo,deviceGroupFragment:()=>er,deviceShortFragment:()=>ey,instanceVersionFragment:()=>ep,mediaBoxFragment:()=>ev,mediaFileFragment:()=>eh,mediaWorkspaceFragment:()=>e$,moduleFragment:()=>ec,moduleShortFragment:()=>el,operationFragment:()=>eu,publicApplicationBasicInfoFragment:()=>ed,userFavoriteFragment:()=>em,workspaceFragment:()=>e_,workspaceShortFragment:()=>eg});var l={};t.r(l),t.d(l,{application:()=>eW,applicationByDevice:()=>eE,applicationReleaseVersion:()=>eT,applicationReleaseVersions:()=>eC,applicationTestsByDevice:()=>eU,applications:()=>eq,checkBindDevicePasscode:()=>eM,deviceUsage:()=>eV,devices:()=>ej,devicesByGroup:()=>eP,devicesByUniqueId:()=>eR,me:()=>ek,module:()=>eD,moduleReleaseVersion:()=>eB,moduleReleaseVersions:()=>ex,modules:()=>eA,publicModules:()=>eS,publicModulesByIdList:()=>ew,workspace:()=>eF,workspacePricingPlans:()=>eO,workspaces:()=>eN});var p={};t.r(p),t.d(p,{addUserFavorite:()=>iD,assignGroupPermissions:()=>ih,bindApplication:()=>e7,bindApplicationWithDeviceGroup:()=>it,changeWorkspaceAdditionalLimitSpending:()=>iw,changeWorkspaceSubscriptionPlan:()=>iS,controlDevice:()=>e0,createApplication:()=>e9,createApplicationWithShareVersion:()=>e3,createConfigChangeOperation:()=>ig,createDevice:()=>ez,createDeviceGroup:()=>e1,createDeviceGroupWithApp:()=>ir,createModule:()=>il,createVirtualDevice:()=>eH,createWorkspace:()=>eY,createWorkspaceOTP:()=>iC,dispatchDeviceGroupAction:()=>e6,doOperation:()=>iy,duplicateApplication:()=>id,duplicateModule:()=>im,forkApplication:()=>is,moveApplication:()=>io,moveDevice:()=>eX,moveModule:()=>iu,registerFCMNotification:()=>ib,registerRemoteDebug:()=>iI,removeApplication:()=>ic,removeDevice:()=>eZ,removeDeviceGroup:()=>e2,removeModule:()=>i_,removeOperation:()=>iv,removeUserFavorite:()=>iA,removeWorkspace:()=>e5,revokeWorkspaceOTP:()=>iT,shareAccessToken:()=>ik,shareApplication:()=>ia,toggleShortEditApplication:()=>ie,updateApplication:()=>e8,updateApplicationViewportPreset:()=>ii,updateDevice:()=>eJ,updateDeviceGroup:()=>e4,updateModule:()=>ip,updateOperation:()=>i$,updateVirtualDevice:()=>eQ,updateWorkspace:()=>eG,updateWorkspaceTokens:()=>eL});var u={};t.r(u),t.d(u,{application:()=>iM,applicationByDevice:()=>iR,applications:()=>iU,device:()=>iN,deviceUsage:()=>iW,devices:()=>iF,devicesByApplication:()=>iq,mediaBox:()=>iK,mediaBoxes:()=>iV,mediaFile:()=>iG,mediaFiles:()=>iY,mediaWorkspace:()=>ij,module:()=>iO,modules:()=>iP,workspace:()=>iE});var m={};t.r(m),t.d(m,{bindApplication:()=>iH,copyMediaFiles:()=>i6,createApplication:()=>iL,createModule:()=>iX,deleteMediaBoxFiles:()=>i5,deleteMediaFiles:()=>i2,requestFileUpload:()=>iZ,setMediaFileAsBoxPreview:()=>i4,unbindApplication:()=>iJ,updateApplication:()=>iz,updateMediaFile:()=>i0,updateMediaFiles:()=>i1,updateModule:()=>iQ});var _={};t.r(_),t.d(_,{mediaBox:()=>tg,mediaBoxes:()=>tm,mediaFile:()=>ty,mediaFiles:()=>tf,mediaWorkspace:()=>t_,mediaWorkspaces:()=>tu});var g={};t.r(g),t.d(g,{assignGroupPermissions:()=>tT,copyMediaFiles:()=>tw,createMediaBox:()=>th,createMediaWorkspace:()=>t$,deleteMediaFiles:()=>tS,moveMediaBox:()=>tb,requestFileUpload:()=>tk,setMediaFileAsBoxPreview:()=>tC,updateMediaBox:()=>tI,updateMediaFile:()=>tD,updateMediaFiles:()=>tA,updateMediaWorkspace:()=>tv});var f={};t.r(f),t.d(f,{mediaBox:()=>tB,mediaFile:()=>tU,mediaFiles:()=>tE});var y={};t.r(y),t.d(y,{deleteMediaFiles:()=>tO,requestFileUpload:()=>tM,updateMediaFile:()=>tR,updateMediaFiles:()=>tP});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"]);function N(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(".");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 q=t(49741),W=t(63981),j=(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]??j(t,i)])):e,V=j(q.t),K=Object.entries(q.systemActions).map(([e,{propertyNameType:i,property:t}])=>` - \`${e}\`: ${V[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
3
|
`.trim()).join("\n"),Y=Object.keys(W.brickMapping).map(e=>`- \`${e}\``).join("\n"),G=Object.keys(W.generatorMapping).map(e=>`- \`${e}\``).join("\n");let L=S.replace("[:SYSTEM_ACTIONS:]",K).replace("[:BRICK_IDS:]",Y).replace("[:GENERATOR_IDS:]",G);var z=t(44668),H=t(5018),J=t(63315),X=t(30409),Q=t(40906),Z=t(79760),ee=t(22268),ei=t(7068),et=t(26197),en=t(94370);let ea=(0,en.default)`
|
|
4
4
|
fragment workspaceArguments on Workspace {
|
|
@@ -1234,11 +1234,11 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
|
|
|
1234
1234
|
dispatched
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
|
-
`),
|
|
1237
|
+
`),e2=eK((0,en.default)`
|
|
1238
1238
|
mutation ControllerClient_removeDeviceGroup($id: ID!) {
|
|
1239
1239
|
removeDeviceGroup(id: $id)
|
|
1240
1240
|
}
|
|
1241
|
-
`),
|
|
1241
|
+
`),e5=eK((0,en.default)`
|
|
1242
1242
|
mutation ControllerClient_removeWorkspace($id: ID!) {
|
|
1243
1243
|
removeWorkspace(id: $id)
|
|
1244
1244
|
}
|
|
@@ -1971,11 +1971,11 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
|
|
|
1971
1971
|
mutation Workspace_copyMediaFiles($fromBoxId: ID!, $toBoxId: ID!, $fileIds: [ID!]!) {
|
|
1972
1972
|
copyMediaFiles(fromBoxId: $fromBoxId, toBoxId: $toBoxId, fileIds: $fileIds)
|
|
1973
1973
|
}
|
|
1974
|
-
`,
|
|
1974
|
+
`,i2=(0,en.default)`
|
|
1975
1975
|
mutation Workspace_deleteMediaFiles($boxId: ID!, $fileIds: [ID!]!) {
|
|
1976
1976
|
deleteMediaFiles(boxId: $boxId, fileIds: $fileIds)
|
|
1977
1977
|
}
|
|
1978
|
-
`,
|
|
1978
|
+
`,i5=(0,en.default)`
|
|
1979
1979
|
mutation Workspace_deleteMediaBoxFiles($boxId: ID!, $includeTypes: [String]) {
|
|
1980
1980
|
deleteMediaBoxFiles(boxId: $boxId, includeTypes: $includeTypes)
|
|
1981
1981
|
}
|
|
@@ -2472,7 +2472,7 @@ ${((e,i)=>{switch(e){case"defined_properties":return Object.entries(i).map(([e,i
|
|
|
2472
2472
|
timestamp
|
|
2473
2473
|
}
|
|
2474
2474
|
}
|
|
2475
|
-
`,tK=z(function e(i,t){H(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(tj,{filter:n})).events}),function(e){return r.apply(this,arguments)})},{key:"screenshots",value:(s=$(function*(e){return(yield this.graphql(tV,{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 tY="bricks-mcp",tG={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 tL=t(1639);let tz=({type:e,title:i,template_key:t})=>{var n,a,o=(0,tL.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=j(W.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,tL.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=j(W.dK.Basic),d=j(W.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=j(W.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(W.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,tL.M4)("property_bank_command"),u=(0,tL.M4)("property_bank_command"),m=(0,tL.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 tH="2.25.0-beta.51";function tJ(){return tX.apply(this,arguments)}function tX(){return(tX=$(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:tY,version:tH}),o={...n,client:function(e,i,t){switch(t){case"user":return new iB(e,i);case"workspace":return new i3(e,i);default:throw Error(`Invalid token type: ${t}.`)}}(tG.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.
|
|
2475
|
+
`,tK=z(function e(i,t){H(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(tj,{filter:n})).events}),function(e){return r.apply(this,arguments)})},{key:"screenshots",value:(s=$(function*(e){return(yield this.graphql(tV,{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 tY="bricks-mcp",tG={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 tL=t(1639);let tz=({type:e,title:i,template_key:t})=>{var n,a,o=(0,tL.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=j(W.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,tL.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=j(W.dK.Basic),d=j(W.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=j(W.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(W.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,tL.M4)("property_bank_command"),u=(0,tL.M4)("property_bank_command"),m=(0,tL.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 tH="2.25.0-beta.52";function tJ(){return tX.apply(this,arguments)}function tX(){return(tX=$(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:tY,version:tH}),o={...n,client:function(e,i,t){switch(t){case"user":return new iB(e,i);case"workspace":return new i3(e,i);default:throw Error(`Invalid token type: ${t}.`)}}(tG.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.
|
|
2476
2476
|
|
|
2477
2477
|
Before doing any complex work (application design, deployments, etc.),
|
|
2478
2478
|
always consult the official docs rather than guessing.
|
package/lib/index.js
CHANGED
|
@@ -89,7 +89,7 @@ ${E.Ay.bold("Definition")}`),console.log(JSON.stringify(r.definition,null,2)),co
|
|
|
89
89
|
Device: ${n.name||n.device_name}`)),console.log("─".repeat(60)),console.log(`Status: ${o}`),console.log(`ID: ${b.Ay.gray(n._id)}`),console.log(`Device Name: ${n.device_name||b.Ay.gray("N/A")}`),console.log(`Description: ${n.description||b.Ay.gray("N/A")}`),console.log(`Tags: ${n.tags?.join(", ")||b.Ay.gray("None")}`),console.log(`Created: ${b.Ay.gray(n.create_datetime||"N/A")}`),console.log(`Modified: ${b.Ay.gray(n.last_modify_datetime||"N/A")}`),n.entry_detail){var s=n.entry_detail;if(console.log(`
|
|
90
90
|
${b.Ay.bold("Entry Details")}`),console.log(`Type: ${s.type||b.Ay.gray("N/A")}`),console.log(`Unique ID: ${b.Ay.gray(s.unique_id||"N/A")}`),console.log(`Version: ${s.operation_version||b.Ay.gray("N/A")}`),console.log(`Mode: ${s.operation_mode||b.Ay.gray("N/A")}`),Array.isArray(s.screen)&&s.screen.length>0)console.log(`
|
|
91
91
|
${b.Ay.bold("Screens")} (${s.screen.length})`),s.screen.forEach((e,t)=>{var a=e.resolution,i=a?`${a.width}x${a.height} @${a.scale}x`:"N/A",n=e.master?b.Ay.green(" (master)"):"",r=e.orientation?` [${e.orientation}]`:"",o=e.touch?.available?b.Ay.cyan(` touch:${e.touch.touch_point}pt`):"";console.log(` ${t+1}. ${e.title||"Screen"}${n}${r} - ${i}${o}`)});else if(s.screen?.resolution){var p=s.screen.resolution;console.log(`Resolution: ${p.width}x${p.height} @${p.scale}x`)}var l=null!=s.memory_usage,d=null!=s.disk_usage;if(l||d){if(console.log(`
|
|
92
|
-
${b.Ay.bold("System Resources")}`),l){var u=Array.isArray(s.memory_usage)?s.memory_usage[0]:s.memory_usage
|
|
92
|
+
${b.Ay.bold("System Resources")}`),l){var u=Array.isArray(s.memory_usage)?s.memory_usage[0]:s.memory_usage;if(Number.isFinite(u)){var c=Math.round(100*u),m=b.Ay.green;c>80?m=b.Ay.red:c>60&&(m=b.Ay.yellow),console.log(`Memory: ${m(`${c}%`)}`)}else console.log(`Memory: ${b.Ay.gray("N/A")}`)}if(d){var f=Array.isArray(s.disk_usage)?s.disk_usage[0]:s.disk_usage;if(Number.isFinite(f)){var h=Math.round(100*f),v=b.Ay.green;h>90?v=b.Ay.red:h>75&&(v=b.Ay.yellow),console.log(`Disk: ${v(`${h}%`)}`)}else console.log(`Disk: ${b.Ay.gray("N/A")}`)}}var g=[];if(s.sound?.available&&g.push("Sound"),s.camera?.available&&g.push("Camera"),s.audio_in?.available&&g.push("Audio Input"),g.length>0&&(console.log(`
|
|
93
93
|
${b.Ay.bold("Capabilities")}`),console.log(`Available: ${g.join(", ")}`),s.camera?.channel?.length>0&&s.camera.channel.forEach(e=>{var t=e.resolution?`${e.resolution.width}x${e.resolution.height}`:"";console.log(` Camera: ${e.title||"Camera"} ${t} [${e.orientation||"N/A"}]`)})),s.local_sync){var y=s.local_sync;console.log(`
|
|
94
94
|
${b.Ay.bold("Local Sync")}`),console.log(`Role: ${y.is_main?b.Ay.cyan("Main"):"Secondary"}`),null!=y.peer_count&&console.log(`Peers: ${y.peer_count}`),null!=y.mean_latency&&console.log(`Latency: ${y.mean_latency.toFixed(2)}ms`)}if(s.update){var x=s.update;console.log(`
|
|
95
95
|
${b.Ay.bold("Update Status")}`),console.log(`Needs Update: ${x.need_update?b.Ay.yellow("Yes"):b.Ay.green("No")}`),x.current_version&&console.log(`App Version: ${x.current_version}`),x.running_mode&&console.log(`Running Mode: ${x.running_mode}`),x.last_update_at&&console.log(`Last Update: ${b.Ay.gray(x.last_update_at)}`)}if(s.watch_dog_timer){var w=s.watch_dog_timer;console.log(`
|
|
@@ -103,7 +103,7 @@ ${b.Ay.gray("Press Ctrl+C to stop")}`)}catch(e){console.error(b.Ay.red(`Error: $
|
|
|
103
103
|
Found ${p.length} DevTools server(s)`)),console.log("─".repeat(80));var c=function*(e){var t=!1===e.verified?R.Ay.red("unverified"):R.Ay.green("online"),a=H(e),i=K(a),n=(e.protocols||[]).map(e=>R.Ay.cyan(e)).join(", "),r=e.workspaceId&&u&&e.workspaceId===u,o=e.addresses||[e.address],s=o.filter(t=>t!==e.address),p=s.length>0?`${e.address}:${e.port} +${s.length} more`:`${e.address}:${e.port}`;if(console.log(` ${R.Ay.bold(e.name||"Unknown")} ${R.Ay.gray(`(${p})`)} [${t}]`),s.length>0&&console.log(` Addresses: ${o.map(e=>R.Ay.gray(e)).join(", ")}`),e.version&&console.log(` Version: ${R.Ay.green(e.version)}`),e.chromeInspect){var l=e.passcode?R.Ay.cyan(e.passcode):R.Ay.gray("no passcode");console.log(` Chrome Inspect: ${R.Ay.green("supported")} (passcode: ${l})`)}var d=` Protocols: ${n||R.Ay.gray("none")} Auth: ${i}`;if(e.deviceId&&(d+=` Device: ${R.Ay.gray(e.deviceId)}`),console.log(d),e.workspaceId){var c=r?R.Ay.green(`${e.workspaceId} (current profile)`):R.Ay.gray(e.workspaceId);console.log(` Workspace: ${c}`)}};for(var m of p)yield*c(m);console.log("─".repeat(80));var f=p[0],h=`${f.address}:${f.port||19851}`,v=H(f),g=f.passcode?`/ws/${encodeURIComponent(f.passcode)}`:"workspace-jwt"===v?"/ws/<workspace-token>":"/ws/<passcode>";console.log(R.Ay.gray(`
|
|
104
104
|
Connect via: http://${h}/devtools-frontend/inspector.html?ws=${h}${g}`)),console.log(R.Ay.gray(`Legacy: devtools://devtools/bundled/inspector.html?ws=${h}${g}`)),process.exit(0)}catch(e){s.fail(`Scan failed: ${e.message}`),process.exit(1)}}),function(e){return l.apply(this,arguments)})),Z.command("open <address>").description("Show DevTools server information").option("-p, --port <port>",`Server port (default: ${Y})`).option("--info","Show connection URLs").action((d=j(function*(e,t){var i=(yield Promise.resolve().then(a.bind(a,30155))).default,n=(yield Promise.resolve().then(a.bind(a,75646))).verifyDevToolsServer,r=Q(e),o=r.host??J,s=parseInt(t.port??r.port??Y,10),p=`${o}:${s}`,l=i(`Fetching server info from ${p}...`).start(),d=yield n(o,s);d||(l.fail(`Could not reach DevTools server at ${p}`),process.exit(1)),l.stop();var u=yield M(o,s),c=u?U(u?.[0]?.webSocketDebuggerUrl):null,m=H(d),f=c?`/ws/${encodeURIComponent(c)}`:"workspace-jwt"===m?"/ws/<workspace-token>":"/ws/<passcode>";if(t.info){console.log(R.Ay.bold("Connection URLs")),console.log("─".repeat(60)),console.log(` Web UI: ${R.Ay.cyan(`http://${p}`)}`),console.log(` CDP: ${R.Ay.cyan(`http://${p}/devtools-frontend/inspector.html?ws=${p}${f}`)}`),console.log(` CDP legacy: ${R.Ay.cyan(`devtools://devtools/bundled/inspector.html?ws=${p}${f}`)}`),console.log(` MCP: ${R.Ay.cyan(`http://${p}/mcp`)}`),console.log(` MCP SSE: ${R.Ay.cyan(`http://${p}/sse`)}`),console.log(` Info: ${R.Ay.cyan(`http://${p}/devtools/info`)}`),console.log("─".repeat(60)),console.log(),console.log(R.Ay.bold("Authorization")),d.auth?.workspaceJwt?.enabled&&console.log(` Workspace JWT: ${R.Ay.green("enabled")} (kid: ${d.auth.workspaceJwt.kid})`),c&&console.log(` Passcode: ${R.Ay.cyan(c)}`),console.log(" MCP and MCP SSE require a Bearer token header:"),console.log(` ${R.Ay.gray(`Authorization: Bearer ${d.auth?.workspaceJwt?.enabled?"<workspace-token>":c||"<passcode>"}`)}`);return}if(console.log(R.Ay.bold("DevTools Server")),console.log("─".repeat(60)),console.log(` Name: ${R.Ay.cyan(d.name||"Unknown")}`),console.log(` Version: ${d.version?R.Ay.green(d.version):R.Ay.gray("N/A")}`),console.log(` Device ID: ${R.Ay.gray(d.deviceId||"N/A")}`),console.log(` Workspace: ${R.Ay.gray(d.workspaceId||"N/A")}`),console.log(` Protocols: ${(d.protocols||[]).map(e=>R.Ay.cyan(e)).join(", ")||R.Ay.gray("none")}`),console.log(` Auth: ${K(m)}`),console.log(` Port: ${d.port}`),u){var h=c?R.Ay.cyan(c):R.Ay.gray("no passcode");console.log(` Inspect: ${R.Ay.green("chrome://inspect supported")} (passcode: ${h})`)}else console.log(` Inspect: ${R.Ay.gray("chrome://inspect not available")}`);console.log("─".repeat(60)),d.version&&!W(d.version)&&console.log(R.Ay.yellow(`
|
|
105
105
|
CDP commands require version >= ${z}`)),console.log(R.Ay.gray(`
|
|
106
|
-
Use --info to see connection URLs`))}),function(e,t){return d.apply(this,arguments)})),ee(Z.command("screenshot").description("Capture device screenshot").option("-o, --output <path>","Output file path")).action((u=j(function*(e){var t;yield et(e,(t=j(function*(t){var i=yield t.send("Page.captureScreenshot",{format:"png"});i.data||(console.error(R.Ay.red("No screenshot data received")),process.exit(1));var n=yield Promise.resolve().then(a.t.bind(a,73024,19)),r=yield Promise.resolve().then(a.t.bind(a,76760,19)),o=e.output||`screenshot-${Date.now()}.png`,s=r.resolve(o);n.writeFileSync(s,Buffer.from(i.data,"base64")),console.log(R.Ay.green(`Screenshot saved to ${s}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return u.apply(this,arguments)}));var er=Z.command("brick").description("Brick component inspection");ee(er.command("tree").description("Print brick component tree").option("-d, --depth <depth>","Max depth (-1 for full)","3")).action((c=j(function*(e){var t;yield et(e,(t=j(function*(t){yield t.send("DOM.enable");var a=parseInt(e.depth,10),i=(yield t.send("DOM.getDocument",{depth:a})).root;e.json?console.log(JSON.stringify(i,null,2)):console.log(en(i).join("\n"))}),function(e){return t.apply(this,arguments)}))}),function(e){return c.apply(this,arguments)})),ee(er.command("query <selector>").description("Find brick by CSS selector")).action((m=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOM.enable");var i=(yield a.send("DOM.getDocument",{depth:0})).root,n=(yield a.send("DOM.querySelector",{nodeId:i.nodeId,selector:e})).nodeId;if(0===n)return void console.log(R.Ay.yellow("No element found"));var r=yield a.send("DOM.describeNode",{nodeId:n}),o=ea((yield a.send("DOM.getAttributes",{nodeId:n})).attributes);if(t.json)return void console.log(JSON.stringify({nodeId:n,...r.node,attributes:o},null,2));if(console.log(R.Ay.bold(`Node ${n}: ${r.node?.nodeName||"unknown"}`)),Object.keys(o).length>0)for(var s of(console.log(R.Ay.bold("Attributes:")),Object.entries(o))){var p=$(s,2),l=p[0],d=p[1];console.log(` ${R.Ay.cyan(l)}: ${d}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return m.apply(this,arguments)})),ee(er.command("query-all <selector>").description("Find all bricks matching CSS selector")).action((f=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOM.enable");var i=(yield a.send("DOM.getDocument",{depth:0})).root,n=(yield a.send("DOM.querySelectorAll",{nodeId:i.nodeId,selector:e})).nodeIds;if(t.json)return void console.log(JSON.stringify({nodeIds:n,count:n.length},null,2));for(var r of(console.log(R.Ay.bold(`Found ${n.length} element(s)`)),n)){var o=yield a.send("DOM.describeNode",{nodeId:r}),s=ea((yield a.send("DOM.getAttributes",{nodeId:r})).attributes),p=s.id||s["short-id"]||"";console.log(` ${r}: ${o.node?.nodeName}${p?R.Ay.gray(`#${p}`):""}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return f.apply(this,arguments)})),ee(er.command("attributes <nodeId>").description("Get brick attributes")).action((h=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=ea((yield a.send("DOM.getAttributes",{nodeId:i})).attributes);if(t.json)return void console.log(JSON.stringify(n,null,2));if(0===Object.keys(n).length)return void console.log(R.Ay.gray("No attributes"));for(var r of Object.entries(n)){var o=$(r,2),s=o[0],p=o[1];console.log(` ${R.Ay.cyan(s)}: ${p}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return h.apply(this,arguments)})),ee(er.command("box-model <nodeId>").description("Get brick dimensions and position")).action((v=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=(yield a.send("DOM.getBoxModel",{nodeId:i})).model;t.json?console.log(JSON.stringify(n,null,2)):(console.log(R.Ay.bold(`Box Model for node ${i}`)),console.log(` Width: ${n.width}`),console.log(` Height: ${n.height}`),n.content&&console.log(` Content: [${n.content.join(", ")}]`),n.padding&&console.log(` Padding: [${n.padding.join(", ")}]`),n.border&&console.log(` Border: [${n.border.join(", ")}]`),n.margin&&console.log(` Margin: [${n.margin.join(", ")}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return v.apply(this,arguments)})),ee(er.command("resolve <nodeId>").description("Resolve brick to JavaScript object with properties")).action((g=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=(yield a.send("DOM.resolveNode",{nodeId:i})).object;if(t.json)return void console.log(JSON.stringify(n,null,2));if(console.log(R.Ay.bold(`Resolved node ${i}`)),console.log(` Type: ${n.type}`),n.className&&console.log(` Class: ${n.className}`),n.description&&console.log(` Description: ${n.description}`),n.objectId&&console.log(` Object ID: ${R.Ay.gray(n.objectId)}`),n.preview?.properties)for(var r of(console.log(R.Ay.bold(" Properties:")),n.preview.properties))console.log(` ${R.Ay.cyan(r.name)}: ${r.value}`)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return g.apply(this,arguments)})),ee(er.command("focus <nodeId>").description("Focus a brick element")).action((y=j(function*(e,t){var a;yield et(t,(a=j(function*(t){yield t.send("DOM.enable");var a=parseInt(e,10);yield t.send("DOM.focus",{nodeId:a}),console.log(R.Ay.green(`Focused node ${a}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return y.apply(this,arguments)}));var eo=Z.command("input").description("Input emulation");ee(eo.command("tap <x> <y>").description("Tap/click at coordinates")).action((b=j(function*(e,t,a){var i;yield et(a,(i=j(function*(i){var n=parseFloat(e),r=parseFloat(t),o=yield i.send("Input.dispatchMouseEvent",{type:"mousePressed",x:n,y:r,button:"left",clickCount:1});yield i.send("Input.dispatchMouseEvent",{type:"mouseReleased",x:n,y:r,button:"left",clickCount:1}),(({x:e,y:t,tapResult:a,json:i})=>{if(i)return console.log(JSON.stringify({x:e,y:t,...a||{}},null,2));console.log(R.Ay.green(`Tapped at (${e}, ${t})`));var n=ei(a?.element||a?.tappedElement||a?.hitElement);if(!n)return console.log(R.Ay.yellow(" Element: none"));console.log(` Element: ${n}`);var r=a?.hitElement,o=a?.tappedElement;if(r&&o&&r.nodeId!==o.nodeId){var s=ei(r);s&&console.log(` Hit: ${s}`)}a&&!1===a.dispatched&&console.log(R.Ay.yellow(" Action: no pressable handler"))})({x:n,y:r,tapResult:o,json:a.json})}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return b.apply(this,arguments)})),ee(eo.command("type <text>").description("Insert text into focused element")).action((D=j(function*(e,t){var a;yield et(t,(a=j(function*(t){yield t.send("Input.insertText",{text:e}),console.log(R.Ay.green(`Typed: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return D.apply(this,arguments)})),ee(eo.command("key <key>").description("Dispatch key event (e.g., Enter, Escape, Tab)")).action((x=j(function*(e,t){var a;yield et(t,(a=j(function*(t){yield t.send("Input.dispatchKeyEvent",{type:"keyDown",key:e}),yield t.send("Input.dispatchKeyEvent",{type:"keyUp",key:e}),console.log(R.Ay.green(`Key: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return x.apply(this,arguments)}));var es=Z.command("network").description("Network inspection");ee(es.command("list").description("Capture snapshot of network activity").option("--duration <ms>","Capture duration in milliseconds","2000")).action((w=j(function*(e){var t;yield et(e,(t=j(function*(t){var a=new Map,i=parseInt(e.duration,10);t.on("Network.requestWillBeSent",e=>{a.set(e.requestId,{method:e.request.method,url:e.request.url,requestId:e.requestId,timestamp:e.timestamp})}),t.on("Network.responseReceived",e=>{var t=a.get(e.requestId);t&&(t.status=e.response.status,t.mimeType=e.response.mimeType)}),t.on("Network.loadingFailed",e=>{var t=a.get(e.requestId);t&&(t.error=e.errorText)}),yield t.send("Network.enable"),yield new Promise(e=>setTimeout(e,i)),yield t.send("Network.disable");var n=[...a.values()];if(e.json)return void console.log(JSON.stringify(n,null,2));if(console.log(R.Ay.bold(`Network Activity (captured ${(i/1e3).toFixed(1)}s, ${n.length} requests)`)),0===n.length)return void console.log(R.Ay.gray(" No network activity captured"));for(var r of n){var o=r.error?R.Ay.red("ERR"):r.status?r.status<300?R.Ay.green(r.status):r.status<400?R.Ay.yellow(r.status):R.Ay.red(r.status):R.Ay.gray("..."),s=r.url.length>60?r.url.substring(0,57)+"...":r.url;console.log(` ${o} ${R.Ay.bold(r.method.padEnd(6))} ${s} ${R.Ay.gray(`(${r.requestId})`)}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return w.apply(this,arguments)})),ee(es.command("get <requestId>").description("Get response body for a network request")).action((_=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("Network.enable");var i=yield a.send("Network.getResponseBody",{requestId:e}),n=i.body,r=i.base64Encoded;t.json?console.log(JSON.stringify({body:n,base64Encoded:r},null,2)):r?console.log(R.Ay.gray(`[base64 encoded, ${n.length} chars]`)):console.log(n)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return _.apply(this,arguments)}));var ep="bricks://app",el="DATA-",ed="properties",eu="entries",ec=e=>{if(null==e||"object"!=typeof e)return{value:e};if("value"in e)return{value:e.value};if("unserializableValue"in e)return{value:e.unserializableValue};if(e.objectId){var t=e.preview?.properties;return Array.isArray(t)&&t.length>0?{value:t.reduce((e,t)=>(e[t.name]=t.value,e),{}),byRef:!0}:{value:e.description||`[${e.type}]`,byRef:!0}}return{value:"undefined"===e.type?void 0:e.description}},em=e=>{var t=e.startsWith(el)?e.slice(el.length):e,a=t.indexOf(":");return a<0?{shortId:t,title:null}:{shortId:t.slice(0,a),title:t.slice(a+1)}},ef=e=>{if(e.startsWith("global:"))return{scope:"global",name:e.slice(7)};if(e.startsWith("subspace:")){var t=e.slice(9),a=t.indexOf(":");return a>0?{scope:"subspace",subspaceUuid:t.slice(0,a),name:t.slice(a+1)}:{scope:"subspace",subspaceUuid:t,name:""}}return{scope:null,name:e}},eh=(e=[])=>{var t=new Map,a=new Map,i=new Set;for(var n of e||[])if(n&&"object"==typeof n){var r=n.shortId,o=n.uuid;r&&i.add(r),o&&(i.add(o),t.set(o,n),a.set(o,o),r&&a.set(r,o))}return{byUuid:t,uuidByScope:a,knownScopes:i}},ev=(e=[])=>e?.byUuid&&e?.uuidByScope&&e?.knownScopes?e:eh(e),eg=(E=j(function*(e){try{var t=yield e.send("Runtime.evaluate",{expression:"JSON.stringify(Object.values(system.subspaces()).map((s) => ({ shortId: s.shortId, uuid: s.uuid, title: s.title })))",objectGroup:"console",returnByValue:!0}),a=t.result;if(t.exceptionDetails||"string"!=typeof a?.value)return[];return JSON.parse(a.value)}catch{return[]}}),function(e){return E.apply(this,arguments)}),ey=(e,{full:t=!1,width:a=100}={})=>{var i="string"==typeof e?e:JSON.stringify(e);return void 0===i?R.Ay.gray("undefined"):t||i.length<=a?i:`${i.substring(0,a)}…`},eb=(e,t)=>{var a=ev(t),i=e.subspaceUuid?a.byUuid.get(e.subspaceUuid):null;return{key:e.rawKey,scope:e.scope,...e.subspaceUuid?{subspaceUuid:e.subspaceUuid}:{},...i?.shortId?{subspaceShortId:i.shortId}:{},name:e.name,value:e.value}},eD=(F=j(function*(e,{databaseName:t,objectStoreName:a,options:i}){var n=parseInt(i.skip??"0",10)||0,r=parseInt(i.limit??"25",10)||25,o=null;try{o=(yield e.send("IndexedDB.getMetadata",{securityOrigin:ep,databaseName:t,objectStoreName:a})).entriesCount}catch{}var s=yield e.send("IndexedDB.requestData",{securityOrigin:ep,databaseName:t,objectStoreName:a,indexName:"",skipCount:n,pageSize:r,returnByValue:!0}),p=s.objectStoreDataEntries,l=s.hasMore,d=!1,u=p.map(e=>{var t=ec(e.key).value,a=ec(e.value),i=a.value;return a.byRef&&(d=!0),{key:t,value:i}});if(i.json)return void console.log(JSON.stringify({database:t,objectStore:a,skip:n,limit:r,total:o,hasMore:!!l,entries:u},null,2));var c=null==o?"":` of ${o}`,m=n>0?`, skipped ${n}`:"";for(var f of(console.log(R.Ay.bold(`${t} / ${a} (${u.length}${c} entries${m})`)),console.log("─".repeat(60)),0===u.length&&console.log(R.Ay.gray(" No entries")),u)){var h=f.key,v=f.value,g="string"==typeof h?h:JSON.stringify(h);console.log(` ${R.Ay.cyan(g)}: ${ey(v,{full:!!i.full})}`)}l&&console.log(R.Ay.gray(" …more entries available — use -l/--limit and -s/--skip")),d&&console.log(R.Ay.yellow("\n Some values came back as object handles (device app without by-value reads).\n Update the device app to see full values."))}),function(e,t){return F.apply(this,arguments)}),ex=e=>e.option("-l, --limit <count>","Max items to fetch","25").option("-s, --skip <count>","Items to skip","0").option("--full","Do not truncate values"),ew=Z.command("storage").description("Storage inspection (read-only — CDP cannot mutate device storage)");ee(ew.command("list").description("Overview of all storage stores with entry counts")).action((A=j(function*(e){var t;yield et(e,(t=j(function*(t){yield t.send("DOMStorage.enable"),yield t.send("IndexedDB.enable");var a,i=(a=j(function*(e){return(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ep,isLocalStorage:e}})).entries.length}),function(e){return a.apply(this,arguments)}),n=yield i(!0),r=yield i(!1),o=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:ep})).databaseNames,s=[];for(var p of o){var l=p.startsWith(el)?ed:eu,d=null;try{d=(yield t.send("IndexedDB.getMetadata",{securityOrigin:ep,databaseName:p,objectStoreName:l})).entriesCount}catch{}s.push({name:p,objectStoreName:l,entriesCount:d})}var u=s.filter(e=>e.name.startsWith(el)).map(e=>({...e,...em(e.name)})),c=s.filter(e=>!e.name.startsWith(el));if(e.json)return void console.log(JSON.stringify({system:{persist:n,memory:r},dataBanks:u,caches:c},null,2));var m=e=>null==e?R.Ay.gray("? entries"):`${e} entries`;for(var f of(console.log(R.Ay.bold("Storage Overview")+R.Ay.gray(" (read-only)")),console.log("─".repeat(60)),console.log(` ${R.Ay.bold("System storage")}${R.Ay.gray(" → storage system persist|memory")}`),console.log(` persist ${m(n)}`),console.log(` memory ${m(r)}`),console.log(` ${R.Ay.bold("Data banks")}${R.Ay.gray(" → storage data-bank get <S_xxxx|title>")}`),0===u.length&&console.log(R.Ay.gray(" none")),u)){var h=f.title?` "${f.title}"`:"";console.log(` ${R.Ay.cyan(f.shortId)}${h} ${m(f.entriesCount)}`)}for(var v of(console.log(` ${R.Ay.bold("Caches")}${R.Ay.gray(" → storage cache generator|generative-media")}`),0===c.length&&console.log(R.Ay.gray(" none")),c))console.log(` ${R.Ay.cyan(v.name)} ${m(v.entriesCount)}`);console.log("─".repeat(60))}),function(e){return t.apply(this,arguments)}))}),function(e){return A.apply(this,arguments)}));var e_=ew.command("system").description("System key-value storage"),eE=e=>e.option("--scope <scope>","Filter by scope: global or a subspace S_xxxx/UUID").option("--prefix <prefix>","Filter by key-name prefix (within the scope)").option("--full","Do not truncate values"),eF=(e,t)=>{var a;return a=j(function*(a){var i;yield et(a,(i=j(function*(i){yield i.send("DOMStorage.enable");var n=(yield i.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ep,isLocalStorage:e}})).entries,r=yield eg(i),o=eh(r),s=((e,{scope:t,prefix:a,subspaceIndex:i=[]}={})=>{var n=ev(i),r=t&&"global"!==t?n.uuidByScope.get(t)||t:null;return e.map(([e,t])=>({rawKey:e,value:t,...ef(e)})).filter(e=>("global"!==t||"global"===e.scope)&&(!r||"subspace"===e.scope&&e.subspaceUuid===r)&&(!a||!!e.name.startsWith(a)))})(n,{scope:a.scope,prefix:a.prefix,subspaceIndex:o});if(a.json)return void console.log(JSON.stringify(s.map(e=>eb(e,o)),null,2));if(((e,{label:t,subspaceIndex:a,full:i})=>{var n=ev(a);if(console.log(R.Ay.bold(`${t} (${e.length} items)`)),console.log("─".repeat(60)),0===e.length)return console.log(R.Ay.gray(" No entries"));var r=null;for(var o of e){var s="subspace"===o.scope?`subspace:${o.subspaceUuid}`:o.scope;if(s!==r)if(r=s,"subspace"===o.scope){var p=n.byUuid.get(o.subspaceUuid),l=p?`${p.shortId}${p.title?` "${p.title}"`:""} `:"";console.log(` ${R.Ay.bold(`subspace ${l}`)}${R.Ay.gray(`(${o.subspaceUuid})`)}`)}else console.log(` ${R.Ay.bold(o.scope||"other")}`);var d=o.name||o.rawKey;console.log(` ${R.Ay.cyan(d)}: ${ey(o.value,{full:i,width:80})}`)}})(s,{label:t,subspaceIndex:o,full:!!a.full}),0===s.length&&a.scope&&"global"!==a.scope&&!o.knownScopes.has(a.scope)){var p=r.map(e=>e.shortId).join(", ");console.log(R.Ay.yellow(` Scope "${a.scope}" did not match a known subspace${p?` (known: ${p})`:""}`))}}),function(e){return i.apply(this,arguments)}))}),function(e){return a.apply(this,arguments)}};eE(ee(e_.command("persist").description("Show persistent system storage entries"))).action(eF(!0,"Persistent Storage")),eE(ee(e_.command("memory").description("Show in-memory system storage entries"))).action(eF(!1,"Memory Storage")),ee(e_.command("get <key>").description("Show a single system storage value (full, untruncated)").option("--scope <scope>","Key scope: global (default) or a subspace S_xxxx/UUID","global").option("--memory","Read from in-memory storage instead of persistent")).action((C=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOMStorage.enable");var i=(yield a.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ep,isLocalStorage:!t.memory}})).entries,n=eh((yield eg(a))),r=[e];if("global"===t.scope)r.push(`global:${e}`);else{var o=n.uuidByScope.get(t.scope)||t.scope;r.push(`subspace:${o}:${e}`)}var s=i.map(([e,t])=>({rawKey:e,value:t,...ef(e)})).find(e=>r.includes(e.rawKey));if(!s){var p=i.map(([e])=>e).filter(t=>t.toLowerCase().includes(e.toLowerCase())).slice(0,5);if(p.length>0)for(var l of(console.error(R.Ay.yellow("Similar keys:")),p))console.error(` ${l}`);throw Error(`Key not found: ${r[r.length-1]}`)}if(t.json)return void console.log(JSON.stringify(eb(s,n),null,2));if("string"==typeof s.value)try{console.log(JSON.stringify(JSON.parse(s.value),null,2));return}catch{}console.log("string"==typeof s.value?s.value:JSON.stringify(s.value,null,2))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return C.apply(this,arguments)}));var eA=ew.command("data-bank").description("Data bank (Property Bank) stores");ee(eA.command("list").description("List data banks")).action((S=j(function*(e){var t;yield et(e,(t=j(function*(t){yield t.send("IndexedDB.enable");var a=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:ep})).databaseNames,i=[];for(var n of a.filter(e=>e.startsWith(el))){var r=null;try{r=(yield t.send("IndexedDB.getMetadata",{securityOrigin:ep,databaseName:n,objectStoreName:ed})).entriesCount}catch{}i.push({name:n,...em(n),entriesCount:r})}if(e.json)return void console.log(JSON.stringify(i,null,2));for(var o of(console.log(R.Ay.bold(`Data Banks (${i.length})`)),console.log("─".repeat(60)),0===i.length&&console.log(R.Ay.gray(" No data banks")),i)){var s=o.title?` ${R.Ay.green(`"${o.title}"`)}`:"",p=null===o.entriesCount||void 0===o.entriesCount?"":R.Ay.gray(` ${o.entriesCount} entries`);console.log(` ${R.Ay.cyan(o.shortId)}${s}${p}`)}console.log(R.Ay.gray("\nInspect: bricks devtools storage data-bank get <S_xxxx|title>"))}),function(e){return t.apply(this,arguments)}))}),function(e){return S.apply(this,arguments)})),ex(ee(eA.command("get <bank> [store]").description(`Show data bank entries — <bank> accepts a subspace S_xxxx, a title keyword, or the full DATA-* database name; [store] defaults to "${ed}"`))).action((T=j(function*(e,t,a){var i;yield et(a,(i=j(function*(i){yield i.send("IndexedDB.enable");var n=(yield i.send("IndexedDB.requestDatabaseNames",{securityOrigin:ep})).databaseNames,r=((e,t)=>{var a=e.filter(e=>e.startsWith(el)),i=a.find(e=>e===t||e===`${el}${t}`);if(i)return{match:i};if(t.startsWith("S_")){var n=a.filter(e=>em(e).shortId===t);if(1===n.length)return{match:n[0]};if(n.length>1)return{candidates:n}}var r=t.toLowerCase(),o=a.filter(e=>e.slice(el.length).toLowerCase().includes(r));return 1===o.length?{match:o[0]}:{candidates:o}})(n,e);if(!r.match){var o=n.filter(e=>e.startsWith(el)),s=(r.candidates?.length||0)>1,p=s?r.candidates:o;for(var l of(console.error(R.Ay.yellow(s?`Data bank "${e}" is ambiguous. Candidates:`:`Data bank "${e}" not found. Available:`)),p)){var d=em(l),u=d.shortId,c=d.title;console.error(` ${u}${c?` "${c}"`:""}`)}process.exit(1)}yield eD(i,{databaseName:r.match,objectStoreName:t||ed,options:a})}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return T.apply(this,arguments)}));var eC=ew.command("cache").description("Cache stores (generator, generative-media)"),eS=e=>{var t;return t=j(function*(t){var a;yield et(t,(a=j(function*(a){yield a.send("IndexedDB.enable"),yield eD(a,{databaseName:e,objectStoreName:eu,options:t})}),function(e){return a.apply(this,arguments)}))}),function(e){return t.apply(this,arguments)}};ex(ee(eC.command("generator").description("Show generator cache entries"))).action(eS("GENERATOR_CACHE")),ex(ee(eC.command("generative-media").description("Show generative media cache entries"))).action(eS("GENERATIVE_MEDIA_CACHE")),ex(ee(ew.command("generator-cache",{hidden:!0}).description("Alias of `storage cache generator`"))).action(eS("GENERATOR_CACHE"));var eT=Z.command("runtime").description("Runtime and evaluation");ee(eT.command("eval <expression>").description("Evaluate JavaScript expression").option("--await","Await promise result")).action((k=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("Runtime.enable");var i=yield a.send("Runtime.evaluate",{expression:e,objectGroup:"console",returnByValue:!0,awaitPromise:!!t.await,generatePreview:!0});if(t.json)return void console.log(JSON.stringify(i,null,2));i.exceptionDetails&&(console.error(R.Ay.red(`Error: ${i.exceptionDetails.text}`)),i.exceptionDetails.exception?.description&&console.error(R.Ay.red(i.exceptionDetails.exception.description)),process.exit(1));var n=i.result;"undefined"===n.type?console.log(R.Ay.gray("undefined")):void 0!==n.value?console.log("object"==typeof n.value?JSON.stringify(n.value,null,2):String(n.value)):n.description?console.log(n.description):console.log(R.Ay.gray(`[${n.type}${n.subtype?`:${n.subtype}`:""}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return k.apply(this,arguments)})),ee(eT.command("properties <objectId>").description("Get properties of a remote object")).action((N=j(function*(e,t){var a;yield et(t,(a=j(function*(a){var i=(yield a.send("Runtime.getProperties",{objectId:e,ownProperties:!0})).result;if(t.json)return void console.log(JSON.stringify(i,null,2));for(var n of(console.log(R.Ay.bold(`Properties of ${e}`)),i))if(n.enumerable){var r=n.value,o=r?.description||r?.value?.toString()||R.Ay.gray(`[${r?.type}]`);console.log(` ${R.Ay.cyan(n.name)}: ${o}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return N.apply(this,arguments)}));var ek=Z.command("simulator").description("Inspect simulated peripherals (Application Simulator / web preview servers only)").command("thermal-printer").description("Simulated thermal printers and their print results"),eN="This DevTools server does not expose simulator inspection. Connect to an Application Simulator preview (e.g. the CTOR project simulator) running a preview build with the Simulator CDP domain.",eO=e=>{if(!e)return"unknown time";var t=new Date(e);return Number.isNaN(t.getTime())?"unknown time":t.toLocaleString()},eI=e=>{if(e.raw)return"raw data";var t=(e=>{if(!e?.length)return"";var t=[];for(var a of e){var i=t[t.length-1];i&&i.type===a?i.count+=1:t.push({type:a,count:1})}return t.map(({type:e,count:t})=>t>1?`${e}\xd7${t}`:e).join(", ")})(e.commandTypes);return`${e.commandCount} command(s)${t?`: ${t}`:""}`};ee(ek.command("list").description("List simulated thermal printers and their print history").option("--commands","Include full print command payloads (use with -j)")).action((O=j(function*(e){var t;yield et(e,(t=j(function*(t){var a=yield t.send("Simulator.listThermalPrinters",{includeCommands:!!e.commands}),i=a?.printers;if(Array.isArray(i)||(console.error(R.Ay.red(eN)),process.exit(1)),e.json)return void console.log(JSON.stringify(i,null,2));if(0===i.length){console.log(R.Ay.yellow("No simulated thermal printers registered.")),console.log(R.Ay.gray("A printer appears once the application configures GENERATOR_THERMAL_PRINTER."));return}for(var n of(console.log(R.Ay.bold(`Simulated Thermal Printers (${i.length})`)),console.log("─".repeat(60)),i)){var r=n.errored?R.Ay.red("fault"):n.connected?R.Ay.green("connected"):R.Ay.gray("idle");console.log(` ${R.Ay.bold(n.label||n.driver)} ${R.Ay.gray(`(${n.driver})`)} [${r}]`),console.log(` Printer ID: ${R.Ay.cyan(n.id)}`),n.connectString&&console.log(` Connect: ${R.Ay.gray(n.connectString)}`);var o=n.printHistory||[];if(0===o.length){console.log(R.Ay.gray(" No print results yet."));continue}var s="memory"===n.printHistorySource?R.Ay.gray(" (restored from memory)"):"";for(var p of(console.log(` Print results, newest first${s}:`),o))console.log(` --index ${p.index} ${eO(p.printedAt)} ${R.Ay.gray(eI(p))}`)}console.log("─".repeat(60)),console.log(R.Ay.gray("Save one as PNG: bricks devtools simulator thermal-printer print-result"))}),function(e){return t.apply(this,arguments)}))}),function(e){return O.apply(this,arguments)})),ee(ek.command("print-result").description("Render a simulated print result to a PNG image").option("--printer <id>","Printer ID (see `list`; defaults to the only registered printer)").option("-i, --index <n>","Print history index, 0 = latest","0").option("--scale <factor>","Image scale factor (1-4)","2").option("-o, --output <path>","Output file path")).action((I=j(function*(e){var t;yield et(e,(t=j(function*(t){var i=yield t.send("Simulator.captureThermalPrinterPrintResult",{id:e.printer,index:parseInt(e.index,10)||0,scale:parseFloat(e.scale)||2},3e4);i?.data||(console.error(R.Ay.red(eN)),process.exit(1));var n=yield Promise.resolve().then(a.t.bind(a,73024,19)),r=yield Promise.resolve().then(a.t.bind(a,76760,19)),o=e.output||`print-result-${Date.now()}.png`,s=r.resolve(o);(n.writeFileSync(s,Buffer.from(i.data,"base64")),e.json)?console.log(JSON.stringify({path:s,id:i.id,driver:i.driver,label:i.label,index:i.index,printedAt:i.printedAt,width:i.width,height:i.height},null,2)):(console.log(R.Ay.green(`Print result saved to ${s}`)),console.log(` Printer: ${i.label} ${R.Ay.gray(`(${i.driver}, ${i.id})`)}`),console.log(` Printed: ${eO(i.printedAt)} (--index ${i.index})`),i.width&&i.height&&console.log(` Size: ${i.width}\xd7${i.height}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return I.apply(this,arguments)}))},11405(e,t,a){a.d(t,{l:()=>v});var i,n,r,o=a(99436),s=a(35679),p=a(7586),l=a(85382),d=a(8479),u=a(47988),c=(i=o(function*(){try{return yield Promise.all([a.e(587),a.e(647),a.e(10),a.e(117)]).then(a.bind(a,98372)),{available:!0}}catch(e){return{available:!1,error:e.message}}}),function(){return i.apply(this,arguments)}),m=(e,t,a)=>({severity:e,code:t,message:a}),f=(n=o(function*({version:e="2.25.0-beta.51",mcpCheck:t=c}={}){var a=(0,u.getCurrentProfile)(),i=(0,u.getCurrentProfileSource)(),n=(0,u.getTokenInfo)(a),r=(0,u.getBaseUrl)(),o=(0,u.getActivityLogBaseUrl)(),s=[],f={ok:!1,timestamp:new Date().toISOString(),cli:{name:"bricks",version:e},profile:{name:a,source:i},config:{path:u.CONFIG_PATH,baseUrl:r,activityLogBaseUrl:o},auth:{available:!!n?.token,source:n?.token?"config":"missing",workspaceId:n?.workspaceId||null,workspaceName:n?.workspaceName||null,createdAt:n?.createdAt||null,tokenPreview:(0,p.$l)(n?.token)},connectivity:{workspace:{ok:!1,skipped:!n?.token,error:null}},capabilities:{zeroArgMode:(0,d.z)()?"interactive":"help",mcp:{available:!1,error:null}},issues:s};if(n?.token)try{var h=yield(0,l.createClient)(r,n.token).workspace();f.connectivity.workspace={ok:!0,skipped:!1,error:null,id:h?._id||n.workspaceId||null,name:h?.name||n.workspaceName||null},f.auth.workspaceId=h?._id||f.auth.workspaceId,f.auth.workspaceName=h?.name||f.auth.workspaceName}catch(e){f.connectivity.workspace={ok:!1,skipped:!1,error:e.message},s.push(m("error","workspace_unreachable",`Workspace query failed for ${r}: ${e.message}`))}else s.push(m("warning","auth_missing","No saved token for the current profile."));var v=yield t();return f.capabilities.mcp={available:v.available,error:v.error||null},v.available||s.push(m("warning","mcp_unavailable",`MCP stdio server is unavailable: ${v.error||"Unknown error"}`)),f.ok=0===s.length,f}),function(){return n.apply(this,arguments)}),h=(e,t,a)=>`${e.padEnd(14)} ${t}${a?` ${a}`:""}`,v=new s.uB("doctor").description("Check CLI configuration, auth state, and workspace reachability").option("-j, --json","Output as JSON").action((r=o(function*(e){try{var t=yield f();if(e.json)return void(0,p.GF)(t);console.log((e=>{var t=[];if(t.push("BRICKS CLI Doctor"),t.push("─".repeat(60)),t.push(h("CLI","OK",`bricks v${e.cli.version}`)),t.push(h("Profile","OK",`${e.profile.name} (${e.profile.source})`)),t.push(h("BRICKS API","OK",e.config.baseUrl)),t.push(h("Activity Log","OK",e.config.activityLogBaseUrl)),e.auth.available){var a=e.auth.workspaceName||e.auth.workspaceId||"Unknown workspace";t.push(h("Auth","OK",`${a} (${e.auth.source}, ${e.auth.tokenPreview})`))}else t.push(h("Auth","WARN","No saved token for the current profile"));if(e.connectivity.workspace.skipped)t.push(h("Workspace","WARN","Skipped because no token is available"));else if(e.connectivity.workspace.ok){var i=e.connectivity.workspace.name||e.connectivity.workspace.id||"Unknown workspace";t.push(h("Workspace","OK",i))}else t.push(h("Workspace","FAIL",e.connectivity.workspace.error));return e.capabilities.mcp.available?t.push(h("MCP","OK","STDIO server import is available")):t.push(h("MCP","WARN",e.capabilities.mcp.error)),t.push(h("Zero-arg mode",((e,t=!1)=>e?"OK":t?"WARN":"FAIL")("interactive"===e.capabilities.zeroArgMode,"help"===e.capabilities.zeroArgMode),"interactive"===e.capabilities.zeroArgMode?"Starts Ink interactive mode on TTY":"Shows help outside TTY contexts")),e.issues.length>0&&(t.push("─".repeat(60)),t.push("Issues"),e.issues.forEach(e=>{t.push(`- [${e.severity}] ${e.message}`)})),t.join("\n")})(t))}catch(t){e.json?(0,p.OW)(t.message):console.error(`Doctor failed: ${t.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)}))},28634(e,t,a){a.d(t,{p:()=>w});var i,n,r,o,s,p,l,d=a(68832),u=a(99436),c=a(35679),m=a(73284),f=a(30155),h=a(7586),v=a(56493),g=a(68168),y=a(98593),b=e=>{if(!e)return m.Ay.gray("○");var t=Date.now()-new Date(e).getTime();return t<=3e5?m.Ay.green("●"):60>Math.floor(t/6e4)?m.Ay.yellow("○"):m.Ay.red("○")},D=(e,t)=>(0,y.H_)(e,t,{deviceCount:e?.devices?.length||0}),x=["refresh","clear-cache","system-menu-open","system-menu-close","system-info-open","system-info-close","local-sync-panel-open","local-sync-panel-close","debug-panel-open","debug-panel-close","logging-on","logging-off","test-panel-open","test-panel-close"],w=new c.uB("group").description("Device Group management");w.command("list").description("List all device groups").option("-j, --json","Output as JSON").action((i=u(function*(e){var t=(0,v.o)(),a=(0,f.default)("Fetching device groups...").start();try{var i=yield t.deviceGroups({});if(a.stop(),e.json)return void console.log(JSON.stringify(i,null,2));if(!i||0===i.length)return void console.log(m.Ay.yellow("No device groups found"));console.log(m.Ay.bold("\nDevice Groups")),console.log("─".repeat(80)),i.forEach(e=>{var t=e.devices?.length||0;console.log(`● ${m.Ay.cyan(e.name)} ${m.Ay.gray(`(${t} devices)`)}`),console.log(` ID: ${m.Ay.gray(e._id)}`),e.description&&console.log(` ${m.Ay.gray(e.description)}`),console.log()})}catch(e){a.fail(`Failed to list groups: ${e.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)})),w.command("get <id>").description("Get device group details").option("-j, --json","Output as JSON").action((n=u(function*(e,t){var a=(0,v.o)(),i=(0,f.default)("Fetching device group...").start();try{var n=yield a.deviceGroup({id:e});if(i.stop(),n||(console.log(m.Ay.red("Device group not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(n,null,2));console.log(m.Ay.bold(`
|
|
106
|
+
Use --info to see connection URLs`))}),function(e,t){return d.apply(this,arguments)})),ee(Z.command("screenshot").description("Capture device screenshot").option("-o, --output <path>","Output file path")).action((u=j(function*(e){var t;yield et(e,(t=j(function*(t){var i=yield t.send("Page.captureScreenshot",{format:"png"});i.data||(console.error(R.Ay.red("No screenshot data received")),process.exit(1));var n=yield Promise.resolve().then(a.t.bind(a,73024,19)),r=yield Promise.resolve().then(a.t.bind(a,76760,19)),o=e.output||`screenshot-${Date.now()}.png`,s=r.resolve(o);n.writeFileSync(s,Buffer.from(i.data,"base64")),console.log(R.Ay.green(`Screenshot saved to ${s}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return u.apply(this,arguments)}));var er=Z.command("brick").description("Brick component inspection");ee(er.command("tree").description("Print brick component tree").option("-d, --depth <depth>","Max depth (-1 for full)","3")).action((c=j(function*(e){var t;yield et(e,(t=j(function*(t){yield t.send("DOM.enable");var a=parseInt(e.depth,10),i=(yield t.send("DOM.getDocument",{depth:a})).root;e.json?console.log(JSON.stringify(i,null,2)):console.log(en(i).join("\n"))}),function(e){return t.apply(this,arguments)}))}),function(e){return c.apply(this,arguments)})),ee(er.command("query <selector>").description("Find brick by CSS selector")).action((m=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOM.enable");var i=(yield a.send("DOM.getDocument",{depth:0})).root,n=(yield a.send("DOM.querySelector",{nodeId:i.nodeId,selector:e})).nodeId;if(0===n)return void console.log(R.Ay.yellow("No element found"));var r=yield a.send("DOM.describeNode",{nodeId:n}),o=ea((yield a.send("DOM.getAttributes",{nodeId:n})).attributes);if(t.json)return void console.log(JSON.stringify({nodeId:n,...r.node,attributes:o},null,2));if(console.log(R.Ay.bold(`Node ${n}: ${r.node?.nodeName||"unknown"}`)),Object.keys(o).length>0)for(var s of(console.log(R.Ay.bold("Attributes:")),Object.entries(o))){var p=$(s,2),l=p[0],d=p[1];console.log(` ${R.Ay.cyan(l)}: ${d}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return m.apply(this,arguments)})),ee(er.command("query-all <selector>").description("Find all bricks matching CSS selector")).action((f=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOM.enable");var i=(yield a.send("DOM.getDocument",{depth:0})).root,n=(yield a.send("DOM.querySelectorAll",{nodeId:i.nodeId,selector:e})).nodeIds;if(t.json)return void console.log(JSON.stringify({nodeIds:n,count:n.length},null,2));for(var r of(console.log(R.Ay.bold(`Found ${n.length} element(s)`)),n)){var o=yield a.send("DOM.describeNode",{nodeId:r}),s=ea((yield a.send("DOM.getAttributes",{nodeId:r})).attributes),p=s.id||s["short-id"]||"";console.log(` ${r}: ${o.node?.nodeName}${p?R.Ay.gray(`#${p}`):""}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return f.apply(this,arguments)})),ee(er.command("attributes <nodeId>").description("Get brick attributes")).action((h=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=ea((yield a.send("DOM.getAttributes",{nodeId:i})).attributes);if(t.json)return void console.log(JSON.stringify(n,null,2));if(0===Object.keys(n).length)return void console.log(R.Ay.gray("No attributes"));for(var r of Object.entries(n)){var o=$(r,2),s=o[0],p=o[1];console.log(` ${R.Ay.cyan(s)}: ${p}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return h.apply(this,arguments)})),ee(er.command("box-model <nodeId>").description("Get brick dimensions and position")).action((v=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=(yield a.send("DOM.getBoxModel",{nodeId:i})).model;t.json?console.log(JSON.stringify(n,null,2)):(console.log(R.Ay.bold(`Box Model for node ${i}`)),console.log(` Width: ${n.width}`),console.log(` Height: ${n.height}`),n.content&&console.log(` Content: [${n.content.join(", ")}]`),n.padding&&console.log(` Padding: [${n.padding.join(", ")}]`),n.border&&console.log(` Border: [${n.border.join(", ")}]`),n.margin&&console.log(` Margin: [${n.margin.join(", ")}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return v.apply(this,arguments)})),ee(er.command("resolve <nodeId>").description("Resolve brick to JavaScript object with properties")).action((g=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOM.enable");var i=parseInt(e,10),n=(yield a.send("DOM.resolveNode",{nodeId:i})).object;if(t.json)return void console.log(JSON.stringify(n,null,2));if(console.log(R.Ay.bold(`Resolved node ${i}`)),console.log(` Type: ${n.type}`),n.className&&console.log(` Class: ${n.className}`),n.description&&console.log(` Description: ${n.description}`),n.objectId&&console.log(` Object ID: ${R.Ay.gray(n.objectId)}`),n.preview?.properties)for(var r of(console.log(R.Ay.bold(" Properties:")),n.preview.properties))console.log(` ${R.Ay.cyan(r.name)}: ${r.value}`)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return g.apply(this,arguments)})),ee(er.command("focus <nodeId>").description("Focus a brick element")).action((y=j(function*(e,t){var a;yield et(t,(a=j(function*(t){yield t.send("DOM.enable");var a=parseInt(e,10);yield t.send("DOM.focus",{nodeId:a}),console.log(R.Ay.green(`Focused node ${a}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return y.apply(this,arguments)}));var eo=Z.command("input").description("Input emulation");ee(eo.command("tap <x> <y>").description("Tap/click at coordinates")).action((b=j(function*(e,t,a){var i;yield et(a,(i=j(function*(i){var n=parseFloat(e),r=parseFloat(t),o=yield i.send("Input.dispatchMouseEvent",{type:"mousePressed",x:n,y:r,button:"left",clickCount:1});yield i.send("Input.dispatchMouseEvent",{type:"mouseReleased",x:n,y:r,button:"left",clickCount:1}),(({x:e,y:t,tapResult:a,json:i})=>{if(i)return console.log(JSON.stringify({x:e,y:t,...a||{}},null,2));console.log(R.Ay.green(`Tapped at (${e}, ${t})`));var n=ei(a?.element||a?.tappedElement||a?.hitElement);if(!n)return console.log(R.Ay.yellow(" Element: none"));console.log(` Element: ${n}`);var r=a?.hitElement,o=a?.tappedElement;if(r&&o&&r.nodeId!==o.nodeId){var s=ei(r);s&&console.log(` Hit: ${s}`)}a&&!1===a.dispatched&&console.log(R.Ay.yellow(" Action: no pressable handler"))})({x:n,y:r,tapResult:o,json:a.json})}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return b.apply(this,arguments)})),ee(eo.command("type <text>").description("Insert text into focused element")).action((D=j(function*(e,t){var a;yield et(t,(a=j(function*(t){yield t.send("Input.insertText",{text:e}),console.log(R.Ay.green(`Typed: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return D.apply(this,arguments)})),ee(eo.command("key <key>").description("Dispatch key event (e.g., Enter, Escape, Tab)")).action((x=j(function*(e,t){var a;yield et(t,(a=j(function*(t){yield t.send("Input.dispatchKeyEvent",{type:"keyDown",key:e}),yield t.send("Input.dispatchKeyEvent",{type:"keyUp",key:e}),console.log(R.Ay.green(`Key: ${e}`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return x.apply(this,arguments)}));var es=Z.command("network").description("Network inspection");ee(es.command("list").description("Capture snapshot of network activity").option("--duration <ms>","Capture duration in milliseconds","2000")).action((w=j(function*(e){var t;yield et(e,(t=j(function*(t){var a=new Map,i=parseInt(e.duration,10);t.on("Network.requestWillBeSent",e=>{a.set(e.requestId,{method:e.request.method,url:e.request.url,requestId:e.requestId,timestamp:e.timestamp})}),t.on("Network.responseReceived",e=>{var t=a.get(e.requestId);t&&(t.status=e.response.status,t.mimeType=e.response.mimeType)}),t.on("Network.loadingFailed",e=>{var t=a.get(e.requestId);t&&(t.error=e.errorText)}),yield t.send("Network.enable"),yield new Promise(e=>setTimeout(e,i)),yield t.send("Network.disable");var n=[...a.values()];if(e.json)return void console.log(JSON.stringify(n,null,2));if(console.log(R.Ay.bold(`Network Activity (captured ${(i/1e3).toFixed(1)}s, ${n.length} requests)`)),0===n.length)return void console.log(R.Ay.gray(" No network activity captured"));for(var r of n){var o=r.error?R.Ay.red("ERR"):r.status?r.status<300?R.Ay.green(r.status):r.status<400?R.Ay.yellow(r.status):R.Ay.red(r.status):R.Ay.gray("..."),s=r.url.length>60?r.url.substring(0,57)+"...":r.url;console.log(` ${o} ${R.Ay.bold(r.method.padEnd(6))} ${s} ${R.Ay.gray(`(${r.requestId})`)}`)}}),function(e){return t.apply(this,arguments)}))}),function(e){return w.apply(this,arguments)})),ee(es.command("get <requestId>").description("Get response body for a network request")).action((_=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("Network.enable");var i=yield a.send("Network.getResponseBody",{requestId:e}),n=i.body,r=i.base64Encoded;t.json?console.log(JSON.stringify({body:n,base64Encoded:r},null,2)):r?console.log(R.Ay.gray(`[base64 encoded, ${n.length} chars]`)):console.log(n)}),function(e){return a.apply(this,arguments)}))}),function(e,t){return _.apply(this,arguments)}));var ep="bricks://app",el="DATA-",ed="properties",eu="entries",ec=e=>{if(null==e||"object"!=typeof e)return{value:e};if("value"in e)return{value:e.value};if("unserializableValue"in e)return{value:e.unserializableValue};if(e.objectId){var t=e.preview?.properties;return Array.isArray(t)&&t.length>0?{value:t.reduce((e,t)=>(e[t.name]=t.value,e),{}),byRef:!0}:{value:e.description||`[${e.type}]`,byRef:!0}}return{value:"undefined"===e.type?void 0:e.description}},em=e=>{var t=e.startsWith(el)?e.slice(el.length):e,a=t.indexOf(":");return a<0?{shortId:t,title:null}:{shortId:t.slice(0,a),title:t.slice(a+1)}},ef=e=>{if(e.startsWith("global:"))return{scope:"global",name:e.slice(7)};if(e.startsWith("subspace:")){var t=e.slice(9),a=t.indexOf(":");return a>0?{scope:"subspace",subspaceUuid:t.slice(0,a),name:t.slice(a+1)}:{scope:"subspace",subspaceUuid:t,name:""}}return{scope:null,name:e}},eh=(e=[])=>{var t=new Map,a=new Map,i=new Set;for(var n of e||[])if(n&&"object"==typeof n){var r=n.shortId,o=n.uuid;r&&i.add(r),o&&(i.add(o),t.set(o,n),a.set(o,o),r&&a.set(r,o))}return{byUuid:t,uuidByScope:a,knownScopes:i}},ev=(e=[])=>e?.byUuid&&e?.uuidByScope&&e?.knownScopes?e:eh(e),eg=(E=j(function*(e){try{var t=yield e.send("Runtime.evaluate",{expression:"JSON.stringify(Object.values(system.subspaces()).map((s) => ({ shortId: s.shortId, uuid: s.uuid, title: s.title })))",objectGroup:"console",returnByValue:!0}),a=t.result;if(t.exceptionDetails||"string"!=typeof a?.value)return[];return JSON.parse(a.value)}catch{return[]}}),function(e){return E.apply(this,arguments)}),ey=(e,{full:t=!1,width:a=100}={})=>{var i="string"==typeof e?e:JSON.stringify(e);return void 0===i?R.Ay.gray("undefined"):t||i.length<=a?i:`${i.substring(0,a)}…`},eb=(e,t)=>{var a=ev(t),i=e.subspaceUuid?a.byUuid.get(e.subspaceUuid):null;return{key:e.rawKey,scope:e.scope,...e.subspaceUuid?{subspaceUuid:e.subspaceUuid}:{},...i?.shortId?{subspaceShortId:i.shortId}:{},name:e.name,value:e.value}},eD=(F=j(function*(e,{databaseName:t,objectStoreName:a,options:i}){var n=parseInt(i.skip??"0",10)||0,r=parseInt(i.limit??"25",10)||25,o=null;try{o=(yield e.send("IndexedDB.getMetadata",{securityOrigin:ep,databaseName:t,objectStoreName:a})).entriesCount}catch{}var s=yield e.send("IndexedDB.requestData",{securityOrigin:ep,databaseName:t,objectStoreName:a,indexName:"",skipCount:n,pageSize:r,returnByValue:!0}),p=s.objectStoreDataEntries,l=s.hasMore,d=!1,u=p.map(e=>{var t=ec(e.key).value,a=ec(e.value),i=a.value;return a.byRef&&(d=!0),{key:t,value:i}});if(i.json)return void console.log(JSON.stringify({database:t,objectStore:a,skip:n,limit:r,total:o,hasMore:!!l,entries:u},null,2));var c=null==o?"":` of ${o}`,m=n>0?`, skipped ${n}`:"";for(var f of(console.log(R.Ay.bold(`${t} / ${a} (${u.length}${c} entries${m})`)),console.log("─".repeat(60)),0===u.length&&console.log(R.Ay.gray(" No entries")),u)){var h=f.key,v=f.value,g="string"==typeof h?h:JSON.stringify(h);console.log(` ${R.Ay.cyan(g)}: ${ey(v,{full:!!i.full})}`)}l&&console.log(R.Ay.gray(" …more entries available — use -l/--limit and -s/--skip")),d&&console.log(R.Ay.yellow("\n Some values came back as object handles (device app without by-value reads).\n Update the device app to see full values."))}),function(e,t){return F.apply(this,arguments)}),ex=e=>e.option("-l, --limit <count>","Max items to fetch","25").option("-s, --skip <count>","Items to skip","0").option("--full","Do not truncate values"),ew=Z.command("storage").description("Storage inspection (read-only — CDP cannot mutate device storage)");ee(ew.command("list").description("Overview of all storage stores with entry counts")).action((A=j(function*(e){var t;yield et(e,(t=j(function*(t){yield t.send("DOMStorage.enable"),yield t.send("IndexedDB.enable");var a,i=(a=j(function*(e){return(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ep,isLocalStorage:e}})).entries.length}),function(e){return a.apply(this,arguments)}),n=yield i(!0),r=yield i(!1),o=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:ep})).databaseNames,s=[];for(var p of o){var l=p.startsWith(el)?ed:eu,d=null;try{d=(yield t.send("IndexedDB.getMetadata",{securityOrigin:ep,databaseName:p,objectStoreName:l})).entriesCount}catch{}s.push({name:p,objectStoreName:l,entriesCount:d})}var u=s.filter(e=>e.name.startsWith(el)).map(e=>({...e,...em(e.name)})),c=s.filter(e=>!e.name.startsWith(el));if(e.json)return void console.log(JSON.stringify({system:{persist:n,memory:r},dataBanks:u,caches:c},null,2));var m=e=>null==e?R.Ay.gray("? entries"):`${e} entries`;for(var f of(console.log(R.Ay.bold("Storage Overview")+R.Ay.gray(" (read-only)")),console.log("─".repeat(60)),console.log(` ${R.Ay.bold("System storage")}${R.Ay.gray(" → storage system persist|memory")}`),console.log(` persist ${m(n)}`),console.log(` memory ${m(r)}`),console.log(` ${R.Ay.bold("Data banks")}${R.Ay.gray(" → storage data-bank get <S_xxxx|title>")}`),0===u.length&&console.log(R.Ay.gray(" none")),u)){var h=f.title?` "${f.title}"`:"";console.log(` ${R.Ay.cyan(f.shortId)}${h} ${m(f.entriesCount)}`)}for(var v of(console.log(` ${R.Ay.bold("Caches")}${R.Ay.gray(" → storage cache generator|generative-media")}`),0===c.length&&console.log(R.Ay.gray(" none")),c))console.log(` ${R.Ay.cyan(v.name)} ${m(v.entriesCount)}`);console.log("─".repeat(60))}),function(e){return t.apply(this,arguments)}))}),function(e){return A.apply(this,arguments)}));var e_=ew.command("system").description("System key-value storage"),eE=e=>e.option("--scope <scope>","Filter by scope: global or a subspace S_xxxx/UUID").option("--prefix <prefix>","Filter by key-name prefix (within the scope)").option("--full","Do not truncate values"),eF=(e,t)=>{var a;return a=j(function*(a){var i;yield et(a,(i=j(function*(i){yield i.send("DOMStorage.enable");var n=(yield i.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ep,isLocalStorage:e}})).entries,r=yield eg(i),o=eh(r),s=((e,{scope:t,prefix:a,subspaceIndex:i=[]}={})=>{var n=ev(i),r=t&&"global"!==t?n.uuidByScope.get(t)||t:null;return e.map(([e,t])=>({rawKey:e,value:t,...ef(e)})).filter(e=>("global"!==t||"global"===e.scope)&&(!r||"subspace"===e.scope&&e.subspaceUuid===r)&&(!a||!!e.name.startsWith(a)))})(n,{scope:a.scope,prefix:a.prefix,subspaceIndex:o});if(a.json)return void console.log(JSON.stringify(s.map(e=>eb(e,o)),null,2));if(((e,{label:t,subspaceIndex:a,full:i})=>{var n=ev(a);if(console.log(R.Ay.bold(`${t} (${e.length} items)`)),console.log("─".repeat(60)),0===e.length)return console.log(R.Ay.gray(" No entries"));var r=null;for(var o of e){var s="subspace"===o.scope?`subspace:${o.subspaceUuid}`:o.scope;if(s!==r)if(r=s,"subspace"===o.scope){var p=n.byUuid.get(o.subspaceUuid),l=p?`${p.shortId}${p.title?` "${p.title}"`:""} `:"";console.log(` ${R.Ay.bold(`subspace ${l}`)}${R.Ay.gray(`(${o.subspaceUuid})`)}`)}else console.log(` ${R.Ay.bold(o.scope||"other")}`);var d=o.name||o.rawKey;console.log(` ${R.Ay.cyan(d)}: ${ey(o.value,{full:i,width:80})}`)}})(s,{label:t,subspaceIndex:o,full:!!a.full}),0===s.length&&a.scope&&"global"!==a.scope&&!o.knownScopes.has(a.scope)){var p=r.map(e=>e.shortId).join(", ");console.log(R.Ay.yellow(` Scope "${a.scope}" did not match a known subspace${p?` (known: ${p})`:""}`))}}),function(e){return i.apply(this,arguments)}))}),function(e){return a.apply(this,arguments)}};eE(ee(e_.command("persist").description("Show persistent system storage entries"))).action(eF(!0,"Persistent Storage")),eE(ee(e_.command("memory").description("Show in-memory system storage entries"))).action(eF(!1,"Memory Storage")),ee(e_.command("get <key>").description("Show a single system storage value (full, untruncated)").option("--scope <scope>","Key scope: global (default) or a subspace S_xxxx/UUID","global").option("--memory","Read from in-memory storage instead of persistent")).action((C=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("DOMStorage.enable");var i=(yield a.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ep,isLocalStorage:!t.memory}})).entries,n=eh((yield eg(a))),r=[e];if("global"===t.scope)r.push(`global:${e}`);else{var o=n.uuidByScope.get(t.scope)||t.scope;r.push(`subspace:${o}:${e}`)}var s=i.map(([e,t])=>({rawKey:e,value:t,...ef(e)})).find(e=>r.includes(e.rawKey));if(!s){var p=i.map(([e])=>e).filter(t=>t.toLowerCase().includes(e.toLowerCase())).slice(0,5);if(p.length>0)for(var l of(console.error(R.Ay.yellow("Similar keys:")),p))console.error(` ${l}`);throw Error(`Key not found: ${r[r.length-1]}`)}if(t.json)return void console.log(JSON.stringify(eb(s,n),null,2));if("string"==typeof s.value)try{console.log(JSON.stringify(JSON.parse(s.value),null,2));return}catch{}console.log("string"==typeof s.value?s.value:JSON.stringify(s.value,null,2))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return C.apply(this,arguments)}));var eA=ew.command("data-bank").description("Data bank (Property Bank) stores");ee(eA.command("list").description("List data banks")).action((S=j(function*(e){var t;yield et(e,(t=j(function*(t){yield t.send("IndexedDB.enable");var a=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:ep})).databaseNames,i=[];for(var n of a.filter(e=>e.startsWith(el))){var r=null;try{r=(yield t.send("IndexedDB.getMetadata",{securityOrigin:ep,databaseName:n,objectStoreName:ed})).entriesCount}catch{}i.push({name:n,...em(n),entriesCount:r})}if(e.json)return void console.log(JSON.stringify(i,null,2));for(var o of(console.log(R.Ay.bold(`Data Banks (${i.length})`)),console.log("─".repeat(60)),0===i.length&&console.log(R.Ay.gray(" No data banks")),i)){var s=o.title?` ${R.Ay.green(`"${o.title}"`)}`:"",p=null===o.entriesCount||void 0===o.entriesCount?"":R.Ay.gray(` ${o.entriesCount} entries`);console.log(` ${R.Ay.cyan(o.shortId)}${s}${p}`)}console.log(R.Ay.gray("\nInspect: bricks devtools storage data-bank get <S_xxxx|title>"))}),function(e){return t.apply(this,arguments)}))}),function(e){return S.apply(this,arguments)})),ex(ee(eA.command("get <bank> [store]").description(`Show data bank entries — <bank> accepts a subspace S_xxxx, a title keyword, or the full DATA-* database name; [store] defaults to "${ed}"`))).action((T=j(function*(e,t,a){var i;yield et(a,(i=j(function*(i){yield i.send("IndexedDB.enable");var n=(yield i.send("IndexedDB.requestDatabaseNames",{securityOrigin:ep})).databaseNames,r=((e,t)=>{var a=e.filter(e=>e.startsWith(el)),i=a.find(e=>e===t||e===`${el}${t}`);if(i)return{match:i};if(t.startsWith("S_")){var n=a.filter(e=>em(e).shortId===t);if(1===n.length)return{match:n[0]};if(n.length>1)return{candidates:n}}var r=t.toLowerCase(),o=a.filter(e=>e.slice(el.length).toLowerCase().includes(r));return 1===o.length?{match:o[0]}:{candidates:o}})(n,e);if(!r.match){var o=n.filter(e=>e.startsWith(el)),s=(r.candidates?.length||0)>1,p=s?r.candidates:o;for(var l of(console.error(R.Ay.yellow(s?`Data bank "${e}" is ambiguous. Candidates:`:`Data bank "${e}" not found. Available:`)),p)){var d=em(l),u=d.shortId,c=d.title;console.error(` ${u}${c?` "${c}"`:""}`)}process.exit(1)}yield eD(i,{databaseName:r.match,objectStoreName:t||ed,options:a})}),function(e){return i.apply(this,arguments)}))}),function(e,t,a){return T.apply(this,arguments)}));var eC=ew.command("cache").description("Cache stores (generator, generative-media)"),eS=e=>{var t;return t=j(function*(t){var a;yield et(t,(a=j(function*(a){yield a.send("IndexedDB.enable"),yield eD(a,{databaseName:e,objectStoreName:eu,options:t})}),function(e){return a.apply(this,arguments)}))}),function(e){return t.apply(this,arguments)}};ex(ee(eC.command("generator").description("Show generator cache entries"))).action(eS("GENERATOR_CACHE")),ex(ee(eC.command("generative-media").description("Show generative media cache entries"))).action(eS("GENERATIVE_MEDIA_CACHE")),ex(ee(ew.command("generator-cache",{hidden:!0}).description("Alias of `storage cache generator`"))).action(eS("GENERATOR_CACHE"));var eT=Z.command("runtime").description("Runtime and evaluation");ee(eT.command("eval <expression>").description("Evaluate JavaScript expression").option("--await","Await promise result")).action((k=j(function*(e,t){var a;yield et(t,(a=j(function*(a){yield a.send("Runtime.enable");var i=yield a.send("Runtime.evaluate",{expression:e,objectGroup:"console",returnByValue:!0,awaitPromise:!!t.await,generatePreview:!0});if(t.json)return void console.log(JSON.stringify(i,null,2));i.exceptionDetails&&(console.error(R.Ay.red(`Error: ${i.exceptionDetails.text}`)),i.exceptionDetails.exception?.description&&console.error(R.Ay.red(i.exceptionDetails.exception.description)),process.exit(1));var n=i.result;"undefined"===n.type?console.log(R.Ay.gray("undefined")):void 0!==n.value?console.log("object"==typeof n.value?JSON.stringify(n.value,null,2):String(n.value)):n.description?console.log(n.description):console.log(R.Ay.gray(`[${n.type}${n.subtype?`:${n.subtype}`:""}]`))}),function(e){return a.apply(this,arguments)}))}),function(e,t){return k.apply(this,arguments)})),ee(eT.command("properties <objectId>").description("Get properties of a remote object")).action((N=j(function*(e,t){var a;yield et(t,(a=j(function*(a){var i=(yield a.send("Runtime.getProperties",{objectId:e,ownProperties:!0})).result;if(t.json)return void console.log(JSON.stringify(i,null,2));for(var n of(console.log(R.Ay.bold(`Properties of ${e}`)),i))if(n.enumerable){var r=n.value,o=r?.description||r?.value?.toString()||R.Ay.gray(`[${r?.type}]`);console.log(` ${R.Ay.cyan(n.name)}: ${o}`)}}),function(e){return a.apply(this,arguments)}))}),function(e,t){return N.apply(this,arguments)}));var ek=Z.command("simulator").description("Inspect simulated peripherals (Application Simulator / web preview servers only)").command("thermal-printer").description("Simulated thermal printers and their print results"),eN="This DevTools server does not expose simulator inspection. Connect to an Application Simulator preview (e.g. the CTOR project simulator) running a preview build with the Simulator CDP domain.",eO=e=>{if(!e)return"unknown time";var t=new Date(e);return Number.isNaN(t.getTime())?"unknown time":t.toLocaleString()},eI=e=>{if(e.raw)return"raw data";var t=(e=>{if(!e?.length)return"";var t=[];for(var a of e){var i=t[t.length-1];i&&i.type===a?i.count+=1:t.push({type:a,count:1})}return t.map(({type:e,count:t})=>t>1?`${e}\xd7${t}`:e).join(", ")})(e.commandTypes);return`${e.commandCount} command(s)${t?`: ${t}`:""}`};ee(ek.command("list").description("List simulated thermal printers and their print history").option("--commands","Include full print command payloads (use with -j)")).action((O=j(function*(e){var t;yield et(e,(t=j(function*(t){var a=yield t.send("Simulator.listThermalPrinters",{includeCommands:!!e.commands}),i=a?.printers;if(Array.isArray(i)||(console.error(R.Ay.red(eN)),process.exit(1)),e.json)return void console.log(JSON.stringify(i,null,2));if(0===i.length){console.log(R.Ay.yellow("No simulated thermal printers registered.")),console.log(R.Ay.gray("A printer appears once the application configures GENERATOR_THERMAL_PRINTER."));return}for(var n of(console.log(R.Ay.bold(`Simulated Thermal Printers (${i.length})`)),console.log("─".repeat(60)),i)){var r=n.errored?R.Ay.red("fault"):n.connected?R.Ay.green("connected"):R.Ay.gray("idle");console.log(` ${R.Ay.bold(n.label||n.driver)} ${R.Ay.gray(`(${n.driver})`)} [${r}]`),console.log(` Printer ID: ${R.Ay.cyan(n.id)}`),n.connectString&&console.log(` Connect: ${R.Ay.gray(n.connectString)}`);var o=n.printHistory||[];if(0===o.length){console.log(R.Ay.gray(" No print results yet."));continue}var s="memory"===n.printHistorySource?R.Ay.gray(" (restored from memory)"):"";for(var p of(console.log(` Print results, newest first${s}:`),o))console.log(` --index ${p.index} ${eO(p.printedAt)} ${R.Ay.gray(eI(p))}`)}console.log("─".repeat(60)),console.log(R.Ay.gray("Save one as PNG: bricks devtools simulator thermal-printer print-result"))}),function(e){return t.apply(this,arguments)}))}),function(e){return O.apply(this,arguments)})),ee(ek.command("print-result").description("Render a simulated print result to a PNG image").option("--printer <id>","Printer ID (see `list`; defaults to the only registered printer)").option("-i, --index <n>","Print history index, 0 = latest","0").option("--scale <factor>","Image scale factor (1-4)","2").option("-o, --output <path>","Output file path")).action((I=j(function*(e){var t;yield et(e,(t=j(function*(t){var i=yield t.send("Simulator.captureThermalPrinterPrintResult",{id:e.printer,index:parseInt(e.index,10)||0,scale:parseFloat(e.scale)||2},3e4);i?.data||(console.error(R.Ay.red(eN)),process.exit(1));var n=yield Promise.resolve().then(a.t.bind(a,73024,19)),r=yield Promise.resolve().then(a.t.bind(a,76760,19)),o=e.output||`print-result-${Date.now()}.png`,s=r.resolve(o);(n.writeFileSync(s,Buffer.from(i.data,"base64")),e.json)?console.log(JSON.stringify({path:s,id:i.id,driver:i.driver,label:i.label,index:i.index,printedAt:i.printedAt,width:i.width,height:i.height},null,2)):(console.log(R.Ay.green(`Print result saved to ${s}`)),console.log(` Printer: ${i.label} ${R.Ay.gray(`(${i.driver}, ${i.id})`)}`),console.log(` Printed: ${eO(i.printedAt)} (--index ${i.index})`),i.width&&i.height&&console.log(` Size: ${i.width}\xd7${i.height}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return I.apply(this,arguments)}))},11405(e,t,a){a.d(t,{l:()=>v});var i,n,r,o=a(99436),s=a(35679),p=a(7586),l=a(85382),d=a(8479),u=a(47988),c=(i=o(function*(){try{return yield Promise.all([a.e(587),a.e(647),a.e(10),a.e(117)]).then(a.bind(a,98372)),{available:!0}}catch(e){return{available:!1,error:e.message}}}),function(){return i.apply(this,arguments)}),m=(e,t,a)=>({severity:e,code:t,message:a}),f=(n=o(function*({version:e="2.25.0-beta.52",mcpCheck:t=c}={}){var a=(0,u.getCurrentProfile)(),i=(0,u.getCurrentProfileSource)(),n=(0,u.getTokenInfo)(a),r=(0,u.getBaseUrl)(),o=(0,u.getActivityLogBaseUrl)(),s=[],f={ok:!1,timestamp:new Date().toISOString(),cli:{name:"bricks",version:e},profile:{name:a,source:i},config:{path:u.CONFIG_PATH,baseUrl:r,activityLogBaseUrl:o},auth:{available:!!n?.token,source:n?.token?"config":"missing",workspaceId:n?.workspaceId||null,workspaceName:n?.workspaceName||null,createdAt:n?.createdAt||null,tokenPreview:(0,p.$l)(n?.token)},connectivity:{workspace:{ok:!1,skipped:!n?.token,error:null}},capabilities:{zeroArgMode:(0,d.z)()?"interactive":"help",mcp:{available:!1,error:null}},issues:s};if(n?.token)try{var h=yield(0,l.createClient)(r,n.token).workspace();f.connectivity.workspace={ok:!0,skipped:!1,error:null,id:h?._id||n.workspaceId||null,name:h?.name||n.workspaceName||null},f.auth.workspaceId=h?._id||f.auth.workspaceId,f.auth.workspaceName=h?.name||f.auth.workspaceName}catch(e){f.connectivity.workspace={ok:!1,skipped:!1,error:e.message},s.push(m("error","workspace_unreachable",`Workspace query failed for ${r}: ${e.message}`))}else s.push(m("warning","auth_missing","No saved token for the current profile."));var v=yield t();return f.capabilities.mcp={available:v.available,error:v.error||null},v.available||s.push(m("warning","mcp_unavailable",`MCP stdio server is unavailable: ${v.error||"Unknown error"}`)),f.ok=0===s.length,f}),function(){return n.apply(this,arguments)}),h=(e,t,a)=>`${e.padEnd(14)} ${t}${a?` ${a}`:""}`,v=new s.uB("doctor").description("Check CLI configuration, auth state, and workspace reachability").option("-j, --json","Output as JSON").action((r=o(function*(e){try{var t=yield f();if(e.json)return void(0,p.GF)(t);console.log((e=>{var t=[];if(t.push("BRICKS CLI Doctor"),t.push("─".repeat(60)),t.push(h("CLI","OK",`bricks v${e.cli.version}`)),t.push(h("Profile","OK",`${e.profile.name} (${e.profile.source})`)),t.push(h("BRICKS API","OK",e.config.baseUrl)),t.push(h("Activity Log","OK",e.config.activityLogBaseUrl)),e.auth.available){var a=e.auth.workspaceName||e.auth.workspaceId||"Unknown workspace";t.push(h("Auth","OK",`${a} (${e.auth.source}, ${e.auth.tokenPreview})`))}else t.push(h("Auth","WARN","No saved token for the current profile"));if(e.connectivity.workspace.skipped)t.push(h("Workspace","WARN","Skipped because no token is available"));else if(e.connectivity.workspace.ok){var i=e.connectivity.workspace.name||e.connectivity.workspace.id||"Unknown workspace";t.push(h("Workspace","OK",i))}else t.push(h("Workspace","FAIL",e.connectivity.workspace.error));return e.capabilities.mcp.available?t.push(h("MCP","OK","STDIO server import is available")):t.push(h("MCP","WARN",e.capabilities.mcp.error)),t.push(h("Zero-arg mode",((e,t=!1)=>e?"OK":t?"WARN":"FAIL")("interactive"===e.capabilities.zeroArgMode,"help"===e.capabilities.zeroArgMode),"interactive"===e.capabilities.zeroArgMode?"Starts Ink interactive mode on TTY":"Shows help outside TTY contexts")),e.issues.length>0&&(t.push("─".repeat(60)),t.push("Issues"),e.issues.forEach(e=>{t.push(`- [${e.severity}] ${e.message}`)})),t.join("\n")})(t))}catch(t){e.json?(0,p.OW)(t.message):console.error(`Doctor failed: ${t.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)}))},28634(e,t,a){a.d(t,{p:()=>w});var i,n,r,o,s,p,l,d=a(68832),u=a(99436),c=a(35679),m=a(73284),f=a(30155),h=a(7586),v=a(56493),g=a(68168),y=a(98593),b=e=>{if(!e)return m.Ay.gray("○");var t=Date.now()-new Date(e).getTime();return t<=3e5?m.Ay.green("●"):60>Math.floor(t/6e4)?m.Ay.yellow("○"):m.Ay.red("○")},D=(e,t)=>(0,y.H_)(e,t,{deviceCount:e?.devices?.length||0}),x=["refresh","clear-cache","system-menu-open","system-menu-close","system-info-open","system-info-close","local-sync-panel-open","local-sync-panel-close","debug-panel-open","debug-panel-close","logging-on","logging-off","test-panel-open","test-panel-close"],w=new c.uB("group").description("Device Group management");w.command("list").description("List all device groups").option("-j, --json","Output as JSON").action((i=u(function*(e){var t=(0,v.o)(),a=(0,f.default)("Fetching device groups...").start();try{var i=yield t.deviceGroups({});if(a.stop(),e.json)return void console.log(JSON.stringify(i,null,2));if(!i||0===i.length)return void console.log(m.Ay.yellow("No device groups found"));console.log(m.Ay.bold("\nDevice Groups")),console.log("─".repeat(80)),i.forEach(e=>{var t=e.devices?.length||0;console.log(`● ${m.Ay.cyan(e.name)} ${m.Ay.gray(`(${t} devices)`)}`),console.log(` ID: ${m.Ay.gray(e._id)}`),e.description&&console.log(` ${m.Ay.gray(e.description)}`),console.log()})}catch(e){a.fail(`Failed to list groups: ${e.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)})),w.command("get <id>").description("Get device group details").option("-j, --json","Output as JSON").action((n=u(function*(e,t){var a=(0,v.o)(),i=(0,f.default)("Fetching device group...").start();try{var n=yield a.deviceGroup({id:e});if(i.stop(),n||(console.log(m.Ay.red("Device group not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(n,null,2));console.log(m.Ay.bold(`
|
|
107
107
|
Device Group: ${n.name}`)),console.log("─".repeat(60)),console.log(`ID: ${m.Ay.gray(n._id)}`),console.log(`Description: ${n.description||m.Ay.gray("N/A")}`),console.log(`Tags: ${n.tags?.join(", ")||m.Ay.gray("None")}`),console.log(`Created: ${m.Ay.gray(n.create_datetime)}`),console.log(`Modified: ${m.Ay.gray(n.last_modify_datetime)}`),n.devices?.length>0&&(console.log(`
|
|
108
108
|
${m.Ay.bold("Devices")} (${n.devices.length})`),n.devices.forEach(e=>{var t=e.device_target_name||e.device_id;console.log(` - ${t} ${m.Ay.gray(`(${e.device_id})`)}`)})),console.log("─".repeat(60))}catch(e){i.fail(`Failed to get group: ${e.message}`),process.exit(1)}}),function(e,t){return n.apply(this,arguments)})),w.command("resolve <query>").description("Resolve a device group name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((r=u(function*(e,t){var a=(0,v.o)(),i=t.json?null:(0,f.default)("Resolving device group...").start();try{var n=yield(0,g.Y)(()=>a.deviceGroup({id:e})),r=n?[n]:yield a.deviceGroups({paginate:{limit:t.limit}}),o=n?r:(r||[]).filter(t=>t.name?.toLowerCase().includes(e.trim().toLowerCase())),s=(0,g.K)({resource:"group",query:e,items:o||[],fields:["_id","name"],selectedBy:n?"id":null});if(i&&i.stop(),t.json)return void(0,h.GF)(s);if(s.resolved){var p=s.resolved;console.log(m.Ay.bold("\nResolved Device Group")),console.log("─".repeat(60)),console.log(`Name: ${m.Ay.cyan(p.name||"Unnamed")}`),console.log(`ID: ${m.Ay.gray(p._id)}`),console.log(`Selected By: ${s.selectedBy}`),console.log("─".repeat(60));return}if(0===s.matches.length)return void console.log(m.Ay.yellow(`No device groups matched "${e}"`));console.log(m.Ay.bold(`
|
|
109
109
|
Matching Device Groups (${s.matches.length})`)),console.log("─".repeat(80)),s.matches.forEach(e=>{console.log(`${m.Ay.cyan(e.name||"Unnamed")} ${m.Ay.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){i?i.fail(`Failed to resolve device group: ${t.message}`):(0,h.OW)(t.message,{resource:"group",query:e}),process.exit(1)}}),function(e,t){return r.apply(this,arguments)})),w.command("devices <id>").description("List devices in a group with status").option("-j, --json","Output as JSON").action((o=u(function*(e,t){var a=(0,v.o)(),i=(0,f.default)("Fetching devices...").start();try{var n=yield a.devicesByGroup({id:e});if(i.stop(),t.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(m.Ay.yellow("No devices in this group"));console.log(m.Ay.bold("\nDevices in Group")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.device||{},a=t.entry_detail?.watch_dog_timer?.last_alive_time,i=b(a),n=t.name||t.device_name||e.target_name||t._id||"Unknown",r=t.entry_detail?.application?.name||m.Ay.gray("No app");console.log(`${i} ${m.Ay.cyan(n.padEnd(30))} ${r}`)}),console.log("─".repeat(80))}catch(e){i.fail(`Failed to get devices: ${e.message}`),process.exit(1)}}),function(e,t){return o.apply(this,arguments)})),w.command("dispatch <id> <action>").description("Dispatch action to all devices in group").option("--dry-run","Validate inputs and show the dispatch plan without sending it").option("-j, --json","Output as JSON").action((s=u(function*(e,t,a){var i=(0,v.o)(),n=a.json?null:(0,f.default)(`Dispatching ${t}...`).start();x.includes(t)||(a.json?(0,h.OW)(`Invalid action. Valid actions: ${x.join(", ")}`,{action:"group.dispatch",target:{id:e}}):n.fail(`Invalid action. Valid actions: ${x.join(", ")}`),process.exit(1));try{var r=yield i.deviceGroup({id:e});if(!r)throw Error("Device group not found");if(a.dryRun){n&&n.stop(),(0,y.S5)({action:"group.dispatch",target:D(r,e),request:{action:t},checks:[(0,y.Iy)("group exists",!0,`${r.name} (${r._id})`),(0,y.Iy)("action is valid",!0)],json:a.json});return}var o=yield i.dispatchDeviceGroupAction({id:e,action:t});a.json?(0,y.yd)({action:"group.dispatch",target:D(r,e),result:{action:t,dispatched:o?.dispatched||0,devices:o?.devices||0},json:!0}):(n.succeed(`Action dispatched: ${m.Ay.green(t)}`),o&&(console.log(`Dispatched: ${m.Ay.green(o.dispatched||0)}`),console.log(`Devices: ${m.Ay.gray(o.devices||0)}`)))}catch(t){a.json?(0,h.OW)(t.message,{action:"group.dispatch",target:{id:e}}):n.fail(`Failed to dispatch action: ${t.message}`),process.exit(1)}}),function(e,t,a){return s.apply(this,arguments)})),w.command("refresh <id>").description("Refresh all devices in group").option("--dry-run","Validate inputs and show the refresh plan without sending it").option("-j, --json","Output as JSON").action((p=u(function*(e,t){var a=(0,v.o)(),i=t.json?null:(0,f.default)("Refreshing devices...").start();try{var n=yield a.deviceGroup({id:e});if(!n)throw Error("Device group not found");if(t.dryRun){i&&i.stop(),(0,y.S5)({action:"group.refresh",target:D(n,e),request:{action:"refresh"},checks:[(0,y.Iy)("group exists",!0,`${n.name} (${n._id})`)],json:t.json});return}var r=yield a.dispatchDeviceGroupAction({id:e,action:"refresh"});t.json?(0,y.yd)({action:"group.refresh",target:D(n,e),result:{dispatched:r?.dispatched||0,devices:r?.devices||0},json:!0}):(i.succeed("Devices refreshed"),r&&(console.log(`Dispatched: ${m.Ay.green(r.dispatched||0)}`),console.log(`Devices: ${m.Ay.gray(r.devices||0)}`)))}catch(a){t.json?(0,h.OW)(a.message,{action:"group.refresh",target:{id:e}}):i.fail(`Failed to refresh: ${a.message}`),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),w.command("monitor <id>").description("Monitor devices in group (polls every 60s)").option("-i, --interval <seconds>","Polling interval in seconds","60").action((l=u(function*(e,t){var a,i=(0,v.o)(),n=1e3*parseInt(t.interval,10);console.log(m.Ay.bold("\nDevice Group Monitor")),console.log(m.Ay.gray(`Polling every ${t.interval}s. Press Ctrl+C to stop.
|
|
@@ -122,7 +122,7 @@ ${y.Ay.bold("Usage")}`),console.log(`Used In: ${n.use_count.total_count} ap
|
|
|
122
122
|
${y.Ay.bold("Exposed Properties")} (${n.expose_properties.length})`),n.expose_properties.forEach(e=>{console.log(` - ${y.Ay.cyan(e)}`)})),console.log("─".repeat(60))}catch(e){i.fail(`Failed to get module: ${e.message}`),process.exit(1)}}),function(e,t){return o.apply(this,arguments)})),k.command("resolve <query>").description("Resolve a module name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((s=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Resolving module...").start();try{var n=yield(0,A.Y)(()=>a.module({id:e})),r=n?[n]:yield a.modules({keyword:e,paginate:{limit:t.limit}}),o=(0,A.K)({resource:"module",query:e,items:r||[],fields:["_id","name"],selectedBy:n?"id":null});if(i&&i.stop(),t.json)return void(0,E.GF)(o);if(o.resolved){var s=o.resolved;console.log(y.Ay.bold("\nResolved Module")),console.log("─".repeat(60)),console.log(`Name: ${y.Ay.cyan(s.name||"Unnamed")}`),console.log(`ID: ${y.Ay.gray(s._id)}`),console.log(`Selected By: ${o.selectedBy}`),console.log("─".repeat(60));return}if(0===o.matches.length)return void console.log(y.Ay.yellow(`No modules matched "${e}"`));console.log(y.Ay.bold(`
|
|
123
123
|
Matching Modules (${o.matches.length})`)),console.log("─".repeat(80)),o.matches.forEach(e=>{console.log(`${y.Ay.cyan(e.name||"Unnamed")} ${y.Ay.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){i?i.fail(`Failed to resolve module: ${t.message}`):(0,E.OW)(t.message,{resource:"module",query:e}),process.exit(1)}}),function(e,t){return s.apply(this,arguments)})),k.command("update <id>").description("Update module name, description, and/or configuration").option("-n, --name <name>","Module name").option("-d, --description <description>","Module description").option("-c, --config <json>","Module config as JSON string").option("-f, --file <path>","Module config from file").option("--validate","Validate configuration (default: true when config is set)",!0).option("--no-validate","Skip server-side config validation").option("--last-commit-id <id>","Reject if server config.bricks_project_last_commit_id does not match this value").option("-j, --json","Output as JSON").action((p=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Updating module...").start();try{var n={id:e};t.name&&(n.name=t.name),t.description&&(n.description=t.description),t.config?n.config=t.config:t.file&&(n.config=D.readFileSync(t.file,"utf-8")),void 0!==n.config&&(n.validateConfig=!1!==t.validate),t.lastCommitId&&(n.lastCommitId=t.lastCommitId);var r=yield a.updateModule(n);t.json?(0,S.yd)({action:"module.update",target:T(r,e),result:{lastCommitId:t.lastCommitId||null},json:!0}):(i.succeed(`Module updated: ${y.Ay.green(r.name)}`),r.has_unreleased_changes&&console.log(y.Ay.yellow("Note: Module has unreleased changes")))}catch(a){t.json?(0,E.OW)(a.message,{action:"module.update",target:{id:e}}):i.fail(`Failed to update module: ${a.message}`),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),k.command("short-edit <id>").description("Short edit module properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action((l=v(function*(e,t){var a=(0,F.o)(),i=(0,b.default)("Applying short edit...").start();try{var n=JSON.parse(t.list);Array.isArray(n)||(i.fail("List must be a JSON array"),process.exit(1));var r=yield a.shortEditModule({id:e,list:n});i.succeed(`Short edit applied to: ${y.Ay.green(r.name)}`)}catch(e){i.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),k.command("short-refs <id>").description("List short edit references for a module").option("-k, --keyword <keyword>","Filter by shortId or title").option("-t, --types <types>","Comma-separated shortId prefixes to include (e.g. B,C,S)").option("-j, --json","Output as JSON").action((d=v(function*(e,t){var a=(0,F.o)(),i=(0,b.default)("Fetching short edit references...").start();try{var n=yield a.module({id:e});if(i.stop(),!n?.short_edit?.enabled)return void console.log(y.Ay.yellow("Short Edit is not enabled for this module"));var r=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],o=(0,_.V)(n.short_edit.ref_map,{keyword:t.keyword,types:r});if(t.json)return void console.log(JSON.stringify(o,null,2));if(0===o.length)return void console.log(y.Ay.yellow("No short edit references found"));console.log(y.Ay.bold(`
|
|
124
124
|
Short Edit References: ${n.name}`)),o.forEach(e=>{console.log(y.Ay.cyan(`
|
|
125
|
-
${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?y.Ay.gray(`- ${t.title}`):"";console.log(` ${y.Ay.green(e)} ${a}`)})}),console.log()}catch(e){i.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),k.command("remove <id>").description("Remove a module").option("--dry-run","Validate the target and show the removal plan without deleting it").option("-j, --json","Output as JSON").action((u=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Removing module...").start();try{var n=yield a.module({id:e});if(!n)throw Error("Module not found");var r=T(n,e);if(t.dryRun){i&&i.stop(),(0,S.S5)({action:"module.remove",target:r,request:{id:e},checks:[(0,S.Iy)("module exists",!0,`${r.name} (${r.id})`)],json:t.json});return}var o=yield a.removeModule({id:e});t.json?(0,S.yd)({action:"module.remove",target:r,result:{removed:!!o},json:!0}):i.succeed(`Module removed: ${y.Ay.green(r.name)}`)}catch(a){t.json?(0,E.OW)(a.message,{action:"module.remove",target:{id:e}}):i.fail(`Failed to remove module: ${a.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),k.command("release <id>").description("Release module to BRICKS platform").requiredOption("-c, --config <path|json>","Module config file path or JSON string").option("-n, --name <name>","Update module name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((c=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Releasing module...").start();try{var n=(0,C.Ku)(t.config),r=n.config,o=n.source,s=n.sizeBytes,p=yield a.module({id:e});if(!p)throw Error("Module not found");if(p.is_public)throw Error("Public module deployment is temporarily not recommended");var l=t.version||t.name||p.name||"Untitled",d=(0,C.w9)(t.changelogs);if(t.dryRun){i&&i.stop(),(0,S.S5)({action:"module.release",target:T(p,e),request:{name:t.name||null,version:l,changelogs:t.changelogs||null,configSource:o,configSizeBytes:s},checks:[(0,S.Iy)("module exists",!0,`${p.name} (${p._id})`),(0,S.Iy)("module is private",!p.is_public),(0,S.Iy)("release config loaded",!0,`${s} bytes`)],json:t.json});return}var u=yield a.releaseModule({id:e,config:r,...t.name?{name:t.name}:{},releaseCurrentVersion:l,releaseCurrentVersionNote:d});t.json?(0,S.yd)({action:"module.release",target:T(u||p,e),result:{name:t.name||null,version:l,configSource:o,configSizeBytes:s},json:!0}):i.succeed(`Module released: ${y.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,E.OW)(a.message,{action:"module.release",target:{id:e}}):i.fail(`Failed to release module: ${a.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),k.command("project-pull <id>").description("Pull module source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((m=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Pulling module project...").start();try{var n=yield a.moduleProject({id:e,buildApplicationOnly:!0});n||(i?i.fail("Module project not found"):console.error(JSON.stringify({error:"Module project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(n)):(i.succeed(`Module project fetched: ${y.Ay.green(n.files?.length||0)} files`),console.log(JSON.stringify(n,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):i.fail(`Failed to pull module project: ${e.message}`),process.exit(1)}}),function(e,t){return m.apply(this,arguments)})),k.command("doctor <idOrPath>").description("Diagnose a module config: schema validation plus semantic lint rules (data races, layout mistakes, dead config)").option("-j, --json","Output as JSON").option("--strict","Exit with code 1 when warnings are found").option("--only <codes>","Run only these rule codes (comma-separated)").option("--ignore <codes>","Skip these rule codes (comma-separated)").option("--validate-automation","Also validate automation_map and test_map references").action((f=v(function*(e,t){var i=t.json?null:(0,b.default)("Running config doctor...").start();try{var n=yield Promise.all([a.e(587),a.e(341),a.e(10),a.e(511),a.e(223)]).then(a.bind(a,63322)),r=n.runConfigDoctor,o=n.renderConfigDoctorReport,s=yield r("module",e,t),p=s.report,l=s.exitCode;i?.stop(),t.json?(0,E.GF)({...p,exitCode:l}):console.log(o(p)),0!==l&&process.exit(l)}catch(e){i?i.fail(`Config doctor failed: ${e.message}`):(0,E.OW)(e.message),process.exit(1)}}),function(e,t){return f.apply(this,arguments)})),k.command("ctor-init <id>").alias("project-init").description("Initialize a BRICKS Project from a module").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action((h=v(function*(e,t){var i=(yield a.e(456).then(a.bind(a,58891))).initProject;yield i("module",e,t)}),function(e,t){return h.apply(this,arguments)}))},86141(e,t,a){a.d(t,{D:()=>V});var i,n,r,o,s,p,l,d,u,c=a(99436),m=a(35679),f=a(73284),h=a(30155),v=a(88958),g=a(73024),y=a(76760),b=a(48161),D=e=>{if(!e)return e;try{return g.realpathSync(e)}catch{return e}},x=a(68832),w=a(31421),_=a(51455),E="@fugood/bricks-cli",F="win32"===process.platform,A=(e,t)=>`https://cdn.bricks.tools/bricks-cli/${e}/${t}`,C=e=>"beta"===e?"beta":"latest",S=(i=c(function*(e){var t=yield fetch(e);if(!t.ok)throw Error(`Failed to fetch ${e}: HTTP ${t.status}`);return t}),function(e){return i.apply(this,arguments)}),T=(n=c(function*(e){return(yield S(A(e,"version.json"))).json()}),function(e){return n.apply(this,arguments)}),k=(r=c(function*(e){var t=C(e),a=yield S(`https://registry.npmjs.org/-/package/${E}/dist-tags`),i=(yield a.json())[t];if(!i)throw Error(`No '${t}' dist-tag for ${E}`);return{version:i}}),function(e){return r.apply(this,arguments)}),N=(o=c(function*(e,t){return"npm"===t||"bun"===t?k(e):T(e)}),function(e,t){return o.apply(this,arguments)}),O=(e,t,a={})=>{var i=(0,w.spawnSync)(e,t,{stdio:"inherit",...a});if(i.error){if("ENOENT"===i.error.code)throw Error(`Command not found: ${e}`);throw i.error}if(0!==i.status){var n=Error(`${e} exited with code ${i.status}`);throw n.code=i.status,n}},I=(s=c(function*(e,t){var a=yield S(e),i=Buffer.from((yield a.arrayBuffer())),n=y.join(b.tmpdir(),`bricks-cli-update-${process.pid}-${t}`);return yield _.writeFile(n,i),F||(yield _.chmod(n,493)),n}),function(e,t){return s.apply(this,arguments)}),$=(p=c(function*(e,{installDir:t}={}){var a=F?"install.ps1":"install.sh",i=yield I(A(e,a),a);try{var n=F?["powershell",["-NoProfile","-ExecutionPolicy","Bypass","-File",i,..."beta"===e?["-Beta"]:[],...t?["-InstallDir",t]:[]]]:["sh",[i,..."beta"===e?["--beta"]:[],...t?[`--dir=${t}`]:[]]],r=x(n,2),o=r[0],s=r[1];O(o,s)}finally{yield _.unlink(i).catch(()=>{})}}),function(e){return p.apply(this,arguments)}),j=(l=c(function*(e,t,a={}){if("npm"===e)return void O("npm",["install","-g",`${E}@${C(t)}`]);if("bun"===e)return void O("bun",["install","-g",`${E}@${C(t)}`]);if("binary"===e)return $(t,{installDir:a.installDir});throw Error(`Unsupported update method: ${e}`)}),function(e,t){return l.apply(this,arguments)}),B=a(8479),R=(d=c(function*({message:e,defaultValue:t,autoYes:a}){if(a)return!0;(0,B.z)()||(console.error(f.Ay.red("Refusing to prompt in a non-interactive shell. Pass -y/--yes to confirm.")),process.exit(1));try{return yield(0,v.lJ)({message:e,default:t})}catch{return!1}}),function(e){return d.apply(this,arguments)}),V=new m.uB("update-cli").description("Update the BRICKS CLI to the latest version").option("-y, --yes","Skip confirmation prompts").option("--channel <channel>","Override channel (release|beta)").option("--check-update","Only check whether a newer version is available and exit").action((u=c(function*(e){var t,a="2.25.0-beta.51",i=(({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:a=b.homedir(),realpath:i=D}={})=>{let n;var r=(n=e)?y.basename(n).replace(/\.exe$/i,""):"";if("bricks"===r||"bricks-beta"===r)return{method:"binary",execPath:e,installDir:y.dirname(e)};var o=i(t),s=((e,t)=>{if(!e)return null;var a=y.sep,i=`${a}node_modules${a}${t.replace(/\//g,a)}${a}`,n=e.indexOf(i);return -1===n?null:e.slice(0,n)})(o,"@fugood/bricks-cli");if(s){var p=y.sep,l=y.join(a,".bun","install","global");return s===l||s.startsWith(l+p)?{method:"bun",installRoot:s}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(s)?{method:"pnpm",installRoot:s}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(s)?{method:"yarn",installRoot:s}:{method:"npm",installRoot:s.endsWith(`${p}lib`)?s.slice(0,-`${p}lib`.length):s}}return{method:"unknown",execPath:e,scriptPath:o}})(),n=e.channel||(({version:e,execPath:t}={})=>{var a=t||process.execPath;return a&&/[\\/]bricks-beta(?:\.exe)?$/i.test(a)||/-(beta|alpha|rc|next)\b/i.test(e||"2.25.0-beta.51")?"beta":"release"})({version:a,execPath:i.execPath});console.log(f.Ay.bold(e.checkUpdate?"BRICKS CLI Update Check":"BRICKS CLI Update")),console.log("─".repeat(60)),console.log(`Current version : ${f.Ay.cyan(a)}`),console.log(`Channel : ${f.Ay.cyan(n)}`),console.log(`Detected method : ${f.Ay.cyan(i.method)}`),i.execPath&&"binary"===i.method&&console.log(`Binary path : ${f.Ay.gray(i.execPath)}`),i.installRoot&&console.log(`Install root : ${f.Ay.gray(i.installRoot)}`);var r="npm"===i.method||"bun"===i.method?"npm":"cdn",o=(0,h.default)(`Fetching latest version info (${r})...`).start(),s=null,p=null;try{s=(yield N(n,i.method)).version,o.succeed(`Latest ${n} (${r}): ${f.Ay.green(s)}`)}catch(e){p=e,o.warn(`Could not fetch version info: ${e.message}`)}var l=s&&s===a;if(e.checkUpdate){if(p&&process.exit(2),l)return void console.log(f.Ay.green("\nUp to date."));s&&(console.log(f.Ay.yellow(`
|
|
125
|
+
${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var a=t?.title?y.Ay.gray(`- ${t.title}`):"";console.log(` ${y.Ay.green(e)} ${a}`)})}),console.log()}catch(e){i.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),k.command("remove <id>").description("Remove a module").option("--dry-run","Validate the target and show the removal plan without deleting it").option("-j, --json","Output as JSON").action((u=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Removing module...").start();try{var n=yield a.module({id:e});if(!n)throw Error("Module not found");var r=T(n,e);if(t.dryRun){i&&i.stop(),(0,S.S5)({action:"module.remove",target:r,request:{id:e},checks:[(0,S.Iy)("module exists",!0,`${r.name} (${r.id})`)],json:t.json});return}var o=yield a.removeModule({id:e});t.json?(0,S.yd)({action:"module.remove",target:r,result:{removed:!!o},json:!0}):i.succeed(`Module removed: ${y.Ay.green(r.name)}`)}catch(a){t.json?(0,E.OW)(a.message,{action:"module.remove",target:{id:e}}):i.fail(`Failed to remove module: ${a.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),k.command("release <id>").description("Release module to BRICKS platform").requiredOption("-c, --config <path|json>","Module config file path or JSON string").option("-n, --name <name>","Update module name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((c=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Releasing module...").start();try{var n=(0,C.Ku)(t.config),r=n.config,o=n.source,s=n.sizeBytes,p=yield a.module({id:e});if(!p)throw Error("Module not found");if(p.is_public)throw Error("Public module deployment is temporarily not recommended");var l=t.version||t.name||p.name||"Untitled",d=(0,C.w9)(t.changelogs);if(t.dryRun){i&&i.stop(),(0,S.S5)({action:"module.release",target:T(p,e),request:{name:t.name||null,version:l,changelogs:t.changelogs||null,configSource:o,configSizeBytes:s},checks:[(0,S.Iy)("module exists",!0,`${p.name} (${p._id})`),(0,S.Iy)("module is private",!p.is_public),(0,S.Iy)("release config loaded",!0,`${s} bytes`)],json:t.json});return}var u=yield a.releaseModule({id:e,config:r,...t.name?{name:t.name}:{},releaseCurrentVersion:l,releaseCurrentVersionNote:d});t.json?(0,S.yd)({action:"module.release",target:T(u||p,e),result:{name:t.name||null,version:l,configSource:o,configSizeBytes:s},json:!0}):i.succeed(`Module released: ${y.Ay.green(u?.name||p.name)}`)}catch(a){t.json?(0,E.OW)(a.message,{action:"module.release",target:{id:e}}):i.fail(`Failed to release module: ${a.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),k.command("project-pull <id>").description("Pull module source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((m=v(function*(e,t){var a=(0,F.o)(),i=t.json?null:(0,b.default)("Pulling module project...").start();try{var n=yield a.moduleProject({id:e,buildApplicationOnly:!0});n||(i?i.fail("Module project not found"):console.error(JSON.stringify({error:"Module project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(n)):(i.succeed(`Module project fetched: ${y.Ay.green(n.files?.length||0)} files`),console.log(JSON.stringify(n,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):i.fail(`Failed to pull module project: ${e.message}`),process.exit(1)}}),function(e,t){return m.apply(this,arguments)})),k.command("doctor <idOrPath>").description("Diagnose a module config: schema validation plus semantic lint rules (data races, layout mistakes, dead config)").option("-j, --json","Output as JSON").option("--strict","Exit with code 1 when warnings are found").option("--only <codes>","Run only these rule codes (comma-separated)").option("--ignore <codes>","Skip these rule codes (comma-separated)").option("--validate-automation","Also validate automation_map and test_map references").action((f=v(function*(e,t){var i=t.json?null:(0,b.default)("Running config doctor...").start();try{var n=yield Promise.all([a.e(587),a.e(341),a.e(10),a.e(511),a.e(223)]).then(a.bind(a,63322)),r=n.runConfigDoctor,o=n.renderConfigDoctorReport,s=yield r("module",e,t),p=s.report,l=s.exitCode;i?.stop(),t.json?(0,E.GF)({...p,exitCode:l}):console.log(o(p)),0!==l&&process.exit(l)}catch(e){i?i.fail(`Config doctor failed: ${e.message}`):(0,E.OW)(e.message),process.exit(1)}}),function(e,t){return f.apply(this,arguments)})),k.command("ctor-init <id>").alias("project-init").description("Initialize a BRICKS Project from a module").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action((h=v(function*(e,t){var i=(yield a.e(456).then(a.bind(a,58891))).initProject;yield i("module",e,t)}),function(e,t){return h.apply(this,arguments)}))},86141(e,t,a){a.d(t,{D:()=>V});var i,n,r,o,s,p,l,d,u,c=a(99436),m=a(35679),f=a(73284),h=a(30155),v=a(88958),g=a(73024),y=a(76760),b=a(48161),D=e=>{if(!e)return e;try{return g.realpathSync(e)}catch{return e}},x=a(68832),w=a(31421),_=a(51455),E="@fugood/bricks-cli",F="win32"===process.platform,A=(e,t)=>`https://cdn.bricks.tools/bricks-cli/${e}/${t}`,C=e=>"beta"===e?"beta":"latest",S=(i=c(function*(e){var t=yield fetch(e);if(!t.ok)throw Error(`Failed to fetch ${e}: HTTP ${t.status}`);return t}),function(e){return i.apply(this,arguments)}),T=(n=c(function*(e){return(yield S(A(e,"version.json"))).json()}),function(e){return n.apply(this,arguments)}),k=(r=c(function*(e){var t=C(e),a=yield S(`https://registry.npmjs.org/-/package/${E}/dist-tags`),i=(yield a.json())[t];if(!i)throw Error(`No '${t}' dist-tag for ${E}`);return{version:i}}),function(e){return r.apply(this,arguments)}),N=(o=c(function*(e,t){return"npm"===t||"bun"===t?k(e):T(e)}),function(e,t){return o.apply(this,arguments)}),O=(e,t,a={})=>{var i=(0,w.spawnSync)(e,t,{stdio:"inherit",...a});if(i.error){if("ENOENT"===i.error.code)throw Error(`Command not found: ${e}`);throw i.error}if(0!==i.status){var n=Error(`${e} exited with code ${i.status}`);throw n.code=i.status,n}},I=(s=c(function*(e,t){var a=yield S(e),i=Buffer.from((yield a.arrayBuffer())),n=y.join(b.tmpdir(),`bricks-cli-update-${process.pid}-${t}`);return yield _.writeFile(n,i),F||(yield _.chmod(n,493)),n}),function(e,t){return s.apply(this,arguments)}),$=(p=c(function*(e,{installDir:t}={}){var a=F?"install.ps1":"install.sh",i=yield I(A(e,a),a);try{var n=F?["powershell",["-NoProfile","-ExecutionPolicy","Bypass","-File",i,..."beta"===e?["-Beta"]:[],...t?["-InstallDir",t]:[]]]:["sh",[i,..."beta"===e?["--beta"]:[],...t?[`--dir=${t}`]:[]]],r=x(n,2),o=r[0],s=r[1];O(o,s)}finally{yield _.unlink(i).catch(()=>{})}}),function(e){return p.apply(this,arguments)}),j=(l=c(function*(e,t,a={}){if("npm"===e)return void O("npm",["install","-g",`${E}@${C(t)}`]);if("bun"===e)return void O("bun",["install","-g",`${E}@${C(t)}`]);if("binary"===e)return $(t,{installDir:a.installDir});throw Error(`Unsupported update method: ${e}`)}),function(e,t){return l.apply(this,arguments)}),B=a(8479),R=(d=c(function*({message:e,defaultValue:t,autoYes:a}){if(a)return!0;(0,B.z)()||(console.error(f.Ay.red("Refusing to prompt in a non-interactive shell. Pass -y/--yes to confirm.")),process.exit(1));try{return yield(0,v.lJ)({message:e,default:t})}catch{return!1}}),function(e){return d.apply(this,arguments)}),V=new m.uB("update-cli").description("Update the BRICKS CLI to the latest version").option("-y, --yes","Skip confirmation prompts").option("--channel <channel>","Override channel (release|beta)").option("--check-update","Only check whether a newer version is available and exit").action((u=c(function*(e){var t,a="2.25.0-beta.52",i=(({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:a=b.homedir(),realpath:i=D}={})=>{let n;var r=(n=e)?y.basename(n).replace(/\.exe$/i,""):"";if("bricks"===r||"bricks-beta"===r)return{method:"binary",execPath:e,installDir:y.dirname(e)};var o=i(t),s=((e,t)=>{if(!e)return null;var a=y.sep,i=`${a}node_modules${a}${t.replace(/\//g,a)}${a}`,n=e.indexOf(i);return -1===n?null:e.slice(0,n)})(o,"@fugood/bricks-cli");if(s){var p=y.sep,l=y.join(a,".bun","install","global");return s===l||s.startsWith(l+p)?{method:"bun",installRoot:s}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(s)?{method:"pnpm",installRoot:s}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(s)?{method:"yarn",installRoot:s}:{method:"npm",installRoot:s.endsWith(`${p}lib`)?s.slice(0,-`${p}lib`.length):s}}return{method:"unknown",execPath:e,scriptPath:o}})(),n=e.channel||(({version:e,execPath:t}={})=>{var a=t||process.execPath;return a&&/[\\/]bricks-beta(?:\.exe)?$/i.test(a)||/-(beta|alpha|rc|next)\b/i.test(e||"2.25.0-beta.52")?"beta":"release"})({version:a,execPath:i.execPath});console.log(f.Ay.bold(e.checkUpdate?"BRICKS CLI Update Check":"BRICKS CLI Update")),console.log("─".repeat(60)),console.log(`Current version : ${f.Ay.cyan(a)}`),console.log(`Channel : ${f.Ay.cyan(n)}`),console.log(`Detected method : ${f.Ay.cyan(i.method)}`),i.execPath&&"binary"===i.method&&console.log(`Binary path : ${f.Ay.gray(i.execPath)}`),i.installRoot&&console.log(`Install root : ${f.Ay.gray(i.installRoot)}`);var r="npm"===i.method||"bun"===i.method?"npm":"cdn",o=(0,h.default)(`Fetching latest version info (${r})...`).start(),s=null,p=null;try{s=(yield N(n,i.method)).version,o.succeed(`Latest ${n} (${r}): ${f.Ay.green(s)}`)}catch(e){p=e,o.warn(`Could not fetch version info: ${e.message}`)}var l=s&&s===a;if(e.checkUpdate){if(p&&process.exit(2),l)return void console.log(f.Ay.green("\nUp to date."));s&&(console.log(f.Ay.yellow(`
|
|
126
126
|
Update available: ${a} → ${s}. Run 'bricks update-cli' to install.`)),process.exit(1)),console.log(f.Ay.yellow("\nCould not determine current version.")),process.exit(2)}if(l&&(console.log(f.Ay.green("\nAlready running the latest version.")),!(yield R({message:"Reinstall anyway?",defaultValue:!1,autoYes:e.yes}))))return void console.log(f.Ay.gray("Skipped."));var d=["npm","bun","binary"].includes(i.method);d||console.log(f.Ay.yellow(`Cannot auto-detect installer (method: ${i.method}); falling back to binary install.`));var u=d?i.method:"binary";if(!(yield R({message:`Update CLI using "${u}" method?`,defaultValue:!0,autoYes:e.yes})))return void console.log(f.Ay.yellow("Cancelled."));var m=(t=c(function*(e){console.log(f.Ay.cyan(`
|
|
127
127
|
→ Running ${e} update...`));try{return yield j(e,n,i),!0}catch(t){return console.error(f.Ay.yellow(`
|
|
128
128
|
${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,arguments)}),v=yield m(u);!v&&"binary"!==u&&(console.log(f.Ay.cyan("\nFalling back to binary install (same method used by the desktop app).")),(yield R({message:"Try the binary installer as a fallback?",defaultValue:!0,autoYes:e.yes}))&&(v=yield m("binary"))),v||(console.error(f.Ay.red("\nUpdate failed. See messages above.")),process.exit(1)),console.log(f.Ay.green("\nUpdate complete."))}),function(e){return u.apply(this,arguments)}))},92642(e,t,a){a.d(t,{W:()=>_});var i,n,r,o=a(99436),s=a(5018),p=a(44668),l=a(4275),d=a(32235),u=a(62192),c=a(79657),m=a(64007);function f(e){var t,a,i,n=2;for("u">typeof Symbol&&(a=Symbol.asyncIterator,i=Symbol.iterator);n--;){if(a&&null!=(t=e[a]))return t.call(e);if(i&&null!=(t=e[i]))return new h(t.call(e));a="@@asyncIterator",i="@@iterator"}throw TypeError("Object is not async iterable")}function h(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return(h=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var a=this.s.return;return void 0===a?Promise.resolve({value:e,done:!0}):t(a.apply(this.s,arguments))},throw:function(e){var a=this.s.return;return void 0===a?Promise.reject(e):t(a.apply(this.s,arguments))}},new h(e)}function*v(e){if(e.errors?.length)throw Error(e.errors.map(e=>e.message).join("\n"));if(e.data){for(var t of Object.values(e.data))if(Array.isArray(t))for(var a of t)yield a}if(Array.isArray(e.incremental)){for(var i of e.incremental)if(Array.isArray(i.items))for(var n of i.items)yield n}}function g(){return(g=l(function*(e){var t=e.headers.get("content-type")||"";if(t.includes("application/json")){var a=yield d(e.json());if(a.errors?.length)throw Error(a.errors.map(e=>e.message).join("\n"));var i=Object.keys(a.data||{})[0];if(i&&Array.isArray(a.data[i]))for(var n of a.data[i])yield n;return}var r=t.match(/boundary="?([^";]+)"?/),o=r?r[1]:"-",s=`--${o}`,p="",l=!1,c=new TextDecoder,m=e=>{for(var t=0;-1!==(t=e.indexOf(s,t));){if(0===t||"\n"===e[t-1])return t;t+=s.length}return -1},h=function*(){for(var e;-1!==(e=m(p));){var t=p.slice(0,e);(p=p.slice(e+s.length)).startsWith("\r\n")?p=p.slice(2):p.startsWith("\n")&&(p=p.slice(1));var a=t.indexOf("\r\n\r\n"),i=-1!==a?t.slice(a+4).trim():t.trim();if(i){var n=void 0;try{n=JSON.parse(i)}catch{continue}if(yield*v(n),!1===n.hasNext){l=!0;return}}}};try{var g=!1,y=!1;try{for(var b,D,x=f(e.body);g=!(D=yield d(x.next())).done;g=!1){var w=D.value;if(p+=c.decode(w,{stream:!0}),yield*u(f(h()),d),l)break}}catch(e){y=!0,b=e}finally{try{g&&null!=x.return&&(yield d(x.return()))}finally{if(y)throw b}}}catch(e){if(!e.message?.includes("Premature close")||!l)throw e}if(!l&&p.trim()){var _,E=p.indexOf("\r\n\r\n"),F=-1!==E?p.slice(E+4).trim():p.trim();if(F&&!F.startsWith("--")){try{_=JSON.parse(F)}catch{}_&&(yield*u(f(v(_)),d),!1===_.hasNext&&(l=!0))}}e.body?.destroy()})).apply(this,arguments)}var y=`
|
|
@@ -1014,7 +1014,7 @@ ${e} update failed: ${t.message}`)),!1}}),function(e){return t.apply(this,argume
|
|
|
1014
1014
|
lastSeenAt
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
|
-
`},1878(e,t,a){a.a(e,async function(e,i){try{a.d(t,{A:()=>C,e:()=>A});var n,r=a(99436),o=a(35679),s=a(73284),p=a(47988),l=a(8479),d=a(55614),u=a(1983),c=a(17422),m=a(32541),f=a(28634),h=a(37818),v=a(23699),g=a(71335),y=a(429),b=a(80274),D=a(42400),x=a(98247),w=a(11405),_=a(86141),E=a(59845),F=e([D]);D=(F.then?(await F)():F)[0];var A=(n=r(function*(){var e,t=process.argv.findIndex(e=>"--auth-profile"===e||"-ap"===e);-1!==t&&process.argv[t+1]&&((0,p.setProfileOverride)(process.argv[t+1]),process.argv.splice(t,2)),o.DM.name("bricks").description("BRICKS CLI - Command-line interface for BRICKS Workspace API").version("2.25.0-beta.
|
|
1017
|
+
`},1878(e,t,a){a.a(e,async function(e,i){try{a.d(t,{A:()=>C,e:()=>A});var n,r=a(99436),o=a(35679),s=a(73284),p=a(47988),l=a(8479),d=a(55614),u=a(1983),c=a(17422),m=a(32541),f=a(28634),h=a(37818),v=a(23699),g=a(71335),y=a(429),b=a(80274),D=a(42400),x=a(98247),w=a(11405),_=a(86141),E=a(59845),F=e([D]);D=(F.then?(await F)():F)[0];var A=(n=r(function*(){var e,t=process.argv.findIndex(e=>"--auth-profile"===e||"-ap"===e);-1!==t&&process.argv[t+1]&&((0,p.setProfileOverride)(process.argv[t+1]),process.argv.splice(t,2)),o.DM.name("bricks").description("BRICKS CLI - Command-line interface for BRICKS Workspace API").version("2.25.0-beta.52","-v, --version","output the version number").enablePositionalOptions(),o.DM.addCommand(d.s),o.DM.addCommand(u._),o.DM.addCommand(c.B),o.DM.addCommand(m.A),o.DM.addCommand(f.p),o.DM.addCommand(h.u),o.DM.addCommand(v.E),o.DM.addCommand(g.oT),o.DM.addCommand(y.K),o.DM.addCommand(b.gf),o.DM.addCommand(D.D),o.DM.addCommand(x.v),o.DM.addCommand(w.l),o.DM.addCommand(_.D),o.DM.addCommand(E.Q),o.DM.command("interactive").alias("i").description("Start interactive mode with Ink UI").action(r(function*(){try{var e=(yield Promise.all([a.e(3),a.e(940)]).then(a.bind(a,92319))).runInteractiveMode;yield e()}catch(e){console.error(s.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}})),o.DM.command("workspace").alias("ws").description("Show current workspace information").option("-j, --json","Output as JSON").action((e=r(function*(e){var t=yield Promise.resolve().then(a.bind(a,47988)),i=t.getToken,n=t.getBaseUrl,r=t.getCurrentProfile,o=(yield Promise.resolve().then(a.bind(a,85382))).createClient,p=(yield Promise.resolve().then(a.bind(a,30155))).default,l=r(),d=i(l);d||(console.error(s.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1));var u=p("Fetching workspace info...").start();try{var c=o(n(),d),m=yield c.workspace();if(u.stop(),e.json)return void console.log(JSON.stringify(m,null,2));console.log(s.Ay.bold("\nWorkspace Information")),console.log("─".repeat(60)),console.log(`Name: ${s.Ay.green(m.name)}`),console.log(`ID: ${s.Ay.gray(m._id)}`),console.log(`Description: ${m.description||s.Ay.gray("N/A")}`),console.log(`
|
|
1018
1018
|
${s.Ay.bold("Data")}`),console.log(`Remote Update: ${m.bank?.enable_remote_update?s.Ay.green("Enabled"):s.Ay.gray("Disabled")}`),console.log(`Spacename: ${m.bank?.spacename||s.Ay.gray("N/A")}`),console.log("─".repeat(60))}catch(e){u.fail(`Failed to get workspace: ${e.message}`),process.exit(1)}}),function(t){return e.apply(this,arguments)})),o.DM.on("--help",()=>{console.log(""),console.log(s.Ay.bold("Examples:")),console.log(""),console.log(s.Ay.gray(" # Login with a one-time passcode (recommended)")),console.log(" $ bricks auth login <passcode>"),console.log(""),console.log(s.Ay.gray(" # List all devices")),console.log(" $ bricks device list"),console.log(""),console.log(s.Ay.gray(" # Monitor devices in real-time")),console.log(" $ bricks device monitor"),console.log(""),console.log(s.Ay.gray(" # Control a device")),console.log(" $ bricks device refresh <device-id>"),console.log(" $ bricks device control <device-id> clear-cache"),console.log(""),console.log(s.Ay.gray(" # Bind a new device")),console.log(' $ bricks device bind <passcode> -n "My Device"'),console.log(""),console.log(s.Ay.gray(" # List applications")),console.log(" $ bricks app list"),console.log(""),console.log(s.Ay.gray(" # Start interactive mode")),console.log(" $ bricks interactive"),console.log(""),console.log(s.Ay.gray(" # Change API endpoint")),console.log(" $ bricks config endpoint beta"),console.log(""),console.log(s.Ay.gray("Get workspace token from BRICKS Controller:")),console.log(s.Ay.cyan(" https://control.bricks.tools")),console.log(s.Ay.gray(" Go to Workspace Settings > API Token"))});var i=process.argv.slice(2);if(0===i.length){if((0,l.b)(i))try{var n=(yield Promise.all([a.e(3),a.e(940)]).then(a.bind(a,92319))).runInteractiveMode;yield n();return}catch(e){console.error(s.Ay.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}console.error(s.Ay.gray("No command provided. Interactive mode requires a TTY, so showing help instead.\n")),o.DM.outputHelp();return}yield o.DM.parseAsync(process.argv)}),function(){return n.apply(this,arguments)});let C=A;i()}catch(e){i(e)}})},56493(e,t,a){a.d(t,{o:()=>o});var i=a(73284),n=a(47988),r=a(85382),o=()=>{var e=(0,n.getCurrentProfile)(),t=(0,n.getToken)(e);return t||(console.error(i.Ay.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,r.createClient)((0,n.getBaseUrl)(),t)}},7586(e,t,a){a.d(t,{$l:()=>r,GF:()=>i,OW:()=>n});var i=e=>{console.log(JSON.stringify(e,null,2))},n=(e,t={})=>{console.error(JSON.stringify({ok:!1,error:{message:e,...t}},null,2))},r=(e,t=4)=>e?e.length<=2*t?"*".repeat(e.length):`${e.slice(0,t)}…${e.slice(-t)}`:null},8479(e,t,a){a.d(t,{b:()=>n,z:()=>i});var i=()=>!!(process.stdin.isTTY&&process.stdout.isTTY&&"function"==typeof process.stdin.setRawMode),n=(e=[])=>0===e.length&&i()},47988(e,t,a){a.r(t),a.d(t,{CONFIG_DIR:()=>o,CONFIG_PATH:()=>s,clearBankCredentials:()=>E,clearConfig:()=>C,default:()=>S,getActivityLogBaseUrl:()=>F,getBankCredentials:()=>w,getBaseUrl:()=>l,getCurrentProfile:()=>y,getCurrentProfileSource:()=>b,getToken:()=>c,getTokenInfo:()=>m,getTokens:()=>u,listProfiles:()=>x,removeToken:()=>h,setActivityLogBaseUrl:()=>A,setBankCredentials:()=>_,setBaseUrl:()=>d,setCurrentProfile:()=>D,setProfileOverride:()=>g,setToken:()=>f});var i=a(83440),n=a(16928),r=a(70857),o=n.join(r.homedir(),".bricks-cli"),s=n.join(o,"config.json"),p=new i.default({projectName:"bricks-cli",cwd:o,schema:{tokens:{type:"object",default:{},additionalProperties:{type:"object",properties:{token:{type:"string"},name:{type:"string"},workspaceId:{type:"string"},workspaceName:{type:"string"},workspaceBilling:{type:"object"},createdAt:{type:"string"},baseUrl:{type:"string"},bank:{type:"object"}}}},currentProfile:{type:"string",default:"default"},baseUrl:{type:"string",default:"https://display.bricks.tools"},activityLogBaseUrl:{type:"string",default:"https://activity-log.bricks.tools"},devtoolsTokens:{type:"object",default:{},additionalProperties:{type:"object",additionalProperties:{type:"object",properties:{token:{type:"string"},expiresAt:{type:"string"},jti:{type:"string"},workspaceId:{type:"string"}}}}}}}),l=()=>{var e=y(),t=p.get("tokens");return t[e]?.baseUrl||p.get("baseUrl")},d=(e,t)=>{if(!t)return void p.set("baseUrl",e);var a=p.get("tokens");a[t]||(a[t]={}),a[t].baseUrl=e,p.set("tokens",a)},u=()=>p.get("tokens"),c=(e="default")=>{var t=p.get("tokens");return t[e]?.token},m=(e="default")=>p.get("tokens")[e],f=(e,t)=>{var a=p.get("tokens"),i=a[e];a[e]={...i?.baseUrl?{baseUrl:i.baseUrl}:{},...i?.activityLogBaseUrl?{activityLogBaseUrl:i.activityLogBaseUrl}:{},...t,createdAt:new Date().toISOString()},p.set("tokens",a)},h=e=>{var t=p.get("tokens");delete t[e],p.set("tokens",t)},v=null,g=e=>{v=e},y=()=>v||process.env.BRICKS_PROFILE||p.get("currentProfile"),b=()=>v?"override":process.env.BRICKS_PROFILE?"env":"config",D=e=>p.set("currentProfile",e),x=()=>{var e=p.get("tokens"),t=p.get("currentProfile");return Object.keys(e).map(a=>({...e[a],name:a,current:a===t}))},w=(e="default")=>{var t=p.get("tokens");return t[e]?.bank||null},_=(e,t)=>{var a=p.get("tokens");a[e]||(a[e]={}),a[e].bank=t,p.set("tokens",a)},E=e=>{var t=p.get("tokens");return!!t[e]?.bank&&(delete t[e].bank,p.set("tokens",t),!0)},F=()=>{var e=y(),t=p.get("tokens");return t[e]?.activityLogBaseUrl||p.get("activityLogBaseUrl")},A=(e,t)=>{if(!t)return void p.set("activityLogBaseUrl",e);var a=p.get("tokens");a[t]||(a[t]={}),a[t].activityLogBaseUrl=e,p.set("tokens",a)},C=()=>{p.clear()};let S=p},75646(e,t,a){a.r(t),a.d(t,{discoverDevToolsServers:()=>l,httpProbeSubnet:()=>d,verifyDevToolsServer:()=>u});var i,n,r=a(99436),o=a(41314),s=a(19557),p="bricks-devtools",l=({timeout:e=3e3,idleTimeout:t=0}={})=>new Promise((a,i)=>{var n=new Map,r=o.createSocket("udp4"),l=null,d=null,u=!1,c=()=>{if(!u){u=!0,clearTimeout(l),clearTimeout(d);try{r.close()}catch{}a([...n.values()])}};r.on("error",e=>{if(!u){u=!0,clearTimeout(l),clearTimeout(d);try{r.close()}catch{}i(e)}}),r.on("message",(e,a)=>{try{var i=JSON.parse(e.toString());if(i.s!==p||"ANNOUNCE"!==i.t&&"RESPONSE"!==i.t)return;var r=i.d?.info;if(!r)return;var o=a.address,s=`${o}:${r.port}`;n.has(s)||(n.set(s,{...r,address:o}),t&&!u&&(clearTimeout(d),d=setTimeout(c,t)))}catch{}}),r.bind(()=>{r.setBroadcast(!0);var t=Buffer.from(JSON.stringify({t:"QUERY",v:"1.0",s:p,d:{id:`cli-${(0,s.BW)()}`}}));for(var a of(0,s.a2)())r.send(t,0,t.length,19900,a);l=setTimeout(c,e)})}),d=(i=r(function*({port:e=19851,connectTimeout:t=500,concurrency:a=50,timeout:i=0}={}){var n=(0,s.r9)();if(0===n.length)return[];var o=[],p=i>0?Date.now()+i:0,l=[],d=new Set;for(var c of n){var m=c.address.split(".").slice(0,3).join(".");if(!d.has(m)){d.add(m);for(var f=1;f<255;f++)l.push(`${m}.${f}`)}}for(var h=0;h<l.length&&!(p&&Date.now()>=p);h+=a){var v=l.slice(h,h+a);yield Promise.allSettled(v.map(function(){var a=r(function*(a){var i=yield u(a,e,t);i&&o.push({...i,address:a,port:e})});return function(e){return a.apply(this,arguments)}}()))}return o}),function(){return i.apply(this,arguments)}),u=(n=r(function*(e,t,a=3e3){return(0,s.uE)(`http://${e}:${t}/devtools/info`,a)}),function(e,t){return n.apply(this,arguments)})},19557(e,t,a){a.d(t,{BW:()=>o,a2:()=>p,r9:()=>s,uE:()=>l});var i,n=a(99436),r=a(48161),o=()=>Math.random().toString(36).slice(2,9),s=()=>{var e=[];for(var t of Object.values(r.networkInterfaces()))for(var a of t)if(function(){if("IPv4"!==a.family||a.internal)return 1;var t=a.address.split(".").map(Number),i=a.netmask.split(".").map(Number),n=t.map((e,t)=>(e|255&~i[t]).toString()).join(".");e.push({address:a.address,broadcast:n})}())continue;return e},p=()=>{var e=new Set(["255.255.255.255","127.0.0.1"]);for(var t of s())e.add(t.broadcast);return[...e]},l=(i=n(function*(e,t=3e3){var a;try{var i=new AbortController;a=setTimeout(()=>i.abort(),t);var n=yield fetch(e,{signal:i.signal});if(!n.ok)return null;return yield n.json()}catch{return null}finally{void 0!==a&&clearTimeout(a)}}),function(e){return i.apply(this,arguments)})},74049(e,t,a){a.d(t,{Ku:()=>s,w9:()=>o});var i=a(79896),n=a(16928),r=new Set(["CTOR","CTOR Desktop"]),o=e=>{var t,a=`Release by ${(t=process.env.BRICKS_RELEASE_SIGN)&&r.has(t)?t:"BRICKS CLI"}`;return e?`${e}
|
|
1019
1019
|
|
|
1020
1020
|
${a}`:a},s=e=>{if(e.endsWith(".json")||e.includes("/")){if(!i.existsSync(e))throw Error(`Config file not found: ${e}`);var t=i.readFileSync(e,"utf-8");return{config:t,source:{type:"file",path:n.resolve(e)},sizeBytes:Buffer.byteLength(t)}}return{config:e,source:{type:"inline"},sizeBytes:Buffer.byteLength(e)}}},68168(e,t,a){a.d(t,{K:()=>o,Y:()=>s});var i,n=a(99436),r=e=>String(e||"").trim().toLowerCase(),o=({resource:e,query:t,items:a,fields:i,selectedBy:n=null})=>{var o=r(t),s=a.filter(e=>i.some(t=>r(t.split(".").reduce((e,t)=>e?.[t],e)??null)===o)),p=null,l=n;return"id"===n?p=a[0]||null:1===s.length?(p=s[0],l="exact"):1===a.length&&(p=a[0],l="single"),{resource:e,query:t,exactMatchCount:s.length,matchCount:a.length,selectedBy:l,ambiguous:a.length>1&&!p,resolved:p,matches:a}},s=(i=n(function*(e){try{return yield e()}catch(e){if(/not found/i.test(e.message))return null;throw e}}),function(e){return i.apply(this,arguments)})},60450(e,t,a){a.d(t,{Gu:()=>m,he:()=>h,wR:()=>u});var i,n,r,o=a(99436),s=a(79657),p=a(73024),l=a(76760),d=a(48161),u=e=>e?.media_resource?.enable_media_workspace===!0,c=(i=o(function*(e,t,a){var i=yield e.mediaFiles({boxId:t,userTags:[`bricks_screenshot_${a}`],limit:1});return i?.[0]||null}),function(e,t,a){return i.apply(this,arguments)}),m=(e,{preferThumbnail:t=!1}={})=>{if(!e?.meta?.storageEndpoint)return null;var a=e.meta,i=a.storageEndpoint,n=a.originalFileKey,r=(t?(e=>{var t=e?.meta;if(!t)return null;if("Video"===e.fileType&&t.videoThumbOriginalFileKey)return t.videoThumbOriginalFileKey;var a=t.imageVersions||[];if(!Array.isArray(a)||0===a.length)return null;var i=a.filter(e=>e?.strategy==="BOUNDED"&&"number"==typeof e.width).sort((e,t)=>e.width-t.width);return(i[0]||a[0])?.key||null})(e):null)||n;return r?`${i}/${r}`:null},f=(n=o(function*(e,t=null){var a=yield(0,s.Ay)(e);if(!a.ok)throw Error(`Failed to download screenshot: ${a.statusText}`);var i=yield a.buffer(),n=t||l.join(d.tmpdir(),`bricks-screenshot-${Date.now()}.png`),r=l.dirname(n);return p.existsSync(r)||p.mkdirSync(r,{recursive:!0}),p.writeFileSync(n,i),n}),function(e){return n.apply(this,arguments)}),h=(r=o(function*(e,t,a,i=null,n={}){var r=u(t)&&t.media_resource?.system_media_box_id||null;if(!r)return{error:"Media workspace not enabled for this workspace"};var o=yield c(e,r,a);if(!o)return{error:"No screenshot available for this device"};var s=m(o,n);return s?{path:yield f(s,i),file:o,url:s}:{error:"Could not build screenshot URL"}}),function(e,t,a){return r.apply(this,arguments)})},44618(e,t,a){a.d(t,{V:()=>r});var i={S:"Subspace",B:"Brick",C:"Canvas",A:"Animation",G:"Generator",D:"Data",F:"Data Calc",N:"Calc Node",T:"Test",TC:"Test Case",AT:"Automation Map"},n=e=>e?.split("_")?.[0]||"",r=(e,{keyword:t,types:a}={})=>{var r=t?.trim().toLowerCase()||"",o=a?.length>0?new Set(a.flatMap(e=>{var t=String(e).trim().toUpperCase();return t?[t]:[]})):null;return Object.entries(Object.entries(e||{}).filter(([,e])=>e&&!e.hide).filter(([e,t])=>{var a=n(e);if(o&&!o.has(a))return!1;if(!r)return!0;var i=t?.title?String(t.title).toLowerCase():"";return e.toLowerCase().includes(r)||i.includes(r)}).reduce((e,[t,a])=>{var i=n(t);return e[i]||(e[i]=[]),e[i].push({shortId:t,ref:a}),e},{})).map(([e,t])=>({prefix:e,label:i[e]||e,refs:t.sort((e,t)=>{var a=e.ref?.title||e.shortId,i=t.ref?.title||t.shortId;return String(a).localeCompare(String(i))})})).sort((e,t)=>e.label.localeCompare(t.label))}},94979(e,t,a){a.d(t,{p:()=>r});var i=/^(\d+)(s|m|h|d|w)$/,n={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function r(e){var t=e.match(i);if(t){var a=parseInt(t[1],10),r=n[t[2]];return new Date(Date.now()-a*r).toISOString()}var o=new Date(e);if(isNaN(o.getTime()))throw Error(`Invalid time format: "${e}". Use ISO 8601 or relative (e.g. 1h, 30m, 2d)`);return o.toISOString()}},98593(e,t,a){a.d(t,{H_:()=>o,Iy:()=>r,S5:()=>p,yd:()=>l});var i=a(73284),n=a(7586),r=(e,t,a)=>({label:e,ok:t,detail:a}),o=(e,t,{id:a,name:i,...n}={})=>({id:e?._id||t,name:i||e?.name||"Unnamed",...n}),s=e=>null==e?i.Ay.gray("N/A"):"object"==typeof e?i.Ay.gray(JSON.stringify(e,null,2)):String(e),p=({action:e,target:t,request:a,checks:r=[],json:o=!1})=>{o?(0,n.GF)({ok:!0,dryRun:!0,action:e,target:t||null,request:a||null,checks:r}):(console.log(i.Ay.bold(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fugood/bricks-cli",
|
|
3
|
-
"version": "2.25.0-beta.
|
|
3
|
+
"version": "2.25.0-beta.52",
|
|
4
4
|
"description": "BRICKS CLI - Command-line interface for BRICKS Workspace API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bricks",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"engines": {
|
|
71
71
|
"node": ">=18.0.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "f6869285ea21123990934411ea190d9fbf12ea7f"
|
|
74
74
|
}
|