@sixb/server 0.1.20 → 0.1.22
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/artifacts/frame.d.ts +18 -0
- package/dist/artifacts/frame.d.ts.map +1 -0
- package/dist/auth/browser-origin.d.ts +10 -1
- package/dist/auth/browser-origin.d.ts.map +1 -1
- package/dist/auth/experience.d.ts +1 -0
- package/dist/auth/experience.d.ts.map +1 -1
- package/dist/auth/public-routes.d.ts.map +1 -1
- package/dist/auth/responses.d.ts +1 -1
- package/dist/auth/responses.d.ts.map +1 -1
- package/dist/auth/scope.d.ts +19 -3
- package/dist/auth/scope.d.ts.map +1 -1
- package/dist/files/content.d.ts +2 -3
- package/dist/files/content.d.ts.map +1 -1
- package/dist/index.js +10636 -7071
- package/dist/index.js.map +56 -38
- package/dist/models/display.d.ts +27 -0
- package/dist/models/display.d.ts.map +1 -1
- package/dist/openapi/components.d.ts +14 -0
- package/dist/openapi/components.d.ts.map +1 -0
- package/dist/openapi/tags.d.ts +22 -2
- package/dist/openapi/tags.d.ts.map +1 -1
- package/dist/registerRoutes.d.ts +3 -0
- package/dist/registerRoutes.d.ts.map +1 -1
- package/dist/routes/actions.d.ts +5 -5
- package/dist/routes/activity.d.ts +35 -0
- package/dist/routes/activity.d.ts.map +1 -0
- package/dist/routes/agent-api-gateway.d.ts.map +1 -1
- package/dist/routes/agent-approval-gate.d.ts +27 -0
- package/dist/routes/agent-approval-gate.d.ts.map +1 -0
- package/dist/routes/agent-approvals.d.ts +599 -0
- package/dist/routes/agent-approvals.d.ts.map +1 -0
- package/dist/routes/agent-children.d.ts +318 -0
- package/dist/routes/agent-children.d.ts.map +1 -0
- package/dist/routes/agent-memory.d.ts +267 -0
- package/dist/routes/agent-memory.d.ts.map +1 -0
- package/dist/routes/agents.d.ts +1008 -98
- 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 +98 -0
- package/dist/routes/artifact-frames.d.ts.map +1 -0
- package/dist/routes/artifacts.d.ts +1508 -0
- package/dist/routes/artifacts.d.ts.map +1 -0
- package/dist/routes/auth.d.ts +117 -11
- package/dist/routes/auth.d.ts.map +1 -1
- package/dist/routes/connector-connection-runs.d.ts +84 -84
- package/dist/routes/connector-connections.d.ts +2 -2
- package/dist/routes/connectors.d.ts +2 -2
- package/dist/routes/datasets.d.ts +27 -27
- package/dist/routes/events.d.ts +5 -5
- package/dist/routes/files.d.ts +14 -14
- package/dist/routes/files.d.ts.map +1 -1
- package/dist/routes/links.d.ts +2 -2
- package/dist/routes/logs.d.ts +5 -5
- package/dist/routes/model-calls.d.ts +155 -0
- package/dist/routes/model-calls.d.ts.map +1 -0
- package/dist/routes/model-generations.d.ts +400 -0
- package/dist/routes/model-generations.d.ts.map +1 -0
- package/dist/routes/models.d.ts +434 -1
- package/dist/routes/models.d.ts.map +1 -1
- package/dist/routes/objects.d.ts +71 -40
- package/dist/routes/objects.d.ts.map +1 -1
- package/dist/routes/observed-agent-threads.d.ts +682 -0
- package/dist/routes/observed-agent-threads.d.ts.map +1 -0
- package/dist/routes/ontology.d.ts +66 -62
- package/dist/routes/ontology.d.ts.map +1 -1
- package/dist/routes/pipelines.d.ts +53 -53
- package/dist/routes/projections.d.ts +63 -63
- package/dist/routes/rules.d.ts +2 -2
- package/dist/routes/share-grants.d.ts +4 -4
- package/dist/routes/syncs.d.ts +18 -18
- package/dist/routes/users.d.ts +117 -0
- package/dist/routes/users.d.ts.map +1 -0
- package/dist/routes/webhook-runs.d.ts +1 -1
- package/dist/routes/workflows.d.ts +142 -76
- package/dist/routes/workflows.d.ts.map +1 -1
- package/dist/routes/ws/agents.d.ts +7 -2
- package/dist/routes/ws/agents.d.ts.map +1 -1
- package/dist/routes/ws/events.d.ts +6 -6
- package/dist/routes/ws/events.d.ts.map +1 -1
- package/dist/routes/ws/logs.d.ts +14 -14
- package/dist/routes/ws/subscription-hub.d.ts +8 -3
- package/dist/routes/ws/subscription-hub.d.ts.map +1 -1
- package/dist/schemas/actions.d.ts +15 -15
- package/dist/schemas/activity.d.ts +1298 -0
- package/dist/schemas/activity.d.ts.map +1 -0
- package/dist/schemas/agent-approvals.d.ts +1091 -0
- package/dist/schemas/agent-approvals.d.ts.map +1 -0
- package/dist/schemas/agent-memory.d.ts +250 -0
- package/dist/schemas/agent-memory.d.ts.map +1 -0
- package/dist/schemas/agents.d.ts +5485 -460
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/ai-accounting.d.ts +1315 -436
- package/dist/schemas/ai-accounting.d.ts.map +1 -1
- package/dist/schemas/ai-limits.d.ts +36 -36
- package/dist/schemas/ai-usage.d.ts +12 -0
- package/dist/schemas/ai-usage.d.ts.map +1 -1
- package/dist/schemas/artifacts.d.ts +1857 -0
- package/dist/schemas/artifacts.d.ts.map +1 -0
- package/dist/schemas/auth.d.ts +125 -52
- package/dist/schemas/auth.d.ts.map +1 -1
- package/dist/schemas/connectors.d.ts +42 -42
- package/dist/schemas/datasets.d.ts +108 -108
- package/dist/schemas/event-payloads.d.ts +6 -6
- package/dist/schemas/events.d.ts +32 -32
- package/dist/schemas/events.d.ts.map +1 -1
- package/dist/schemas/files.d.ts +24 -24
- package/dist/schemas/links.d.ts +2 -2
- package/dist/schemas/logs.d.ts +32 -32
- package/dist/schemas/models.d.ts +8889 -10
- package/dist/schemas/models.d.ts.map +1 -1
- package/dist/schemas/objects.d.ts +48 -12
- package/dist/schemas/objects.d.ts.map +1 -1
- package/dist/schemas/ontology.d.ts +127 -104
- package/dist/schemas/ontology.d.ts.map +1 -1
- package/dist/schemas/pipelines.d.ts +166 -166
- package/dist/schemas/projections.d.ts +346 -346
- package/dist/schemas/rules.d.ts +4 -4
- package/dist/schemas/share-grants.d.ts +14 -14
- package/dist/schemas/syncs.d.ts +40 -40
- package/dist/schemas/users.d.ts +72 -0
- package/dist/schemas/users.d.ts.map +1 -0
- package/dist/schemas/webhook-runs.d.ts +6 -6
- package/dist/schemas/workflows.d.ts +769 -254
- package/dist/schemas/workflows.d.ts.map +1 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/utils/http.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/artifacts/frame.ts +51 -0
- package/src/auth/browser-origin.ts +20 -5
- package/src/auth/experience.ts +1 -1
- package/src/auth/guard.ts +2 -2
- package/src/auth/public-routes.ts +16 -0
- package/src/auth/responses.ts +7 -6
- package/src/auth/scope.ts +32 -3
- package/src/files/content.ts +9 -13
- package/src/models/display.ts +61 -16
- package/src/openapi/components.ts +54 -0
- package/src/openapi/tags.ts +20 -0
- package/src/registerRoutes.ts +23 -0
- package/src/routes/activity.ts +327 -0
- package/src/routes/agent-api-gateway.ts +115 -91
- package/src/routes/agent-approval-gate.ts +213 -0
- package/src/routes/agent-approvals.ts +299 -0
- package/src/routes/agent-children.ts +209 -0
- package/src/routes/agent-memory.ts +210 -0
- package/src/routes/agents.ts +364 -143
- package/src/routes/ai-accounting.ts +4 -0
- package/src/routes/artifact-frames.ts +144 -0
- package/src/routes/artifacts.ts +717 -0
- package/src/routes/auth.ts +306 -13
- package/src/routes/file-downloads.ts +1 -3
- package/src/routes/files.ts +6 -7
- package/src/routes/model-calls.ts +120 -0
- package/src/routes/model-generations.ts +245 -0
- package/src/routes/models.ts +116 -9
- package/src/routes/objects.ts +55 -61
- package/src/routes/observed-agent-threads.ts +253 -0
- package/src/routes/ontology.ts +1 -0
- package/src/routes/users.ts +73 -0
- package/src/routes/workflows.ts +6 -9
- package/src/routes/ws/agents.ts +10 -5
- package/src/routes/ws/events.ts +3 -2
- package/src/routes/ws/subscription-hub.ts +53 -20
- package/src/schemas/activity.ts +287 -0
- package/src/schemas/agent-approvals.ts +129 -0
- package/src/schemas/agent-memory.ts +96 -0
- package/src/schemas/agents.ts +240 -2
- package/src/schemas/ai-accounting.ts +40 -4
- package/src/schemas/ai-usage.ts +10 -0
- package/src/schemas/artifacts.ts +246 -0
- package/src/schemas/auth.ts +25 -0
- package/src/schemas/models.ts +197 -1
- package/src/schemas/objects.ts +181 -0
- package/src/schemas/ontology.ts +1 -0
- package/src/schemas/users.ts +24 -0
- package/src/schemas/workflows.ts +2 -0
- package/src/server.ts +34 -19
- package/src/utils/http.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/schemas/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,wBAAwB,+GAA4B,CAAA;AAMjE,eAAO,MAAM,oBAAoB;;;;;;EAE/B,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;EAE3C,CAAA;AAEF,eAAO,MAAM,uBAAuB,iFAOlC,CAAA;AAEF,eAAO,MAAM,gCAAgC,6DAK3C,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;EAQlC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa3C,CAAA;AAEF,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/schemas/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,wBAAwB,+GAA4B,CAAA;AAMjE,eAAO,MAAM,oBAAoB;;;;;;EAE/B,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;EAE3C,CAAA;AAEF,eAAO,MAAM,uBAAuB,iFAOl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options: SixbServerOptions);
|
|
39
39
|
getHost(): SixbHostView;
|
|
40
|
+
/** The port the server listens on once started, so `port: 0` reports the one it bound. */
|
|
40
41
|
getPort(): number;
|
|
41
42
|
resolveAuthContext(request: Request): RequestAuthContext;
|
|
42
43
|
resolveAuthRedirectContext(request: Parameters<ResolveAuthRedirectContext>[0], input: Parameters<ResolveAuthRedirectContext>[1]): ReturnType<ResolveAuthRedirectContext>;
|
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;AAQzE,OAAO,EAAE,MAAM,EAAc,MAAM,QAAQ,CAAA;AAG3C,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;AAuB7B,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,CAAA;IAC7B,8EAA8E;IAC9E,cAAc,CAAC,EAAE,yBAAyB,CAAA;IAC1C,qEAAqE;IACrE,YAAY,CAAC,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D,iBAAiB,IAAI,yBAAyB,GAAG,SAAS;IAI1D,sBAAsB,IAAI,uBAAuB;IAI3C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAyCtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAe5B;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgP/C;AAqED,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA"}
|
package/dist/utils/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAA;AAiCnB,UAAU,gBAAgB;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,CAE/C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CAWrE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAW9E;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACjC,IAAI,EAAE,MAAM,GACX;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAGnB;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,gBAAgB,GACpB;IACD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAC5B,CA6CA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixb/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "HTTP and WebSocket API server for Sixb",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sixb",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"zod-to-json-schema": "^3.24.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@sixb/core": "0.1.
|
|
41
|
+
"@sixb/core": "0.1.22"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@sixb/auth-magic-link": "0.1.
|
|
45
|
-
"@sixb/auth-oidc": "0.1.
|
|
46
|
-
"@sixb/cli-core": "0.1.
|
|
47
|
-
"@sixb/core": "0.1.
|
|
48
|
-
"@sixb/sqlite": "0.1.
|
|
44
|
+
"@sixb/auth-magic-link": "0.1.7",
|
|
45
|
+
"@sixb/auth-oidc": "0.1.7",
|
|
46
|
+
"@sixb/cli-core": "0.1.9",
|
|
47
|
+
"@sixb/core": "0.1.22",
|
|
48
|
+
"@sixb/sqlite": "0.1.22",
|
|
49
49
|
"@types/bun": "latest",
|
|
50
50
|
"typescript": "^5.7.0"
|
|
51
51
|
},
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ARTIFACT_FRAME_ROUTE_PREFIX } from "@sixb/core/internal/artifacts/frames"
|
|
2
|
+
import {
|
|
3
|
+
type ResolvedSixbApiBrowserPolicy,
|
|
4
|
+
resolveApiBrowserPublicOrigin,
|
|
5
|
+
} from "../auth/browser-origin"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Hosts a frame may load from besides its own files: CSS and script libraries and web fonts. Each
|
|
9
|
+
* is a public CDN; a frame that uses one contacts it when it opens.
|
|
10
|
+
*/
|
|
11
|
+
const FRAME_CDN_ALLOWLIST = [
|
|
12
|
+
"https://cdn.jsdelivr.net",
|
|
13
|
+
"https://cdnjs.cloudflare.com",
|
|
14
|
+
"https://unpkg.com",
|
|
15
|
+
"https://fonts.googleapis.com",
|
|
16
|
+
"https://fonts.gstatic.com",
|
|
17
|
+
] as const
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The policy every frame response carries, 404s included. The frame is sandboxed without
|
|
21
|
+
* `allow-same-origin`, so its page cannot read the app's cookies or call the API as the reader;
|
|
22
|
+
* it loads only its own version's files, under its token, and the CDNs above; only the app's
|
|
23
|
+
* origins may show it.
|
|
24
|
+
*
|
|
25
|
+
* A page reads its queries' rows as the reader, so it posts no form, and opens no window, not
|
|
26
|
+
* even one the reader's click allows: the app opens the web links the reader follows, and its own
|
|
27
|
+
* policy keeps the frame's navigations on the frames' origin. No policy reaches WebRTC: a page's
|
|
28
|
+
* code can still connect to a server it names that way.
|
|
29
|
+
*/
|
|
30
|
+
export function frameContentSecurityPolicy(input: {
|
|
31
|
+
readonly policy: ResolvedSixbApiBrowserPolicy
|
|
32
|
+
readonly request: Request
|
|
33
|
+
readonly token: string
|
|
34
|
+
}): string {
|
|
35
|
+
const origin = resolveApiBrowserPublicOrigin(input.policy, input.request)
|
|
36
|
+
const base = `${origin}${ARTIFACT_FRAME_ROUTE_PREFIX}${input.token}/`
|
|
37
|
+
const cdn = FRAME_CDN_ALLOWLIST.join(" ")
|
|
38
|
+
return [
|
|
39
|
+
"default-src 'none'",
|
|
40
|
+
`script-src ${base} 'unsafe-inline' ${cdn}`,
|
|
41
|
+
`style-src ${base} 'unsafe-inline' ${cdn}`,
|
|
42
|
+
`img-src ${base} data: blob: ${cdn}`,
|
|
43
|
+
`font-src ${base} data: ${cdn}`,
|
|
44
|
+
`media-src ${base} data: blob:`,
|
|
45
|
+
`connect-src ${base}`,
|
|
46
|
+
"form-action 'none'",
|
|
47
|
+
"base-uri 'none'",
|
|
48
|
+
`frame-ancestors 'self' ${input.policy.allowedOrigins.join(" ")}`.trim(),
|
|
49
|
+
"sandbox allow-scripts allow-modals",
|
|
50
|
+
].join("; ")
|
|
51
|
+
}
|
|
@@ -11,7 +11,11 @@ export interface ResolvedSixbApiBrowserPolicy {
|
|
|
11
11
|
|
|
12
12
|
export interface RequestAuthContext {
|
|
13
13
|
readonly browserOrigin?: string
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Where a signed-out visitor to one of the API's own pages comes back to: its public origin.
|
|
16
|
+
* Behind a proxy that ends TLS, the request's own URL is `http://` and sign-in refuses it.
|
|
17
|
+
*/
|
|
18
|
+
readonly returnToOrigin?: string
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
export interface AuthInvitationRedirectInput {
|
|
@@ -76,23 +80,34 @@ export function resolveApiBrowserAuthContext(
|
|
|
76
80
|
request: Request
|
|
77
81
|
): RequestAuthContext {
|
|
78
82
|
const origin = normalizeRequestOrigin(request)
|
|
83
|
+
const returnToOrigin = resolveApiBrowserPublicOrigin(policy, request)
|
|
79
84
|
if (!origin) {
|
|
80
|
-
return {
|
|
85
|
+
return { returnToOrigin }
|
|
81
86
|
}
|
|
82
87
|
|
|
83
88
|
if (isAllowedOrigin(policy, request, origin)) {
|
|
84
|
-
return { browserOrigin: origin,
|
|
89
|
+
return { browserOrigin: origin, returnToOrigin }
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
throw new BrowserOriginError(`[SixbServer] Browser origin '${origin}' is not allowed.`)
|
|
88
93
|
}
|
|
89
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Whether the request's Origin may call the API with a session. An Origin that is not an http(s)
|
|
97
|
+
* origin, such as a sandboxed frame's `null`, is not allowed, never an error: the CORS plugin asks
|
|
98
|
+
* this of every request, and a throw there replaces the route's response with the error's.
|
|
99
|
+
*/
|
|
90
100
|
export function isAllowedApiBrowserOrigin(
|
|
91
101
|
policy: ResolvedSixbApiBrowserPolicy,
|
|
92
102
|
request: Request
|
|
93
103
|
): boolean {
|
|
94
|
-
|
|
95
|
-
|
|
104
|
+
try {
|
|
105
|
+
const origin = normalizeRequestOrigin(request)
|
|
106
|
+
return origin !== null && isAllowedOrigin(policy, request, origin)
|
|
107
|
+
} catch (error) {
|
|
108
|
+
if (error instanceof BrowserOriginError) return false
|
|
109
|
+
throw error
|
|
110
|
+
}
|
|
96
111
|
}
|
|
97
112
|
|
|
98
113
|
export function resolveApiBrowserAuthRedirectContext(
|
package/src/auth/experience.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface ProjectAuthExperience extends SixbAuthExperienceOptions {
|
|
|
15
15
|
export type AuthExperiencePageState =
|
|
16
16
|
| { readonly kind: "signIn" }
|
|
17
17
|
| { readonly kind: "checkEmail" }
|
|
18
|
-
| { readonly kind: "confirm"; readonly email?: string }
|
|
18
|
+
| { readonly kind: "confirm"; readonly email?: string; readonly firstSignIn?: true }
|
|
19
19
|
| { readonly kind: "invalidLink" }
|
|
20
20
|
| { readonly kind: "error" }
|
|
21
21
|
|
package/src/auth/guard.ts
CHANGED
|
@@ -69,7 +69,7 @@ export class ServerAuthGuard {
|
|
|
69
69
|
return {
|
|
70
70
|
kind: "deny",
|
|
71
71
|
response: htmlAuthRedirectResponse(request, {
|
|
72
|
-
|
|
72
|
+
returnToOrigin: authContext.returnToOrigin,
|
|
73
73
|
}),
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -112,7 +112,7 @@ export class ServerAuthGuard {
|
|
|
112
112
|
return {
|
|
113
113
|
kind: "deny",
|
|
114
114
|
response: htmlAuthRedirectResponse(request, {
|
|
115
|
-
|
|
115
|
+
returnToOrigin: authContext.returnToOrigin,
|
|
116
116
|
}),
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AGENT_API_GATEWAY_PREFIX } from "@sixb/core/internal/agents"
|
|
2
|
+
import { ARTIFACT_FRAME_ROUTE_PREFIX } from "@sixb/core/internal/artifacts/frames"
|
|
2
3
|
import { isCsrfExemptMethod } from "@sixb/core/internal/auth"
|
|
3
4
|
import { FILE_DOWNLOAD_ROUTE_PREFIX } from "@sixb/core/internal/blob-storage"
|
|
4
5
|
import { isSharedAccessPublicPath } from "./shared-access"
|
|
@@ -71,6 +72,15 @@ export function isPublicRoute(pathname: string, method: string): boolean {
|
|
|
71
72
|
return true
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
// A frame's page is sandboxed with an opaque origin, so it cannot hold a session either. The
|
|
76
|
+
// token in a frame link's path is the credential.
|
|
77
|
+
if (
|
|
78
|
+
pathname.startsWith(ARTIFACT_FRAME_ROUTE_PREFIX) &&
|
|
79
|
+
(normalizedMethod === "GET" || normalizedMethod === "HEAD")
|
|
80
|
+
) {
|
|
81
|
+
return true
|
|
82
|
+
}
|
|
83
|
+
|
|
74
84
|
// Public because a webhook cannot carry a session: the signature its connector
|
|
75
85
|
// verifies is the credential. POST only — `WebhookDefinition.method` is the literal
|
|
76
86
|
// `"POST"`, so nothing else is ever registered here, and the allow-list should not be
|
|
@@ -114,6 +124,12 @@ export function isPublicRoute(pathname: string, method: string): boolean {
|
|
|
114
124
|
return true
|
|
115
125
|
}
|
|
116
126
|
|
|
127
|
+
// Where a signed-out browser waits to be approved from another one. The HttpOnly cookie it was
|
|
128
|
+
// given when it started is the credential, and the page only ever reads.
|
|
129
|
+
if (pathname === "/auth/sign-in/device" && normalizedMethod === "GET") {
|
|
130
|
+
return true
|
|
131
|
+
}
|
|
132
|
+
|
|
117
133
|
// GET renders the magic-link confirmation page; POST consumes the emailed
|
|
118
134
|
// token. The token itself is the credential, and no CSRF cookie exists yet.
|
|
119
135
|
if (
|
package/src/auth/responses.ts
CHANGED
|
@@ -15,14 +15,15 @@ export function jsonForbiddenResponse(message = "Forbidden"): Response {
|
|
|
15
15
|
export function htmlAuthRedirectResponse(
|
|
16
16
|
request: Request,
|
|
17
17
|
options: {
|
|
18
|
-
readonly
|
|
18
|
+
readonly returnToOrigin?: string
|
|
19
19
|
} = {}
|
|
20
20
|
): Response {
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const returnTo = returnToForRequest(request)
|
|
22
|
+
const params = new URLSearchParams({
|
|
23
|
+
returnTo: options.returnToOrigin
|
|
24
|
+
? new URL(returnTo, options.returnToOrigin).toString()
|
|
25
|
+
: returnTo,
|
|
26
|
+
})
|
|
26
27
|
|
|
27
28
|
return new Response(null, {
|
|
28
29
|
status: 302,
|
package/src/auth/scope.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { type Principal, SYSTEM_PRINCIPAL } from "@sixb/core"
|
|
2
|
+
import { type AgentExecutionAuthorization, agentServiceAccountId } from "@sixb/core/internal/agents"
|
|
1
3
|
import type { AuthenticatedRequestAuthSession } from "@sixb/core/internal/auth"
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
+
import type { Sixb } from "@sixb/core/internal/request-execution"
|
|
5
|
+
import type {
|
|
6
|
+
AgentRunRecord,
|
|
7
|
+
ConversationAgentRunRecord,
|
|
8
|
+
ExecutionRecord,
|
|
9
|
+
} from "@sixb/core/storage"
|
|
4
10
|
import type { ServerAuthGuardDecision } from "./guard"
|
|
5
11
|
|
|
6
12
|
/**
|
|
@@ -20,8 +26,17 @@ export interface RequestAuthState {
|
|
|
20
26
|
| { readonly kind: "workflow"; readonly nodeRunId: string }
|
|
21
27
|
}
|
|
22
28
|
|
|
29
|
+
/** The agent run execution a gateway request runs inside, read from server-side records only. */
|
|
30
|
+
export interface AgentGatewayRunExecution {
|
|
31
|
+
readonly execution: ExecutionRecord
|
|
32
|
+
readonly actorId?: string
|
|
33
|
+
readonly runId: string
|
|
34
|
+
readonly attempt: number
|
|
35
|
+
readonly authorization: AgentExecutionAuthorization
|
|
36
|
+
}
|
|
37
|
+
|
|
23
38
|
export interface InternalRequestAuthState {
|
|
24
|
-
readonly
|
|
39
|
+
readonly runExecution: AgentGatewayRunExecution
|
|
25
40
|
readonly agentRun?: AgentRunRecord
|
|
26
41
|
readonly agentExecution?: RequestAuthState["agentExecution"]
|
|
27
42
|
}
|
|
@@ -69,6 +84,20 @@ export function requireRequestSixb(context: unknown): Sixb {
|
|
|
69
84
|
return sixb
|
|
70
85
|
}
|
|
71
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Who performs the request: a managed Agent run's service account, otherwise the requester.
|
|
89
|
+
* Records of who submitted or cancelled something, and upload-session ownership, name the actor;
|
|
90
|
+
* what the request starts keeps the requester.
|
|
91
|
+
*/
|
|
92
|
+
export function requestActor(sixb: Pick<Sixb, "execution">): Principal {
|
|
93
|
+
const { executor, requestedBy } = sixb.execution
|
|
94
|
+
if (executor.type === "agent" && executor.actorId !== undefined) {
|
|
95
|
+
return { type: "serviceAccount", id: agentServiceAccountId(executor.actorId) }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return requestedBy ?? SYSTEM_PRINCIPAL
|
|
99
|
+
}
|
|
100
|
+
|
|
72
101
|
/**
|
|
73
102
|
* The caller the auth guard resolved for this request. Null on public routes, for shared-access and
|
|
74
103
|
* agent-gateway requests, and when auth is disabled.
|
package/src/files/content.ts
CHANGED
|
@@ -15,9 +15,8 @@ export interface FileContentResponseInput {
|
|
|
15
15
|
readonly fileRef: FileRef
|
|
16
16
|
readonly disposition?: FileContentDisposition
|
|
17
17
|
readonly head?: boolean
|
|
18
|
-
|
|
19
|
-
readonly
|
|
20
|
-
readonly ifRangeHeader?: string | null
|
|
18
|
+
/** The request being answered: its Range, If-Range, and If-None-Match headers apply. */
|
|
19
|
+
readonly request?: Request
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
export interface FileContentQuery {
|
|
@@ -161,18 +160,17 @@ export async function createFileContentResponse(
|
|
|
161
160
|
const canReadRange = supportsRangeRead(input.blobStorage)
|
|
162
161
|
const headers = fileContentHeaders(input.fileRef, stat, input.disposition, canReadRange)
|
|
163
162
|
const etag = headers.get("etag")!
|
|
164
|
-
|
|
163
|
+
const requestHeaders = input.request?.headers
|
|
164
|
+
if (matchesIfNoneMatch(requestHeaders?.get("if-none-match"), etag)) {
|
|
165
165
|
headers.delete("content-length")
|
|
166
166
|
return new Response(null, { status: 304, headers })
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
// Date validators are unsupported: only a strong ETag can validate a range.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
) {
|
|
175
|
-
const range = parseSingleByteRange(input.rangeHeader, stat.sizeBytes)
|
|
170
|
+
const rangeHeader = requestHeaders?.get("range")
|
|
171
|
+
const ifRangeHeader = requestHeaders?.get("if-range")
|
|
172
|
+
if (canReadRange && rangeHeader && (ifRangeHeader == null || ifRangeHeader.trim() === etag)) {
|
|
173
|
+
const range = parseSingleByteRange(rangeHeader, stat.sizeBytes)
|
|
176
174
|
if (!range) {
|
|
177
175
|
return rangeNotSatisfiableResponse(stat.sizeBytes)
|
|
178
176
|
}
|
|
@@ -237,9 +235,7 @@ export async function createContextualFileContentResponse<TQuery extends FileCon
|
|
|
237
235
|
fileRef,
|
|
238
236
|
disposition: parsed.disposition,
|
|
239
237
|
head: input.head,
|
|
240
|
-
|
|
241
|
-
ifNoneMatchHeader: input.request.headers.get("if-none-match"),
|
|
242
|
-
ifRangeHeader: input.request.headers.get("if-range"),
|
|
238
|
+
request: input.request,
|
|
243
239
|
})
|
|
244
240
|
if (!response) {
|
|
245
241
|
return fileContentNotFound(input.set, missingMessage)
|
package/src/models/display.ts
CHANGED
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
import type { LanguageModelEntry } from "@sixb/core"
|
|
2
2
|
import {
|
|
3
3
|
defineLanguageModel,
|
|
4
|
+
defineModelRateCard,
|
|
4
5
|
type LanguageModelDefinition,
|
|
5
6
|
ModelCatalogUnavailableError,
|
|
7
|
+
type ModelRateCard,
|
|
6
8
|
type ModelReasoningLevel,
|
|
7
9
|
} from "@sixb/core/models"
|
|
8
10
|
|
|
9
11
|
/** Presentation only; the configured provider remains the source of model capabilities. */
|
|
10
12
|
export async function languageModelDisplay(entry: LanguageModelEntry) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const resolved = await entry.model.resolve?.()
|
|
14
|
-
if (resolved) {
|
|
15
|
-
if (resolved.providerId !== entry.provider || resolved.modelId !== entry.modelId) {
|
|
16
|
-
throw new Error("[SixbServer] Resolved model identity does not match its catalog entry.")
|
|
17
|
-
}
|
|
18
|
-
definition = resolved.definition
|
|
19
|
-
}
|
|
20
|
-
} catch (error) {
|
|
21
|
-
if (!(error instanceof ModelCatalogUnavailableError)) throw error
|
|
22
|
-
console.warn(
|
|
23
|
-
`[SixbServer] Model metadata is unavailable for '${entry.provider}/${entry.modelId}'; using its configured definition.`
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
definition = defineLanguageModel(definition)
|
|
13
|
+
const model = await resolvedForDisplay(entry)
|
|
14
|
+
const definition = defineLanguageModel(model.definition)
|
|
27
15
|
if (definition.providerId !== entry.provider || definition.modelId !== entry.modelId) {
|
|
28
16
|
throw new Error("[SixbServer] Model definition identity does not match its catalog entry.")
|
|
29
17
|
}
|
|
@@ -62,6 +50,63 @@ export async function languageModelDisplay(entry: LanguageModelEntry) {
|
|
|
62
50
|
: { contextWindowTokens: definition.contextWindow }),
|
|
63
51
|
},
|
|
64
52
|
reasoningLevels: reasoningLevels(definition),
|
|
53
|
+
...rateCardDisplay(entry, model.rateCard),
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface DisplayedBinding<TModel> {
|
|
58
|
+
readonly provider: string
|
|
59
|
+
readonly modelId: string
|
|
60
|
+
readonly model: TModel & {
|
|
61
|
+
readonly providerId: string
|
|
62
|
+
readonly modelId: string
|
|
63
|
+
resolve?(): Promise<TModel>
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A binding resolved for its metadata and prices, never for inference. An unavailable provider
|
|
69
|
+
* catalog leaves the configured binding, so the catalog still lists every model.
|
|
70
|
+
*/
|
|
71
|
+
export async function resolvedForDisplay<
|
|
72
|
+
TModel extends { readonly providerId: string; readonly modelId: string },
|
|
73
|
+
>(entry: DisplayedBinding<TModel>): Promise<TModel> {
|
|
74
|
+
try {
|
|
75
|
+
const resolved = await entry.model.resolve?.()
|
|
76
|
+
if (!resolved) return entry.model
|
|
77
|
+
if (resolved.providerId !== entry.provider || resolved.modelId !== entry.modelId) {
|
|
78
|
+
throw new Error("[SixbServer] Resolved model identity does not match its catalog entry.")
|
|
79
|
+
}
|
|
80
|
+
return resolved
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if (!(error instanceof ModelCatalogUnavailableError)) throw error
|
|
83
|
+
console.warn(
|
|
84
|
+
`[SixbServer] Model metadata is unavailable for '${entry.provider}/${entry.modelId}'; using its configured definition.`
|
|
85
|
+
)
|
|
86
|
+
return entry.model
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// The catalog is read often (the model picker), so each invalid card is reported once.
|
|
91
|
+
const reportedInvalidCards = new Set<string>()
|
|
92
|
+
|
|
93
|
+
/** A binding's prices, shown only when they form a valid card. */
|
|
94
|
+
export function rateCardDisplay(
|
|
95
|
+
entry: { readonly provider: string; readonly modelId: string },
|
|
96
|
+
card: ModelRateCard | undefined
|
|
97
|
+
): { rateCard?: ModelRateCard } {
|
|
98
|
+
if (!card) return {}
|
|
99
|
+
try {
|
|
100
|
+
return { rateCard: defineModelRateCard(card) }
|
|
101
|
+
} catch {
|
|
102
|
+
const key = JSON.stringify([entry.provider, entry.modelId])
|
|
103
|
+
if (!reportedInvalidCards.has(key)) {
|
|
104
|
+
reportedInvalidCards.add(key)
|
|
105
|
+
console.warn(
|
|
106
|
+
`[SixbServer] The rate card of '${entry.provider}/${entry.modelId}' is invalid; its price is not shown.`
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
return {}
|
|
65
110
|
}
|
|
66
111
|
}
|
|
67
112
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ZodTypeAny, ZodTypeDef } from "zod"
|
|
2
|
+
import {
|
|
3
|
+
ignoreOverride,
|
|
4
|
+
type JsonSchema7Type,
|
|
5
|
+
type OverrideCallback,
|
|
6
|
+
zodToJsonSchema,
|
|
7
|
+
} from "zod-to-json-schema"
|
|
8
|
+
import {
|
|
9
|
+
AgentChildAwaitingSchema,
|
|
10
|
+
AgentChildEndedSchema,
|
|
11
|
+
AgentChildFileSchema,
|
|
12
|
+
AgentChildRunSchema,
|
|
13
|
+
AgentChildSchema,
|
|
14
|
+
} from "../schemas/agents"
|
|
15
|
+
import { jsonValueOpenApiOverride } from "../schemas/common"
|
|
16
|
+
|
|
17
|
+
// The spec inlines every schema (`$refStrategy: "none"`), so a large shape several routes return
|
|
18
|
+
// repeats in each, and the generated client repeats its type. The schemas named here are emitted
|
|
19
|
+
// once under `components.schemas`, and a `$ref` wherever a route's schema holds one of them.
|
|
20
|
+
|
|
21
|
+
const NAMED: readonly (readonly [string, ZodTypeAny])[] = [
|
|
22
|
+
["AgentChild", AgentChildSchema],
|
|
23
|
+
["AgentChildRun", AgentChildRunSchema],
|
|
24
|
+
["AgentChildFile", AgentChildFileSchema],
|
|
25
|
+
["AgentChildAwaiting", AgentChildAwaitingSchema],
|
|
26
|
+
["AgentChildEnded", AgentChildEndedSchema],
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
const nameOf = new Map<ZodTypeDef, string>(NAMED.map(([name, schema]) => [schema._def, name]))
|
|
30
|
+
|
|
31
|
+
/** The server's override: JSON values as one open schema, and the named schemas by reference. */
|
|
32
|
+
export function openApiOverride(except?: ZodTypeDef): OverrideCallback {
|
|
33
|
+
return (def, refs, seen, forceResolution) => {
|
|
34
|
+
const json = jsonValueOpenApiOverride(def, refs, seen, forceResolution)
|
|
35
|
+
if (json !== ignoreOverride) return json
|
|
36
|
+
|
|
37
|
+
const name = def === except ? undefined : nameOf.get(def)
|
|
38
|
+
return name === undefined
|
|
39
|
+
? ignoreOverride
|
|
40
|
+
: ({ $ref: `#/components/schemas/${name}` } as JsonSchema7Type)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The named schemas, each referencing the others it holds. */
|
|
45
|
+
export const NamedOpenApiSchemas = Object.fromEntries(
|
|
46
|
+
NAMED.map(([name, schema]) => [
|
|
47
|
+
name,
|
|
48
|
+
zodToJsonSchema(schema, {
|
|
49
|
+
$refStrategy: "none",
|
|
50
|
+
target: "openApi3",
|
|
51
|
+
override: openApiOverride(schema._def),
|
|
52
|
+
}),
|
|
53
|
+
])
|
|
54
|
+
)
|
package/src/openapi/tags.ts
CHANGED
|
@@ -119,10 +119,18 @@ export const OPENAPI_TAGS = {
|
|
|
119
119
|
name: "Agent Runs",
|
|
120
120
|
description: "Agent run state and cancellation",
|
|
121
121
|
},
|
|
122
|
+
agentMemory: {
|
|
123
|
+
name: "Agent Memory",
|
|
124
|
+
description: "What the Agent remembers across conversations",
|
|
125
|
+
},
|
|
122
126
|
files: {
|
|
123
127
|
name: "Files",
|
|
124
128
|
description: "File uploads and file references",
|
|
125
129
|
},
|
|
130
|
+
artifacts: {
|
|
131
|
+
name: "Artifacts",
|
|
132
|
+
description: "Versioned documents, sheets, slides, pages, and files",
|
|
133
|
+
},
|
|
126
134
|
links: {
|
|
127
135
|
name: "Links",
|
|
128
136
|
description: "Object relationship links",
|
|
@@ -139,14 +147,26 @@ export const OPENAPI_TAGS = {
|
|
|
139
147
|
name: "Logs",
|
|
140
148
|
description: "Run log stream",
|
|
141
149
|
},
|
|
150
|
+
activity: {
|
|
151
|
+
name: "Activity",
|
|
152
|
+
description: "Visits and page views in the project's app and its shared links",
|
|
153
|
+
},
|
|
142
154
|
authSessions: {
|
|
143
155
|
name: "Auth Sessions",
|
|
144
156
|
description: "Authentication sessions and sign-out",
|
|
145
157
|
},
|
|
158
|
+
authProfile: {
|
|
159
|
+
name: "Auth Profile",
|
|
160
|
+
description: "The signed-in user's own profile",
|
|
161
|
+
},
|
|
146
162
|
authMembers: {
|
|
147
163
|
name: "Auth Members",
|
|
148
164
|
description: "User membership administration",
|
|
149
165
|
},
|
|
166
|
+
users: {
|
|
167
|
+
name: "Users",
|
|
168
|
+
description: "Project member directory",
|
|
169
|
+
},
|
|
150
170
|
authInvitations: {
|
|
151
171
|
name: "Auth Invitations",
|
|
152
172
|
description: "User invitations",
|
package/src/registerRoutes.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { SixbHostView } from "@sixb/core"
|
|
2
2
|
import type { Elysia } from "elysia"
|
|
3
|
+
import type { ResolvedSixbApiBrowserPolicy } from "./auth/browser-origin"
|
|
3
4
|
import type { SharedAccessBoundary } from "./auth/shared-access"
|
|
4
5
|
import { registerActionRunRoutes } from "./routes/action-runs"
|
|
5
6
|
import { registerActionRoutes } from "./routes/actions"
|
|
7
|
+
import { registerActivityRoutes } from "./routes/activity"
|
|
6
8
|
import { registerAgentApiGatewayRoutes } from "./routes/agent-api-gateway"
|
|
9
|
+
import { registerAgentApprovalRoutes } from "./routes/agent-approvals"
|
|
10
|
+
import { registerAgentChildRoutes } from "./routes/agent-children"
|
|
11
|
+
import { registerAgentMemoryRoutes } from "./routes/agent-memory"
|
|
7
12
|
import { registerAgentRoutes } from "./routes/agents"
|
|
8
13
|
import { registerAiAccountingRoutes } from "./routes/ai-accounting"
|
|
14
|
+
import { registerArtifactFrameRoutes } from "./routes/artifact-frames"
|
|
15
|
+
import { registerArtifactRoutes } from "./routes/artifacts"
|
|
9
16
|
import {
|
|
10
17
|
type ConnectorConnectionRouteOptions,
|
|
11
18
|
registerConnectorConnectionRunRoutes,
|
|
@@ -18,8 +25,11 @@ import { registerFileDownloadRoutes } from "./routes/file-downloads"
|
|
|
18
25
|
import { registerFileRoutes } from "./routes/files"
|
|
19
26
|
import { registerLinkRoutes } from "./routes/links"
|
|
20
27
|
import { registerLogRoutes } from "./routes/logs"
|
|
28
|
+
import { registerModelCallRoutes } from "./routes/model-calls"
|
|
29
|
+
import { registerModelGenerationRoutes } from "./routes/model-generations"
|
|
21
30
|
import { registerModelRoutes } from "./routes/models"
|
|
22
31
|
import { registerObjectRoutes } from "./routes/objects"
|
|
32
|
+
import { registerObservedAgentThreadRoutes } from "./routes/observed-agent-threads"
|
|
23
33
|
import { registerOntologyRoutes } from "./routes/ontology"
|
|
24
34
|
import { registerPipelineRoutes } from "./routes/pipelines"
|
|
25
35
|
import { registerProjectRoutes } from "./routes/project"
|
|
@@ -30,17 +40,22 @@ import { registerSharedAccessRoutes } from "./routes/shared-access"
|
|
|
30
40
|
import { registerStatusRoutes } from "./routes/status"
|
|
31
41
|
import { registerSyncRoutes } from "./routes/syncs"
|
|
32
42
|
import { registerTelemetryRoutes } from "./routes/telemetry"
|
|
43
|
+
import { registerUserRoutes } from "./routes/users"
|
|
33
44
|
import { registerWebhookRunRoutes } from "./routes/webhook-runs"
|
|
34
45
|
import { registerWorkflowRoutes } from "./routes/workflows"
|
|
35
46
|
|
|
36
47
|
export interface HttpRouteOptions {
|
|
37
48
|
readonly connectorConnections: ConnectorConnectionRouteOptions
|
|
38
49
|
readonly sharedAccess: SharedAccessBoundary
|
|
50
|
+
/** Where frames are served from and which app origins may show them. */
|
|
51
|
+
readonly browserPolicy: ResolvedSixbApiBrowserPolicy
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
export function registerHttpRoutes(app: Elysia, host: SixbHostView, options: HttpRouteOptions) {
|
|
42
55
|
registerAgentApiGatewayRoutes(app, host)
|
|
43
56
|
registerAiAccountingRoutes(app, host)
|
|
57
|
+
registerModelCallRoutes(app, host)
|
|
58
|
+
registerModelGenerationRoutes(app, host)
|
|
44
59
|
registerProjectRoutes(app, host)
|
|
45
60
|
registerStatusRoutes(app, host)
|
|
46
61
|
registerConnectorRoutes(app, host)
|
|
@@ -60,11 +75,19 @@ export function registerHttpRoutes(app: Elysia, host: SixbHostView, options: Htt
|
|
|
60
75
|
registerFileDownloadRoutes(app, host)
|
|
61
76
|
registerActionRunRoutes(app, host)
|
|
62
77
|
registerAgentRoutes(app, host)
|
|
78
|
+
registerAgentChildRoutes(app, host)
|
|
79
|
+
registerAgentApprovalRoutes(app, host)
|
|
80
|
+
registerObservedAgentThreadRoutes(app, host)
|
|
81
|
+
registerAgentMemoryRoutes(app)
|
|
82
|
+
registerArtifactRoutes(app, host)
|
|
83
|
+
registerArtifactFrameRoutes(app, host, options.browserPolicy)
|
|
63
84
|
registerModelRoutes(app, host)
|
|
64
85
|
registerLinkRoutes(app, host)
|
|
65
86
|
registerTelemetryRoutes(app, host)
|
|
66
87
|
registerEventRoutes(app, host)
|
|
67
88
|
registerLogRoutes(app, host)
|
|
89
|
+
registerActivityRoutes(app, host)
|
|
90
|
+
registerUserRoutes(app, host)
|
|
68
91
|
registerProjectionRoutes(app, host)
|
|
69
92
|
registerWebhookRunRoutes(app, host)
|
|
70
93
|
|