@fugood/bricks-project 2.21.0-beta.25 → 2.21.0-beta.27

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.
@@ -60,6 +60,22 @@ export const templateActionNameMap = {
60
60
  height: 'TAKE_SCREENSHOT_HEIGHT',
61
61
  saveProperty: 'TAKE_SCREENSHOT_SAVE_PROPERTY',
62
62
  },
63
+ CHANNEL_SUBSCRIBE: {
64
+ key: 'CHANNEL_SUBSCRIBE_KEY',
65
+ type: 'CHANNEL_SUBSCRIBE_TYPE',
66
+ livetime: 'CHANNEL_SUBSCRIBE_LIVETIME',
67
+ dataResult: 'CHANNEL_SUBSCRIBE_DATA_RESULT',
68
+ progressResult: 'CHANNEL_SUBSCRIBE_PROGRESS_RESULT',
69
+ errorResult: 'CHANNEL_SUBSCRIBE_ERROR_RESULT',
70
+ },
71
+ CHANNEL_UNSUBSCRIBE: {
72
+ keyMatch: 'CHANNEL_UNSUBSCRIBE_KEY_MATCH',
73
+ },
74
+ CHANNEL_PUBLISH: {
75
+ keyMatch: 'CHANNEL_PUBLISH_KEY_MATCH',
76
+ payloadType: 'CHANNEL_PUBLISH_PAYLOAD_TYPE',
77
+ payload: 'CHANNEL_PUBLISH_PAYLOAD',
78
+ },
63
79
  USE_SHARE_APPLICATION: {
64
80
  applicationId: 'APPLICATION_ID',
65
81
  releaseVersion: 'RELEASE_VERSION',
@@ -192,6 +208,27 @@ export const templateActionNameMap = {
192
208
  },
193
209
  },
194
210
 
