Skip to content

feat: externalize artifact engine URL to shared config - #2

Merged
dahai80 merged 2 commits into
mainfrom
feature/artifacts-config-externalize
Jul 27, 2026
Merged

dahai80 merged 2 commits into
mainfrom
feature/artifacts-config-externalize

Conversation

@dahai80

@dahai80 dahai80 commented Jul 25, 2026

Copy link
Copy Markdown
Owner

目的

配置外部化:所有项目配置从配置文件读取,不能写死在代码里。

改动

  • 新增 src/utils/artifactConfig.ts — 集中读取 artifacts-engine URL
    • 优先级:ARTIFACT_ENGINE_URL 环境变量 > ~/.fusion/artifacts/config.yaml > 默认值
    • 内置轻量 YAML section 解析(无需第三方依赖)
    • 缓存结果避免重复读文件
  • 修改 ArtifactCreateTool.ts — 替换硬编码 ARTIFACT_ENGINE_URL → getArtifactEngineURL()
  • 修改 ArtifactUpdateTool.ts — 同上
  • 修改 artifactInjection.ts — 同上

配置文件格式

与 fusion-artifacts-engine 的 default_config.yaml 一致:

server:
  host: "127.0.0.1"
  port: 8892

用户修改 ~/.fusion/artifacts/config.yaml 即可改变所有客户端连接地址,无需改代码。

🤖 Generated with Claude Code

dahai80 and others added 2 commits July 27, 2026 09:29
- Replace hardcoded ~/.fusion with getClaudeConfigHomeDir() (~/.fusion-code)
- Replace custom parseYAMLSection with existing parseYaml() utility
- Fix cache guard: cachedURL !== null instead of truthy check
- Add logging for config load and errors

