keysclient

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 1 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 keysclient 是 keystone 域的出站 client 缝:协调者会话承载、终端 attach 定位、叙事落点与账本只读面四条能力接口,全部定义在使用方(keystone 域)这一侧(架构法第九条),由组装点绑定实现;组装点之外不得 new 他方具体 类型(架构法第八条)。测试缝:假 Runner/假 Narrator 供 keystone 域在不起 agentd、不起账本的情况下独立测试。

铁律挂在本缝:以协调者身份拉起/续接一个 CLI 会话不进派发状态机、不产生 task(B156.3 spec 测试接缝 3)——Runner 的任何实现都不得调用执行域派发路径。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachInfo

type AttachInfo struct {
	Machine string `json:"machine"`
	Dir     string `json:"dir"`
	Command string `json:"command"` // 例:opencode --session <id>;在对应机器上执行
}

AttachInfo 是「在哪台机器哪个目录用什么命令打开原生 TUI」的定位三元组 (spec §4.4 attach:不做第二套 TUI,handoff 只负责把用户送到门口)。

type LedgerView

type LedgerView interface {
	GetCard(id string) (proto.Card, error)
	EventsFromAsc(cardIDs []string, fromSeq int64, limit int) ([]proto.LedgerEvent, error)
	EffectiveBaseBranch(id string) (string, error)
	MarkNeedsHuman(cardID, reason, actor string) error
}

LedgerView 是 keystone 对账本的只读面加一条兜底写:读卡/事件流/基线用于 开场评估与重建四步,MarkNeedsHuman 用于兜底链终点「转等人」。类型一律取 proto wire DTO(门面归一轮的弱隔离修正:不再经别名漏账本内部类型), 组装点直接绑 internal/ledger/api 的 *api.Facade——方法集天然满足,keystone 与账本互不 import(架构法第八/九条)。

type Narrator

type Narrator interface {
	Say(cardID, text string) error
}

Narrator 是叙事落点缝。会话子系统(B156.2 房间制)落地前,组装点绑账本 卡 note 兜底实现;落地后换绑房间消息,keystone 不感知差异。

type Runner

type Runner interface {
	// Launch 新建会话并送入第一回合。**prompt 必须非空**——原注释曾承诺
	// 「prompt 为空表示只建立会话」,2026-08-26 在 opencode 上实证该形态无原生
	// 支撑(run 形态空 prompt 直接 exit 1),且该承诺从未出现在 spec / 契约 /
	// 拆解任一文档里,是注释单方面发明的契约,故删除。实现方对空 prompt 必须
	// 响报(带标记词的可行动错误),不得静默兜底成「只建会话」。
	Launch(spec SessionSpec, prompt string) (TurnResult, error)
	// Resume 在既有会话上无头续一回合——事件唤醒的常规路径。
	Resume(ref SessionRef, prompt string) (TurnResult, error)
}

Runner 是协调者会话承载缝(进程承载半段经 hostapi 门面实现,spec §7.0): 无头拉起一个 CLI 会话、喂 prompt、收回合输出。没有派发状态机的任何概念。

type SessionRef

type SessionRef struct {
	CLI       string `json:"cli,omitempty"`
	SessionID string `json:"session_id"`
	Machine   string `json:"machine,omitempty"`
	HomeDir   string `json:"home_dir,omitempty"`
	Workdir   string `json:"workdir,omitempty"`
	Model     string `json:"model,omitempty"`
}

SessionRef 指向一个可 resume 的持久会话。HomeDir/Workdir/Model 是续接环境: 会话文件落在隔离 HOME 里,丢掉它们 Resume 会在 agentd 默认 HOME 里找不到 session,每次唤醒都走重建(B299 真机)。

type SessionSpec

type SessionSpec struct {
	CLI     string   // opencode / claude / ...
	HomeDir string   // 隔离 HOME 根;空 = 主 HOME(协调者载体禁空,由配置审核保证)
	Model   string   // 协调者模型独立配置(载体属性)
	Workdir string   // 会话工作目录(项目位置根)
	Env     []string // 追加环境变量 KEY=VALUE(已解析已展开;值不得进日志)
}

SessionSpec 是一次无头拉起的会话规格。HomeDir 是隔离 HOME 档案:协调者 全套(全局规则/skill/MCP/账本凭据),与执行者的干净 HOME 相反(spec §4.3)。

type TerminalLocator

type TerminalLocator interface {
	Locate(ref SessionRef, workdir string) (AttachInfo, error)
}

TerminalLocator 是 attach 定位缝(PTY 域薄门面 ptyapi 承载终端 tab 本体)。

type TurnResult

type TurnResult struct {
	SessionID string // 实际生效的会话 id(fresh 重建时是新 id)
	Output    string // 回合末输出原文(裁决块等由上层解析)
}

TurnResult 是一个唤醒回合的产出。

Jump to

Keyboard shortcuts

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