@oneciel-ai/ciel-runtime 0.2.37 → 0.2.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +5 -2
  3. package/ciel_runtime.py +94 -96
  4. package/ciel_runtime_support/anthropic_model_policy.py +20 -3
  5. package/ciel_runtime_support/architecture.py +5 -0
  6. package/ciel_runtime_support/channel_inflight.py +4 -4
  7. package/ciel_runtime_support/channel_injection.py +56 -1
  8. package/ciel_runtime_support/channel_mcp_tools.py +34 -0
  9. package/ciel_runtime_support/channel_message_policy.py +9 -1
  10. package/ciel_runtime_support/channel_message_prompt.py +23 -0
  11. package/ciel_runtime_support/channel_pending_injection.py +86 -32
  12. package/ciel_runtime_support/channel_pending_poll.py +6 -2
  13. package/ciel_runtime_support/channel_runtime_environment.py +0 -11
  14. package/ciel_runtime_support/channel_terminal_context.py +0 -6
  15. package/ciel_runtime_support/channel_terminal_proxy.py +3 -42
  16. package/ciel_runtime_support/channel_transcript_repository.py +16 -1
  17. package/ciel_runtime_support/channel_wake_claim_repository.py +0 -19
  18. package/ciel_runtime_support/channel_wake_context.py +6 -13
  19. package/ciel_runtime_support/channel_wake_delivery_repository.py +50 -0
  20. package/ciel_runtime_support/chat_http_controller.py +88 -5
  21. package/ciel_runtime_support/claude_environment.py +100 -3
  22. package/ciel_runtime_support/claude_launch_assembly.py +4 -0
  23. package/ciel_runtime_support/claude_session_socket.py +181 -0
  24. package/ciel_runtime_support/cli_application_context.py +18 -10
  25. package/ciel_runtime_support/cli_dispatch.py +19 -3
  26. package/ciel_runtime_support/cli_parser.py +2 -0
  27. package/ciel_runtime_support/cli_usage.py +3 -2
  28. package/ciel_runtime_support/codex_backend_context.py +8 -3
  29. package/ciel_runtime_support/codex_completion_gate.py +198 -0
  30. package/ciel_runtime_support/codex_turn_recovery.py +240 -83
  31. package/ciel_runtime_support/compatibility_protocol.py +5 -2
  32. package/ciel_runtime_support/config_migrations.py +79 -0
  33. package/ciel_runtime_support/config_repository.py +7 -0
  34. package/ciel_runtime_support/context_summary_policy.py +24 -4
  35. package/ciel_runtime_support/external_event_menu.py +107 -0
  36. package/ciel_runtime_support/external_event_receiver.py +19 -1
  37. package/ciel_runtime_support/launch_state.py +2 -0
  38. package/ciel_runtime_support/managed_tool_injection.py +33 -0
  39. package/ciel_runtime_support/muse_runtime_context.py +291 -0
  40. package/ciel_runtime_support/ollama_thinking.py +12 -26
  41. package/ciel_runtime_support/prelaunch.py +13 -0
  42. package/ciel_runtime_support/prelaunch_launch_panel.py +2 -1
  43. package/ciel_runtime_support/prompt_compaction.py +39 -0
  44. package/ciel_runtime_support/provider_files_proxy.py +248 -0
  45. package/ciel_runtime_support/provider_model_identity.py +10 -2
  46. package/ciel_runtime_support/provider_option_cli.py +1 -1
  47. package/ciel_runtime_support/provider_request_access.py +54 -1
  48. package/ciel_runtime_support/provider_responses_passthrough.py +152 -15
  49. package/ciel_runtime_support/providers/alibaba.py +34 -1
  50. package/ciel_runtime_support/providers/anthropic.py +18 -1
  51. package/ciel_runtime_support/providers/meta.py +252 -21
  52. package/ciel_runtime_support/pseudo_tool_parser.py +17 -1
  53. package/ciel_runtime_support/remote_bridge.py +4 -0
  54. package/ciel_runtime_support/remote_instructions.py +5 -0
  55. package/ciel_runtime_support/remote_memory.py +1 -1
  56. package/ciel_runtime_support/responses_cache_diagnostics.py +82 -0
  57. package/ciel_runtime_support/responses_custom_tool_bridge.py +282 -0
  58. package/ciel_runtime_support/responses_input_compatibility.py +19 -3
  59. package/ciel_runtime_support/router_http.py +301 -4
  60. package/ciel_runtime_support/router_observability_context.py +26 -0
  61. package/ciel_runtime_support/router_server_context.py +1 -0
  62. package/ciel_runtime_support/runtime_adapters.py +31 -0
  63. package/ciel_runtime_support/runtime_constants.py +23 -1
  64. package/ciel_runtime_support/runtime_input_gateway.py +85 -5
  65. package/ciel_runtime_support/runtime_input_status.py +150 -0
  66. package/ciel_runtime_support/runtime_launch.py +27 -4
  67. package/ciel_runtime_support/runtime_paths.py +1 -0
  68. package/ciel_runtime_support/speech_http_controller.py +3 -2
  69. package/ciel_runtime_support/streaming_anthropic.py +3 -0
  70. package/ciel_runtime_support/tool_call_events.py +98 -0
  71. package/ciel_runtime_support/transcript_delta_delivery.py +140 -1
  72. package/ciel_runtime_support/ui_text.py +1 -0
  73. package/ciel_runtime_support/web_search_result_events.py +130 -0
  74. package/ciel_runtime_support/web_ui.py +1 -0
  75. package/ciel_runtime_support/windows_conpty.py +92 -8
  76. package/ciel_runtime_support/workspace_mcp.py +4 -1
  77. package/ciel_runtime_support/workspace_state.py +1 -0
  78. package/docs/Configuration.md +20 -4
  79. package/docs/MCP-Channels.md +79 -6
  80. package/docs/Managed-Tool-Injection.md +25 -0
  81. package/docs/Module-Map.md +4 -0
  82. package/docs/Muse-Code.md +73 -0
  83. package/docs/Observability.md +39 -0
  84. package/docs/Providers.md +29 -2
  85. package/docs/Remote-Bridge.md +12 -0
  86. package/docs/Router.md +1 -0
  87. package/docs/journal/2026/09/01/diagnostics/anthropic/router/fable51-usage-credits.okf +70 -0
  88. package/docs/journal/2026/09/01/implementation/claude/session-socket/all-input-paths/default-delivery.okf +133 -0
  89. package/docs/journal/2026/09/01/implementation/claude/session-socket/windows-direct-input.okf +112 -0
  90. package/docs/journal/2026/09/02/diagnostics/cache/alibaba/qwen38-post-restart-hit-rate.okf +107 -0
  91. package/docs/journal/2026/09/02/diagnostics/cache/ollama-cloud/kimi-k3-codex-hit-rate.okf +91 -0
  92. package/docs/journal/2026/09/02/diagnostics/codex/tui/statusline-cache-metrics.okf +44 -0
  93. package/docs/journal/2026/09/02/diagnostics/input/transport/fallback-behavior.okf +31 -0
  94. package/docs/journal/2026/09/02/diagnostics/providers/ollama-cloud/kimi-k3-agent-turn-recovery.okf +125 -0
  95. package/docs/journal/2026/09/02/diagnostics/providers/ollama-cloud/kimi-k3-parameters.okf +128 -0
  96. package/docs/journal/2026/09/02/diagnostics/remote/mia/socket-tui-visibility.okf +47 -0
  97. package/docs/journal/2026/09/02/diagnostics/runtime/alibaba/token-plan/qwen38-latency.okf +108 -0
  98. package/docs/journal/2026/09/02/diagnostics/runtime/alibaba/token-plan/qwen38-vs-gpt56-latency.okf +92 -0
  99. package/docs/journal/2026/09/02/implementation/anthropic/context/one-million-defaults.okf +85 -0
  100. package/docs/journal/2026/09/02/implementation/cache/alibaba/qwen38-cache-hit-improvement.okf +104 -0
  101. package/docs/journal/2026/09/02/implementation/cache/alibaba/qwen38-cache-hit-improvement.png +0 -0
  102. package/docs/journal/2026/09/02/implementation/cache/alibaba/responses-session-cache.okf +97 -0
  103. package/docs/journal/2026/09/02/implementation/providers/alibaba/qwen38/0902-parameter-alignment.okf +97 -0
  104. package/docs/journal/2026/09/02/implementation/providers/meta/multimodal-tools/contributor-protocol-adoption.okf +140 -0
  105. package/docs/journal/2026/09/02/implementation/providers/meta/muse-spark-1.3-support.okf +53 -0
  106. package/docs/journal/2026/09/02/monitoring/cache/alibaba/cielarvis-qwen38-live-hit-rate.okf +858 -0
  107. package/docs/journal/2026/09/02/operations/release/main-merge-local-deploy.okf +36 -0
  108. package/docs/journal/2026/09/02/operations/release/nightly/local-cache-deployment.okf +54 -0
  109. package/docs/journal/2026/09/02/operations/release/nightly/ollama-kimi-recovery-model-audit-deployment.okf +58 -0
  110. package/docs/journal/2026/09/02/operations/release/nightly/qwen38-cache-improvement-deployment.okf +72 -0
  111. package/docs/journal/2026/09/02/research/cache/alibaba/qwen38-hit-rate-improvement.okf +233 -0
  112. package/docs/journal/2026/09/02/research/cache/codex/provider-scope.okf +77 -0
  113. package/docs/journal/2026/09/02/research/providers/ollama-cloud/desktop-model-exhaustive-audit.okf +159 -0
  114. package/docs/journal/2026/09/03/diagnostics/providers/meta/muse-spark-contributor-cache-hit.okf +148 -0
  115. package/docs/journal/2026/09/03/diagnostics/providers/meta/muse-spark-contributor-required-schema.okf +127 -0
  116. package/docs/journal/2026/09/03/diagnostics/providers/ollama-cloud/kimi-k3-resumed-session-stall.okf +160 -0
  117. package/docs/journal/2026/09/03/diagnostics/providers/ollama-cloud/kimi-k3-substantive-dangling-action.okf +94 -0
  118. package/docs/journal/2026/09/03/diagnostics/remote/kevin/codex-gpt-early-turn-completion.okf +162 -0
  119. package/docs/journal/2026/09/03/implementation/runtimes/meta/muse-code/default-yolo.okf +40 -0
  120. package/docs/journal/2026/09/03/implementation/runtimes/meta/muse-code/native-subscription-router.okf +86 -0
  121. package/docs/journal/2026/09/03/operations/deployment/local/session-socket-default-fallback.okf +41 -0
  122. package/docs/journal/2026/09/03/research/deployment/colab/tailscale/credential-storage.okf +41 -0
  123. package/docs/journal/2026/09/03/research/providers/meta/muse-code/subscription-billing-boundary.okf +64 -0
  124. package/docs/journal/2026/09/03/research/web-chat/voice/instruction-format.okf +135 -0
  125. package/docs/journal/2026/09/04/diagnostics/claude/context/early-auto-compaction.okf +75 -0
  126. package/docs/journal/2026/09/04/diagnostics/claude/context/fable-51-status-200k.okf +54 -0
  127. package/docs/journal/2026/09/04/diagnostics/runtime/codex/responses/replayed-item-id-validation.okf +74 -0
  128. package/docs/journal/2026/09/04/diagnostics/workspaces/onecieldmsui/codex/replay-stall.okf +100 -0
  129. package/docs/journal/2026/09/04/implementation/observability/tool-calls/websocket-stream.okf +49 -0
  130. package/docs/journal/2026/09/04/implementation/web-chat/input/raw-injection.okf +42 -0
  131. package/docs/journal/2026/09/05/diagnostics/tty/claude-raw-idle-render.okf +25 -0
  132. package/docs/journal/2026/09/05/implementation/events/search-response-urls.okf +23 -0
  133. package/docs/journal/2026/09/05/implementation/tools/native-injection.okf +19 -0
  134. package/docs/journal/2026/09/05/implementation/windows/conpty/prompt-delivery-lifecycle.okf +43 -0
  135. package/docs/journal/2026/09/05/release/nightly/conpty-native-tools.okf +13 -0
  136. package/docs/journal/2026/09/05/release/nightly/search-result-urls.okf +14 -0
  137. package/docs/journal/2026/09/06/implementation/codex/inherited-web-mcp.okf +22 -0
  138. package/docs/journal/2026/09/07/integration/main/nightly-merge.okf +13 -0
  139. package/docs/journal/2026/09/07/release/stable/0.2.38.okf +10 -0
  140. package/package.json +1 -1