Co-Authored-By: Claude <[email protected]>
@dahai80
dahai80 force-pushed the feature/artifacts-config-externalize branch from 5c95d1f to 507df09 Compare July 27, 2026 01:30
@dahai80
dahai80 merged commit 8a56079 into main Jul 27, 2026
1 check passed
@dahai80
dahai80 deleted the feature/artifacts-config-externalize branch July 27, 2026 01:33
dahai80 added a commit that referenced this pull request Aug 25, 2026
…ff) (#135)

Route foreground bash commands to fusion-executor (Layer B hands, Rust+PyO3,
self-built built-in tools + sandbox) via UDS NDJSON-RPC. fusion-code src/services/llm/
= Layer A brain (SDK removed, self-built). This wires Layer A to Layer B.

Phase 1 (PRD architecture/fusion-executor-prd.md):
- src/services/executor/types.ts — TS types mirroring executor Rust models
  (snake_case serde verbatim): ExecutionRequest/ExecutionResult/Diagnostics/
  ExecutorStreamChunk. Exit-code constants (0/-124/-1).
- ExecutorClient.ts — UDS NDJSON-RPC client (NOT LSP Content-Length framing).
  Spawns the executor serve+sock persistent UDS server, spawn-gate prevents
  ENOENT, net.Socket + line buffer. Methods health/execute/executeStream
  (multi-frame share one id: chunk then done)/stop. Crash handling isStopping+onCrash.
- ExecutorInstance.ts — state machine stopped to starting to running to stopping
  to error, MAX_CRASH_RECOVERY=3, lazy-require client.
- manager.ts — module-scope singleton + generation counter + race-safe initPromise
  (mirrors lsp/manager.ts). Gate isEnvTruthy(FUSION_CODE_EXECUTOR_ENABLED),
  unset means init no-op (byte-identical). registerCleanup on init.
- executorDriver.ts — BashTool delegation seam. callBashViaExecutor async
  generator: builds ExecutionRequest, executeStream chunk to progress protocol
  (callback to queue bridge, bursts coalesce, fullOutput preserved), terminal
  ExecutionResult to ExecResult (code=exit_code, interrupted=timed_out).
  isExecutorRouteable excludes run_in_background (issue #1) + _simulatedSedEdit.
  No client returns null (fail-open). Test injection seam.
- BashTool.tsx — call() top lazy-require gate (isEnvTruthy guard keeps executor
  module graph out of disabled runtime path). Routeable calls callBashViaExecutor,
  else runShellCommand. Terminal null calls logExecutorFallback + in-process fallback.
- main.tsx — initializeExecutorManager() after LSP init (same trust gate).

Wire = NDJSON (executor fe-ipc writes serde_json::to_string(resp)+newline per frame),
not vscode-jsonrpc Content-Length. Exit codes: 0=ok, -124=timeout, -1=blocked.

Gate + fail-open: FUSION_CODE_EXECUTOR_ENABLED unset means BashTool uses runShellCommand,
zero diff. Executor binary missing/init failed/crash means getExecutorClient() undefined,
callBashViaExecutor returns null, in-process fallback, log warning. Background commands
stay on fusion-code spawnShellTask (executor issue #1 no background API).

Tests: 23 new (manager gate/disabled/fail-open/singleton; executorDriver routing/
mapping/streaming/fail-open). Injection seam avoids mock.module cross-file pollution.

Gates: typecheck 0 errors, 431 tests pass, executor files lint clean (added to CI
lint list), build:dev passes. Runtime gate confirmed in bundle (env unset to runShellCommand).

Phase 2 (diagnostics slicing) + Phase 3 (git snapshot + atomic rollback) follow-up;
Phase 3 blocked on executor issues #1/#2 upstream.

Co-authored-by: Claude Fable 5 <[email protected]>
dahai80 added a commit that referenced this pull request Aug 27, 2026
…on (#153)

Add two behavior protocol sections for local MLX models (ar-plan PR #2):
- getToolResultProcessingProtocol: tool failure retry limit (≤3 same-op),
  failure-mode classification (schema/permission/timeout/not-found), partial
  read guard. More specific than the general error-recovery protocol.
- getLongTaskCheckpointProtocol: 3+ step checkpoint pattern, progress
  survival across context compression, recovery after interruption.

Registration by tier (equal-replacement, compact ≤3K budget):
- compact: drops getErrorRecoveryProtocol (overlaps with the new specific
  tool-result protocol), keeps the two new sections + coding standards.
  Measured 2940 tokens (≤3000 budget).
- standard/extended/full: keep getErrorRecoveryProtocol AND the two new
  sections (budget ample, no overlap concern at scale).

KV-cache (part 2): docs/model-providers.md already documents the accurate
conclusion (defer item 8): fusion-mlx /v1/messages honors cache_control
(issues #196/#241/#289/#386 CLOSED), fusion-code adapter /v1/chat/completions
drops it = large refactor, not a gap. No doc contradiction found.

Gates: typecheck 0, 537 tests pass, lint no new errors (baseline-identical),
build:dev passes.

Co-authored-by: Claude Fable 5 <[email protected]>
dahai80 added a commit that referenced this pull request Aug 30, 2026
…slice #62)

Carve agent-setting-restore sub-block from resume() useCallback
(REPL L1949-1961): restoreAgentFromSession + setMainThreadAgentDefinition
+ setAppState agent-type. resume-chunked-extraction #2 of 4. Sibling to
slice #61 (content-replacement). Pure sync setter chain, no async/require/
feature-flag, no getToolUseContext (pre-frontier L2528). LOC-neutral pattern-
establishing slice. 4 gates: typecheck 0 / 921 tests / biome clean / build:dev.

Co-Authored-By: Claude Fable 5 <[email protected]>
dahai80 added a commit that referenced this pull request Sep 13, 2026
审计核实结论: v1 #1/#3、v2 P1×2/P2×6 已在前序提交修复; 本次落地剩余项。

- lint 存量清零 (23→0): useNodejsImportProtocol ×12 (biome --unsafe
  自动修)、noNonNullAssertion ×10 (守卫变量/for-of/?? "" 兜底逐处
  消除, 不改语义)、noExplicitAny ×11 (Tool.ts AnyToolDef 约束为有意
  any + biome-ignore, Parameters<> 消除 execute→call 适配器 any;
  mcpHelpers 测试改用 McpHTTPServerConfig 真实类型)、
  noTemplateCurlyInString ×9 (被测语法 fixture, biome-ignore 标注)、
  noImplicitAnyLet ×4 (显式类型标注, 不预调用)
- Tool.ts execute→call 适配器: 局部别名收窄 + Parameters<> 转发,
  消除 5×any + 1×!
- biome.json: React Compiler 生成文件 (ink/buddy/context/util.tsx)
  的 t0/t1 缓存槽模式加 linter overrides 豁免, 不手改生成产物
- Task.ts generateTaskId: for-of 消除 bytes[i]!
- 修复过程中两处自引入回归已当场修正: ToolDef 约束改写破坏 30+ 工具
  类型推断 (回退为 biome-ignore 方案); joinedLine 误改 const 触发
  noConstAssign (保持 let)

验证: tsc 0 错误; 1209 pass / 0 fail; lint 0 告警。

Co-Authored-By: AtomCode (glm5.3-flash) <[email protected]>
dahai80 added a commit that referenced this pull request Nov 21, 2026
…op E2E

Records the two runner changes since the provisional baseline
(-p permission bypass; recovery loop with whole-file Write escalation)
and why pre-fix wall numbers are provisional only.

Co-Authored-By: Claude Code <[email protected]>
dahai80 added a commit that referenced this pull request Nov 21, 2026
Valid run 2026-11-21T02-52-26Z (fixed harness: #297 verifier fix,
permission bypass, tool-call-as-text recovery loop): 3/20 (15%), all
easy tasks, no timeouts, textEmissions 0. Conclusions: harness fixes
worth 0->3; 8B ceiling is the easy/medium boundary; opencode/goose
pending for cross-harness comparison.

Co-Authored-By: Claude Code <[email protected]>
dahai80 added a commit that referenced this pull request Nov 21, 2026
Cross-harness final: fusion-code 3/20, opencode 2/20, goose 10/20 —
same Qwen3-8B, same engine. Harness interface (edit tool shape, prompt
size, turn bounds) worth more than model quality for small local
models. ACI simplification now top-ranked lever for fusion-code.

Co-Authored-By: Claude Code <[email protected]>
dahai80 added a commit that referenced this pull request Nov 21, 2026
Survey grounded in this week's bench evidence: constrained decoding
(XGrammar + MLX ports), SWE-agent ACI interface principles, BFCL
measurement methodology, and training-side fixes (ToolACE, Hammer
MFC, APISen, TinyAgent). Ranks five options for fusion-code, from
per-turn emission telemetry in the bench runner to flywheel
fine-tuning asks. Also carries the report #2 skeleton (results
pending the first clean suite run).

Co-Authored-By: Claude Code <[email protected]>
dahai80 added a commit that referenced this pull request Nov 21, 2026
…op E2E

Records the two runner changes since the provisional baseline
(-p permission bypass; recovery loop with whole-file Write escalation)
and why pre-fix wall numbers are provisional only.

Co-Authored-By: Claude Code <[email protected]>
dahai80 added a commit that referenced this pull request Nov 21, 2026
Valid run 2026-11-21T02-52-26Z (fixed harness: #297 verifier fix,
permission bypass, tool-call-as-text recovery loop): 3/20 (15%), all
easy tasks, no timeouts, textEmissions 0. Conclusions: harness fixes
worth 0->3; 8B ceiling is the easy/medium boundary; opencode/goose
pending for cross-harness comparison.

Co-Authored-By: Claude Code <[email protected]>
dahai80 added a commit that referenced this pull request Nov 21, 2026
Cross-harness final: fusion-code 3/20, opencode 2/20, goose 10/20 —
same Qwen3-8B, same engine. Harness interface (edit tool shape, prompt
size, turn bounds) worth more than model quality for small local
models. ACI simplification now top-ranked lever for fusion-code.

Co-Authored-By: Claude Code <[email protected]>
dahai80 added a commit that referenced this pull request Nov 21, 2026
…search

docs: small-model tool-calling survey + bench report #2 (cross-harness baseline)
dahai80 added a commit that referenced this pull request Nov 21, 2026
Env-gated escape hatch forcing a prompt tier regardless of the automatic
param-count/context mapping (mini|compact|standard|extended|full).
Motivation: bench report #2 cross-harness baseline — the same Qwen3-8B
checkpoint resolves 10/20 suite tasks under goose's ~2K-token prompt vs
3/20 under this builder's standard tier (~8.1K tokens measured with
empty memory/context; compact measures ~1.9K). Ships as an override
first; A/B suite numbers decide whether the automatic mapping for <=9B
models should move to compact.

3 unit tests: forced compact on 8B, forced full on 0.5B, invalid value
falls back to automatic.

Co-Authored-By: Claude Code <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant