dsh-plugin-live2d-stage 0.5.2 → 0.5.3

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 (68) hide show
  1. package/README.md +76 -60
  2. package/assets/floating.html +1 -1
  3. package/assets/floating.js +321 -285
  4. package/character/deepseek/AdvancedARKitSettings.vbridger +0 -0
  5. package/character/deepseek/Animation/IDLE.motion3.json +3606 -0
  6. package/character/deepseek/Animation//344/270/276/346/211/213/345/210/207/351/273/230/350/256/244/346/211/213.motion3.json +151 -0
  7. package/character/deepseek/Animation//347/213/227/345/260/276/350/215/211/345/210/207/345/233/236/351/273/230/350/256/244/346/211/213.motion3.json +205 -0
  8. package/character/deepseek/Animation//347/213/227/345/260/276/350/215/211/345/210/207/346/215/242/345/207/272/346/235/245.motion3.json +240 -0
  9. package/character/deepseek/Animation//347/253/226/346/211/213/346/214/207/345/210/207/345/207/272/346/235/245/345/212/250/347/224/273.motion3.json +251 -0
  10. package/character/deepseek/Animation//347/253/226/346/211/213/346/214/207/345/210/207/345/233/236/351/273/230/350/256/244.motion3.json +219 -0
  11. package/character/deepseek/Animation//350/204/261/346/215/225.motion3.json +1793 -0
  12. package/character/deepseek/Animation//351/273/230/350/256/244/346/211/213/345/210/207/344/270/276/346/211/213.motion3.json +180 -0
  13. package/character/deepseek/DeepSeek/345/205/215/350/264/271 Live2D /346/250/241/345/236/213/344/275/277/347/224/250/351/241/273/347/237/245.txt" +138 -0
  14. package/character/deepseek/Exp3//344/275/223/345/236/2131.exp3.json +11 -0
  15. package/character/deepseek/Exp3//344/275/223/345/236/2132.exp3.json +11 -0
  16. package/character/deepseek/Exp3//345/205/224/347/211/231.exp3.json +11 -0
  17. package/character/deepseek/Exp3//345/211/215/345/200/276.exp3.json +11 -0
  18. package/character/deepseek/Exp3//345/212/240/350/275/275.exp3.json +11 -0
  19. package/character/deepseek/Exp3//345/215/225/347/211/207/347/234/274/351/225/234.exp3.json +11 -0
  20. package/character/deepseek/Exp3//345/234/210/345/234/210/347/234/274.exp3.json +26 -0
  21. package/character/deepseek/Exp3//345/260/276/345/267/264/345/274/200/345/205/263.exp3.json +11 -0
  22. package/character/deepseek/Exp3//345/261/221/345/261/221/347/234/274.exp3.json +21 -0
  23. package/character/deepseek/Exp3//346/265/201/345/206/267/346/261/227.exp3.json +11 -0
  24. package/character/deepseek/Exp3//346/265/201/346/263/252.exp3.json +11 -0
  25. package/character/deepseek/Exp3//347/210/261/345/277/203/347/234/274.exp3.json +11 -0
  26. package/character/deepseek/Exp3//347/253/226/351/243/237/346/214/207/345/205/263.exp3.json +11 -0
  27. package/character/deepseek/Exp3//347/253/226/351/243/237/346/214/207/345/274/200.exp3.json +16 -0
  28. package/character/deepseek/Exp3//350/203/270/345/217/243/350/241/243/346/234/215.exp3.json +11 -0
  29. package/character/deepseek/Exp3//350/204/261/351/236/213.exp3.json +11 -0
  30. package/character/deepseek/Exp3//350/204/270/347/272/242.exp3.json +11 -0
  31. package/character/deepseek/Exp3//350/243/231/345/255/220/345/210/207/346/215/242.exp3.json +11 -0
  32. package/character/deepseek/Exp3//351/222/242/347/233/206.exp3.json +11 -0
  33. package/character/deepseek/Exp3//351/273/221/346/241/206/347/234/274/351/225/234.exp3.json +11 -0
  34. package/character/deepseek/Exp3//351/273/221/350/204/270.exp3.json +11 -0
  35. package/character/deepseek/Exp3//351/273/230/350/256/244/344/275/223/345/236/213.exp3.json +11 -0
  36. package/character/deepseek/Exp3//357/274/236/357/274/234.exp3.json +26 -0
  37. package/character/deepseek/items_pinned_to_model.json +15 -0
  38. package/character/deepseek//345/244/247/350/202/245/351/261/274.4096/texture_00.png +0 -0
  39. package/character/deepseek//345/244/247/350/202/245/351/261/274.4096/texture_01.png +0 -0
  40. package/character/deepseek//345/244/247/350/202/245/351/261/274.4096/texture_02.png +0 -0
  41. package/character/deepseek//345/244/247/350/202/245/351/261/274.4096/texture_03.png +0 -0
  42. package/character/deepseek//345/244/247/350/202/245/351/261/274.4096/texture_04.png +0 -0
  43. package/character/deepseek//345/244/247/350/202/245/351/261/274.cdi3.json +3251 -0
  44. package/character/deepseek//345/244/247/350/202/245/351/261/274.moc3 +0 -0
  45. package/character/deepseek//345/244/247/350/202/245/351/261/274.model3.json +30 -0
  46. package/character/deepseek//345/244/247/350/202/245/351/261/274.physics3.json +13512 -0
  47. package/character/deepseek//345/244/247/350/202/245/351/261/274.png +0 -0
  48. package/character/deepseek//345/244/247/350/202/245/351/261/274.vtube.json +4086 -0
  49. package/lib/chat.mjs +16 -2
  50. package/lib/client.js +21158 -20849
  51. package/lib/floating.mjs +1 -1
  52. package/lib/index.mjs +21 -9
  53. package/lib/native/Live2DFloating.exe +0 -0
  54. package/lib/store.cjs +11173 -11064
  55. package/package.json +7 -5
  56. package/character/hiyori/hiyori_free_t08.2048/texture_00.png +0 -0
  57. package/character/hiyori/hiyori_free_t08.cdi3.json +0 -276
  58. package/character/hiyori/hiyori_free_t08.moc3 +0 -0
  59. package/character/hiyori/hiyori_free_t08.model3.json +0 -72
  60. package/character/hiyori/hiyori_free_t08.physics3.json +0 -631
  61. package/character/hiyori/motion/hiyori_m01.motion3.json +0 -951
  62. package/character/hiyori/motion/hiyori_m02.motion3.json +0 -1238
  63. package/character/hiyori/motion/hiyori_m03.motion3.json +0 -1035
  64. package/character/hiyori/motion/hiyori_m04.motion3.json +0 -776
  65. package/character/hiyori/motion/hiyori_m05.motion3.json +0 -1462
  66. package/character/hiyori/motion/hiyori_m06.motion3.json +0 -727
  67. package/character/hiyori/motion/hiyori_m07.motion3.json +0 -874
  68. package/character/hiyori/motion/hiyori_m08.motion3.json +0 -755