@@ -57,8 +57,15 @@ how a request enters the active TUI and how the answer should leave it:
57
57
  projection, voice/text hint, and request metadata. `input_mode=tty` puts the
58
58
  caller's message text directly on the private terminal-input path without the
59
59
  Web Chat input envelope.
60
- - `input_transport=tty` (default) submits the selected input format through the
61
- active CLI terminal. `input_transport=router` keeps the full message in the
60
+ - `input_transport=session_socket` is the default preference for every admitted
61
+ input. An interactive Claude Code session launched by Ciel receives it through
62
+ its authenticated messaging socket without terminal typing, including while
63
+ Claude is processing another turn. If the active runtime does not expose a
64
+ usable session socket, Ciel falls back to `input_transport=tty` while the TUI is
65
+ idle; during an active turn the durable input remains queued until terminal
66
+ injection is safe. An explicit `input_transport=tty` always retains terminal
67
+ delivery.
68
+ - `input_transport=router` keeps the full message in the
62
69
  Runtime Input Gateway: while a model turn is already active, its next request
63
70
  consumes the message without a console wake; while the CLI is idle, Ciel types
64
71
  a correlated wake turn and replaces that entire turn with the full pending
@@ -67,11 +74,44 @@ how a request enters the active TUI and how the answer should leave it:
67
74
  short marker-only wake because their terminal turn behavior is different. In
