@sixb/server 0.2.5 → 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.
Files changed (56) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +525 -61
  4. package/dist/index.js.map +19 -18
  5. package/dist/registerRoutes.d.ts +1 -0
  6. package/dist/registerRoutes.d.ts.map +1 -1
  7. package/dist/routes/agent-approvals.d.ts +22 -0
  8. package/dist/routes/agent-approvals.d.ts.map +1 -1
  9. package/dist/routes/agent-computers.d.ts +36 -0
  10. package/dist/routes/agent-computers.d.ts.map +1 -1
  11. package/dist/routes/agent-thread-reads.d.ts +82 -0
  12. package/dist/routes/agent-thread-reads.d.ts.map +1 -0
  13. package/dist/routes/agents.d.ts +783 -1
  14. package/dist/routes/agents.d.ts.map +1 -1
  15. package/dist/routes/ai-accounting.d.ts.map +1 -1
  16. package/dist/routes/model-generations.d.ts +6 -0
  17. package/dist/routes/model-generations.d.ts.map +1 -1
  18. package/dist/routes/observed-agent-threads.d.ts +22 -0
  19. package/dist/routes/observed-agent-threads.d.ts.map +1 -1
  20. package/dist/routes/status.d.ts +4 -1
  21. package/dist/routes/status.d.ts.map +1 -1
  22. package/dist/routes/syncs.d.ts +175 -12
  23. package/dist/routes/syncs.d.ts.map +1 -1
  24. package/dist/routes/workflows.d.ts +6 -6
  25. package/dist/routes/ws/agents.d.ts.map +1 -1
  26. package/dist/schemas/activity.d.ts +4 -4
  27. package/dist/schemas/agents.d.ts +2602 -6
  28. package/dist/schemas/agents.d.ts.map +1 -1
  29. package/dist/schemas/ai-accounting.d.ts +3 -0
  30. package/dist/schemas/ai-accounting.d.ts.map +1 -1
  31. package/dist/schemas/common.d.ts.map +1 -1
  32. package/dist/schemas/models.d.ts +46 -0
  33. package/dist/schemas/models.d.ts.map +1 -1
  34. package/dist/schemas/syncs.d.ts +724 -25
  35. package/dist/schemas/syncs.d.ts.map +1 -1
  36. package/dist/schemas/workflows.d.ts +22 -22
  37. package/dist/server.d.ts +16 -1
  38. package/dist/server.d.ts.map +1 -1
  39. package/package.json +5 -5
  40. package/src/index.ts +6 -1
  41. package/src/registerRoutes.ts +4 -1
  42. package/src/routes/agent-computers.ts +7 -6
  43. package/src/routes/agent-thread-reads.ts +67 -0
  44. package/src/routes/agents.ts +129 -16
  45. package/src/routes/ai-accounting.ts +1 -0
  46. package/src/routes/model-generations.ts +1 -1
  47. package/src/routes/observed-agent-threads.ts +3 -4
  48. package/src/routes/status.ts +18 -1
  49. package/src/routes/syncs.ts +135 -8
  50. package/src/routes/ws/agents.ts +43 -3
  51. package/src/schemas/agents.ts +80 -10
  52. package/src/schemas/ai-accounting.ts +12 -0
  53. package/src/schemas/common.ts +15 -9
  54. package/src/schemas/models.ts +10 -0
  55. package/src/schemas/syncs.ts +63 -1
  56. package/src/server.ts +205 -13
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS9B,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;EAGnC,CAAA;AAOF,eAAO,MAAM,aAAa;;;;;;;IAOxB,uFAAuF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAevF,CAAA;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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3C,qEAAqE;;;;;QAKrE,uFAAuF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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" | "waiting" | "queued" | undefined;
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" | "waiting" | "queued" | undefined;
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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" | "waiting" | "queued";
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: {};
@@ -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;AAQzE,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/B,eAAO,MAAM,2BAA2B,QAAY,CAAA;AAEpD,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,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;;;;;;;;;;;;;;;;;;;;;;;;;GAwQ/C;AAqED,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.2.5",
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.5",
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.3",
50
- "@sixb/core": "0.2.5",
51
- "@sixb/sqlite": "0.2.5",
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 { createSixbServer, SixbServer, type SixbServerOptions } from "./server"
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"
@@ -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 computer's thread runs on one of its owner's computers, in one folder there: only `sixb` open
50
- // in that folder claims its turns. Each open `sixb` holds a session, a lease it renews, so the
51
- // thread reads as online while one is live, and its owner can send from anywhere. Moving it to
52
- // another folder, or to the cloud, is its owner's call.
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
- "A thread that runs on its owner's computer runs there alone, in one folder: only `sixb` open in that folder claims its turns. Its owner moves it to another folder or computer. Refused while a turn runs or waits on approvals.",
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,
@@ -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
+ }