package/lib/chat.mjs CHANGED
@@ -1,9 +1,23 @@
1
1
  export class StageChat {
2
2
  constructor(ctx){this.ctx=ctx;this.errors=new Map();ctx.on?.('api-session/error',(id,error)=>{this.errors.set(id,String(error));if(this.errors.size>100)this.errors.delete(this.errors.keys().next().value);});}
3
3
  controller(){if(!this.ctx.sessionController)throw new Error('宿主会话服务尚未就绪');return this.ctx.sessionController;}
4
- async list(){const result=await this.controller().list({},new AbortController().signal);const workspaces=(this.ctx.workspaceRegistry?.list()??[]).map(w=>({workspaceId:w.id,title:w.title,path:w.path,sessionIds:[...w.sessionIds]}));return {...result,workspaces,items:result.items.map(s=>({...s,workspaceId:workspaces.find(w=>w.sessionIds.includes(s.sessionId))?.workspaceId??null}))};}
4
+ async list(){const result=await this.controller().list({},new AbortController().signal);const workspaces=(this.ctx.workspaceRegistry?.list()??[]).map(w=>({workspaceId:w.id,title:w.title,path:w.path,sessionIds:[...w.sessionIds]}));return {...result,workspaces,items:result.items.map(s=>{const title=[s.projections?.values?.title,s.projectionValues?.title,s.title,s.name].find(v=>typeof v==='string'&&v.trim());return {...s,title:title?.trim()||'未命名会话',workspaceId:workspaces.find(w=>w.sessionIds.includes(s.sessionId))?.workspaceId??null};})};}
5
5
  async visibleSession(id,workspaceId){const data=await this.list();const session=data.items.find(s=>s.sessionId===id);if(!session)throw new Error('该会话不在当前 Harness 的可用会话列表中,请重新选择');if(workspaceId&&session.workspaceId!==workspaceId)throw new Error('会话不属于所选 Harness 工作区');return session;}
6
6
 
7
+ uploadRequest(){return this.uploadPending?.request??null;}
8
+ completeUpload(data){const pending=this.uploadPending;if(!pending||data.requestId!==pending.request.requestId)throw new Error('文件上传跳转已失效');this.uploadPending=null;clearTimeout(pending.timer);if(data.error)pending.reject(new Error(String(data.error)));else pending.resolve({sessionId:pending.request.sessionId});return {ok:true};}
9
+ async openUpload(data){
10
+ if(this.uploadPending)throw new Error('正在打开 Harness 文件上传,请稍候');
11
+ if(typeof data.requestId!=='string'||!/^[a-zA-Z0-9-]{1,80}$/.test(data.requestId)||typeof data.text!=='string'||data.text.length>32000)throw new Error('无效的上传跳转');
12
+ if(data.sessionId!==undefined&&(typeof data.sessionId!=='string'||data.sessionId.length>200)||data.workspaceId!==undefined&&(typeof data.workspaceId!=='string'||data.workspaceId.length>200))throw new Error('无效的会话或工作区');
13
+ // Create only the host session. Files and attachments stay entirely in its composer.
14
+ let sessionId=data.sessionId;
15
+ if(sessionId)await this.visibleSession(sessionId,data.workspaceId);
16
+ else{if(!data.workspaceId||!this.ctx.workspaceRegistry?.get(data.workspaceId))throw new Error('请先选择 Harness 工作区');sessionId=(await this.controller().create({sessionId:'live2d-'+data.requestId,workspaceId:data.workspaceId})).sessionId;}
17
+ if(this.uploadPending)throw new Error('正在打开 Harness 文件上传,请稍候');
18
+ return new Promise((resolve,reject)=>{const pending={request:{requestId:data.requestId,sessionId,text:data.text},resolve,reject,timer:null};pending.timer=setTimeout(()=>{if(this.uploadPending===pending)this.uploadPending=null;reject(new Error('请先打开 Harness 主窗口,再进入原生文件上传'));},12000);this.uploadPending=pending;});
19
+ }
20
+
7
21
  async history(id){if(typeof id!=='string'||!id||id.length>200)throw new Error('请选择对话');await this.visibleSession(id);const view=await this.controller().inspect(id,new AbortController().signal);const messages=view.events.filter(e=>['user/message','assistant/message'].includes(e.type)).slice(-100).map(e=>{const m=e.type==='user/message'?e.data:e.data.message;return {id:m.id,role:m.role,text:(m.content??[]).filter(p=>p.type==='text').map(p=>p.text).join('\n')};}).filter(m=>m.text);return {sessionId:id,messages,running:this.ctx.agents?.get(id)?.status==='running',error:this.errors.get(id)||''};}
8
- async send(data){if(typeof data.text!=='string'||!data.text.trim()||data.text.length>32000)throw new Error('请输入 1–32000 个字符');if(typeof data.requestId!=='string'||!/^[a-zA-Z0-9-]{1,80}$/.test(data.requestId))throw new Error('无效消息标识');if(data.sessionId!==undefined&&(typeof data.sessionId!=='string'||data.sessionId.length>200))throw new Error('无效对话');const controller=this.controller();let id=data.sessionId;if(data.workspaceId!==undefined&&(typeof data.workspaceId!=='string'||data.workspaceId.length>200))throw new Error('无效工作区');if(id){await this.visibleSession(id,data.workspaceId);}else{if(!data.workspaceId||!this.ctx.workspaceRegistry?.get(data.workspaceId))throw new Error('请先选择当前 Harness 的工作区,再新建对话');const created=await controller.create({sessionId:'live2d-'+data.requestId,workspaceId:data.workspaceId});id=created.sessionId;}this.errors.delete(id);await controller.prompt({sessionId:id,requestId:data.requestId,content:[{type:'text',text:data.text.trim()}],mode:'followup',clientTimeZone:data.timeZone||'Asia/Shanghai'},new AbortController().signal);return {accepted:true,sessionId:id};}
22
+ async send(data){if(typeof data.text!=='string'||!data.text.trim()||data.text.length>32000)throw new Error('请输入 1–32000 个字符');if(typeof data.requestId!=='string'||!/^[a-zA-Z0-9-]{1,80}$/.test(data.requestId))throw new Error('无效消息标识');if(data.sessionId!==undefined&&(typeof data.sessionId!=='string'||data.sessionId.length>200))throw new Error('无效对话');const controller=this.controller();let id=data.sessionId;if(data.workspaceId!==undefined&&(typeof data.workspaceId!=='string'||data.workspaceId.length>200))throw new Error('无效工作区');if(id){await this.visibleSession(id,data.workspaceId);}else{if(!data.workspaceId||!this.ctx.workspaceRegistry?.get(data.workspaceId))throw new Error('请先选择当前 Harness 的工作区,再新建对话');const created=await controller.create({sessionId:'live2d-'+data.requestId,workspaceId:data.workspaceId});id=created.sessionId;}this.errors.delete(id);await controller.prompt({sessionId:id,requestId:data.requestId,content:[{type:'text',text:data.text.trim()}],mode:'queue',clientTimeZone:data.timeZone||'Asia/Shanghai'},new AbortController().signal);return {accepted:true,sessionId:id};}
9
23
  }