Skip to content

Commit 3c697d8

Browse files
Kayshen-XfinikingSmile232323
authored
V0.6.0 (#88)
* fix(renderer): skip paragraph image cache when zoomed in * refactor(publish-cli): streamline version publishing process - Removed the check for already published versions to simplify the workflow. - Updated npm publish commands to handle already published versions gracefully, allowing the process to continue without aborting. - Added publishing step for the new pen-ai-skills package, ensuring it is included in the deployment process. * fix(mcp): wire openpencil codex install to config toml (#85) Co-authored-by: Kaiiiiiiiii <182183652+Smile232323@users.noreply.github.com> * refactor(mcp): reorganize codex-cli handling in installation process - Removed the codex-cli configuration from CLI_CONFIGS and adjusted the installation logic to handle codex-cli actions directly. - Improved error handling for unknown CLI tools and streamlined the installation process for codex-cli, ensuring it uses its own commands for adding/removing components. * feat(agent): add built-in agent SDK and web integration Introduces @zseven-w/agent — a domain-agnostic agent SDK with: - Agent loop (plan→act→observe) with dual execution model - Anthropic + OpenAI-compatible provider adapters via Vercel AI SDK - Tool registry with auth levels (read/create/modify/delete/orchestrate) - Agent team orchestration with delegate tool - SSE streaming protocol encoder/decoder - Sliding window context management Web app integration: - Built-in provider config UI with presets (Anthropic, OpenAI, OpenRouter, DeepSeek) - Model search via provider API proxy endpoint - Built-in models appear in the model dropdown alongside CLI agents - Server-side agent SSE endpoint with session management - Client-side tool executor with undo batch support - Inline tool call blocks in chat UI * feat(api): implement keep-alive pings for long-running LLM calls - Added a keep-alive mechanism in the SSE stream for the agent API to prevent timeouts during long-running LLM calls. - Updated the keep-alive interval to 8 seconds to align with Bun.serve's default idle timeout of 10 seconds. - Ensured proper cleanup of the ping timer when the stream is closed. * feat(mcp): enhance live sync diagnostics and port file management - Implemented a mechanism to probe the live sync server's availability, providing clearer diagnostics for connection issues. - Updated the port file structure to include a unique token for better management and cleanup. - Enhanced the `getSyncUrl` and `getLiveSyncState` functions to return detailed status messages based on the server's response. - Added tests for live sync diagnostics to ensure accurate reporting of server states. * feat(mcp): implement sync URL caching for improved performance - Added caching mechanism for sync URLs to reduce repeated reads and health checks, enhancing performance during live document and selection fetches. - Introduced functions to set and clear the cached sync URL, improving connection management. - Updated existing functions to utilize the cached URL when available, streamlining the fetching process. * feat(skia): enhance syncFromDocument error handling and normalize document structure - Wrapped the syncFromDocument method in a try-catch block to log errors during synchronization, improving debugging capabilities. - Introduced normalization of external documents in the document store to ensure consistent structure before processing. - Updated text content resolution to handle both 'content' and 'text' fields, enhancing compatibility with various node formats. - Refactored text measurement functions to streamline text handling and improve layout consistency. * chore: update package versions to 0.6.0 across all modules and enhance code generation pipeline - Bumped version from 0.5.3 to 0.6.0 in package.json files for all modules including core, agent, and various code generation packages. - Refactored code generation functions to utilize a new AI code generation pipeline, marking previous functions as deprecated with plans for removal in v1.0.0. - Introduced new export nodes functionality in the MCP server for raw PenNode data export. * fix(mcp): clear stale sync cache on page load to prevent false dirty state When refreshing the page or opening a new file, the SSE document:init event would echo back the old cached document, causing applyExternalDocument to unconditionally set isDirty=true and trigger a spurious save prompt. * style(panels): improve AI checklist visual design Add progress bar, spinner animation, highlighted active items, and pill-shaped counter badge for a more polished orchestrator progress UI. * feat(ci): add Homebrew Cask update workflow for OpenPencil releases - Implemented a new GitHub Actions job to update the Homebrew Cask for OpenPencil upon new version tags. - The workflow fetches the latest macOS binaries, computes their SHA256 checksums, and updates the cask formula accordingly. - Includes steps for committing and pushing changes to the tap repository. * docs: update installation instructions in README and enhance CI workflow for Scoop bucket updates - Added detailed installation instructions for macOS, Windows, and Linux in the README. - Introduced a new GitHub Actions job to update the Scoop bucket with the latest OpenPencil release, including versioning and SHA256 checksum computation for Windows binaries. * docs: add OpenPencil Skill plugin link to all i18n READMEs Add localized LLM Skill link in CLI section across all 15 README files, pointing to zseven-w/openpencil-skill repository. * docs: add same-name project disclaimer to all i18n READMEs Distinguish from open-pencil/open-pencil (Figma-compatible visual design with real-time collaboration) — this project focuses on AI-native design-to-code workflows. * fix(agent): resolve SSE timeout, routing, and message format issues - Add 5s keep-alive ping to agent SSE stream (prevents Bun 10s idle timeout) - Consolidate tool-result and abort into single agent endpoint (?action=result|abort) - Fix assistant message history: include text alongside tool-call parts - Fix ToolResultPart format: use 'output' field with {type:'text',value} structure - Use openai.chat() instead of openai() for Chat Completions API (OpenRouter compat) - Use proper TOOL_SCHEMAS instead of z.any() for tool parameters * fix(agent): prevent sliding window from splitting assistant+tool groups The sliding window context strategy was naively slicing by message count, which could leave orphaned tool_result messages without their preceding assistant tool_use — causing Claude API to reject the request. Now counts "logical turns" (user/assistant starts) and never cuts inside an assistant→tool group. Also increased default window from 10 to 50 turns. * fix(agent): use correct AI SDK v6 parameter name maxOutputTokens streamText() in AI SDK v6 renamed maxTokens to maxOutputTokens. Default 4096 prevents OpenRouter credit limit errors from requesting the model's full 65536 token capacity. * feat(agent): add API error classification and auto-retry without tools When a model doesn't support function calling (400 errors, missing arguments), the agent loop now classifies the error and automatically retries without tools on the first turn. Also provides user-friendly error messages for common failures: privacy restrictions, credit limits, rate limiting, and incompatible models. * fix(agent): improve system prompt with PenNode schema and workflow guidance - Add PenNode property schema to agent system prompt so models know valid properties (fills, cornerRadius, padding array, etc.) - Explicitly forbid CSS properties (backgroundColor, boxShadow, etc.) - Add workflow steps: plan before creating, avoid create-then-delete - Change max turns reached from error to normal done event * feat(agent): align insert_node with CLI batch_design capability - insert_node now supports nested children arrays (recursive ID generation) - Post-processing pipeline runs after insertion: role resolution, icon resolution, layout sanitization, unique ID enforcement — same as MCP batch_design with postProcess=true - System prompt teaches model to create entire designs in ONE insert_node call with nested children, instead of 20+ individual calls - Includes concrete example of nested PenNode structure in prompt * fix(agent): deep-clone node before post-processing to avoid Zustand mutation Zustand state is immutable — post-processing functions mutate in-place. JSON.parse(JSON.stringify()) creates a mutable copy. Each post-processing step is individually try-caught so partial failures don't break insertion. * fix(agent): return node count in insert_node result to prevent model retries insert_node now returns {id, nodesCreated, message} so the model knows the full tree was created. System prompt reinforces: when insert_node succeeds, do NOT retry. Reduces 5+ duplicate insert calls to exactly 1. * fix(agent): prevent duplicate root-level inserts from weaker models Track the first root-level insert_node ID per session. Subsequent root-level insert_node calls return the existing ID with a message instead of creating duplicates. Fixes M2.5 and similar models that ignore "do not retry" prompt instructions. * feat(agent): support Anthropic API format in custom provider settings Custom provider preset now has an API Format toggle: "OpenAI Compatible" or "Anthropic". This allows users to configure custom Anthropic-compatible endpoints (proxies, mirrors) in addition to OpenAI-compatible ones. Anthropic provider also now accepts optional baseURL for proxy support. * fix(agent): update Custom option label in provider dropdown * fix(agent): match 'invalid function arguments' in error classifier for auto-retry * fix(agent): always auto-retry without tools on first turn errors Many providers (MiniMax, StepFun) have broken tool call implementations. Instead of pattern-matching specific error messages, any streaming error on turn 0 now triggers auto-retry without tools. The model falls back to generating a text-only response instead of failing entirely. * fix(agent): use clean JSON Schema for tool definitions (no $schema field) Replaced Zod schemas with jsonSchema() from AI SDK for tool parameter definitions. Zod's zodToJsonSchema adds "$schema" and "additionalProperties" fields that strict OpenAI-compatible APIs (MiniMax, StepFun) reject with "invalid function arguments". Clean JSON Schema only has type/properties/ required — compatible with all providers. Also added text-mode fallback prompt for when tools are truly unsupported. * fix(agent): ensure tool call args is always {} and fix turn>0 retry Two fixes for MiniMax "invalid function arguments" error: 1. Ensure args is always {} (never undefined/null) when building conversation history — undefined args causes strict APIs to reject 2. Auto-retry without tools now works on ANY turn (not just turn 0) by resetting history to original user messages and restarting * fix(agent): use SDK response.messages for history instead of manual construction Root cause of MiniMax "invalid function arguments" error: we were manually constructing ModelMessage[] for conversation history, which the SDK then failed to convert correctly to OpenAI format (dropping function.arguments). Fix: use response.response.messages from the SDK — it produces correctly formatted messages that the provider knows how to convert. Only manually add tool result messages for client-executed tools (no execute() function). Also keeps a fetch interceptor as safety net to patch any remaining edge cases with missing/malformed arguments. * fix(agent): parse stringified JSON in insert_node data parameter Some models (MiniMax M2.5) send insert_node data as a JSON string instead of an object. Now handleInsertNode detects string data and JSON.parse it before processing. Fixes nodesCreated:1 when model sends nested children as a stringified object. * fix(agent): sanitize node data and catch addNode side-effect errors - Convert model's 'border' property to valid 'strokes' array - Filter null/non-object children before processing - Wrap docStore.addNode in try-catch — canvas sync side-effects (e.g., renderer hitting unknown properties) may throw but the node IS still inserted. Return success regardless. * fix(agent): auto-zoom to fit after insert_node to show new design * fix(agent): align insert_node with batch_design — auto-replace empty root frame When inserting a frame at root level and an empty root frame exists, replace it and inherit its position (x:0, y:0). This matches the MCP batch_design behavior (line 146-161) so the design lands in the visible viewport instead of off-screen at x:1250. * fix(agent): use updateNode for empty frame replacement (no duplicate keys) The remove+add pattern caused React duplicate key errors because two separate Zustand state updates could leave the node in two places. Now uses a single updateNode call to replace the empty frame's properties in-place — atomic operation, no duplicates. * fix(agent): set replaced=true BEFORE updateNode to prevent duplicate on side-effect throw * fix(agent): use atomic tree swap for empty frame replacement updateNode caused canvas sync crash (map on undefined) because the renderer couldn't handle a complete property replacement on an existing node. Now uses removeNodeFromTree + insertNodeInTree in a single setState — same atomic approach as MCP batch_design. The Skia engine sees the new node as a fresh addition, not an update to an existing one. * fix(agent): simplify empty frame replacement to removeNode+addNode via store API * refactor(agent): use applyNodesToCanvas instead of raw addNode The agent's insert_node was bypassing the design pipeline's sanitization and canvas sync code, causing blank canvas rendering. Now delegates to the SAME applyNodesToCanvas function used by the CLI/MCP design pipeline. This handles: - sanitizeNodesForInsert (role defaults, layout fixes, unique IDs) - isCanvasOnlyEmptyFrame → replaceEmptyFrame (empty frame at 0,0) - icon resolution and image scanning - proper Skia canvas sync Removed the custom postProcessNode method — no longer needed since applyNodesToCanvas does the same work correctly. * feat(agent): add generate_design tool using internal CLI design pipeline generate_design delegates to the SAME generateDesign() function the standard chat uses — orchestrator, sub-agents, streaming insertion, post-processing. Finds the first connected CLI provider for LLM calls. Also uses insertStreamingNode with resetGenerationRemapping() for insert_node, matching the CLI streaming pattern exactly. * feat(agent): replace insert_node with generate_design as primary design tool Remove insert_node and find_empty_space from agent tool set — models should use generate_design for creating designs, not raw PenNode JSON. generate_design accepts natural language prompts and delegates to the full internal pipeline. Keeps update_node/delete_node for modifications. * feat(agent): simplify system prompt to direct models to generate_design Clear instruction: when user asks to create/design, MUST call generate_design tool. No JSON output, no manual node construction. * fix(agent): strip <think> tags from model text output in chat UI Models like MiniMax M2.5 and DeepSeek output <think>...</think> as plain text (not via the thinking SSE event). Strip both closed and unclosed <think> tags from the displayed text during streaming. * fix(renderer): skip paragraph image cache when zoomed out below 0.5x Bitmap text cache at fixed DPR resolution produces jagged edges when scaled down significantly. Now only uses cache at 0.5x–1x zoom range. Below 0.5x and above 1x, falls back to vector Paragraph API rendering. * fix(ai): prevent model from using OpenPencil as brand name in generated designs * fix(agent): strip <think> tags from final message, not just during streaming The regex was only applied during text-delta events but the final message (returned by runAgentStream and set in done/error handlers) used the raw accumulated text. Now stripThinkTags() is applied at the return point so the final displayed message is always clean. * fix(ai): reduce keepalive ping interval from 15s to 5s for Bun compatibility Bun.serve has a 10s idle timeout. The previous 15s ping interval meant the first ping arrived AFTER Bun killed the connection, causing "socket connection was closed unexpectedly" errors when waiting for slow LLM responses (extended thinking, TTFT > 10s). Now pings at 5s. * fix(renderer): rasterize paragraph image cache at 2x minimum for crisp text on low-DPR * fix(agent): remove hardcoded TOOL_SCHEMAS and maxOutputTokens - Server uses client-provided JSON schemas (single source of truth) - maxOutputTokens configurable per provider, defaults to model limit - turnTimeout increased to 5min for generate_design pipeline - Session cleanup wrapped in try-catch - Re-export streamText from agent SDK for consumer use * feat(agent): add builtin provider support to /api/ai/chat endpoint streamViaBuiltin() uses Vercel AI SDK to call LLM directly with API key — no CLI tool required. ai-service.ts attaches builtin credentials from agent settings store when provider is 'builtin'. This enables generate_design to work without any CLI provider connected. * fix(agent): align generate_design params with CLI pipeline and handle field name variants - Pass concurrency, variables, themes, designMd to generateDesign() (was missing, causing lower quality output vs CLI mode) - Accept both 'prompt' and 'description' field names from models - Fall back to builtin provider when no CLI provider connected - Enable animated node insertion * feat(agent): dynamic system prompt via pen-ai-skills + misc fixes - Replace hardcoded AGENT_SYSTEM_PROMPT with buildAgentSystemPrompt() that loads design knowledge from pen-ai-skills (same as CLI pipeline) - Validate builtin provider apiKey before agent connection - Client-side tool schema serialization for server (no duplication) - Update tool_call block status locally as fallback for lost SSE events - Pass maxOutputTokens from provider config * refactor(agent): extract builtin provider settings to separate file Split BuiltinProviderForm, BuiltinProviderCard, BuiltinProvidersSection from agent-settings-dialog.tsx (1279→730 lines) into builtin-provider-settings.tsx (394 lines). Both under 800 line limit. * refactor(agent): extract model selector to separate file Split ModelDropdown, ConcurrencyButton, resolveNextModel, PROVIDER_ICON from ai-chat-panel.tsx (915→690 lines) into ai-chat-model-selector.tsx (183 lines). Both under 800 line limit. * fix(renderer): guard against undefined fill entries in resolveFillColor/resolveStrokeColor * feat(ai): extend BuiltinProviderPreset with 9 new providers Add MiniMax, Zhipu, Kimi, Bailian, DouBao, Xiaomi MiMo, ModelScope, StepFun and NVIDIA NIM to the builtin provider preset type union. * feat(ai): add provider presets and region switcher for builtin providers Add preset configs for MiniMax, Zhipu, Kimi, Bailian (DashScope), DouBao Seed, Xiaomi MiMo, ModelScope, StepFun and NVIDIA NIM with correct API base URLs and model placeholders. Providers with separate China/Global endpoints (MiniMax, Zhipu, Kimi, Bailian, StepFun) get a region toggle that auto-switches the base URL. Region inference works both for new providers and when editing existing ones via REGION_URLS reverse-lookup table. * style(ai): increase settings dialog height for more provider entries * feat(ai): add i18n for builtin provider settings (15 locales) Extract all hardcoded strings in builtin-provider-settings.tsx to i18n keys under the builtin.* namespace. Add translations for all 15 supported languages: en, zh, zh-TW, ja, ko, fr, es, de, pt, ru, hi, tr, th, vi, id. * fix(ai): remove remaining hardcoded strings in builtin provider UI - Extract error messages, badge text, tooltip, and placeholder to i18n - Remove unused region label fields from PresetRegion interface - Add 8 new builtin.* keys across all 15 locales - Fix ai-chat-model-selector API Key badge and parallel agents tooltip - Fix ai-chat-panel provider description template - Fix ai-chat-handlers error messages via i18n.t() * fix(agent): clean up pending tool calls on exit and improve error handling P0: Wrap agent loop generator in try-finally to reject all pending tool call promises and clear timeout timers when the loop exits. Prevents timeout leaks when sessions end early. P1: Add HTTP status code matching (429, 402, 403) before regex fallback in classifyAPIError for more reliable error classification. P1: Clone tool registry in createTeam instead of mutating the caller's config.lead.tools. Add doc comment for unused _maxTokens parameter in sliding-window strategy. * fix(ai): add error handling and retry for tool result POST The POST to /api/ai/agent?action=result had no error handling. If it failed, the agent loop would hang forever waiting for the tool result. Now retries once on failure and logs the error. * fix(ai): use lastActivity for session TTL and guard stream init P1: Add lastActivity timestamp to AgentSession, updated on every event and tool result. TTL cleanup now checks lastActivity instead of createdAt, preventing active long-running sessions from being killed. P1: Wrap ReadableStream construction in try-catch to ensure session cleanup if stream initialization fails. * chore: add docs/ to gitignore * fix(ai): update model lists and fix model search for providers - Update Anthropic models to include Claude 4.6 (Opus + Sonnet) - Update model placeholders: OpenAI→gpt-5.4, MiniMax→M2.7, Zhipu→glm-5, Kimi→kimi-k2.5, Xiaomi→mimo-v2-pro - Add hardcoded model lists for MiniMax and DouBao (no /models API) - Generalize ANTHROPIC_MODELS to BUILTIN_MODEL_LISTS lookup table - Fix provider-models proxy to handle { models: [...] } and array response formats in addition to OpenAI's { data: [...] } * docs: update CLAUDE.md and README files for new AI agent SDK and i18n support - Added new sections in CLAUDE.md detailing the AI agent SDK and its multi-provider capabilities. - Updated README files in multiple languages to include information about the built-in AI agent SDK and full interface localization in 15 languages. - Adjusted key technologies and scopes to reflect recent changes in the project structure and features. * docs(agent): add Agent Team web integration design spec Phase 3 design: model routing via Agent Team. Lead agent uses fast model for chat, designer member uses capable model for generation. SDK changes: source tracking on events, member_start/end events, auto team suffix. Web changes: team toggle + design model selector in settings, conditional createTeam in server endpoint. * fix(electron): fix Scoop/Homebrew tap auto-update in CI - Add pre_install to Scoop manifest to rename versioned exe to OpenPencil.exe - Add mkdir -p for Casks/ and bucket/ dirs in tap repos - Use curl -fSL to fail fast on HTTP errors instead of silent mode * docs(agent): add Agent Team web integration implementation plan 9 tasks: SDK event types → SSE tests → team source injection → server team endpoint → settings store → team UI → i18n → chat handler wiring → e2e verification * feat(agent): add source field and team events to AgentEvent type * test(agent): add SSE encoder/decoder tests for source and team events * feat(agent): inject source field and team events in agent-team * feat(ai): extend agent endpoint to support team mode with members * feat(ai): add teamEnabled and teamDesignModel to agent settings store * feat(ai): wire team mode in chat handlers with member events * feat(ai): add i18n keys for team settings (15 locales) * feat(ai): add Team section UI with design model selector * fix(agent): route resolveToolResult to correct agent in team mode Member tool calls (e.g. generate_design) were routed to leadAgent which didn't have them in its pending map. Added toolCallOwners map to track which agent (lead or member) issued each tool call and route resolveToolResult accordingly. * docs(agent): clarify resolveToolResult routing, member tools, and source handling * fix(agent): force delegation in team mode and add turnTimeout support Two fixes for team mode generation failures: 1. Remove generate_design from lead's tool registry in team mode, forcing the lead to delegate design work to the designer member 2. Add turnTimeout to TeamMemberConfig/TeamConfig and pass 5min timeout to member agents (generate_design needs it) * fix(ai): make team mode visually distinct in chat UI - Add source badge on tool call blocks (shows "designer" pill for member-initiated tool calls) - Pass evt.source to ToolCallBlockData - Use blockquote format for member_start/end events so team activity is clearly visible in the chat stream * fix(agent): scope designer tools, streamline delegation, add model hint 1. Designer member only gets generate_design + snapshot_layout (was: all tools, causing 7 wasteful batch_get calls) 2. Team suffix tells lead to delegate immediately without verbose planning text 3. UI shows amber tip when only 2 providers configured, suggesting a more capable model for design * fix(ai): clean up partial nodes on generate_design failure When generate_design fails midway, partial nodes were left on the canvas and rootInsertId was not set, allowing a retry that created a duplicate design. Now: 1. Set rootInsertId='generating' BEFORE calling generateDesign 2. Snapshot node IDs before generation 3. On failure, remove all new nodes and reset rootInsertId to null 4. Remove incorrect same-model warning from Team UI * fix(ai): show Team section with 1 enabled provider * refactor(ai): smart team mode — auto-enable when design model is set Remove manual Team toggle. Selecting a Design Model automatically enables team mode; "None (single agent)" disables it. Simpler UX: one dropdown replaces toggle + dropdown. Updated descriptions and removed obsolete teamTitle/teamSameModelWarning i18n keys. * fix(agent): properly serialize non-Error objects in error messages String(err) on plain objects produces "[object Object]". Changed to err instanceof Error ? err.message : JSON.stringify(err) for readable error messages in tool results and design generation failures. * refactor(ai): auto team mode using current chat model Remove Design Model dropdown from settings. Team mode is now fully automatic: the designer member always uses the same provider/model as the current chat selection. Zero configuration needed — the value is in role separation (different prompts + scoped tools), not model selection. * style(ai): use min/max height for settings dialog instead of fixed height * feat(ai): add Google Gemini to builtin provider presets Base URL: generativelanguage.googleapis.com/v1beta/openai (OpenAI compatible). Hardcoded model list: Gemini 2.5 Pro, 2.5 Flash, 2.0 Flash. API key placeholder: AIza... * feat(ai): update Gemini models to 3.x series --------- Co-authored-by: Fini <fini.yang@gmail.com> Co-authored-by: Kaiiiiiiiii <2761362118@qq.com> Co-authored-by: Kaiiiiiiiii <182183652+Smile232323@users.noreply.github.com>
1 parent 2cc2447 commit 3c697d8

151 files changed

Lines changed: 9477 additions & 928 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-electron.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,133 @@ jobs:
119119
files: artifacts/*
120120
env:
121121
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
123+
update-homebrew:
124+
name: Update Homebrew Cask
125+
runs-on: ubuntu-latest
126+
needs: release
127+
if: startsWith(github.ref, 'refs/tags/v')
128+
129+
steps:
130+
- name: Get version
131+
id: version
132+
run: echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
133+
134+
- name: Download macOS zips and compute sha256
135+
run: |
136+
VERSION=${{ steps.version.outputs.version }}
137+
curl -fSL "https://github.com/zseven-w/openpencil/releases/download/v${VERSION}/OpenPencil-${VERSION}-arm64-mac.zip" -o arm64.zip
138+
curl -fSL "https://github.com/zseven-w/openpencil/releases/download/v${VERSION}/OpenPencil-${VERSION}-x64-mac.zip" -o x64.zip
139+
echo "SHA_ARM64=$(sha256sum arm64.zip | cut -d' ' -f1)" >> "$GITHUB_ENV"
140+
echo "SHA_X64=$(sha256sum x64.zip | cut -d' ' -f1)" >> "$GITHUB_ENV"
141+
142+
- name: Checkout tap repo
143+
uses: actions/checkout@v4
144+
with:
145+
repository: zseven-w/homebrew-openpencil
146+
token: ${{ secrets.TAP_GITHUB_TOKEN }}
147+
148+
- name: Update cask formula
149+
run: |
150+
VERSION=${{ steps.version.outputs.version }}
151+
mkdir -p Casks
152+
cat > Casks/openpencil.rb << EOF
153+
cask "openpencil" do
154+
version "${VERSION}"
155+
156+
on_arm do
157+
sha256 "${SHA_ARM64}"
158+
url "https://github.com/zseven-w/openpencil/releases/download/v#{version}/OpenPencil-#{version}-arm64-mac.zip"
159+
end
160+
on_intel do
161+
sha256 "${SHA_X64}"
162+
url "https://github.com/zseven-w/openpencil/releases/download/v#{version}/OpenPencil-#{version}-x64-mac.zip"
163+
end
164+
165+
name "OpenPencil"
166+
desc "Open-source vector design tool"
167+
homepage "https://github.com/zseven-w/openpencil"
168+
169+
app "OpenPencil.app"
170+
171+
zap trash: [
172+
"~/Library/Application Support/OpenPencil",
173+
"~/Library/Preferences/dev.openpencil.app.plist",
174+
"~/Library/Caches/dev.openpencil.app",
175+
]
176+
end
177+
EOF
178+
179+
- name: Commit and push
180+
run: |
181+
git config user.name "github-actions[bot]"
182+
git config user.email "github-actions[bot]@users.noreply.github.com"
183+
git add Casks/openpencil.rb
184+
git diff --cached --quiet && exit 0
185+
git commit -m "Update OpenPencil to ${{ steps.version.outputs.version }}"
186+
git push
187+
188+
update-scoop:
189+
name: Update Scoop Bucket
190+
runs-on: ubuntu-latest
191+
needs: release
192+
if: startsWith(github.ref, 'refs/tags/v')
193+
194+
steps:
195+
- name: Get version
196+
id: version
197+
run: echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
198+
199+
- name: Download Windows portable and compute sha256
200+
run: |
201+
VERSION=${{ steps.version.outputs.version }}
202+
curl -fSL "https://github.com/zseven-w/openpencil/releases/download/v${VERSION}/OpenPencil-${VERSION}-x64-win.exe" -o win64.exe
203+
echo "SHA_WIN64=$(sha256sum win64.exe | cut -d' ' -f1)" >> "$GITHUB_ENV"
204+
205+
- name: Checkout scoop bucket
206+
uses: actions/checkout@v4
207+
with:
208+
repository: zseven-w/scoop-openpencil
209+
token: ${{ secrets.TAP_GITHUB_TOKEN }}
210+
211+
- name: Update manifest
212+
run: |
213+
VERSION=${{ steps.version.outputs.version }}
214+
mkdir -p bucket
215+
cat > bucket/openpencil.json << EOF
216+
{
217+
"version": "${VERSION}",
218+
"description": "Open-source AI-native vector design tool",
219+
"homepage": "https://github.com/zseven-w/openpencil",
220+
"license": "MIT",
221+
"architecture": {
222+
"64bit": {
223+
"url": "https://github.com/zseven-w/openpencil/releases/download/v${VERSION}/OpenPencil-${VERSION}-x64-win.exe",
224+
"hash": "${SHA_WIN64}"
225+
}
226+
},
227+
"pre_install": "Rename-Item \"\$dir\\OpenPencil-\$version-x64-win.exe\" 'OpenPencil.exe'",
228+
"bin": "OpenPencil.exe",
229+
"shortcuts": [["OpenPencil.exe", "OpenPencil"]],
230+
"checkver": {
231+
"github": "https://github.com/zseven-w/openpencil"
232+
},
233+
"autoupdate": {
234+
"architecture": {
235+
"64bit": {
236+
"url": "https://github.com/zseven-w/openpencil/releases/download/v\$version/OpenPencil-\$version-x64-win.exe"
237+
}
238+
},
239+
"pre_install": "Rename-Item \"\$dir\\OpenPencil-\$version-x64-win.exe\" 'OpenPencil.exe'"
240+
}
241+
}
242+
EOF
243+
244+
- name: Commit and push
245+
run: |
246+
git config user.name "github-actions[bot]"
247+
git config user.email "github-actions[bot]@users.noreply.github.com"
248+
git add bucket/openpencil.json
249+
git diff --cached --quiet && exit 0
250+
git commit -m "Update OpenPencil to ${{ steps.version.outputs.version }}"
251+
git push

.github/workflows/publish-cli.yml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ jobs:
3434
id: version
3535
run: echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT"
3636

37-
- name: Check if version already published
38-
run: |
39-
VERSION=${{ steps.version.outputs.version }}
40-
if npm view "@zseven-w/pen-types@${VERSION}" version 2>/dev/null; then
41-
echo "::error::Version ${VERSION} already exists on npm. Aborting."
42-
exit 1
43-
fi
44-
echo "Version ${VERSION} is not yet published. Proceeding."
45-
4637
- name: Replace workspace:* with version
4738
run: |
4839
VERSION=${{ steps.version.outputs.version }}
@@ -70,45 +61,51 @@ jobs:
7061
- name: Verify CLI build
7162
run: node apps/cli/dist/openpencil-cli.cjs --version
7263

73-
# Publish in topological order — fail fast on error
64+
# Publish in topological order — skip packages already published at this version
7465
- name: Publish pen-types
75-
run: npm publish --access public
66+
run: npm publish --access public 2>&1 || [[ $? -eq 0 ]] || npm view "@zseven-w/pen-types@${{ steps.version.outputs.version }}" version
7667
working-directory: packages/pen-types
7768
env:
7869
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7970

8071
- name: Publish pen-core
81-
run: npm publish --access public
72+
run: npm publish --access public 2>&1 || npm view "@zseven-w/pen-core@${{ steps.version.outputs.version }}" version
8273
working-directory: packages/pen-core
8374
env:
8475
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8576

8677
- name: Publish pen-codegen
87-
run: npm publish --access public
78+
run: npm publish --access public 2>&1 || npm view "@zseven-w/pen-codegen@${{ steps.version.outputs.version }}" version
8879
working-directory: packages/pen-codegen
8980
env:
9081
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
9182

9283
- name: Publish pen-figma
93-
run: npm publish --access public
84+
run: npm publish --access public 2>&1 || npm view "@zseven-w/pen-figma@${{ steps.version.outputs.version }}" version
9485
working-directory: packages/pen-figma
9586
env:
9687
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
9788

9889
- name: Publish pen-renderer
99-
run: npm publish --access public
90+
run: npm publish --access public 2>&1 || npm view "@zseven-w/pen-renderer@${{ steps.version.outputs.version }}" version
10091
working-directory: packages/pen-renderer
10192
env:
10293
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10394

10495
- name: Publish pen-sdk
105-
run: npm publish --access public
96+
run: npm publish --access public 2>&1 || npm view "@zseven-w/pen-sdk@${{ steps.version.outputs.version }}" version
10697
working-directory: packages/pen-sdk
10798
env:
10899
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
109100

101+
- name: Publish pen-ai-skills
102+
run: npm publish --access public 2>&1 || npm view "@zseven-w/pen-ai-skills@${{ steps.version.outputs.version }}" version
103+
working-directory: packages/pen-ai-skills
104+
env:
105+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
106+
110107
- name: Publish CLI
111-
run: npm publish --access public
108+
run: npm publish --access public 2>&1 || npm view "@zseven-w/openpencil-cli@${{ steps.version.outputs.version }}" version
112109
working-directory: apps/cli
113110
env:
114111
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ __unconfig*
1111
todos.json
1212
.openpencil-tmp/
1313

14+
docs/
15+
1416
# Build outputs
1517
out/
1618
dist/
1719
dist-ssr/
1820
electron-dist/
1921
dist-electron/
22+
.claude

CLAUDE.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ openpencil/
3737
│ ├── pen-figma/ Figma .fig file parser and converter
3838
│ ├── pen-renderer/ Standalone CanvasKit/Skia renderer
3939
│ ├── pen-sdk/ Umbrella SDK (re-exports all packages)
40-
│ └── pen-ai-skills/ AI prompt skill engine (phase-driven prompt loading + design memory)
40+
│ ├── pen-ai-skills/ AI prompt skill engine (phase-driven prompt loading + design memory)
41+
│ └── agent/ Domain-agnostic AI agent SDK (Vercel AI SDK, multi-provider, agent teams)
4142
├── scripts/ Build and publish scripts
4243
└── .githooks/ Pre-commit version sync from branch name
4344
```
4445

45-
**Key technologies:** React 19, CanvasKit/Skia WASM (canvas engine), Paper.js (boolean path operations), Zustand v5 (state management), TanStack Router (file-based routing), Tailwind CSS v4, shadcn/ui (UI primitives), Vite 7, Nitro (server), Electron 35 (desktop), TypeScript (strict mode).
46+
**Key technologies:** React 19, CanvasKit/Skia WASM (canvas engine), Paper.js (boolean path operations), Zustand v5 (state management), TanStack Router (file-based routing), Tailwind CSS v4, shadcn/ui (UI primitives), Vite 7, Nitro (server), Electron 35 (desktop), Vercel AI SDK v6 (agent framework), i18next (15 locales), TypeScript (strict mode).
4647

4748
### Data Flow
4849

@@ -137,7 +138,7 @@ Use [Conventional Commits](https://www.conventionalcommits.org/) format: `<type>
137138

138139
**Types:** `feat`, `fix`, `refactor`, `perf`, `style`, `docs`, `test`, `chore`
139140

140-
**Scopes:** `editor`, `canvas`, `panels`, `history`, `ai`, `codegen`, `store`, `types`, `variables`, `figma`, `mcp`, `electron`, `renderer`, `sdk`, `cli`
141+
**Scopes:** `editor`, `canvas`, `panels`, `history`, `ai`, `codegen`, `store`, `types`, `variables`, `figma`, `mcp`, `electron`, `renderer`, `sdk`, `cli`, `agent`, `i18n`
141142

142143
**Rules:** Subject in English, lowercase start, no period, imperative mood. Body is optional; explain **why** not what. One commit per change.
143144

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ COPY packages/pen-figma/package.json packages/pen-figma/
1010
COPY packages/pen-renderer/package.json packages/pen-renderer/
1111
COPY packages/pen-sdk/package.json packages/pen-sdk/
1212
COPY packages/pen-ai-skills/package.json packages/pen-ai-skills/
13+
COPY packages/agent/package.json packages/agent/
1314
COPY apps/web/package.json apps/web/
1415
COPY apps/desktop/package.json apps/desktop/
1516
COPY apps/cli/package.json apps/cli/

README.de.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
<br />
3333

34+
> **Hinweis:** Es gibt ein weiteres Open-Source-Projekt mit demselben Namen — [OpenPencil](https://github.com/open-pencil/open-pencil), das sich auf Figma-kompatibles visuelles Design mit Echtzeit-Zusammenarbeit konzentriert. Dieses Projekt konzentriert sich auf AI-native Design-to-Code-Workflows.
35+
3436
## Warum OpenPencil
3537

3638
<table>
@@ -180,6 +182,7 @@ docker build --target full -t openpencil-full .
180182

181183
| Agent | Einrichtung |
182184
| --- | --- |
185+
| **Integriert (9+ Anbieter)** | Auswahl aus Anbieter-Presets mit Region-Switcher — Anthropic, OpenAI, Google, DeepSeek und mehr |
183186
| **Claude Code** | Keine Konfiguration — verwendet Claude Agent SDK mit lokalem OAuth |
184187
| **Codex CLI** | In den Agenteneinstellungen verbinden (`Cmd+,`) |
185188
| **OpenCode** | In den Agenteneinstellungen verbinden (`Cmd+,`) |
@@ -188,6 +191,8 @@ docker build --target full -t openpencil-full .
188191

189192
**Modell-Fähigkeitsprofile** — passt Prompts, Thinking-Modus und Timeouts automatisch pro Modellstufe an. Modelle der Vollstufe (Claude) erhalten vollständige Prompts; Standardstufe (GPT-4o, Gemini, DeepSeek) deaktiviert Thinking; Basisstufe (MiniMax, Qwen, Llama, Mistral) erhält vereinfachte verschachtelte JSON-Prompts für maximale Zuverlässigkeit.
190193

194+
**i18n** — Vollständige Interface-Lokalisierung in 15 Sprachen: English, 简体中文, 繁體中文, 日本語, 한국어, Français, Español, Deutsch, Português, Русский, हिन्दी, Türkçe, ไทย, Tiếng Việt, Bahasa Indonesia.
195+
191196
**MCP-Server**
192197
- Eingebauter MCP-Server — Ein-Klick-Installation in Claude Code / Codex / Gemini / OpenCode / Kiro / Copilot CLIs
193198
- Automatische Node.js-Erkennung — falls nicht installiert, automatischer Fallback auf HTTP-Transport und automatischer Start des MCP-HTTP-Servers
@@ -219,6 +224,8 @@ cat design.dsl | op design - # Pipe von stdin
219224

220225
Unterstützt drei Eingabemethoden: Inline-String, `@filepath` (aus Datei lesen) oder `-` (von stdin lesen). Funktioniert mit der Desktop-App oder dem Web-Entwicklungsserver. Siehe [CLI README](./apps/cli/README.md) für die vollständige Befehlsreferenz.
221226

227+
**LLM-Skill** — Installieren Sie das [OpenPencil Skill](https://github.com/ZSeven-W/openpencil-skill)-Plugin, um KI-Agenten (Claude Code, Cursor, Codex, Gemini CLI usw.) das Designen mit `op` beizubringen.
228+
222229
## Funktionen
223230

224231
**Canvas und Zeichnen**
@@ -248,13 +255,13 @@ Unterstützt drei Eingabemethoden: Inline-String, `@filepath` (aus Datei lesen)
248255

249256
| | |
250257
| --- | --- |
251-
| **Frontend** | React 19 · TanStack Start · Tailwind CSS v4 · shadcn/ui |
258+
| **Frontend** | React 19 · TanStack Start · Tailwind CSS v4 · shadcn/ui · i18next |
252259
| **Canvas** | CanvasKit/Skia (WASM, GPU-beschleunigt) |
253260
| **State** | Zustand v5 |
254261
| **Server** | Nitro |
255262
| **Desktop** | Electron 35 |
256263
| **CLI** | `op` — Terminal-Steuerung, Batch-Design-DSL, Code-Export |
257-
| **KI** | Anthropic SDK · Claude Agent SDK · OpenCode SDK · Copilot SDK |
264+
| **KI** | Vercel AI SDK v6 · Anthropic SDK · Claude Agent SDK · OpenCode SDK · Copilot SDK |
258265
| **Laufzeit** | Bun · Vite 7 |
259266
| **Dateiformat** | `.op` — JSON-basiert, menschenlesbar, Git-freundlich |
260267

@@ -289,7 +296,9 @@ openpencil/
289296
│ ├── pen-codegen/ Codegeneratoren (React, HTML, Vue, Flutter, ...)
290297
│ ├── pen-figma/ Figma-.fig-Datei-Parser und -Konverter
291298
│ ├── pen-renderer/ Eigenständiger CanvasKit/Skia-Renderer
292-
│ └── pen-sdk/ Umbrella-SDK (re-exportiert alle Pakete)
299+
│ ├── pen-sdk/ Umbrella-SDK (re-exportiert alle Pakete)
300+
│ ├── pen-ai-skills/ KI-Prompt-Skill-Engine (phasengesteuertes Prompt-Laden)
301+
│ └── agent/ KI-Agenten-SDK (Vercel AI SDK, Multi-Anbieter, Agententeams)
293302
└── .githooks/ Pre-Commit-Versionssynchronisierung vom Branch-Namen
294303
```
295304

@@ -348,6 +357,8 @@ Beiträge sind willkommen! Siehe [CLAUDE.md](./CLAUDE.md) für Architekturdetail
348357
- [x] Multi-Modell-Fähigkeitsprofile
349358
- [x] Monorepo-Umstrukturierung mit wiederverwendbaren Paketen
350359
- [x] CLI-Tool (`op`) für Terminal-Steuerung
360+
- [x] Integriertes KI-Agenten-SDK mit Multi-Anbieter-Unterstützung
361+
- [x] i18n — 15 Sprachen
351362
- [ ] Kollaboratives Bearbeiten
352363
- [ ] Plugin-System
353364

README.es.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
<br />
3333

34+
> **Nota:** Existe otro proyecto de código abierto con el mismo nombre — [OpenPencil](https://github.com/open-pencil/open-pencil), enfocado en diseño visual compatible con Figma con colaboración en tiempo real. Este proyecto se enfoca en flujos de trabajo AI-nativos de diseño a código.
35+
3436
## Por Qué OpenPencil
3537

3638
<table>
@@ -180,6 +182,7 @@ docker build --target full -t openpencil-full .
180182

181183
| Agente | Configuración |
182184
| --- | --- |
185+
| **Integrado (9+ proveedores)** | Selecciona de preajustes de proveedores con selector de región — Anthropic, OpenAI, Google, DeepSeek y más |
183186
| **Claude Code** | Sin configuración — usa Claude Agent SDK con OAuth local |
184187
| **Codex CLI** | Conectar en Configuración de Agente (`Cmd+,`) |
185188
| **OpenCode** | Conectar en Configuración de Agente (`Cmd+,`) |
@@ -188,6 +191,8 @@ docker build --target full -t openpencil-full .
188191

189192
**Perfiles de Capacidad de Modelos** — adapta automáticamente los prompts, el modo de pensamiento y los tiempos de espera según el nivel del modelo. Los modelos de nivel completo (Claude) reciben prompts completos; los de nivel estándar (GPT-4o, Gemini, DeepSeek) desactivan el pensamiento; los de nivel básico (MiniMax, Qwen, Llama, Mistral) reciben prompts simplificados de JSON anidado para máxima fiabilidad.
190193

194+
**i18n** — Localización completa de la interfaz en 15 idiomas: English, 简体中文, 繁體中文, 日本語, 한국어, Français, Español, Deutsch, Português, Русский, हिन्दी, Türkçe, ไทย, Tiếng Việt, Bahasa Indonesia.
195+
191196
**Servidor MCP**
192197
- Servidor MCP integrado — instalación con un clic en Claude Code / Codex / Gemini / OpenCode / Kiro / Copilot CLIs
193198
- Detección automática de Node.js — si no está instalado, recurre automáticamente al transporte HTTP e inicia el servidor MCP HTTP
@@ -219,6 +224,8 @@ cat design.dsl | op design - # Entrada por pipe desde stdin
219224

220225
Soporta tres métodos de entrada: cadena inline, `@filepath` (leer desde archivo), o `-` (leer desde stdin). Funciona con la app de escritorio o el servidor de desarrollo web. Consulta el [README del CLI](./apps/cli/README.md) para la referencia completa de comandos.
221226

227+
**Habilidad LLM** — instala el plugin [OpenPencil Skill](https://github.com/ZSeven-W/openpencil-skill) para enseñar a agentes IA (Claude Code, Cursor, Codex, Gemini CLI, etc.) a diseñar con `op`.
228+
222229
## Características
223230

224231
**Lienzo y Dibujo**
@@ -248,13 +255,13 @@ Soporta tres métodos de entrada: cadena inline, `@filepath` (leer desde archivo
248255

249256
| | |
250257
| --- | --- |
251-
| **Frontend** | React 19 · TanStack Start · Tailwind CSS v4 · shadcn/ui |
258+
| **Frontend** | React 19 · TanStack Start · Tailwind CSS v4 · shadcn/ui · i18next |
252259
| **Lienzo** | CanvasKit/Skia (WASM, acelerado por GPU) |
253260
| **Estado** | Zustand v5 |
254261
| **Servidor** | Nitro |
255262
| **Escritorio** | Electron 35 |
256263
| **CLI** | `op` — control desde terminal, DSL de diseño por lotes, exportación de código |
257-
| **IA** | Anthropic SDK · Claude Agent SDK · OpenCode SDK · Copilot SDK |
264+
| **IA** | Vercel AI SDK v6 · Anthropic SDK · Claude Agent SDK · OpenCode SDK · Copilot SDK |
258265
| **Runtime** | Bun · Vite 7 |
259266
| **Formato de archivo** | `.op` — basado en JSON, legible por humanos, compatible con Git |
260267

@@ -289,7 +296,9 @@ openpencil/
289296
│ ├── pen-codegen/ Generadores de código (React, HTML, Vue, Flutter, ...)
290297
│ ├── pen-figma/ Parser y conversor de archivos .fig de Figma
291298
│ ├── pen-renderer/ Renderizador independiente CanvasKit/Skia
292-
│ └── pen-sdk/ SDK global (reexporta todos los paquetes)
299+
│ ├── pen-sdk/ SDK global (reexporta todos los paquetes)
300+
│ ├── pen-ai-skills/ Motor de habilidades AI (carga de prompts por fases)
301+
│ └── agent/ SDK de agente AI (Vercel AI SDK, multi-proveedor, equipos de agentes)
293302
└── .githooks/ Sincronización de versión pre-commit desde nombre de rama
294303
```
295304

@@ -348,6 +357,8 @@ bun run cli:compile # Compilar CLI a dist
348357
- [x] Perfiles de capacidad multimodelo
349358
- [x] Reestructuración en monorepo con paquetes reutilizables
350359
- [x] Herramienta CLI (`op`) para control desde terminal
360+
- [x] SDK de agente AI integrado con soporte multi-proveedor
361+
- [x] i18n — 15 idiomas
351362
- [ ] Edición colaborativa
352363
- [ ] Sistema de plugins
353364

0 commit comments

Comments
 (0)