Gateway: per-watch notification switches, model list for new threads, and Ask before acting
This commit is contained in:
1 parent
a5222e14e8
commit
3cc7e40852
14 files changed
+472
-20
No files matched your search
@@ -5,6 +5,7 @@
|
||||
|
||||
import { threadPhase, type Phase } from "./awareness.ts";
|
||||
import type {
|
||||
AgentProvider,
|
||||
Feed,
|
||||
FeedItem,
|
||||
HostStatusDetail,
|
||||
@@ -360,5 +361,28 @@ export async function buildThreadDetail(
|
||||
item: feedItem(host, thread, child?.phase ?? own, summary, via),
|
||||
messages: summary.messages,
|
||||
canStop: thread.activeRunId !== null,
|
||||
askFirst: thread.runtimeMode === ASK_FIRST,
|
||||
};
|
||||
}
|
||||
|
||||
/** T3's runtime mode that asks before each action. */
|
||||
export const ASK_FIRST = "approval-required";
|
||||
|
||||
/** The providers on a host that can start a thread now, leaving out legacy models. */
|
||||
export function agentProviders(host: T3Host): AgentProvider[] {
|
||||
return (host.serverConfig?.providers ?? [])
|
||||
.filter(
|
||||
(provider) =>
|
||||
provider.enabled &&
|
||||
provider.installed &&
|
||||
provider.availability !== "unavailable" &&
|
||||
(provider.status === "ready" || provider.status === "warning"),
|
||||
)
|
||||
.map((provider) => ({
|
||||
instanceId: provider.instanceId,
|
||||
name: provider.displayName ?? provider.driver,
|
||||
canAskFirst: provider.supportedRuntimeModes?.includes(ASK_FIRST) ?? true,
|
||||
models: provider.models.filter((model) => !model.isLegacy).map((model) => ({ slug: model.slug, name: model.name })),
|
||||
}))
|
||||
.filter((provider) => provider.models.length > 0);
|
||||
}
|
||||
Reference in new issue
Block a user