@gui-chat-plugin/switch-role 0.1.0 → 0.2.0

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.
@@ -2,11 +2,16 @@
2
2
  * SwitchRole Tool Definition (Schema)
3
3
  */
4
4
  import type { ToolDefinition } from "gui-chat-protocol";
5
+ import type { Role } from "./types";
5
6
  export declare const TOOL_NAME = "switchRole";
6
7
  /**
7
- * Create tool definition with current roles
8
- * This needs to be called dynamically since roles can be configured
8
+ * Create tool definition with specific roles
9
+ * @param roles - Array of available roles
10
+ */
11
+ export declare function createToolDefinition(roles: Role[]): ToolDefinition;
12
+ /**
13
+ * Default tool definition (used when roles are not provided)
14
+ * Apps should use createToolDefinition() with their roles for better LLM guidance
9
15
  */
10
- export declare function createToolDefinition(): ToolDefinition;
11
16
  export declare const TOOL_DEFINITION: ToolDefinition;
12
17
  export declare const SYSTEM_PROMPT = "When users ask to change the role, personality, or behavior of the AI (e.g., 'switch to tutor role', 'change to listener role', 'be a teacher'), use the switchRole function. Note that switching roles will disconnect and reconnect the conversation.";
@@ -2,5 +2,4 @@
2
2
  * SwitchRole Plugin - Core (Framework-agnostic)
3
3
  */
4
4
  export type { Role, SwitchRoleArgs, SwitchRoleJsonData } from "./types";
5
- export { DEFAULT_ROLES, setRoles, getRoles, getRoleById } from "./roles";
6
5
  export { TOOL_NAME, TOOL_DEFINITION, SYSTEM_PROMPT, createToolDefinition, executeSwitchRole, pluginCore, } from "./plugin";
@@ -2,12 +2,20 @@
2
2
  * SwitchRole Plugin Core (Framework-agnostic)
3
3
  */
4
4
  import type { ToolPluginCore, ToolContext, ToolResult } from "gui-chat-protocol";
5
- import type { SwitchRoleArgs, SwitchRoleJsonData } from "./types";
5
+ import type { Role, SwitchRoleArgs, SwitchRoleJsonData } from "./types";
6
6
  export { TOOL_NAME, TOOL_DEFINITION, SYSTEM_PROMPT, createToolDefinition } from "./definition";
7
- export { DEFAULT_ROLES, setRoles, getRoles, getRoleById } from "./roles";
7
+ /**
8
+ * Extended ToolContext with role-related app functions
9
+ */
10
+ interface SwitchRoleToolContext extends ToolContext {
11
+ app?: ToolContext["app"] & {
12
+ getRoles?: () => Role[];
13
+ switchRole?: (roleId: string) => void;
14
+ };
15
+ }
8
16
  /**
9
17
  * Execute the switchRole function
10
18
  * Triggers a role switch via the app layer
11
19
  */