68
75
  both cases the model request receives the queued message exactly once. Router
69
76
  transport therefore requires the active model session to use Ciel Router.
70
- Aliases `llm`, `context`, and `inband` are accepted.
77
+ Aliases `llm`, `context`, and `inband` are accepted. Socket aliases `socket`,
78
+ `claude_socket`, and `messaging_socket` select `session_socket`.
71
79
  - `response_mode=web_chat` (alias `ai_net`, default) uses the normal correlated Web
72
80
  Chat reply contract. `response_mode=tty` leaves the model's ordinary terminal
73
81
  output as-is and does not require a Web Chat tool reply. `response_mode=mcp`
74
82
  supplies a one-request MCP routing hint from `response_mcp`.
83
+ - `raw_injection=true` makes the model-facing input exactly equal to the
84
+ `message` string. Ciel does not add a Web Chat envelope, voice/text marker,
85
+ attachment description, ACK/reply contract, MCP response hint, correlation
86
+ marker, or batch separator. It is independent of `input_transport` and
87
+ `response_mode`; callers selecting a non-terminal response destination must
88
+ arrange that response behavior outside the injected prompt.
89
+
90
+ Exact-input example:
91
+
92
+ ```json
93
+ {
94
+ "message": "Run the queued operation exactly once.",
95
+ "raw_injection": true,
96
+ "input_transport": "session_socket",
97
+ "response_mode": "tty"
98
+ }
99
+ ```
100
+
101
+ Every admitted private Runtime Input has an independent lifecycle identifier.
102
+ The message POST response includes `request_id` and a `request` object whose
103
+ initial state is `queued`; HTTP success does not claim that the TUI accepted the
104
+ input. Query one request with `GET /ca/channel/requests/{request_id}` or list
105
+ latest states with `GET /ca/channel/requests?after=0&status=submitted&limit=100`.
106
+ The `/ca/chat/requests/...` aliases are equivalent. State transitions are
107
+ `queued -> submitted -> replied` or `queued|submitted -> failed`. They are also
108
+ published through `/ca/events/stream?category=runtime_input.status` and
109
+ `/ca/events/ws?category=runtime_input.status`.
110
+
111
+ The lifecycle store is `runtime-input-status.jsonl`; the delivery queue and its
112
+ cursor both use the private `runtime-inputs.jsonl` ID domain. Public
113
+ `chat-messages.jsonl` IDs are never used to calculate the pending Runtime Input
114
+ count.
75
115
 
76
116
  The MCP hint is declarative; Ciel does not call the named server itself:
77
117
 
@@ -98,6 +138,29 @@ remains supported and maps to the old paired behavior. Unknown modes and an MCP
98
138
  response without `response_mcp.server` return HTTP 400; they never silently fall
99
139
  back to another route.
100
140
 
141
+ ### Claude Code cross-session socket boundary
142
+
143
+ Claude Code 2.1.239 and later publishes its cross-session messaging socket on
144
+ Windows as well as macOS and Linux. For an interactive Claude session, Ciel now
145
+ creates an explicit per-launch socket path, passes it with
146
+ `--messaging-socket-path`, and enables `crossSessionInbound=accept` in Ciel's
147
+ generated runtime settings. Windows uses a local named pipe; Unix platforms use
148
+ an AF_UNIX socket.
149
+
150
+ Each connection authenticates first with the `peerToken` from Claude's
151
+ user-private `~/.claude/sessions/<pid>.<socket-hash>.key` file and then submits a
152
+ newline-delimited `user` frame. Ciel deliberately omits a peer `from` address:
153
+ the existing private Web Chat/MCP response contract remains authoritative, so a
154
+ socket input does not invent a second Claude peer as its reply destination.
155
+ If the socket is not available before delivery during an active turn, the durable
156
+ Runtime Input remains queued. Once a delivery attempt begins, an unconfirmed
157
+ socket or TTY submission becomes `failed` and is not typed again automatically.
158
+ While the TUI is idle, a failed socket attempt may try TTY once; if that attempt
159
+ is not confirmed, the request remains failed.
160
+
161
+ Set `claude_code.session_socket_input=false` to disable automatic socket setup
162
+ for a launch, or choose `input_transport=tty|router` on an individual input.
163
+
101
164
  Web Chat attachments are uploaded through `POST /ca/channel/files`. The public
