enterprise (#4617)

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com>
This commit is contained in:
Dax
2025-11-21 20:41:27 -05:00
committed by GitHub
parent 76192fbced
commit 49408c00e9
1205 changed files with 3057 additions and 1491 deletions

View File

@@ -16,6 +16,7 @@ import { SessionPrompt } from "./prompt"
import { fn } from "@/util/fn"
import { Command } from "../command"
import { Snapshot } from "@/snapshot"
import { ShareNext } from "@/share/share-next"
export namespace Session {
const log = Log.create({ service: "session" })
@@ -221,6 +222,15 @@ export namespace Session {
throw new Error("Sharing is disabled in configuration")
}
if (cfg.enterprise?.url) {
const share = await ShareNext.create(id)
await update(id, (draft) => {
draft.share = {
url: share.url,
}
})
}
const session = await get(id)
if (session.share) return session.share
const share = await Share.create(id)
@@ -241,6 +251,13 @@ export namespace Session {
})
export const unshare = fn(Identifier.schema("session"), async (id) => {
const cfg = await Config.get()
if (cfg.enterprise?.url) {
await ShareNext.remove(id)
await update(id, (draft) => {
draft.share = undefined
})
}
const share = await getShare(id)
if (!share) return
await Storage.remove(["share", id])

View File

@@ -319,8 +319,6 @@ export namespace SessionProcessor {
break
case "finish":
input.assistantMessage.time.completed = Date.now()
await Session.updateMessage(input.assistantMessage)
break
default: