feat(channels): webhook and email channel extensions
This commit is contained in:
10 files changed
+5160
No files matched your search
@@ -6,6 +6,7 @@ directory holds one subdirectory per extension.
|
||||
```
|
||||
secret-engines/<name>/ package.yaml + Go source, served over secretengine.v1
|
||||
workflows/<name>/ package.yaml + workflow YAML, projected into workflow-definitions
|
||||
channels/<name>/ package.yaml + Go source, served over channel.v1 (webhook, email)
|
||||
forge/<name>/ package.yaml + Go source, served over forge.v1 (github, gitea)
|
||||
playbooks/<name>/ package.yaml + EDA playbook YAML, projected into eda-playbooks
|
||||
profiles/<name>/ package.yaml + agent profile YAML, projected into agent-profiles
|
||||
|
||||
@@ -0,0 +1,299 @@
|
||||
// Command email is the email chat channel: it receives mail over SMTP, routes
|
||||
// the body through the gateway, and replies through an SMTP relay. Settings:
|
||||
// listen_addr (default :2525), relay_addr, relay_user, and relay_pass_ref
|
||||
// ("engine:key" of the relay password).
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"net"
|
||||
"net/smtp"
|
||||
"strings"
|
||||
|
||||
"github.com/samcharles93/archipelago/sdk/channel"
|
||||
gatewayv1 "github.com/samcharles93/archipelago/sdk/gateway/v1"
|
||||
)
|
||||
|
||||
type gateway struct {
|
||||
chat gatewayv1.ChatServiceClient
|
||||
relayAddr, relayUser, relayPass string
|
||||
log *slog.Logger
|
||||
}
|
||||
|
||||
func main() { channel.Serve(run) }
|
||||
|
||||
func run(ctx context.Context, cfg channel.Config, chat gatewayv1.ChatServiceClient, lifecycle channel.Lifecycle) error {
|
||||
lifecycle.Starting()
|
||||
listen := cfg.Settings["listen_addr"]
|
||||
if listen == "" {
|
||||
listen = ":2525"
|
||||
}
|
||||
g := &gateway{
|
||||
chat: chat,
|
||||
relayAddr: cfg.Settings["relay_addr"],
|
||||
relayUser: cfg.Settings["relay_user"],
|
||||
relayPass: cfg.Secrets["relay_pass"],
|
||||
log: slog.Default().With("component", "email"),
|
||||
}
|
||||
var lc net.ListenConfig
|
||||
ln, err := lc.Listen(ctx, "tcp", listen)
|
||||
if err != nil {
|
||||
return fmt.Errorf("email: listen %s: %w", listen, err)
|
||||
}
|
||||
g.log.Info("email channel listening", "addr", listen)
|
||||
lifecycle.Running()
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
_ = ln.Close()
|
||||
}()
|
||||
for {
|
||||
conn, err := ln.Accept()
|
||||
if err != nil {
|
||||
if ctx.Err() != nil || errors.Is(err, net.ErrClosed) {
|
||||
return nil
|
||||
}
|
||||
g.log.Error("email accept", "err", err)
|
||||
continue
|
||||
}
|
||||
go g.handleSMTP(ctx, conn)
|
||||
}
|
||||
}
|
||||
|
||||
// handleSMTP processes one SMTP session.
|
||||
func (g *gateway) handleSMTP(ctx context.Context, conn net.Conn) {
|
||||
defer func() { _ = conn.Close() }()
|
||||
r := bufio.NewReader(conn)
|
||||
w := bufio.NewWriter(conn)
|
||||
|
||||
write := func(code int, msg string) {
|
||||
_, _ = fmt.Fprintf(w, "%d %s\r\n", code, msg)
|
||||
_ = w.Flush()
|
||||
}
|
||||
readLine := func() (string, error) {
|
||||
line, err := r.ReadString('\n')
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.TrimRight(line, "\r\n"), nil
|
||||
}
|
||||
|
||||
write(220, "archie email gateway ready")
|
||||
|
||||
var mailFrom, rcptTo string
|
||||
var dataBuf strings.Builder
|
||||
inData := false
|
||||
|
||||
for {
|
||||
line, err := readLine()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
switch {
|
||||
case inData:
|
||||
if line == "." {
|
||||
// End of DATA — process the message.
|
||||
g.processMessage(ctx, mailFrom, rcptTo, dataBuf.String())
|
||||
write(250, "OK: message accepted")
|
||||
return
|
||||
}
|
||||
if strings.HasPrefix(line, "..") {
|
||||
line = line[1:]
|
||||
}
|
||||
dataBuf.WriteString(line)
|
||||
dataBuf.WriteString("\r\n")
|
||||
|
||||
case strings.HasPrefix(strings.ToUpper(line), "MAIL FROM:"):
|
||||
mailFrom = extractAddr(line)
|
||||
write(250, "OK")
|
||||
|
||||
case strings.HasPrefix(strings.ToUpper(line), "RCPT TO:"):
|
||||
rcptTo = extractAddr(line)
|
||||
write(250, "OK")
|
||||
|
||||
case strings.HasPrefix(strings.ToUpper(line), "DATA"):
|
||||
write(354, "Start mail input; end with <CRLF>.<CRLF>")
|
||||
inData = true
|
||||
|
||||
case strings.HasPrefix(strings.ToUpper(line), "QUIT"):
|
||||
write(221, "Bye")
|
||||
return
|
||||
|
||||
case strings.HasPrefix(strings.ToUpper(line), "EHLO"), strings.HasPrefix(strings.ToUpper(line), "HELO"):
|
||||
write(250, "OK")
|
||||
|
||||
default:
|
||||
write(500, "Unrecognized command")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// extractAddr pulls the email address from an SMTP command line like
|
||||
// "MAIL FROM:<user@example.com>" or "RCPT TO:<user@example.com>".
|
||||
func extractAddr(line string) string {
|
||||
start := strings.IndexByte(line, '<')
|
||||
end := strings.LastIndexByte(line, '>')
|
||||
if start >= 0 && end > start {
|
||||
return strings.TrimSpace(line[start+1 : end])
|
||||
}
|
||||
return strings.TrimSpace(line)
|
||||
}
|
||||
|
||||
// processMessage extracts text from the raw email and routes it through
|
||||
// the messaging chat contract. Replies are sent back via SMTP.
|
||||
func (g *gateway) processMessage(ctx context.Context, from, to, raw string) {
|
||||
// Extract plain text body: everything after the first blank line
|
||||
// following Content-Type or headers.
|
||||
text := extractBody(raw)
|
||||
|
||||
// The channel names the platform it carries, which is how the gateway
|
||||
// learns it is serving email.
|
||||
reply, err := g.chat.Route(ctx, &gatewayv1.RouteRequest{Message: &gatewayv1.Message{
|
||||
ChannelId: to,
|
||||
From: from,
|
||||
Text: text,
|
||||
Platform: "email",
|
||||
}})
|
||||
if err != nil {
|
||||
g.log.Error("email route", "err", err, "from", from)
|
||||
return
|
||||
}
|
||||
|
||||
if reply.GetText() != "" && g.relayAddr != "" {
|
||||
if err := g.sendReply(from, to, reply.GetText()); err != nil {
|
||||
g.log.Error("email reply", "err", err, "to", from)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// extractBody pulls the plain text body from a raw email.
|
||||
func extractBody(raw string) string {
|
||||
// Find the message body: after headers (blank line).
|
||||
parts := strings.SplitN(raw, "\r\n\r\n", 2)
|
||||
if len(parts) < 2 {
|
||||
parts = strings.SplitN(raw, "\n\n", 2)
|
||||
}
|
||||
if len(parts) < 2 {
|
||||
return strings.TrimSpace(raw)
|
||||
}
|
||||
|
||||
headers := parts[0]
|
||||
body := parts[1]
|
||||
|
||||
// If multipart, look for the text/plain section.
|
||||
if strings.Contains(strings.ToLower(headers), "content-type: multipart") {
|
||||
if text := extractMultipartText(headers, body); text != "" {
|
||||
return text
|
||||
}
|
||||
}
|
||||
|
||||
// Non-multipart: strip trailing SMTP dots.
|
||||
return strings.TrimSpace(body)
|
||||
}
|
||||
|
||||
// extractMultipartText looks for a text/plain section within a multipart
|
||||
// body. Returns the trimmed text body or an empty string when not found.
|
||||
func extractMultipartText(headers, body string) string {
|
||||
idx := strings.Index(strings.ToLower(headers), "boundary=")
|
||||
if idx < 0 {
|
||||
return ""
|
||||
}
|
||||
boundary := extractBoundary(headers[idx:])
|
||||
if boundary == "" {
|
||||
return ""
|
||||
}
|
||||
sections := strings.SplitSeq(body, "--"+boundary)
|
||||
for sec := range sections {
|
||||
if !strings.Contains(strings.ToLower(sec), "content-type: text/plain") {
|
||||
continue
|
||||
}
|
||||
if parts := strings.SplitN(sec, "\r\n\r\n", 2); len(parts) == 2 {
|
||||
return strings.TrimSpace(strings.TrimRight(parts[1], "\r\n-"))
|
||||
}
|
||||
if parts := strings.SplitN(sec, "\n\n", 2); len(parts) == 2 {
|
||||
return strings.TrimSpace(strings.TrimRight(parts[1], "\n-"))
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func extractBoundary(line string) string {
|
||||
// boundary="xxx" or boundary=xxx
|
||||
line = strings.TrimPrefix(line, "boundary=")
|
||||
line = strings.TrimSpace(line)
|
||||
line = strings.Trim(line, "\"")
|
||||
// Stop at semicolon or whitespace.
|
||||
if idx := strings.IndexAny(line, " ;\r\n"); idx >= 0 {
|
||||
return line[:idx]
|
||||
}
|
||||
return line
|
||||
}
|
||||
|
||||
// sendReply delivers a reply to the original sender via SMTP relay.
|
||||
func (g *gateway) sendReply(to, from, text string) error {
|
||||
msg := fmt.Sprintf("From: %s\r\nTo: %s\r\nSubject: Re: %s\r\n\r\n%s",
|
||||
from, to, truncateSubject(text), text)
|
||||
|
||||
var auth smtp.Auth
|
||||
if g.relayUser != "" {
|
||||
host, _, _ := net.SplitHostPort(g.relayAddr)
|
||||
auth = smtp.PlainAuth("", g.relayUser, g.relayPass, host)
|
||||
}
|
||||
|
||||
// Try TLS first, fall back to plain.
|
||||
c, err := smtp.Dial(g.relayAddr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("dial relay: %w", err)
|
||||
}
|
||||
defer func() { _ = c.Close() }()
|
||||
|
||||
if ok, _ := c.Extension("STARTTLS"); ok {
|
||||
tlsCfg := &tls.Config{ServerName: serverName(g.relayAddr)}
|
||||
if err := c.StartTLS(tlsCfg); err != nil {
|
||||
return fmt.Errorf("starttls: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if auth != nil {
|
||||
if err := c.Auth(auth); err != nil {
|
||||
g.log.Warn("email relay auth failed", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := c.Mail(from); err != nil {
|
||||
return fmt.Errorf("mail from: %w", err)
|
||||
}
|
||||
if err := c.Rcpt(to); err != nil {
|
||||
return fmt.Errorf("rcpt to: %w", err)
|
||||
}
|
||||
wc, err := c.Data()
|
||||
if err != nil {
|
||||
return fmt.Errorf("data: %w", err)
|
||||
}
|
||||
_, err = io.WriteString(wc, msg)
|
||||
if err != nil {
|
||||
return fmt.Errorf("write: %w", err)
|
||||
}
|
||||
return wc.Close()
|
||||
}
|
||||
|
||||
func serverName(addr string) string {
|
||||
host, _, err := net.SplitHostPort(addr)
|
||||
if err != nil {
|
||||
return "localhost"
|
||||
}
|
||||
return host
|
||||
}
|
||||
|
||||
func truncateSubject(text string) string {
|
||||
if len(text) > 60 {
|
||||
return text[:57] + "..."
|
||||
}
|
||||
return text
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: dev.archie.package.v1
|
||||
displayName: Email channel
|
||||
description: Email chat channel: receive mail over SMTP, reply through an SMTP relay.
|
||||
version: 1.0.0
|
||||
contributes:
|
||||
extensions:
|
||||
- surface: channel
|
||||
path: bin/email
|
||||
files:
|
||||
- path: bin/email
|
||||
mode: 493
|
||||
@@ -0,0 +1,135 @@
|
||||
// Command webhook is the inbound webhook chat channel. External services POST
|
||||
// a message to a route; it is routed through the gateway for the model to
|
||||
// answer. Settings: addr (default 0.0.0.0:8644), path (default /webhook),
|
||||
// template (dot path to the text in a JSON body; empty uses the raw body),
|
||||
// deliver_to ("origin" answers the HTTP request with the reply), and
|
||||
// secret_ref ("engine:key" of the HMAC secret; empty skips validation).
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/samcharles93/archipelago/sdk/channel"
|
||||
gatewayv1 "github.com/samcharles93/archipelago/sdk/gateway/v1"
|
||||
)
|
||||
|
||||
const maxBody = 1 << 20
|
||||
|
||||
func main() { channel.Serve(run) }
|
||||
|
||||
func run(ctx context.Context, cfg channel.Config, chat gatewayv1.ChatServiceClient, lifecycle channel.Lifecycle) error {
|
||||
lifecycle.Starting()
|
||||
addr := cfg.Settings["addr"]
|
||||
if addr == "" {
|
||||
addr = "0.0.0.0:8644"
|
||||
}
|
||||
path := cfg.Settings["path"]
|
||||
if path == "" {
|
||||
path = "/webhook"
|
||||
}
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc(path, handler(path, cfg.Settings["template"], cfg.Settings["deliver_to"], cfg.Secrets["secret"], chat))
|
||||
server := &http.Server{Addr: addr, Handler: mux, ReadHeaderTimeout: 5 * time.Second}
|
||||
|
||||
var lc net.ListenConfig
|
||||
ln, err := lc.Listen(ctx, "tcp", addr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("webhook: listen: %w", err)
|
||||
}
|
||||
slog.Info("webhook channel listening", "addr", addr, "path", path)
|
||||
lifecycle.Running()
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
shutdown, cancel := context.WithTimeout(context.WithoutCancel(ctx), 5*time.Second)
|
||||
defer cancel()
|
||||
_ = server.Shutdown(shutdown)
|
||||
}()
|
||||
if err := server.Serve(ln); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||
return fmt.Errorf("webhook: serve: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func handler(path, template, deliverTo, secret string, chat gatewayv1.ChatServiceClient) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodPost {
|
||||
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
body, err := io.ReadAll(io.LimitReader(r.Body, maxBody))
|
||||
if err != nil {
|
||||
http.Error(w, "read error", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if secret != "" {
|
||||
sig := r.Header.Get("X-Hub-Signature-256")
|
||||
if sig == "" {
|
||||
sig = r.Header.Get("X-Signature-256")
|
||||
}
|
||||
if !channel.VerifyHMAC(body, sig, secret) {
|
||||
slog.Warn("webhook invalid signature", "path", path)
|
||||
http.Error(w, "invalid signature", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
}
|
||||
text := extractText(body, template)
|
||||
if text == "" {
|
||||
http.Error(w, "empty message", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
// A webhook has no per-caller identity, so source_id stays empty: a
|
||||
// route path must never become a user identity. The path is the
|
||||
// source the gateway rate limits on.
|
||||
reply, err := chat.Route(r.Context(), &gatewayv1.RouteRequest{Message: &gatewayv1.Message{
|
||||
ChannelId: path,
|
||||
From: "webhook",
|
||||
Text: text,
|
||||
BudgetKey: path,
|
||||
Platform: "webhook",
|
||||
}})
|
||||
if err != nil {
|
||||
slog.Error("webhook route", "err", err, "path", path)
|
||||
http.Error(w, "route error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
if deliverTo == "origin" && reply.GetText() != "" {
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
_, _ = w.Write([]byte(reply.GetText()))
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
}
|
||||
}
|
||||
|
||||
// extractText pulls a value from a JSON body by dot path ("issue.title"). An
|
||||
// empty path is the raw body.
|
||||
func extractText(body []byte, path string) string {
|
||||
if path == "" {
|
||||
return strings.TrimSpace(string(body))
|
||||
}
|
||||
var data map[string]any
|
||||
if err := json.Unmarshal(body, &data); err != nil {
|
||||
return strings.TrimSpace(string(body))
|
||||
}
|
||||
var current any = data
|
||||
for p := range strings.SplitSeq(path, ".") {
|
||||
m, ok := current.(map[string]any)
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
current = m[p]
|
||||
}
|
||||
if s, ok := current.(string); ok {
|
||||
return strings.TrimSpace(s)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: dev.archie.package.v1
|
||||
displayName: Webhook channel
|
||||
description: Inbound webhook chat channel: an external service POSTs a message and the model answers.
|
||||
version: 1.0.0
|
||||
contributes:
|
||||
extensions:
|
||||
- surface: channel
|
||||
path: bin/webhook
|
||||
files:
|
||||
- path: bin/webhook
|
||||
mode: 493
|
||||
@@ -0,0 +1,101 @@
|
||||
// Package channel is what a Go chat channel extension builds on: the
|
||||
// generated channel.v1 contract, the handshake archie-core launches extensions
|
||||
// with, and the gateway chat service the host serves back to the channel.
|
||||
package channel
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/hmac"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"strings"
|
||||
|
||||
goplugin "github.com/hashicorp/go-plugin"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
channelv1 "github.com/samcharles93/archipelago/sdk/channel/v1"
|
||||
gatewayv1 "github.com/samcharles93/archipelago/sdk/gateway/v1"
|
||||
)
|
||||
|
||||
const surface = "channel"
|
||||
|
||||
// Config is the operator's configuration for the channel. Secrets holds the
|
||||
// resolved values of settings the operator gave as secret references, under
|
||||
// the setting's name without its _ref suffix.
|
||||
type Config struct {
|
||||
Settings map[string]string
|
||||
Secrets map[string]string
|
||||
}
|
||||
|
||||
// Lifecycle reports the channel's state to the host.
|
||||
type Lifecycle struct {
|
||||
Starting func()
|
||||
Running func()
|
||||
}
|
||||
|
||||
// Run runs the channel until ctx ends or it fails. chat is the gateway chat
|
||||
// service: the channel routes inbound messages through it.
|
||||
type Run func(ctx context.Context, cfg Config, chat gatewayv1.ChatServiceClient, lifecycle Lifecycle) error
|
||||
|
||||
type plugin struct {
|
||||
goplugin.NetRPCUnsupportedPlugin
|
||||
run Run
|
||||
}
|
||||
|
||||
type server struct {
|
||||
channelv1.UnimplementedChannelServiceServer
|
||||
broker *goplugin.GRPCBroker
|
||||
run Run
|
||||
}
|
||||
|
||||
func (p *plugin) GRPCServer(broker *goplugin.GRPCBroker, s *grpc.Server) error {
|
||||
channelv1.RegisterChannelServiceServer(s, &server{broker: broker, run: p.run})
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*plugin) GRPCClient(context.Context, *goplugin.GRPCBroker, *grpc.ClientConn) (any, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *server) Run(r *channelv1.RunRequest, stream grpc.ServerStreamingServer[channelv1.RunResponse]) error {
|
||||
conn, err := s.broker.Dial(r.GetChatBrokerId())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() { _ = conn.Close() }()
|
||||
send := func(state channelv1.RunResponse_State) func() {
|
||||
return func() { _ = stream.Send(&channelv1.RunResponse{State: state}) }
|
||||
}
|
||||
return s.run(stream.Context(), Config{Settings: r.GetSettings(), Secrets: r.GetSecrets()},
|
||||
gatewayv1.NewChatServiceClient(conn),
|
||||
Lifecycle{Starting: send(channelv1.RunResponse_STATE_STARTING), Running: send(channelv1.RunResponse_STATE_RUNNING)})
|
||||
}
|
||||
|
||||
// Serve runs run as the extension process. It returns when archie-core stops
|
||||
// the extension.
|
||||
func Serve(run Run) {
|
||||
goplugin.Serve(&goplugin.ServeConfig{
|
||||
HandshakeConfig: goplugin.HandshakeConfig{
|
||||
ProtocolVersion: 1,
|
||||
MagicCookieKey: "ARCHIE_EXTENSION",
|
||||
MagicCookieValue: "archie",
|
||||
},
|
||||
Plugins: goplugin.PluginSet{surface: &plugin{run: run}},
|
||||
GRPCServer: goplugin.DefaultGRPCServer,
|
||||
})
|
||||
}
|
||||
|
||||
// VerifyHMAC checks a hex SHA-256 HMAC of body, with or without a "sha256="
|
||||
// prefix, case-insensitively. An empty signature never verifies.
|
||||
func VerifyHMAC(body []byte, signature, secret string) bool {
|
||||
if signature == "" {
|
||||
return false
|
||||
}
|
||||
supplied, err := hex.DecodeString(strings.TrimPrefix(signature, "sha256="))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
mac := hmac.New(sha256.New, []byte(secret))
|
||||
mac.Write(body)
|
||||
return hmac.Equal(supplied, mac.Sum(nil))
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc (unknown)
|
||||
// source: channel/v1/channel.proto
|
||||
|
||||
package channelv1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type RunResponse_State int32
|
||||
|
||||
const (
|
||||
RunResponse_STATE_UNSPECIFIED RunResponse_State = 0
|
||||
RunResponse_STATE_STARTING RunResponse_State = 1
|
||||
RunResponse_STATE_RUNNING RunResponse_State = 2
|
||||
)
|
||||
|
||||
// Enum value maps for RunResponse_State.
|
||||
var (
|
||||
RunResponse_State_name = map[int32]string{
|
||||
0: "STATE_UNSPECIFIED",
|
||||
1: "STATE_STARTING",
|
||||
2: "STATE_RUNNING",
|
||||
}
|
||||
RunResponse_State_value = map[string]int32{
|
||||
"STATE_UNSPECIFIED": 0,
|
||||
"STATE_STARTING": 1,
|
||||
"STATE_RUNNING": 2,
|
||||
}
|
||||
)
|
||||
|
||||
func (x RunResponse_State) Enum() *RunResponse_State {
|
||||
p := new(RunResponse_State)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x RunResponse_State) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (RunResponse_State) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_channel_v1_channel_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (RunResponse_State) Type() protoreflect.EnumType {
|
||||
return &file_channel_v1_channel_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x RunResponse_State) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RunResponse_State.Descriptor instead.
|
||||
func (RunResponse_State) EnumDescriptor() ([]byte, []int) {
|
||||
return file_channel_v1_channel_proto_rawDescGZIP(), []int{1, 0}
|
||||
}
|
||||
|
||||
type RunRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// settings are the operator's values for this channel from extension
|
||||
// settings. A key ending in _ref holds an "engine:key" secret reference the
|
||||
// host resolves; the plugin receives the value in secrets, under the key
|
||||
// without the suffix.
|
||||
Settings map[string]string `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Secrets map[string]string `protobuf:"bytes,2,rep,name=secrets,proto3" json:"secrets,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
// chat_broker_id is the plugin broker stream the host serves
|
||||
// gateway.v1.ChatService on.
|
||||
ChatBrokerId uint32 `protobuf:"varint,3,opt,name=chat_broker_id,json=chatBrokerId,proto3" json:"chat_broker_id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *RunRequest) Reset() {
|
||||
*x = RunRequest{}
|
||||
mi := &file_channel_v1_channel_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RunRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RunRequest) ProtoMessage() {}
|
||||
|
||||
func (x *RunRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_channel_v1_channel_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RunRequest.ProtoReflect.Descriptor instead.
|
||||
func (*RunRequest) Descriptor() ([]byte, []int) {
|
||||
return file_channel_v1_channel_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *RunRequest) GetSettings() map[string]string {
|
||||
if x != nil {
|
||||
return x.Settings
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RunRequest) GetSecrets() map[string]string {
|
||||
if x != nil {
|
||||
return x.Secrets
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RunRequest) GetChatBrokerId() uint32 {
|
||||
if x != nil {
|
||||
return x.ChatBrokerId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type RunResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
State RunResponse_State `protobuf:"varint,1,opt,name=state,proto3,enum=channel.v1.RunResponse_State" json:"state,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *RunResponse) Reset() {
|
||||
*x = RunResponse{}
|
||||
mi := &file_channel_v1_channel_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RunResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RunResponse) ProtoMessage() {}
|
||||
|
||||
func (x *RunResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_channel_v1_channel_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RunResponse.ProtoReflect.Descriptor instead.
|
||||
func (*RunResponse) Descriptor() ([]byte, []int) {
|
||||
return file_channel_v1_channel_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *RunResponse) GetState() RunResponse_State {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return RunResponse_STATE_UNSPECIFIED
|
||||
}
|
||||
|
||||
var File_channel_v1_channel_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_channel_v1_channel_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x18channel/v1/channel.proto\x12\n" +
|
||||
"channel.v1\"\xac\x02\n" +
|
||||
"\n" +
|
||||
"RunRequest\x12@\n" +
|
||||
"\bsettings\x18\x01 \x03(\v2$.channel.v1.RunRequest.SettingsEntryR\bsettings\x12=\n" +
|
||||
"\asecrets\x18\x02 \x03(\v2#.channel.v1.RunRequest.SecretsEntryR\asecrets\x12$\n" +
|
||||
"\x0echat_broker_id\x18\x03 \x01(\rR\fchatBrokerId\x1a;\n" +
|
||||
"\rSettingsEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a:\n" +
|
||||
"\fSecretsEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x89\x01\n" +
|
||||
"\vRunResponse\x123\n" +
|
||||
"\x05state\x18\x01 \x01(\x0e2\x1d.channel.v1.RunResponse.StateR\x05state\"E\n" +
|
||||
"\x05State\x12\x15\n" +
|
||||
"\x11STATE_UNSPECIFIED\x10\x00\x12\x12\n" +
|
||||
"\x0eSTATE_STARTING\x10\x01\x12\x11\n" +
|
||||
"\rSTATE_RUNNING\x10\x022J\n" +
|
||||
"\x0eChannelService\x128\n" +
|
||||
"\x03Run\x12\x16.channel.v1.RunRequest\x1a\x17.channel.v1.RunResponse0\x01B\xa5\x01\n" +
|
||||
"\x0ecom.channel.v1B\fChannelProtoP\x01Z<github.com/samcharles93/archipelago/sdk/channel/v1;channelv1\xa2\x02\x03CXX\xaa\x02\n" +
|
||||
"Channel.V1\xca\x02\n" +
|
||||
"Channel\\V1\xe2\x02\x16Channel\\V1\\GPBMetadata\xea\x02\vChannel::V1b\x06proto3"
|
||||
|
||||
var (
|
||||
file_channel_v1_channel_proto_rawDescOnce sync.Once
|
||||
file_channel_v1_channel_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_channel_v1_channel_proto_rawDescGZIP() []byte {
|
||||
file_channel_v1_channel_proto_rawDescOnce.Do(func() {
|
||||
file_channel_v1_channel_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_channel_v1_channel_proto_rawDesc), len(file_channel_v1_channel_proto_rawDesc)))
|
||||
})
|
||||
return file_channel_v1_channel_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_channel_v1_channel_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_channel_v1_channel_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_channel_v1_channel_proto_goTypes = []any{
|
||||
(RunResponse_State)(0), // 0: channel.v1.RunResponse.State
|
||||
(*RunRequest)(nil), // 1: channel.v1.RunRequest
|
||||
(*RunResponse)(nil), // 2: channel.v1.RunResponse
|
||||
nil, // 3: channel.v1.RunRequest.SettingsEntry
|
||||
nil, // 4: channel.v1.RunRequest.SecretsEntry
|
||||
}
|
||||
var file_channel_v1_channel_proto_depIdxs = []int32{
|
||||
3, // 0: channel.v1.RunRequest.settings:type_name -> channel.v1.RunRequest.SettingsEntry
|
||||
4, // 1: channel.v1.RunRequest.secrets:type_name -> channel.v1.RunRequest.SecretsEntry
|
||||
0, // 2: channel.v1.RunResponse.state:type_name -> channel.v1.RunResponse.State
|
||||
1, // 3: channel.v1.ChannelService.Run:input_type -> channel.v1.RunRequest
|
||||
2, // 4: channel.v1.ChannelService.Run:output_type -> channel.v1.RunResponse
|
||||
4, // [4:5] is the sub-list for method output_type
|
||||
3, // [3:4] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_channel_v1_channel_proto_init() }
|
||||
func file_channel_v1_channel_proto_init() {
|
||||
if File_channel_v1_channel_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_channel_v1_channel_proto_rawDesc), len(file_channel_v1_channel_proto_rawDesc)),
|
||||
NumEnums: 1,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_channel_v1_channel_proto_goTypes,
|
||||
DependencyIndexes: file_channel_v1_channel_proto_depIdxs,
|
||||
EnumInfos: file_channel_v1_channel_proto_enumTypes,
|
||||
MessageInfos: file_channel_v1_channel_proto_msgTypes,
|
||||
}.Build()
|
||||
File_channel_v1_channel_proto = out.File
|
||||
file_channel_v1_channel_proto_goTypes = nil
|
||||
file_channel_v1_channel_proto_depIdxs = nil
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.2
|
||||
// - protoc (unknown)
|
||||
// source: channel/v1/channel.proto
|
||||
|
||||
package channelv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
ChannelService_Run_FullMethodName = "/channel.v1.ChannelService/Run"
|
||||
)
|
||||
|
||||
// ChannelServiceClient is the client API for ChannelService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
//
|
||||
// ChannelService is the surface a chat channel extension serves. The host
|
||||
// launches one plugin process per enabled channel and serves the gateway
|
||||
// ChatService back to it over the plugin broker, so a channel carries messages
|
||||
// in and out through that service and never dials the gateway itself.
|
||||
type ChannelServiceClient interface {
|
||||
// Run starts the channel and keeps it running until the call is cancelled or
|
||||
// the channel fails. The stream reports lifecycle: STARTING before each
|
||||
// launch attempt, RUNNING once the channel can receive. A stream that ends
|
||||
// with an error is a failed channel; the host restarts it.
|
||||
Run(ctx context.Context, in *RunRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[RunResponse], error)
|
||||
}
|
||||
|
||||
type channelServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewChannelServiceClient(cc grpc.ClientConnInterface) ChannelServiceClient {
|
||||
return &channelServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *channelServiceClient) Run(ctx context.Context, in *RunRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[RunResponse], error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &ChannelService_ServiceDesc.Streams[0], ChannelService_Run_FullMethodName, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &grpc.GenericClientStream[RunRequest, RunResponse]{ClientStream: stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type ChannelService_RunClient = grpc.ServerStreamingClient[RunResponse]
|
||||
|
||||
// ChannelServiceServer is the server API for ChannelService service.
|
||||
// All implementations must embed UnimplementedChannelServiceServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// ChannelService is the surface a chat channel extension serves. The host
|
||||
// launches one plugin process per enabled channel and serves the gateway
|
||||
// ChatService back to it over the plugin broker, so a channel carries messages
|
||||
// in and out through that service and never dials the gateway itself.
|
||||
type ChannelServiceServer interface {
|
||||
// Run starts the channel and keeps it running until the call is cancelled or
|
||||
// the channel fails. The stream reports lifecycle: STARTING before each
|
||||
// launch attempt, RUNNING once the channel can receive. A stream that ends
|
||||
// with an error is a failed channel; the host restarts it.
|
||||
Run(*RunRequest, grpc.ServerStreamingServer[RunResponse]) error
|
||||
mustEmbedUnimplementedChannelServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedChannelServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedChannelServiceServer struct{}
|
||||
|
||||
func (UnimplementedChannelServiceServer) Run(*RunRequest, grpc.ServerStreamingServer[RunResponse]) error {
|
||||
return status.Error(codes.Unimplemented, "method Run not implemented")
|
||||
}
|
||||
func (UnimplementedChannelServiceServer) mustEmbedUnimplementedChannelServiceServer() {}
|
||||
func (UnimplementedChannelServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeChannelServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ChannelServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeChannelServiceServer interface {
|
||||
mustEmbedUnimplementedChannelServiceServer()
|
||||
}
|
||||
|
||||
func RegisterChannelServiceServer(s grpc.ServiceRegistrar, srv ChannelServiceServer) {
|
||||
// If the following call panics, it indicates UnimplementedChannelServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&ChannelService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _ChannelService_Run_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(RunRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(ChannelServiceServer).Run(m, &grpc.GenericServerStream[RunRequest, RunResponse]{ServerStream: stream})
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type ChannelService_RunServer = grpc.ServerStreamingServer[RunResponse]
|
||||
|
||||
// ChannelService_ServiceDesc is the grpc.ServiceDesc for ChannelService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var ChannelService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "channel.v1.ChannelService",
|
||||
HandlerType: (*ChannelServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "Run",
|
||||
Handler: _ChannelService_Run_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "channel/v1/channel.proto",
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,885 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.2
|
||||
// - protoc (unknown)
|
||||
// source: gateway/v1/chat.proto
|
||||
|
||||
package gatewayv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
ChatService_Snapshot_FullMethodName = "/gateway.v1.ChatService/Snapshot"
|
||||
ChatService_GetSession_FullMethodName = "/gateway.v1.ChatService/GetSession"
|
||||
ChatService_RecentMessages_FullMethodName = "/gateway.v1.ChatService/RecentMessages"
|
||||
ChatService_RecentTurns_FullMethodName = "/gateway.v1.ChatService/RecentTurns"
|
||||
ChatService_Route_FullMethodName = "/gateway.v1.ChatService/Route"
|
||||
ChatService_Stream_FullMethodName = "/gateway.v1.ChatService/Stream"
|
||||
ChatService_Cancel_FullMethodName = "/gateway.v1.ChatService/Cancel"
|
||||
ChatService_SetPersona_FullMethodName = "/gateway.v1.ChatService/SetPersona"
|
||||
ChatService_ApplyTaskAction_FullMethodName = "/gateway.v1.ChatService/ApplyTaskAction"
|
||||
ChatService_ApplyOperatorTaskAction_FullMethodName = "/gateway.v1.ChatService/ApplyOperatorTaskAction"
|
||||
ChatService_SaveSession_FullMethodName = "/gateway.v1.ChatService/SaveSession"
|
||||
ChatService_GetSessionsByChannel_FullMethodName = "/gateway.v1.ChatService/GetSessionsByChannel"
|
||||
ChatService_DeleteSession_FullMethodName = "/gateway.v1.ChatService/DeleteSession"
|
||||
ChatService_TouchSession_FullMethodName = "/gateway.v1.ChatService/TouchSession"
|
||||
ChatService_ListSessions_FullMethodName = "/gateway.v1.ChatService/ListSessions"
|
||||
ChatService_SaveMessage_FullMethodName = "/gateway.v1.ChatService/SaveMessage"
|
||||
ChatService_DeleteRecentMessages_FullMethodName = "/gateway.v1.ChatService/DeleteRecentMessages"
|
||||
ChatService_MessageCount_FullMethodName = "/gateway.v1.ChatService/MessageCount"
|
||||
ChatService_SaveMessages_FullMethodName = "/gateway.v1.ChatService/SaveMessages"
|
||||
ChatService_ReplaceMessages_FullMethodName = "/gateway.v1.ChatService/ReplaceMessages"
|
||||
ChatService_SearchMessages_FullMethodName = "/gateway.v1.ChatService/SearchMessages"
|
||||
)
|
||||
|
||||
// ChatServiceClient is the client API for ChatService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type ChatServiceClient interface {
|
||||
Snapshot(ctx context.Context, in *SnapshotRequest, opts ...grpc.CallOption) (*SnapshotResponse, error)
|
||||
GetSession(ctx context.Context, in *GetSessionRequest, opts ...grpc.CallOption) (*GetSessionResponse, error)
|
||||
RecentMessages(ctx context.Context, in *RecentMessagesRequest, opts ...grpc.CallOption) (*RecentMessagesResponse, error)
|
||||
RecentTurns(ctx context.Context, in *RecentTurnsRequest, opts ...grpc.CallOption) (*RecentTurnsResponse, error)
|
||||
Route(ctx context.Context, in *RouteRequest, opts ...grpc.CallOption) (*RouteResponse, error)
|
||||
Stream(ctx context.Context, in *StreamRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StreamResponse], error)
|
||||
Cancel(ctx context.Context, in *CancelRequest, opts ...grpc.CallOption) (*CancelResponse, error)
|
||||
SetPersona(ctx context.Context, in *SetPersonaRequest, opts ...grpc.CallOption) (*SetPersonaResponse, error)
|
||||
ApplyTaskAction(ctx context.Context, in *ApplyTaskActionRequest, opts ...grpc.CallOption) (*ApplyTaskActionResponse, error)
|
||||
ApplyOperatorTaskAction(ctx context.Context, in *ApplyOperatorTaskActionRequest, opts ...grpc.CallOption) (*ApplyOperatorTaskActionResponse, error)
|
||||
SaveSession(ctx context.Context, in *SaveSessionRequest, opts ...grpc.CallOption) (*SaveSessionResponse, error)
|
||||
GetSessionsByChannel(ctx context.Context, in *GetSessionsByChannelRequest, opts ...grpc.CallOption) (*GetSessionsByChannelResponse, error)
|
||||
DeleteSession(ctx context.Context, in *DeleteSessionRequest, opts ...grpc.CallOption) (*DeleteSessionResponse, error)
|
||||
TouchSession(ctx context.Context, in *TouchSessionRequest, opts ...grpc.CallOption) (*TouchSessionResponse, error)
|
||||
ListSessions(ctx context.Context, in *ListSessionsRequest, opts ...grpc.CallOption) (*ListSessionsResponse, error)
|
||||
SaveMessage(ctx context.Context, in *SaveMessageRequest, opts ...grpc.CallOption) (*SaveMessageResponse, error)
|
||||
DeleteRecentMessages(ctx context.Context, in *DeleteRecentMessagesRequest, opts ...grpc.CallOption) (*DeleteRecentMessagesResponse, error)
|
||||
MessageCount(ctx context.Context, in *MessageCountRequest, opts ...grpc.CallOption) (*MessageCountResponse, error)
|
||||
SaveMessages(ctx context.Context, in *SaveMessagesRequest, opts ...grpc.CallOption) (*SaveMessagesResponse, error)
|
||||
ReplaceMessages(ctx context.Context, in *ReplaceMessagesRequest, opts ...grpc.CallOption) (*ReplaceMessagesResponse, error)
|
||||
SearchMessages(ctx context.Context, in *SearchMessagesRequest, opts ...grpc.CallOption) (*SearchMessagesResponse, error)
|
||||
}
|
||||
|
||||
type chatServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewChatServiceClient(cc grpc.ClientConnInterface) ChatServiceClient {
|
||||
return &chatServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) Snapshot(ctx context.Context, in *SnapshotRequest, opts ...grpc.CallOption) (*SnapshotResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SnapshotResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_Snapshot_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) GetSession(ctx context.Context, in *GetSessionRequest, opts ...grpc.CallOption) (*GetSessionResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetSessionResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_GetSession_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) RecentMessages(ctx context.Context, in *RecentMessagesRequest, opts ...grpc.CallOption) (*RecentMessagesResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RecentMessagesResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_RecentMessages_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) RecentTurns(ctx context.Context, in *RecentTurnsRequest, opts ...grpc.CallOption) (*RecentTurnsResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RecentTurnsResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_RecentTurns_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) Route(ctx context.Context, in *RouteRequest, opts ...grpc.CallOption) (*RouteResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RouteResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_Route_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) Stream(ctx context.Context, in *StreamRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StreamResponse], error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &ChatService_ServiceDesc.Streams[0], ChatService_Stream_FullMethodName, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &grpc.GenericClientStream[StreamRequest, StreamResponse]{ClientStream: stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type ChatService_StreamClient = grpc.ServerStreamingClient[StreamResponse]
|
||||
|
||||
func (c *chatServiceClient) Cancel(ctx context.Context, in *CancelRequest, opts ...grpc.CallOption) (*CancelResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(CancelResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_Cancel_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) SetPersona(ctx context.Context, in *SetPersonaRequest, opts ...grpc.CallOption) (*SetPersonaResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SetPersonaResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_SetPersona_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) ApplyTaskAction(ctx context.Context, in *ApplyTaskActionRequest, opts ...grpc.CallOption) (*ApplyTaskActionResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ApplyTaskActionResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_ApplyTaskAction_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) ApplyOperatorTaskAction(ctx context.Context, in *ApplyOperatorTaskActionRequest, opts ...grpc.CallOption) (*ApplyOperatorTaskActionResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ApplyOperatorTaskActionResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_ApplyOperatorTaskAction_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) SaveSession(ctx context.Context, in *SaveSessionRequest, opts ...grpc.CallOption) (*SaveSessionResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SaveSessionResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_SaveSession_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) GetSessionsByChannel(ctx context.Context, in *GetSessionsByChannelRequest, opts ...grpc.CallOption) (*GetSessionsByChannelResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetSessionsByChannelResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_GetSessionsByChannel_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) DeleteSession(ctx context.Context, in *DeleteSessionRequest, opts ...grpc.CallOption) (*DeleteSessionResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DeleteSessionResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_DeleteSession_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) TouchSession(ctx context.Context, in *TouchSessionRequest, opts ...grpc.CallOption) (*TouchSessionResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(TouchSessionResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_TouchSession_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) ListSessions(ctx context.Context, in *ListSessionsRequest, opts ...grpc.CallOption) (*ListSessionsResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ListSessionsResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_ListSessions_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) SaveMessage(ctx context.Context, in *SaveMessageRequest, opts ...grpc.CallOption) (*SaveMessageResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SaveMessageResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_SaveMessage_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) DeleteRecentMessages(ctx context.Context, in *DeleteRecentMessagesRequest, opts ...grpc.CallOption) (*DeleteRecentMessagesResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DeleteRecentMessagesResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_DeleteRecentMessages_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) MessageCount(ctx context.Context, in *MessageCountRequest, opts ...grpc.CallOption) (*MessageCountResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(MessageCountResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_MessageCount_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) SaveMessages(ctx context.Context, in *SaveMessagesRequest, opts ...grpc.CallOption) (*SaveMessagesResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SaveMessagesResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_SaveMessages_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) ReplaceMessages(ctx context.Context, in *ReplaceMessagesRequest, opts ...grpc.CallOption) (*ReplaceMessagesResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ReplaceMessagesResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_ReplaceMessages_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatServiceClient) SearchMessages(ctx context.Context, in *SearchMessagesRequest, opts ...grpc.CallOption) (*SearchMessagesResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SearchMessagesResponse)
|
||||
err := c.cc.Invoke(ctx, ChatService_SearchMessages_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ChatServiceServer is the server API for ChatService service.
|
||||
// All implementations must embed UnimplementedChatServiceServer
|
||||
// for forward compatibility.
|
||||
type ChatServiceServer interface {
|
||||
Snapshot(context.Context, *SnapshotRequest) (*SnapshotResponse, error)
|
||||
GetSession(context.Context, *GetSessionRequest) (*GetSessionResponse, error)
|
||||
RecentMessages(context.Context, *RecentMessagesRequest) (*RecentMessagesResponse, error)
|
||||
RecentTurns(context.Context, *RecentTurnsRequest) (*RecentTurnsResponse, error)
|
||||
Route(context.Context, *RouteRequest) (*RouteResponse, error)
|
||||
Stream(*StreamRequest, grpc.ServerStreamingServer[StreamResponse]) error
|
||||
Cancel(context.Context, *CancelRequest) (*CancelResponse, error)
|
||||
SetPersona(context.Context, *SetPersonaRequest) (*SetPersonaResponse, error)
|
||||
ApplyTaskAction(context.Context, *ApplyTaskActionRequest) (*ApplyTaskActionResponse, error)
|
||||
ApplyOperatorTaskAction(context.Context, *ApplyOperatorTaskActionRequest) (*ApplyOperatorTaskActionResponse, error)
|
||||
SaveSession(context.Context, *SaveSessionRequest) (*SaveSessionResponse, error)
|
||||
GetSessionsByChannel(context.Context, *GetSessionsByChannelRequest) (*GetSessionsByChannelResponse, error)
|
||||
DeleteSession(context.Context, *DeleteSessionRequest) (*DeleteSessionResponse, error)
|
||||
TouchSession(context.Context, *TouchSessionRequest) (*TouchSessionResponse, error)
|
||||
ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error)
|
||||
SaveMessage(context.Context, *SaveMessageRequest) (*SaveMessageResponse, error)
|
||||
DeleteRecentMessages(context.Context, *DeleteRecentMessagesRequest) (*DeleteRecentMessagesResponse, error)
|
||||
MessageCount(context.Context, *MessageCountRequest) (*MessageCountResponse, error)
|
||||
SaveMessages(context.Context, *SaveMessagesRequest) (*SaveMessagesResponse, error)
|
||||
ReplaceMessages(context.Context, *ReplaceMessagesRequest) (*ReplaceMessagesResponse, error)
|
||||
SearchMessages(context.Context, *SearchMessagesRequest) (*SearchMessagesResponse, error)
|
||||
mustEmbedUnimplementedChatServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedChatServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedChatServiceServer struct{}
|
||||
|
||||
func (UnimplementedChatServiceServer) Snapshot(context.Context, *SnapshotRequest) (*SnapshotResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Snapshot not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) GetSession(context.Context, *GetSessionRequest) (*GetSessionResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetSession not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) RecentMessages(context.Context, *RecentMessagesRequest) (*RecentMessagesResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method RecentMessages not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) RecentTurns(context.Context, *RecentTurnsRequest) (*RecentTurnsResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method RecentTurns not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) Route(context.Context, *RouteRequest) (*RouteResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Route not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) Stream(*StreamRequest, grpc.ServerStreamingServer[StreamResponse]) error {
|
||||
return status.Error(codes.Unimplemented, "method Stream not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) Cancel(context.Context, *CancelRequest) (*CancelResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Cancel not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) SetPersona(context.Context, *SetPersonaRequest) (*SetPersonaResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method SetPersona not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) ApplyTaskAction(context.Context, *ApplyTaskActionRequest) (*ApplyTaskActionResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ApplyTaskAction not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) ApplyOperatorTaskAction(context.Context, *ApplyOperatorTaskActionRequest) (*ApplyOperatorTaskActionResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ApplyOperatorTaskAction not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) SaveSession(context.Context, *SaveSessionRequest) (*SaveSessionResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method SaveSession not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) GetSessionsByChannel(context.Context, *GetSessionsByChannelRequest) (*GetSessionsByChannelResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetSessionsByChannel not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) DeleteSession(context.Context, *DeleteSessionRequest) (*DeleteSessionResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method DeleteSession not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) TouchSession(context.Context, *TouchSessionRequest) (*TouchSessionResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method TouchSession not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ListSessions not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) SaveMessage(context.Context, *SaveMessageRequest) (*SaveMessageResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method SaveMessage not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) DeleteRecentMessages(context.Context, *DeleteRecentMessagesRequest) (*DeleteRecentMessagesResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method DeleteRecentMessages not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) MessageCount(context.Context, *MessageCountRequest) (*MessageCountResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method MessageCount not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) SaveMessages(context.Context, *SaveMessagesRequest) (*SaveMessagesResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method SaveMessages not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) ReplaceMessages(context.Context, *ReplaceMessagesRequest) (*ReplaceMessagesResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ReplaceMessages not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) SearchMessages(context.Context, *SearchMessagesRequest) (*SearchMessagesResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method SearchMessages not implemented")
|
||||
}
|
||||
func (UnimplementedChatServiceServer) mustEmbedUnimplementedChatServiceServer() {}
|
||||
func (UnimplementedChatServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeChatServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ChatServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeChatServiceServer interface {
|
||||
mustEmbedUnimplementedChatServiceServer()
|
||||
}
|
||||
|
||||
func RegisterChatServiceServer(s grpc.ServiceRegistrar, srv ChatServiceServer) {
|
||||
// If the following call panics, it indicates UnimplementedChatServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&ChatService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _ChatService_Snapshot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SnapshotRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).Snapshot(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_Snapshot_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).Snapshot(ctx, req.(*SnapshotRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_GetSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetSessionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).GetSession(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_GetSession_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).GetSession(ctx, req.(*GetSessionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_RecentMessages_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RecentMessagesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).RecentMessages(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_RecentMessages_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).RecentMessages(ctx, req.(*RecentMessagesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_RecentTurns_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RecentTurnsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).RecentTurns(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_RecentTurns_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).RecentTurns(ctx, req.(*RecentTurnsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_Route_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RouteRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).Route(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_Route_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).Route(ctx, req.(*RouteRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_Stream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(StreamRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(ChatServiceServer).Stream(m, &grpc.GenericServerStream[StreamRequest, StreamResponse]{ServerStream: stream})
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type ChatService_StreamServer = grpc.ServerStreamingServer[StreamResponse]
|
||||
|
||||
func _ChatService_Cancel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CancelRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).Cancel(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_Cancel_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).Cancel(ctx, req.(*CancelRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_SetPersona_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetPersonaRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).SetPersona(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_SetPersona_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).SetPersona(ctx, req.(*SetPersonaRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_ApplyTaskAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ApplyTaskActionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).ApplyTaskAction(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_ApplyTaskAction_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).ApplyTaskAction(ctx, req.(*ApplyTaskActionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_ApplyOperatorTaskAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ApplyOperatorTaskActionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).ApplyOperatorTaskAction(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_ApplyOperatorTaskAction_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).ApplyOperatorTaskAction(ctx, req.(*ApplyOperatorTaskActionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_SaveSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SaveSessionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).SaveSession(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_SaveSession_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).SaveSession(ctx, req.(*SaveSessionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_GetSessionsByChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetSessionsByChannelRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).GetSessionsByChannel(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_GetSessionsByChannel_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).GetSessionsByChannel(ctx, req.(*GetSessionsByChannelRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_DeleteSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteSessionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).DeleteSession(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_DeleteSession_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).DeleteSession(ctx, req.(*DeleteSessionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_TouchSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(TouchSessionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).TouchSession(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_TouchSession_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).TouchSession(ctx, req.(*TouchSessionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_ListSessions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListSessionsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).ListSessions(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_ListSessions_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).ListSessions(ctx, req.(*ListSessionsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_SaveMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SaveMessageRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).SaveMessage(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_SaveMessage_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).SaveMessage(ctx, req.(*SaveMessageRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_DeleteRecentMessages_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteRecentMessagesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).DeleteRecentMessages(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_DeleteRecentMessages_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).DeleteRecentMessages(ctx, req.(*DeleteRecentMessagesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_MessageCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MessageCountRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).MessageCount(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_MessageCount_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).MessageCount(ctx, req.(*MessageCountRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_SaveMessages_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SaveMessagesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).SaveMessages(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_SaveMessages_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).SaveMessages(ctx, req.(*SaveMessagesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_ReplaceMessages_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ReplaceMessagesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).ReplaceMessages(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_ReplaceMessages_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).ReplaceMessages(ctx, req.(*ReplaceMessagesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChatService_SearchMessages_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SearchMessagesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServiceServer).SearchMessages(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ChatService_SearchMessages_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServiceServer).SearchMessages(ctx, req.(*SearchMessagesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// ChatService_ServiceDesc is the grpc.ServiceDesc for ChatService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var ChatService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "gateway.v1.ChatService",
|
||||
HandlerType: (*ChatServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Snapshot",
|
||||
Handler: _ChatService_Snapshot_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetSession",
|
||||
Handler: _ChatService_GetSession_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RecentMessages",
|
||||
Handler: _ChatService_RecentMessages_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RecentTurns",
|
||||
Handler: _ChatService_RecentTurns_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Route",
|
||||
Handler: _ChatService_Route_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Cancel",
|
||||
Handler: _ChatService_Cancel_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SetPersona",
|
||||
Handler: _ChatService_SetPersona_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ApplyTaskAction",
|
||||
Handler: _ChatService_ApplyTaskAction_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ApplyOperatorTaskAction",
|
||||
Handler: _ChatService_ApplyOperatorTaskAction_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SaveSession",
|
||||
Handler: _ChatService_SaveSession_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetSessionsByChannel",
|
||||
Handler: _ChatService_GetSessionsByChannel_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteSession",
|
||||
Handler: _ChatService_DeleteSession_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "TouchSession",
|
||||
Handler: _ChatService_TouchSession_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListSessions",
|
||||
Handler: _ChatService_ListSessions_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SaveMessage",
|
||||
Handler: _ChatService_SaveMessage_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteRecentMessages",
|
||||
Handler: _ChatService_DeleteRecentMessages_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "MessageCount",
|
||||
Handler: _ChatService_MessageCount_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SaveMessages",
|
||||
Handler: _ChatService_SaveMessages_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ReplaceMessages",
|
||||
Handler: _ChatService_ReplaceMessages_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SearchMessages",
|
||||
Handler: _ChatService_SearchMessages_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "Stream",
|
||||
Handler: _ChatService_Stream_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "gateway/v1/chat.proto",
|
||||
}
|
||||
Reference in new issue
Block a user