Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions .github/workflows/plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ jobs:
- name: Require a tagged commit from main for releases
if: github.event_name == 'workflow_dispatch'
run: git merge-base --is-ancestor HEAD origin/main
# Pin the host/API used by the real goja integration test.
# Pin the host/API used by the real sandbox integration test.
- uses: actions/checkout@v7
with:
repository: godwit-email/godwit
ref: 95eb0180654353e4e0a026a33258d6f9f0c6fb54
ref: 40cad22278abd39582db8effdbbd41b613e614f5
path: .godwit-ci
- uses: actions/setup-go@v7
with:
Expand All @@ -86,17 +86,14 @@ jobs:
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.4.3
- name: Install published SDK for releases
if: github.event_name == 'workflow_dispatch'
# core/plugins imports internal/i18n, whose catalog_gen.go is generated and not committed.
- name: Generate the pinned host's sources
run: |
(cd "$GODWIT_CHECKOUT/web" && bun install --frozen-lockfile)
cd "$GODWIT_CHECKOUT" && go tool mygo generate
- name: Install published SDK
working-directory: packages/${{ matrix.plugin }}
run: bun install --no-save --ignore-scripts
- name: Install packed SDK for source checks
if: github.event_name != 'workflow_dispatch'
working-directory: packages/${{ matrix.plugin }}
run: |
# shortcut: model types ship in the next SDK release; use the pinned API until then.
(cd "$GODWIT_CHECKOUT/sdk" && bun pm pack --ignore-scripts --filename "$RUNNER_TEMP/godwit-sdk.tgz")
bun add --dev --no-save --ignore-scripts "@godwit/sdk@file:$RUNNER_TEMP/godwit-sdk.tgz"
- run: bun run --bun typecheck
working-directory: packages/${{ matrix.plugin }}
- run: bun test scripts
Expand Down
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,20 @@ Each `packages/<name>/` contains `plugin.json` and `package.json`, whose scripts
write `dist/plugin.json` and a bundled `dist/index.js`. New packages join the shared CI
without adding a workflow.

1. Release Godwit 1.7.0 or later with model plugin support; its release publishes the matching
`@godwit/sdk` version. The published 1.6.0 SDK predates the model API.
2. Bump `packages/<name>/package.json` and `plugin.json` together and merge to main.
3. Create and push `<name>-vX.Y.Z` for that main commit.
4. Run **Actions → Plugins → Run workflow** on main, supplying the plugin name, tag, and actual
1. Bump `packages/<name>/package.json` and `plugin.json` together and merge to main.
2. Create and push `<name>-vX.Y.Z` for that main commit.
3. Run **Actions → Plugins → Run workflow** on main, supplying the plugin name, tag, and actual
minimum released Godwit version. The workflow checks the tagged source, installs the
published SDK, and publishes `index.js`, `plugin.json`, `<name>.tar.gz`,
`registry-plugin.json`, and `SHA256SUMS` to GitHub Releases.
5. Copy the release from the released `registry-plugin.json` into the plugin's
4. Copy the release from the released `registry-plugin.json` into the plugin's
`packages/<name>/godwit-plugin.json`, preserving older releases, and merge it. Then open a PR
that sets the plugin's `source.sha` in `directory.json` to that commit (a new plugin: adds its
entry, whose title, summary and risk wording are the reviewers'). **Publish** builds the
registry, validates the real downloads, signs, and uploads it.

PR checks provide a `<name>-dist` artifact. Until the model API's SDK is published, they
pack it from the pinned Godwit commit used by the goja integration test. Release runs
install the published SDK from npm. Update the host pin when updating the SDK/API.
PR checks provide a `<name>-dist` artifact. Checks and release runs install the published SDK
from npm and test against the pinned Godwit commit. Update the pin when updating the SDK/API.
Release runs require `contents: write`. If a failed run leaves a draft release, inspect
and delete that unpublished draft before retrying. Never replace published files; bump
the version instead. The workflow does not modify the registry.
Expand Down
22 changes: 12 additions & 10 deletions packages/zen-free/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# Zen Free for Godwit

在 Godwit 中使用 OpenCode Zen 的免费模型,无需 API Key。
Use OpenCode Zen's free models in Godwit, with no API key.