211
+ BRICK_RIVE: {
212
+ BRICK_RIVE_PLAY: {
213
+ animationName: 'BRICK_RIVE_ANIMATION_NAME',
214
+ loop: 'BRICK_RIVE_LOOP',
215
+ direction: 'BRICK_RIVE_DIRECTION',
216
+ isStateMachine: 'BRICK_RIVE_IS_STATE_MACHINE',
217
+ },
218
+ BRICK_RIVE_FIRE_STATE: {
219
+ stateMachineName: 'BRICK_RIVE_STATE_MACHINE_NAME',
220
+ inputName: 'BRICK_RIVE_INPUT_NAME',
221
+ },
222
+ BRICK_RIVE_SET_INPUT_STATE: {
223
+ stateMachineName: 'BRICK_RIVE_STATE_MACHINE_NAME',
224
+ inputName: 'BRICK_RIVE_INPUT_NAME',
225
+ value: 'BRICK_RIVE_VALUE',
226
+ },
227
+ BRICK_RIVE_SET_TEXT_RUN_VALUE: {
228
+ textRunName: 'BRICK_RIVE_TEXT_RUN_NAME',
229
+ value: 'BRICK_RIVE_VALUE',
230
+ },
231
+ },
195
232
  BRICK_WEBVIEW: {
196
233
  BRICK_WEBVIEW_INJECT_JAVASCRIPT: {
197
234
  javascriptCode: 'BRICK_WEBVIEW_JAVASCRIPT_CODE',
@@ -496,6 +533,11 @@ export const templateActionNameMap = {
496
533
  topP: 'GENERATOR_LLM_TOP_P',
497
534
  xtcThreshold: 'GENERATOR_LLM_XTC_THRESHOLD',
498
535
  xtcProbability: 'GENERATOR_LLM_XTC_PROBABILITY',
536
+ dryMultiplier: 'GENERATOR_LLM_DRY_MULTIPLIER',
537
+ dryBase: 'GENERATOR_LLM_DRY_BASE',
538
+ dryAllowedLength: 'GENERATOR_LLM_DRY_ALLOWED_LENGTH',
539
+ dryPenaltyLastN: 'GENERATOR_LLM_DRY_PENALTY_LAST_N',
540
+ drySequenceBreakers: 'GENERATOR_LLM_DRY_SEQUENCE_BREAKERS',
499
541
  mirostat: 'GENERATOR_LLM_MIROSTAT',
500
542
  mirostatTau: 'GENERATOR_LLM_MIROSTAT_TAU',
501
543
  mirostatEta: 'GENERATOR_LLM_MIROSTAT_ETA',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.21.0-beta.25",
3
+ "version": "2.21.0-beta.27",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "build": "node scripts/build.js"
@@ -13,5 +13,5 @@
13
13
  "lodash": "^4.17.4",
14
14
  "uuid": "^8.3.1"
15
15
  },
16
- "gitHead": "ab6c290fc51b20eb046cb31b9f37ac98de2de3b7"
16
+ "gitHead": "85b6bb3416b693de316511738097112f89e764e7"
17
17
  }
@@ -2,6 +2,16 @@
2
2
  import { app, BrowserWindow } from 'electron'
3
3
  import { readFile } from 'fs/promises'
4
4
  import { watchFile } from 'fs'
5
+ import { parseArgs } from 'util'
6
+
7
+ const { values } = parseArgs({
8
+ args: process.argv,
9
+ options: {
10
+ 'clear-cache': { type: 'boolean' },
11
+ },
12
+ strict: true,
13
+ allowPositionals: true,
14
+ })
5
15
 
6
16
  const cwd = process.cwd()
7
17
 
@@ -36,6 +46,11 @@ app.on('ready', () => {
36
46
 
37
47
  mainWindow.webContents.once('dom-ready', sendConfig)
38
48
 
49
+ if (values['clear-cache']) {
50
+ console.log('Clearing cache')
51
+ mainWindow.webContents.session.clearCache()
52
+ }
53
+
39
54
  mainWindow.on('close', () => app.quit())
40
55
 
41
56
  watchFile(
package/tools/preview.ts CHANGED
@@ -9,6 +9,9 @@ const { values } = parseArgs({
9
9
  'skip-typecheck': {
10
10
  type: 'boolean',
11
11
  },
12
+ 'clear-cache': {
13
+ type: 'boolean',
14
+ },
12
15
  },
13
16
  strict: true,
14
17
  allowPositionals: true,
@@ -34,5 +37,11 @@ const watcher = watch(`${cwd}/subspaces`, { recursive: true }, async (event, fil
34
37
 
35
38
  const app = await Bun.file(`${cwd}/application.json`).json()
36
39
 
37
- await $`BRICKS_STAGE=${app.stage || 'production'} bunx electron ${__dirname}/preview-main.mjs`
40
+
41
+ if (values['clear-cache']) {
42
+ await $`BRICKS_STAGE=${app.stage || 'production'} bunx --bun electron ${__dirname}/preview-main.mjs --clear-cache`
43
+ } else {
44
+ await $`BRICKS_STAGE=${app.stage || 'production'} bunx --bun electron ${__dirname}/preview-main.mjs`
45
+ }
46
+
38
47
  watcher.close()
package/types/bricks.ts CHANGED
@@ -772,7 +772,8 @@ interface BrickSvgDef {
772
772
  Default property:
773
773
  {
774
774
  "source": "",
775
- "uri": ""
775
+ "uri": "",
776
+ "renderMode": "general"
776
777
  }
777
778
  */
778
779
  property?: BrickBasicProperty & {
@@ -792,6 +793,8 @@ Default property:
792
793
  }
793
794
  >
794
795
  | DataLink
796
+ /* The render mode */
797
+ renderMode?: 'general' | 'legacy' | DataLink
795
798
  }
796
799
  events?: BrickBasicEvents & {
797
800
  /* Event of the brick press */
@@ -2486,6 +2489,314 @@ export type BrickLottie = Brick &
2486
2489
  >
2487
2490
  }
2488
2491
 
2492
+ /* Play animation */
2493
+ export type BrickRiveActionPlay = ActionWithParams & {
2494
+ __actionName: 'BRICK_RIVE_PLAY'
2495
+ params?: Array<
2496
+ | {
2497
+ input: 'animationName'
2498
+ value?: string | DataLink
2499
+ mapping?: string
2500
+ }
2501
+ | {
2502
+ input: 'loop'
2503
+ value?: 'auto' | 'oneShot' | 'loop' | 'pingPong' | DataLink
2504
+ mapping?: string
2505
+ }
2506
+ | {
2507
+ input: 'direction'
2508
+ value?: 'auto' | 'backwards' | 'forwards' | DataLink
2509
+ mapping?: string
2510
+ }
2511
+ | {
2512
+ input: 'isStateMachine'
2513
+ value?: boolean | DataLink
2514
+ mapping?: string
2515
+ }
2516
+ >
2517
+ }
2518
+
2519
+ /* Pause animation */
2520
+ export type BrickRiveActionPause = Action & {
2521
+ __actionName: 'BRICK_RIVE_PAUSE'
2522
+ }
2523
+
2524
+ /* Stop animation */
2525
+ export type BrickRiveActionStop = Action & {
2526
+ __actionName: 'BRICK_RIVE_STOP'
2527
+ }
2528
+
2529
+ /* Reset animation */
2530
+ export type BrickRiveActionReset = Action & {
2531
+ __actionName: 'BRICK_RIVE_RESET'
2532
+ }
2533
+
2534
+ /* Fire state */
2535
+ export type BrickRiveActionFireState = ActionWithParams & {
2536
+ __actionName: 'BRICK_RIVE_FIRE_STATE'
2537
+ params?: Array<
2538
+ | {
2539
+ input: 'stateMachineName'
2540
+ value?: string | DataLink
2541
+ mapping?: string
2542
+ }
2543
+ | {
2544
+ input: 'inputName'
2545
+ value?: string | DataLink
2546
+ mapping?: string
2547
+ }
2548
+ >
2549
+ }
2550
+
2551
+ /* Set input state */
2552
+ export type BrickRiveActionSetInputState = ActionWithParams & {
2553
+ __actionName: 'BRICK_RIVE_SET_INPUT_STATE'
2554
+ params?: Array<
2555
+ | {
2556
+ input: 'stateMachineName'
2557
+ value?: string | DataLink
2558
+ mapping?: string
2559
+ }
2560
+ | {
2561
+ input: 'inputName'
2562
+ value?: string | DataLink
2563
+ mapping?: string
2564
+ }
2565
+ | {
2566
+ input: 'value'
2567
+ value?: any
2568
+ mapping?: string
2569
+ }
2570
+ >
2571
+ }
2572
+
2573
+ /* Set text run value. Text Run name need to defined as unique name in Rive file. (Ref: https://rive.app/community/doc/text/docn2E6y1lXo) */
2574
+ export type BrickRiveActionSetTextRunValue = ActionWithParams & {
2575
+ __actionName: 'BRICK_RIVE_SET_TEXT_RUN_VALUE'
2576
+ params?: Array<
2577
+ | {
2578
+ input: 'textRunName'
2579
+ value?: string | DataLink
2580
+ mapping?: string
2581
+ }
2582
+ | {
2583
+ input: 'value'
2584
+ value?: any
2585
+ mapping?: string
2586
+ }
2587
+ >
2588
+ }
2589
+
2590
+ interface BrickRiveDef {
2591
+ /*
2592
+ Default property:
2593
+ {
2594
+ "autoplay": true,
2595
+ "alignment": "center",
2596
+ "fit": "contain"
2597
+ }
2598
+ */
2599
+ property?: BrickBasicProperty & {
2600
+ /* Rive file url */
2601
+ url?: string | DataLink
2602
+ /* The checksum of `url` */
2603
+ md5?: string | DataLink
2604
+ /* Autoplay the animation */
2605
+ autoplay?: boolean | DataLink
2606
+ /* Alignment of the animation */
2607
+ alignment?:
2608
+ | 'topLeft'
2609
+ | 'topCenter'
2610
+ | 'topRight'
2611
+ | 'centerLeft'
2612
+ | 'center'
2613
+ | 'centerRight'
2614
+ | 'bottomLeft'
2615
+ | 'bottomCenter'
2616
+ | 'bottomRight'
2617
+ | DataLink
2618
+ /* Fit mode of the animation */
2619
+ fit?:
2620
+ | 'cover'
2621
+ | 'contain'
2622
+ | 'fill'
2623
+ | 'fitWidth'
2624
+ | 'fitHeight'
2625
+ | 'none'
2626
+ | 'scaleDown'
2627
+ | 'layout'
2628
+ | DataLink
2629
+ /* Artboard name */
2630
+ artboardName?: string | DataLink
2631
+ /* Animation name */
2632
+ animationName?: string | DataLink
2633
+ /* State machine name */
2634
+ stateMachineName?: string | DataLink
2635
+ }
2636
+ events?: BrickBasicEvents & {
2637
+ /* Event of animation play */
2638
+ onPlay?: Array<
2639
+ EventAction & {
2640
+ eventPropertyMapping?: {
2641
+ animationName: {
2642
+ type: 'string'
2643
+ path: string
2644
+ }
2645
+ isStateMachine: {
2646
+ type: 'bool'
2647
+ path: string
2648
+ }
2649
+ }
2650
+ }
2651
+ >
2652
+ /* Event of animation pause */
2653
+ onPause?: Array<
2654
+ EventAction & {
2655
+ eventPropertyMapping?: {
2656
+ animationName: {
2657
+ type: 'string'
2658
+ path: string
2659
+ }
2660
+ isStateMachine: {
2661
+ type: 'bool'
2662
+ path: string
2663
+ }
2664
+ }
2665
+ }
2666
+ >
2667
+ /* Event of animation stop */
2668
+ onStop?: Array<
2669
+ EventAction & {
2670
+ eventPropertyMapping?: {
2671
+ animationName: {
2672
+ type: 'string'
2673
+ path: string
2674
+ }
2675
+ isStateMachine: {
2676
+ type: 'bool'
2677
+ path: string
2678
+ }
2679
+ }
2680
+ }
2681
+ >
2682
+ /* Event of animation loop end */
2683
+ onLoopEnd?: Array<
2684
+ EventAction & {
2685
+ eventPropertyMapping?: {
2686
+ animationName: {
2687
+ type: 'string'
2688
+ path: string
2689
+ }
2690
+ isStateMachine: {
2691
+ type: 'bool'
2692
+ path: string
2693
+ }
2694
+ }
2695
+ }
2696
+ >
2697
+ /* Event of state changed */
2698
+ onStateChanged?: Array<
2699
+ EventAction & {
2700
+ eventPropertyMapping?: {
2701
+ stateMachineName: {
2702
+ type: 'string'
2703
+ path: string
2704
+ }
2705
+ stateName: {
2706
+ type: 'string'
2707
+ path: string
2708
+ }
2709
+ }
2710
+ }
2711
+ >
2712
+ /* Event of error */
2713
+ onError?: Array<
2714
+ EventAction & {
2715
+ eventPropertyMapping?: {
2716
+ error: {
2717
+ type: 'string'
2718
+ path: string
2719
+ }
2720
+ }
2721
+ }
2722
+ >
2723
+ /* Event of Rive general event received */
2724
+ onRiveGeneralEvent?: Array<
2725
+ EventAction & {
2726
+ eventPropertyMapping?: {
2727
+ eventName: {
2728
+ type: 'string'
2729
+ path: string
2730
+ }
2731
+ eventDelay: {
2732
+ type: 'number'
2733
+ path: string
2734
+ }
2735
+ eventProperties: {
2736
+ type: 'object'
2737
+ path: string
2738
+ }
2739
+ }
2740
+ }
2741
+ >
2742
+ /* Event of Rive open-url event received */
2743
+ onRiveOpenUrlEvent?: Array<
2744
+ EventAction & {
2745
+ eventPropertyMapping?: {
2746
+ eventName: {
2747
+ type: 'string'
2748
+ path: string
2749
+ }
2750
+ eventDelay: {
2751
+ type: 'number'
2752
+ path: string
2753
+ }
2754
+ eventUrl: {
2755
+ type: 'string'
2756
+ path: string
2757
+ }
2758
+ eventTarget: {
2759
+ type: 'string'
2760
+ path: string
2761
+ }
2762
+ }
2763
+ }
2764
+ >
2765
+ }
2766
+ animation?: AnimationBasicEvents & {
2767
+ onPlay?: Animation
2768
+ onPause?: Animation
2769
+ onStop?: Animation
2770
+ onLoopEnd?: Animation
2771
+ onStateChanged?: Animation
2772
+ onError?: Animation
2773
+ onRiveGeneralEvent?: Animation
2774
+ onRiveOpenUrlEvent?: Animation
2775
+ }
2776
+ }
2777
+
2778
+ /* Rive file component */
2779
+ export type BrickRive = Brick &
2780
+ BrickRiveDef & {
2781
+ templateKey: 'BRICK_RIVE'
2782
+ switches: Array<
2783
+ SwitchDef &
2784
+ BrickRiveDef & {
2785
+ conds?: Array<{
2786
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
2787
+ cond:
2788
+ | SwitchCondInnerStateCurrentCanvas
2789
+ | SwitchCondData
2790
+ | {
2791
+ __typename: 'SwitchCondInnerStateOutlet'
2792
+ outlet: ''
2793
+ value: any
2794
+ }
2795
+ }>
2796
+ }
2797
+ >
2798
+ }
2799
+
2489
2800
  /* Run Javascript on the WebView */
2490
2801
  export type BrickWebViewActionInjectJavascript = ActionWithParams & {
2491
2802
  __actionName: 'BRICK_WEBVIEW_INJECT_JAVASCRIPT'
@@ -41,9 +41,35 @@ Default property:
41
41
  }
42
42
  events?: {
43
43
  /* Event for each tick start */
44
- ticking?: Array<EventAction>
44
+ ticking?: Array<
45
+ EventAction & {
46
+ eventPropertyMapping?: {
47
+ countdown: {
48
+ type: 'number'
49
+ path: string
50
+ }
51
+ value: {
52
+ type: 'any'
53
+ path: string
54
+ }
55
+ }
56
+ }
57
+ >
45
58
  /* Event for tick completed */
46
- completed?: Array<EventAction>
59
+ completed?: Array<
60
+ EventAction & {
61
+ eventPropertyMapping?: {
62
+ countdown: {
63
+ type: 'number'
64
+ path: string
65
+ }
66
+ value: {
67
+ type: 'any'
68
+ path: string
69
+ }
70
+ }
71
+ }
72
+ >
47
73
  }
48
74
  outlets?: {
49
75
  /* Result of each countdown change */
@@ -6122,6 +6148,31 @@ export type GeneratorLLMActionCompletion = ActionWithParams & {
6122
6148
  value?: number | DataLink
6123
6149
  mapping?: string
6124
6150
  }
6151
+ | {
6152
+ input: 'dryMultiplier'
6153
+ value?: number | DataLink
6154
+ mapping?: string
6155
+ }
6156
+ | {
6157
+ input: 'dryBase'
6158
+ value?: number | DataLink
6159
+ mapping?: string
6160
+ }
6161
+ | {
6162
+ input: 'dryAllowedLength'
6163
+ value?: number | DataLink
6164
+ mapping?: string
6165
+ }
6166
+ | {
6167
+ input: 'dryPenaltyLastN'
6168
+ value?: number | DataLink
6169
+ mapping?: string
6170
+ }
6171
+ | {
6172
+ input: 'drySequenceBreakers'
6173
+ value?: Array<any> | DataLink
6174
+ mapping?: string
6175
+ }
6125
6176
  | {
6126
6177
  input: 'mirostat'
6127
6178
  value?: number | DataLink
@@ -6261,6 +6312,15 @@ Default property:
6261
6312
  "completionTopK": 40,
6262
6313
  "completionTopP": 0.5,
6263
6314
  "completionMinP": 0.05,
6315
+ "completionDryMultiplier": 0,
6316
+ "completionDryBase": 1.75,
6317
+ "completionDryAllowedLength": 2,
6318
+ "completionDrySequenceBreakers": [
6319
+ "\n",
6320
+ ":",
6321
+ "\"",
6322
+ "*"
6323
+ ],
6264
6324
  "completionMirostat": 0,
6265
6325
  "completionMirostatTau": 5,
6266
6326
  "completionMirostatEta": 0.1,
@@ -6367,6 +6427,16 @@ Default property:
6367
6427
  completionXtcThreshold?: number | DataLink
6368
6428
  /* Sets the chance for token removal (checked once on sampler start) */
6369
6429
  completionXtcProbability?: number | DataLink
6430
+ /* Set the DRY (Don't Repeat Yourself) repetition penalty multiplier. Default: `0.0`, which is disabled. */
6431
+ completionDryMultiplier?: number | DataLink
6432
+ /* Set the DRY repetition penalty base value. Default: `1.75` */
6433
+ completionDryBase?: number | DataLink
6434
+ /* Tokens that extend repetition beyond this receive exponentially increasing penalty: multiplier * base ^ (length of repeating sequence before token - allowed length). Default: `2` */
6435
+ completionDryAllowedLength?: number | DataLink
6436
+ /* How many tokens to scan for repetitions. Default: `-1`, where `0` is disabled and `-1` is context size. */
6437
+ completionDryPenaltyLastN?: number | DataLink
6438
+ /* Specify an array of sequence breakers for DRY sampling. Only a JSON array of strings is accepted. Default: `['\n', ':', '"', '*']` */
6439
+ completionDrySequenceBreakers?: Array<string | DataLink> | DataLink
6370
6440
  /* Use Mirostat sampling. Top K, Nucleus, Tail Free and Locally Typical samplers are ignored if used. */
6371
6441
  completionMirostat?: number | DataLink
6372
6442
  /* Mirostat target entropy, parameter tau */
package/types/system.ts CHANGED
@@ -279,6 +279,75 @@ export type SystemActionTakeScreenshot = ActionWithParams & {
279
279
  >
280
280
  }
281
281
 
282
+ /* Subscribe to a channel for data update */
283
+ export type SystemActionChannelSubscribe = ActionWithParams & {
284
+ __actionName: 'CHANNEL_SUBSCRIBE'
285
+ params?: Array<
286
+ | {
287
+ input: 'key'
288
+ value?: string | DataLink
289
+ mapping?: string
290
+ }
291
+ | {
292
+ input: 'type'
293
+ value?: 'on' | 'once' | DataLink
294
+ mapping?: string
295
+ }
296
+ | {
297
+ input: 'livetime'
298
+ value?: number | DataLink
299
+ mapping?: string
300
+ }
301
+ | {
302
+ input: 'dataResult'
303
+ value?: string | DataLink | (() => Data)
304
+ mapping?: string
305
+ }
306
+ | {
307
+ input: 'progressResult'
308
+ value?: string | DataLink | (() => Data)
309
+ mapping?: string
310
+ }
311
+ | {
312
+ input: 'errorResult'
313
+ value?: string | DataLink | (() => Data)
314
+ mapping?: string
315
+ }
316
+ >
317
+ }
318
+
319
+ /* Unsubscribe from a channel */
320
+ export type SystemActionChannelUnsubscribe = ActionWithParams & {
321
+ __actionName: 'CHANNEL_UNSUBSCRIBE'
322
+ params?: Array<{
323
+ input: 'keyMatch'
324
+ value?: string | DataLink
325
+ mapping?: string
326
+ }>
327
+ }
328
+
329
+ /* Publish data to a channel */
330
+ export type SystemActionChannelPublish = ActionWithParams & {
331
+ __actionName: 'CHANNEL_PUBLISH'
332
+ params?: Array<
333
+ | {
334
+ input: 'keyMatch'
335
+ value?: string | DataLink
336
+ mapping?: string
337
+ }
338
+ | {
339
+ input: 'payloadType'
340
+ value?: 'result' | 'progress' | 'error' | DataLink
341
+ mapping?: string
342
+ }
343
+ | {
344
+ input: 'payload'
345
+ value?: string | DataLink
346
+ mapping?: string
347
+ }
348
+ >
349
+ }
350
+
282
351
  /* [Internal] Use a shared application */
283
352
  export type SystemActionUseShareApplication = ActionWithParams & {
284
353
  __actionName: 'USE_SHARE_APPLICATION'