@arkitektio/bsx 4.1.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bsx/references.d.ts.map +1 -1
- package/dist/bsx/references.js +28 -7
- package/dist/bsx/references.js.map +1 -1
- package/dist/catalogs/index.d.ts +83 -27
- package/dist/catalogs/index.d.ts.map +1 -1
- package/dist/catalogs/parts/data.d.ts +1 -1
- package/dist/catalogs/parts/feedback.d.ts +3 -3
- package/dist/catalogs/parts/forms.d.ts +35 -7
- package/dist/catalogs/parts/forms.d.ts.map +1 -1
- package/dist/catalogs/parts/forms.js +32 -0
- package/dist/catalogs/parts/forms.js.map +1 -1
- package/dist/catalogs/parts/icons.d.ts +2 -2
- package/dist/catalogs/parts/index.d.ts +63 -27
- package/dist/catalogs/parts/index.d.ts.map +1 -1
- package/dist/catalogs/parts/navigation.d.ts +4 -4
- package/dist/catalogs/parts/overlays.d.ts +11 -11
- package/dist/catalogs/parts/run.d.ts +8 -0
- package/dist/catalogs/parts/run.d.ts.map +1 -1
- package/dist/catalogs/parts/scene.d.ts +8 -0
- package/dist/catalogs/parts/scene.d.ts.map +1 -1
- package/dist/catalogs/parts/scene.js +4 -0
- package/dist/catalogs/parts/scene.js.map +1 -1
- package/dist/catalogs/props.d.ts +1 -1
- package/dist/catalogs/scene.d.ts +8 -0
- package/dist/catalogs/scene.d.ts.map +1 -1
- package/dist/catalogs/shadcn.d.ts +59 -11
- package/dist/catalogs/shadcn.d.ts.map +1 -1
- package/dist/catalogs/shadcn.js +2 -0
- package/dist/catalogs/shadcn.js.map +1 -1
- package/dist/catalogs/ui.d.ts +16 -16
- package/dist/ports/dependencies/DependenciesContainer.d.ts +13 -8
- package/dist/ports/dependencies/DependenciesContainer.d.ts.map +1 -1
- package/dist/ports/dependencies/DependenciesContainer.js +130 -118
- package/dist/ports/dependencies/DependenciesContainer.js.map +1 -1
- package/dist/ports/dependencies/DependencyTreeNotice.d.ts +3 -2
- package/dist/ports/dependencies/DependencyTreeNotice.d.ts.map +1 -1
- package/dist/ports/dependencies/DependencyTreeNotice.js +7 -6
- package/dist/ports/dependencies/DependencyTreeNotice.js.map +1 -1
- package/dist/ports/dependencies/tree.d.ts +24 -0
- package/dist/ports/dependencies/tree.d.ts.map +1 -1
- package/dist/ports/dependencies/tree.js +52 -0
- package/dist/ports/dependencies/tree.js.map +1 -1
- package/dist/ports/dependencies/useDependencyTree.d.ts +5 -0
- package/dist/ports/dependencies/useDependencyTree.d.ts.map +1 -1
- package/dist/ports/dependencies/useDependencyTree.js +11 -5
- package/dist/ports/dependencies/useDependencyTree.js.map +1 -1
- package/dist/renderer/BlokRenderer.d.ts +4 -1
- package/dist/renderer/BlokRenderer.d.ts.map +1 -1
- package/dist/renderer/BlokRenderer.js +5 -1
- package/dist/renderer/BlokRenderer.js.map +1 -1
- package/dist/renderer/bloks/control.d.ts +12 -0
- package/dist/renderer/bloks/control.d.ts.map +1 -1
- package/dist/renderer/bloks/control.js +92 -5
- package/dist/renderer/bloks/control.js.map +1 -1
- package/dist/renderer/bloks/data.d.ts +1 -1
- package/dist/renderer/bloks/feedback.d.ts +3 -3
- package/dist/renderer/bloks/forms.d.ts +31 -7
- package/dist/renderer/bloks/forms.d.ts.map +1 -1
- package/dist/renderer/bloks/forms.js +56 -0
- package/dist/renderer/bloks/forms.js.map +1 -1
- package/dist/renderer/bloks/icons.d.ts +1 -1
- package/dist/renderer/bloks/index.d.ts +51 -27
- package/dist/renderer/bloks/index.d.ts.map +1 -1
- package/dist/renderer/bloks/navigation.d.ts +4 -4
- package/dist/renderer/bloks/overlays.d.ts +11 -11
- package/dist/renderer/bloks/run/components.d.ts +4 -0
- package/dist/renderer/bloks/run/components.d.ts.map +1 -1
- package/dist/renderer/bloks/run/host.d.ts +32 -3
- package/dist/renderer/bloks/run/host.d.ts.map +1 -1
- package/dist/renderer/bloks/run/host.js.map +1 -1
- package/dist/renderer/bloks/scene/index.d.ts +4 -0
- package/dist/renderer/bloks/scene/index.d.ts.map +1 -1
- package/dist/renderer/functions/v2/index.d.ts.map +1 -1
- package/dist/renderer/functions/v2/index.js +39 -0
- package/dist/renderer/functions/v2/index.js.map +1 -1
- package/dist/renderer/runtime/context.d.ts +2 -0
- package/dist/renderer/runtime/context.d.ts.map +1 -1
- package/dist/renderer/runtime/context.js +4 -0
- package/dist/renderer/runtime/context.js.map +1 -1
- package/dist/renderer/runtime/hooks.d.ts.map +1 -1
- package/dist/renderer/runtime/hooks.js +1 -0
- package/dist/renderer/runtime/hooks.js.map +1 -1
- package/dist/renderer/runtime/resolution.d.ts +2 -0
- package/dist/renderer/runtime/resolution.d.ts.map +1 -1
- package/dist/renderer/runtime/resolution.js +17 -1
- package/dist/renderer/runtime/resolution.js.map +1 -1
- package/dist/renderer/runtime/schemas.d.ts +5 -5
- package/dist/renderer/runtime/task.d.ts +25 -2
- package/dist/renderer/runtime/task.d.ts.map +1 -1
- package/dist/renderer/runtime/task.js +11 -2
- package/dist/renderer/runtime/task.js.map +1 -1
- package/dist/renderer/runtime/types.d.ts +7 -2
- package/dist/renderer/runtime/types.d.ts.map +1 -1
- package/dist/shadcn.d.ts +51 -27
- package/dist/shadcn.d.ts.map +1 -1
- package/dist/shadcn.js +2 -0
- package/dist/shadcn.js.map +1 -1
- package/dist/spec/bsx_v2.json +64 -0
- package/dist/spec/catalogs/base@2.json +136 -3
- package/dist/spec/catalogs/base@2.json.js +136 -3
- package/dist/spec/catalogs/scene@1.json +20 -0
- package/dist/spec/catalogs/scene@1.json.js +20 -0
- package/dist/spec/catalogs/shadcn@1.json +142 -0
- package/dist/spec/catalogs/shadcn@1.json.js +142 -0
- package/dist/spec/vocabulary.d.ts +2 -0
- package/dist/spec/vocabulary.d.ts.map +1 -1
- package/dist/spec/vocabulary.js +1 -0
- package/dist/spec/vocabulary.js.map +1 -1
- package/dist/spec/vocabulary.json +43 -11
- package/dist/spec/vocabulary.json.js +43 -11
- package/package.json +1 -1
- package/src/bsx/language.test.ts +1 -1
- package/src/bsx/references.test.ts +59 -0
- package/src/bsx/references.ts +28 -7
- package/src/catalogs/parts/forms.ts +32 -0
- package/src/catalogs/parts/scene.ts +6 -0
- package/src/catalogs/shadcn.ts +2 -0
- package/src/ports/dependencies/DependenciesContainer.test.tsx +176 -0
- package/src/ports/dependencies/DependenciesContainer.tsx +341 -304
- package/src/ports/dependencies/DependencyTreeNotice.tsx +7 -15
- package/src/ports/dependencies/tree.test.ts +75 -0
- package/src/ports/dependencies/tree.ts +54 -0
- package/src/ports/dependencies/useDependencyTree.test.tsx +55 -0
- package/src/ports/dependencies/useDependencyTree.ts +11 -5
- package/src/renderer/BlokRenderer.tsx +9 -0
- package/src/renderer/bloks/control.tsx +116 -5
- package/src/renderer/bloks/forms.tsx +126 -0
- package/src/renderer/bloks/run/host.tsx +33 -3
- package/src/renderer/bloks/run/space.test.tsx +76 -0
- package/src/renderer/functions/v2/functions.test.ts +40 -1
- package/src/renderer/functions/v2/index.ts +47 -0
- package/src/renderer/runtime/context.tsx +6 -0
- package/src/renderer/runtime/hooks.ts +1 -0
- package/src/renderer/runtime/resolution.test.ts +14 -0
- package/src/renderer/runtime/resolution.ts +15 -1
- package/src/renderer/runtime/task.ts +33 -4
- package/src/renderer/runtime/types.ts +7 -2
- package/src/shadcn.ts +2 -0
- package/src/spec/bsx_v2.json +64 -0
- package/src/spec/catalogs/base@2.json +136 -3
- package/src/spec/catalogs/scene@1.json +20 -0
- package/src/spec/catalogs/shadcn@1.json +142 -0
- package/src/spec/spec.test.ts +20 -0
- package/src/spec/vocabulary.json +43 -11
- package/src/spec/vocabulary.ts +3 -0
package/dist/catalogs/ui.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
49
49
|
info: "info";
|
|
50
50
|
list: "list";
|
|
51
51
|
message: "message";
|
|
52
|
+
pause: "pause";
|
|
52
53
|
user: "user";
|
|
53
54
|
code: "code";
|
|
54
55
|
map: "map";
|
|
@@ -129,7 +130,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
129
130
|
network: "network";
|
|
130
131
|
package: "package";
|
|
131
132
|
paperclip: "paperclip";
|
|
132
|
-
pause: "pause";
|
|
133
133
|
pencil: "pencil";
|
|
134
134
|
play: "play";
|
|
135
135
|
plus: "plus";
|
|
@@ -187,6 +187,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
187
187
|
info: "info";
|
|
188
188
|
list: "list";
|
|
189
189
|
message: "message";
|
|
190
|
+
pause: "pause";
|
|
190
191
|
user: "user";
|
|
191
192
|
code: "code";
|
|
192
193
|
map: "map";
|
|
@@ -267,7 +268,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
267
268
|
network: "network";
|
|
268
269
|
package: "package";
|
|
269
270
|
paperclip: "paperclip";
|
|
270
|
-
pause: "pause";
|
|
271
271
|
pencil: "pencil";
|
|
272
272
|
play: "play";
|
|
273
273
|
plus: "plus";
|
|
@@ -325,6 +325,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
325
325
|
info: "info";
|
|
326
326
|
list: "list";
|
|
327
327
|
message: "message";
|
|
328
|
+
pause: "pause";
|
|
328
329
|
user: "user";
|
|
329
330
|
code: "code";
|
|
330
331
|
map: "map";
|
|
@@ -405,7 +406,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
405
406
|
network: "network";
|
|
406
407
|
package: "package";
|
|
407
408
|
paperclip: "paperclip";
|
|
408
|
-
pause: "pause";
|
|
409
409
|
pencil: "pencil";
|
|
410
410
|
play: "play";
|
|
411
411
|
plus: "plus";
|
|
@@ -477,6 +477,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
477
477
|
info: "info";
|
|
478
478
|
list: "list";
|
|
479
479
|
message: "message";
|
|
480
|
+
pause: "pause";
|
|
480
481
|
user: "user";
|
|
481
482
|
code: "code";
|
|
482
483
|
map: "map";
|
|
@@ -557,7 +558,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
557
558
|
network: "network";
|
|
558
559
|
package: "package";
|
|
559
560
|
paperclip: "paperclip";
|
|
560
|
-
pause: "pause";
|
|
561
561
|
pencil: "pencil";
|
|
562
562
|
play: "play";
|
|
563
563
|
plus: "plus";
|
|
@@ -623,9 +623,9 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
623
623
|
path: import("zod").ZodOptional<import("zod").ZodString>;
|
|
624
624
|
util_call: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodType<import("..").BlokUtilCall, unknown, import("zod/v4/core").$ZodTypeInternals<import("..").BlokUtilCall, unknown>>>>;
|
|
625
625
|
operator: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
626
|
+
equals: "equals";
|
|
626
627
|
truthy: "truthy";
|
|
627
628
|
falsy: "falsy";
|
|
628
|
-
equals: "equals";
|
|
629
629
|
notEquals: "notEquals";
|
|
630
630
|
gt: "gt";
|
|
631
631
|
gte: "gte";
|
|
@@ -768,9 +768,9 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
768
768
|
path: import("zod").ZodOptional<import("zod").ZodString>;
|
|
769
769
|
util_call: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodType<import("..").BlokUtilCall, unknown, import("zod/v4/core").$ZodTypeInternals<import("..").BlokUtilCall, unknown>>>>;
|
|
770
770
|
operator: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
771
|
+
equals: "equals";
|
|
771
772
|
truthy: "truthy";
|
|
772
773
|
falsy: "falsy";
|
|
773
|
-
equals: "equals";
|
|
774
774
|
notEquals: "notEquals";
|
|
775
775
|
gt: "gt";
|
|
776
776
|
gte: "gte";
|
|
@@ -893,6 +893,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
893
893
|
info: "info";
|
|
894
894
|
list: "list";
|
|
895
895
|
message: "message";
|
|
896
|
+
pause: "pause";
|
|
896
897
|
user: "user";
|
|
897
898
|
code: "code";
|
|
898
899
|
map: "map";
|
|
@@ -973,7 +974,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
973
974
|
network: "network";
|
|
974
975
|
package: "package";
|
|
975
976
|
paperclip: "paperclip";
|
|
976
|
-
pause: "pause";
|
|
977
977
|
pencil: "pencil";
|
|
978
978
|
play: "play";
|
|
979
979
|
plus: "plus";
|
|
@@ -1087,6 +1087,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
1087
1087
|
info: "info";
|
|
1088
1088
|
list: "list";
|
|
1089
1089
|
message: "message";
|
|
1090
|
+
pause: "pause";
|
|
1090
1091
|
user: "user";
|
|
1091
1092
|
code: "code";
|
|
1092
1093
|
map: "map";
|
|
@@ -1167,7 +1168,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
1167
1168
|
network: "network";
|
|
1168
1169
|
package: "package";
|
|
1169
1170
|
paperclip: "paperclip";
|
|
1170
|
-
pause: "pause";
|
|
1171
1171
|
pencil: "pencil";
|
|
1172
1172
|
play: "play";
|
|
1173
1173
|
plus: "plus";
|
|
@@ -1225,6 +1225,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
1225
1225
|
info: "info";
|
|
1226
1226
|
list: "list";
|
|
1227
1227
|
message: "message";
|
|
1228
|
+
pause: "pause";
|
|
1228
1229
|
user: "user";
|
|
1229
1230
|
code: "code";
|
|
1230
1231
|
map: "map";
|
|
@@ -1305,7 +1306,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
1305
1306
|
network: "network";
|
|
1306
1307
|
package: "package";
|
|
1307
1308
|
paperclip: "paperclip";
|
|
1308
|
-
pause: "pause";
|
|
1309
1309
|
pencil: "pencil";
|
|
1310
1310
|
play: "play";
|
|
1311
1311
|
plus: "plus";
|
|
@@ -1492,6 +1492,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
1492
1492
|
info: "info";
|
|
1493
1493
|
list: "list";
|
|
1494
1494
|
message: "message";
|
|
1495
|
+
pause: "pause";
|
|
1495
1496
|
user: "user";
|
|
1496
1497
|
code: "code";
|
|
1497
1498
|
map: "map";
|
|
@@ -1572,7 +1573,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
1572
1573
|
network: "network";
|
|
1573
1574
|
package: "package";
|
|
1574
1575
|
paperclip: "paperclip";
|
|
1575
|
-
pause: "pause";
|
|
1576
1576
|
pencil: "pencil";
|
|
1577
1577
|
play: "play";
|
|
1578
1578
|
plus: "plus";
|
|
@@ -1767,6 +1767,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
1767
1767
|
info: "info";
|
|
1768
1768
|
list: "list";
|
|
1769
1769
|
message: "message";
|
|
1770
|
+
pause: "pause";
|
|
1770
1771
|
user: "user";
|
|
1771
1772
|
code: "code";
|
|
1772
1773
|
map: "map";
|
|
@@ -1847,7 +1848,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
1847
1848
|
network: "network";
|
|
1848
1849
|
package: "package";
|
|
1849
1850
|
paperclip: "paperclip";
|
|
1850
|
-
pause: "pause";
|
|
1851
1851
|
pencil: "pencil";
|
|
1852
1852
|
play: "play";
|
|
1853
1853
|
plus: "plus";
|
|
@@ -2148,9 +2148,9 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
2148
2148
|
path: import("zod").ZodOptional<import("zod").ZodString>;
|
|
2149
2149
|
util_call: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodType<import("..").BlokUtilCall, unknown, import("zod/v4/core").$ZodTypeInternals<import("..").BlokUtilCall, unknown>>>>;
|
|
2150
2150
|
operator: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
2151
|
+
equals: "equals";
|
|
2151
2152
|
truthy: "truthy";
|
|
2152
2153
|
falsy: "falsy";
|
|
2153
|
-
equals: "equals";
|
|
2154
2154
|
notEquals: "notEquals";
|
|
2155
2155
|
gt: "gt";
|
|
2156
2156
|
gte: "gte";
|
|
@@ -2296,6 +2296,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
2296
2296
|
info: "info";
|
|
2297
2297
|
list: "list";
|
|
2298
2298
|
message: "message";
|
|
2299
|
+
pause: "pause";
|
|
2299
2300
|
user: "user";
|
|
2300
2301
|
code: "code";
|
|
2301
2302
|
map: "map";
|
|
@@ -2376,7 +2377,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
2376
2377
|
network: "network";
|
|
2377
2378
|
package: "package";
|
|
2378
2379
|
paperclip: "paperclip";
|
|
2379
|
-
pause: "pause";
|
|
2380
2380
|
pencil: "pencil";
|
|
2381
2381
|
play: "play";
|
|
2382
2382
|
plus: "plus";
|
|
@@ -2517,6 +2517,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
2517
2517
|
info: "info";
|
|
2518
2518
|
list: "list";
|
|
2519
2519
|
message: "message";
|
|
2520
|
+
pause: "pause";
|
|
2520
2521
|
user: "user";
|
|
2521
2522
|
code: "code";
|
|
2522
2523
|
map: "map";
|
|
@@ -2597,7 +2598,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
2597
2598
|
network: "network";
|
|
2598
2599
|
package: "package";
|
|
2599
2600
|
paperclip: "paperclip";
|
|
2600
|
-
pause: "pause";
|
|
2601
2601
|
pencil: "pencil";
|
|
2602
2602
|
play: "play";
|
|
2603
2603
|
plus: "plus";
|
|
@@ -2691,6 +2691,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
2691
2691
|
info: "info";
|
|
2692
2692
|
list: "list";
|
|
2693
2693
|
message: "message";
|
|
2694
|
+
pause: "pause";
|
|
2694
2695
|
user: "user";
|
|
2695
2696
|
code: "code";
|
|
2696
2697
|
map: "map";
|
|
@@ -2771,7 +2772,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
2771
2772
|
network: "network";
|
|
2772
2773
|
package: "package";
|
|
2773
2774
|
paperclip: "paperclip";
|
|
2774
|
-
pause: "pause";
|
|
2775
2775
|
pencil: "pencil";
|
|
2776
2776
|
play: "play";
|
|
2777
2777
|
plus: "plus";
|
|
@@ -2864,6 +2864,7 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
2864
2864
|
info: "info";
|
|
2865
2865
|
list: "list";
|
|
2866
2866
|
message: "message";
|
|
2867
|
+
pause: "pause";
|
|
2867
2868
|
user: "user";
|
|
2868
2869
|
code: "code";
|
|
2869
2870
|
map: "map";
|
|
@@ -2944,7 +2945,6 @@ export declare const uiCatalog: import("../catalogs").BlokCatalogContract<{
|
|
|
2944
2945
|
network: "network";
|
|
2945
2946
|
package: "package";
|
|
2946
2947
|
paperclip: "paperclip";
|
|
2947
|
-
pause: "pause";
|
|
2948
2948
|
pencil: "pencil";
|
|
2949
2949
|
play: "play";
|
|
2950
2950
|
plus: "plus";
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import { portHash } from "../engine/utils";
|
|
2
1
|
import type { ListDependencyFragment } from "../rekuest";
|
|
3
2
|
import { type DependencyNode, type ResolvedDependencyInput } from "./tree";
|
|
4
|
-
import type { ArgPort, PortGroup } from "../engine/types";
|
|
5
|
-
export type FilledGroup = PortGroup & {
|
|
6
|
-
filledPorts: ArgPort[];
|
|
7
|
-
};
|
|
8
|
-
export { portHash };
|
|
9
|
-
export declare const NanaContainer: () => import("react").JSX.Element;
|
|
10
3
|
/** Whose dependency the id names: an implementation's, or a blok's. */
|
|
11
4
|
export type DependencyOwner = "implementation" | "blok";
|
|
12
5
|
export type DependencyFieldProps = {
|
|
@@ -20,6 +13,12 @@ export type DependencyFieldProps = {
|
|
|
20
13
|
/** The form's own complaint about this pin. */
|
|
21
14
|
error?: string;
|
|
22
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* One dependency on one line: what it is called, and what will serve it. The
|
|
18
|
+
* line is the picker's trigger: "Automatic" (whoever fits when it runs) or the
|
|
19
|
+
* agents pinned by name. What the agents it reaches need themselves follows
|
|
20
|
+
* below, folded until something there is pinned or unmet.
|
|
21
|
+
*/
|
|
23
22
|
export declare const DependencySearchField: ({ dependency, owner, pin, onPin, node, error: fieldError, }: DependencyFieldProps) => import("react").JSX.Element;
|
|
24
23
|
export type DependencyContainerProps = {
|
|
25
24
|
dependencies: ListDependencyFragment[];
|
|
@@ -28,5 +27,11 @@ export type DependencyContainerProps = {
|
|
|
28
27
|
/** The assign's dry run (`useDependencyTree`): without it only the root level shows. */
|
|
29
28
|
tree?: DependencyNode[] | null;
|
|
30
29
|
};
|
|
31
|
-
|
|
30
|
+
/**
|
|
31
|
+
* "Runs with": the agents a run reaches besides its own. One line while they
|
|
32
|
+
* resolve by themselves, which is most runs; it opens to one line per
|
|
33
|
+
* dependency when something is pinned, unmet or waiting to be picked, or when
|
|
34
|
+
* asked. Once open it stays open.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DependenciesContainer: ({ dependencies, owner, tree, }: DependencyContainerProps) => import("react").JSX.Element | null;
|
|
32
37
|
//# sourceMappingURL=DependenciesContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependenciesContainer.d.ts","sourceRoot":"","sources":["../../../src/ports/dependencies/DependenciesContainer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DependenciesContainer.d.ts","sourceRoot":"","sources":["../../../src/ports/dependencies/DependenciesContainer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAaL,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC7B,MAAM,QAAQ,CAAC;AAyChB,uEAAuE;AACvE,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,MAAM,CAAC;AAExD,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,sBAAsB,CAAC;IACnC,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,yDAAyD;IACzD,GAAG,EAAE,uBAAuB,GAAG,SAAS,CAAC;IACzC,KAAK,EAAE,CAAC,GAAG,EAAE,uBAAuB,GAAG,SAAS,KAAK,IAAI,CAAC;IAC1D,oFAAoF;IACpF,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA0BF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,6DAOnC,oBAAoB,gCAqQtB,CAAC;AA+FF,MAAM,MAAM,wBAAwB,GAAG;IACrC,YAAY,EAAE,sBAAsB,EAAE,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,wFAAwF;IACxF,IAAI,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,gCAInC,wBAAwB,uCA+E1B,CAAC"}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { portHash } from "../engine/utils.js";
|
|
3
2
|
import { portHost } from "../host.js";
|
|
4
|
-
import { levelBelow, withLevelBelow, withPin, } from "./tree.js";
|
|
5
|
-
import { Command,
|
|
6
|
-
import {
|
|
7
|
-
import { cn } from "../../vendor/core/util/utils.js";
|
|
8
|
-
import { Bot, CheckIcon, ChevronRight, Circle, SearchIcon, X, Zap } from "lucide-react";
|
|
9
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
10
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../vendor/core/ui/collapsible.js";
|
|
3
|
+
import { agentLabel, agentsOf, awaitsPick, levelBelow, namesAgents, pickHint, pickLimits, unmetDependencies, withLevelBelow, withPin, } from "./tree.js";
|
|
4
|
+
import { Command, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, } from "../../vendor/core/ui/command.js";
|
|
5
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../vendor/core/ui/popover.js";
|
|
11
6
|
import { useDebouncedCallback } from "../../vendor/core/util/hooks/useDebouncedCallback.js";
|
|
7
|
+
import { cn } from "../../vendor/core/util/utils.js";
|
|
8
|
+
import { AlertCircle, ChevronRight, ChevronsUpDown, CircleSlash, Zap } from "lucide-react";
|
|
9
|
+
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
12
10
|
import { useFormContext, useWatch } from "react-hook-form";
|
|
13
|
-
import { Badge } from "../../vendor/core/ui/badge.js";
|
|
14
|
-
import { Button } from "../../vendor/core/ui/button.js";
|
|
15
|
-
import { FormDescription, FormLabel } from "../../vendor/core/ui/form.js";
|
|
16
|
-
import { InputGroup, InputGroupAddon } from "../../vendor/core/ui/input-group.js";
|
|
17
11
|
/**
|
|
18
12
|
* What can bind a dependency. `dependency` narrows to an implementation's, `blokDependency` to a
|
|
19
13
|
* blok's, `values` resolves ones already picked. As text: it goes through the host's service query.
|
|
@@ -33,20 +27,27 @@ query AgentForDependency($search: String, $values: [ID!], $dependency: ID, $blok
|
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
29
|
`;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
/** How many agents the closed field names before it counts the rest. */
|
|
31
|
+
const SHOWN_AGENTS = 3;
|
|
32
|
+
const PresenceDot = ({ connected }) => (_jsx("span", { "aria-label": connected ? "Connected" : "Offline", className: cn("size-2 shrink-0 rounded-full", connected ? "bg-green-500" : "bg-muted-foreground/40") }));
|
|
33
|
+
/** Agents on one line: a presence dot and a name each, the rest counted. */
|
|
34
|
+
const AgentNames = ({ agents, className }) => (_jsxs("span", { className: cn("flex min-w-0 items-center gap-2.5", className), children: [agents.slice(0, SHOWN_AGENTS).map(({ id, agent }) => (_jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx(PresenceDot, { connected: agent?.connected }), _jsx("span", { className: "truncate", children: agentLabel(agent, id) })] }, id))), agents.length > SHOWN_AGENTS && (_jsxs("span", { className: "shrink-0 text-muted-foreground", children: ["+", agents.length - SHOWN_AGENTS] }))] }));
|
|
35
|
+
/**
|
|
36
|
+
* One dependency on one line: what it is called, and what will serve it. The
|
|
37
|
+
* line is the picker's trigger: "Automatic" (whoever fits when it runs) or the
|
|
38
|
+
* agents pinned by name. What the agents it reaches need themselves follows
|
|
39
|
+
* below, folded until something there is pinned or unmet.
|
|
40
|
+
*/
|
|
43
41
|
export const DependencySearchField = ({ dependency, owner = "implementation", pin, onPin, node, error: fieldError, }) => {
|
|
44
42
|
const [agents, setAgents] = useState([]);
|
|
45
43
|
const [agentCache, setAgentCache] = useState({});
|
|
46
|
-
const [
|
|
47
|
-
const
|
|
44
|
+
const [loaded, setLoaded] = useState(false);
|
|
45
|
+
const [failed, setFailed] = useState(false);
|
|
48
46
|
const [open, setOpen] = useState(false);
|
|
49
47
|
const [inputValue, setInputValue] = useState("");
|
|
48
|
+
const labelId = useId();
|
|
49
|
+
// A late answer to an earlier search must not replace a newer one.
|
|
50
|
+
const requestRef = useRef(0);
|
|
50
51
|
const host = portHost();
|
|
51
52
|
const { StructureDisplay } = host;
|
|
52
53
|
const run = host.useServiceQuery("rekuest");
|
|
@@ -54,58 +55,40 @@ export const DependencySearchField = ({ dependency, owner = "implementation", pi
|
|
|
54
55
|
const dependencyFilter = owner === "blok" ? { blokDependency: dependency.id } : { dependency: dependency.id };
|
|
55
56
|
// The pin is the selection: it lives in the form, at this level.
|
|
56
57
|
const selectedIds = useMemo(() => pin?.mappedAgents.map((mapped) => mapped.agent) ?? [], [pin]);
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
key: dependency.key,
|
|
66
|
-
autoResolve: autoResolve,
|
|
67
|
-
// An agent that stays keeps what is pinned below it.
|
|
68
|
-
mappedAgents: agentIds.map((id) => pin?.mappedAgents.find((mapped) => mapped.agent === id) ?? { agent: id, key: dependency.key }),
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
const toggleAutoResolve = () => {
|
|
72
|
-
onPin({
|
|
73
|
-
key: dependency.key,
|
|
74
|
-
autoResolve: !autoResolve,
|
|
75
|
-
mappedAgents: pin?.mappedAgents ?? [],
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
const queryAgents = useDebouncedCallback((searchStr) => {
|
|
79
|
-
if (!dependency.id)
|
|
58
|
+
const pinned = selectedIds.length > 0;
|
|
59
|
+
const automatic = !pinned && (pin?.autoResolve ?? false);
|
|
60
|
+
const { max } = pickLimits(dependency);
|
|
61
|
+
const single = max === 1;
|
|
62
|
+
const remember = (found) => setAgentCache((known) => ({ ...known, ...Object.fromEntries(found.map((agent) => [agent.id, agent])) }));
|
|
63
|
+
const load = (term) => {
|
|
64
|
+
if (!dependency.id) {
|
|
65
|
+
setLoaded(true);
|
|
80
66
|
return;
|
|
81
|
-
|
|
67
|
+
}
|
|
68
|
+
const request = ++requestRef.current;
|
|
69
|
+
search({ search: term, ...dependencyFilter })
|
|
82
70
|
.then((found) => {
|
|
71
|
+
if (requestRef.current !== request)
|
|
72
|
+
return;
|
|
83
73
|
setAgents(found);
|
|
84
74
|
remember(found);
|
|
85
|
-
|
|
86
|
-
setError(null);
|
|
75
|
+
setFailed(false);
|
|
87
76
|
})
|
|
88
|
-
.catch((
|
|
89
|
-
|
|
77
|
+
.catch(() => {
|
|
78
|
+
if (requestRef.current !== request)
|
|
79
|
+
return;
|
|
90
80
|
setAgents([]);
|
|
91
|
-
|
|
92
|
-
});
|
|
93
|
-
// Load initial options
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
if (!dependency.id)
|
|
96
|
-
return;
|
|
97
|
-
search({ search: "", ...dependencyFilter })
|
|
98
|
-
.then((found) => {
|
|
99
|
-
setAgents(found);
|
|
100
|
-
remember(found);
|
|
101
|
-
setError(null);
|
|
81
|
+
setFailed(true);
|
|
102
82
|
})
|
|
103
|
-
.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
83
|
+
.finally(() => requestRef.current === request && setLoaded(true));
|
|
84
|
+
};
|
|
85
|
+
const query = useDebouncedCallback(load);
|
|
86
|
+
// Asked when the list is opened, not when the form mounts: most runs never open it.
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (open)
|
|
89
|
+
load(inputValue);
|
|
107
90
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
108
|
-
}, [dependency.id]);
|
|
91
|
+
}, [open, dependency.id]);
|
|
109
92
|
// The agents the dry run bound are known without asking.
|
|
110
93
|
const boundAgents = useMemo(() => {
|
|
111
94
|
const bound = {};
|
|
@@ -125,60 +108,69 @@ export const DependencySearchField = ({ dependency, owner = "implementation", pi
|
|
|
125
108
|
.catch(() => { });
|
|
126
109
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
127
110
|
}, [unknown]);
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
111
|
+
const pinAgents = (agentIds) => {
|
|
112
|
+
// Nobody named: back to "whoever fits", where the dependency allows it.
|
|
113
|
+
if (agentIds.length === 0) {
|
|
114
|
+
onPin(dependency.autoResolvable ? { key: dependency.key, autoResolve: true, mappedAgents: [] } : undefined);
|
|
115
|
+
return;
|
|
133
116
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
117
|
+
onPin({
|
|
118
|
+
key: dependency.key,
|
|
119
|
+
autoResolve: false,
|
|
120
|
+
// An agent that stays keeps what is pinned below it.
|
|
121
|
+
mappedAgents: agentIds.map((id) => pin?.mappedAgents.find((mapped) => mapped.agent === id) ?? { agent: id, key: dependency.key }),
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
const toggleAgent = (agentId) => {
|
|
125
|
+
if (single) {
|
|
126
|
+
pinAgents(selectedIds.includes(agentId) ? [] : [agentId]);
|
|
127
|
+
setOpen(false);
|
|
128
|
+
return;
|
|
140
129
|
}
|
|
141
|
-
|
|
142
|
-
|
|
130
|
+
pinAgents(selectedIds.includes(agentId) ? selectedIds.filter((id) => id !== agentId) : [...selectedIds, agentId]);
|
|
131
|
+
};
|
|
132
|
+
const chooseAutomatic = () => {
|
|
133
|
+
onPin({ key: dependency.key, autoResolve: true, mappedAgents: [] });
|
|
134
|
+
setOpen(false);
|
|
143
135
|
};
|
|
144
|
-
const
|
|
145
|
-
|
|
136
|
+
const chooseNone = () => {
|
|
137
|
+
onPin(undefined);
|
|
138
|
+
setOpen(false);
|
|
146
139
|
};
|
|
147
|
-
//
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
140
|
+
// What an assign reaches: the agents named, else what the dry run resolved by itself.
|
|
141
|
+
const named = selectedIds.map((id) => ({ id, agent: agentCache[id] ?? boundAgents[id] }));
|
|
142
|
+
const resolved = pinned
|
|
143
|
+
? []
|
|
144
|
+
: (node?.mappedAgents ?? []).map((binding) => ({ id: binding.agentId, agent: binding.agent }));
|
|
145
|
+
const complaint = fieldError || node?.unmet || undefined;
|
|
146
|
+
const hint = pickHint(dependency);
|
|
147
|
+
const only = [dependency.appFilter, dependency.versionFilter].filter(Boolean).join(" ");
|
|
148
|
+
const full = !single && selectedIds.length >= max;
|
|
149
|
+
return (_jsxs("div", { className: "grid grid-cols-[minmax(0,11rem)_minmax(0,1fr)] items-start gap-x-3 gap-y-1.5", children: [_jsxs("div", { className: "flex min-h-8 min-w-0 flex-col justify-center", children: [_jsxs("span", { id: labelId, className: "flex min-w-0 items-baseline gap-1.5 text-sm", children: [_jsx("span", { className: "truncate font-medium", children: dependency.key }), dependency.optional && _jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: "optional" })] }), dependency.description && (_jsx("span", { className: "line-clamp-2 text-xs text-muted-foreground", title: dependency.description, children: dependency.description }))] }), _jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-labelledby": labelId, "aria-invalid": complaint ? true : undefined, className: cn("flex h-8 w-full items-center gap-2 rounded-md border border-input bg-transparent px-2.5 text-left text-xs ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", complaint && "border-destructive/60"), children: [pinned ? (_jsx(AgentNames, { agents: named, className: "flex-1" })) : resolved.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(Zap, { "aria-label": "Chosen automatically", className: "size-3.5 shrink-0 text-muted-foreground" }), _jsx(AgentNames, { agents: resolved, className: "flex-1" })] })) : automatic ? (_jsxs(_Fragment, { children: [_jsx(Zap, { className: "size-3.5 shrink-0 text-muted-foreground" }), _jsx("span", { className: "flex-1 truncate", children: "Automatic" })] })) : (_jsx("span", { className: "flex-1 truncate text-muted-foreground", children: dependency.optional ? "None" : single ? "Pick an agent…" : "Pick agents…" })), _jsx(ChevronsUpDown, { className: "size-3.5 shrink-0 text-muted-foreground" })] }) }), _jsx(PopoverContent, { side: "bottom", align: "start", className: "w-[max(var(--radix-popover-trigger-width),20rem)] p-0", children: _jsxs(Command, { shouldFilter: false, className: "bg-transparent", children: [_jsx(CommandInput, { placeholder: "Search agents\u2026", value: inputValue, onValueChange: (term) => {
|
|
150
|
+
setInputValue(term);
|
|
151
|
+
query(term);
|
|
152
|
+
} }), (hint || only) && (_jsx("div", { className: "px-3.5 pt-2 text-[11px] text-muted-foreground", children: [hint, only && `only ${only}`].filter(Boolean).join(" · ") })), _jsxs(CommandList, { children: [(dependency.autoResolvable || dependency.optional) && (_jsxs(_Fragment, { children: [_jsxs(CommandGroup, { children: [dependency.autoResolvable && (_jsxs(CommandItem, { value: "__automatic", "data-checked": automatic, onSelect: chooseAutomatic, children: [_jsx(Zap, { className: "text-muted-foreground" }), _jsxs("span", { className: "flex min-w-0 flex-col", children: [_jsx("span", { children: "Automatic" }), _jsx("span", { className: "text-[11px] text-muted-foreground", children: "Whoever fits when it runs" })] })] })), dependency.optional && (_jsxs(CommandItem, { value: "__none", "data-checked": !pinned && !automatic, onSelect: chooseNone, children: [_jsx(CircleSlash, { className: "text-muted-foreground" }), _jsx("span", { children: "None" })] }))] }), _jsx(CommandSeparator, {})] })), failed && (_jsxs("div", { className: "flex items-center gap-2 px-3.5 py-3 text-xs text-destructive", children: [_jsx(AlertCircle, { className: "size-3.5 shrink-0" }), "The agents could not be loaded."] })), loaded && !failed && agents.length === 0 && (_jsx("div", { className: "px-3.5 py-4 text-center text-xs text-muted-foreground", children: inputValue ? `No agent matches “${inputValue}”.` : "No agent provides this." })), agents.length > 0 && (_jsx(CommandGroup, { heading: full ? `Agents · ${max} picked, unpick one to change` : "Agents", children: agents.map((agent) => {
|
|
153
|
+
const isSelected = selectedIds.includes(agent.id);
|
|
154
|
+
return (_jsxs(CommandItem, { value: agent.id, "data-checked": isSelected, disabled: full && !isSelected, onSelect: () => toggleAgent(agent.id), children: [_jsx(PresenceDot, { connected: agent.connected }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx("span", { className: "truncate", children: agentLabel(agent, agent.id) }), _jsxs("span", { className: "truncate text-[11px] text-muted-foreground", children: [agent.app.identifier, " \u00B7 ", agent.release.version, !agent.connected && " · offline"] })] }), _jsx(StructureDisplay, { identifier: "@lok/user", id: agent.user.sub, variant: "avatar", className: "size-5" })] }, agent.id));
|
|
155
|
+
}) }))] })] }) })] }), complaint && _jsx("p", { className: "text-xs text-destructive", children: complaint })] }), node?.mappedAgents.map((binding) => (_jsx(LevelBelow, { binding: binding, pins: pin?.mappedAgents.find((mapped) => mapped.agent === binding.agentId)?.dependencies ?? NO_PINS, onChange: (next) => onPin(withLevelBelow(pin, node, binding.agentId, next)) }, binding.agentId)))] }));
|
|
156
|
+
};
|
|
157
|
+
const NO_PINS = [];
|
|
158
|
+
/**
|
|
159
|
+
* What one bound agent needs itself: a line naming it, the level under it.
|
|
160
|
+
* Folded while it takes care of itself; open once something below is pinned
|
|
161
|
+
* or unmet, and it then stays open.
|
|
162
|
+
*/
|
|
163
|
+
const LevelBelow = ({ binding, pins, onChange, }) => {
|
|
164
|
+
const below = useMemo(() => levelBelow(binding), [binding]);
|
|
165
|
+
const needsLook = namesAgents(pins) || unmetDependencies(below).length > 0;
|
|
166
|
+
const [open, setOpen] = useState(needsLook);
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
if (needsLook)
|
|
169
|
+
setOpen(true);
|
|
170
|
+
}, [needsLook]);
|
|
171
|
+
if (below.length === 0)
|
|
159
172
|
return null;
|
|
160
|
-
})();
|
|
161
|
-
// What resolved without a pin: shown, so it is clear what an assign reaches.
|
|
162
|
-
const resolvedByItself = selectedIds.length === 0 ? (node?.mappedAgents ?? []) : [];
|
|
163
|
-
return (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [dependency.key != null && (_jsx(FormLabel, { className: "text-sm", children: dependency.key })), dependency.optional && (_jsx("span", { className: "text-[10px] text-muted-foreground", children: "optional" })), countHint && (_jsxs("span", { className: "text-[10px] text-muted-foreground", children: ["(", selectedIds.length, autoResolve ? "+auto" : "", " / ", countHint, ")"] })), !countHint && selectedIds.length > 0 && (_jsxs("span", { className: "text-[10px] text-muted-foreground", children: ["(", selectedIds.length, " selected", autoResolve ? " +auto" : "", ")"] }))] }), dependency.autoResolvable && (_jsxs(Button, { type: "button", variant: autoResolve ? "default" : "outline", size: "sm", className: "h-6 text-[10px] px-2 gap-1", onClick: toggleAutoResolve, children: [_jsx(Zap, { className: cn("h-3 w-3", autoResolve && "text-yellow-300") }), autoResolve ? "Auto" : "Auto-resolve"] }))] }), !autoResolve && (_jsxs(Command, { shouldFilter: false, className: "overflow-visible bg-transparent relative w-full", children: [_jsx("div", { className: "rounded-md text-sm ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 flex flex-row w-full", children: _jsx("div", { className: "relative w-full", children: _jsx(CommandInputWithBadges, { ref: inputRef, placeholder: "Search for an agent...", onValueChange: (e) => {
|
|
164
|
-
setInputValue(e);
|
|
165
|
-
queryAgents(e);
|
|
166
|
-
}, value: inputValue, onBlur: () => setOpen(false), onFocus: () => setOpen(true), className: "w-full flex-grow", children: _jsx(_Fragment, { children: selectedIds.map((id) => {
|
|
167
|
-
const agent = agentCache[id] ?? boundAgents[id];
|
|
168
|
-
return (_jsxs(Badge, { variant: "secondary", className: "cursor-pointer text-[10px] px-1.5 py-0 h-5 flex-shrink-0 gap-1", onClick: () => removeAgent(id), children: [agent ? (_jsxs(_Fragment, { children: [_jsx(Circle, { className: cn("h-2 w-2 fill-current", agent.connected ? "text-green-500" : "text-muted-foreground/40") }), agent.app.identifier] })) : (_jsxs(_Fragment, { children: [_jsx(Bot, { className: "h-2.5 w-2.5" }), id] })), _jsx(X, { className: "h-2.5 w-2.5 opacity-60" })] }, id));
|
|
169
|
-
}) }) }) }) }), _jsx("div", { className: "relative mt-1", children: open && (_jsx(CommandList, { className: "w-full", children: _jsxs("div", { className: "absolute top-0 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in", children: [_jsx(CommandEmpty, { children: "No matching agent found" }), error && (_jsx(CommandGroup, { heading: "Error", children: _jsx(CommandItem, { children: error }) })), agents.length > 0 && (_jsx(CommandGroup, { heading: "Agents", children: agents.map((agent) => {
|
|
170
|
-
const isSelected = selectedIds.includes(agent.id);
|
|
171
|
-
return (_jsxs(CommandItem, { value: agent.id, onMouseDown: (e) => {
|
|
172
|
-
e.preventDefault();
|
|
173
|
-
e.stopPropagation();
|
|
174
|
-
}, onSelect: () => toggleAgent(agent.id), className: "flex items-center gap-3 py-2", children: [_jsxs("div", { className: "relative flex-shrink-0", children: [_jsx(StructureDisplay, { identifier: "@lok/user", id: agent.user.sub, variant: "avatar", className: "h-7 w-7" }), _jsx(Circle, { className: cn("absolute -bottom-0.5 -right-0.5 h-2.5 w-2.5 rounded-full fill-current ring-2 ring-popover", agent.connected ? "text-green-500" : "text-muted-foreground/40") })] }), _jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [_jsx("span", { className: "text-sm font-medium truncate", children: agent.app.identifier }), _jsxs("span", { className: "text-[10px] text-muted-foreground truncate", children: ["v", agent.release.version] })] }), _jsx(CheckIcon, { className: cn("ml-auto h-4 w-4 flex-shrink-0", isSelected ? "opacity-100" : "opacity-0") })] }, agent.id));
|
|
175
|
-
}) }))] }) })) })] })), resolvedByItself.length > 0 && (_jsxs("div", { className: "flex flex-wrap items-center gap-1 text-[10px] text-muted-foreground", children: ["resolves to", resolvedByItself.map((binding) => (_jsxs(Badge, { variant: "outline", className: "text-[10px] px-1.5 py-0 h-5 gap-1 font-normal", children: [_jsx(Circle, { className: cn("h-2 w-2 fill-current", binding.agent?.connected ? "text-green-500" : "text-muted-foreground/40") }), binding.agent?.app.identifier ?? binding.agentId] }, binding.agentId)))] })), (fieldError || node?.unmet) && (_jsx("p", { className: "text-destructive text-xs", children: fieldError || node?.unmet })), dependency.description && (_jsx(FormDescription, { children: dependency.description })), node?.mappedAgents.map((binding) => {
|
|
176
|
-
const below = levelBelow(binding);
|
|
177
|
-
if (below.length === 0)
|
|
178
|
-
return null;
|
|
179
|
-
const pinned = pin?.mappedAgents.find((mapped) => mapped.agent === binding.agentId);
|
|
180
|
-
return (_jsxs(Collapsible, { defaultOpen: true, className: "ml-1 border-l pl-3", children: [_jsxs(CollapsibleTrigger, { className: "group flex items-center gap-1 py-1 text-xs text-muted-foreground", children: [_jsx(ChevronRight, { className: "h-3 w-3 transition-transform group-data-[state=open]:rotate-90" }), binding.agent?.app.identifier ?? binding.agentId, " depends on"] }), _jsx(CollapsibleContent, { className: "pt-1 pb-2", children: _jsx(DependencyLevel, { dependencies: below.map((inner) => inner.dependency ?? undeclared(inner.key)), nodes: below, value: pinned?.dependencies ?? [], onChange: (next) => onPin(withLevelBelow(pin, node, binding.agentId, next)) }) })] }, binding.agentId));
|
|
181
|
-
})] }));
|
|
173
|
+
return (_jsxs("div", { className: "col-span-2 flex flex-col gap-2", children: [_jsxs("button", { type: "button", "aria-expanded": open, onClick: () => setOpen((was) => !was), className: "flex min-w-0 items-center gap-1 self-start text-xs text-muted-foreground hover:text-foreground", children: [_jsx(ChevronRight, { className: cn("size-3 shrink-0 transition-transform", open && "rotate-90") }), _jsxs("span", { className: "truncate", children: [agentLabel(binding.agent, binding.agentId), " needs ", below.map((inner) => inner.key).join(", ")] })] }), open && (_jsx("div", { className: "ml-1.5 border-l pl-3", children: _jsx(DependencyLevel, { dependencies: below.map((inner) => inner.dependency ?? undeclared(inner.key)), nodes: below, value: pins, onChange: onChange }) }))] }));
|
|
182
174
|
};
|
|
183
175
|
/** A dependency a task still carries although its implementation no longer declares it. */
|
|
184
176
|
const undeclared = (key) => ({
|
|
@@ -194,7 +186,13 @@ const undeclared = (key) => ({
|
|
|
194
186
|
singular: false,
|
|
195
187
|
});
|
|
196
188
|
/** One level of the dependency tree: its dependencies, each with the levels below what it binds. */
|
|
197
|
-
const DependencyLevel = ({ dependencies, nodes, value, onChange, owner, errors }) => (_jsx("div", { className: "
|
|
189
|
+
const DependencyLevel = ({ dependencies, nodes, value, onChange, owner, errors }) => (_jsx("div", { className: "flex flex-col gap-2.5", children: dependencies.map((dep) => (_jsx(DependencySearchField, { dependency: dep, owner: owner, pin: value.find((pin) => pin.key === dep.key), onPin: (pin) => onChange(withPin(value, dep.key, pin)), node: nodes?.find((node) => node.key === dep.key), error: errors?.[dep.key]?.message }, dep.key))) }));
|
|
190
|
+
/**
|
|
191
|
+
* "Runs with": the agents a run reaches besides its own. One line while they
|
|
192
|
+
* resolve by themselves, which is most runs; it opens to one line per
|
|
193
|
+
* dependency when something is pinned, unmet or waiting to be picked, or when
|
|
194
|
+
* asked. Once open it stays open.
|
|
195
|
+
*/
|
|
198
196
|
export const DependenciesContainer = ({ dependencies, owner, tree, }) => {
|
|
199
197
|
const form = useFormContext();
|
|
200
198
|
const watched = useWatch({ control: form.control, name: "dependencies" });
|
|
@@ -216,8 +214,22 @@ export const DependenciesContainer = ({ dependencies, owner, tree, }) => {
|
|
|
216
214
|
}
|
|
217
215
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
218
216
|
}, []);
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
// Per-dependency form errors (path: dependencies.{dep.key})
|
|
218
|
+
const errors = form.formState.errors?.dependencies;
|
|
219
|
+
const unmet = useMemo(() => unmetDependencies(tree), [tree]);
|
|
220
|
+
const waiting = dependencies.filter((dep) => awaitsPick(dep, value.find((pin) => pin.key === dep.key)));
|
|
221
|
+
const refused = dependencies.filter((dep) => errors?.[dep.key]?.message);
|
|
222
|
+
const troubled = unmet.length > 0 || refused.length > 0;
|
|
223
|
+
const needsLook = troubled || waiting.length > 0 || namesAgents(value);
|
|
224
|
+
const [open, setOpen] = useState(needsLook);
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
if (needsLook)
|
|
227
|
+
setOpen(true);
|
|
228
|
+
}, [needsLook]);
|
|
229
|
+
if (dependencies.length === 0)
|
|
230
|
+
return null;
|
|
231
|
+
const reached = agentsOf(tree);
|
|
232
|
+
return (_jsxs("div", { className: "flex flex-col gap-3", children: [_jsxs("button", { type: "button", "aria-expanded": open, onClick: () => setOpen((was) => !was), className: "flex min-w-0 items-center gap-1.5 text-left text-sm", children: [_jsx(ChevronRight, { className: cn("size-3.5 shrink-0 text-muted-foreground transition-transform", open && "rotate-90") }), _jsx("span", { className: "shrink-0 font-medium", children: "Runs with" }), !open &&
|
|
233
|
+
(troubled ? (_jsxs("span", { className: "flex items-center gap-1 text-xs text-destructive", children: [_jsx(AlertCircle, { className: "size-3.5" }), Math.max(unmet.length, refused.length), " not met"] })) : reached.length > 0 ? (_jsx(AgentNames, { agents: reached, className: "text-xs text-muted-foreground" })) : (_jsxs("span", { className: "truncate text-xs text-muted-foreground", children: [dependencies.length, " ", dependencies.length === 1 ? "other agent" : "other agents", ", chosen automatically"] })))] }), open && (_jsx(DependencyLevel, { dependencies: dependencies, nodes: tree, value: value, onChange: (next) => form.setValue("dependencies", next, { shouldValidate: true }), owner: owner, errors: errors }))] }));
|
|
222
234
|
};
|
|
223
235
|
//# sourceMappingURL=DependenciesContainer.js.map
|