@forsion/extend 0.10.7 → 0.10.10

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.
package/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "forsion-extend",
3
3
  "name": "Forsion 扩展",
4
4
  "nameEn": "Forsion Extend",
5
- "version": "0.10.7",
5
+ "version": "0.10.10",
6
6
  "apiVersion": 1,
7
7
  "minAppVersion": "2.13.8-beta.3",
8
8
  "main": "dist/main.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsion/extend",
3
- "version": "0.10.7",
3
+ "version": "0.10.10",
4
4
  "description": "Forsion Extend: the cloud-account half of Forsion Desktop plus Forsion Connect (Coding Space publishing and the preview-mode AI proxy), shipped as a built-in bundle (signed, updated through npm).",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -21,6 +21,8 @@
21
21
  "dist/THIRD_PARTY_NOTICES.md",
22
22
  "tangu-plugins/store-update/tangu-plugin.json",
23
23
  "tangu-plugins/store-update/dist/index.mjs",
24
+ "tangu-plugins/agent-feedback/tangu-plugin.json",
25
+ "tangu-plugins/agent-feedback/dist/index.mjs",
24
26
  "spaces/guide/space.json",
25
27
  "spaces/penzor/space.json",
26
28
  "spaces/penzor/icon.svg",
@@ -0,0 +1,2 @@
1
+ var p=e=>e==="auto"||e==="off"?e:"ask",y=new Set(["bug","idea","other"]);function F(e){return typeof e!="string"?null:e.trim().toLowerCase().replace(/\s+/g," ").slice(0,160)||null}var g=(e,t)=>typeof e=="string"?e.replace(/\r\n?/g,`
2
+ `).trim().slice(0,t):"",h=/(github\.com[:/]+changan-su\/forsion|git\.forsion\.net\/)/i,b=()=>({sessions:new Set,fingerprints:new Map});function m(e,t,n){if(n.mode==="off")return"Error: Feedback drafting is turned off in settings. Do not mention feedback; just tell the user what went wrong.";if(n.inOfficialRepo)return"Error: This is one of Forsion's own source repositories. Fix the problem here or suggest a GitHub issue instead of drafting feedback.";let i=typeof t?.kind=="string"&&y.has(t.kind)?t.kind:"bug",o=g(t?.title,120).replace(/\n+/g," "),d=g(t?.description,4e3);if(!o)return"Error: title is required (one line, in the user's interface language).";if(!d)return"Error: description is required: what was being done, what was expected, what happened instead.";let s=F(t?.fingerprint),r=typeof n.sessionId=="string"&&n.sessionId?n.sessionId:null;if(r&&e.sessions.has(r))return"Error: A feedback draft was already made in this conversation. Do not draft another; refer the user to the existing card.";if(s){let a=e.fingerprints.get(s);if(a!==void 0&&n.now-a<864e5)return"Error: The same problem was drafted as feedback within the last 24 hours. Do not draft it again; just tell the user."}r&&e.sessions.add(r),s&&e.fingerprints.set(s,n.now);let l=n.mode==="auto"?"auto":"ask",c={ok:!0,kind:i,title:o,description:d,fingerprint:s,mode:l,draftedAt:n.now,note:l==="auto"?"Shown to the user as a feedback card and sent automatically (the user turned that on); they can withdraw it for 10 minutes. Logs go along, the conversation does not. Tell the user in one sentence.":"Shown to the user as an editable feedback card with the logs listed. Nothing is sent until they click Send. Do not say it was sent."};return JSON.stringify(c)}var k=`Draft a feedback report to the Forsion team about a problem in Forsion itself, shown to the user as an editable card. Use it only when Forsion is at fault: a Forsion built-in tool or official plugin returned an internal error (database, IPC, crash) and one retry failed too; Forsion behaves differently from its documentation; or, while building a plugin / skill / widget on Forsion, a host API is missing something you need (kind "idea"). Never use it for errors in the user's own code, tests or builds, model provider errors / rate limits / quota, network outages, third-party plugins, or actions the user cancelled. Write title and description in the user's interface language; describe what was being done, what was expected and what happened, and quote the error text. fingerprint: "<tool or area>:<error class>", for example "manage_schedule:sqlite_busy". At most one draft per conversation. The card prepares the logs; never paste secrets into the description.`;var u="agent-feedback",w=e=>{try{return p(e.sdk.pluginStore.getPluginSettingsSync?.(u)?.mode)}catch{return"ask"}};function E(e){if(!e||typeof e!="string")return!1;let t=globalThis.process?.getBuiltinModule;if(typeof t!="function")return!1;try{let n=t("node:fs"),i=t("node:path"),o=i.resolve(e);for(let d=0;d<12;d++){let s=i.join(o,".git","config"),r=null;try{r=n.readFileSync(s,"utf8")}catch{}if(r===null)try{let c=n.readFileSync(i.join(o,".git"),"utf8").match(/^gitdir:\s*(.+)$/m)?.[1]?.trim();if(c){let a=i.resolve(o,c),f=a;try{f=i.resolve(a,n.readFileSync(i.join(a,"commondir"),"utf8").trim())}catch{}r=n.readFileSync(i.join(f,"config"),"utf8")}}catch{}if(r!==null)return h.test(r);let l=i.dirname(o);if(l===o)return!1;o=l}}catch{}return!1}function x(e,t=Date.now){let n=b();return[{name:"feedback_draft",mode:"both",isEnabledFor:(i,o)=>!o?.muse&&e.sdk.pluginStore.isPluginEnabledSync(u)&&w(e)!=="off",capabilities:{sideEffect:"none",parallel:!1,defaultTimeoutMs:1e4},definition:{type:"function",function:{name:"feedback_draft",description:k,parameters:{type:"object",properties:{kind:{type:"string",enum:["bug","idea","other"],description:"bug = something in Forsion is broken; idea = a missing capability; other."},title:{type:"string",description:"One line, under 120 characters, in the user's interface language."},description:{type:"string",description:"What was being done, what was expected, what happened (quote the error). Under 4000 characters."},fingerprint:{type:"string",description:'"<tool or area>:<error class>", lower case, e.g. "manage_schedule:sqlite_busy".'}},required:["kind","title","description"]}}},execute:(i,o)=>m(n,i||{},{sessionId:o?.sessionId,mode:w(e),inOfficialRepo:E(o?.cwd),now:t()})}]}var S={activate(e){let t=x(e);e.registerPlugin({id:u,name:"\u53CD\u9988\u7ED9 Forsion",nameEn:"Feedback to Forsion",description:"Agent \u78B0\u5230 Forsion \u81EA\u5DF1\u7684\u95EE\u9898\u65F6\u8D77\u8349\u4E00\u4EFD\u53CD\u9988\u3001\u5907\u597D\u65E5\u5FD7\uFF0C\u53D1\u4E0D\u53D1\u7531\u4F60\u5728\u5361\u7247\u4E0A\u5B9A\u3002",descriptionEn:"When the agent runs into a problem in Forsion itself, it drafts a report with the logs ready. You decide on the card whether to send it.",scopes:["global"],defaultEnabled:!0,settings:{fields:[{key:"mode",type:"select",default:"ask",label:"\u9047\u5230 Forsion \u7684\u95EE\u9898\u65F6",labelEn:"When Forsion has a problem",help:"\u300C\u76F4\u63A5\u53D1\u9001\u300D\u65F6\u4E0D\u5E26\u4F1A\u8BDD\u5185\u5BB9\uFF0C\u53D1\u51FA\u540E 10 \u5206\u949F\u5185\u53EF\u4EE5\u64A4\u56DE\u3002",helpEn:"\u201CSend automatically\u201D never includes the conversation, and you can withdraw a report for 10 minutes.",options:[{value:"ask",label:"\u8D77\u8349\uFF0C\u6BCF\u6B21\u5148\u95EE\u6211",labelEn:"Draft and ask me first"},{value:"auto",label:"\u8D77\u8349\u5E76\u76F4\u63A5\u53D1\u9001",labelEn:"Draft and send automatically"},{value:"off",label:"\u4E0D\u7528\u8D77\u8349",labelEn:"Don\u2019t draft"}]}]},toolProvider:{id:`plugin:${u}`,tools:()=>t}}),e.log("agent-feedback activated")},deactivate(){}},T=S;export{u as PLUGIN_ID,x as buildTools,T as default,E as isOfficialRepo};
@@ -0,0 +1,8 @@
1
+ {
2
+ "id": "agent-feedback",
3
+ "name": "反馈给 Forsion",
4
+ "version": "1.0.0",
5
+ "apiVersion": 1,
6
+ "entry": "dist/index.mjs",
7
+ "description": "Lets the agent draft a feedback report to the Forsion team when Forsion itself is at fault (feedback_draft); the person sends it from the card. Built from src/tangu/agentFeedback by scripts/build.mjs."
8
+ }