@sixb/server 0.1.16 → 0.1.17
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/README.md +6 -0
- package/dist/auth/public-routes.d.ts.map +1 -1
- package/dist/auth/shared-access.d.ts.map +1 -1
- package/dist/index.js +406 -327
- package/dist/index.js.map +17 -16
- package/dist/registerRoutes.d.ts.map +1 -1
- package/dist/routes/agents.d.ts +8 -0
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/ai-accounting.d.ts.map +1 -1
- package/dist/routes/auth.d.ts +1 -1
- package/dist/routes/file-downloads.d.ts +98 -0
- package/dist/routes/file-downloads.d.ts.map +1 -0
- package/dist/routes/objects.d.ts +3 -0
- package/dist/routes/objects.d.ts.map +1 -1
- package/dist/routes/ontology.d.ts +4 -4
- package/dist/routes/status.d.ts +0 -4
- package/dist/routes/status.d.ts.map +1 -1
- package/dist/routes/workflows.d.ts +3 -0
- package/dist/routes/workflows.d.ts.map +1 -1
- package/dist/routes/ws/events.d.ts.map +1 -1
- package/dist/routes/ws/logs.d.ts +11 -0
- package/dist/routes/ws/logs.d.ts.map +1 -1
- package/dist/routes/ws/subscription-hub.d.ts +66 -0
- package/dist/routes/ws/subscription-hub.d.ts.map +1 -0
- package/dist/schemas/agents.d.ts +33 -0
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/ai-accounting.d.ts +224 -100
- package/dist/schemas/ai-accounting.d.ts.map +1 -1
- package/dist/schemas/ai-usage.d.ts +3 -0
- package/dist/schemas/ai-usage.d.ts.map +1 -1
- package/dist/schemas/auth.d.ts +2 -2
- package/dist/schemas/objects.d.ts.map +1 -1
- package/dist/schemas/ontology.d.ts +18 -18
- package/dist/schemas/status.d.ts +0 -26
- package/dist/schemas/status.d.ts.map +1 -1
- package/dist/schemas/workflows.d.ts +35 -0
- package/dist/schemas/workflows.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/auth/public-routes.ts +10 -0
- package/src/auth/shared-access.ts +48 -6
- package/src/registerRoutes.ts +2 -0
- package/src/routes/ai-accounting.ts +1 -0
- package/src/routes/file-downloads.ts +48 -0
- package/src/routes/objects.ts +13 -3
- package/src/routes/ws/events.ts +96 -133
- package/src/routes/ws/logs.ts +67 -5
- package/src/routes/ws/{log-subscription-hub.ts → subscription-hub.ts} +137 -127
- package/src/schemas/ai-accounting.ts +5 -0
- package/src/schemas/ai-usage.ts +3 -0
- package/src/schemas/objects.ts +28 -2
- package/src/schemas/status.ts +0 -6
- package/src/server.ts +5 -0
- package/dist/routes/ws/log-subscription-hub.d.ts +0 -50
- package/dist/routes/ws/log-subscription-hub.d.ts.map +0 -1
|
@@ -218,6 +218,7 @@ export declare const WorkflowAgentNodeExecutionSummarySchema: z.ZodObject<{
|
|
|
218
218
|
cacheWriteInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
219
219
|
textOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
220
220
|
reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
audioDurationMs: z.ZodOptional<z.ZodNumber>;
|
|
221
222
|
reportingStatus: z.ZodEnum<["complete", "partial", "unavailable"]>;
|
|
222
223
|
}, "strip", z.ZodTypeAny, {
|
|
223
224
|
reportingStatus: "partial" | "complete" | "unavailable";
|
|
@@ -229,6 +230,7 @@ export declare const WorkflowAgentNodeExecutionSummarySchema: z.ZodObject<{
|
|
|
229
230
|
cacheWriteInputTokens?: number | undefined;
|
|
230
231
|
textOutputTokens?: number | undefined;
|
|
231
232
|
reasoningOutputTokens?: number | undefined;
|
|
233
|
+
audioDurationMs?: number | undefined;
|
|
232
234
|
}, {
|
|
233
235
|
reportingStatus: "partial" | "complete" | "unavailable";
|
|
234
236
|
inputTokens?: number | undefined;
|
|
@@ -239,6 +241,7 @@ export declare const WorkflowAgentNodeExecutionSummarySchema: z.ZodObject<{
|
|
|
239
241
|
cacheWriteInputTokens?: number | undefined;
|
|
240
242
|
textOutputTokens?: number | undefined;
|
|
241
243
|
reasoningOutputTokens?: number | undefined;
|
|
244
|
+
audioDurationMs?: number | undefined;
|
|
242
245
|
}>>;
|
|
243
246
|
cost: z.ZodOptional<z.ZodObject<{
|
|
244
247
|
amounts: z.ZodArray<z.ZodObject<{
|
|
@@ -289,6 +292,7 @@ export declare const WorkflowAgentNodeExecutionSummarySchema: z.ZodObject<{
|
|
|
289
292
|
cacheWriteInputTokens?: number | undefined;
|
|
290
293
|
textOutputTokens?: number | undefined;
|
|
291
294
|
reasoningOutputTokens?: number | undefined;
|
|
295
|
+
audioDurationMs?: number | undefined;
|
|
292
296
|
} | undefined;
|
|
293
297
|
cost?: {
|
|
294
298
|
amounts: {
|
|
@@ -316,6 +320,7 @@ export declare const WorkflowAgentNodeExecutionSummarySchema: z.ZodObject<{
|
|
|
316
320
|
cacheWriteInputTokens?: number | undefined;
|
|
317
321
|
textOutputTokens?: number | undefined;
|
|
318
322
|
reasoningOutputTokens?: number | undefined;
|
|
323
|
+
audioDurationMs?: number | undefined;
|
|
319
324
|
} | undefined;
|
|
320
325
|
cost?: {
|
|
321
326
|
amounts: {
|
|
@@ -343,6 +348,7 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
|
|
|
343
348
|
cacheWriteInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
344
349
|
textOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
345
350
|
reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
351
|
+
audioDurationMs: z.ZodOptional<z.ZodNumber>;
|
|
346
352
|
reportingStatus: z.ZodEnum<["complete", "partial", "unavailable"]>;
|
|
347
353
|
}, "strip", z.ZodTypeAny, {
|
|
348
354
|
reportingStatus: "partial" | "complete" | "unavailable";
|
|
@@ -354,6 +360,7 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
|
|
|
354
360
|
cacheWriteInputTokens?: number | undefined;
|
|
355
361
|
textOutputTokens?: number | undefined;
|
|
356
362
|
reasoningOutputTokens?: number | undefined;
|
|
363
|
+
audioDurationMs?: number | undefined;
|
|
357
364
|
}, {
|
|
358
365
|
reportingStatus: "partial" | "complete" | "unavailable";
|
|
359
366
|
inputTokens?: number | undefined;
|
|
@@ -364,6 +371,7 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
|
|
|
364
371
|
cacheWriteInputTokens?: number | undefined;
|
|
365
372
|
textOutputTokens?: number | undefined;
|
|
366
373
|
reasoningOutputTokens?: number | undefined;
|
|
374
|
+
audioDurationMs?: number | undefined;
|
|
367
375
|
}>>;
|
|
368
376
|
cost: z.ZodOptional<z.ZodObject<{
|
|
369
377
|
amounts: z.ZodArray<z.ZodObject<{
|
|
@@ -656,6 +664,7 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
|
|
|
656
664
|
cacheWriteInputTokens?: number | undefined;
|
|
657
665
|
textOutputTokens?: number | undefined;
|
|
658
666
|
reasoningOutputTokens?: number | undefined;
|
|
667
|
+
audioDurationMs?: number | undefined;
|
|
659
668
|
} | undefined;
|
|
660
669
|
cost?: {
|
|
661
670
|
amounts: {
|
|
@@ -751,6 +760,7 @@ export declare const WorkflowAgentNodeExecutionSchema: z.ZodObject<{
|
|
|
751
760
|
cacheWriteInputTokens?: number | undefined;
|
|
752
761
|
textOutputTokens?: number | undefined;
|
|
753
762
|
reasoningOutputTokens?: number | undefined;
|
|
763
|
+
audioDurationMs?: number | undefined;
|
|
754
764
|
} | undefined;
|
|
755
765
|
cost?: {
|
|
756
766
|
amounts: {
|
|
@@ -856,6 +866,7 @@ export declare const WorkflowNodeRunSchema: z.ZodObject<{
|
|
|
856
866
|
cacheWriteInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
857
867
|
textOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
858
868
|
reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
869
|
+
audioDurationMs: z.ZodOptional<z.ZodNumber>;
|
|
859
870
|
reportingStatus: z.ZodEnum<["complete", "partial", "unavailable"]>;
|
|
860
871
|
}, "strip", z.ZodTypeAny, {
|
|
861
872
|
reportingStatus: "partial" | "complete" | "unavailable";
|
|
@@ -867,6 +878,7 @@ export declare const WorkflowNodeRunSchema: z.ZodObject<{
|
|
|
867
878
|
cacheWriteInputTokens?: number | undefined;
|
|
868
879
|
textOutputTokens?: number | undefined;
|
|
869
880
|
reasoningOutputTokens?: number | undefined;
|
|
881
|
+
audioDurationMs?: number | undefined;
|
|
870
882
|
}, {
|
|
871
883
|
reportingStatus: "partial" | "complete" | "unavailable";
|
|
872
884
|
inputTokens?: number | undefined;
|
|
@@ -877,6 +889,7 @@ export declare const WorkflowNodeRunSchema: z.ZodObject<{
|
|
|
877
889
|
cacheWriteInputTokens?: number | undefined;
|
|
878
890
|
textOutputTokens?: number | undefined;
|
|
879
891
|
reasoningOutputTokens?: number | undefined;
|
|
892
|
+
audioDurationMs?: number | undefined;
|
|
880
893
|
}>>;
|
|
881
894
|
cost: z.ZodOptional<z.ZodObject<{
|
|
882
895
|
amounts: z.ZodArray<z.ZodObject<{
|
|
@@ -927,6 +940,7 @@ export declare const WorkflowNodeRunSchema: z.ZodObject<{
|
|
|
927
940
|
cacheWriteInputTokens?: number | undefined;
|
|
928
941
|
textOutputTokens?: number | undefined;
|
|
929
942
|
reasoningOutputTokens?: number | undefined;
|
|
943
|
+
audioDurationMs?: number | undefined;
|
|
930
944
|
} | undefined;
|
|
931
945
|
cost?: {
|
|
932
946
|
amounts: {
|
|
@@ -954,6 +968,7 @@ export declare const WorkflowNodeRunSchema: z.ZodObject<{
|
|
|
954
968
|
cacheWriteInputTokens?: number | undefined;
|
|
955
969
|
textOutputTokens?: number | undefined;
|
|
956
970
|
reasoningOutputTokens?: number | undefined;
|
|
971
|
+
audioDurationMs?: number | undefined;
|
|
957
972
|
} | undefined;
|
|
958
973
|
cost?: {
|
|
959
974
|
amounts: {
|
|
@@ -995,6 +1010,7 @@ export declare const WorkflowNodeRunSchema: z.ZodObject<{
|
|
|
995
1010
|
cacheWriteInputTokens?: number | undefined;
|
|
996
1011
|
textOutputTokens?: number | undefined;
|
|
997
1012
|
reasoningOutputTokens?: number | undefined;
|
|
1013
|
+
audioDurationMs?: number | undefined;
|
|
998
1014
|
} | undefined;
|
|
999
1015
|
cost?: {
|
|
1000
1016
|
amounts: {
|
|
@@ -1038,6 +1054,7 @@ export declare const WorkflowNodeRunSchema: z.ZodObject<{
|
|
|
1038
1054
|
cacheWriteInputTokens?: number | undefined;
|
|
1039
1055
|
textOutputTokens?: number | undefined;
|
|
1040
1056
|
reasoningOutputTokens?: number | undefined;
|
|
1057
|
+
audioDurationMs?: number | undefined;
|
|
1041
1058
|
} | undefined;
|
|
1042
1059
|
cost?: {
|
|
1043
1060
|
amounts: {
|
|
@@ -1544,6 +1561,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
1544
1561
|
cacheWriteInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
1545
1562
|
textOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
1546
1563
|
reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
1564
|
+
audioDurationMs: z.ZodOptional<z.ZodNumber>;
|
|
1547
1565
|
reportingStatus: z.ZodEnum<["complete", "partial", "unavailable"]>;
|
|
1548
1566
|
}, "strip", z.ZodTypeAny, {
|
|
1549
1567
|
reportingStatus: "partial" | "complete" | "unavailable";
|
|
@@ -1555,6 +1573,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
1555
1573
|
cacheWriteInputTokens?: number | undefined;
|
|
1556
1574
|
textOutputTokens?: number | undefined;
|
|
1557
1575
|
reasoningOutputTokens?: number | undefined;
|
|
1576
|
+
audioDurationMs?: number | undefined;
|
|
1558
1577
|
}, {
|
|
1559
1578
|
reportingStatus: "partial" | "complete" | "unavailable";
|
|
1560
1579
|
inputTokens?: number | undefined;
|
|
@@ -1565,6 +1584,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
1565
1584
|
cacheWriteInputTokens?: number | undefined;
|
|
1566
1585
|
textOutputTokens?: number | undefined;
|
|
1567
1586
|
reasoningOutputTokens?: number | undefined;
|
|
1587
|
+
audioDurationMs?: number | undefined;
|
|
1568
1588
|
}>>;
|
|
1569
1589
|
cost: z.ZodOptional<z.ZodObject<{
|
|
1570
1590
|
amounts: z.ZodArray<z.ZodObject<{
|
|
@@ -1615,6 +1635,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
1615
1635
|
cacheWriteInputTokens?: number | undefined;
|
|
1616
1636
|
textOutputTokens?: number | undefined;
|
|
1617
1637
|
reasoningOutputTokens?: number | undefined;
|
|
1638
|
+
audioDurationMs?: number | undefined;
|
|
1618
1639
|
} | undefined;
|
|
1619
1640
|
cost?: {
|
|
1620
1641
|
amounts: {
|
|
@@ -1642,6 +1663,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
1642
1663
|
cacheWriteInputTokens?: number | undefined;
|
|
1643
1664
|
textOutputTokens?: number | undefined;
|
|
1644
1665
|
reasoningOutputTokens?: number | undefined;
|
|
1666
|
+
audioDurationMs?: number | undefined;
|
|
1645
1667
|
} | undefined;
|
|
1646
1668
|
cost?: {
|
|
1647
1669
|
amounts: {
|
|
@@ -1683,6 +1705,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
1683
1705
|
cacheWriteInputTokens?: number | undefined;
|
|
1684
1706
|
textOutputTokens?: number | undefined;
|
|
1685
1707
|
reasoningOutputTokens?: number | undefined;
|
|
1708
|
+
audioDurationMs?: number | undefined;
|
|
1686
1709
|
} | undefined;
|
|
1687
1710
|
cost?: {
|
|
1688
1711
|
amounts: {
|
|
@@ -1726,6 +1749,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
1726
1749
|
cacheWriteInputTokens?: number | undefined;
|
|
1727
1750
|
textOutputTokens?: number | undefined;
|
|
1728
1751
|
reasoningOutputTokens?: number | undefined;
|
|
1752
|
+
audioDurationMs?: number | undefined;
|
|
1729
1753
|
} | undefined;
|
|
1730
1754
|
cost?: {
|
|
1731
1755
|
amounts: {
|
|
@@ -1787,6 +1811,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
1787
1811
|
cacheWriteInputTokens?: number | undefined;
|
|
1788
1812
|
textOutputTokens?: number | undefined;
|
|
1789
1813
|
reasoningOutputTokens?: number | undefined;
|
|
1814
|
+
audioDurationMs?: number | undefined;
|
|
1790
1815
|
} | undefined;
|
|
1791
1816
|
cost?: {
|
|
1792
1817
|
amounts: {
|
|
@@ -1848,6 +1873,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
1848
1873
|
cacheWriteInputTokens?: number | undefined;
|
|
1849
1874
|
textOutputTokens?: number | undefined;
|
|
1850
1875
|
reasoningOutputTokens?: number | undefined;
|
|
1876
|
+
audioDurationMs?: number | undefined;
|
|
1851
1877
|
} | undefined;
|
|
1852
1878
|
cost?: {
|
|
1853
1879
|
amounts: {
|
|
@@ -1947,6 +1973,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
1947
1973
|
cacheWriteInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
1948
1974
|
textOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
1949
1975
|
reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
1976
|
+
audioDurationMs: z.ZodOptional<z.ZodNumber>;
|
|
1950
1977
|
reportingStatus: z.ZodEnum<["complete", "partial", "unavailable"]>;
|
|
1951
1978
|
}, "strip", z.ZodTypeAny, {
|
|
1952
1979
|
reportingStatus: "partial" | "complete" | "unavailable";
|
|
@@ -1958,6 +1985,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
1958
1985
|
cacheWriteInputTokens?: number | undefined;
|
|
1959
1986
|
textOutputTokens?: number | undefined;
|
|
1960
1987
|
reasoningOutputTokens?: number | undefined;
|
|
1988
|
+
audioDurationMs?: number | undefined;
|
|
1961
1989
|
}, {
|
|
1962
1990
|
reportingStatus: "partial" | "complete" | "unavailable";
|
|
1963
1991
|
inputTokens?: number | undefined;
|
|
@@ -1968,6 +1996,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
1968
1996
|
cacheWriteInputTokens?: number | undefined;
|
|
1969
1997
|
textOutputTokens?: number | undefined;
|
|
1970
1998
|
reasoningOutputTokens?: number | undefined;
|
|
1999
|
+
audioDurationMs?: number | undefined;
|
|
1971
2000
|
}>>;
|
|
1972
2001
|
cost: z.ZodOptional<z.ZodObject<{
|
|
1973
2002
|
amounts: z.ZodArray<z.ZodObject<{
|
|
@@ -2018,6 +2047,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
2018
2047
|
cacheWriteInputTokens?: number | undefined;
|
|
2019
2048
|
textOutputTokens?: number | undefined;
|
|
2020
2049
|
reasoningOutputTokens?: number | undefined;
|
|
2050
|
+
audioDurationMs?: number | undefined;
|
|
2021
2051
|
} | undefined;
|
|
2022
2052
|
cost?: {
|
|
2023
2053
|
amounts: {
|
|
@@ -2045,6 +2075,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
2045
2075
|
cacheWriteInputTokens?: number | undefined;
|
|
2046
2076
|
textOutputTokens?: number | undefined;
|
|
2047
2077
|
reasoningOutputTokens?: number | undefined;
|
|
2078
|
+
audioDurationMs?: number | undefined;
|
|
2048
2079
|
} | undefined;
|
|
2049
2080
|
cost?: {
|
|
2050
2081
|
amounts: {
|
|
@@ -2086,6 +2117,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
2086
2117
|
cacheWriteInputTokens?: number | undefined;
|
|
2087
2118
|
textOutputTokens?: number | undefined;
|
|
2088
2119
|
reasoningOutputTokens?: number | undefined;
|
|
2120
|
+
audioDurationMs?: number | undefined;
|
|
2089
2121
|
} | undefined;
|
|
2090
2122
|
cost?: {
|
|
2091
2123
|
amounts: {
|
|
@@ -2129,6 +2161,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
2129
2161
|
cacheWriteInputTokens?: number | undefined;
|
|
2130
2162
|
textOutputTokens?: number | undefined;
|
|
2131
2163
|
reasoningOutputTokens?: number | undefined;
|
|
2164
|
+
audioDurationMs?: number | undefined;
|
|
2132
2165
|
} | undefined;
|
|
2133
2166
|
cost?: {
|
|
2134
2167
|
amounts: {
|
|
@@ -2190,6 +2223,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
2190
2223
|
cacheWriteInputTokens?: number | undefined;
|
|
2191
2224
|
textOutputTokens?: number | undefined;
|
|
2192
2225
|
reasoningOutputTokens?: number | undefined;
|
|
2226
|
+
audioDurationMs?: number | undefined;
|
|
2193
2227
|
} | undefined;
|
|
2194
2228
|
cost?: {
|
|
2195
2229
|
amounts: {
|
|
@@ -2251,6 +2285,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
2251
2285
|
cacheWriteInputTokens?: number | undefined;
|
|
2252
2286
|
textOutputTokens?: number | undefined;
|
|
2253
2287
|
reasoningOutputTokens?: number | undefined;
|
|
2288
|
+
audioDurationMs?: number | undefined;
|
|
2254
2289
|
} | undefined;
|
|
2255
2290
|
cost?: {
|
|
2256
2291
|
amounts: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/schemas/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,wBAAwB,+GAA4B,CAAA;AAMjE,eAAO,MAAM,oBAAoB;;;;;;EAE/B,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAA;AAEF,eAA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;;;;;;;;;;;;;;;;;EAGnD,CAAA;AAEF,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEnD,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;EAK3C,CAAA"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA6B,YAAY,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA6B,YAAY,EAAE,MAAM,YAAY,CAAA;AAKzE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAG/B,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EAMhC,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EAKjC,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAA;AAO9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAKlE,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,sBAAsB,CAAA;AAoB7B,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,YAAY,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,oBAAoB,CAAA;IAC7B,8EAA8E;IAC9E,cAAc,CAAC,EAAE,yBAAyB,CAAA;IA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B,KAAK,EAAE,2BAA2B,GACjC,6BAA6B;IAIhC,mBAAmB,IAAI,4BAA4B;IAInD,iBAAiB,IAAI,yBAAyB,GAAG,SAAS;IAI1D,sBAAsB,IAAI,uBAAuB;IAI3C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA+BtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAe5B;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiP/C;AAiED,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixb/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "HTTP and WebSocket API server for Sixb",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sixb",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"zod-to-json-schema": "^3.24.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@sixb/core": "0.1.
|
|
41
|
+
"@sixb/core": "0.1.17"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@sixb/auth-magic-link": "0.1.5",
|
|
45
45
|
"@sixb/auth-oidc": "0.1.4",
|
|
46
|
-
"@sixb/core": "0.1.
|
|
47
|
-
"@sixb/sqlite": "0.1.
|
|
46
|
+
"@sixb/core": "0.1.17",
|
|
47
|
+
"@sixb/sqlite": "0.1.17",
|
|
48
48
|
"@types/bun": "latest",
|
|
49
49
|
"typescript": "^5.7.0"
|
|
50
50
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AGENT_API_GATEWAY_PREFIX } from "@sixb/core/internal/agents"
|
|
2
2
|
import { isCsrfExemptMethod } from "@sixb/core/internal/auth"
|
|
3
|
+
import { FILE_DOWNLOAD_ROUTE_PREFIX } from "@sixb/core/internal/blob-storage"
|
|
3
4
|
import { isSharedAccessPublicPath } from "./shared-access"
|
|
4
5
|
|
|
5
6
|
const CONNECTOR_OAUTH_CALLBACK_PATH = "/auth/connectors/callback"
|
|
@@ -70,6 +71,15 @@ export function isPublicRoute(pathname: string, method: string): boolean {
|
|
|
70
71
|
return true
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
// A signed download URL is read by services that cannot hold a session, such as a social network
|
|
75
|
+
// fetching media to publish. The signed token in the path is the credential.
|
|
76
|
+
if (
|
|
77
|
+
pathname.startsWith(FILE_DOWNLOAD_ROUTE_PREFIX) &&
|
|
78
|
+
(normalizedMethod === "GET" || normalizedMethod === "HEAD")
|
|
79
|
+
) {
|
|
80
|
+
return true
|
|
81
|
+
}
|
|
82
|
+
|
|
73
83
|
// Public because a webhook cannot carry a session: the signature its connector
|
|
74
84
|
// verifies is the credential. POST only — `WebhookDefinition.method` is the literal
|
|
75
85
|
// `"POST"`, so nothing else is ever registered here, and the allow-list should not be
|
|
@@ -11,6 +11,7 @@ import { type SharedSessionContext, SharedSessionProtocol } from "@sixb/core/int
|
|
|
11
11
|
import { hasForegroundSessionActivity } from "./session-activity"
|
|
12
12
|
|
|
13
13
|
export const SHARED_ACCESS_GRANT_HEADER_NAME = "x-sixb-share-grant"
|
|
14
|
+
const SHARED_ACCESS_GRANT_QUERY_PARAM = "shareGrant"
|
|
14
15
|
|
|
15
16
|
const SHARED_SESSION_COOKIE_PREFIX = "sixb_share_session_"
|
|
16
17
|
const SHARED_CSRF_COOKIE_PREFIX = "sixb_share_csrf_"
|
|
@@ -18,6 +19,10 @@ const SHARED_COOKIE_PATH = "/api"
|
|
|
18
19
|
const STORED_IDENTIFIER_MAX_LENGTH = 128
|
|
19
20
|
|
|
20
21
|
const SHARED_SESSION_ROUTES = SIXB_API_ROUTES.filter((route) => route.sharedSession)
|
|
22
|
+
const SHARED_FILE_CONTENT_ROUTES = SHARED_SESSION_ROUTES.filter(
|
|
23
|
+
(route) =>
|
|
24
|
+
(route.method === "GET" || route.method === "HEAD") && route.path.endsWith("/files/content")
|
|
25
|
+
)
|
|
21
26
|
|
|
22
27
|
export interface SixbSharedAccessOptions {
|
|
23
28
|
/** Sliding inactivity window, always bounded by the grant's absolute expiration. */
|
|
@@ -34,6 +39,11 @@ export interface ResolvedSharedAccess {
|
|
|
34
39
|
readonly cookies: SharedAccessCookieHeaders
|
|
35
40
|
}
|
|
36
41
|
|
|
42
|
+
type SharedAccessGrantSelection =
|
|
43
|
+
| { readonly kind: "absent" }
|
|
44
|
+
| { readonly kind: "conflict" }
|
|
45
|
+
| { readonly kind: "selected"; readonly grantId: string }
|
|
46
|
+
|
|
37
47
|
export type SharedAccessRequestDecision =
|
|
38
48
|
| { readonly kind: "absent" }
|
|
39
49
|
| { readonly kind: "deny"; readonly response: Response }
|
|
@@ -63,22 +73,30 @@ export class SharedAccessBoundary {
|
|
|
63
73
|
/** Fail closed before route parsing can emit a route-specific validation response. */
|
|
64
74
|
preflightResponse(request: Request): Response | undefined {
|
|
65
75
|
if (isSharedAccessPublicRoute(request)) return
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
if (
|
|
76
|
+
const selection = selectSharedAccessGrant(request)
|
|
77
|
+
if (selection.kind === "absent") return
|
|
78
|
+
if (
|
|
79
|
+
selection.kind === "conflict" ||
|
|
80
|
+
request.headers.has("authorization") ||
|
|
81
|
+
!isSharedSessionRoute(request)
|
|
82
|
+
) {
|
|
69
83
|
return sharedAccessForbiddenResponse()
|
|
70
84
|
}
|
|
71
|
-
if (!isStoredIdentifier(
|
|
85
|
+
if (!isStoredIdentifier(selection.grantId)) return sharedAccessUnauthenticatedResponse()
|
|
72
86
|
}
|
|
73
87
|
|
|
74
88
|
async resolveRequest(request: Request): Promise<SharedAccessRequestDecision> {
|
|
75
89
|
if (isSharedAccessPublicRoute(request)) return { kind: "absent" }
|
|
76
90
|
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
91
|
+
const selection = selectSharedAccessGrant(request)
|
|
92
|
+
if (selection.kind === "absent") return { kind: "absent" }
|
|
93
|
+
if (selection.kind === "conflict") {
|
|
94
|
+
return { kind: "deny", response: sharedAccessForbiddenResponse() }
|
|
95
|
+
}
|
|
79
96
|
|
|
80
97
|
const preflight = this.preflightResponse(request)
|
|
81
98
|
if (preflight) return { kind: "deny", response: preflight }
|
|
99
|
+
const selectedGrantId = selection.grantId
|
|
82
100
|
|
|
83
101
|
let resolved: ResolvedSharedAccess | null
|
|
84
102
|
try {
|
|
@@ -278,6 +296,30 @@ export function isSharedAccessPublicPath(pathname: string, requestMethod: string
|
|
|
278
296
|
return matchesPathPattern(normalizedPathname, `/api/shared-access/:grantId/${suffix}`)
|
|
279
297
|
}
|
|
280
298
|
|
|
299
|
+
/**
|
|
300
|
+
* The header selects the grant. File GET/HEAD routes also accept the selector in the query, because
|
|
301
|
+
* `<img>`, `<video>`, and download links cannot send headers. Either way it only names which
|
|
302
|
+
* grant cookie to read; the HttpOnly cookie remains the credential, as with a file `audience`.
|
|
303
|
+
*/
|
|
304
|
+
function selectSharedAccessGrant(request: Request): SharedAccessGrantSelection {
|
|
305
|
+
const header = request.headers.get(SHARED_ACCESS_GRANT_HEADER_NAME)
|
|
306
|
+
const url = new URL(request.url)
|
|
307
|
+
const method = request.method.toUpperCase()
|
|
308
|
+
const pathname = normalizeRoutePath(url.pathname)
|
|
309
|
+
const queryValues = SHARED_FILE_CONTENT_ROUTES.some(
|
|
310
|
+
(route) => route.method === method && matchesPathPattern(pathname, route.path)
|
|
311
|
+
)
|
|
312
|
+
? url.searchParams.getAll(SHARED_ACCESS_GRANT_QUERY_PARAM)
|
|
313
|
+
: []
|
|
314
|
+
|
|
315
|
+
const [query, ...extra] = queryValues
|
|
316
|
+
if (query === undefined) {
|
|
317
|
+
return header === null ? { kind: "absent" } : { kind: "selected", grantId: header }
|
|
318
|
+
}
|
|
319
|
+
if (extra.length > 0 || (header !== null && header !== query)) return { kind: "conflict" }
|
|
320
|
+
return { kind: "selected", grantId: query }
|
|
321
|
+
}
|
|
322
|
+
|
|
281
323
|
export function isSharedSessionRoute(request: Request): boolean {
|
|
282
324
|
const method = request.method.toUpperCase()
|
|
283
325
|
const pathname = normalizeRoutePath(new URL(request.url).pathname)
|
package/src/registerRoutes.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { registerConnectorConnectionRoutes } from "./routes/connector-connection
|
|
|
14
14
|
import { registerConnectorRoutes } from "./routes/connectors"
|
|
15
15
|
import { registerDatasetRoutes } from "./routes/datasets"
|
|
16
16
|
import { registerEventRoutes } from "./routes/events"
|
|
17
|
+
import { registerFileDownloadRoutes } from "./routes/file-downloads"
|
|
17
18
|
import { registerFileRoutes } from "./routes/files"
|
|
18
19
|
import { registerLinkRoutes } from "./routes/links"
|
|
19
20
|
import { registerLogRoutes } from "./routes/logs"
|
|
@@ -56,6 +57,7 @@ export function registerHttpRoutes(app: Elysia, host: SixbHostView, options: Htt
|
|
|
56
57
|
registerObjectRoutes(app, host)
|
|
57
58
|
registerActionRoutes(app, host)
|
|
58
59
|
registerFileRoutes(app, host)
|
|
60
|
+
registerFileDownloadRoutes(app, host)
|
|
59
61
|
registerActionRunRoutes(app, host)
|
|
60
62
|
registerAgentRoutes(app, host)
|
|
61
63
|
registerModelRoutes(app, host)
|
|
@@ -109,6 +109,7 @@ function serializeModelCall(item: AiModelCallAccountingItem) {
|
|
|
109
109
|
callId: item.usage.callId,
|
|
110
110
|
providerId: item.usage.providerId,
|
|
111
111
|
requestedModelId: item.usage.requestedModelId,
|
|
112
|
+
modelKind: item.usage.modelKind,
|
|
112
113
|
providerIds: item.usage.providerIds ?? null,
|
|
113
114
|
requestedReasoning: item.usage.requestedReasoning,
|
|
114
115
|
responseModelId: item.usage.responseModelId,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { SixbHostView } from "@sixb/core"
|
|
2
|
+
import { FILE_DOWNLOAD_ROUTE_PREFIX, resolveFileDownload } from "@sixb/core/internal/blob-storage"
|
|
3
|
+
import type { Elysia } from "elysia"
|
|
4
|
+
import { createFileContentResponse } from "../files/content"
|
|
5
|
+
|
|
6
|
+
interface FileDownloadContext {
|
|
7
|
+
readonly params: { readonly token: string }
|
|
8
|
+
readonly request: Request
|
|
9
|
+
readonly set: { status?: number | string }
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Serves the URLs `blobs.createDownloadUrl()` issues. Public, because their readers — social
|
|
14
|
+
* networks fetching media to publish — cannot hold a session: the token is the credential.
|
|
15
|
+
* Hidden from OpenAPI like webhooks; clients receive these URLs, they never build them.
|
|
16
|
+
*/
|
|
17
|
+
export function registerFileDownloadRoutes(app: Elysia, host: SixbHostView) {
|
|
18
|
+
const path = `${FILE_DOWNLOAD_ROUTE_PREFIX}:token`
|
|
19
|
+
return app
|
|
20
|
+
.get(path, (context) => fileDownloadResponse(host, context), { detail: { hide: true } })
|
|
21
|
+
.head(path, (context) => fileDownloadResponse(host, context, { head: true }), {
|
|
22
|
+
detail: { hide: true },
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function fileDownloadResponse(
|
|
27
|
+
host: SixbHostView,
|
|
28
|
+
{ params, request, set }: FileDownloadContext,
|
|
29
|
+
options: { readonly head?: boolean } = {}
|
|
30
|
+
): Promise<Response | { readonly error: string }> {
|
|
31
|
+
// An unknown, expired, or revoked token and a deleted blob all answer the same 404.
|
|
32
|
+
const fileRef = await resolveFileDownload(host, params.token)
|
|
33
|
+
const response =
|
|
34
|
+
fileRef &&
|
|
35
|
+
(await createFileContentResponse({
|
|
36
|
+
blobStorage: host.blobStorage,
|
|
37
|
+
fileRef,
|
|
38
|
+
head: options.head,
|
|
39
|
+
rangeHeader: request.headers.get("range"),
|
|
40
|
+
ifNoneMatchHeader: request.headers.get("if-none-match"),
|
|
41
|
+
ifRangeHeader: request.headers.get("if-range"),
|
|
42
|
+
}))
|
|
43
|
+
if (!response) {
|
|
44
|
+
set.status = 404
|
|
45
|
+
return { error: "File not found" }
|
|
46
|
+
}
|
|
47
|
+
return response
|
|
48
|
+
}
|
package/src/routes/objects.ts
CHANGED
|
@@ -41,7 +41,16 @@ import {
|
|
|
41
41
|
} from "../schemas/objects"
|
|
42
42
|
import { handleRouteError, parseOptionalInt, toIsoString } from "../utils/http"
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
// Only object files are served to shared sessions. The boundary reads `shareGrant` before routing;
|
|
45
|
+
// declaring it here keeps it in the OpenAPI contract and through query validation.
|
|
46
|
+
const ObjectFileContentRouteQuerySchema = FileContentQuerySchema.extend({
|
|
47
|
+
shareGrant: z
|
|
48
|
+
.string()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe("Share grant selector for elements that cannot send the x-sixb-share-grant header"),
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const ObjectFileContentQuerySchema = ObjectFileContentRouteQuerySchema.extend({
|
|
45
54
|
path: z
|
|
46
55
|
.string()
|
|
47
56
|
.min(1)
|
|
@@ -745,6 +754,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
|
|
|
745
754
|
})
|
|
746
755
|
|
|
747
756
|
return {
|
|
757
|
+
total: result.total,
|
|
748
758
|
facets: result.facets,
|
|
749
759
|
plan: serializePlan(result.plan),
|
|
750
760
|
}
|
|
@@ -812,7 +822,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
|
|
|
812
822
|
// the handler applies the stricter `^/properties` check and returns a
|
|
813
823
|
// consistent `{ error }` 400. Registering the strict schema here would
|
|
814
824
|
// make Elysia emit its own 422 validation body, breaking that contract.
|
|
815
|
-
query:
|
|
825
|
+
query: ObjectFileContentRouteQuerySchema,
|
|
816
826
|
// No top-level `response` map: Elysia's OpenAPI builder resets responses
|
|
817
827
|
// to JSON-only whenever one is present, which would erase the binary
|
|
818
828
|
// `application/octet-stream` bodies. Declaring every status in
|
|
@@ -833,7 +843,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
|
|
|
833
843
|
params: ObjectParamsSchema,
|
|
834
844
|
// See the GET route: register the loose query so the handler owns the
|
|
835
845
|
// strict `^/properties` check and its consistent 400.
|
|
836
|
-
query:
|
|
846
|
+
query: ObjectFileContentRouteQuerySchema,
|
|
837
847
|
// See the GET route: no top-level `response` map, so the binary responses
|
|
838
848
|
// declared in `detail.responses` survive into the spec.
|
|
839
849
|
detail: {
|