3 Commits

6 changed files with 35 additions and 85 deletions

View File

@@ -1,13 +0,0 @@
FROM golang:alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Sync root workspace templates into embed path before build
RUN rm -rf ./cmd/clawgo/workspace && mkdir -p ./cmd/clawgo/workspace && cp -a ./workspace/. ./cmd/clawgo/workspace/
RUN go build -o clawgo ./cmd/clawgo
FROM alpine:latest
WORKDIR /root/
COPY --from=builder /app/clawgo .
CMD ["./clawgo"]

View File

@@ -19,13 +19,28 @@
## 并发调度(新)⚙️
- 🧩 一条复合消息会先自动拆成多个子任务(可配置上限)
- 🧩 一条复合消息会先自动拆成多个子任务
- 🔀 同一会话内:无资源冲突的子任务可并发执行
- 🔒 同一会话内:有资源冲突的子任务自动串行(避免互相踩)
- 🏷️ 默认会自动推断 `resource_keys`,无需手动填写
---
## 记忆与 EKG 增强(新)🧠
- 📚 每个子任务执行前会自动检索相关记忆(`memory_search`
- 🚨 会结合 EKG 与任务审计识别“重复错误签名”风险
- ⏱️ 高风险任务会自动附带重试退避建议,减少重复踩坑
---
## Telegram 流式渲染优化(新)💬
- 🧷 只在语法安全断点刷新流式内容(减少格式抖动)
- ✅ 结束时做一次最终收敛渲染,保证排版稳定
---
## 3 分钟上手 ⚡
### 1) 安装

View File

@@ -19,13 +19,28 @@ A long-running AI Agent written in Go: lightweight, auditable, and multi-channel
## Concurrency Scheduling (New) ⚙️
- 🧩 A composite message is auto-split into sub-tasks (configurable max)
- 🧩 A composite message is automatically split into sub-tasks
- 🔀 Within the same session: non-conflicting tasks run in parallel
- 🔒 Within the same session: conflicting tasks run serially (to avoid collisions)
- 🏷️ `resource_keys` are inferred automatically by default (no manual input needed)
---
## Memory + EKG Enhancements (New) 🧠
- 📚 Before each sub-task runs, related memory is fetched via `memory_search`
- 🚨 EKG + task-audit are used to detect repeated error-signature risks
- ⏱️ High-risk tasks include retry-backoff hints to reduce repeated failures
---
## Telegram Streaming Rendering (New) 💬
- 🧷 Stream flushes happen at syntax-safe boundaries to reduce formatting jitter
- ✅ A final convergence render is applied when streaming ends for stable layout
---
## 3-Minute Quick Start ⚡
### 1) Install

View File

@@ -1,68 +0,0 @@
package main
import (
"context"
"testing"
"time"
"clawgo/pkg/bus"
"clawgo/pkg/cron"
)
func TestNormalizeCronTargetChatID(t *testing.T) {
if got := normalizeCronTargetChatID("telegram", "telegram:12345"); got != "12345" {
t.Fatalf("expected 12345, got %q", got)
}
if got := normalizeCronTargetChatID("telegram", "12345"); got != "12345" {
t.Fatalf("expected unchanged chat id, got %q", got)
}
}
func TestDispatchCronJob_DeliversTargetedMessageEvenWhenDeliverFalse(t *testing.T) {
mb := bus.NewMessageBus()
defer mb.Close()
status := dispatchCronJob(mb, &cron.CronJob{
ID: "job-1",
Payload: cron.CronPayload{
Message: "time to sleep",
Deliver: false,
Channel: "telegram",
To: "telegram:5988738763",
},
})
if status != "delivered_targeted" {
t.Fatalf("unexpected status: %s", status)
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
out, ok := mb.SubscribeOutbound(ctx)
if !ok {
t.Fatal("expected outbound message")
}
if out.Channel != "telegram" || out.ChatID != "5988738763" || out.Content != "time to sleep" {
t.Fatalf("unexpected outbound: %#v", out)
}
}
func TestDispatchCronJob_FallsBackToSystemInboundWithoutTarget(t *testing.T) {
mb := bus.NewMessageBus()
defer mb.Close()
status := dispatchCronJob(mb, &cron.CronJob{ID: "job-2", Payload: cron.CronPayload{Message: "tick"}})
if status != "scheduled" {
t.Fatalf("unexpected status: %s", status)
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
in, ok := mb.ConsumeInbound(ctx)
if !ok {
t.Fatal("expected inbound message")
}
if in.Channel != "system" || in.ChatID != "internal:cron" {
t.Fatalf("unexpected inbound: %#v", in)
}
}

View File

@@ -1760,7 +1760,8 @@ func rewriteSystemMessageContent(content, template string) string {
func alSessionListForTool(sm *session.SessionManager, limit int) []tools.SessionInfo {
items := sm.List(limit)
out := make([]tools.SessionInfo, 0, len(items))
for _, s := range items {
for i := range items {
s := &items[i]
out = append(out, tools.SessionInfo{
Key: s.Key,
Kind: s.Kind,

View File

@@ -1068,7 +1068,7 @@ func (c *TelegramChannel) deleteTelegramMessageWithRetry(ctx context.Context, ch
func (c *TelegramChannel) handleAction(ctx context.Context, chatID int64, action string, msg bus.OutboundMessage) error {
messageID, ok := parseTelegramMessageID(msg.MessageID)
if !ok && action != "send" && action != "stream" {
if !ok && action != "send" && action != "stream" && action != "finalize" {
return fmt.Errorf("message_id required for action=%s", action)
}
switch action {