102
165
  chat transcript contains only download metadata; the private Runtime Input
103
166
  projection adds a validated workspace-local path so the active Claude or Codex
@@ -120,11 +183,16 @@ POST /ca/events/receivers/<receiver-id>
120
183
  POST /ca/events/webhooks/<receiver-id>
121
184
  ```
122
185
 
123
- The configuration POST accepts `enabled`, `transport` (`webhook` or `sse`), `url` for SSE, an optional `event_types` allow-list, and either `webhook_secret` or `authorization`. Secrets are stored in the local encrypted workspace vault and are never returned by the GET response.
186
+ The configuration POST accepts `enabled`, `transport` (`webhook` or `sse`), `url`
187
+ for SSE, an optional `event_types` allow-list, and either `webhook_secret` or
188
+ `authorization`. `input_transport=auto|session_socket|tty|router` controls how
189
+ admitted events reach the active runtime; `auto` prefers the session socket and
190
+ uses the same safe TTY fallback. Secrets are stored in the local
191
+ encrypted workspace vault and are never returned by the GET response.
124
192
 
125
193
  Webhook bodies use CloudEvents 1.0 structured JSON and Standard Webhooks `webhook-id`, `webhook-timestamp`, and `webhook-signature` headers. SSE requests negotiate the same structured representation with `Accept: text/event-stream, application/cloudevents+json`; each `data` frame must contain one CloudEvent 1.0 structured JSON object. Ciel validates framing, signatures, replay windows, type filters, and duplicate identities, but preserves the admitted event text exactly for the LLM.
126
194
 
127
- Reconnects use the SSE `id` field and `Last-Event-ID` by default. Streams that carry a cursor inside the CloudEvent can set `cursor_json_pointer` to an RFC 6901 pointer such as `/data/stream_id`. If the producer expects its cursor in the reconnect URL instead of `Last-Event-ID`, set the provider-neutral `cursor_query_parameter` to that query parameter's name. Ciel persists the projected cursor per workspace and receiver; no product-specific event schema is built into the runtime.
195
+ Reconnects use the SSE `id` field and `Last-Event-ID` by default. Streams that carry a cursor inside the CloudEvent can set `cursor_json_pointer` to an RFC 6901 pointer such as `/data/stream_id`. If the producer expects its cursor in the reconnect URL instead of `Last-Event-ID`, set the provider-neutral `cursor_query_parameter` to that query parameter's name. Ciel persists the projected cursor per workspace and receiver; no product-specific event schema is built into the runtime. A failed earlier request blocks later requests, preserving input order and preventing two requests from sharing one unresolved TUI draft.
128
196
 
129
197
  The workspace router is the sole owner of each outbound SSE subscription. The prelaunch settings process only persists receiver configuration, preventing duplicate connections and duplicate deliveries. The terminal bridge also performs a bounded periodic safety rescan of its durable private input queue so a missed filesystem notification cannot strand an admitted event.
130
198
 
@@ -140,7 +208,12 @@ When Web Chat or an explicit Ciel integration needs response tools, the CLI may
140
208
  POST /ca/mcp
141
209
  ```
142
210
 
143
- It exposes only Ciel-owned tools such as `send_message`, `send_file`, `compact_session`, and `llm_options`. The endpoint is stateless and has no MCP GET stream, `/ca/mcp/sse`, session registry, replay cursor, or external notification subscription.
211
+ It exposes only Ciel-owned tools such as `submit_input`, `send_message`,
212
+ `send_file`, `compact_session`, and `llm_options`. External Streamable HTTP MCP
213
+ clients can call `submit_input`; its default transport follows the same
214
+ session-socket-first policy and accepts an explicit `session_socket|tty|router`
215
+ override. The endpoint is stateless and has no MCP GET stream, `/ca/mcp/sse`,
216
+ session registry, replay cursor, or external notification subscription.
144
217
 
145
218
  ## MCP 2026-07-28
146
219
 
@@ -0,0 +1,25 @@
1
+ # Managed tool launch policy
2
+
3
+ Ciel-owned tool definitions can declare `injection_mode`: `always`, `native`,
4
+ or `non_native`. The default is `always`, retaining channel/runtime integration.
5
+ `WorkspaceMcpLaunchService.prepare(..., native=...)` filters only its
6
+ `injected_servers` argument. User-owned `workspace_mcp.servers` is not filtered.
7
+ The metadata is removed before generating CLI arguments or MCP JSON.
8
+
9
+ Claude's generated DuckDuckGo and fetch bundle is non-native-only, including
10
+ when the Ciel web-search override is enabled. Anthropic direct and routed
11
+ connections both retain their own web tools. Codex and Codex app-server pass
12
+ their existing native-provider classification to the same projection policy;
13
+ their current launch paths do not auto-generate a DuckDuckGo bundle.
14
+
15
+ Selection happens for each launch, without deleting shared files or changing
16
+ another running instance. This does not dynamically reconfigure an already
17
+ running CLI after a provider switch. It does not change the CLI's own search
18
+ settings, install a fallback after an error, or remove user-installed tools.
19
+
20
+ Codex native launches (direct or routed), including app-server, additionally
21
+ override `mcp_servers.duckduckgo.enabled=false` and
22
+ `mcp_servers.web_fetch.enabled=false` after workspace MCP projection. This
23
+ suppresses replacement web tools inherited from Codex's global configuration
24
+ for this child process only. Non-native launches receive neither override.
25
+ The original global/project configuration files remain unchanged.
@@ -185,6 +185,10 @@ Claude/Codex transcript의 queued-only wake를 찾아 LLM delivery cursor를 안
185
185
 
