@sixb/server 0.2.4 → 0.2.6
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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +877 -89
- package/dist/index.js.map +26 -25
- package/dist/live/room.d.ts +2 -0
- package/dist/live/room.d.ts.map +1 -1
- package/dist/registerRoutes.d.ts +1 -0
- package/dist/registerRoutes.d.ts.map +1 -1
- package/dist/routes/agent-approvals.d.ts +22 -0
- package/dist/routes/agent-approvals.d.ts.map +1 -1
- package/dist/routes/agent-computers.d.ts +36 -0
- package/dist/routes/agent-computers.d.ts.map +1 -1
- package/dist/routes/agent-runners.d.ts +5 -1
- package/dist/routes/agent-runners.d.ts.map +1 -1
- package/dist/routes/agent-thread-reads.d.ts +82 -0
- package/dist/routes/agent-thread-reads.d.ts.map +1 -0
- package/dist/routes/agents.d.ts +1760 -86
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/ai-accounting.d.ts.map +1 -1
- package/dist/routes/artifact-frames.d.ts +3 -3
- package/dist/routes/artifact-frames.d.ts.map +1 -1
- package/dist/routes/artifacts.d.ts +287 -21
- package/dist/routes/artifacts.d.ts.map +1 -1
- package/dist/routes/auth.d.ts +7 -7
- package/dist/routes/events.d.ts +4 -4
- package/dist/routes/links.d.ts +8 -0
- package/dist/routes/links.d.ts.map +1 -1
- package/dist/routes/model-generations.d.ts +6 -0
- package/dist/routes/model-generations.d.ts.map +1 -1
- package/dist/routes/objects.d.ts +8 -0
- package/dist/routes/objects.d.ts.map +1 -1
- package/dist/routes/observed-agent-threads.d.ts +22 -0
- package/dist/routes/observed-agent-threads.d.ts.map +1 -1
- package/dist/routes/projections.d.ts +2 -0
- package/dist/routes/projections.d.ts.map +1 -1
- package/dist/routes/status.d.ts +4 -1
- package/dist/routes/status.d.ts.map +1 -1
- package/dist/routes/syncs.d.ts +175 -12
- package/dist/routes/syncs.d.ts.map +1 -1
- package/dist/routes/workflows.d.ts +6 -6
- package/dist/routes/ws/agents.d.ts.map +1 -1
- package/dist/routes/ws/events.d.ts +6 -6
- package/dist/schemas/activity.d.ts +4 -4
- package/dist/schemas/agents.d.ts +7697 -262
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/ai-accounting.d.ts +3 -0
- package/dist/schemas/ai-accounting.d.ts.map +1 -1
- package/dist/schemas/artifacts.d.ts +676 -36
- package/dist/schemas/artifacts.d.ts.map +1 -1
- package/dist/schemas/auth.d.ts +8 -8
- package/dist/schemas/common.d.ts.map +1 -1
- package/dist/schemas/events.d.ts +36 -24
- package/dist/schemas/events.d.ts.map +1 -1
- package/dist/schemas/lineage.d.ts +112 -0
- package/dist/schemas/lineage.d.ts.map +1 -1
- package/dist/schemas/models.d.ts +46 -0
- package/dist/schemas/models.d.ts.map +1 -1
- package/dist/schemas/projections.d.ts +11 -0
- package/dist/schemas/projections.d.ts.map +1 -1
- package/dist/schemas/syncs.d.ts +724 -25
- package/dist/schemas/syncs.d.ts.map +1 -1
- package/dist/schemas/workflows.d.ts +22 -22
- package/dist/server.d.ts +16 -1
- package/dist/server.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +6 -1
- package/src/live/README.md +9 -6
- package/src/live/room.ts +16 -8
- package/src/registerRoutes.ts +4 -1
- package/src/routes/agent-computers.ts +7 -6
- package/src/routes/agent-runners.ts +15 -4
- package/src/routes/agent-thread-reads.ts +67 -0
- package/src/routes/agents.ts +331 -20
- package/src/routes/ai-accounting.ts +1 -0
- package/src/routes/artifact-frames.ts +22 -9
- package/src/routes/artifacts.ts +124 -3
- package/src/routes/model-generations.ts +1 -1
- package/src/routes/observed-agent-threads.ts +3 -4
- package/src/routes/status.ts +18 -1
- package/src/routes/syncs.ts +135 -8
- package/src/routes/ws/agents.ts +43 -3
- package/src/schemas/agents.ts +148 -12
- package/src/schemas/ai-accounting.ts +12 -0
- package/src/schemas/artifacts.ts +66 -1
- package/src/schemas/common.ts +15 -9
- package/src/schemas/events.ts +1 -0
- package/src/schemas/models.ts +10 -0
- package/src/schemas/projections.ts +1 -0
- package/src/schemas/syncs.ts +63 -1
- package/src/server.ts +208 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncs.d.ts","sourceRoot":"","sources":["../../src/schemas/syncs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAA;AAEF,eAAO,MAAM,mBAAmB,sEAAoE,CAAA;AAGpG,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"syncs.d.ts","sourceRoot":"","sources":["../../src/schemas/syncs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAA;AAEF,eAAO,MAAM,mBAAmB,sEAAoE,CAAA;AAGpG,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU9B,CAAA;AAEF,eAAO,MAAM,wBAAwB;IACnC,iGAAiG;;;;;;;;;;;;EAIjG,CAAA;AAOF,eAAO,MAAM,aAAa;;;;IAIxB,qEAAqE;;;;;IAKrE,uFAAuF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAevF,CAAA;AAYF,4FAA4F;AAC5F,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAjCjC,qEAAqE;;;;;QAKrE,uFAAuF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgFvF,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;QAvFpC,qEAAqE;;;;;QAKrE,uFAAuF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsFvF,CAAA;AAWF,+FAA+F;AAC/F,eAAO,MAAM,4BAA4B;;;;;QANvC,qEAAqE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQrE,CAAA"}
|
|
@@ -33,7 +33,7 @@ export declare const WorkflowRunsQuerySchema: z.ZodObject<{
|
|
|
33
33
|
offset: z.ZodOptional<z.ZodString>;
|
|
34
34
|
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
35
35
|
}, "strip", z.ZodTypeAny, {
|
|
36
|
-
status?: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
36
|
+
status?: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting" | undefined;
|
|
37
37
|
startedAfter?: string | undefined;
|
|
38
38
|
startedBefore?: string | undefined;
|
|
39
39
|
limit?: string | undefined;
|
|
@@ -41,7 +41,7 @@ export declare const WorkflowRunsQuerySchema: z.ZodObject<{
|
|
|
41
41
|
order?: "asc" | "desc" | undefined;
|
|
42
42
|
workflowId?: string | undefined;
|
|
43
43
|
}, {
|
|
44
|
-
status?: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
44
|
+
status?: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting" | undefined;
|
|
45
45
|
startedAfter?: string | undefined;
|
|
46
46
|
startedBefore?: string | undefined;
|
|
47
47
|
limit?: string | undefined;
|
|
@@ -129,7 +129,7 @@ export declare const WorkflowRunSummarySchema: z.ZodObject<{
|
|
|
129
129
|
type: "user" | "serviceAccount" | "system";
|
|
130
130
|
}>;
|
|
131
131
|
}, "strip", z.ZodTypeAny, {
|
|
132
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
132
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
133
133
|
projectId: string;
|
|
134
134
|
id: string;
|
|
135
135
|
requestedBy: {
|
|
@@ -142,7 +142,7 @@ export declare const WorkflowRunSummarySchema: z.ZodObject<{
|
|
|
142
142
|
finishedAt?: string | undefined;
|
|
143
143
|
queuedAt?: string | undefined;
|
|
144
144
|
}, {
|
|
145
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
145
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
146
146
|
projectId: string;
|
|
147
147
|
id: string;
|
|
148
148
|
requestedBy: {
|
|
@@ -178,7 +178,7 @@ export declare const WorkflowRunDetailSchema: z.ZodObject<{
|
|
|
178
178
|
input: z.ZodRecord<z.ZodString, z.ZodType<import("./common").JsonValue, z.ZodTypeDef, import("./common").JsonValue>>;
|
|
179
179
|
output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./common").JsonValue, z.ZodTypeDef, import("./common").JsonValue>>>;
|
|
180
180
|
}, "strip", z.ZodTypeAny, {
|
|
181
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
181
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
182
182
|
projectId: string;
|
|
183
183
|
id: string;
|
|
184
184
|
requestedBy: {
|
|
@@ -193,7 +193,7 @@ export declare const WorkflowRunDetailSchema: z.ZodObject<{
|
|
|
193
193
|
queuedAt?: string | undefined;
|
|
194
194
|
output?: Record<string, import("./common").JsonValue> | undefined;
|
|
195
195
|
}, {
|
|
196
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
196
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
197
197
|
projectId: string;
|
|
198
198
|
id: string;
|
|
199
199
|
requestedBy: {
|
|
@@ -1822,7 +1822,7 @@ export declare const WorkflowSchema: z.ZodObject<{
|
|
|
1822
1822
|
type: "user" | "serviceAccount" | "system";
|
|
1823
1823
|
}>;
|
|
1824
1824
|
}, "strip", z.ZodTypeAny, {
|
|
1825
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
1825
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
1826
1826
|
projectId: string;
|
|
1827
1827
|
id: string;
|
|
1828
1828
|
requestedBy: {
|
|
@@ -1835,7 +1835,7 @@ export declare const WorkflowSchema: z.ZodObject<{
|
|
|
1835
1835
|
finishedAt?: string | undefined;
|
|
1836
1836
|
queuedAt?: string | undefined;
|
|
1837
1837
|
}, {
|
|
1838
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
1838
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
1839
1839
|
projectId: string;
|
|
1840
1840
|
id: string;
|
|
1841
1841
|
requestedBy: {
|
|
@@ -1882,7 +1882,7 @@ export declare const WorkflowSchema: z.ZodObject<{
|
|
|
1882
1882
|
output: Record<string, import("./common").JsonValue>;
|
|
1883
1883
|
})[];
|
|
1884
1884
|
latestRun: {
|
|
1885
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
1885
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
1886
1886
|
projectId: string;
|
|
1887
1887
|
id: string;
|
|
1888
1888
|
requestedBy: {
|
|
@@ -1929,7 +1929,7 @@ export declare const WorkflowSchema: z.ZodObject<{
|
|
|
1929
1929
|
output: Record<string, import("./common").JsonValue>;
|
|
1930
1930
|
})[];
|
|
1931
1931
|
latestRun: {
|
|
1932
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
1932
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
1933
1933
|
projectId: string;
|
|
1934
1934
|
id: string;
|
|
1935
1935
|
requestedBy: {
|
|
@@ -1964,7 +1964,7 @@ export declare const WorkflowRunListResponseSchema: z.ZodObject<{
|
|
|
1964
1964
|
type: "user" | "serviceAccount" | "system";
|
|
1965
1965
|
}>;
|
|
1966
1966
|
}, "strip", z.ZodTypeAny, {
|
|
1967
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
1967
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
1968
1968
|
projectId: string;
|
|
1969
1969
|
id: string;
|
|
1970
1970
|
requestedBy: {
|
|
@@ -1977,7 +1977,7 @@ export declare const WorkflowRunListResponseSchema: z.ZodObject<{
|
|
|
1977
1977
|
finishedAt?: string | undefined;
|
|
1978
1978
|
queuedAt?: string | undefined;
|
|
1979
1979
|
}, {
|
|
1980
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
1980
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
1981
1981
|
projectId: string;
|
|
1982
1982
|
id: string;
|
|
1983
1983
|
requestedBy: {
|
|
@@ -1994,7 +1994,7 @@ export declare const WorkflowRunListResponseSchema: z.ZodObject<{
|
|
|
1994
1994
|
total: z.ZodNumber;
|
|
1995
1995
|
}, "strip", z.ZodTypeAny, {
|
|
1996
1996
|
runs: {
|
|
1997
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
1997
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
1998
1998
|
projectId: string;
|
|
1999
1999
|
id: string;
|
|
2000
2000
|
requestedBy: {
|
|
@@ -2011,7 +2011,7 @@ export declare const WorkflowRunListResponseSchema: z.ZodObject<{
|
|
|
2011
2011
|
total: number;
|
|
2012
2012
|
}, {
|
|
2013
2013
|
runs: {
|
|
2014
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
2014
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
2015
2015
|
projectId: string;
|
|
2016
2016
|
id: string;
|
|
2017
2017
|
requestedBy: {
|
|
@@ -2051,7 +2051,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
2051
2051
|
input: z.ZodRecord<z.ZodString, z.ZodType<import("./common").JsonValue, z.ZodTypeDef, import("./common").JsonValue>>;
|
|
2052
2052
|
output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./common").JsonValue, z.ZodTypeDef, import("./common").JsonValue>>>;
|
|
2053
2053
|
}, "strip", z.ZodTypeAny, {
|
|
2054
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
2054
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
2055
2055
|
projectId: string;
|
|
2056
2056
|
id: string;
|
|
2057
2057
|
requestedBy: {
|
|
@@ -2066,7 +2066,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
2066
2066
|
queuedAt?: string | undefined;
|
|
2067
2067
|
output?: Record<string, import("./common").JsonValue> | undefined;
|
|
2068
2068
|
}, {
|
|
2069
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
2069
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
2070
2070
|
projectId: string;
|
|
2071
2071
|
id: string;
|
|
2072
2072
|
requestedBy: {
|
|
@@ -2344,7 +2344,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
2344
2344
|
}>, "many">;
|
|
2345
2345
|
}, "strip", z.ZodTypeAny, {
|
|
2346
2346
|
run: {
|
|
2347
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
2347
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
2348
2348
|
projectId: string;
|
|
2349
2349
|
id: string;
|
|
2350
2350
|
requestedBy: {
|
|
@@ -2410,7 +2410,7 @@ export declare const WorkflowRunDetailResponseSchema: z.ZodObject<{
|
|
|
2410
2410
|
}[];
|
|
2411
2411
|
}, {
|
|
2412
2412
|
run: {
|
|
2413
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
2413
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
2414
2414
|
projectId: string;
|
|
2415
2415
|
id: string;
|
|
2416
2416
|
requestedBy: {
|
|
@@ -2499,7 +2499,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
2499
2499
|
input: z.ZodRecord<z.ZodString, z.ZodType<import("./common").JsonValue, z.ZodTypeDef, import("./common").JsonValue>>;
|
|
2500
2500
|
output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./common").JsonValue, z.ZodTypeDef, import("./common").JsonValue>>>;
|
|
2501
2501
|
}, "strip", z.ZodTypeAny, {
|
|
2502
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
2502
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
2503
2503
|
projectId: string;
|
|
2504
2504
|
id: string;
|
|
2505
2505
|
requestedBy: {
|
|
@@ -2514,7 +2514,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
2514
2514
|
queuedAt?: string | undefined;
|
|
2515
2515
|
output?: Record<string, import("./common").JsonValue> | undefined;
|
|
2516
2516
|
}, {
|
|
2517
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
2517
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
2518
2518
|
projectId: string;
|
|
2519
2519
|
id: string;
|
|
2520
2520
|
requestedBy: {
|
|
@@ -2792,7 +2792,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
2792
2792
|
}>, "many">;
|
|
2793
2793
|
}, "strip", z.ZodTypeAny, {
|
|
2794
2794
|
run: {
|
|
2795
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
2795
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
2796
2796
|
projectId: string;
|
|
2797
2797
|
id: string;
|
|
2798
2798
|
requestedBy: {
|
|
@@ -2858,7 +2858,7 @@ export declare const CancelWorkflowRunResponseSchema: z.ZodObject<{
|
|
|
2858
2858
|
}[];
|
|
2859
2859
|
}, {
|
|
2860
2860
|
run: {
|
|
2861
|
-
status: "succeeded" | "failed" | "cancelled" | "running" | "
|
|
2861
|
+
status: "succeeded" | "failed" | "cancelled" | "running" | "queued" | "waiting";
|
|
2862
2862
|
projectId: string;
|
|
2863
2863
|
id: string;
|
|
2864
2864
|
requestedBy: {
|
package/dist/server.d.ts
CHANGED
|
@@ -33,6 +33,14 @@ export interface SixbServerOptions {
|
|
|
33
33
|
*/
|
|
34
34
|
ingestFlush?: boolean;
|
|
35
35
|
}
|
|
36
|
+
export interface SixbServerStopOptions {
|
|
37
|
+
/**
|
|
38
|
+
* How long in-flight HTTP requests may take to finish before remaining connections are closed.
|
|
39
|
+
* Defaults to 65 seconds, matching the Action drain window; `0` closes them at once. A stop
|
|
40
|
+
* called while another one drains joins it, and a shorter timeout brings its deadline closer.
|
|
41
|
+
*/
|
|
42
|
+
readonly timeoutMs?: number;
|
|
43
|
+
}
|
|
36
44
|
export declare function createSixbServer(options: SixbServerOptions): SixbServer;
|
|
37
45
|
export declare class SixbServer {
|
|
38
46
|
private readonly hostRuntime;
|
|
@@ -48,10 +56,13 @@ export declare class SixbServer {
|
|
|
48
56
|
private readonly timing;
|
|
49
57
|
private app;
|
|
50
58
|
private bunServer;
|
|
59
|
+
private closeWebSockets;
|
|
60
|
+
private stopping;
|
|
51
61
|
private readonly hostsOntologyMaintenance;
|
|
52
62
|
private readonly flushesIngestion;
|
|
53
63
|
private maintenance;
|
|
54
64
|
private stopSweeper;
|
|
65
|
+
private inProgressStop;
|
|
55
66
|
constructor(options: SixbServerOptions);
|
|
56
67
|
getHost(): SixbHostView;
|
|
57
68
|
/** The port the server listens on once started, so `port: 0` reports the one it bound. */
|
|
@@ -63,9 +74,13 @@ export declare class SixbServer {
|
|
|
63
74
|
getApiBrowserPolicy(): ResolvedSixbApiBrowserPolicy;
|
|
64
75
|
getAuthExperience(): SixbAuthExperienceOptions | undefined;
|
|
65
76
|
getSharedAccessOptions(): SixbSharedAccessOptions;
|
|
77
|
+
/** Marks the server as stopping so `/ready` answers `503` before connections close. */
|
|
78
|
+
markStopping(): void;
|
|
79
|
+
isStopping(): boolean;
|
|
66
80
|
start(): Promise<void>;
|
|
67
81
|
private setIngestFlush;
|
|
68
|
-
stop(): Promise<void>;
|
|
82
|
+
stop(options?: SixbServerStopOptions): Promise<void>;
|
|
83
|
+
private stopUntil;
|
|
69
84
|
}
|
|
70
85
|
export declare function createSixbApi(server: SixbServer): Elysia<"", {
|
|
71
86
|
decorator: {};
|
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;AASzE,OAAO,EAAE,MAAM,EAAc,MAAM,QAAQ,CAAA;AAE3C,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EAIhC,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;AAsB7B,OAAO,EAEL,KAAK,wBAAwB,EAE9B,MAAM,wBAAwB,CAAA;AAG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AM,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.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "HTTP and WebSocket API server for Sixb",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sixb",
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"zod-to-json-schema": "^3.24.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@sixb/core": "0.2.
|
|
43
|
+
"@sixb/core": "0.2.6",
|
|
44
44
|
"yjs": "^13.6.33"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@sixb/auth-magic-link": "0.2.0",
|
|
48
48
|
"@sixb/auth-oidc": "0.2.3",
|
|
49
|
-
"@sixb/cli-core": "0.2.
|
|
50
|
-
"@sixb/core": "0.2.
|
|
51
|
-
"@sixb/sqlite": "0.2.
|
|
49
|
+
"@sixb/cli-core": "0.2.4",
|
|
50
|
+
"@sixb/core": "0.2.6",
|
|
51
|
+
"@sixb/sqlite": "0.2.6",
|
|
52
52
|
"@types/bun": "latest",
|
|
53
53
|
"typescript": "^5.7.0",
|
|
54
54
|
"yjs": "13.6.33"
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export type { SixbApiBrowserPolicy } from "./auth/browser-origin"
|
|
2
2
|
export type { SixbAuthExperienceOptions } from "./auth/experience"
|
|
3
3
|
export type { SixbSharedAccessOptions } from "./auth/shared-access"
|
|
4
|
-
export {
|
|
4
|
+
export {
|
|
5
|
+
createSixbServer,
|
|
6
|
+
SixbServer,
|
|
7
|
+
type SixbServerOptions,
|
|
8
|
+
type SixbServerStopOptions,
|
|
9
|
+
} from "./server"
|
|
5
10
|
export { requestTimingOptionsFromEnv, type SixbRequestTimingOptions } from "./utils/request-timing"
|
package/src/live/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# Live artifacts
|
|
2
2
|
|
|
3
|
-
`/ws/artifacts` lets several people edit a canvas at once. Every connected
|
|
4
|
-
artifact's open version as a Yjs document (`@sixb/core/artifacts/live`). Each
|
|
5
|
-
artifact keeps one copy, and writes it back into storage as an ordinary artifact
|
|
3
|
+
`/ws/artifacts` lets several people edit a canvas, or a document, Markdown or designed, at once. Every connected
|
|
4
|
+
client holds the artifact's open version as a Yjs document (`@sixb/core/artifacts/live`). Each
|
|
5
|
+
server holding the artifact keeps one copy, and writes it back into storage as an ordinary artifact
|
|
6
|
+
write.
|
|
6
7
|
|
|
7
8
|
| File | Role |
|
|
8
9
|
| --- | --- |
|
|
@@ -21,7 +22,7 @@ whose content it holds, replaced with every content write (see
|
|
|
21
22
|
|
|
22
23
|
- Every server loads a room from that state, and every client's document comes from a room. Any
|
|
23
24
|
copy, on any server and after any reload, continues the same history.
|
|
24
|
-
- Every write to a
|
|
25
|
+
- Every write to an artifact that keeps a document is made into it, whoever makes it
|
|
25
26
|
(`packages/core/src/artifacts/publish/merge.ts`):
|
|
26
27
|
- A live write-back carries the room's state, which is applied to the stored one.
|
|
27
28
|
- A write of files (the Agent, HTTP) is applied as the change from the files it was made from.
|
|
@@ -37,7 +38,8 @@ whose content it holds, replaced with every content write (see
|
|
|
37
38
|
|
|
38
39
|
- On `join`, the server reads the person's access to the artifact. `owner` and `update` edit,
|
|
39
40
|
`read` watches, and anything else is refused with `left`.
|
|
40
|
-
- The first join opens the room from the stored document.
|
|
41
|
+
- The first join opens the room from the stored document. A sheet, a page, a deck or a file is
|
|
42
|
+
refused as `not_live`.
|
|
41
43
|
- `joined` says who the connection is (`user`: id, name and color, read once per connection). A
|
|
42
44
|
shared link's guest is read at each join instead, from its session: `guest:<sessionId>`, the
|
|
43
45
|
name they gave, and `guest: true`. Once they give a name, their socket reads it from the session
|
|
@@ -86,7 +88,8 @@ The server vouches for every awareness state it shares:
|
|
|
86
88
|
- A failure leaves the room dirty, reports `status: failed` with the error, and retries:
|
|
87
89
|
- `artifact_not_found`: the room closes and every member gets `left`.
|
|
88
90
|
- An access error: the author is demoted, and another editor is tried at once.
|
|
89
|
-
- `invalid_artifact`: waits for the next change while someone is connected
|
|
91
|
+
- `invalid_artifact`: waits for the next change while someone is connected, and says so with
|
|
92
|
+
`refused`, since nothing tries it again.
|
|
90
93
|
- Anything else: retries with backoff from 2 s doubling to 30 s, for as long as the server runs,
|
|
91
94
|
whether or not anyone still holds the room.
|
|
92
95
|
- Changes are lost only when nobody can write them: the server stops first, or storage refuses
|
package/src/live/room.ts
CHANGED
|
@@ -16,9 +16,11 @@ import {
|
|
|
16
16
|
AGENT_PRESENCE_MS,
|
|
17
17
|
artifactLiveStream,
|
|
18
18
|
artifactPresenceStream,
|
|
19
|
+
keepsDocument,
|
|
19
20
|
loadArtifactDocument,
|
|
20
21
|
mergeIntoDocument,
|
|
21
22
|
parseArtifactLiveRecord,
|
|
23
|
+
readChange,
|
|
22
24
|
readDocumentState,
|
|
23
25
|
readLiveFiles,
|
|
24
26
|
sameArtifactFiles,
|
|
@@ -132,6 +134,8 @@ export class LiveRoom {
|
|
|
132
134
|
private shadow: Y.Doc
|
|
133
135
|
private state: ArtifactLiveSaveState = "saved"
|
|
134
136
|
private error: string | undefined
|
|
137
|
+
/** The last write-back was refused for what the document holds: it waits for a change. */
|
|
138
|
+
private refused = false
|
|
135
139
|
/** The last write-back's failure, which a loss of the changes reports. */
|
|
136
140
|
private failure: unknown
|
|
137
141
|
private attempts = 0
|
|
@@ -187,7 +191,7 @@ export class LiveRoom {
|
|
|
187
191
|
const storage = requireArtifacts(host)
|
|
188
192
|
const artifact = await storage.get({ projectId: host.projectId, id: artifactId })
|
|
189
193
|
if (!artifact) return "not_found"
|
|
190
|
-
if (artifact.kind
|
|
194
|
+
if (!keepsDocument(artifact.kind)) return "not_live"
|
|
191
195
|
|
|
192
196
|
const version = await storage.getVersion({
|
|
193
197
|
projectId: host.projectId,
|
|
@@ -520,6 +524,7 @@ export class LiveRoom {
|
|
|
520
524
|
this.savedSnapshot = written
|
|
521
525
|
this.attempts = 0
|
|
522
526
|
this.error = undefined
|
|
527
|
+
this.refused = false
|
|
523
528
|
this.failure = undefined
|
|
524
529
|
this.setState(this.dirty ? "unsaved" : "saved", true)
|
|
525
530
|
if (this.dirty && !this.idle) this.idle = setTimeout(() => this.save(), SAVE_IDLE_MS)
|
|
@@ -536,9 +541,10 @@ export class LiveRoom {
|
|
|
536
541
|
this.attempts += 1
|
|
537
542
|
this.error = error instanceof Error ? error.message : String(error)
|
|
538
543
|
this.failure = error
|
|
544
|
+
const code = error instanceof ArtifactRequestError ? error.code : undefined
|
|
545
|
+
this.refused = code === "invalid_artifact"
|
|
539
546
|
this.setState("failed", true)
|
|
540
547
|
|
|
541
|
-
const code = error instanceof ArtifactRequestError ? error.code : undefined
|
|
542
548
|
if (code === "artifact_not_found") {
|
|
543
549
|
for (const member of [...this.members.values()]) {
|
|
544
550
|
member.connection.send({ type: "left", artifactId: this.artifactId, reason: "not_found" })
|
|
@@ -665,13 +671,14 @@ export class LiveRoom {
|
|
|
665
671
|
*/
|
|
666
672
|
private readable(bytes: Uint8Array): boolean {
|
|
667
673
|
try {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
674
|
+
readChange(this.shadow, () =>
|
|
675
|
+
syncProtocol.readSyncMessage(
|
|
676
|
+
decoding.createDecoder(bytes),
|
|
677
|
+
encoding.createEncoder(),
|
|
678
|
+
this.shadow,
|
|
679
|
+
null
|
|
680
|
+
)
|
|
673
681
|
)
|
|
674
|
-
documentFiles(this.shadow)
|
|
675
682
|
return true
|
|
676
683
|
} catch {
|
|
677
684
|
this.shadow.destroy()
|
|
@@ -902,6 +909,7 @@ export class LiveRoom {
|
|
|
902
909
|
revision: this.synced.revision,
|
|
903
910
|
snapshot: encodeLiveData(this.savedSnapshot),
|
|
904
911
|
...(this.state === "failed" && this.error ? { error: this.error } : {}),
|
|
912
|
+
...(this.state === "failed" && this.refused ? { refused: true as const } : {}),
|
|
905
913
|
}
|
|
906
914
|
}
|
|
907
915
|
|
package/src/registerRoutes.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { registerAgentChildRoutes } from "./routes/agent-children"
|
|
|
10
10
|
import { registerAgentComputerRoutes } from "./routes/agent-computers"
|
|
11
11
|
import { registerAgentMemoryRoutes } from "./routes/agent-memory"
|
|
12
12
|
import { registerAgentRunnerRoutes } from "./routes/agent-runners"
|
|
13
|
+
import { registerAgentThreadReadRoutes } from "./routes/agent-thread-reads"
|
|
13
14
|
import { registerAgentRoutes } from "./routes/agents"
|
|
14
15
|
import { registerAiAccountingRoutes } from "./routes/ai-accounting"
|
|
15
16
|
import { registerArtifactFrameRoutes } from "./routes/artifact-frames"
|
|
@@ -51,6 +52,7 @@ export interface HttpRouteOptions {
|
|
|
51
52
|
readonly sharedAccess: SharedAccessBoundary
|
|
52
53
|
/** Where frames are served from and which app origins may show them. */
|
|
53
54
|
readonly browserPolicy: ResolvedSixbApiBrowserPolicy
|
|
55
|
+
readonly isStopping?: () => boolean
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
export function registerHttpRoutes(app: Elysia, host: SixbHostView, options: HttpRouteOptions) {
|
|
@@ -58,7 +60,7 @@ export function registerHttpRoutes(app: Elysia, host: SixbHostView, options: Htt
|
|
|
58
60
|
registerModelCallRoutes(app, host)
|
|
59
61
|
registerModelGenerationRoutes(app, host)
|
|
60
62
|
registerProjectRoutes(app, host)
|
|
61
|
-
registerStatusRoutes(app, host)
|
|
63
|
+
registerStatusRoutes(app, host, { isStopping: options.isStopping })
|
|
62
64
|
registerConnectorRoutes(app, host)
|
|
63
65
|
registerConnectorConnectionRoutes(app, host)
|
|
64
66
|
registerConnectorConnectionRunRoutes(app, host, options.connectorConnections)
|
|
@@ -77,6 +79,7 @@ export function registerHttpRoutes(app: Elysia, host: SixbHostView, options: Htt
|
|
|
77
79
|
registerFileDownloadRoutes(app, host)
|
|
78
80
|
registerActionRunRoutes(app, host)
|
|
79
81
|
registerAgentRoutes(app, host)
|
|
82
|
+
registerAgentThreadReadRoutes(app, host)
|
|
80
83
|
registerAgentChildRoutes(app, host)
|
|
81
84
|
registerAgentRunnerRoutes(app, host)
|
|
82
85
|
registerAgentComputerRoutes(app, host)
|
|
@@ -46,10 +46,11 @@ import {
|
|
|
46
46
|
serializeThreadRead,
|
|
47
47
|
} from "./agents"
|
|
48
48
|
|
|
49
|
-
// A
|
|
50
|
-
// in that folder claims
|
|
51
|
-
// thread reads as online while one is live, and its owner can
|
|
52
|
-
//
|
|
49
|
+
// A thread runs in the cloud, or on one of its owner's computers in one folder there: only
|
|
50
|
+
// `sixb` open in that folder claims the turns of one that runs there. Each open `sixb` holds a
|
|
51
|
+
// session, a lease it renews, so the thread reads as online while one is live, and its owner can
|
|
52
|
+
// send from anywhere. Moving it between the cloud, a computer and a folder is its owner's call,
|
|
53
|
+
// as often as they like.
|
|
53
54
|
|
|
54
55
|
/** How long a session stays live without a renewal; `sixb` renews it three times as often. */
|
|
55
56
|
const SESSION_MS = 60_000
|
|
@@ -188,7 +189,7 @@ export function registerAgentComputerRoutes(app: Elysia, host: SixbHostView) {
|
|
|
188
189
|
detail: {
|
|
189
190
|
summary: "Move a thread to one of your computers, in a folder there",
|
|
190
191
|
description:
|
|
191
|
-
"
|
|
192
|
+
"Its turns run there alone from now on, in that folder: only `sixb` open in it claims them. Its owner moves it from the cloud or from another folder or computer, as often as they need; files from where it ran before stay there. Refused while a turn runs or waits on approvals.",
|
|
192
193
|
tags: [OPENAPI_TAGS.agentThreads.name],
|
|
193
194
|
operationId: "moveAgentThreadToComputer",
|
|
194
195
|
security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
|
|
@@ -222,7 +223,7 @@ export function registerAgentComputerRoutes(app: Elysia, host: SixbHostView) {
|
|
|
222
223
|
detail: {
|
|
223
224
|
summary: "Move a thread from your computer to the cloud",
|
|
224
225
|
description:
|
|
225
|
-
"Its turns run in the cloud from now on, starting with the one waiting for the computer, if any. The files it worked on stay on the computer. Refused while a turn runs there or waits on approvals.",
|
|
226
|
+
"Its turns run in the cloud from now on, starting with the one waiting for the computer, if any, and its owner can move it to a computer or folder again later. The files it worked on stay on the computer. Refused while a turn runs there or waits on approvals.",
|
|
226
227
|
tags: [OPENAPI_TAGS.agentThreads.name],
|
|
227
228
|
operationId: "moveAgentThreadToCloud",
|
|
228
229
|
security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
|
|
@@ -84,20 +84,31 @@ export function startLapsedRunSweeper(host: SixbHostView): () => void {
|
|
|
84
84
|
return () => clearInterval(timer)
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
/** The part of Bun's server a session request needs: its per-request idle timeout. */
|
|
88
|
+
export interface RunnerSessionServer {
|
|
89
|
+
timeout(request: Request, seconds: number): void
|
|
90
|
+
}
|
|
91
|
+
|
|
87
92
|
/**
|
|
88
93
|
* Answer a runner's session request before the API parses it: its runner token speaks only for its
|
|
89
94
|
* run's session, and any other route refuses it. Null for any other request.
|
|
90
95
|
*/
|
|
91
96
|
export function agentRunSessionHandler(
|
|
92
97
|
host: SixbHostView
|
|
93
|
-
): (request: Request) => Promise<Response | null> {
|
|
98
|
+
): (request: Request, server?: RunnerSessionServer | null) => Promise<Response | null> {
|
|
94
99
|
let sessions: AgentRunSessionHost | null | undefined
|
|
95
|
-
return async (request) => {
|
|
100
|
+
return async (request, server) => {
|
|
96
101
|
sessions ??= agentRunSessionHost(host)
|
|
97
|
-
// The session reads its runner's body within its own limit, past the server's default cap.
|
|
98
102
|
const served = sessions
|
|
99
103
|
? await serveAgentRunSession(sessions, request, {
|
|
100
|
-
admitted: () =>
|
|
104
|
+
admitted: () => {
|
|
105
|
+
// The session reads its runner's body within its own limit, past the server's cap.
|
|
106
|
+
liftRequestBodyCap(request)
|
|
107
|
+
// A model call streams nothing while the model thinks, which on a long conversation
|
|
108
|
+
// outlasts Bun's 10-second idle timeout: Bun would close the socket mid-stream and the
|
|
109
|
+
// runner would read ECONNRESET. A worker calls its model in process and never meets it.
|
|
110
|
+
server?.timeout(request, 0)
|
|
111
|
+
},
|
|
101
112
|
})
|
|
102
113
|
: null
|
|
103
114
|
if (served) return served
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { SixbHostView } from "@sixb/core"
|
|
2
|
+
import type { Elysia } from "elysia"
|
|
3
|
+
import { requireRequestSixb } from "../auth/scope"
|
|
4
|
+
import { SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT } from "../openapi/security"
|
|
5
|
+
import { OPENAPI_TAGS } from "../openapi/tags"
|
|
6
|
+
import {
|
|
7
|
+
AgentRequestErrorResponseSchema,
|
|
8
|
+
AgentThreadParamsSchema,
|
|
9
|
+
MarkAgentThreadReadBodySchema,
|
|
10
|
+
MarkAgentThreadReadResponseSchema,
|
|
11
|
+
} from "../schemas/agents"
|
|
12
|
+
import { ErrorResponseSchema } from "../schemas/common"
|
|
13
|
+
import { toIsoString, unconfiguredStorageResponse } from "../utils/http"
|
|
14
|
+
import { handleAgentRouteError } from "./agents"
|
|
15
|
+
|
|
16
|
+
const MARKING =
|
|
17
|
+
"Record that your reading of a conversation reached a message, or its newest when `throughMessageId` is omitted, which is what a Done button sends. It never moves backwards, so another device that read further keeps its place; a message a retry or an edit took away marks nothing. Session routes only: a runner has no reading."
|
|
18
|
+
|
|
19
|
+
/** Where the caller's reading of a conversation has reached. One route: the write. */
|
|
20
|
+
export function registerAgentThreadReadRoutes(app: Elysia, host: SixbHostView) {
|
|
21
|
+
return app.put(
|
|
22
|
+
"/api/agent-threads/:threadId/read",
|
|
23
|
+
async (context) => {
|
|
24
|
+
const { set } = context
|
|
25
|
+
try {
|
|
26
|
+
if (!host.storage.agents) {
|
|
27
|
+
return unconfiguredStorageResponse(set, "Agent storage")
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const body = MarkAgentThreadReadBodySchema.parse(context.body ?? {})
|
|
31
|
+
const read = await requireRequestSixb(context).agent.threads.markRead(
|
|
32
|
+
context.params.threadId,
|
|
33
|
+
body
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
return MarkAgentThreadReadResponseSchema.parse({
|
|
37
|
+
read: {
|
|
38
|
+
threadId: read.threadId,
|
|
39
|
+
throughSeq: read.throughSeq,
|
|
40
|
+
headSeq: read.headSeq,
|
|
41
|
+
unread: read.unread,
|
|
42
|
+
readAt: read.readAt ? toIsoString(read.readAt) : undefined,
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
} catch (error) {
|
|
46
|
+
return handleAgentRouteError(error, set)
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
params: AgentThreadParamsSchema,
|
|
51
|
+
body: MarkAgentThreadReadBodySchema,
|
|
52
|
+
response: {
|
|
53
|
+
200: MarkAgentThreadReadResponseSchema,
|
|
54
|
+
400: AgentRequestErrorResponseSchema,
|
|
55
|
+
404: AgentRequestErrorResponseSchema,
|
|
56
|
+
501: ErrorResponseSchema,
|
|
57
|
+
},
|
|
58
|
+
detail: {
|
|
59
|
+
summary: "Mark how far you have read an Agent thread",
|
|
60
|
+
description: MARKING,
|
|
61
|
+
tags: [OPENAPI_TAGS.agentThreads.name],
|
|
62
|
+
operationId: "markAgentThreadRead",
|
|
63
|
+
security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
}
|