12
- export declare const executeSwitchRole: (_context: ToolContext, args: SwitchRoleArgs) => Promise<ToolResult<unknown, SwitchRoleJsonData>>;
20
+ export declare const executeSwitchRole: (context: SwitchRoleToolContext, args: SwitchRoleArgs) => Promise<ToolResult<unknown, SwitchRoleJsonData>>;
13
21
  export declare const pluginCore: ToolPluginCore<unknown, SwitchRoleJsonData, SwitchRoleArgs>;
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=[{id:"general",name:"General"},{id:"tutor",name:"Tutor"},{id:"listener",name:"Listener"},{id:"receptionist",name:"Receptionist"},{id:"tourPlanner",name:"Trip Planner"},{id:"recipeGuide",name:"Recipe Guide"},{id:"game",name:"Game"},{id:"office",name:"Office"}];let r=c;function p(o){r=o}function s(){return r}function u(o){return r.find(i=>i.id===o)}const a="switchRole";function h(){const o=s(),i=o.map(n=>n.id),t=o.map(n=>`'${n.id}' (${n.name})`).join(", ");return{type:"function",name:a,description:`Switch the system prompt role and reconnect to the LLM. This changes the AI's personality and behavior. Available roles: ${t}.`,parameters:{type:"object",properties:{role:{type:"string",enum:i,description:`The role to switch to. Options: ${t}`}},required:["role"]}}}const d=h(),m=`When users ask to change the role, personality, or behavior of the AI (e.g., 'switch to tutor role', 'change to listener role', 'be a teacher'), use the ${a} function. Note that switching roles will disconnect and reconnect the conversation.`,g=async(o,i)=>{const{role:t}=i,n=s(),f=n.map(e=>`${e.id} (${e.name})`).join(", ");try{const e=u(t);if(!e)return{message:`Invalid role: ${t}`,jsonData:{success:!1,error:"Invalid role",availableRoles:n},instructions:`Tell the user that '${t}' is not a valid role. Available roles are: ${f}.`};const l=globalThis;if(typeof window<"u"&&typeof l.switchRole=="function")setTimeout(()=>{l.switchRole?.(t)},0);else return console.error("switchRole function not found on window object"),{message:"Failed to switch role: switchRole API not available",jsonData:{success:!1,error:"switchRole API not available"},instructions:"Tell the user that the role switching feature is not available."};return{message:`Role switch to '${e.name}' initiated`,jsonData:{success:!0,role:t,roleName:e.name}}}catch(e){return console.error("ERR: exception in switchRole",e),{message:`Role switch error: ${e instanceof Error?e.message:"Unknown error"}`,jsonData:{success:!1,error:e instanceof Error?e.message:"Unknown error"},instructions:"Acknowledge that there was an error switching roles and ask the user to try again."}}},R={toolDefinition:d,execute:g,generatingMessage:"Switching role...",isEnabled:()=>!0,systemPrompt:m};exports.DEFAULT_ROLES=c;exports.SYSTEM_PROMPT=m;exports.TOOL_DEFINITION=d;exports.TOOL_NAME=a;exports.createToolDefinition=h;exports.executeSwitchRole=g;exports.getRoleById=u;exports.getRoles=s;exports.pluginCore=R;exports.setRoles=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s="switchRole";function p(e){const n=e.map(r=>r.id),o=e.map(r=>`'${r.id}' (${r.name})`).join(", ");return{type:"function",name:s,description:`Switch the system prompt role and reconnect to the LLM. This changes the AI's personality and behavior. Available roles: ${o}.`,parameters:{type:"object",properties:{role:{type:"string",enum:n,description:`The role to switch to. Options: ${o}`}},required:["role"]}}}const i={type:"function",name:s,description:"Switch the system prompt role and reconnect to the LLM. This changes the AI's personality and behavior.",parameters:{type:"object",properties:{role:{type:"string",description:"The role ID to switch to"}},required:["role"]}},a=`When users ask to change the role, personality, or behavior of the AI (e.g., 'switch to tutor role', 'change to listener role', 'be a teacher'), use the ${s} function. Note that switching roles will disconnect and reconnect the conversation.`;function l(e){return typeof e.app?.getRoles=="function"?e.app.getRoles():(console.warn("switchRole: context.app.getRoles() not available, returning empty roles"),[])}function u(e,n){return l(e).find(r=>r.id===n)}const c=async(e,n)=>{const{role:o}=n,r=l(e),h=r.map(t=>`${t.id} (${t.name})`).join(", ");try{const t=u(e,o);if(!t)return{message:`Invalid role: ${o}`,jsonData:{success:!1,error:"Invalid role",availableRoles:r},instructions:`Tell the user that '${o}' is not a valid role. Available roles are: ${h}.`};if(typeof e.app?.switchRole=="function")setTimeout(()=>{e.app?.switchRole?.(o)},0);else return console.error("switchRole: context.app.switchRole() not available"),{message:"Failed to switch role: switchRole API not available",jsonData:{success:!1,error:"switchRole API not available"},instructions:"Tell the user that the role switching feature is not available."};return{message:`Role switch to '${t.name}' initiated`,jsonData:{success:!0,role:o,roleName:t.name}}}catch(t){return console.error("ERR: exception in switchRole",t),{message:`Role switch error: ${t instanceof Error?t.message:"Unknown error"}`,jsonData:{success:!1,error:t instanceof Error?t.message:"Unknown error"},instructions:"Acknowledge that there was an error switching roles and ask the user to try again."}}},g={toolDefinition:i,execute:c,generatingMessage:"Switching role...",isEnabled:()=>!0,systemPrompt:a};exports.SYSTEM_PROMPT=a;exports.TOOL_DEFINITION=i;exports.TOOL_NAME=s;exports.createToolDefinition=p;exports.executeSwitchRole=c;exports.pluginCore=g;
package/dist/core.js CHANGED
@@ -1,64 +1,66 @@
1
- const u = [
2
- { id: "general", name: "General" },
3
- { id: "tutor", name: "Tutor" },
4
- { id: "listener", name: "Listener" },
5
- { id: "receptionist", name: "Receptionist" },
6
- { id: "tourPlanner", name: "Trip Planner" },
7
- { id: "recipeGuide", name: "Recipe Guide" },
8
- { id: "game", name: "Game" },
9
- { id: "office", name: "Office" }
10
- ];
11
- let s = u;
12
- function g(o) {
13
- s = o;
14
- }
15
- function a() {
16
- return s;
17
- }
18
- function h(o) {
19
- return s.find((r) => r.id === o);
20
- }
21
- const l = "switchRole";
22
- function d() {
23
- const o = a(), r = o.map((n) => n.id), t = o.map((n) => `'${n.id}' (${n.name})`).join(", ");
1
+ const n = "switchRole";
2
+ function u(e) {
3
+ const s = e.map((r) => r.id), o = e.map((r) => `'${r.id}' (${r.name})`).join(", ");
24
4
  return {
25
5
  type: "function",
26
- name: l,
27
- description: `Switch the system prompt role and reconnect to the LLM. This changes the AI's personality and behavior. Available roles: ${t}.`,
6
+ name: n,
7
+ description: `Switch the system prompt role and reconnect to the LLM. This changes the AI's personality and behavior. Available roles: ${o}.`,
28
8
  parameters: {
29
9
  type: "object",
30
10
  properties: {
31
11
  role: {
32
12
  type: "string",
33
- enum: r,
34
- description: `The role to switch to. Options: ${t}`
13
+ enum: s,
14
+ description: `The role to switch to. Options: ${o}`
35
15
  }
36
16
  },
37
17
  required: ["role"]
38
18
  }
39
19
  };
40
20
  }
41
- const m = d(), f = `When users ask to change the role, personality, or behavior of the AI (e.g., 'switch to tutor role', 'change to listener role', 'be a teacher'), use the ${l} function. Note that switching roles will disconnect and reconnect the conversation.`, p = async (o, r) => {
42
- const { role: t } = r, n = a(), c = n.map((e) => `${e.id} (${e.name})`).join(", ");
21
+ const l = {
22
+ type: "function",
23
+ name: n,
24
+ description: "Switch the system prompt role and reconnect to the LLM. This changes the AI's personality and behavior.",
25
+ parameters: {
26
+ type: "object",
27
+ properties: {
28
+ role: {
29
+ type: "string",
30
+ description: "The role ID to switch to"
31
+ }
32
+ },
33
+ required: ["role"]
34
+ }
35
+ }, c = `When users ask to change the role, personality, or behavior of the AI (e.g., 'switch to tutor role', 'change to listener role', 'be a teacher'), use the ${n} function. Note that switching roles will disconnect and reconnect the conversation.`;
36
+ function i(e) {
37
+ return typeof e.app?.getRoles == "function" ? e.app.getRoles() : (console.warn(
38
+ "switchRole: context.app.getRoles() not available, returning empty roles"
39
+ ), []);
40
+ }
41
+ function h(e, s) {
42
+ return i(e).find((r) => r.id === s);
43
+ }
44
+ const p = async (e, s) => {
45
+ const { role: o } = s, r = i(e), a = r.map((t) => `${t.id} (${t.name})`).join(", ");
43
46
  try {
44
- const e = h(t);
45
- if (!e)
47
+ const t = h(e, o);
48
+ if (!t)
46
49
  return {
47
- message: `Invalid role: ${t}`,
50
+ message: `Invalid role: ${o}`,
48
51
  jsonData: {
49
52
  success: !1,
50
53
  error: "Invalid role",
51
- availableRoles: n
54
+ availableRoles: r
52
55
  },
53
- instructions: `Tell the user that '${t}' is not a valid role. Available roles are: ${c}.`
56
+ instructions: `Tell the user that '${o}' is not a valid role. Available roles are: ${a}.`
54
57
  };
55
- const i = globalThis;
56
- if (typeof window < "u" && typeof i.switchRole == "function")
58
+ if (typeof e.app?.switchRole == "function")
57
59
  setTimeout(() => {
58
- i.switchRole?.(t);
60
+ e.app?.switchRole?.(o);
59
61
  }, 0);
60
62
  else
61
- return console.error("switchRole function not found on window object"), {
63
+ return console.error("switchRole: context.app.switchRole() not available"), {
62
64
  message: "Failed to switch role: switchRole API not available",
63
65
  jsonData: {
64
66
  success: !1,
@@ -67,39 +69,35 @@ const m = d(), f = `When users ask to change the role, personality, or behavior
67
69
  instructions: "Tell the user that the role switching feature is not available."
68
70
  };
69
71
  return {
70
- message: `Role switch to '${e.name}' initiated`,
72
+ message: `Role switch to '${t.name}' initiated`,
71
73
  jsonData: {
72
74
  success: !0,
73
- role: t,
74
- roleName: e.name
75
+ role: o,
76
+ roleName: t.name
75
77
  }
76
78
  };
77
- } catch (e) {
78
- return console.error("ERR: exception in switchRole", e), {
79
- message: `Role switch error: ${e instanceof Error ? e.message : "Unknown error"}`,
79
+ } catch (t) {
80
+ return console.error("ERR: exception in switchRole", t), {
81
+ message: `Role switch error: ${t instanceof Error ? t.message : "Unknown error"}`,
80
82
  jsonData: {
81
83
  success: !1,
82
- error: e instanceof Error ? e.message : "Unknown error"
84
+ error: t instanceof Error ? t.message : "Unknown error"
83
85
  },
84
86
  instructions: "Acknowledge that there was an error switching roles and ask the user to try again."
85
87
  };
86
88
  }
87
- }, w = {
88
- toolDefinition: m,
89
+ }, m = {
90
+ toolDefinition: l,
89
91
  execute: p,
90
92
  generatingMessage: "Switching role...",
91
93
  isEnabled: () => !0,
92
- systemPrompt: f
94
+ systemPrompt: c
93
95
  };
94
96
  export {
95
- u as DEFAULT_ROLES,
96
- f as SYSTEM_PROMPT,
97
- m as TOOL_DEFINITION,
98
- l as TOOL_NAME,
99
- d as createToolDefinition,
97
+ c as SYSTEM_PROMPT,
98
+ l as TOOL_DEFINITION,
99
+ n as TOOL_NAME,
100
+ u as createToolDefinition,
100
101
  p as executeSwitchRole,
101
- h as getRoleById,
102
- a as getRoles,
103
- w as pluginCore,
104
- g as setRoles
102
+ m as pluginCore
105
103
  };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./core.cjs");exports.DEFAULT_ROLES=e.DEFAULT_ROLES;exports.SYSTEM_PROMPT=e.SYSTEM_PROMPT;exports.TOOL_DEFINITION=e.TOOL_DEFINITION;exports.TOOL_NAME=e.TOOL_NAME;exports.createToolDefinition=e.createToolDefinition;exports.executeSwitchRole=e.executeSwitchRole;exports.getRoleById=e.getRoleById;exports.getRoles=e.getRoles;exports.pluginCore=e.pluginCore;exports.setRoles=e.setRoles;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./core.cjs");exports.SYSTEM_PROMPT=e.SYSTEM_PROMPT;exports.TOOL_DEFINITION=e.TOOL_DEFINITION;exports.TOOL_NAME=e.TOOL_NAME;exports.createToolDefinition=e.createToolDefinition;exports.executeSwitchRole=e.executeSwitchRole;exports.pluginCore=e.pluginCore;
package/dist/index.js CHANGED
@@ -1,13 +1,9 @@
1
- import { DEFAULT_ROLES as t, SYSTEM_PROMPT as O, TOOL_DEFINITION as T, TOOL_NAME as l, createToolDefinition as R, executeSwitchRole as i, getRoleById as E, getRoles as r, pluginCore as I, setRoles as L } from "./core.js";
1
+ import { SYSTEM_PROMPT as O, TOOL_DEFINITION as T, TOOL_NAME as i, createToolDefinition as t, executeSwitchRole as r, pluginCore as c } from "./core.js";
2
2
  export {
3
- t as DEFAULT_ROLES,
4
3
  O as SYSTEM_PROMPT,
5
4
  T as TOOL_DEFINITION,
6
- l as TOOL_NAME,
7
- R as createToolDefinition,
8
- i as executeSwitchRole,
9
- E as getRoleById,
10
- r as getRoles,
11
- I as pluginCore,
12
- L as setRoles
5
+ i as TOOL_NAME,
6
+ t as createToolDefinition,
7
+ r as executeSwitchRole,
8
+ c as pluginCore
13
9
  };
@@ -7,7 +7,7 @@ import type { SwitchRoleArgs, SwitchRoleJsonData } from "../core/types";
7
7
  import Preview from "./Preview.vue";
8
8
  export declare const plugin: ToolPlugin<unknown, SwitchRoleJsonData, SwitchRoleArgs>;
9
9
  export type { Role, SwitchRoleArgs, SwitchRoleJsonData } from "../core/types";
10
- export { TOOL_NAME, TOOL_DEFINITION, SYSTEM_PROMPT, createToolDefinition, executeSwitchRole, pluginCore, DEFAULT_ROLES, setRoles, getRoles, getRoleById, } from "../core/plugin";
10
+ export { TOOL_NAME, TOOL_DEFINITION, SYSTEM_PROMPT, createToolDefinition, executeSwitchRole, pluginCore, } from "../core/plugin";
11
11
  export { Preview };
12
12
  declare const _default: {
13
13
  plugin: ToolPlugin<unknown, SwitchRoleJsonData, SwitchRoleArgs, import("gui-chat-protocol/vue").InputHandler, Record<string, unknown>>;
package/dist/vue.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./core.cjs"),e=require("vue"),d={class:"p-2 bg-gray-50 dark:bg-gray-800 rounded"},u={class:"text-xs text-gray-600 dark:text-gray-400"},p={key:0,class:"space-y-1"},m={class:"flex items-center gap-1"},g={class:"font-medium"},v={class:"text-xs text-gray-500"},E={key:1,class:"flex items-center gap-1 text-red-500"},n=e.defineComponent({__name:"Preview",props:{result:{}},setup(a){const s=a,c=e.computed(()=>s.result.jsonData?.success||!1),l=e.computed(()=>s.result.jsonData?.roleName||"Unknown"),i=e.computed(()=>s.result.jsonData?.error);return(x,o)=>(e.openBlock(),e.createElementBlock("div",d,[o[2]||(o[2]=e.createElementVNode("div",{class:"flex items-center gap-2 mb-2"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 text-purple-600 dark:text-purple-400",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",d:"M4 2a1 1 0 011 1v2.101a7.002 7.002 0 0111.601 2.566 1 1 0 11-1.885.666A5.002 5.002 0 005.999 7H9a1 1 0 010 2H4a1 1 0 01-1-1V3a1 1 0 011-1zm.008 9.057a1 1 0 011.276.61A5.002 5.002 0 0014.001 13H11a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0v-2.101a7.002 7.002 0 01-11.601-2.566 1 1 0 01.61-1.276z","clip-rule":"evenodd"})]),e.createElementVNode("span",{class:"text-sm font-medium text-gray-700 dark:text-gray-300"}," Role Switch ")],-1)),e.createElementVNode("div",u,[c.value?(e.openBlock(),e.createElementBlock("div",p,[e.createElementVNode("div",m,[o[0]||(o[0]=e.createElementVNode("span",{class:"text-green-500"},"✓",-1)),e.createElementVNode("span",g,e.toDisplayString(l.value),1)]),e.createElementVNode("div",v,"Switched to "+e.toDisplayString(l.value)+" role",1)])):(e.openBlock(),e.createElementBlock("div",E,[o[1]||(o[1]=e.createElementVNode("span",null,"✗",-1)),e.createElementVNode("span",null,e.toDisplayString(i.value||"Failed to switch role"),1)]))])]))}}),r={...t.pluginCore,previewComponent:n},_={plugin:r};exports.DEFAULT_ROLES=t.DEFAULT_ROLES;exports.SYSTEM_PROMPT=t.SYSTEM_PROMPT;exports.TOOL_DEFINITION=t.TOOL_DEFINITION;exports.TOOL_NAME=t.TOOL_NAME;exports.createToolDefinition=t.createToolDefinition;exports.executeSwitchRole=t.executeSwitchRole;exports.getRoleById=t.getRoleById;exports.getRoles=t.getRoles;exports.pluginCore=t.pluginCore;exports.setRoles=t.setRoles;exports.Preview=n;exports.default=_;exports.plugin=r;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./core.cjs"),e=require("vue"),d={class:"p-2 bg-gray-50 dark:bg-gray-800 rounded"},u={class:"text-xs text-gray-600 dark:text-gray-400"},p={key:0,class:"space-y-1"},m={class:"flex items-center gap-1"},g={class:"font-medium"},v={class:"text-xs text-gray-500"},x={key:1,class:"flex items-center gap-1 text-red-500"},n=e.defineComponent({__name:"Preview",props:{result:{}},setup(a){const s=a,c=e.computed(()=>s.result.jsonData?.success||!1),l=e.computed(()=>s.result.jsonData?.roleName||"Unknown"),i=e.computed(()=>s.result.jsonData?.error);return(E,o)=>(e.openBlock(),e.createElementBlock("div",d,[o[2]||(o[2]=e.createElementVNode("div",{class:"flex items-center gap-2 mb-2"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 text-purple-600 dark:text-purple-400",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",d:"M4 2a1 1 0 011 1v2.101a7.002 7.002 0 0111.601 2.566 1 1 0 11-1.885.666A5.002 5.002 0 005.999 7H9a1 1 0 010 2H4a1 1 0 01-1-1V3a1 1 0 011-1zm.008 9.057a1 1 0 011.276.61A5.002 5.002 0 0014.001 13H11a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0v-2.101a7.002 7.002 0 01-11.601-2.566 1 1 0 01.61-1.276z","clip-rule":"evenodd"})]),e.createElementVNode("span",{class:"text-sm font-medium text-gray-700 dark:text-gray-300"}," Role Switch ")],-1)),e.createElementVNode("div",u,[c.value?(e.openBlock(),e.createElementBlock("div",p,[e.createElementVNode("div",m,[o[0]||(o[0]=e.createElementVNode("span",{class:"text-green-500"},"✓",-1)),e.createElementVNode("span",g,e.toDisplayString(l.value),1)]),e.createElementVNode("div",v,"Switched to "+e.toDisplayString(l.value)+" role",1)])):(e.openBlock(),e.createElementBlock("div",x,[o[1]||(o[1]=e.createElementVNode("span",null,"✗",-1)),e.createElementVNode("span",null,e.toDisplayString(i.value||"Failed to switch role"),1)]))])]))}}),r={...t.pluginCore,previewComponent:n},_={plugin:r};exports.SYSTEM_PROMPT=t.SYSTEM_PROMPT;exports.TOOL_DEFINITION=t.TOOL_DEFINITION;exports.TOOL_NAME=t.TOOL_NAME;exports.createToolDefinition=t.createToolDefinition;exports.executeSwitchRole=t.executeSwitchRole;exports.pluginCore=t.pluginCore;exports.Preview=n;exports.default=_;exports.plugin=r;
package/dist/vue.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { pluginCore as p } from "./core.js";
2
- import { DEFAULT_ROLES as T, SYSTEM_PROMPT as N, TOOL_DEFINITION as M, TOOL_NAME as A, createToolDefinition as B, executeSwitchRole as C, getRoleById as I, getRoles as L, setRoles as P } from "./core.js";
3
- import { defineComponent as u, computed as o, createElementBlock as a, openBlock as r, createElementVNode as e, toDisplayString as l } from "vue";
4
- const m = { class: "p-2 bg-gray-50 dark:bg-gray-800 rounded" }, x = { class: "text-xs text-gray-600 dark:text-gray-400" }, g = {
2
+ import { SYSTEM_PROMPT as E, TOOL_DEFINITION as M, TOOL_NAME as C, createToolDefinition as P, executeSwitchRole as b } from "./core.js";
3
+ import { defineComponent as u, computed as o, createElementBlock as a, openBlock as r, createElementVNode as e, toDisplayString as n } from "vue";
4
+ const m = { class: "p-2 bg-gray-50 dark:bg-gray-800 rounded" }, x = { class: "text-xs text-gray-600 dark:text-gray-400" }, v = {
5
5
  key: 0,
6
6
  class: "space-y-1"
7
- }, v = { class: "flex items-center gap-1" }, _ = { class: "font-medium" }, f = { class: "text-xs text-gray-500" }, w = {
7
+ }, g = { class: "flex items-center gap-1" }, _ = { class: "font-medium" }, f = { class: "text-xs text-gray-500" }, w = {
8
8
  key: 1,
9
9
  class: "flex items-center gap-1 text-red-500"
10
10
  }, y = /* @__PURE__ */ u({
@@ -13,7 +13,7 @@ const m = { class: "p-2 bg-gray-50 dark:bg-gray-800 rounded" }, x = { class: "te
13
13
  result: {}
14
14
  },
15
15
  setup(i) {
16
- const s = i, c = o(() => s.result.jsonData?.success || !1), n = o(() => s.result.jsonData?.roleName || "Unknown"), d = o(() => s.result.jsonData?.error);
16
+ const s = i, c = o(() => s.result.jsonData?.success || !1), l = o(() => s.result.jsonData?.roleName || "Unknown"), d = o(() => s.result.jsonData?.error);
17
17
  return (k, t) => (r(), a("div", m, [
18
18
  t[2] || (t[2] = e("div", { class: "flex items-center gap-2 mb-2" }, [
19
19
  e("svg", {
@@ -31,15 +31,15 @@ const m = { class: "p-2 bg-gray-50 dark:bg-gray-800 rounded" }, x = { class: "te
31
31
  e("span", { class: "text-sm font-medium text-gray-700 dark:text-gray-300" }, " Role Switch ")
32
32
  ], -1)),
33
33
  e("div", x, [
34
- c.value ? (r(), a("div", g, [
35
- e("div", v, [
34
+ c.value ? (r(), a("div", v, [
35
+ e("div", g, [
36
36
  t[0] || (t[0] = e("span", { class: "text-green-500" }, "✓", -1)),
37
- e("span", _, l(n.value), 1)
37
+ e("span", _, n(l.value), 1)
38
38
  ]),
39
- e("div", f, "Switched to " + l(n.value) + " role", 1)
39
+ e("div", f, "Switched to " + n(l.value) + " role", 1)
40
40
  ])) : (r(), a("div", w, [
41
41
  t[1] || (t[1] = e("span", null, "✗", -1)),
42
- e("span", null, l(d.value || "Failed to switch role"), 1)
42
+ e("span", null, n(d.value || "Failed to switch role"), 1)
43
43
  ]))
44
44
  ])
45
45
  ]));
@@ -50,17 +50,13 @@ const m = { class: "p-2 bg-gray-50 dark:bg-gray-800 rounded" }, x = { class: "te
50
50
  // No viewComponent - this plugin only has a preview
51
51
  }, O = { plugin: h };
52
52
  export {
53
- T as DEFAULT_ROLES,
54
53
  y as Preview,
55
- N as SYSTEM_PROMPT,
54
+ E as SYSTEM_PROMPT,
56
55
  M as TOOL_DEFINITION,
57
- A as TOOL_NAME,
58
- B as createToolDefinition,
56
+ C as TOOL_NAME,
57
+ P as createToolDefinition,
59
58
  O as default,
60
- C as executeSwitchRole,
61
- I as getRoleById,
62
- L as getRoles,
59
+ b as executeSwitchRole,
63
60
  h as plugin,
64
- p as pluginCore,
65
- P as setRoles
61
+ p as pluginCore
66
62
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gui-chat-plugin/switch-role",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Switch role plugin for GUIChat",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -45,7 +45,7 @@
45
45
  "eslint": "^9.39.2",
46
46
  "eslint-plugin-vue": "^10.6.2",
47
47
  "globals": "^17.0.0",
48
- "gui-chat-protocol": "^0.0.1",
48
+ "gui-chat-protocol": "^0.0.2",
49
49
  "tailwindcss": "^4.1.18",
50
50
  "typescript": "~5.9.3",
51
51
  "vite": "^7.3.1",
@@ -1,9 +0,0 @@
1
- /**
2
- * Default roles configuration
3
- * These can be overridden by the app layer
4
- */
5
- import type { Role } from "./types";
6
- export declare const DEFAULT_ROLES: Role[];
7
- export declare function setRoles(roles: Role[]): void;
8
- export declare function getRoles(): Role[];
9
- export declare function getRoleById(id: string): Role | undefined;