## 使用
[简体中文](README.zh-Hans.md)

插件尚未发布。发布并收录后:
## Use

1. 打开 Godwit「设置 → 扩展」,在插件目录中安装 Zen Free。
2. 启用插件,允许它声明的网络权限。
3. 打开「设置 → 模型服务」,选择 Zen Free 的模型。
The plugin is not released yet. Once it is listed:

可用模型由上游免费目录决定,无需手动配置接口或协议。需要支持模型插件的 Godwit 版本。
1. Open Godwit **Settings → Extensions** and install Zen Free from the plugin directory.
2. Enable the plugin and allow the network access it declares.
3. Open **Settings → Model Services** and choose a Zen Free model.

## 数据与可用性
The available models follow the upstream free catalog; there is no endpoint or protocol to set up.

使用模型时,提示、邮件上下文、工具定义及工具结果会发送到 OpenCode 及其模型服务商,请阅读上游的数据使用条款。
## Data and availability

插件依赖非官方公共接口。免费模型、限流和免费期限可能变化,不保证配额或持续可用。
When you use a model, prompts, mail context, tool definitions and tool results are sent to OpenCode and its model providers. Read their data terms before using it with mail you care about.

The plugin relies on an unofficial public interface and identifies itself to it as the OpenCode client. Free models, rate limits and free periods can change, and neither quota nor continued availability is guaranteed.
21 changes: 21 additions & 0 deletions packages/zen-free/README.zh-Hans.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Zen Free for Godwit

在 Godwit 中使用 OpenCode Zen 的免费模型,无需 API Key。

[English](README.md)

## 使用

插件尚未发布。发布并收录后:

1. 打开 Godwit「设置 → 扩展」,在插件目录中安装 Zen Free。
2. 启用插件,允许它声明的网络权限。
3. 打开「设置 → 模型服务」,选择 Zen Free 的模型。

可用模型由上游免费目录决定,无需手动配置接口或协议。

## 数据与可用性

使用模型时,提示、邮件上下文、工具定义及工具结果会发送到 OpenCode 及其模型服务商,请阅读上游的数据使用条款。

插件依赖非官方公共接口,并以 OpenCode 客户端的身份访问它。免费模型、限流和免费期限可能变化,不保证配额或持续可用。
2 changes: 1 addition & 1 deletion packages/zen-free/build.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {expect,test} from "bun:test"
import {resolve} from "node:path"
const checkout=process.env.GODWIT_CHECKOUT
test.skipIf(!checkout)("built plugin runs in Godwit's actual goja sandbox",()=>{
test.skipIf(!checkout)("built plugin runs in Godwit's actual plugin sandbox",()=>{
const built=Bun.spawnSync(["bun","run","build.ts"],{cwd:import.meta.dir});expect(built.exitCode).toBe(0)
const host=Bun.spawnSync(["go","test",resolve(import.meta.dir,"build_test.go"),"-count=1"],{cwd:checkout,env:{...process.env,GODWIT_ZEN_FREE_DIST:resolve(import.meta.dir,"dist")},timeout:120000})
if(host.exitCode!==0)throw new Error(host.stdout.toString()+host.stderr.toString())
Expand Down
7 changes: 4 additions & 3 deletions packages/zen-free/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"path/filepath"
"testing"

"github.com/dop251/goja"
"github.com/MoeForge/moejs"
"github.com/godwit-email/godwit/core/plugins"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -43,9 +43,10 @@ func TestZenFree(t *testing.T) {
require.NoError(t, err)
code, err := plugins.Build(dist, m.Main)
require.NoError(t, err)
program, err := goja.Compile("zen-free", string(code), true)
mod, err := moejs.Compile("zen-free.js", string(code))
require.NoError(t, err)
vm, err := plugins.NewVM("zen-free", mod, plugins.VMOptions{})
require.NoError(t, err)
vm := plugins.NewVM("zen-free", program, plugins.VMOptions{})
t.Cleanup(vm.Close)
cfg := &plugins.ConfigSnapshot{Values: map[string]any{}}
p, err := plugins.Load(context.Background(), vm, m, catalogHost{}, cfg)
Expand Down
Loading