186
186
  대기 중인 channel 메시지의 필터링, 중복 제거, wake claim, prompt 생성 및 터미널 주입을 조정하는 Channel Application Service. 상태 판정, prompt 전략, wake 저장소, I/O를 각각 10필드 이하 포트로 분리한다.
187
187
 
188
+ ### `ciel_runtime_support/runtime_input_status.py`
189
+
190
+ private Runtime Input의 `queued -> submitted -> replied|failed` 전이를 JSONL로 보존하고 요청별 조회 및 `runtime_input.status` 실시간 이벤트를 제공하는 lifecycle repository다. terminal 상태에서 이전 상태로 되돌아가는 전이는 거부한다.
191
+
188
192
  ### `ciel_runtime_support/channel_tool_context.py`
189
193
 
190
194
  외부 채널에서 시작된 tool-use의 원문 context를 bounded, thread-safe 저장소에 보관하고 대응하는 tool-result 후속 요청에 한 번만 주입하는 Channel Application Service. 저장소가 lock·eviction·consume-on-read를 소유하며 메시지 projection과 시간·텍스트·로그 효과는 typed ports로 분리한다.
@@ -0,0 +1,73 @@
1
+ # Muse Code runtime
2
+
3
+ Ciel Runtime can launch Meta's official Muse Code CLI while preserving Muse
4
+ Code subscription authentication:
5
+
6
+ ```sh
7
+ ciel-runtime muse
8
+ ```
9
+
10
+ This is a native runtime integration. Muse Code sends its model traffic directly
11
+ with the browser-authenticated credential created by its own onboarding. The Ciel
12
+ Router remains the local control plane for Web Chat, external inputs, remote
13
+ instructions, and workspace memory; it does not proxy the subscription model
14
+ request through the pay-as-you-go Model API.
15
+
16
+ ## Authentication and billing boundary
17
+
18
+ Native Muse launches remove `META_API_KEY` and `MODEL_API_KEY` from the child
19
+ environment. Meta documents that API-key authentication takes precedence over a
20
+ stored browser session and that additional API keys are billed pay-as-you-go.
21
+ Run `ciel-runtime muse`, then use Muse's `/login` command when sign-in is needed.
22
+
23
+ Use the existing Ciel `meta` provider with Claude or Codex when direct Model API
24
+ pay-as-you-go routing is desired. That is a separate path from Muse Code
25
+ subscription usage.
26
+
27
+ ## Platforms and installation
28
+
29
+ On macOS and Linux, Ciel discovers `muse` on `PATH`; when it is absent, Ciel runs
30
+ Meta's official installer from `https://dev.meta.ai/install.sh` with Bash.
31
+
32
+ Meta currently documents native Muse Code installation for macOS and Linux. On
33
+ Windows, Ciel discovers or installs Muse Code inside the default WSL2
34
+ distribution and launches it through `wsl.exe`. The current Windows directory is
35
+ preserved by WSL path translation.
36
+
37
+ ## Model, effort, and passthrough
38
+
39
+ The native runtime defaults to `muse-spark-1.3`. When the selected Ciel provider
40
+ is `meta`, its configured Muse model and supported reasoning effort are forwarded.
41
+ Ciel `max` maps to Muse's documented `ultra` tier. Explicit Muse flags win:
42
+
43
+ ```sh
44
+ ciel-runtime muse --model muse-spark-1.3 --reasoning-effort high
45
+ ciel-runtime muse exec --json "Inspect this repository"
46
+ ciel-runtime --ca-runtime muse -- --version
47
+ ```
48
+
49
+ Utility subcommands such as `login`, `auth`, `config`, `schema`, `serve`, and
50
+ `session-message` are passed through without injecting model flags.
51
+
52
+ Interactive sessions, `exec`, and `resume` include Muse's `--yolo` option by
53
+ default, matching Ciel's Codex launch policy. Muse defines this option as
54
+ disabling approval and sandboxing and trusting the workspace for that run.
55
+ An explicitly supplied `--yolo` is retained once rather than duplicated.
56
+ Utility commands do not receive it.
57
+
58
+ ## Router input delivery
59
+
60
+ Interactive Muse sessions run through Ciel's channel-aware terminal proxy when
61
+ available. Web Chat and external inputs therefore use the standard
62
+ session-socket-first policy and safely fall back to terminal delivery because
63
+ Muse Code does not expose Claude's session socket. Because Muse does not publish
64
+ Claude/Codex-compatible transcript confirmation events, its terminal fallback
65
+ uses one write and commits the durable channel cursor immediately; it does not
66
+ replay the same accepted message while waiting for an unavailable confirmation.
67
+ Headless `muse exec` and
68
+ utility commands run directly and do not start an interactive input proxy.
69
+
70
+ Muse Code 1.0.2 also exposes `muse serve` for the Muse Session Protocol (MSP) over
71
+ stdio and `muse session-message` for peer sessions. Ciel preserves these commands
72
+ as native passthrough surfaces; it does not claim MSP lifecycle ownership for an
73
+ ordinary interactive TUI launch.
@@ -108,6 +108,45 @@ GET /ca/events/stream
108
108
  Server-Sent Events로 실시간 이벤트 전송.
109
109
  쿼리 파라미터: `?level=debug&category=router`
110
110
 
