Documentation
¶
Overview ¶
Package projects mounts Projects (the projects/ module, see .design/projects.md) in Tingly Box: a Host that points its Claude Code sessions at the gateway, and the routes behind the "projects" feature flag.
Index ¶
- type ChatBridge
- func (b *ChatBridge) Answer(ref agent.ChatRef, threadID, requestID, value string) (string, error)
- func (b *ChatBridge) App() *projectsapp.App
- func (b *ChatBridge) Bind(app *projectsapp.App, registry *channel.Registry, enabled func() bool, ...)
- func (b *ChatBridge) BotFor(platform, chatID string) string
- func (b *ChatBridge) Bound(platform, chatID string) bool
- func (b *ChatBridge) Command(ref agent.ChatRef, name, arg string) (bool, string, error)
- func (b *ChatBridge) Enabled() bool
- func (b *ChatBridge) Folder(platform, chatID string) string
- func (b *ChatBridge) Folders() ([]string, error)
- func (b *ChatBridge) ForgetBots()
- func (b *ChatBridge) MayAnswerText(ref agent.ChatRef, text string) bool
- func (b *ChatBridge) Outbox() agent.Outbox
- func (b *ChatBridge) Place(ref agent.ChatRef) (agent.ChatPlace, error)
- func (b *ChatBridge) Post(ref agent.ChatRef, text string, files []agent.File) (bool, error)
- func (b *ChatBridge) Projects() ([]agent.ProjectChoice, error)
- func (b *ChatBridge) RememberBot(platform, chatID, botUUID string)
- func (b *ChatBridge) SetTargetBlocked(check func(context.Context, string, string, string) (bool, error))
- func (b *ChatBridge) ToFolder(ref agent.ChatRef, folder string, ifNew bool) error
- func (b *ChatBridge) ToProject(ref agent.ChatRef, projectID string) error
- func (b *ChatBridge) Unbind(ref agent.ChatRef) (agent.UnbindInfo, error)
- type Handler
- type Host
- func (h *Host) CheckLaunch(ctx context.Context, profile, model string) error
- func (h *Host) CustomCommands(context.Context) ([]projectsapp.CustomCommand, error)
- func (h *Host) HandoffLaunch(profile string) []string
- func (h *Host) LaunchEnv(ctx context.Context, profile string) ([]string, string, error)
- func (h *Host) LaunchMCP(_ context.Context, profile string) (string, error)
- func (h *Host) Models(context.Context) ([]projectsapp.Model, error)
- func (h *Host) Outbox() agent.Outbox
- func (h *Host) SetChatBridge(b *ChatBridge)
- func (h *Host) ThreadEnv(ctx context.Context) ([]string, string)
- func (h *Host) WithRoutePreview(routes *statusline.Handler) *Host
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatBridge ¶ added in v1.261022.2
type ChatBridge struct {
// contains filtered or unexported fields
}
ChatBridge joins Remote's IM chats to Projects (.design/projects-im.md):
- inbound: a chat that is bound to a project hands its messages to that project's coordinator instead of @cc / @tb (chat.ProjectRouter);
- outbound: the coordinator's replies and thread reports reach the bound chats through Remote's outbox (projectsapp.ChannelSink, which the host forwards to).
The bridge exists before Projects does (the IM handler is built first), so it is created empty and bound to the app and the channel registry later. Until then, or when the Projects flag is off, it takes no messages.
func NewChatBridge ¶ added in v1.261022.2
func NewChatBridge() *ChatBridge
NewChatBridge returns a bridge that does nothing until Bind.
func (*ChatBridge) App ¶ added in v1.261109.0
func (b *ChatBridge) App() *projectsapp.App
App returns the Projects app while it is switched on, else nil.
func (*ChatBridge) Bind ¶ added in v1.261022.2
func (b *ChatBridge) Bind(app *projectsapp.App, registry *channel.Registry, enabled func() bool, start func(), disabled func(chatID string) bool)
Bind connects the bridge to Projects and to the running bots' channels. enabled is the Projects feature flag and start brings the runtime up on first use, like the HTTP gate does; disabled may be nil.
func (*ChatBridge) BotFor ¶ added in v1.261109.0
func (b *ChatBridge) BotFor(platform, chatID string) string
BotFor is the bot a chat last wrote through, or "" when none is remembered.
func (*ChatBridge) Bound ¶ added in v1.261022.2
func (b *ChatBridge) Bound(platform, chatID string) bool
Bound reports whether the chat has a place in Projects.
func (*ChatBridge) Enabled ¶ added in v1.261023.0
func (b *ChatBridge) Enabled() bool
Enabled implements chat.ProjectRouter: chats follow the Projects switch.
func (*ChatBridge) Folder ¶ added in v1.261109.0
func (b *ChatBridge) Folder(platform, chatID string) string
Folder is the folder a chat is on in Projects, or "" when it is on a project, has no place yet, or Projects is off.
func (*ChatBridge) Folders ¶ added in v1.261109.0
func (b *ChatBridge) Folders() ([]string, error)
Folders implements agent.Chat: Projects' current, existing working folders.
func (*ChatBridge) ForgetBots ¶ added in v1.261109.0
func (b *ChatBridge) ForgetBots()
ForgetBots drops every remembered bot, as a restart does.
func (*ChatBridge) MayAnswerText ¶ added in v1.261112.1
func (b *ChatBridge) MayAnswerText(ref agent.ChatRef, text string) bool
MayAnswerText identifies candidate text replies without consuming them.
func (*ChatBridge) Outbox ¶ added in v1.261109.0
func (b *ChatBridge) Outbox() agent.Outbox
Outbox is how Projects reaches the bridge's chats: Remote's outbox, which remembers the bot each chat wrote through (see Post, Command, Answer).
func (*ChatBridge) Place ¶ added in v1.261109.0
Place implements agent.Chat: where the chat is, from the actual Projects binding.
func (*ChatBridge) Projects ¶ added in v1.261109.0
func (b *ChatBridge) Projects() ([]agent.ProjectChoice, error)
Projects implements agent.Chat: project coordinators, separately from working folders.
func (*ChatBridge) RememberBot ¶ added in v1.261109.0
func (b *ChatBridge) RememberBot(platform, chatID, botUUID string)
RememberBot records the bot a chat wrote through; replies to the chat go back through it.
func (*ChatBridge) SetTargetBlocked ¶ added in v1.261105.1
func (b *ChatBridge) SetTargetBlocked(check func(context.Context, string, string, string) (bool, error))
SetTargetBlocked connects the bot-scoped access control used by outbound messages and prompt updates. A lookup failure prevents delivery.
func (*ChatBridge) ToProject ¶ added in v1.261109.0
func (b *ChatBridge) ToProject(ref agent.ChatRef, projectID string) error
ToProject implements agent.Chat: it binds the chat to the project's coordinator.
func (*ChatBridge) Unbind ¶ added in v1.261203.0
func (b *ChatBridge) Unbind(ref agent.ChatRef) (agent.UnbindInfo, error)
Unbind implements agent.Chat: it removes the chat's binding in Projects (the same delete the Web's unbind performs), so it stops receiving the bound thread's replies and its messages no longer route there.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler mounts Projects' routes (all under /api/v1/projects and /api/v1/threads) behind user auth and the feature flag.
func NewHandler ¶
func NewHandler(app *projectsapp.App, enabled func() bool, start func()) *Handler
func (*Handler) RegisterRoutes ¶
RegisterRoutes gives Projects a /api/v1 group of its own, so the gate applies to its routes and nothing else.
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host gives Projects model access through Tingly Box's own gateway. The coordinator and the threads are Claude Code sessions on the claude_code scenario, so its routing rules, usage records and quotas cover Projects too, and the model names Projects offers are the ones that scenario routes.
func (*Host) CheckLaunch ¶
CheckLaunch accepts the default tier always, and a named tier only where the profile routes tiers separately: under a unified profile every tier is the same model, so choosing one would change nothing.
func (*Host) CustomCommands ¶ added in v1.261203.2
func (h *Host) CustomCommands(context.Context) ([]projectsapp.CustomCommand, error)
CustomCommands returns the user's config-defined composer commands ("custom_commands" in config.json). They are the global fallback; a project's own .agents/skills (and its Claude Code files) override them by name. Projects validates names against its built-ins and computes whether each takes arguments.
func (*Host) HandoffLaunch ¶
HandoffLaunch goes through tingly-box (`cc`, or `profile <id>`), by absolute path, so the terminal routes through the same gateway and settings the web turns used, with no token in the command.
func (*Host) LaunchEnv ¶
LaunchEnv routes a session's turn like @cc does, through the shared agent config resolver: the connection default's env, or a profile's settings file, which carries its own routing and so replaces the env rather than adding to it.
func (*Host) Models ¶
Models lists the request models the claude_code scenario has active rules for, the default tier first. Each entry also carries what the status line would route it to, so an alias can be shown with the real model it stands for.
func (*Host) Outbox ¶ added in v1.261109.0
Outbox is the host's half of Projects' optional OutboxHost: the coordinator's replies, thread reports and approvals reach the IM chats bound to a project. It is nil until the bridge is set.
func (*Host) SetChatBridge ¶ added in v1.261022.2
func (h *Host) SetChatBridge(b *ChatBridge)
SetChatBridge gives the host the bridge whose outbox Projects speaks through.
func (*Host) ThreadEnv ¶
ThreadEnv points the coordinator's and each thread's Claude Code at the gateway the same way @cc does, through the shared agent config resolver.
func (*Host) WithRoutePreview ¶ added in v1.261029.0
func (h *Host) WithRoutePreview(routes *statusline.Handler) *Host
WithRoutePreview names the status line's route preview, so the model list can show what each id resolves to. Same wiring as the scenario module's tier listing (server_webui_api.go).