mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-11-07 06:19:43 -10:00
fix(mods): skip hooks on prompt.paint and ui.place instead of failing (#16124)
A Mod that hooked either event failed to initialize, which stopped a headless run before any model request. Both are now skipped with the startup line, like other events Qwen Code does not run yet. $.session.version() reports 2.1.316.
This commit is contained in:
1 parent
38b71299c8
commit
73474ef094
5 files changed
+16
-11
No files matched your search
@@ -163,7 +163,7 @@ Patterns select among the engine events `session.start`, `session.end`,
|
||||
`*`, or a single negation such as `!session.*`. The patterns `!*` and `!!...` are
|
||||
rejected.
|
||||
|
||||
Claude Code 2.1.310 also defines events that Qwen Code does not run yet, such as
|
||||
Claude Code 2.1.316 also defines events that Qwen Code does not run yet, such as
|
||||
`prompt.fill` or `classic.Stop`. `prompt.submit` runs only in headless runs, and
|
||||
`ui.render` only where a host draws it. A registration for one of them,
|
||||
or for a prefix such as `prompt.*` that matches none of the events above, loads
|
||||
@@ -416,7 +416,7 @@ supports:
|
||||
{
|
||||
"version": "0.26.0",
|
||||
"qwen": {
|
||||
"claudeCode": "2.1.310",
|
||||
"claudeCode": "2.1.316",
|
||||
"events": [
|
||||
"clock.now",
|
||||
"clock.sleep",
|
||||
@@ -513,7 +513,7 @@ Mod discovery. Mod manifests must be relative paths inside the extension.
|
||||
directory, the one that holds `qwen-extension.json` or
|
||||
`.claude-plugin/plugin.json`. They are plain properties.
|
||||
|
||||
The other methods are API events that resolve to the shapes Claude Code 2.1.310
|
||||
The other methods are API events that resolve to the shapes Claude Code 2.1.316
|
||||
declares:
|
||||
|
||||
| Method | Resolves to |
|
||||
@@ -722,7 +722,7 @@ its props and its children flattened into an array, and throws for a string tag
|
||||
JSX in a `.tsx` or `.jsx` file compiles to these calls, as described in
|
||||
[TypeScript, JSX and relative imports](#typescript-jsx-and-relative-imports).
|
||||
|
||||
A tree a hook returns is judged with Claude Code 2.1.310's rules for `Box` and
|
||||
A tree a hook returns is judged with Claude Code 2.1.316's rules for `Box` and
|
||||
`Text`, and any other element refuses it with
|
||||
`<Element> is not drawn by Qwen Code yet`.
|
||||
|
||||
@@ -969,6 +969,6 @@ Own `__proto__` keys in tool inputs and results are ordinary data on both sides.
|
||||
A hook answer whose getter throws while Qwen Code reads it fails as a whole;
|
||||
Claude Code 2.1.299 drops only that key.
|
||||
|
||||
The author API follows the Claude Code 2.1.310 declarations, event names
|
||||
The author API follows the Claude Code 2.1.316 declarations, event names
|
||||
included, and the
|
||||
[official Mod documentation](https://code.claude.com/docs/en/plugins/mods/create).
|
||||
@@ -10,8 +10,8 @@ import { MOD_EVENTS, MOD_METHODS } from './dispatch.js';
|
||||
|
||||
describe('Claude Code event names', () => {
|
||||
it('lists each engine, API and classic event once, including every supported one', () => {
|
||||
expect(CLAUDE_CODE_EVENTS).toHaveLength(144);
|
||||
expect(new Set(CLAUDE_CODE_EVENTS).size).toBe(144);
|
||||
expect(CLAUDE_CODE_EVENTS).toHaveLength(146);
|
||||
expect(new Set(CLAUDE_CODE_EVENTS).size).toBe(146);
|
||||
expect(CLAUDE_CODE_EVENTS).toEqual(expect.arrayContaining([...MOD_EVENTS]));
|
||||
expect(MOD_EVENTS).toEqual(expect.arrayContaining([...MOD_METHODS]));
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
export const CLAUDE_CODE_EVENTS_VERSION = '2.1.310';
|
||||
export const CLAUDE_CODE_EVENTS_VERSION = '2.1.316';
|
||||
|
||||
// Claude Code's engine events, `$` API events and `classic.*` settings hook
|
||||
// events, so registrations for events Qwen does not run yet can be skipped
|
||||
@@ -68,6 +68,7 @@ const eventsByNamespace: Record<string, readonly string[]> = {
|
||||
'edit',
|
||||
'fill',
|
||||
'mention',
|
||||
'paint',
|
||||
'read',
|
||||
'section',
|
||||
'submit',
|
||||
@@ -118,6 +119,7 @@ const eventsByNamespace: Record<string, readonly string[]> = {
|
||||
'notify',
|
||||
'open',
|
||||
'panes',
|
||||
'place',
|
||||
'press',
|
||||
'render',
|
||||
'resolve',
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
// The trees a `ui.render` hook draws, judged by Claude Code 2.1.310's rules.
|
||||
// The trees a `ui.render` hook draws, judged by Claude Code 2.1.316's rules.
|
||||
// The worker checks each hook's answer and the host the tree the chain settles
|
||||
// on, so a tree Qwen Code accepts is one Claude Code accepts.
|
||||
|
||||
|
||||
@@ -337,6 +337,9 @@ describe('ModRuntime with the real QuickJS worker', () => {
|
||||
return next(e);
|
||||
});
|
||||
on('classic.Stop', ($, e, next) => next(e));
|
||||
// Added in Claude Code 2.1.316.
|
||||
on('prompt.paint', ($, e, next) => next(e));
|
||||
on('ui.place', ($, e, next) => next(e));
|
||||
on('ui.render', {component:'Spinner'}, ($, e, next) => next(e));
|
||||
on('session.start', async ($, e, next) => {
|
||||
await $.command.register({name:'hello',description:'Hello'});
|
||||
@@ -347,7 +350,7 @@ describe('ModRuntime with the real QuickJS worker', () => {
|
||||
expect(logs).toEqual([
|
||||
{
|
||||
to: 'transcript',
|
||||
text: 'Hooks for unsupported events will not run: classic.Stop, prompt.*, prompt.edit, ui.render',
|
||||
text: 'Hooks for unsupported events will not run: classic.Stop, prompt.*, prompt.edit, prompt.paint, ui.place, ui.render',
|
||||
},
|
||||
]);
|
||||
expect(await runtime.runCommand('hello', '', signal())).toBe('still works');
|
||||
@@ -419,7 +422,7 @@ describe('ModRuntime with the real QuickJS worker', () => {
|
||||
{
|
||||
version: '1.2.3+wrapped',
|
||||
qwen: {
|
||||
claudeCode: '2.1.310',
|
||||
claudeCode: '2.1.316',
|
||||
events: [
|
||||
'clock.now',
|
||||
'clock.sleep',
|
||||
|
||||
Reference in new issue
Block a user