白
e878b46701
Merge remote-tracking branch 'educraft/main' into merge/educraft-cph
...
# Conflicts:
# .gitignore
# hub/.env.example
# hub/deploy/deploy_fleet_release.sh
# hub/deploy/deploy_platform.sh
# hub/test/integration/helpers.ts
2026-08-06 00:49:02 +08:00
hongjr03
88386fb943
fix(hub): download Feishu resources via bot-owned lark-cli
...
Agent tool downloads and trigger attachment staging both used the SDK
messageResource path, which fails closed for multi-MB teacher files and
did not share the bot-identity transport contract. Route every download
through Hub-owned createFeishuBotCli (secret via stdin, disposable HOME,
HUB_FEISHU_CLI_BIN), keep workspace containment on write, and inject the
adapter in trigger tests.
2026-07-30 11:27:53 +08:00
白
3b544d99f4
feat(filelib): 导出改为下载 cph 编译的真实 PDF
2026-07-27 20:25:29 +08:00
白
ce5fbfb9a6
fix(filelib): 上传上限抬到 50MiB,并把它与 body limit 的串联写清
...
7.8MB 文件上传报 413:那是 Fastify 在 body 解析阶段拒的,不是
HUB_FILELIB_MAX_FILE_BYTES。上传把内容放在 JSON body 里、二进制过 base64
体积涨 4/3,所以有效上限是 min(该值, HUB_HTTP_BODY_LIMIT_BYTES × 3/4)。
原先 body limit 是 1MiB,10MiB 的文件上限根本不可达。
.env.example:body limit 1MiB → 70MiB,新增 HUB_FILELIB_MAX_FILE_BYTES=50MiB。
注意 body limit 同时是 ADR-0022 requestBodySize 维度的平台 ceiling,抬高它
对所有端点生效。
resolveMaxFileBytes 拆成 parseMaxFileBytes(纯解析)+ resolveMaxFileBytes(读
env):原先带默认参数,显式传 undefined 会回落到读 env,"没传值"与"读环境变量"
分不开,vitest 加载 .env 后测试会读到真实配置。
2026-07-27 16:14:50 +08:00
hongjr03
36660f72d6
fix(hub): enable tenant Typst package resolution
2026-07-22 17:47:56 +08:00
hongjr03
db49a0d23d
feat(hub): concurrent multi-PDF convert_pdf_to_md + readable skills (v0.0.40)
...
Teachers convert many PDFs in one tool call with bounded Docmind concurrency.
Each item keeps its own output_dir/document.md and UsageFact; failures are
per-file. Mirror role skills to .cph/runtime-skills and CPH_RUNTIME_SKILLS_DIR
so agents can Read SKILL.md instead of dead .claude/sandbox stubs.
2026-07-21 05:55:55 +00:00
hongjr03
6cefb2a938
feat(hub): raise agent turns/time limits and notify teachers on failure
...
Defaults and silo env go to 150 turns / 1800s wall clock. Run completion
appends a clear Feishu notice for max-turns, timeout, and other failures
(partial answer kept). Startup process-restart kills notify the bound chat.
Release v0.0.38.
2026-07-20 12:07:45 +00:00
hongjr03
46687dd5f6
chore(hub): default HUB_MAX_FILES_PER_MESSAGE to 20
...
Match production silos (raised for multi-image Feishu posts).
2026-07-20 11:50:45 +00:00
ChickenPige0n
a12984d174
feat(admin-web): add folder and project creation functionality in FolderNode and FolderTree components
2026-07-18 12:32:45 +08:00
hongjr03
9e954790dc
feat: add deployable alpha silo
2026-07-11 00:25:45 +08:00
hongjr03
848f913597
feat: secure organization provider credentials
2026-07-10 22:04:43 +08:00
hongjr03
73fa28a178
feat: provision non-root Hub service
2026-07-10 15:59:35 +08:00
hongjr03
c4f052efa2
feat(hub): add Feishu OAuth session for org admin
...
Introduce signed cookie sessions, Feishu web OAuth, requireOrgRole
guards, and the first org admin APIs (summary + project settings).
2026-07-10 00:55:19 +08:00
hongjr03
519ea8144f
feat: add Feishu project onboarding card
2026-07-10 00:32:09 +08:00
hongjr03
3f486232a8
feat(hub): 抽出运行时配置
2026-07-08 15:25:49 +08:00
hongjr03
012c8a7d89
fix(hub): default to OpenRouter Sonnet model
2026-07-08 11:48:16 +08:00
hongjr03
085f7c7186
fix(hub): 去掉冗余 OPENROUTER_API_KEY,直接用 ANTHROPIC_AUTH_TOKEN
2026-07-08 01:48:01 +08:00
hongjr03
b9f50407be
fix(hub): Claude Code SDK 经 OpenRouter Anthropic Skin,保留 provider-agnostic
...
我之前判断错了——OpenRouter 有 Anthropic Messages API 兼容端点
(https://openrouter.ai/api ),Claude Code SDK 直连不需要代理。
ANTHROPIC_AUTH_TOKEN=OpenRouter key,ANTHROPIC_API_KEY='' 即可。
而且 ANTHROPIC_DEFAULT_SONNET_MODEL 可设 OpenRouter model ID
(z-ai/glm-4.7 等),所以 provider-agnostic 没丢。
ADR-0017 重写:从'Anthropic 专有'改为'Claude Code SDK via OpenRouter,
保留 provider-agnostic'。tsc rc=0。
2026-07-08 01:46:09 +08:00
hongjr03
1abcc495f4
test(hub): 真实 model 集成测试 + Gitea CI workflow
...
real-model.test.ts: 用真 OpenRouter model + 真 cph + 真 workspace 跑 agent
tool-calls 循环,验证 MockProvider 测不到的路径(model 返回 tool_calls →
dispatch → tool_result 回传 → 继续/stop)。没 OPENROUTER_API_KEY 时自动
skip,不阻塞 CI;有 key 时自动跑。
两个 test:(1) list files → cph check → 回答;(2) write file → read back。
hub-check.yml: Gitea CI workflow,对齐 checker-check/spec-check 的纪律:
npm ci → prisma generate → tsc → prisma validate → 装 cph → vitest unit →
vitest integration(postgres service container)→ real-model(可选,从
secrets 注入 key)。
全 suite: 60 passed + 2 skipped(无 key)。tsc rc=0。
2026-07-07 23:45:59 +08:00
hongjr03
ce767e9cab
feat(hub): 真实飞书读取 + 状态卡片 + 权限 gate + 部署脚本
...
FeishuRead(ADR-0003): feishuContextTool 从 stub 换成真实 lark
im.v1.message.get(单条 trigger/reply/status_card)+ list(thread 回复);
ADR-0003 chat 授权不变式不变(handler 已 gate)。
StatusCard: sendCard + buildRunStatusCard——完成/出错发 interactive card
(status 文案 + model 选择器 + 取消按钮带 runId),替代纯文本。
Permission(ADR-0004, project-wise): triggerAgent 查 PermissionGrant 对
project 的 edit+ 能力(manage⊇edit 单调);sender open_id 当 principal
(子类型学 OPEN,务实选择,permission.ts 标注);per-artifact OPEN;
settings 组合规则 OPEN。无权限回 '无权限触发'。
Deploy: cph-hub.service systemd unit(ExecStartPre 跑 prisma migrate)+
install_service.sh(idempotent,seed env)+ deploy_platform.sh
(rsync + npm ci + build + restart + healthz)。
client.ts 抽 createLarkClient/startFeishuListenerWithClient,tools 与
ws 共用同一 client。
tsc rc=0;prisma validate 通过;deploy 脚本 bash -n 通过。
2026-07-06 23:44:07 +08:00
hongjr03
b4dd8f09e1
feat(hub): Prisma schema + DB singleton,对齐 spec/System 契约
...
按 ADR-0001..0004/0017 重塑 schema,非照搬旧服务:
- ADR-0001: ProjectGroupBinding project↔chat 1:1(chatId @unique 钉单射不变式)
- ADR-0002: ProjectAgentLock projectId @id(at-most-one)+runId @unique;holder=run 非 session
- ADR-0004: PermissionGrant(resource×principal×role)+PermissionSettings(六旋钮)新落;
PermissionRole=read/edit/manage 与 PlatformRole=admin/teacher 分离(旧 schema 混淆了)
- ADR-0017: AgentSession 无 claudeSessionId,改 provider+model(切 model 即新 session)
- RunState 对齐 spec:加 WAITING_FOR_USER/TIMED_OUT(枚举完整性 OPEN)
- Audit:runId 是 PINNED 关系,其余 OPEN
旧 schema 的 FeishuProjectBinding(user/chat 混表)拆为单一 ProjectGroupBinding。
prisma validate 通过;generate 通过;tsc --noEmit rc=0;
类型级 schema 约束检查全部通过(ADR-0002 主键/唯一、ADR-0017 无 claudeSessionId 等)。
2026-07-06 22:48:28 +08:00