Skip to content

Provide SPX knowledge from frontend#3097

Merged
aofei merged 1 commit into
goplus:devfrom
nighca:issue-3093
May 11, 2026
Merged

Provide SPX knowledge from frontend#3097
aofei merged 1 commit into
goplus:devfrom
nighca:issue-3093

Conversation

@nighca
Copy link
Copy Markdown
Collaborator

@nighca nighca commented Apr 29, 2026

Refs #3093

Summary

  • Move reusable SPX skill knowledge into the SPX utility layer
  • Send frontend-provided SPX knowledge when generating AI project descriptions
  • Update the AI description OpenAPI request schema

Stacking

This PR is based on the issue-3045 branch, corresponding to #3080. Please review/merge #3080 first.

Verification

  • npm run test -- --run src/components/copilot/skills/skills.test.ts src/models/common/xbp.test.ts src/models/spx/animation.test.ts
  • npm run test -- --run src/components/copilot/copilot.test.ts src/components/copilot/skills/skills.test.ts
  • npm run type-check
  • npm run lint

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the workflow stream message endpoint and refactors the Copilot skill system to use a centralized registry and preloading mechanism. The /ai/description API now requires a knowledgeBase parameter, and the Copilot context has been expanded to include available and preloaded skills. Feedback points out that the getSkillBody function's string-based frontmatter stripping is fragile and recommends using a more robust parsing method.

Comment thread spx-gui/src/utils/spx/skill/index.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR moves reusable XGo/SPX “skill” knowledge into the frontend utility layer, preloads that knowledge into Copilot context for the SPX editor, and sends SPX grounding knowledge to the backend when generating AI project descriptions (with corresponding OpenAPI updates).

