Skip to content

Commit 276607b

Browse files
authored
Add a notion of leaf block and pdl__is_leaf field (#707)
1 parent 636d6a7 commit 276607b

File tree

4 files changed

+190
-19
lines changed

4 files changed

+190
-19
lines changed

pdl-live-react/src/pdl_ast.d.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ export type StartNanos = number | null
249249
export type EndNanos = number | null
250250
export type FirstUseNanos = number | null
251251
export type Timezone = string | null
252+
export type PdlIsLeaf = true
252253
export type Kind = "empty"
253254
/**
254255
* Name of the variable used to store the result of the execution of the block.
@@ -322,6 +323,7 @@ export type Context1 =
322323
*
323324
*/
324325
export type PdlId1 = string | null
326+
export type PdlIsLeaf1 = true
325327
export type Kind1 = "error"
326328
/**
327329
* Error message.
@@ -429,6 +431,7 @@ export type Context2 =
429431
*
430432
*/
431433
export type PdlId2 = string | null
434+
export type PdlIsLeaf2 = true
432435
export type Kind2 = "import"
433436
/**
434437
* Name of the file to import.
@@ -532,6 +535,7 @@ export type Context3 =
532535
*
533536
*/
534537
export type PdlId3 = string | null
538+
export type PdlIsLeaf3 = false
535539
export type Kind3 = "include"
536540
/**
537541
* Name of the file to include.
@@ -635,6 +639,7 @@ export type Context4 =
635639
*
636640
*/
637641
export type PdlId4 = string | null
642+
export type PdlIsLeaf4 = true
638643
export type Kind4 = "read"
639644
/**
640645
* Name of the file to read. If `None`, read the standard input.
@@ -723,6 +728,7 @@ export type Context5 =
723728
*
724729
*/
725730
export type PdlId5 = string | null
731+
export type PdlIsLeaf5 = false
726732
export type Kind5 = "message"
727733
/**
728734
* Content of the message.
@@ -824,6 +830,7 @@ export type Context6 =
824830
*
825831
*/
826832
export type PdlId6 = string | null
833+
export type PdlIsLeaf6 = false
827834
export type Kind6 = "object"
828835
export type Object =
829836
| {
@@ -951,6 +958,7 @@ export type Context7 =
951958
*
952959
*/
953960
export type PdlId7 = string | null
961+
export type PdlIsLeaf7 = false
954962
export type Kind7 = "array"
955963
/**
956964
* Elements of the array.
@@ -1053,6 +1061,7 @@ export type Context8 =
10531061
*
10541062
*/
10551063
export type PdlId8 = string | null
1064+
export type PdlIsLeaf8 = false
10561065
export type Kind8 = "lastOf"
10571066
/**
10581067
* Sequence of blocks to execute.
@@ -1155,6 +1164,7 @@ export type Context9 =
11551164
*
11561165
*/
11571166
export type PdlId9 = string | null
1167+
export type PdlIsLeaf9 = false
11581168
export type Kind9 = "text"
11591169
/**
11601170
* Body of the text.
@@ -1283,6 +1293,7 @@ export type Context10 =
12831293
*
12841294
*/
12851295
export type PdlId10 = string | null
1296+
export type PdlIsLeaf10 = false
12861297
export type Kind10 = "repeat"
12871298
/**
12881299
* Arrays to iterate over.
@@ -1465,6 +1476,7 @@ export type Context11 =
14651476
*
14661477
*/
14671478
export type PdlId11 = string | null
1479+
export type PdlIsLeaf11 = false
14681480
export type Kind11 = "match"
14691481
export type Case =
14701482
| boolean
@@ -1606,6 +1618,7 @@ export type Context12 =
16061618
*
16071619
*/
16081620
export type PdlId12 = string | null
1621+
export type PdlIsLeaf12 = false
16091622
export type Kind12 = "if"
16101623
/**
16111624
* Condition.
@@ -1743,6 +1756,7 @@ export type Context13 =
17431756
*
17441757
*/
17451758
export type PdlId13 = string | null
1759+
export type PdlIsLeaf13 = true
17461760
export type Kind13 = "data"
17471761
/**
17481762
* Do not evaluate expressions inside strings.
@@ -1820,6 +1834,7 @@ export type Context14 =
18201834
*
18211835
*/
18221836
export type PdlId14 = string | null
1837+
export type PdlIsLeaf14 = true
18231838
export type Kind14 = "get"
18241839
/**
18251840
* Name of the variable to access.
@@ -1897,6 +1912,7 @@ export type Context15 =
18971912
*
18981913
*/
18991914
export type PdlId15 = string | null
1915+
export type PdlIsLeaf15 = true
19001916
export type Kind15 = "code"
19011917
/**
19021918
* Programming language of the code.
@@ -2004,6 +2020,7 @@ export type Context16 =
20042020
*
20052021
*/
20062022
export type PdlId16 = string | null
2023+
export type PdlIsLeaf16 = true
20072024
export type Kind16 = "model"
20082025
/**
20092026
* Messages to send to the model.
@@ -2167,6 +2184,7 @@ export type Context17 =
21672184
*
21682185
*/
21692186
export type PdlId17 = string | null
2187+
export type PdlIsLeaf17 = true
21702188
export type Kind17 = "model"
21712189
/**
21722190
* Name of the model following the LiteLLM convention.
@@ -2368,6 +2386,7 @@ export type Context18 =
23682386
*
23692387
*/
23702388
export type PdlId18 = string | null
2389+
export type PdlIsLeaf18 = true
23712390
export type Kind18 = "call"
23722391
export type PdlTrace5 =
23732392
| boolean
@@ -2466,6 +2485,7 @@ export type Context19 =
24662485
*
24672486
*/
24682487
export type PdlId19 = string | null
2488+
export type PdlIsLeaf19 = true
24692489
export type Kind19 = "function"
24702490
/**
24712491
* Functions parameters with their types.
@@ -2546,6 +2566,7 @@ export interface FunctionBlock {
25462566
pdl__result?: unknown
25472567
pdl__location?: PdlLocationType | null
25482568
pdl__timing?: PdlTiming | null
2569+
pdl__is_leaf?: PdlIsLeaf19
25492570
kind?: Kind19
25502571
function: Function
25512572
return: Return
@@ -2605,6 +2626,7 @@ export interface CallBlock {
26052626
pdl__result?: unknown
26062627
pdl__location?: PdlLocationType | null
26072628
pdl__timing?: PdlTiming | null
2629+
pdl__is_leaf?: PdlIsLeaf18
26082630
kind?: Kind18
26092631
call: unknown
26102632
args?: unknown
@@ -2672,6 +2694,7 @@ export interface LitellmModelBlock {
26722694
pdl__result?: unknown
26732695
pdl__location?: PdlLocationType | null
26742696
pdl__timing?: PdlTiming | null
2697+
pdl__is_leaf?: PdlIsLeaf17
26752698
kind?: Kind17
26762699
model: Model1
26772700
input?: Input1
@@ -2735,6 +2758,7 @@ export interface GraniteioModelBlock {
27352758
pdl__result?: unknown
27362759
pdl__location?: PdlLocationType | null
27372760
pdl__timing?: PdlTiming | null
2761+
pdl__is_leaf?: PdlIsLeaf16
27382762
kind?: Kind16
27392763
model: unknown
27402764
input?: Input
@@ -2810,6 +2834,7 @@ export interface CodeBlock {
28102834
pdl__result?: unknown
28112835
pdl__location?: PdlLocationType | null
28122836
pdl__timing?: PdlTiming | null
2837+
pdl__is_leaf?: PdlIsLeaf15
28132838
kind?: Kind15
28142839
lang: Lang
28152840
code: Code
@@ -2871,6 +2896,7 @@ export interface GetBlock {
28712896
pdl__result?: unknown
28722897
pdl__location?: PdlLocationType | null
28732898
pdl__timing?: PdlTiming | null
2899+
pdl__is_leaf?: PdlIsLeaf14
28742900
kind?: Kind14
28752901
get: Get
28762902
}
@@ -2950,6 +2976,7 @@ export interface DataBlock {
29502976
pdl__result?: unknown
29512977
pdl__location?: PdlLocationType | null
29522978
pdl__timing?: PdlTiming | null
2979+
pdl__is_leaf?: PdlIsLeaf13
29532980
kind?: Kind13
29542981
data: unknown
29552982
raw?: Raw
@@ -3018,6 +3045,7 @@ export interface IfBlock {
30183045
pdl__result?: unknown
30193046
pdl__location?: PdlLocationType | null
30203047
pdl__timing?: PdlTiming | null
3048+
pdl__is_leaf?: PdlIsLeaf12
30213049
kind?: Kind12
30223050
if: If1
30233051
then: Then1
@@ -3079,6 +3107,7 @@ export interface MatchBlock {
30793107
pdl__result?: unknown
30803108
pdl__location?: PdlLocationType | null
30813109
pdl__timing?: PdlTiming | null
3110+
pdl__is_leaf?: PdlIsLeaf11
30823111
kind?: Kind11
30833112
match: unknown
30843113
with: With1
@@ -3147,6 +3176,7 @@ export interface RepeatBlock {
31473176
pdl__result?: unknown
31483177
pdl__location?: PdlLocationType | null
31493178
pdl__timing?: PdlTiming | null
3179+
pdl__is_leaf?: PdlIsLeaf10
31503180
kind?: Kind10
31513181
for?: For
31523182
while?: While
@@ -3211,6 +3241,7 @@ export interface TextBlock {
32113241
pdl__result?: unknown
32123242
pdl__location?: PdlLocationType | null
32133243
pdl__timing?: PdlTiming | null
3244+
pdl__is_leaf?: PdlIsLeaf9
32143245
kind?: Kind9
32153246
text: Text
32163247
}
@@ -3269,6 +3300,7 @@ export interface LastOfBlock {
32693300
pdl__result?: unknown
32703301
pdl__location?: PdlLocationType | null
32713302
pdl__timing?: PdlTiming | null
3303+
pdl__is_leaf?: PdlIsLeaf8
32723304
kind?: Kind8
32733305
lastOf: Lastof
32743306
}
@@ -3327,6 +3359,7 @@ export interface ArrayBlock {
33273359
pdl__result?: unknown
33283360
pdl__location?: PdlLocationType | null
33293361
pdl__timing?: PdlTiming | null
3362+
pdl__is_leaf?: PdlIsLeaf7
33303363
kind?: Kind7
33313364
array: Array
33323365
}
@@ -3385,6 +3418,7 @@ export interface ObjectBlock {
33853418
pdl__result?: unknown
33863419
pdl__location?: PdlLocationType | null
33873420
pdl__timing?: PdlTiming | null
3421+
pdl__is_leaf?: PdlIsLeaf6
33883422
kind?: Kind6
33893423
object: Object
33903424
}
@@ -3443,6 +3477,7 @@ export interface MessageBlock {
34433477
pdl__result?: unknown
34443478
pdl__location?: PdlLocationType | null
34453479
pdl__timing?: PdlTiming | null
3480+
pdl__is_leaf?: PdlIsLeaf5
34463481
kind?: Kind5
34473482
content: Content
34483483
}
@@ -3501,6 +3536,7 @@ export interface ReadBlock {
35013536
pdl__result?: unknown
35023537
pdl__location?: PdlLocationType | null
35033538
pdl__timing?: PdlTiming | null
3539+
pdl__is_leaf?: PdlIsLeaf4
35043540
kind?: Kind4
35053541
read: Read
35063542
message?: Message
@@ -3561,6 +3597,7 @@ export interface IncludeBlock {
35613597
pdl__result?: unknown
35623598
pdl__location?: PdlLocationType | null
35633599
pdl__timing?: PdlTiming | null
3600+
pdl__is_leaf?: PdlIsLeaf3
35643601
kind?: Kind3
35653602
include: Include
35663603
pdl__trace?: PdlTrace1
@@ -3620,6 +3657,7 @@ export interface ImportBlock {
36203657
pdl__result?: unknown
36213658
pdl__location?: PdlLocationType | null
36223659
pdl__timing?: PdlTiming | null
3660+
pdl__is_leaf?: PdlIsLeaf2
36233661
kind?: Kind2
36243662
import: Import
36253663
pdl__trace?: PdlTrace
@@ -3679,6 +3717,7 @@ export interface ErrorBlock {
36793717
pdl__result?: unknown
36803718
pdl__location?: PdlLocationType | null
36813719
pdl__timing?: PdlTiming | null
3720+
pdl__is_leaf?: PdlIsLeaf1
36823721
kind?: Kind1
36833722
msg: Msg
36843723
program: Program1
@@ -3738,6 +3777,7 @@ export interface EmptyBlock {
37383777
pdl__result?: unknown
37393778
pdl__location?: PdlLocationType | null
37403779
pdl__timing?: PdlTiming | null
3780+
pdl__is_leaf?: PdlIsLeaf
37413781
kind?: Kind
37423782
}
37433783
/**

0 commit comments

Comments
 (0)