111
+ ### WebSocket 스트림
112
+ ```
113
+ GET /ca/events/ws
114
+ ```
115
+ RFC 6455 WebSocket text frame으로 같은 이벤트 JSON을 실시간 전송한다.
116
+ `after`, `level`, `category` 쿼리 파라미터를 SSE와 동일하게 지원하며,
117
+ 원격 연결은 라우터의 기존 외부 접근 토큰 검사를 그대로 거친다.
118
+
119
+ CLI 툴콜만 구독:
120
+ ```
121
+ ws://127.0.0.1:<port>/ca/events/ws?category=tool.call
122
+ ```
123
+
124
+ `tool.call` 이벤트는 라우터 변환 스트림과 Claude/Codex/Muse Code 세션
125
+ transcript의 구조화된 툴 시작 레코드에서 생성된다. Windows에서 실행되는
126
+ Muse WSL 세션도 `wslpath`로 확인한 세션 저장소를 직접 추적한다. `data`에는 `call_id`, `name`,
127
+ `call_type`, `arguments`, `runtime`, `model`이 가능한 범위에서 포함된다.
128
+ 동일한 `call_id`가 라우터와 transcript 양쪽에서 관측되면 한 번만 전달한다.
129
+ `tool_call_events.include_arguments=false`로 설정하면 모든 `tool.call` 이벤트의
130
+ 인자 값을 제외할 수 있다.
131
+
132
+ 검색 응답의 URL도 같은 `tool.call` 카테고리와 기존 WS/SSE/recent 경로로
133
+ 전달한다. 결과는 `data.phase == "result"`로 구분하며 다음 형태다.
134
+
135
+ ```json
136
+ {"call_id":"toolu_...","name":"WebSearch","runtime":"claude","phase":"result","urls":["https://example.org/article"]}
137
+ ```
138
+
139
+ 검색어·제목·요약·응답 본문은 이 결과 이벤트에 포함하지 않는다. 기존 호출 시작
140
+ 이벤트는 유지되므로 결과 URL만 필요한 소비자는 `phase`를 필터링한다.
141
+ Claude Code는 호출 ID에 연결된 `tool_result.content`의 JSON `Links` 목록,
142
+ Anthropic 서버 도구는 `web_search_tool_result`의 URL을 읽는다. Codex는 검색
143
+ 호출에 연결된 function/custom output, 완료된 `web_search_call`의 `action.sources`
144
+ 및 `results`, assistant의 구조화된 `url_citation`을 지원한다.
145
+ 단, Codex 네이티브 rollout은 검색어/상태만 저장하고 결과 URL을 생략할 수 있다.
146
+ 그 경우 이 수집기는 URL을 생성하거나 검색어/페이지 열기 입력을 결과로 대신하지 않는다.
147
+ URL 없는 응답은 이벤트를 발행하지 않는다. 호출 연결과 중복 방지 상태는
148
+ transcript cursor와 함께 저장하며 최근 512개로 제한한다.
149
+
111
150
  ### 최근 이벤트 JSON
112
151
  ```
113
152
  GET /ca/events/recent
package/docs/Providers.md CHANGED
@@ -50,7 +50,14 @@ token은 Bearer header로 전송하며, 사용자 지정 `base_url`로 사설 ga
50
50
 
51
51
  ### Alibaba Model Studio Singapore
52
52
 
53
- `alims-intl`의 기본 모델은 Singapore International scope의 `qwen3.8-max`다.
53
+ `alims-intl`의 기본 모델은 Singapore International scope의 rolling alias
54
+ `qwen3.8-max`다. 고정 스냅샷 `qwen3.8-max-0902`도 모델 목록에서 선택할 수 있다.
55
+ Token Plan은 공식 지원 ID인 rolling alias `qwen3.8-max`를 사용하며, Responses
56
+ API에서는 `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max` reasoning
57
+ effort를 그대로 전달한다. Chat Completions의 축약 effort 매핑과 혼용하지 않는다.
58
+ Alibaba Responses session cache의 공식 opt-in 계약에 따라
59
+ `x-dashscope-session-cache: enable`을 Responses 요청에 기본 전송한다. Chat과
60
+ Anthropic Messages 요청에는 이 header를 추가하지 않는다.
54
61
  공식 한도에 맞춰 context window는 1,000,000, 최대 입력은 일반 모드 991,808,
55
62
  thinking 모드 983,616, 최대 출력은 131,072로 취급한다. Codex에는 thinking 모드의
56
63
  안전한 입력 상한인 983,616을 model catalog context로 제공한다.
@@ -137,8 +144,10 @@ Imagine image/video, Voice, STT/TTS 모델 ID는 text LLM 선택 메뉴에 섞
137
144
 
138
145
  - **Native 모드**: Claude Code가 직접 Anthropic API 호출. Router가 중계하지 않음.
139
146
  - **Routed 모드**: Router가 중계하며 `ROUTED_COMPAT_PROMPT`를 시스템 프롬프트에 주입.
147
+ - Routed 모드는 기본적으로 표준 200K 컨텍스트를 사용한다. 1M 사용 크레딧
148
+ beta를 명시적으로 사용할 때만 모델 ID에 `[1m]`을 붙인다.
140
149
  - 공개 모델 ID 목록 (`ANTHROPIC_PUBLIC_MODEL_DEFAULT_IDS`):
141
- - `claude-fable-5`, `claude-opus-4-8`, `claude-sonnet-4-6`, `claude-haiku-4-5-20251001`, `claude-haiku-4-5`
150
+ - `claude-fable-5-1`, `claude-fable-5`, `claude-opus-4-8`, `claude-sonnet-4-6`, `claude-haiku-4-5-20251001`, `claude-haiku-4-5`
142
151
  - 제한 접근 모델 (`ANTHROPIC_LIMITED_ACCESS_MODEL_IDS`):
143
152
  - `claude-mythos-5`, `claude-mythos-preview`
144
153
 
@@ -247,6 +256,24 @@ ZCode 버전의 선택된 Desktop provider는 fallback으로만 읽는다. 두
247
256
 
248
257
  ---
249
258
 
259
+ ## Meta Model API / Muse Spark
260
+
261
+ - `muse-spark-1.3`과 `muse-spark-1.3-contributor`를 기본 1.3 계열로 제공한다.
262
+ - Responses, Chat Completions, Messages를 각각 네이티브 프로토콜로 전달한다.
263
+ - Responses의 `web_search`, `tool_search`, `defer_loading` 서버 도구와 검색
264
+ 결과·URL citation을 보존한다.
265
+ - 이미지, MP4 비디오, WAV/MP3 오디오, PDF/텍스트/JSON 문서 블록을 프로토콜별
266
+ 원형으로 전달한다. Muse Spark 1.3 오디오는 Meta가 제한적 지원으로 명시하므로
267
+ 고품질 오디오 작업에는 1.2 또는 Muse Voice Transcribe를 사용한다.
268
+ - 인라인 파일은 최대 50,000,000 bytes이며, `/v1/files`는 파일당 1 GiB와 팀당
269
+ 100 GiB를 지원한다. 추론용 업로드 purpose는 `user_data`이다.
270
+ - PDF는 텍스트 기준 처음 100페이지와 페이지 이미지 기준 처음 50페이지를 처리한다.
271
+ - Files API 업로드·목록·내용 조회·삭제는 로컬 라우터와 인증된 Remote Bridge에서
272
+ Meta 자격 증명으로 전달된다. 대용량 multipart 업로드는 메모리에 통째로 적재하지
273
+ 않고 스트리밍된다.
274
+
275
+ ---
276
+
250
277
  ## vLLM / LM Studio
251
278
 
252
279
  - OpenAI 호환 로컬 서버.
@@ -70,6 +70,10 @@ Use `http://ROUTER_HOST:ROUTER_PORT/v1` as an OpenAI base URL and
70
70
  | Anthropic token count | `POST /v1/messages/count_tokens` |
71
71
  | OpenAI model list | `GET /v1/models` |
72
72
  | OpenAI model detail | `GET /v1/models/{provider}/{model}` |
73
+ | Provider file upload | `POST /v1/files` |
74
+ | Provider file list | `GET /v1/files` |
75
+ | Provider file metadata/content | `GET /v1/files/{file_id}` and `GET /v1/files/{file_id}/content` |
76
+ | Provider file deletion | `DELETE /v1/files/{file_id}` |
73
77
  | Bridge status | `GET /ca/bridge` |
74
78
 
75
79
  `GET /v1/models` preserves the OpenAI-compatible `object`, `data`, and
@@ -116,6 +120,14 @@ Providers that require upstream streaming reject non-streaming Chat or
116
120
  Anthropic Messages requests with HTTP 501; use `/v1/responses` when Ciel must
117
121
  collect that stream into a non-streaming compatible response.
118
122
 
123
+ The Files routes are currently exposed for Meta Model API. Because a multipart
124
+ file upload has no `model` JSON field, select a non-default Meta route with
125
+ `X-Ciel-Runtime-Provider: meta`. Ciel replaces the bridge credential with the
126
+ Meta credential stored on the Router host and streams the multipart body
127
+ upstream without retaining the complete upload in router memory. Meta remains
128
+ authoritative for the `purpose=user_data`, MIME-type, expiry, per-file, and
129
+ team-storage validation rules.
130
+
119
131
  ## Select a provider, model, and provider credential
120
132
 
121
133
  The portable route syntax is `provider/model` in the standard `model` field:
package/docs/Router.md CHANGED
@@ -13,6 +13,7 @@ Claude Code의 Anthropic Messages 요청과 Codex의 OpenAI Responses 요청을
13
13
  POST /v1/messages → 모델 라우팅 (핵심 엔드포인트)
14
14
  POST /v1/responses → Codex / OpenAI Responses 라우팅
15
15
  GET /ca/events/stream → SSE 이벤트 스트림
16
+ GET /ca/events/ws → WebSocket 이벤트 스트림
16
17
  GET /ca/events/recent → 최근 이벤트 JSON
17
18
  GET /ca/health → 라우터 상태 확인
18
19
  GET /v1/models → 사용 가능한 모델 목록
@@ -0,0 +1,70 @@
1
+ okf: 1
2
+ record:
3
+ title: Anthropic routed 1M usage-credit regression and Fable 5.1 support
4
+ date: 2026-09-01
5
+ scope:
6
+ runtime: ciel-runtime
7
+ branch: nightly
8
+ claude_code: 2.1.258
9
+ provider: anthropic
10
+ mode: routed
11
+ evidence:
12
+ user_observation:
13
+ direct_claude: works
14
+ routed_claude: 'API Error: Usage credits required for 1M context'
15
+ official_changelog:
16
+ url: https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md
17
+ version: 2.1.257
18
+ fable_model: claude-fable-5-1
19
+ context_tokens: 1000000
20
+ input_price_per_million_tokens_usd: 10
21
+ output_price_per_million_tokens_usd: 50
22
+ cache_read_price_per_million_tokens_usd: 0.25
23
+ local_environment_comparison:
24
+ direct_anthropic_model: unset
25
+ routed_anthropic_model_before: ciel-runtime-anthropic-claude-fable-5[1m]
26
+ routed_context_before: 1048576
27
+ claude_binary_capture_before:
28
+ automatic_1m_beta: context-1m-2025-08-07
29
+ same_alias_without_suffix_has_1m_beta: false
30
+ conclusion: The automatic suffix selected Claude Code's usage-credit 1M request path.
31
+ implementation:
32
+ catalog:
33
+ added: claude-fable-5-1
34
+ retained: claude-fable-5
35
+ model_family: fable
36
+ context_metadata: 1048576
37
+ max_output_tokens_metadata: 128000
38
+ thinking_mode: adaptive
39
+ routed_context:
40
+ implicit_selection: standard-200k
41
+ explicit_one_million_selection: model-id-with-[1m]
42
+ direct_native_mode_changed: false
43
+ non_anthropic_providers_changed: false
44
+ verification:
45
+ claude_2_1_258_live_capture:
46
+ exit_code: 0
47
+ expected_response_received: true
48
+ environment_model: ciel-runtime-anthropic-claude-fable-5-1
49
+ request_model: ciel-runtime-anthropic-claude-fable-5-1
50
+ context_tokens: 200000
51
+ compact_window_tokens: 200000
52
+ context_1m_beta_present: false
53
+ full_repository:
54
+ compile: pass
55
+ unit:
56
+ passed: 1302
57
+ skipped: 44
58
+ router:
59
+ passed: 1064
60
+ channel:
61
+ passed: 320
62
+ skipped: 80
63
+ runtime:
64
+ passed: 246
65
+ skipped: 12
66
+ total_passed: 2932
67
+ total_skipped: 136
68
+ quality:
69
+ ruff: pass
70
+ documentation_metadata: pass
@@ -0,0 +1,133 @@
1
+ okf: 1
2
+ record:
3
+ title: Claude session socket default delivery for all Ciel input paths
4
+ date: 2026-09-01
5
+ scope:
6
+ branch: nightly
7
+ runtime: claude-code
8
+ claude_version_tested: 2.1.258
9
+ platforms:
10
+ windows: named-pipe
11
+ linux: AF_UNIX
12
+
13
+ evidence:
14
+ packaged_claude_protocol:
15
+ socket_argument: --messaging-socket-path
16
+ framing: newline-delimited JSON
17
+ authentication:
18
+ first_frame: '{"type":"auth","token":"<peerToken>"}'
19
+ key_location: ~/.claude/sessions/<pid>.<sha256-canonical-socket-path>.key
20
+ input_frame:
21
+ type: user
22
+ message_role: user
23
+ peer_from_field: omitted
24
+ windows_canonicalization: ASCII-lowercased local named-pipe path
25
+ live_windows_web_chat_probe:
26
+ executable: isolated Claude Code 2.1.258 native Windows binary
27
+ upstream: local Anthropic-compatible SSE capture server
28
+ http_route: POST /ca/chat/messages
29
+ http_status: 200
30
+ public_selected_transport: session_socket
31
+ private_gateway_transport: session_socket
32
+ socket_send: true
33
+ upstream_request_count_before: 1
34
+ upstream_request_count_after: 2
35
+ injected_marker_present_in_second_request: CIEL_ACTUAL_SOCKET_MESSAGE_7F31
36
+ claude_exit_code: 0
37
+ debug_turns_observed: 2
38
+ live_unix_transport_probe:
39
+ environment: WSL2 Ubuntu 26.04
40
+ transport: real AF_UNIX SOCK_STREAM server and client
41
+ authentication_frame_received: true
42
+ user_frame_received: true
43
+ unicode_safe_json: true
44
+ result: pass
45
+
46
+ implementation:
47
+ launch:
48
+ generated_path:
49
+ windows: '\\.\pipe\LOCAL\cc-msg-<32-hex>'
50
+ unix: /tmp/cc-socks-<uid>/ciel-<32-hex>.sock
51
+ claude_argument: --messaging-socket-path
52
+ generated_setting: 'crossSessionInbound: accept'
53
+ lifecycle:
54
+ configure_before_child: true
55
+ clear_after_child: true
56
+ disable_config: claude_code.session_socket_input=false
57
+ admission:
58
+ shared_gateway: ciel_runtime_support/runtime_input_gateway.py
59
+ runtime_default:
60
+ active_ciel_claude_socket: session_socket
61
+ otherwise: tty
62
+ explicit_overrides: [session_socket, tty, router]
63
+ routes:
64
+ web_chat_rest:
65
+ - POST /ca/chat/messages
66
+ - POST /ca/channel/messages
67
+ notification_rest:
68
+ - POST /ca/chat/notify
69
+ - POST /ca/channel/notify
70
+ external_events:
71
+ - POST /ca/events/webhooks/<receiver-id>
72
+ - configured SSE receiver
73
+ mcp_streamable:
74
+ endpoint: POST /ca/mcp
75
+ tool: submit_input
76
+ telemetry_notice:
77
+ source: OTLP durable log notification
78
+ delivery:
79
+ durable_queue_retained_until_socket_send: true
80
+ active_turn_delivery: true
81
+ active_tool_call_delivery: true
82
+ missing_key_or_socket:
83
+ cursor_committed: false
84
+ delivery_mark_rolled_back: true
85
+ retry: bounded polling of the durable queue
86
+ reply_contract: existing Ciel Web Chat or MCP response contract
87
+ receiver_option:
88
+ values: [auto, session_socket, tty, router]
89
+ auto_behavior: active Claude socket else TTY
90
+
91
+ verification:
92
+ focused:
93
+ windows_protocol_and_hash: pass
94
+ unix_AF_UNIX_real_socket: pass
95
+ ciel_launch_argument_and_lifecycle: pass
96
+ web_chat_rest_default_and_alias: pass
97
+ active_turn_socket_delivery: pass
98
+ external_event_socket_delivery: pass
99
+ mcp_submit_input_socket_delivery: pass
100
+ external_receiver_transport_option: pass
101
+ runtime_gateway_all_sources: pass
102
+ repository:
103
+ unit:
104
+ passed: 1358
105
+ skipped: 45
106
+ router:
107
+ passed: 1064
108
+ channel:
109
+ passed: 403
110
+ skipped: 80
111
+ runtime:
112
+ passed: 258
113
+ skipped: 12
114
+ npm_test:
115
+ result: pass
116
+ total_passed: 3083
117
+ total_skipped: 137
118
+ ruff: pass
119
+ architecture_budget:
120
+ result: pass
121
+ ciel_runtime_lines: 4936
122
+ maximum: 4980
123
+ metadata: pass
124
+ git_diff_check: pass
125
+ npm_pack_dry_run:
126
+ result: pass
127
+ package_version: 0.2.37
128
+ packed_bytes: 1685026
129
+ deployment:
130
+ commit: ready-after-full-verification
131
+ nightly_push: ready-after-full-verification
132
+ github_actions: pending
133
+ npm_nightly: pending