Changes:

  • Add bundled skill markdown sources for xgo-language and spx-project, and expose helpers to retrieve them from src/utils/*.
  • Extend AI description generation to include frontend-provided SPX knowledge (knowledge) and update the OpenAPI request schema.
  • Refactor Copilot skill support to be owned by Copilot (catalog + preload + tools) and update tests accordingly.

Reviewed changes

Copilot reviewed 21 out of 26 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
spx-gui/src/utils/xgo/skills/xgo-language/SKILL.md Adds XGo language skill main document (frontmatter + content).
spx-gui/src/utils/xgo/skills/xgo-language/references/syntax.md Adds XGo syntax reference resource.
spx-gui/src/utils/xgo/index.ts Exposes xgoLanguageSkillName + bundled skill file getter via import.meta.glob.
spx-gui/src/utils/xgo/index.test.ts Adds test coverage for bundled XGo skill files.
spx-gui/src/utils/spx/skills/spx-project/SKILL.md Adds SPX project skill main document (guidelines).
spx-gui/src/utils/spx/skills/spx-project/references/apis.md Adds SPX API reference resource.
spx-gui/src/utils/spx/skills/spx-project/references/ai-interaction.md Adds SPX AI Interaction reference resource.
spx-gui/src/utils/spx/index.ts Exposes SPX skill file getter + builds getSpxProjectKnowledge() for AI grounding.
spx-gui/src/utils/spx/index.test.ts Adds test coverage for SPX knowledge aggregation.
spx-gui/src/utils/frontmatter.ts Introduces lightweight frontmatter parsing utilities.
spx-gui/src/utils/frontmatter.test.ts Adds tests for frontmatter parsing utilities.
spx-gui/src/models/spx/project.ts Passes SPX grounding knowledge into generateAIDescription.
spx-gui/src/components/editor/spx-code-editor/document-base/helpers.ts Updates file header comment to match new knowledge-generation usage.
spx-gui/src/components/editor/copilot/index.ts Preloads xgo-language + spx-project skills for SPX editor Copilot context.
spx-gui/src/components/copilot/skills/tools.ts Adds “skip reload if preloaded” behavior and extracts content wrapper helper.
spx-gui/src/components/copilot/skills/skills.test.ts Updates skill tests for new Copilot-owned skill catalog/preload behavior.
spx-gui/src/components/copilot/skills/parser.ts Reuses shared frontmatter parser for skill document parsing.
spx-gui/src/components/copilot/skills/index.ts Removes old skill support entrypoint (migrated into Copilot).
spx-gui/src/components/copilot/skills/context-provider.ts Removes old SkillCatalogContextProvider (migrated into Copilot).
spx-gui/src/components/copilot/skills/content.ts Adds shared wrapSkillContent helper.
spx-gui/src/components/copilot/skills/built-in.ts Builds built-in skill registry from src/utils/* skill file getters.
spx-gui/src/components/copilot/CopilotRoot.vue Instantiates Copilot with a built-in SkillRegistry (no longer calls registerSkillSupport).
spx-gui/src/components/copilot/copilot.ts Makes Copilot own skill registry + catalog/preload context + registers skill tools in ctor.
spx-gui/src/components/copilot/copilot.test.ts Updates Copilot tests for new constructor + built-in tool registration count.
spx-gui/src/apis/ai-description.ts Adds knowledge to /ai/description request payload.
docs/openapi.yaml Adds knowledge field to /ai/description request schema and removes legacy workflow schema/endpoint entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread spx-gui/src/apis/ai-description.ts
Copy link
Copy Markdown
Contributor

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well-structured refactor that cleanly moves SPX skill knowledge to the frontend utility layer and extends the AI description API to pass contextual knowledge. A few points worth addressing below.

Comment thread spx-gui/src/components/copilot/copilot.ts
Comment thread spx-gui/src/components/copilot/copilot.ts
Comment thread spx-gui/src/utils/spx/index.ts
Comment thread spx-gui/src/components/copilot/skills/content.ts
Comment thread docs/openapi.yaml
@@ -1,36 +1,26 @@
import { getSpxProjectSkillFiles, spxProjectSkillName } from '@/utils/spx'
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

内置 skills 内容本身的维护从 components/copilot 模块挪到 utils/spxutils/xgo 了,方便调用 ai-description 的逻辑去复用

@nighca nighca linked an issue May 7, 2026 that may be closed by this pull request
@aofei aofei merged commit 2393a10 into goplus:dev May 11, 2026
4 checks passed
nighca added a commit that referenced this pull request May 15, 2026
* chore(deps): bump spx to 2.0.0 (#3127)

Agent-Logs-Url: https://github.com/goplus/builder/sessions/147d2d8e-4bf8-4ae7-b66e-b8a41c970f3a

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>

* Widget `<unstable-xgo-code-editor>` (#3089)

* Add widget `<unstable-xgo-code-editor>`

* Address widget review feedback

* Stabilize layer order workarounds

* Provide SPX knowledge from frontend (#3097)

* UI update for tutorial pages (#3122)

* update tutorial pages styles

* compress tutorials banner

* refine tutorials banner layout

* show updated time for course series

* details

* Handle invalid image stalls in editor (#3136)

* feat: add title attribute to sprite name in list items (#3140)

* feat: add title attribute to sprite name in list items

Add HTML title attribute to the sprite name span in UIEditorSpriteItem
so users can hover to see the full name when it is truncated.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>

* refactor: move title tooltip to UIBlockItemTitle component

Add optional `title` prop to UIBlockItemTitle and forward it to the
inner truncation span, then use it in UIEditorSpriteItem to avoid the
extra wrapper span.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>

* feat: add title attribute to name in all block item components

Add :title="name" to UIBlockItemTitle in UIEditorBackdropItem,
UIEditorSoundItem, UIEditorWidgetItem, and UISpriteItem so truncated
names show a hover tooltip consistently across all item panels.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>

* feat: add title attribute to sprite name in list items

Add :title="name" to UIBlockItemTitle in UISoundItem and UIBackdropItem.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>

* refactor: make title prop required in UIBlockItemTitle

Change title from optional to required prop to ensure all callers
provide a tooltip value for truncated text.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>

* feat: add title attribute to sprite name in list items

Add missing :title prop to all UIBlockItemTitle callers to satisfy
the newly-required title prop: AnimationGenItem, BackdropGenItem,
ParamSelector, CostumeGenItem, SpriteGenItem, SpxEffectKindItem,
and the ui-design docs page.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>

* fix: use $t() instead of t() in ParamSelector template

Replace t(item.label) with $t(item.label) in the :title binding
to be consistent with the template-level i18n helper usage.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>

* style: fix formatting in CostumeGenItem.vue

Run Prettier to fix line-length formatting issue flagged by CI.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>

---------

Co-authored-by: xgopilot <noreply@goplus.org>
Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>

* feat(code-editor): support sprite instance input helpers (#3123)

Handle `spx-sprite-instance` with the existing resource input helper so
sprite instance slots can use the sprite resource selector.

Write selected sprite instances as bare identifiers while keeping
resource name slots as string literals.

Fixes #3110
Updates goplus/xgolsw#317

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>

* Update UI empty/error default images (#3134)

* update ui empty/error default images

* compress svg size

* rename image

* adjust svg size

* chore(deps): bump github.com/goplus/xgolsw to 0.20.0 in /tools/spxls (#3163)

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>

* feat(spx-gui): optimize video cut preview during animation generation (#3150)

* optimize video cut preview during animation generation

* use css variables for track padding

* fix details

* remove page for test

* optimize code

* queue video seeks to keep animation preview responsive during dragging

---------

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>
Co-authored-by: chennan <chennan@qiniu.com>
Co-authored-by: fennoai[bot] <231223108+fennoai[bot]@users.noreply.github.com>
Co-authored-by: xgopilot <noreply@goplus.org>
Co-authored-by: Aofei Sheng <aofei@aofeisheng.com>
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.

Clean up legacy embedded Copilot knowledge dependencies

3 participants