@sixb/server 0.2.3 → 0.2.5
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.js +354 -30
- package/dist/index.js.map +12 -12
- package/dist/live/room.d.ts +2 -0
- package/dist/live/room.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/agents.d.ts +898 -6
- package/dist/routes/agents.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/objects.d.ts +8 -0
- package/dist/routes/objects.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/ws/events.d.ts +6 -6
- package/dist/schemas/agents.d.ts +5089 -250
- package/dist/schemas/agents.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/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/projections.d.ts +11 -0
- package/dist/schemas/projections.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/live/README.md +9 -6
- package/src/live/room.ts +16 -8
- package/src/routes/agent-runners.ts +15 -4
- package/src/routes/agents.ts +203 -5
- package/src/routes/artifact-frames.ts +22 -9
- package/src/routes/artifacts.ts +124 -3
- package/src/schemas/agents.ts +68 -2
- package/src/schemas/artifacts.ts +66 -1
- package/src/schemas/events.ts +1 -0
- package/src/schemas/projections.ts +1 -0
- package/src/server.ts +3 -1
|
@@ -497,6 +497,7 @@ export declare const ObjectProjectionSchema: z.ZodObject<{
|
|
|
497
497
|
strategy: "mostRecent";
|
|
498
498
|
sourceTimestamp: string;
|
|
499
499
|
}>]>;
|
|
500
|
+
missing: z.ZodOptional<z.ZodLiteral<"remove">>;
|
|
500
501
|
latestRun: z.ZodNullable<z.ZodUnion<[z.ZodObject<{
|
|
501
502
|
id: z.ZodString;
|
|
502
503
|
projectId: z.ZodString;
|
|
@@ -1034,6 +1035,7 @@ export declare const ObjectProjectionSchema: z.ZodObject<{
|
|
|
1034
1035
|
sourceTimestamp: string;
|
|
1035
1036
|
};
|
|
1036
1037
|
users?: Record<string, "id" | "email"> | undefined;
|
|
1038
|
+
missing?: "remove" | undefined;
|
|
1037
1039
|
}, {
|
|
1038
1040
|
id: string;
|
|
1039
1041
|
properties: Record<string, string>;
|
|
@@ -1148,6 +1150,7 @@ export declare const ObjectProjectionSchema: z.ZodObject<{
|
|
|
1148
1150
|
sourceTimestamp: string;
|
|
1149
1151
|
};
|
|
1150
1152
|
users?: Record<string, "id" | "email"> | undefined;
|
|
1153
|
+
missing?: "remove" | undefined;
|
|
1151
1154
|
}>;
|
|
1152
1155
|
export declare const LinkProjectionSchema: z.ZodObject<{
|
|
1153
1156
|
_tag: z.ZodLiteral<"LinkProjectionDefinition">;
|
|
@@ -2484,6 +2487,7 @@ export declare const ProjectionListResponseSchema: z.ZodObject<{
|
|
|
2484
2487
|
strategy: "mostRecent";
|
|
2485
2488
|
sourceTimestamp: string;
|
|
2486
2489
|
}>]>;
|
|
2490
|
+
missing: z.ZodOptional<z.ZodLiteral<"remove">>;
|
|
2487
2491
|
latestRun: z.ZodNullable<z.ZodUnion<[z.ZodObject<{
|
|
2488
2492
|
id: z.ZodString;
|
|
2489
2493
|
projectId: z.ZodString;
|
|
@@ -3021,6 +3025,7 @@ export declare const ProjectionListResponseSchema: z.ZodObject<{
|
|
|
3021
3025
|
sourceTimestamp: string;
|
|
3022
3026
|
};
|
|
3023
3027
|
users?: Record<string, "id" | "email"> | undefined;
|
|
3028
|
+
missing?: "remove" | undefined;
|
|
3024
3029
|
}, {
|
|
3025
3030
|
id: string;
|
|
3026
3031
|
properties: Record<string, string>;
|
|
@@ -3135,6 +3140,7 @@ export declare const ProjectionListResponseSchema: z.ZodObject<{
|
|
|
3135
3140
|
sourceTimestamp: string;
|
|
3136
3141
|
};
|
|
3137
3142
|
users?: Record<string, "id" | "email"> | undefined;
|
|
3143
|
+
missing?: "remove" | undefined;
|
|
3138
3144
|
}>, "many">;
|
|
3139
3145
|
linkProjections: z.ZodArray<z.ZodObject<{
|
|
3140
3146
|
_tag: z.ZodLiteral<"LinkProjectionDefinition">;
|
|
@@ -4545,6 +4551,7 @@ export declare const ProjectionListResponseSchema: z.ZodObject<{
|
|
|
4545
4551
|
sourceTimestamp: string;
|
|
4546
4552
|
};
|
|
4547
4553
|
users?: Record<string, "id" | "email"> | undefined;
|
|
4554
|
+
missing?: "remove" | undefined;
|
|
4548
4555
|
}[];
|
|
4549
4556
|
linkProjections: {
|
|
4550
4557
|
id: string;
|
|
@@ -4873,6 +4880,7 @@ export declare const ProjectionListResponseSchema: z.ZodObject<{
|
|
|
4873
4880
|
sourceTimestamp: string;
|
|
4874
4881
|
};
|
|
4875
4882
|
users?: Record<string, "id" | "email"> | undefined;
|
|
4883
|
+
missing?: "remove" | undefined;
|
|
4876
4884
|
}[];
|
|
4877
4885
|
linkProjections: {
|
|
4878
4886
|
id: string;
|
|
@@ -5134,6 +5142,7 @@ export declare const ProjectionResponseSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
5134
5142
|
strategy: "mostRecent";
|
|
5135
5143
|
sourceTimestamp: string;
|
|
5136
5144
|
}>]>;
|
|
5145
|
+
missing: z.ZodOptional<z.ZodLiteral<"remove">>;
|
|
5137
5146
|
latestRun: z.ZodNullable<z.ZodUnion<[z.ZodObject<{
|
|
5138
5147
|
id: z.ZodString;
|
|
5139
5148
|
projectId: z.ZodString;
|
|
@@ -5671,6 +5680,7 @@ export declare const ProjectionResponseSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
5671
5680
|
sourceTimestamp: string;
|
|
5672
5681
|
};
|
|
5673
5682
|
users?: Record<string, "id" | "email"> | undefined;
|
|
5683
|
+
missing?: "remove" | undefined;
|
|
5674
5684
|
}, {
|
|
5675
5685
|
id: string;
|
|
5676
5686
|
properties: Record<string, string>;
|
|
@@ -5785,6 +5795,7 @@ export declare const ProjectionResponseSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
5785
5795
|
sourceTimestamp: string;
|
|
5786
5796
|
};
|
|
5787
5797
|
users?: Record<string, "id" | "email"> | undefined;
|
|
5798
|
+
missing?: "remove" | undefined;
|
|
5788
5799
|
}>, z.ZodObject<{
|
|
5789
5800
|
_tag: z.ZodLiteral<"LinkProjectionDefinition">;
|
|
5790
5801
|
id: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projections.d.ts","sourceRoot":"","sources":["../../src/schemas/projections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,oBAAoB,4CAA0C,CAAA;AAC3E,eAAO,MAAM,yBAAyB,oFAOpC,CAAA;AA0DF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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sixb/server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
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.5",
|
|
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
49
|
"@sixb/cli-core": "0.2.3",
|
|
50
|
-
"@sixb/core": "0.2.
|
|
51
|
-
"@sixb/sqlite": "0.2.
|
|
50
|
+
"@sixb/core": "0.2.5",
|
|
51
|
+
"@sixb/sqlite": "0.2.5",
|
|
52
52
|
"@types/bun": "latest",
|
|
53
53
|
"typescript": "^5.7.0",
|
|
54
54
|
"yjs": "13.6.33"
|
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
|
|
|
@@ -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
|
package/src/routes/agents.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
type AgentBackgroundCommandRef,
|
|
21
21
|
type AgentComputerBackgroundCommand,
|
|
22
22
|
type AgentContextCheckpointRecord,
|
|
23
|
+
type AgentInboxItemRecord,
|
|
23
24
|
type AgentMessageRecord,
|
|
24
25
|
type AgentRunDiagnostic,
|
|
25
26
|
type AgentStorage,
|
|
@@ -48,6 +49,8 @@ import { OPENAPI_TAGS } from "../openapi/tags"
|
|
|
48
49
|
import {
|
|
49
50
|
AddAgentThreadParticipantsBodySchema,
|
|
50
51
|
AgentDescriptorSchema,
|
|
52
|
+
AgentInboxItemSchema,
|
|
53
|
+
AgentInboxListResponseSchema,
|
|
51
54
|
AgentMessageFileContentParamsSchema,
|
|
52
55
|
AgentMessageListResponseSchema,
|
|
53
56
|
AgentMessageSchema,
|
|
@@ -59,6 +62,7 @@ import {
|
|
|
59
62
|
AgentRunSchema,
|
|
60
63
|
AgentThreadContextQuerySchema,
|
|
61
64
|
AgentThreadContextSchema,
|
|
65
|
+
AgentThreadInboxParamsSchema,
|
|
62
66
|
AgentThreadListQuerySchema,
|
|
63
67
|
AgentThreadListResponseSchema,
|
|
64
68
|
AgentThreadParamsSchema,
|
|
@@ -71,6 +75,8 @@ import {
|
|
|
71
75
|
PostAgentMessageBodySchema,
|
|
72
76
|
PostAgentMessageResponseSchema,
|
|
73
77
|
RetryAgentRunResponseSchema,
|
|
78
|
+
UpdateAgentInboxItemBodySchema,
|
|
79
|
+
UpdateAgentInboxItemResponseSchema,
|
|
74
80
|
} from "../schemas/agents"
|
|
75
81
|
import { AiUsageLimitErrorResponseSchema, ErrorResponseSchema } from "../schemas/common"
|
|
76
82
|
import { FileContentQuerySchema } from "../schemas/files"
|
|
@@ -252,6 +258,27 @@ function serializeMessage(
|
|
|
252
258
|
})
|
|
253
259
|
}
|
|
254
260
|
|
|
261
|
+
export function serializeAgentInboxItem(
|
|
262
|
+
item: AgentInboxItemRecord
|
|
263
|
+
): ReturnType<typeof AgentInboxItemSchema.parse> {
|
|
264
|
+
return AgentInboxItemSchema.parse({
|
|
265
|
+
id: item.id,
|
|
266
|
+
projectId: item.projectId,
|
|
267
|
+
threadId: item.threadId,
|
|
268
|
+
messageId: item.messageId,
|
|
269
|
+
seq: item.seq,
|
|
270
|
+
authorPrincipal: item.authorPrincipal,
|
|
271
|
+
mode: item.mode,
|
|
272
|
+
parts: item.parts,
|
|
273
|
+
spec: item.spec,
|
|
274
|
+
timeZone: item.timeZone,
|
|
275
|
+
locale: item.locale,
|
|
276
|
+
immediate: item.immediate === true ? true : undefined,
|
|
277
|
+
createdAt: toIsoString(item.createdAt),
|
|
278
|
+
updatedAt: toIsoString(item.updatedAt),
|
|
279
|
+
})
|
|
280
|
+
}
|
|
281
|
+
|
|
255
282
|
export function serializeAgentRun(run: AgentRunView): ReturnType<typeof AgentRunSchema.parse> {
|
|
256
283
|
return AgentRunSchema.parse({
|
|
257
284
|
id: run.id,
|
|
@@ -301,6 +328,27 @@ async function getAgentMessageFileContentThread(params: {
|
|
|
301
328
|
return params.authState.sixb.agent.threads.getById(params.threadId)
|
|
302
329
|
}
|
|
303
330
|
|
|
331
|
+
/**
|
|
332
|
+
* An inbox route's error: a message a turn already read, or an inbox already full, is a conflict.
|
|
333
|
+
* The provider's message names the run, so it stays out of the answer.
|
|
334
|
+
*/
|
|
335
|
+
function handleAgentInboxRouteError(
|
|
336
|
+
error: unknown,
|
|
337
|
+
set: { status?: number | string; headers?: unknown }
|
|
338
|
+
):
|
|
339
|
+
| ReturnType<typeof handleAgentRouteError>
|
|
340
|
+
| { readonly error: string; readonly code: "invalid_state" | "inbox_limit" } {
|
|
341
|
+
if (error instanceof AgentStorageError && error.code === "invalid_state") {
|
|
342
|
+
set.status = 409
|
|
343
|
+
return { error: "A turn already read this message", code: error.code }
|
|
344
|
+
}
|
|
345
|
+
if (error instanceof AgentStorageError && error.code === "inbox_limit") {
|
|
346
|
+
set.status = 409
|
|
347
|
+
return { error: "Too many messages are waiting in this conversation", code: error.code }
|
|
348
|
+
}
|
|
349
|
+
return handleAgentRouteError(error, set)
|
|
350
|
+
}
|
|
351
|
+
|
|
304
352
|
export function handleAgentRouteError(
|
|
305
353
|
error: unknown,
|
|
306
354
|
set: { status?: number | string; headers?: unknown }
|
|
@@ -845,6 +893,43 @@ export function registerAgentRoutes(app: Elysia, host: SixbHostView) {
|
|
|
845
893
|
},
|
|
846
894
|
}
|
|
847
895
|
)
|
|
896
|
+
.post(
|
|
897
|
+
"/api/agent-threads/:threadId/sandbox/restore",
|
|
898
|
+
async (context) => {
|
|
899
|
+
try {
|
|
900
|
+
const sixb = requireRequestSixb(context)
|
|
901
|
+
const thread = await sixb.agent.threads.restoreSandbox(
|
|
902
|
+
context.params.threadId,
|
|
903
|
+
context.body
|
|
904
|
+
)
|
|
905
|
+
return serializeThread(host, thread, requestActor(sixb))
|
|
906
|
+
} catch (error) {
|
|
907
|
+
if (error instanceof AgentStorageError && error.code === "invalid_state") {
|
|
908
|
+
context.set.status = 409
|
|
909
|
+
return { error: "Sandbox state changed or a run is active. Reload and try again." }
|
|
910
|
+
}
|
|
911
|
+
return handleAgentRouteError(error, context.set)
|
|
912
|
+
}
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
params: AgentThreadParamsSchema,
|
|
916
|
+
body: z.object({ expectedSandboxName: z.string().min(1) }).strict(),
|
|
917
|
+
response: {
|
|
918
|
+
200: AgentThreadSchema,
|
|
919
|
+
400: ErrorResponseSchema,
|
|
920
|
+
403: AgentRequestErrorResponseSchema,
|
|
921
|
+
404: ErrorResponseSchema,
|
|
922
|
+
409: AgentRequestErrorResponseSchema,
|
|
923
|
+
},
|
|
924
|
+
detail: {
|
|
925
|
+
summary:
|
|
926
|
+
"Explicitly go on in the workspace a failed save left, with its files as they were",
|
|
927
|
+
operationId: "restoreAgentThreadSandbox",
|
|
928
|
+
tags: [OPENAPI_TAGS.agentThreads.name],
|
|
929
|
+
security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
|
|
930
|
+
},
|
|
931
|
+
}
|
|
932
|
+
)
|
|
848
933
|
.get(
|
|
849
934
|
"/api/agent-threads/:threadId/messages",
|
|
850
935
|
async (context) => {
|
|
@@ -959,14 +1044,19 @@ export function registerAgentRoutes(app: Elysia, host: SixbHostView) {
|
|
|
959
1044
|
context: parsed.context,
|
|
960
1045
|
messageId: parsed.messageId,
|
|
961
1046
|
}
|
|
962
|
-
const
|
|
1047
|
+
const sent = await sixb.agent.runs.send({
|
|
1048
|
+
...requestInput,
|
|
1049
|
+
delivery: parsed.delivery,
|
|
1050
|
+
})
|
|
963
1051
|
|
|
964
1052
|
set.status = 202
|
|
965
|
-
return PostAgentMessageResponseSchema.parse(
|
|
966
|
-
|
|
967
|
-
|
|
1053
|
+
return PostAgentMessageResponseSchema.parse(
|
|
1054
|
+
sent.kind === "turn"
|
|
1055
|
+
? { run: serializeAgentRun(sent.run) }
|
|
1056
|
+
: { item: serializeAgentInboxItem(sent.item) }
|
|
1057
|
+
)
|
|
968
1058
|
} catch (error) {
|
|
969
|
-
return
|
|
1059
|
+
return handleAgentInboxRouteError(error, set)
|
|
970
1060
|
}
|
|
971
1061
|
},
|
|
972
1062
|
{
|
|
@@ -990,6 +1080,114 @@ export function registerAgentRoutes(app: Elysia, host: SixbHostView) {
|
|
|
990
1080
|
},
|
|
991
1081
|
}
|
|
992
1082
|
)
|
|
1083
|
+
.get(
|
|
1084
|
+
"/api/agent-threads/:threadId/inbox",
|
|
1085
|
+
async (context) => {
|
|
1086
|
+
const { params, set } = context
|
|
1087
|
+
const sixb = requireRequestSixb(context)
|
|
1088
|
+
try {
|
|
1089
|
+
if (!host.storage.agents) {
|
|
1090
|
+
return missingAgentStorageResponse(set)
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
const items = await sixb.agent.inbox.list(params.threadId)
|
|
1094
|
+
return AgentInboxListResponseSchema.parse({
|
|
1095
|
+
items: items.map(serializeAgentInboxItem),
|
|
1096
|
+
})
|
|
1097
|
+
} catch (error) {
|
|
1098
|
+
return handleAgentRouteError(error, set)
|
|
1099
|
+
}
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
params: AgentThreadParamsSchema,
|
|
1103
|
+
response: {
|
|
1104
|
+
200: AgentInboxListResponseSchema,
|
|
1105
|
+
400: AgentRequestErrorResponseSchema,
|
|
1106
|
+
404: ErrorResponseSchema,
|
|
1107
|
+
501: ErrorResponseSchema,
|
|
1108
|
+
},
|
|
1109
|
+
detail: {
|
|
1110
|
+
summary: "List agent thread inbox messages",
|
|
1111
|
+
tags: [OPENAPI_TAGS.agentThreads.name],
|
|
1112
|
+
operationId: "listAgentThreadInbox",
|
|
1113
|
+
security: accessTokenSecurityRequirement("listAgentThreadInbox"),
|
|
1114
|
+
},
|
|
1115
|
+
}
|
|
1116
|
+
)
|
|
1117
|
+
.patch(
|
|
1118
|
+
"/api/agent-threads/:threadId/inbox/:itemId",
|
|
1119
|
+
async (context) => {
|
|
1120
|
+
const { params, body, set } = context
|
|
1121
|
+
const sixb = requireRequestSixb(context)
|
|
1122
|
+
try {
|
|
1123
|
+
if (!host.storage.agents) {
|
|
1124
|
+
return missingAgentStorageResponse(set)
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
const parsed = UpdateAgentInboxItemBodySchema.parse(body)
|
|
1128
|
+
const item = await sixb.agent.inbox.update(params.threadId, params.itemId, parsed)
|
|
1129
|
+
return UpdateAgentInboxItemResponseSchema.parse({
|
|
1130
|
+
item: serializeAgentInboxItem(item),
|
|
1131
|
+
})
|
|
1132
|
+
} catch (error) {
|
|
1133
|
+
return handleAgentInboxRouteError(error, set)
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
params: AgentThreadInboxParamsSchema,
|
|
1138
|
+
body: UpdateAgentInboxItemBodySchema,
|
|
1139
|
+
response: {
|
|
1140
|
+
200: UpdateAgentInboxItemResponseSchema,
|
|
1141
|
+
400: AgentRequestErrorResponseSchema,
|
|
1142
|
+
403: AgentRequestErrorResponseSchema,
|
|
1143
|
+
404: ErrorResponseSchema,
|
|
1144
|
+
409: AgentRequestErrorResponseSchema,
|
|
1145
|
+
501: ErrorResponseSchema,
|
|
1146
|
+
},
|
|
1147
|
+
detail: {
|
|
1148
|
+
summary: "Update a waiting agent thread message",
|
|
1149
|
+
tags: [OPENAPI_TAGS.agentThreads.name],
|
|
1150
|
+
operationId: "updateAgentThreadInboxItem",
|
|
1151
|
+
security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
|
|
1152
|
+
},
|
|
1153
|
+
}
|
|
1154
|
+
)
|
|
1155
|
+
.delete(
|
|
1156
|
+
"/api/agent-threads/:threadId/inbox/:itemId",
|
|
1157
|
+
async (context) => {
|
|
1158
|
+
const { params, set } = context
|
|
1159
|
+
const sixb = requireRequestSixb(context)
|
|
1160
|
+
try {
|
|
1161
|
+
if (!host.storage.agents) {
|
|
1162
|
+
return missingAgentStorageResponse(set)
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
await sixb.agent.inbox.remove(params.threadId, params.itemId)
|
|
1166
|
+
|
|
1167
|
+
set.status = 204
|
|
1168
|
+
return
|
|
1169
|
+
} catch (error) {
|
|
1170
|
+
return handleAgentInboxRouteError(error, set)
|
|
1171
|
+
}
|
|
1172
|
+
},
|
|
1173
|
+
{
|
|
1174
|
+
params: AgentThreadInboxParamsSchema,
|
|
1175
|
+
response: {
|
|
1176
|
+
204: z.void(),
|
|
1177
|
+
400: AgentRequestErrorResponseSchema,
|
|
1178
|
+
403: AgentRequestErrorResponseSchema,
|
|
1179
|
+
404: ErrorResponseSchema,
|
|
1180
|
+
409: AgentRequestErrorResponseSchema,
|
|
1181
|
+
501: ErrorResponseSchema,
|
|
1182
|
+
},
|
|
1183
|
+
detail: {
|
|
1184
|
+
summary: "Withdraw a waiting agent thread message",
|
|
1185
|
+
tags: [OPENAPI_TAGS.agentThreads.name],
|
|
1186
|
+
operationId: "withdrawAgentThreadInboxItem",
|
|
1187
|
+
security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
|
|
1188
|
+
},
|
|
1189
|
+
}
|
|
1190
|
+
)
|
|
993
1191
|
.post(
|
|
994
1192
|
"/api/agent-threads/:threadId/cancel",
|
|
995
1193
|
async (context) => {
|
|
@@ -8,7 +8,9 @@ import {
|
|
|
8
8
|
FRAME_REFERENCE_PREFIX,
|
|
9
9
|
frameEntries,
|
|
10
10
|
frameLayout,
|
|
11
|
+
frozenDocumentHtml,
|
|
11
12
|
injectFrameAssets,
|
|
13
|
+
markDocumentSections,
|
|
12
14
|
resolveArtifactFrame,
|
|
13
15
|
rewriteFrameReferences,
|
|
14
16
|
} from "@sixb/core/internal/artifacts/frames"
|
|
@@ -31,9 +33,9 @@ interface FrameContext {
|
|
|
31
33
|
/**
|
|
32
34
|
* Serves a version's files to its sandboxed frame, under the token a frame link carries: the token
|
|
33
35
|
* is the credential, so the route is public. Each entry gets its layout's kit and the runtime,
|
|
34
|
-
* which are served beside the files. A canvas's board
|
|
35
|
-
* editing: its static elements marked with their addresses. Hidden from
|
|
36
|
-
* never build them.
|
|
36
|
+
* which are served beside the files. A canvas's board, or a designed document, asked for with
|
|
37
|
+
* `?sixb-edit` is served for editing: its static elements marked with their addresses. Hidden from
|
|
38
|
+
* OpenAPI: clients receive frame links, they never build them.
|
|
37
39
|
*/
|
|
38
40
|
export function registerArtifactFrameRoutes(
|
|
39
41
|
app: Elysia,
|
|
@@ -110,7 +112,7 @@ async function frameResponse(
|
|
|
110
112
|
const file = version.files.find((candidate) => candidate.path === path)
|
|
111
113
|
if (!file) return notFound()
|
|
112
114
|
|
|
113
|
-
const layout = frameLayout(version
|
|
115
|
+
const layout = frameLayout(version)
|
|
114
116
|
if (!lent && layout && frameEntries(version).includes(file.path)) {
|
|
115
117
|
const opened = await openFileRef(host.blobStorage, file.file)
|
|
116
118
|
if (!opened) return notFound()
|
|
@@ -119,16 +121,27 @@ async function frameResponse(
|
|
|
119
121
|
if (options.head) return new Response(null, { headers })
|
|
120
122
|
const text = await new Response(opened.body).text()
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
//
|
|
124
|
+
const { outline } = version
|
|
125
|
+
// A canvas's board, or a designed document, served for editing has its static elements
|
|
126
|
+
// marked with their addresses, for the runtime to report and edit them by.
|
|
124
127
|
const editing =
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
(outline.kind === "canvas" || outline.kind === "document") &&
|
|
129
|
+
new URL(request.url).searchParams.has("sixb-edit")
|
|
130
|
+
const marked = editing ? annotateBoard(text) : text
|
|
131
|
+
// A frozen designed document shows the values written in when it was frozen: its fields are
|
|
132
|
+
// served unmarked, so its frame reads none again.
|
|
133
|
+
const shown =
|
|
134
|
+
outline.kind === "document" && version.frozenAt ? frozenDocumentHtml(marked) : marked
|
|
135
|
+
// A designed document's headings carry their sections' slugs, to open it at one, and its
|
|
136
|
+
// runtime gets its paper, to cut it into pages.
|
|
137
|
+
const source =
|
|
138
|
+
outline.kind === "document" ? markDocumentSections(shown, outline.headings) : shown
|
|
127
139
|
return new Response(
|
|
128
140
|
injectFrameAssets(
|
|
129
141
|
rewriteFrameReferences(source, frame.targets, file.path),
|
|
130
142
|
layout,
|
|
131
|
-
file.path
|
|
143
|
+
file.path,
|
|
144
|
+
outline.kind === "document" ? outline.paper : undefined
|
|
132
145
|
),
|
|
133
146
|
{ headers }
|
|
134
147
|
)
|