projects

package
v1.261030.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MPL-2.0 Imports: 24 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package projects mounts Projects (the projects/ module, see .design/projects.md) in Tingly Box: a Host that gives it model access through the gateway, and the routes behind the "projects" feature flag.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoChannel = errors.New("no running bot for this chat")

ErrNoChannel means no running bot can reach the chat.

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 (remoteagent.ProjectRouter);
  • outbound: the coordinator's replies and thread reports reach the bound chats through the bot's channel, the same send path notifications use (projectsapp.ChannelSink, implemented by Host).

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) 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) Bound added in v1.261022.2

func (b *ChatBridge) Bound(platform, chatID string) bool

Bound implements remoteagent.ProjectRouter.

func (*ChatBridge) Enabled added in v1.261023.0

func (b *ChatBridge) Enabled() bool

Enabled implements remoteagent.ProjectRouter: chats follow the Projects switch.

func (*ChatBridge) RestateChannelPrompt added in v1.261023.0

func (b *ChatBridge) RestateChannelPrompt(ctx context.Context, platform, chatID, ref, text string) error

RestateChannelPrompt implements projectsapp.ChannelPrompter.

func (*ChatBridge) RouteAnswer added in v1.261023.0

func (b *ChatBridge) RouteAnswer(_ context.Context, in remoteagent.ProjectInbound, threadID, requestID, choice string) (string, error)

RouteAnswer implements remoteagent.ProjectRouter.

func (*ChatBridge) RouteCommand added in v1.261023.0

func (b *ChatBridge) RouteCommand(_ context.Context, name string, in remoteagent.ProjectInbound) (bool, string, error)

RouteCommand implements remoteagent.ProjectRouter.

func (*ChatBridge) RouteInbound added in v1.261022.2

func (b *ChatBridge) RouteInbound(_ context.Context, in remoteagent.ProjectInbound) (bool, error)

RouteInbound implements remoteagent.ProjectRouter.

func (*ChatBridge) SendChannelPrompt added in v1.261023.0

func (b *ChatBridge) SendChannelPrompt(ctx context.Context, platform, chatID string, p projectsapp.ChannelPrompt) (string, error)

SendChannelPrompt implements projectsapp.ChannelPrompter. The returned ref names the bot that sent it, so the prompt is restated through the same one.

func (*ChatBridge) SendChannelText added in v1.261022.2

func (b *ChatBridge) SendChannelText(ctx context.Context, platform, chatID, text string) error

SendChannelText implements projectsapp.ChannelSink: it sends text to a chat through the channel of the bot the chat last wrote through, else through the bots of the chat's platform.

func (*ChatBridge) ToFolder added in v1.261023.0

func (b *ChatBridge) ToFolder(_ context.Context, in remoteagent.ProjectInbound, folder string, ifNew bool) error

ToFolder implements remoteagent.ProjectRouter.

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

func (h *Handler) RegisterRoutes(rt *module.Routes)

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 both go through 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 NewHost

func NewHost(cfg *config.Config) *Host

func (*Host) CheckLaunch

func (h *Host) CheckLaunch(ctx context.Context, profile, model string) error

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) ClientFor

func (h *Host) ClientFor(_ context.Context, model string) (llm.Client, string, error)

ClientFor talks Anthropic Messages to the gateway's claude_code scenario with the model token; an empty model means the scenario's default tier.

func (*Host) HandoffLaunch

func (h *Host) HandoffLaunch(profile string) []string

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

func (h *Host) LaunchEnv(ctx context.Context, profile string) ([]string, string, error)

LaunchEnv routes a session's turn like @cc does: the main claude_code scenario'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

func (h *Host) Models(context.Context) ([]llm.Model, error)

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) RestateChannelPrompt added in v1.261023.0

func (h *Host) RestateChannelPrompt(ctx context.Context, platform, chatID, ref, text string) error

RestateChannelPrompt restates a prompt once it is settled.

func (*Host) SendChannelPrompt added in v1.261023.0

func (h *Host) SendChannelPrompt(ctx context.Context, platform, chatID string, p projectsapp.ChannelPrompt) (string, error)

SendChannelPrompt is the host's half of Projects' optional ChannelPrompter: a thread's approvals and questions reach bound chats with buttons.

func (*Host) SendChannelText added in v1.261022.2

func (h *Host) SendChannelText(ctx context.Context, platform, chatID, text string) error

SendChannelText is the host's half of Projects' optional ChannelSink: the coordinator's replies reach the IM chats bound to a project.

func (*Host) SetChatBridge added in v1.261022.2

func (h *Host) SetChatBridge(b *ChatBridge)

SetChatBridge gives the host the bridge it sends chat messages through.

func (*Host) ThreadEnv

func (h *Host) ThreadEnv(ctx context.Context) ([]string, string)

ThreadEnv points each thread's Claude Code at the gateway the same way @cc does.

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL