shennian 0.3.2 → 0.3.4
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/dist/publish-build-manifest.json +65 -45
- package/dist/src/agents/adapter.d.ts +1 -1
- package/dist/src/agents/claude.d.ts +2 -2
- package/dist/src/agents/claude.js +4 -4
- package/dist/src/agents/codex.d.ts +2 -1
- package/dist/src/agents/codex.js +6 -6
- package/dist/src/agents/cursor.d.ts +2 -2
- package/dist/src/agents/cursor.js +1 -1
- package/dist/src/agents/custom.d.ts +2 -2
- package/dist/src/agents/custom.js +4 -4
- package/dist/src/agents/gemini.d.ts +2 -2
- package/dist/src/agents/gemini.js +1 -1
- package/dist/src/agents/model-registry/service.js +1 -1
- package/dist/src/agents/openclaw.d.ts +2 -2
- package/dist/src/agents/openclaw.js +2 -2
- package/dist/src/agents/opencode.d.ts +2 -2
- package/dist/src/agents/opencode.js +1 -1
- package/dist/src/agents/platform-instructions.d.ts +3 -3
- package/dist/src/agents/platform-instructions.js +15 -7
- package/dist/src/agents/runtime-compatibility.d.ts +11 -0
- package/dist/src/agents/runtime-compatibility.js +1 -0
- package/dist/src/agents/workbuddy.d.ts +1 -1
- package/dist/src/agents/workbuddy.js +2 -2
- package/dist/src/index.js +2 -2
- package/dist/src/integrations/room-plugin-bundles.js +1 -1
- package/dist/src/integrations/room-plugin-shared.d.ts +1 -0
- package/dist/src/integrations/room-plugin-shared.js +2 -2
- package/dist/src/room/agent-tool.d.ts +62 -0
- package/dist/src/room/agent-tool.js +1 -0
- package/dist/src/room/managed-room-binding.d.ts +42 -0
- package/dist/src/room/managed-room-binding.js +1 -0
- package/dist/src/room/room-action-client.d.ts +2 -0
- package/dist/src/room/room-action-client.js +1 -1
- package/dist/src/room/room-action-ipc.js +1 -1
- package/dist/src/room/room-action-schema.js +1 -1
- package/dist/src/room/room-authorized-action-executor.js +1 -1
- package/dist/src/room/tool-schema.d.ts +4 -0
- package/dist/src/room/tool-schema.js +1 -1
- package/dist/src/room/tool-server.js +3 -3
- package/dist/src/session/handlers/chat.js +2 -2
- package/dist/src/session/handlers/room-managed.d.ts +4 -0
- package/dist/src/session/handlers/room-managed.js +1 -0
- package/dist/src/session/manager.d.ts +3 -1
- package/dist/src/session/manager.js +1 -1
- package/dist/src/session/queue.js +3 -3
- package/node_modules/@shennian/wire/dist/agent-workspace.d.ts +41 -0
- package/node_modules/@shennian/wire/dist/agent-workspace.d.ts.map +1 -0
- package/node_modules/@shennian/wire/dist/agent-workspace.js +3 -0
- package/node_modules/@shennian/wire/dist/agent-workspace.js.map +1 -0
- package/node_modules/@shennian/wire/dist/index.d.ts +1 -0
- package/node_modules/@shennian/wire/dist/index.d.ts.map +1 -1
- package/node_modules/@shennian/wire/dist/index.js +1 -0
- package/node_modules/@shennian/wire/dist/index.js.map +1 -1
- package/node_modules/@shennian/wire/dist/methods.d.ts +1 -1
- package/node_modules/@shennian/wire/dist/methods.d.ts.map +1 -1
- package/node_modules/@shennian/wire/dist/session.d.ts +21 -0
- package/node_modules/@shennian/wire/dist/session.d.ts.map +1 -1
- package/node_modules/@shennian/wire/dist/session.js +13 -2
- package/node_modules/@shennian/wire/dist/session.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DaemonIpcError as
|
|
1
|
+
import{DaemonIpcError as l}from"../daemon-ipc/protocol.js";function I(t,n){const e=h(n);switch(t){case"room.status":return d(e,[]),{};case"room.read":{d(e,["afterSequence","limit","attachmentIds","query"]);const s=o(e.query,"query",200),i=e.afterSequence??"0",a=e.limit??50;(typeof i!="string"||!/^(0|[1-9]\d{0,19})$/.test(i))&&r("afterSequence"),(typeof a!="number"||!Number.isInteger(a)||a<1||a>100)&&r("limit");const m=g(e.attachmentIds,"attachmentIds",10);return s&&(e.afterSequence!=null||m)&&r("parameters"),s?{query:s,limit:a}:{afterSequence:i,limit:a,...m?{attachmentIds:m}:{}}}case"room.send":{d(e,["clientMessageId","text","files","mentionMembershipIds","replyToMessageId"]);const s=c(e.clientMessageId,"clientMessageId",191),i=o(e.text,"text",2e4),a=u(e.files,"files",10);!i&&!a&&r("parameters");const m=g(e.mentionMembershipIds,"mentionMembershipIds",20),p=o(e.replyToMessageId,"replyToMessageId",191);return{clientMessageId:s,text:i??"",...a?{files:a}:{},...m?{mentionMembershipIds:m}:{},...p?{replyToMessageId:p}:{}}}case"room.mode":return d(e,["activationMode"]),{activationMode:f(e.activationMode)};case"room.create":return d(e,["name","agentAlias","agentDescription","activationMode"]),{name:c(e.name,"name",80),agentAlias:c(e.agentAlias,"agentAlias",80),...o(e.agentDescription,"agentDescription",1e3)?{agentDescription:o(e.agentDescription,"agentDescription",1e3)}:{},activationMode:f(e.activationMode??"auto_follow")};case"room.join":return d(e,["inviteUrl","agentAlias","agentDescription","message","activationMode"]),{inviteUrl:y(e.inviteUrl),agentAlias:c(e.agentAlias,"agentAlias",80),...o(e.agentDescription,"agentDescription",1e3)?{agentDescription:o(e.agentDescription,"agentDescription",1e3)}:{},activationMode:f(e.activationMode??"auto_follow"),...o(e.message,"message",500)?{message:o(e.message,"message",500)}:{}}}}function u(t,n,e){return t==null?void 0:((!Array.isArray(t)||t.length<1||t.length>e)&&r(n),t.map(i=>((typeof i!="string"||!i.trim()||i.length>4096||/[\0\r\n]/.test(i))&&r(n),i.trim())))}function h(t){return t==null?{}:((Array.isArray(t)||typeof t!="object")&&r("parameters"),t)}function d(t,n){const e=new Set(n);Object.keys(t).some(s=>!e.has(s))&&r("parameters")}function c(t,n,e){return(typeof t!="string"||!t.trim()||t.length>e||/[\0\r]/.test(t))&&r(n),t.trim()}function o(t,n,e){if(!(t==null||t===""))return c(t,n,e)}function g(t,n,e){if(t==null)return;(!Array.isArray(t)||t.length>e)&&r(n);const s=t.map(i=>c(i,n,191));return new Set(s).size!==s.length&&r(n),s.length>0?s:void 0}function f(t){if(t==="auto"||t==="auto_follow")return"auto_follow";if(t==="mention"||t==="mention_only")return"mention_only";if(t==="paused")return"paused";r("activationMode")}function y(t){const n=c(t,"inviteUrl",2048);let e;try{e=new URL(n)}catch{r("inviteUrl")}return(e.protocol!=="https:"||e.hostname!=="shennian.net"||!/^\/spaces\/join\/[A-Za-z0-9_-]{43}$/.test(e.pathname)||e.username||e.password||e.search||e.hash)&&r("inviteUrl"),e.toString()}function r(t){throw new l("invalid_params",`${t} is invalid.`)}export{I as normalizeRoomActionParameters};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import g from"node:path";import{normalizeRoomActionParameters as f}from"./room-action-schema.js";class H{deps;constructor(e){this.deps=e}async execute(e,m){const s=I(m??this.deps.getMachineCredentials()),n=A(e),r=this.deps.observations.observe({machineId:s.machineId,runtimeAdapter:n.runtimeAdapter,sourceSessionKey:n.sourceSessionKey,hostContextHash:n.hostContextHash,workspaceHash:n.workspaceHash,workspacePath:n.workspacePath,lifecycleState:"active",eventName:"PreToolUse"}),c=await this.deps.actionClient.resolveNativeSession({machineToken:s.machineToken,runtimeAdapter:n.runtimeAdapter,sourceSessionKey:n.sourceSessionKey}),i=!!r.workspacePath,p=this.deps.registry.register({machineId:s.machineId,runtimeAdapter:n.runtimeAdapter,sourceSessionKey:n.sourceSessionKey,nianSessionId:c.nianSessionId,hostProcessIdentity:`${n.runtimeAdapter}:${r.hostContextHash}:${r.registrationEpoch}`,capabilities:{canIdentifySession:!0,canBindAutomatically:!0,canOpenEmbeddedRoomPage:!1,canResumeIdleSession:i,canActivateWhileHostOpen:!1}}),
|
|
1
|
+
import g from"node:path";import{normalizeRoomActionParameters as f}from"./room-action-schema.js";class H{deps;constructor(e){this.deps=e}async execute(e,m){const s=I(m??this.deps.getMachineCredentials()),n=A(e),r=this.deps.observations.observe({machineId:s.machineId,runtimeAdapter:n.runtimeAdapter,sourceSessionKey:n.sourceSessionKey,hostContextHash:n.hostContextHash,workspaceHash:n.workspaceHash,workspacePath:n.workspacePath,lifecycleState:"active",eventName:"PreToolUse"}),c=await this.deps.actionClient.resolveNativeSession({machineToken:s.machineToken,runtimeAdapter:n.runtimeAdapter,sourceSessionKey:n.sourceSessionKey}),i=!!r.workspacePath,p=this.deps.registry.register({machineId:s.machineId,runtimeAdapter:n.runtimeAdapter,sourceSessionKey:n.sourceSessionKey,nianSessionId:c.nianSessionId,hostProcessIdentity:`${n.runtimeAdapter}:${r.hostContextHash}:${r.registrationEpoch}`,capabilities:{canIdentifySession:!0,canBindAutomatically:!0,canOpenEmbeddedRoomPage:!1,canResumeIdleSession:i,canActivateWhileHostOpen:!1}}),y=i?"idle_resume":"notify_only",l=`${n.action.replace(".","-")}:${e.id}`,h={machineToken:s.machineToken,bindingIntentId:l,nianSessionId:c.nianSessionId,runtimeAdapter:n.runtimeAdapter,sessionRegistryKey:p.registryKey,agentAlias:n.parameters.agentAlias,agentDescription:n.parameters.agentDescription,activationCapability:y,activationMode:n.parameters.activationMode},o=n.action==="room.create"?await this.deps.actionClient.createRoom({...h,name:n.parameters.name}):await this.deps.actionClient.joinRoom({...h,inviteToken:w(n.parameters.inviteUrl),message:n.parameters.message});return this.deps.registry.setBinding({registryKey:p.registryKey,bindingId:o.binding.id,roomId:o.room.id,agentIdentityId:o.binding.agentIdentityId,agentMembershipId:o.binding.agentMembershipId,status:o.binding.status,activationMode:o.binding.activationMode}),JSON.parse(JSON.stringify(o))}}function A(t){const e=t.canonicalActionPayload;(!e||Array.isArray(e)||typeof e!="object"||e.schemaVersion!==1)&&a();const m=k(e.runtimeAdapter),s=d(e.sourceSessionKey,1024),n=u(e.hostContextHash),r=e.workspaceHash==null?null:u(e.workspaceHash),c=S(e.workspacePath);e.lifecycleState!=="active"&&a(),(e.action!==t.actionType||e.action!=="room.create"&&e.action!=="room.join")&&a();const i=f(e.action,e.actionParameters);return(!i||Array.isArray(i)||typeof i!="object")&&a(),{runtimeAdapter:m,sourceSessionKey:s,hostContextHash:n,workspaceHash:r,workspacePath:c,action:e.action,parameters:{name:typeof i.name=="string"?i.name:"",inviteUrl:typeof i.inviteUrl=="string"?i.inviteUrl:"",agentAlias:d(i.agentAlias,80),...typeof i.agentDescription=="string"?{agentDescription:i.agentDescription}:{},activationMode:b(i.activationMode),...typeof i.message=="string"?{message:i.message}:{}}}}function I(t){if(!t.machineId?.trim()||!t.machineToken?.trim())throw new Error("machine_credentials_unavailable");return{machineId:t.machineId.trim(),machineToken:t.machineToken.trim()}}function k(t){return t!=="codex"&&t!=="claude_code"&&t!=="workbuddy"&&a(),t}function b(t){return t!=="auto_follow"&&t!=="mention_only"&&t!=="paused"&&a(),t}function d(t,e){return(typeof t!="string"||!t.trim()||t.length>e||/[\0\r\n]/.test(t))&&a(),t.trim()}function u(t){const e=d(t,64);return/^[a-f0-9]{64}$/.test(e)||a(),e}function S(t){if(t==null||t==="")return null;const e=d(t,4096);return g.isAbsolute(e)||a(),e}function w(t){const e=/^https:\/\/shennian\.net\/spaces\/join\/([A-Za-z0-9_-]{43})$/.exec(t);return e||a(),e[1]}function a(){throw new Error("invalid_room_authorized_action")}export{H as RoomAuthorizedActionExecutor};
|
|
@@ -25,6 +25,10 @@ export declare const SHENNIAN_ROOM_TOOL: {
|
|
|
25
25
|
readonly minLength: 1;
|
|
26
26
|
readonly maxLength: 80;
|
|
27
27
|
};
|
|
28
|
+
readonly agentDescription: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly maxLength: 1000;
|
|
31
|
+
};
|
|
28
32
|
readonly inviteUrl: {
|
|
29
33
|
readonly type: "string";
|
|
30
34
|
readonly format: "uri";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{normalizeRoomActionParameters as c}from"./room-action-schema.js";const d="shennian_room",l={name:d,title:"Shennian Room",description:"Create, join, read, search, send to, configure, or inspect the single Shennian Room bound to this Agent session.",inputSchema:{type:"object",additionalProperties:!1,required:["action"],properties:{action:{type:"string",enum:["create","join","read","send","mode","status"],description:"The Room action to perform."},name:{type:"string",minLength:1,maxLength:80},agentAlias:{type:"string",minLength:1,maxLength:80},inviteUrl:{type:"string",format:"uri",maxLength:2048},message:{type:"string",maxLength:500},activationMode:{type:"string",enum:["auto","auto_follow","mention","mention_only","paused"]},afterSequence:{type:"string",pattern:"^(0|[1-9]\\d{0,19})$"},limit:{type:"integer",minimum:1,maximum:100},query:{type:"string",minLength:1,maxLength:200},attachmentIds:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:191}},clientMessageId:{type:"string",minLength:1,maxLength:191},text:{type:"string",minLength:1,maxLength:2e4},files:{type:"array",description:"Up to 10 files inside the current Agent workspace to upload privately with this message.",minItems:1,maxItems:10,items:{type:"string",minLength:1,maxLength:4096}},mentionMembershipIds:{type:"array",maxItems:20,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:191}},replyToMessageId:{type:"string",minLength:1,maxLength:191}}}},u=new Map([["create","room.create"],["join","room.join"],["read","room.read"],["send","room.send"],["mode","room.mode"],["status","room.status"]]);function f(
|
|
1
|
+
import{normalizeRoomActionParameters as c}from"./room-action-schema.js";const d="shennian_room",l={name:d,title:"Shennian Room",description:"Create, join, read, search, send to, configure, or inspect the single Shennian Room bound to this Agent session.",inputSchema:{type:"object",additionalProperties:!1,required:["action"],properties:{action:{type:"string",enum:["create","join","read","send","mode","status"],description:"The Room action to perform."},name:{type:"string",minLength:1,maxLength:80},agentAlias:{type:"string",minLength:1,maxLength:80},agentDescription:{type:"string",maxLength:1e3},inviteUrl:{type:"string",format:"uri",maxLength:2048},message:{type:"string",maxLength:500},activationMode:{type:"string",enum:["auto","auto_follow","mention","mention_only","paused"]},afterSequence:{type:"string",pattern:"^(0|[1-9]\\d{0,19})$"},limit:{type:"integer",minimum:1,maximum:100},query:{type:"string",minLength:1,maxLength:200},attachmentIds:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:191}},clientMessageId:{type:"string",minLength:1,maxLength:191},text:{type:"string",minLength:1,maxLength:2e4},files:{type:"array",description:"Up to 10 files inside the current Agent workspace to upload privately with this message.",minItems:1,maxItems:10,items:{type:"string",minLength:1,maxLength:4096}},mentionMembershipIds:{type:"array",maxItems:20,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:191}},replyToMessageId:{type:"string",minLength:1,maxLength:191}}}},u=new Map([["create","room.create"],["join","room.join"],["read","room.read"],["send","room.send"],["mode","room.mode"],["status","room.status"]]);function f(i){(!i||typeof i!="object"||Array.isArray(i))&&g();const t=i,n=typeof t.action=="string"?u.get(t.action):void 0;n||g();const o=t._shennianRegistryKey,r=t._shennianInvocationToken,s=t._shennianAuthorizedActionId,a=Object.keys(t).filter(e=>e.startsWith("_shennian"));if(typeof s=="string"&&/^[A-Za-z0-9_-]{8,128}$/.test(s)&&a.length===1){const e=Object.fromEntries(Object.entries(t).filter(([m])=>m!=="action"&&m!=="_shennianAuthorizedActionId"));return{action:n,actionParameters:c(n,e),authorizedActionId:s}}if(typeof o!="string"||!/^[a-f0-9]{64}$/.test(o)||typeof r!="string"||!/^sni_v1_[A-Za-z0-9_-]{40,80}$/.test(r)||a.some(e=>e!=="_shennianRegistryKey"&&e!=="_shennianInvocationToken"))throw new p("session_context_required","The current Agent session is not connected to Shennian Room yet.");const h=Object.fromEntries(Object.entries(t).filter(([e])=>e!=="action"&&e!=="_shennianRegistryKey"&&e!=="_shennianInvocationToken"));return{action:n,actionParameters:c(n,h),registryKey:o,invocationToken:r}}class p extends Error{code;constructor(t,n){super(n),this.code=t,this.name="RoomToolInputError"}}function g(){throw new p("invalid_tool_input","Invalid Shennian Room tool input.")}export{p as RoomToolInputError,l as SHENNIAN_ROOM_TOOL,d as SHENNIAN_ROOM_TOOL_NAME,f as normalizeRoomToolInput};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
`);continue}const
|
|
3
|
-
`)}}function
|
|
1
|
+
import l from"node:readline";import{callDaemonIpc as u}from"../daemon-ipc/client.js";import{DaemonIpcError as m}from"../daemon-ipc/protocol.js";import{normalizeRoomToolInput as d,RoomToolInputError as p,SHENNIAN_ROOM_TOOL as y,SHENNIAN_ROOM_TOOL_NAME as g}from"./tool-schema.js";import{AgentToolError as N,executeAgentTool as h,SHENNIAN_AGENT_TOOL as I,SHENNIAN_AGENT_TOOL_NAME as f}from"./agent-tool.js";async function O(t,e=u){const o=d(t);return o.authorizedActionId?e({method:"authorized-action.wait",params:{id:o.authorizedActionId,timeoutMs:12e4},timeoutMs:135e3}):e({method:"room-action.execute",params:{registryKey:o.registryKey,invocationToken:o.invocationToken,action:o.action,actionParameters:o.actionParameters},timeoutMs:o.action==="room.read"?65e3:15e3})}async function T(t,e=u){if(!t||typeof t!="object"||Array.isArray(t))return a(null,-32600,"Invalid Request");const o=t,r=A(o.id);if(o.jsonrpc!=="2.0"||typeof o.method!="string")return a(r,-32600,"Invalid Request");if(o.method.startsWith("notifications/"))return null;if(o.method==="initialize")return s(r,{protocolVersion:_(o.params),capabilities:{tools:{listChanged:!1}},serverInfo:{name:"shennian-room",version:"1.0.0"}});if(o.method==="ping")return s(r,{});if(o.method==="tools/list")return s(r,{tools:[y,I]});if(o.method!=="tools/call")return a(r,-32601,"Method not found");const n=E(o.params);if(!n||n.name!==g&&n.name!==f)return a(r,-32602,"Invalid params");try{const i=n.name===f?await h(n.arguments):await O(n.arguments,e);return s(r,{content:[{type:"text",text:JSON.stringify(i)}],structuredContent:i,isError:!1})}catch(i){const c=R(i);return s(r,{content:[{type:"text",text:JSON.stringify(c)}],structuredContent:c,isError:!0})}}async function b(t=process.stdin,e=process.stdout){const o=l.createInterface({input:t,crlfDelay:1/0});for await(const r of o){if(!r.trim())continue;let n;try{n=JSON.parse(r)}catch{e.write(`${JSON.stringify(a(null,-32700,"Parse error"))}
|
|
2
|
+
`);continue}const i=await T(n);i&&e.write(`${JSON.stringify(i)}
|
|
3
|
+
`)}}function A(t){return typeof t=="string"||typeof t=="number"||t===null?t:null}function _(t){if(t&&typeof t=="object"){const e=t.protocolVersion;if(typeof e=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(e))return e}return"2025-06-18"}function E(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;return typeof e.name=="string"?{name:e.name,arguments:e.arguments??{}}:null}function R(t){return t instanceof p||t instanceof N||t instanceof m?{ok:!1,error:{code:t.code,message:t.message}}:{ok:!1,error:{code:"room_tool_failed",message:"Shennian Room action failed."}}}function s(t,e){return{jsonrpc:"2.0",id:t,result:e}}function a(t,e,o){return{jsonrpc:"2.0",id:t,error:{code:e,message:o}}}export{O as executeRoomTool,T as handleRoomToolRpc,b as runRoomToolServer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
`),a=e>0?Math.min(e,80):Math.min(t.length,80);return t.slice(0,a)}function Y(t,e,a={}){if(t.state==="tool-call"||t.state==="tool-result"){const s={runId:t.runId,sourceSeq:t.seq};return{state:t.state,runId:t.runId,seq:t.seq,sessionId:e,detailRef:s,...t.name?{name:t.name}:{},...t.source?{source:t.source}:{},...t.agentSessionId?{agentSessionId:t.agentSessionId}:{},...a}}return{...t,sessionId:e,...a}}const X=3e4;function Z(t){return t.state==="heartbeat"?t.runPhase??null:t.state==="tool-call"||t.state==="tool-result"?"tool_running":t.state==="approval-pending"?"waiting_approval":t.state==="delta"?t.thinking?"thinking":"streaming_text":t.state==="init"||t.state==="start"?"thinking":null}function ee(t,e){return`Agent send failed: ${e instanceof Error?e.message:String(e)}`}function _(t,e){return t!=="manager"?t:e==="claude"?"claude":"codex"}function L(t,e,a){t.client.sendEvent({type:"event",event:"session.message",payload:{sessionId:e.sessionId,message:e,session:{id:e.sessionId,agentType:a.agentType,agentSessionId:a.agentSessionId??null,modelId:a.modelId??null,workDir:a.workDir,status:"active",externalChannel:null}}})}function te(t,e){B({sessionId:e.sessionId,agentType:e.agentType,workDir:e.workDir,agentSessionId:e.agentSessionId??null,modelId:e.modelId??null}),t.client.sendEvent({type:"event",event:"session.update",payload:{session:{id:e.sessionId,agentType:e.agentType,agentSessionId:e.agentSessionId??null,modelId:e.modelId??null,workDir:e.workDir,status:"active",externalChannel:null}}})}function Ie(t){if(!t||typeof t!="object")return null;const e=t;return{configured:e.configured===void 0?void 0:!!e.configured,connected:!!e.connected,type:typeof e.type=="string"?e.type:null,channelId:typeof e.channelId=="string"?e.channelId:null,name:typeof e.name=="string"?e.name:null,canReply:e.canReply===void 0||e.canReply===null?null:!!e.canReply,systemPrompt:typeof e.systemPrompt=="string"?e.systemPrompt:null,wechatRpaSource:typeof e.wechatRpaSource=="string"?e.wechatRpaSource:null,wechatRpaGroups:Array.isArray(e.wechatRpaGroups)?e.wechatRpaGroups.map(a=>({name:String(a?.name||"").trim()})).filter(a=>a.name):null,pollIntervalMs:Number.isFinite(e.pollIntervalMs)?Number(e.pollIntervalMs):null,recentLimit:Number.isFinite(e.recentLimit)?Number(e.recentLimit):null,idleSeconds:Number.isFinite(e.idleSeconds)?Number(e.idleSeconds):null,forceForeground:e.forceForeground===void 0||e.forceForeground===null?null:!!e.forceForeground,noRestore:e.noRestore===void 0||e.noRestore===null?null:!!e.noRestore,downloadAttachments:e.downloadAttachments===void 0||e.downloadAttachments===null?null:!!e.downloadAttachments,downloadAttachmentsDir:typeof e.downloadAttachmentsDir=="string"?e.downloadAttachmentsDir:null}}function we(t){return!!(t?.configured??t?.connected)}function W(t){return J(t)}function v(t,e,a){return{}}function ne(t,e,a,s,i){t.configure?.({sessionId:e,externalChannel:s??null,env:{...W(a),...v(e,s,i)}})}function Se(t,e,a){return null}function ae(t,e,a){if(t!=="claude"||!a)return e;const s=e.trim();return!!s&&s.startsWith("-")&&!s.includes("/")?U(a)??e:e}function re(t,e,a,s){let i=null;function f(n,r={}){t.client.sendAgentEvent({type:"event",event:"agent",payload:Y(n,e,r),seq:n.seq,id:`agent-evt-${n.runId}-${n.seq}`})}function l(n){n?.heartbeatTimer&&(clearInterval(n.heartbeatTimer),n.heartbeatTimer=null)}function d(n){if(!n.currentRunId||!n.currentRunPhase)return;const r=n.heartbeatSeq++;t.client.sendAgentEvent({type:"event",event:"agent",payload:{state:"heartbeat",sessionId:e,runId:n.currentRunId,seq:r,runPhase:n.currentRunPhase},seq:r,id:`agent-heartbeat-${n.currentRunId}-${r}-${Date.now()}`})}function I(n){!n||n.heartbeatTimer||(n.heartbeatTimer=setInterval(()=>{d(n)},X),n.heartbeatTimer.unref?.())}function w(n){const r=n?.pendingTextEvent;!n||!r||!r.text||(f({state:"delta",runId:r.runId,seq:r.seq,text:r.text,thinking:r.thinking||void 0}),n.pendingTextEvent=null)}s.on("agentEvent",n=>{const r=t.sessions.get(e),R=Z(n),T=n.state==="final"||n.state==="error"||n.state==="aborted";r&&(r.nextEventSeq=n.seq+1,T||(r.currentRunId=n.runId),!T&&R&&(r.currentRunPhase=R,I(r)),n.agentSessionId&&(r.agentSessionId=n.agentSessionId)),t.managerRuntime?.noteAgentEvent(e,n),n.state!=="delta"&&E({level:"info",sessionId:e,wsEvent:`agent.${n.state}`,wsDirection:"out",metadata:{runId:n.runId,seq:n.seq,agentType:a}}),n.state==="delta"&&n.text&&!n.thinking?A(e,{id:`agent-${n.runId}-${n.seq}`,sessionId:e,role:"agent",ts:Date.now(),payload:n.text}):n.state==="tool-call"||n.state==="tool-result"?A(e,{id:`agent-${n.runId}-${n.seq}`,sessionId:e,role:"agent",ts:Date.now(),payload:JSON.stringify({v:1,type:n.state==="tool-call"?"tool_use":"tool_result",name:n.name,status:n.state==="tool-call"?"running":"completed",detailRef:{runId:n.runId,sourceSeq:n.seq},args:n.args,result:n.result})}):n.state==="approval-pending"?A(e,{id:`agent-${n.runId||"run"}-${n.seq}`,sessionId:e,role:"agent",ts:Date.now(),payload:j(n.approval)}):(n.state==="error"||n.state==="aborted")&&n.message&&A(e,{id:`agent-${n.runId||"run"}-${n.seq}`,sessionId:e,role:"agent",ts:Date.now(),payload:n.message});const m=`${e}:${n.runId}`;if(n.state==="delta"&&!n.thinking&&n.text&&t.runTextAcc.set(m,(t.runTextAcc.get(m)??"")+n.text),n.agentSessionId&&n.agentSessionId!==i&&(i=n.agentSessionId,t.nativeFusion?.noteManagedSourceSession(e,_(a,n.source),n.agentSessionId),r&&B({sessionId:e,agentType:a,workDir:r.workDir,agentSessionId:n.agentSessionId}),t.client.sendEvent({type:"event",event:"session.update",payload:{session:{id:e,agentType:a,agentSessionId:n.agentSessionId}}})),n.state==="delta"){const h=n.text??"";if(!h)return;const b=!!n.thinking;r?.pendingTextEvent&&(r.pendingTextEvent.runId!==n.runId||r.pendingTextEvent.thinking!==b)&&w(r),r&&!r.pendingTextEvent&&(r.pendingTextEvent={runId:n.runId,seq:n.seq,text:"",thinking:b}),r?.pendingTextEvent&&(r.pendingTextEvent.text+=h,r.pendingTextEvent.seq=n.seq);return}let p={};if(n.state==="final"){w(r);const h=t.runTextAcc.get(m)??"";h&&(p={messageSummary:V(h)}),t.runTextAcc.delete(m)}else n.state==="error"||n.state==="aborted"?(w(r),t.runTextAcc.delete(m)):(n.state==="tool-call"||n.state==="tool-result"||n.state==="approval-pending")&&w(r);T&&r?.currentRunId===n.runId&&(r.currentRunId=null,r.currentRunPhase=null,r.nextEventSeq=0,l(r),t.chatQueue?.noteTerminal(e)),f(n,p)}),s.on("error",n=>{console.error(`[chat.send] adapter error sessionId=${e} agentType=${a}: ${n.message}`),t.sessions.delete(e),t.chatQueue?.noteTerminal(e),t.client.sendEvent({type:"event",event:"agent",payload:{state:"error",sessionId:e,message:n.message,runId:"",seq:0}})})}function se(t,e){if(t.processedReqIds.add(e),t.processedReqIds.size>1e3){const a=t.processedReqIds.values().next().value;t.processedReqIds.delete(a)}}async function q(t){t.heartbeatTimer&&(clearInterval(t.heartbeatTimer),t.heartbeatTimer=null),t.adapter.removeAllListeners(),await t.adapter.stop().catch(()=>{})}async function oe(t,e,a,s,i,f,l){t.evictIdleSessions();const d=O(a);if(!d)throw new Error(`Unsupported agent: ${a}`);ne(d,e,a,f,l),await d.start(e,s,i);const I={adapter:d,workDir:s,agentType:a,agentSessionId:i??null,lastActiveAt:Date.now(),currentRunId:null,currentRunPhase:null,nextEventSeq:0,heartbeatSeq:0,heartbeatTimer:null,pendingTextEvent:null,externalChannel:f??null,externalReplyTarget:l??null,externalChannelEnv:{...W(a),...v(e,f,l)}};return t.sessions.set(e,I),re(t,e,a,d),I}function le(t,e){const a=t.sessions.get(e),s=a?.currentRunId;if(!a||!s)return;const i=a.nextEventSeq;t.runTextAcc.delete(`${e}:${s}`),a.pendingTextEvent=null,a.currentRunId=null,a.currentRunPhase=null,a.nextEventSeq=0,a.heartbeatTimer&&(clearInterval(a.heartbeatTimer),a.heartbeatTimer=null),t.client.sendAgentEvent({type:"event",event:"agent",payload:{state:"aborted",sessionId:e,runId:s,seq:i},seq:i,id:`agent-evt-${s}-${i}`}),t.chatQueue?.noteTerminal(e)}async function xe(t,e){if(t.processedReqIds.has(e.id)){t.client.sendRes({type:"res",id:e.id,ok:!0});return}se(t,e.id);const{sessionId:a,text:s,agentType:i,workDir:f,agentSessionId:l,modelId:d,managerDefaultWorkerAgentType:I,managerDefaultWorkerModelId:w,reasoningEffort:n,clientMessageId:r,sessionListProjection:R,waitForDispatch:T,responseId:m}=e.params,p=m||e.id;G(R);const h=null,b="";if(!a||!s){t.processedReqIds.delete(e.id),t.client.sendRes({type:"res",id:p,ok:!1,error:"sessionId and text are required"});return}const u=i;u==="manager"&&t.managerRuntime?.setManagerWorkerDefaults(a,I??null,w??null);const y=(u==="claude"||u==="codex"||u==="workbuddy")&&typeof n=="string"&&n.trim()?n.trim():void 0,S=t.resolvePath(ae(u,f||z.homedir(),l)||z.homedir()),$=S,D=K(e.params.attachments),g=D?.length?await Q({text:s,attachments:D,workDir:S}):{text:s,attachments:D,localized:!1};let o=t.sessions.get(a);if(o){if(o.lastActiveAt=Date.now(),o.agentType!==u||o.workDir!==S||JSON.stringify(o.externalChannel??null)!==JSON.stringify(h??null)){t.sessions.delete(a);try{await q(o)}catch{t.processedReqIds.delete(e.id)}o=void 0}else if(l&&o.agentSessionId!==l)try{await o.adapter.resume(l),o.agentSessionId=l}catch{t.sessions.delete(a);try{await q(o)}catch{t.processedReqIds.delete(e.id)}o=void 0}}if(!o)try{o=await oe(t,a,u,S,l,h,b)}catch(c){const x=c instanceof Error&&c.message.startsWith("Unsupported agent:")?c.message:`Failed to start ${i}: ${c instanceof Error?c.message:String(c)}`;console.error(`[chat.send] start failed reqId=${e.id} sessionId=${a} agentType=${i} workDir=${S} agentSessionId=${l??""}: ${x}`),t.client.sendEvent({type:"event",event:"agent",payload:{state:"error",sessionId:a,message:x,runId:"",seq:0}}),t.processedReqIds.delete(e.id),t.client.sendRes({type:"res",id:p,ok:!1,error:x});return}const P={id:r??`user-${e.id}`,sessionId:a,role:"user",ts:Date.now(),payload:H(g.text,g.attachments)};E({level:"info",sessionId:a,wsEvent:"chat.send.start",metadata:{reqId:e.id,agentType:u,modelId:d,reasoningEffort:y}});const C=()=>{te(t,{sessionId:a,agentType:u,workDir:$,agentSessionId:o.agentSessionId??l??null,modelId:d}),o.currentRunId||(o.nextEventSeq=0),t.nativeFusion?.registerManagedSend({sessionId:a,agentType:u,sourceAgentType:_(u,d),canonicalMessageId:r??null,sourceSessionKey:o.agentSessionId??l??null,text:g.text}),A(a,P),L(t,P,{agentType:u,workDir:$,agentSessionId:o.agentSessionId??l??null,modelId:d})},M=async(c,x)=>{const k=ee(u,c);console.error(`[chat.send] send failed reqId=${e.id} sessionId=${a} agentType=${i} workDir=${S} agentSessionId=${o.agentSessionId??l??""}: ${k}`),t.sessions.delete(a);try{await q(o)}catch{}if(t.client.sendEvent({type:"event",event:"agent",payload:{state:"error",sessionId:a,message:k,runId:"",seq:0}}),!x){const N={id:`agent-error-${e.id}-${Date.now()}`,sessionId:a,role:"agent",ts:Date.now(),payload:k};A(a,N),L(t,N,{agentType:u,workDir:$,agentSessionId:o.agentSessionId??l??null,modelId:d})}x&&(t.processedReqIds.delete(e.id),t.client.sendRes({type:"res",id:p,ok:!1,error:k}))};if(T){try{const c=g.attachments;c?.length?await o.adapter.send(g.text,d,y,c):y?await o.adapter.send(g.text,d,y):await o.adapter.send(g.text,d),E({level:"info",sessionId:a,wsEvent:"chat.send.done",metadata:{reqId:e.id}})}catch(c){await M(c,!0);return}C(),t.client.sendRes({type:"res",id:p,ok:!0,...g.localized?{payload:{localizedAttachments:!0}}:{}}),E({level:"info",sessionId:a,wsEvent:"chat.send.res",metadata:{reqId:e.id,ok:!0}});return}C(),t.client.sendRes({type:"res",id:p,ok:!0,...g.localized?{payload:{localizedAttachments:!0}}:{}}),E({level:"info",sessionId:a,wsEvent:"chat.send.res",metadata:{reqId:e.id,ok:!0}});const F=g.attachments;(F?.length?o.adapter.send(g.text,d,y,F):y?o.adapter.send(g.text,d,y):o.adapter.send(g.text,d)).then(()=>{E({level:"info",sessionId:a,wsEvent:"chat.send.done",metadata:{reqId:e.id}})}).catch(c=>{M(c,!1)})}async function Ee(t,e){const{sessionId:a}=e.params,s=t.sessions.get(a);if(s){try{await s.adapter.stop()}catch{}le(t,a),t.activityPublisher?.publish(a,null)}t.client.sendRes({type:"res",id:e.id,ok:!0})}export{Ee as handleChatAbort,xe as handleChatSend};
|
|
1
|
+
import N from"node:os";import{createAgent as H}from"../../agents/adapter.js";import{buildApprovalPendingPayload as U,buildUserMessagePayload as G}from"@shennian/wire";import{reportLog as w}from"../../log-reporter.js";import{lookupClaudeTranscriptCwd as J}from"../../native-fusion/parsers.js";import{appendMessage as A,recordSession as z}from"../store.js";import{mergeProjectedSessions as Q}from"../projection.js";import{buildManagedAgentEnv as K}from"../../agents/config-status.js";import{materializeRemoteChatAttachments as V}from"../remote-attachments.js";function Y(t){if(!Array.isArray(t))return;const e=t.map(a=>{if(!a||typeof a!="object")return null;const s=a,o=typeof s.path=="string"?s.path:"",u=typeof s.name=="string"?s.name:"",i=typeof s.mimeType=="string"?s.mimeType:"";if(!o||!u||!i)return null;const d=typeof s.previewData=="string"&&s.previewData.trim()?s.previewData.trim():void 0;return{path:o,name:u,mimeType:i,kind:i.startsWith("image/")?"image":"file",...d?{previewData:d}:{}}}).filter(a=>a!=null);return e.length?e:void 0}function X(t){const e=t.indexOf(`
|
|
2
|
+
`),a=e>0?Math.min(e,80):Math.min(t.length,80);return t.slice(0,a)}function Z(t,e,a={}){if(t.state==="tool-call"||t.state==="tool-result"){const s={runId:t.runId,sourceSeq:t.seq};return{state:t.state,runId:t.runId,seq:t.seq,sessionId:e,detailRef:s,...t.name?{name:t.name}:{},...t.source?{source:t.source}:{},...t.agentSessionId?{agentSessionId:t.agentSessionId}:{},...a}}return{...t,sessionId:e,...a}}const ee=3e4;function te(t){return t.state==="heartbeat"?t.runPhase??null:t.state==="tool-call"||t.state==="tool-result"?"tool_running":t.state==="approval-pending"?"waiting_approval":t.state==="delta"?t.thinking?"thinking":"streaming_text":t.state==="init"||t.state==="start"?"thinking":null}function ne(t,e){return`Agent send failed: ${e instanceof Error?e.message:String(e)}`}function B(t,e){return t!=="manager"?t:e==="claude"?"claude":"codex"}function _(t,e,a){t.client.sendEvent({type:"event",event:"session.message",payload:{sessionId:e.sessionId,message:e,session:{id:e.sessionId,agentType:a.agentType,agentSessionId:a.agentSessionId??null,modelId:a.modelId??null,workDir:a.workDir,status:"active",externalChannel:null}}})}function ae(t,e){z({sessionId:e.sessionId,agentType:e.agentType,workDir:e.workDir,agentSessionId:e.agentSessionId??null,modelId:e.modelId??null}),t.client.sendEvent({type:"event",event:"session.update",payload:{session:{id:e.sessionId,agentType:e.agentType,agentSessionId:e.agentSessionId??null,modelId:e.modelId??null,workDir:e.workDir,status:"active",externalChannel:null}}})}function we(t){if(!t||typeof t!="object")return null;const e=t;return{configured:e.configured===void 0?void 0:!!e.configured,connected:!!e.connected,type:typeof e.type=="string"?e.type:null,channelId:typeof e.channelId=="string"?e.channelId:null,name:typeof e.name=="string"?e.name:null,canReply:e.canReply===void 0||e.canReply===null?null:!!e.canReply,systemPrompt:typeof e.systemPrompt=="string"?e.systemPrompt:null,wechatRpaSource:typeof e.wechatRpaSource=="string"?e.wechatRpaSource:null,wechatRpaGroups:Array.isArray(e.wechatRpaGroups)?e.wechatRpaGroups.map(a=>({name:String(a?.name||"").trim()})).filter(a=>a.name):null,pollIntervalMs:Number.isFinite(e.pollIntervalMs)?Number(e.pollIntervalMs):null,recentLimit:Number.isFinite(e.recentLimit)?Number(e.recentLimit):null,idleSeconds:Number.isFinite(e.idleSeconds)?Number(e.idleSeconds):null,forceForeground:e.forceForeground===void 0||e.forceForeground===null?null:!!e.forceForeground,noRestore:e.noRestore===void 0||e.noRestore===null?null:!!e.noRestore,downloadAttachments:e.downloadAttachments===void 0||e.downloadAttachments===null?null:!!e.downloadAttachments,downloadAttachmentsDir:typeof e.downloadAttachmentsDir=="string"?e.downloadAttachmentsDir:null}}function Ae(t){return!!(t?.configured??t?.connected)}function L(t){return K(t)}function W(t,e,a){return{}}function re(t,e,a,s,o){t.configure?.({sessionId:e,externalChannel:s??null,env:{...L(a),...W(e,s,o)}})}function Te(t,e,a){return null}function se(t,e,a){if(t!=="claude"||!a)return e;const s=e.trim();return!!s&&s.startsWith("-")&&!s.includes("/")?J(a)??e:e}function oe(t,e,a,s){let o=null;function u(n,r={}){t.client.sendAgentEvent({type:"event",event:"agent",payload:Z(n,e,r),seq:n.seq,id:`agent-evt-${n.runId}-${n.seq}`})}function i(n){n?.heartbeatTimer&&(clearInterval(n.heartbeatTimer),n.heartbeatTimer=null)}function d(n){if(!n.currentRunId||!n.currentRunPhase)return;const r=n.heartbeatSeq++;t.client.sendAgentEvent({type:"event",event:"agent",payload:{state:"heartbeat",sessionId:e,runId:n.currentRunId,seq:r,runPhase:n.currentRunPhase},seq:r,id:`agent-heartbeat-${n.currentRunId}-${r}-${Date.now()}`})}function h(n){!n||n.heartbeatTimer||(n.heartbeatTimer=setInterval(()=>{d(n)},ee),n.heartbeatTimer.unref?.())}function y(n){const r=n?.pendingTextEvent;!n||!r||!r.text||(u({state:"delta",runId:r.runId,seq:r.seq,text:r.text,thinking:r.thinking||void 0}),n.pendingTextEvent=null)}s.on("agentEvent",n=>{const r=t.sessions.get(e),T=te(n),E=n.state==="final"||n.state==="error"||n.state==="aborted";r&&(r.nextEventSeq=n.seq+1,E||(r.currentRunId=n.runId),!E&&T&&(r.currentRunPhase=T,h(r)),n.agentSessionId&&(r.agentSessionId=n.agentSessionId)),t.managerRuntime?.noteAgentEvent(e,n),n.state!=="delta"&&w({level:"info",sessionId:e,wsEvent:`agent.${n.state}`,wsDirection:"out",metadata:{runId:n.runId,seq:n.seq,agentType:a}}),n.state==="delta"&&n.text&&!n.thinking?A(e,{id:`agent-${n.runId}-${n.seq}`,sessionId:e,role:"agent",ts:Date.now(),payload:n.text}):n.state==="tool-call"||n.state==="tool-result"?A(e,{id:`agent-${n.runId}-${n.seq}`,sessionId:e,role:"agent",ts:Date.now(),payload:JSON.stringify({v:1,type:n.state==="tool-call"?"tool_use":"tool_result",name:n.name,status:n.state==="tool-call"?"running":"completed",detailRef:{runId:n.runId,sourceSeq:n.seq},args:n.args,result:n.result})}):n.state==="approval-pending"?A(e,{id:`agent-${n.runId||"run"}-${n.seq}`,sessionId:e,role:"agent",ts:Date.now(),payload:U(n.approval)}):(n.state==="error"||n.state==="aborted")&&n.message&&A(e,{id:`agent-${n.runId||"run"}-${n.seq}`,sessionId:e,role:"agent",ts:Date.now(),payload:n.message});const m=`${e}:${n.runId}`;if(n.state==="delta"&&!n.thinking&&n.text&&t.runTextAcc.set(m,(t.runTextAcc.get(m)??"")+n.text),n.agentSessionId&&n.agentSessionId!==o&&(o=n.agentSessionId,t.nativeFusion?.noteManagedSourceSession(e,B(a,n.source),n.agentSessionId),r&&z({sessionId:e,agentType:a,workDir:r.workDir,agentSessionId:n.agentSessionId}),t.client.sendEvent({type:"event",event:"session.update",payload:{session:{id:e,agentType:a,agentSessionId:n.agentSessionId}}})),n.state==="delta"){const f=n.text??"";if(!f)return;const R=!!n.thinking;r?.pendingTextEvent&&(r.pendingTextEvent.runId!==n.runId||r.pendingTextEvent.thinking!==R)&&y(r),r&&!r.pendingTextEvent&&(r.pendingTextEvent={runId:n.runId,seq:n.seq,text:"",thinking:R}),r?.pendingTextEvent&&(r.pendingTextEvent.text+=f,r.pendingTextEvent.seq=n.seq);return}let x={};if(n.state==="final"){y(r);const f=t.runTextAcc.get(m)??"";f&&(x={messageSummary:X(f)}),t.runTextAcc.delete(m)}else n.state==="error"||n.state==="aborted"?(y(r),t.runTextAcc.delete(m)):(n.state==="tool-call"||n.state==="tool-result"||n.state==="approval-pending")&&y(r);E&&r?.currentRunId===n.runId&&(r.currentRunId=null,r.currentRunPhase=null,r.nextEventSeq=0,i(r),t.chatQueue?.noteTerminal(e)),u(n,x)}),s.on("error",n=>{console.error(`[chat.send] adapter error sessionId=${e} agentType=${a}: ${n.message}`),t.sessions.delete(e),t.chatQueue?.noteTerminal(e),t.client.sendEvent({type:"event",event:"agent",payload:{state:"error",sessionId:e,message:n.message,runId:"",seq:0}})})}function le(t,e){if(t.processedReqIds.add(e),t.processedReqIds.size>1e3){const a=t.processedReqIds.values().next().value;t.processedReqIds.delete(a)}}async function q(t){t.heartbeatTimer&&(clearInterval(t.heartbeatTimer),t.heartbeatTimer=null),t.adapter.removeAllListeners(),await t.adapter.stop().catch(()=>{})}function v(t,e,a,s,o,u){return u?.trim()?t.send(e,a,s,o,u):o?.length?t.send(e,a,s,o):s?t.send(e,a,s):t.send(e,a)}async function ie(t,e,a,s,o,u,i){t.evictIdleSessions();const d=H(a);if(!d)throw new Error(`Unsupported agent: ${a}`);re(d,e,a,u,i),await d.start(e,s,o);const h={adapter:d,workDir:s,agentType:a,agentSessionId:o??null,lastActiveAt:Date.now(),currentRunId:null,currentRunPhase:null,nextEventSeq:0,heartbeatSeq:0,heartbeatTimer:null,pendingTextEvent:null,externalChannel:u??null,externalReplyTarget:i??null,externalChannelEnv:{...L(a),...W(e,u,i)}};return t.sessions.set(e,h),oe(t,e,a,d),h}function de(t,e){const a=t.sessions.get(e),s=a?.currentRunId;if(!a||!s)return;const o=a.nextEventSeq;t.runTextAcc.delete(`${e}:${s}`),a.pendingTextEvent=null,a.currentRunId=null,a.currentRunPhase=null,a.nextEventSeq=0,a.heartbeatTimer&&(clearInterval(a.heartbeatTimer),a.heartbeatTimer=null),t.client.sendAgentEvent({type:"event",event:"agent",payload:{state:"aborted",sessionId:e,runId:s,seq:o},seq:o,id:`agent-evt-${s}-${o}`}),t.chatQueue?.noteTerminal(e)}async function Ee(t,e){if(t.processedReqIds.has(e.id)){t.client.sendRes({type:"res",id:e.id,ok:!0});return}le(t,e.id);const{sessionId:a,text:s,agentType:o,workDir:u,agentSessionId:i,modelId:d,systemPrompt:h,managerDefaultWorkerAgentType:y,managerDefaultWorkerModelId:n,reasoningEffort:r,clientMessageId:T,sessionListProjection:E,waitForDispatch:m,responseId:x}=e.params,f=x||e.id;Q(E);const R=null,O="";if(!a||!s){t.processedReqIds.delete(e.id),t.client.sendRes({type:"res",id:f,ok:!1,error:"sessionId and text are required"});return}const g=o;g==="manager"&&t.managerRuntime?.setManagerWorkerDefaults(a,y??null,n??null);const k=(g==="claude"||g==="codex"||g==="workbuddy")&&typeof r=="string"&&r.trim()?r.trim():void 0,I=t.resolvePath(se(g,u||N.homedir(),i)||N.homedir()),$=I,D=Y(e.params.attachments),p=D?.length?await V({text:s,attachments:D,workDir:I}):{text:s,attachments:D,localized:!1};let l=t.sessions.get(a);if(l){if(l.lastActiveAt=Date.now(),l.agentType!==g||l.workDir!==I||JSON.stringify(l.externalChannel??null)!==JSON.stringify(R??null)){t.sessions.delete(a);try{await q(l)}catch{t.processedReqIds.delete(e.id)}l=void 0}else if(i&&l.agentSessionId!==i)try{await l.adapter.resume(i),l.agentSessionId=i}catch{t.sessions.delete(a);try{await q(l)}catch{t.processedReqIds.delete(e.id)}l=void 0}}if(!l)try{l=await ie(t,a,g,I,i,R,O)}catch(c){const S=c instanceof Error&&c.message.startsWith("Unsupported agent:")?c.message:`Failed to start ${o}: ${c instanceof Error?c.message:String(c)}`;console.error(`[chat.send] start failed reqId=${e.id} sessionId=${a} agentType=${o} workDir=${I} agentSessionId=${i??""}: ${S}`),t.client.sendEvent({type:"event",event:"agent",payload:{state:"error",sessionId:a,message:S,runId:"",seq:0}}),t.processedReqIds.delete(e.id),t.client.sendRes({type:"res",id:f,ok:!1,error:S});return}const P={id:T??`user-${e.id}`,sessionId:a,role:"user",ts:Date.now(),payload:G(p.text,p.attachments)};w({level:"info",sessionId:a,wsEvent:"chat.send.start",metadata:{reqId:e.id,agentType:g,modelId:d,reasoningEffort:k}});const C=()=>{ae(t,{sessionId:a,agentType:g,workDir:$,agentSessionId:l.agentSessionId??i??null,modelId:d}),l.currentRunId||(l.nextEventSeq=0),t.nativeFusion?.registerManagedSend({sessionId:a,agentType:g,sourceAgentType:B(g,d),canonicalMessageId:T??null,sourceSessionKey:l.agentSessionId??i??null,text:p.text}),A(a,P),_(t,P,{agentType:g,workDir:$,agentSessionId:l.agentSessionId??i??null,modelId:d})},M=async(c,S)=>{const b=ne(g,c);console.error(`[chat.send] send failed reqId=${e.id} sessionId=${a} agentType=${o} workDir=${I} agentSessionId=${l.agentSessionId??i??""}: ${b}`),t.sessions.delete(a);try{await q(l)}catch{}if(t.client.sendEvent({type:"event",event:"agent",payload:{state:"error",sessionId:a,message:b,runId:"",seq:0}}),!S){const F={id:`agent-error-${e.id}-${Date.now()}`,sessionId:a,role:"agent",ts:Date.now(),payload:b};A(a,F),_(t,F,{agentType:g,workDir:$,agentSessionId:l.agentSessionId??i??null,modelId:d})}S&&(t.processedReqIds.delete(e.id),t.client.sendRes({type:"res",id:f,ok:!1,error:b}))};if(m){try{const c=p.attachments;await v(l.adapter,p.text,d,k,c,h),w({level:"info",sessionId:a,wsEvent:"chat.send.done",metadata:{reqId:e.id}})}catch(c){await M(c,!0);return}C(),t.client.sendRes({type:"res",id:f,ok:!0,...p.localized?{payload:{localizedAttachments:!0}}:{}}),w({level:"info",sessionId:a,wsEvent:"chat.send.res",metadata:{reqId:e.id,ok:!0}});return}C(),t.client.sendRes({type:"res",id:f,ok:!0,...p.localized?{payload:{localizedAttachments:!0}}:{}}),w({level:"info",sessionId:a,wsEvent:"chat.send.res",metadata:{reqId:e.id,ok:!0}});const j=p.attachments;v(l.adapter,p.text,d,k,j,h).then(()=>{w({level:"info",sessionId:a,wsEvent:"chat.send.done",metadata:{reqId:e.id}})}).catch(c=>{M(c,!1)})}async function Re(t,e){const{sessionId:a}=e.params,s=t.sessions.get(a);if(s){try{await s.adapter.stop()}catch{}de(t,a),t.activityPublisher?.publish(a,null)}t.client.sendRes({type:"res",id:e.id,ok:!0})}export{Re as handleChatAbort,Ee as handleChatSend};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ReqFrame } from '@shennian/wire';
|
|
2
|
+
import type { ManagedRoomBinder } from '../../room/managed-room-binding.js';
|
|
3
|
+
import type { SessionManagerRuntime } from '../types.js';
|
|
4
|
+
export declare function handleManagedRoomBind(runtime: SessionManagerRuntime, binder: ManagedRoomBinder | null, req: ReqFrame): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const m=/^[A-Za-z0-9_.:@/-]{1,191}$/,c=new Set(["roomId","agentIdentityId","nianSessionId","assignmentIntentId"]);async function p(n,e,t){if(!e)throw new Error("Managed Room binding is unavailable.");if(Object.keys(t.params).some(g=>!c.has(g)))throw new Error("Managed Room binding contains unsupported parameters.");const i=o(t.params.roomId,"roomId"),d=o(t.params.agentIdentityId,"agentIdentityId"),a=o(t.params.nianSessionId,"nianSessionId"),r=o(t.params.assignmentIntentId,"assignmentIntentId"),s=n.sessions.get(a);if(!s?.agentSessionId)throw new Error("The exact native Agent session is not ready for Room binding.");const I=await e.bind({roomId:i,agentIdentityId:d,nianSessionId:a,assignmentIntentId:r,agentSessionId:s.agentSessionId,workDir:s.workDir,agentType:s.agentType});n.client.sendRes({type:"res",id:t.id,ok:!0,payload:I})}function o(n,e){if(typeof n!="string"||!m.test(n))throw new Error(`Invalid ${e}.`);return n}export{p as handleManagedRoomBind};
|
|
@@ -10,12 +10,14 @@ import '../agents/gemini.js';
|
|
|
10
10
|
import '../agents/cursor.js';
|
|
11
11
|
import '../agents/opencode.js';
|
|
12
12
|
import '../agents/manager.js';
|
|
13
|
+
import type { ManagedRoomBinder } from '../room/managed-room-binding.js';
|
|
13
14
|
export { resolveSessionWorkDir } from '../fs/boundary.js';
|
|
14
15
|
export declare class SessionManager {
|
|
15
16
|
private client;
|
|
16
17
|
private nativeFusion;
|
|
17
18
|
private cliVersion?;
|
|
18
19
|
private upgradePolicyController;
|
|
20
|
+
private managedRoomBinder;
|
|
19
21
|
private sessions;
|
|
20
22
|
/** Track processed request IDs to deduplicate replayed offline messages */
|
|
21
23
|
private processedReqIds;
|
|
@@ -27,7 +29,7 @@ export declare class SessionManager {
|
|
|
27
29
|
private chatQueue;
|
|
28
30
|
private activityProbeTimer;
|
|
29
31
|
private activeRequests;
|
|
30
|
-
constructor(client: CliRelayClient, nativeFusion?: NativeSessionFusionService | null, cliVersion?: string | undefined, upgradePolicyController?: UpgradePolicyController | null);
|
|
32
|
+
constructor(client: CliRelayClient, nativeFusion?: NativeSessionFusionService | null, cliVersion?: string | undefined, upgradePolicyController?: UpgradePolicyController | null, managedRoomBinder?: ManagedRoomBinder | null);
|
|
31
33
|
private getRuntime;
|
|
32
34
|
getUpgradeIdleState(): UpgradeIdleState;
|
|
33
35
|
activateRoomSession(input: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getRegisteredAgents as
|
|
1
|
+
import{getRegisteredAgents as c,unregisterAgent as h}from"../agents/adapter.js";import{loadConfig as l}from"../config/index.js";import{handleUpgradeStart as d,handleUpgradeStatus as u}from"../commands/upgrade.js";import{handleAgentsRefresh as m,handleModelsRefresh as p}from"./handlers/agents.js";import{handleAgentCapabilitiesList as f}from"./handlers/agent-capabilities.js";import{handleAgentConfigClear as g,handleAgentConfigGet as b,handleAgentConfigTest as w,handleAgentConfigUpsert as v}from"./handlers/agent-config.js";import{handleChatAbort as k,handleChatSend as r}from"./handlers/chat.js";import{handleSessionRefresh as R}from"./handlers/session-refresh.js";import{handleSessionToolDetail as S}from"./handlers/tool-detail.js";import{handleSessionTitleSet as y}from"./handlers/title.js";import{cleanupPendingTransfers as A,handleFsLs as T,handleFsRead as P,handleFsRename as I,handleFsWrite as C,handleFsTransfer as F,handleFsTransferAbort as M,handleFsTransferChunk as x,handleFsTransferFinish as Q,handleFsTransferStart as z,handleFsExportMarkdownPdf as D,handleFsExportMarkdownPdfSetup as E,handleFsArchiveZip as U}from"./handlers/fs.js";import{handleRegionProbe as V,handleRegionSwitch as B,handleUpgradeSetPolicy as O}from"./handlers/control.js";import{ManagerRuntimeService as W,setManagerRuntimeService as o}from"../manager/runtime.js";import{ChatQueueManager as _}from"./queue.js";import{createAuthorizedFsRoot as j,resolveAuthorizedPath as L,resolveSessionWorkDir as $}from"../fs/boundary.js";import"../agents/claude.js";import"../agents/codex.js";import"../agents/workbuddy.js";import"../agents/gemini.js";import"../agents/cursor.js";import"../agents/opencode.js";import"../agents/manager.js";import{registerCustomAgent as G}from"../agents/custom.js";import{handleManagedRoomBind as N}from"./handlers/room-managed.js";const X=50;import{resolveSessionWorkDir as Se}from"../fs/boundary.js";class ve{client;nativeFusion;cliVersion;upgradePolicyController;managedRoomBinder;sessions=new Map;processedReqIds=new Set;runTextAcc=new Map;pendingTransfers=new Map;managerRuntime;chatQueue;activityProbeTimer=null;activeRequests=0;constructor(e,t=null,s,i=null,a=null){this.client=e,this.nativeFusion=t,this.cliVersion=s,this.upgradePolicyController=i,this.managedRoomBinder=a,this.managerRuntime=new W({getRuntime:()=>this.getRuntime(),dispatchReq:n=>this.handleReq(n)}),this.chatQueue=new _({getRuntime:()=>this.getRuntime(),dispatchReq:n=>this.handleReq(n)}),o(this.managerRuntime),this.managerRuntime.start(),this.reloadCustomAgents(),this.activityProbeTimer=setInterval(()=>{this.publishManagedActivitySnapshots().catch(n=>{console.error("[session.activity] managed probe failed",n)})},15e3),this.activityProbeTimer.unref?.()}getRuntime(){return{client:this.client,pendingTransfers:this.pendingTransfers,processedReqIds:this.processedReqIds,reloadCustomAgents:()=>this.reloadCustomAgents(),resolvePath:e=>this.resolvePath(e),resolveAuthorizedPath:(e,t)=>this.resolveAuthorizedPath(e,t),runTextAcc:this.runTextAcc,sessions:this.sessions,evictIdleSessions:()=>this.evictIdleSessions(),nativeFusion:this.nativeFusion,managerRuntime:this.managerRuntime,chatQueue:this.chatQueue,activityPublisher:{publish:(e,t)=>this.publishSessionActivity(e,t)},upgradePolicyController:this.upgradePolicyController}}getUpgradeIdleState(){const e=[];return[...this.sessions.values()].some(t=>t.currentRunId!==null)&&e.push("active-agent-turn"),this.pendingTransfers.size>0&&e.push("file-transfer"),this.activeRequests>0&&e.push("active-daemon-request"),{idle:e.length===0,reasons:e}}async activateRoomSession(e){const t=new Proxy(this.client,{get:(s,i)=>{if(i==="sendRes")return()=>{};const a=Reflect.get(s,i,s);return typeof a=="function"?a.bind(s):a}});await r({...this.getRuntime(),client:t},{type:"req",id:e.clientMessageId,method:"chat.send",params:{...e,waitForDispatch:!0}})}publishSessionActivity(e,t){this.client.sendEvent({type:"event",event:"session.activity",payload:{sessionId:e,activity:t}})}async publishManagedActivitySnapshots(){for(const[e,t]of this.sessions.entries()){if(!t.currentRunId||!t.adapter.getStatus)continue;const s=await t.adapter.getStatus().catch(()=>null);if(!s?.active||!s.runPhase)continue;const i=new Date().toISOString();this.publishSessionActivity(e,{sessionId:e,runId:s.runId||t.currentRunId,runPhase:s.runPhase,startedAt:new Date(t.lastActiveAt).toISOString(),updatedAt:i,canStop:s.canStop??!0});const a=t.heartbeatSeq++;this.client.sendAgentEvent({type:"event",event:"agent",payload:{state:"heartbeat",sessionId:e,runId:s.runId||t.currentRunId,seq:a,runPhase:s.runPhase,canStop:s.canStop??!0},seq:a,id:`agent-status-${s.runId||t.currentRunId}-${Date.now()}`})}}reloadCustomAgents(){for(const t of c())t.startsWith("custom:")&&h(t);const e=l();for(const[t,s]of Object.entries(e.customAgents??{}))G(t,s)}async handleReq(e){const t=this.getRuntime();this.activeRequests++;try{switch(e.method){case"chat.send":await r(t,e);break;case"chat.enqueue":await this.chatQueue.handleEnqueue(e);break;case"chat.queue.get":await this.chatQueue.handleGet(e);break;case"chat.queue.edit":await this.chatQueue.handleEdit(e);break;case"chat.queue.delete":await this.chatQueue.handleDelete(e);break;case"chat.abort":await k(t,e);break;case"session.refresh":await R(t,e);break;case"session.tool.detail":await S(t,e);break;case"session.title.set":await y(t,e);break;case"room.agent.bind-managed":await N(t,this.managedRoomBinder,e);break;case"fs.ls":await T(t,e);break;case"fs.read":await P(t,e);break;case"fs.write":await C(t,e);break;case"fs.export.markdown-pdf":await D(t,e);break;case"fs.export.markdown-pdf.setup":await E(t,e);break;case"fs.archive.zip":await U(t,e);break;case"fs.rename":await I(t,e);break;case"fs.transfer":await F(t,e);break;case"fs.transfer.start":await z(t,e);break;case"fs.transfer.chunk":await x(t,e);break;case"fs.transfer.finish":await Q(t,e);break;case"fs.transfer.abort":await M(t,e);break;case"region.probe":await V(t,e);break;case"region.switch":await B(t,e);break;case"upgrade.start":await d(this.client,e.id,e.params.version,{currentVersion:this.cliVersion,confirmedMajor:e.params.confirmedMajor===!0});break;case"upgrade.status":await u(this.client,e.id,{currentVersion:this.cliVersion});break;case"upgrade.set-policy":await O(t,e);break;case"agents.refresh":await m(t,e);break;case"models.refresh":await p(t,e);break;case"agent.config.get":await b(t,e);break;case"agent.config.upsert":await v(t,e);break;case"agent.config.clear":await g(t,e);break;case"agent.config.test":await w(t,e);break;case"agent.capabilities.list":await f(t,e);break;case"skill.list":case"skill.install":case"skill.doctor":case"skill.setup":case"skill.use":this.client.sendRes({type:"res",id:e.id,ok:!1,error:"feature_retired"});break;case"session.wechat-rpa.channel.get":case"session.wechat-rpa.channel.upsert":case"session.wechat-rpa.channel.sync":case"manager.wechat-rpa.channel.get":case"manager.wechat-rpa.channel.upsert":case"manager.wechat-rpa.channel.sync":this.client.sendRes({type:"res",id:e.id,ok:!1,error:"feature_retired"});break;default:this.client.sendRes({type:"res",id:e.id,ok:!1,error:`Unknown method: ${e.method}`})}}catch(s){this.client.sendRes({type:"res",id:e.id,ok:!1,error:s instanceof Error?s.message:String(s)})}finally{this.activeRequests--}}evictIdleSessions(){if(this.sessions.size<X)return;let e=null;for(const[t,s]of this.sessions)(!e||s.lastActiveAt<e.session.lastActiveAt)&&(e={key:t,session:s});e&&(e.session.heartbeatTimer&&(clearInterval(e.session.heartbeatTimer),e.session.heartbeatTimer=null),e.session.adapter.removeAllListeners(),e.session.adapter.stop().catch(()=>{}),this.sessions.delete(e.key))}resolvePath(e){return $(e)}resolveAuthorizedPath(e,t){return L(e,j(t))}async cleanup(){this.activityProbeTimer&&(clearInterval(this.activityProbeTimer),this.activityProbeTimer=null);for(const[,e]of this.sessions)e.heartbeatTimer&&(clearInterval(e.heartbeatTimer),e.heartbeatTimer=null),await e.adapter.stop().catch(()=>{});this.sessions.clear(),this.runTextAcc.clear(),A(this.getRuntime()),await this.managerRuntime.stop(),o(null)}}export{ve as SessionManager,Se as resolveSessionWorkDir};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import h from"node:fs";import{randomUUID as y}from"node:crypto";import{resolveShennianPath as I}from"../config/index.js";import{mergeProjectedSessions as w}from"./projection.js";import{materializeRemoteChatAttachments as S}from"./remote-attachments.js";const x=I("chat-queue.json");function M(){return{sessions:{}}}function p(){return new Date().toISOString()}function R(n){return`enqueue-send-${n}-${y()}`}function u(){try{const n=JSON.parse(h.readFileSync(x,"utf-8"));return{sessions:n.sessions&&typeof n.sessions=="object"?n.sessions:{}}}catch{return M()}}function d(n){h.mkdirSync(I(""),{recursive:!0}),h.writeFileSync(x,JSON.stringify(n,null,2))}function f(n){if(!Array.isArray(n))return;const e=n.map(s=>{if(!s||typeof s!="object")return null;const t=s,i={path:typeof t.path=="string"?t.path:"",name:typeof t.name=="string"?t.name:"",mimeType:typeof t.mimeType=="string"?t.mimeType:"",...typeof t.previewData=="string"&&t.previewData.trim()?{previewData:t.previewData.trim()}:{}};return i.path&&i.name&&i.mimeType?i:null}).filter(s=>s!=null);return e.length?e:void 0}function q(n){const e=p();return{id:n.queueMessageId||n.clientMessageId||`queue-${y()}`,sessionId:n.sessionId,text:n.text,agentType:n.agentType,workDir:n.workDir,agentSessionId:n.agentSessionId??null,modelId:n.modelId??null,reasoningEffort:n.reasoningEffort??null,clientMessageId:n.clientMessageId??null,attachments:f(n.attachments),externalChannel:n.externalChannel??null,replyTarget:n.replyTarget??null,origin:n.origin,createdAt:e,updatedAt:e}}class
|
|
1
|
+
import h from"node:fs";import{randomUUID as y}from"node:crypto";import{resolveShennianPath as I}from"../config/index.js";import{mergeProjectedSessions as w}from"./projection.js";import{materializeRemoteChatAttachments as S}from"./remote-attachments.js";const x=I("chat-queue.json");function M(){return{sessions:{}}}function p(){return new Date().toISOString()}function R(n){return`enqueue-send-${n}-${y()}`}function u(){try{const n=JSON.parse(h.readFileSync(x,"utf-8"));return{sessions:n.sessions&&typeof n.sessions=="object"?n.sessions:{}}}catch{return M()}}function d(n){h.mkdirSync(I(""),{recursive:!0}),h.writeFileSync(x,JSON.stringify(n,null,2))}function f(n){if(!Array.isArray(n))return;const e=n.map(s=>{if(!s||typeof s!="object")return null;const t=s,i={path:typeof t.path=="string"?t.path:"",name:typeof t.name=="string"?t.name:"",mimeType:typeof t.mimeType=="string"?t.mimeType:"",...typeof t.previewData=="string"&&t.previewData.trim()?{previewData:t.previewData.trim()}:{}};return i.path&&i.name&&i.mimeType?i:null}).filter(s=>s!=null);return e.length?e:void 0}function q(n){const e=p();return{id:n.queueMessageId||n.clientMessageId||`queue-${y()}`,sessionId:n.sessionId,text:n.text,agentType:n.agentType,workDir:n.workDir,agentSessionId:n.agentSessionId??null,modelId:n.modelId??null,systemPrompt:n.systemPrompt??null,reasoningEffort:n.reasoningEffort??null,clientMessageId:n.clientMessageId??null,attachments:f(n.attachments),externalChannel:n.externalChannel??null,replyTarget:n.replyTarget??null,origin:n.origin,createdAt:e,updatedAt:e}}class z{opts;draining=new Set;constructor(e){this.opts=e,setTimeout(()=>this.drainIdleQueues(),0).unref?.()}getSnapshot(e){return{sessionId:e,busy:!!this.opts.getRuntime().sessions.get(e)?.currentRunId,pending:u().sessions[e]??[]}}async handleEnqueue(e){const s=this.opts.getRuntime(),t=e.params;if(w(t.sessionListProjection),!t.sessionId||!t.text||!t.agentType||!t.workDir){s.client.sendRes({type:"res",id:e.id,ok:!1,error:"sessionId, text, agentType and workDir are required"});return}const i=f(t.attachments),r=i?.length?await S({text:t.text,attachments:i,workDir:t.workDir}):{text:t.text,attachments:i,localized:!1},a=await this.isSessionBusy(t.sessionId),o=u(),c=o.sessions[t.sessionId]??[];if(!a&&!c.length){await this.opts.dispatchReq({...e,id:R(e.id),method:"chat.send",params:{...t,text:r.text,responseId:e.id,clientMessageId:t.clientMessageId??t.queueMessageId,waitForDispatch:!0,attachments:r.attachments}});return}const l=q({...t,text:r.text,attachments:r.attachments}),m=t.origin==="external"?D(c,l):null;m||(o.sessions[t.sessionId]=[...c,l],d(o)),this.broadcast(t.sessionId),s.client.sendRes({type:"res",id:e.id,ok:!0,payload:{queued:!0,queueMessageId:m?.id??l.id,queue:this.getSnapshot(t.sessionId),...r.localized?{localizedAttachments:!0}:{}}}),a||this.drainNext(t.sessionId)}async handleGet(e){const s=this.opts.getRuntime(),t=e.params;if(!t.sessionId){s.client.sendRes({type:"res",id:e.id,ok:!1,error:"sessionId is required"});return}s.client.sendRes({type:"res",id:e.id,ok:!0,payload:{queue:this.getSnapshot(t.sessionId)}}),this.getSnapshot(t.sessionId).busy||this.drainNext(t.sessionId)}async handleEdit(e){const s=this.opts.getRuntime(),t=e.params;if(!t.sessionId||!t.queueMessageId||!t.text){s.client.sendRes({type:"res",id:e.id,ok:!1,error:"sessionId, queueMessageId and text are required"});return}const i=u(),r=i.sessions[t.sessionId]??[],a=r.findIndex(o=>o.id===t.queueMessageId);if(a<0){s.client.sendRes({type:"res",id:e.id,ok:!1,error:"Queued message not found"});return}r[a]={...r[a],text:t.text,attachments:f(t.attachments),updatedAt:p()},i.sessions[t.sessionId]=r,d(i),this.broadcast(t.sessionId),s.client.sendRes({type:"res",id:e.id,ok:!0,payload:{queue:this.getSnapshot(t.sessionId)}})}async handleDelete(e){const s=this.opts.getRuntime(),t=e.params;if(!t.sessionId||!t.queueMessageId){s.client.sendRes({type:"res",id:e.id,ok:!1,error:"sessionId and queueMessageId are required"});return}const i=u(),r=i.sessions[t.sessionId]??[],a=r.filter(o=>o.id!==t.queueMessageId);if(a.length===r.length){s.client.sendRes({type:"res",id:e.id,ok:!1,error:"Queued message not found"});return}a.length?i.sessions[t.sessionId]=a:delete i.sessions[t.sessionId],d(i),this.broadcast(t.sessionId),s.client.sendRes({type:"res",id:e.id,ok:!0,payload:{queue:this.getSnapshot(t.sessionId)}})}noteTerminal(e){this.drainNext(e)}drainIdleQueues(){const e=u();for(const s of Object.keys(e.sessions))this.drainNext(s)}async drainNext(e){if(this.draining.has(e))return;const s=this.opts.getRuntime();if(await this.isSessionBusy(e))return;const t=u(),i=t.sessions[e]??[],r=i.shift();if(!r){this.broadcast(e);return}const a=r.origin==="external"?this.mergeExternalMessages(r,i):r;i.length?t.sessions[e]=i:delete t.sessions[e],d(t),this.broadcast(e),this.draining.add(e);try{await this.dispatchQueuedMessage(a)}finally{this.draining.delete(e)}}mergeExternalMessages(e,s){const t=[e];for(;s[0]?.origin==="external";)t.push(s.shift());const i=k(t);return i.length===1?i[0]:{...e,id:`external-batch-${e.id}`,text:i.map(r=>r.text).filter(Boolean).join(`
|
|
2
2
|
|
|
3
|
-
`),attachments:b(i.flatMap(r=>r.attachments??[])),updatedAt:p()}}async dispatchQueuedMessage(e){await this.opts.dispatchReq({type:"req",id:`queue-send-${e.id}-${Date.now()}`,method:"chat.send",params:{sessionId:e.sessionId,text:e.text,agentType:e.agentType,workDir:e.workDir,agentSessionId:e.agentSessionId??null,modelId:e.modelId??void 0,reasoningEffort:e.reasoningEffort??void 0,clientMessageId:e.clientMessageId??e.id,attachments:e.attachments,externalChannel:e.externalChannel,replyTarget:e.replyTarget,waitForDispatch:!0}})}async isSessionBusy(e){const s=this.opts.getRuntime().sessions.get(e);if(!s)return!1;if(s.currentRunId)return!0;if(!s.adapter.getStatus)return!1;const t=await s.adapter.getStatus().catch(()=>null);return t?.active?(t.runId&&(s.currentRunId=t.runId,s.currentRunPhase=t.runPhase??s.currentRunPhase),!0):!1}broadcast(e){this.opts.getRuntime().client.sendEvent({type:"event",event:"session.queue.update",payload:{queue:this.getSnapshot(e)}})}}function k(n){const e=new Set,s=[];for(const t of n){const i=g(t);e.has(i)||(e.add(i),s.push(t))}return s}function D(n,e){const s=g(e);return n.find(t=>g(t)===s)??null}function g(n){const e=T(n);return e?`id:${e}`:["body",E(n.text),...(n.attachments??[]).map(s=>s.path||`${s.name}:${s.mimeType}`)].join(`
|
|
4
|
-
`)}function T(n){const e=typeof n.clientMessageId=="string"?n.clientMessageId.trim():"";if(e)return e;const s=typeof n.id=="string"?n.id.trim():"";return s&&!s.startsWith("queue-")?s:""}function b(n){const e=new Set,s=[];for(const t of n){const i=t.path||`${t.name}:${t.mimeType}`;e.has(i)||(e.add(i),s.push(t))}return s.length?s:void 0}function E(n){return String(n||"").replace(/\s+/g," ").trim()}export{
|
|
3
|
+
`),attachments:b(i.flatMap(r=>r.attachments??[])),updatedAt:p()}}async dispatchQueuedMessage(e){await this.opts.dispatchReq({type:"req",id:`queue-send-${e.id}-${Date.now()}`,method:"chat.send",params:{sessionId:e.sessionId,text:e.text,agentType:e.agentType,workDir:e.workDir,agentSessionId:e.agentSessionId??null,modelId:e.modelId??void 0,systemPrompt:e.systemPrompt??null,reasoningEffort:e.reasoningEffort??void 0,clientMessageId:e.clientMessageId??e.id,attachments:e.attachments,externalChannel:e.externalChannel,replyTarget:e.replyTarget,waitForDispatch:!0}})}async isSessionBusy(e){const s=this.opts.getRuntime().sessions.get(e);if(!s)return!1;if(s.currentRunId)return!0;if(!s.adapter.getStatus)return!1;const t=await s.adapter.getStatus().catch(()=>null);return t?.active?(t.runId&&(s.currentRunId=t.runId,s.currentRunPhase=t.runPhase??s.currentRunPhase),!0):!1}broadcast(e){this.opts.getRuntime().client.sendEvent({type:"event",event:"session.queue.update",payload:{queue:this.getSnapshot(e)}})}}function k(n){const e=new Set,s=[];for(const t of n){const i=g(t);e.has(i)||(e.add(i),s.push(t))}return s}function D(n,e){const s=g(e);return n.find(t=>g(t)===s)??null}function g(n){const e=T(n);return e?`id:${e}`:["body",E(n.text),...(n.attachments??[]).map(s=>s.path||`${s.name}:${s.mimeType}`)].join(`
|
|
4
|
+
`)}function T(n){const e=typeof n.clientMessageId=="string"?n.clientMessageId.trim():"";if(e)return e;const s=typeof n.id=="string"?n.id.trim():"";return s&&!s.startsWith("queue-")?s:""}function b(n){const e=new Set,s=[];for(const t of n){const i=t.path||`${t.name}:${t.mimeType}`;e.has(i)||(e.add(i),s.push(t))}return s.length?s:void 0}function E(n){return String(n||"").replace(/\s+/g," ").trim()}export{z as ChatQueueManager};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { AgentType } from './session.ts';
|
|
2
|
+
export type AgentWorkspaceRoomLink = {
|
|
3
|
+
bindingId: string;
|
|
4
|
+
status: string;
|
|
5
|
+
roomId: string;
|
|
6
|
+
roomName: string;
|
|
7
|
+
};
|
|
8
|
+
export type AgentWorkspaceSession = {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
status: string;
|
|
12
|
+
agentType: AgentType;
|
|
13
|
+
modelId: string | null;
|
|
14
|
+
machineId: string;
|
|
15
|
+
machineName: string | null;
|
|
16
|
+
workDir: string;
|
|
17
|
+
lastActivityAt: string;
|
|
18
|
+
room: AgentWorkspaceRoomLink | null;
|
|
19
|
+
};
|
|
20
|
+
export type AgentWorkspace = {
|
|
21
|
+
id: string;
|
|
22
|
+
displayName: string;
|
|
23
|
+
description: string;
|
|
24
|
+
systemPrompt: string;
|
|
25
|
+
avatar: {
|
|
26
|
+
version: string;
|
|
27
|
+
smallUrl: string;
|
|
28
|
+
mediumUrl: string;
|
|
29
|
+
updatedAt: string;
|
|
30
|
+
} | null;
|
|
31
|
+
status: string;
|
|
32
|
+
machineId: string | null;
|
|
33
|
+
machineName: string | null;
|
|
34
|
+
runtimeAdapter: AgentType | null;
|
|
35
|
+
workDir: string;
|
|
36
|
+
modelId: string | null;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
updatedAt: string;
|
|
39
|
+
sessions: AgentWorkspaceSession[];
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=agent-workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-workspace.d.ts","sourceRoot":"","sources":["../src/agent-workspace.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,SAAS,CAAA;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,sBAAsB,GAAG,IAAI,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,MAAM,CAAA;QACjB,SAAS,EAAE,MAAM,CAAA;KAClB,GAAG,IAAI,CAAA;IACR,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,cAAc,EAAE,SAAS,GAAG,IAAI,CAAA;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,qBAAqB,EAAE,CAAA;CAClC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-workspace.js","sourceRoot":"","sources":["../src/agent-workspace.ts"],"names":[],"mappings":"AAAA,0CAA0C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type ReqMethod = 'chat.send' | 'chat.enqueue' | 'chat.queue.get' | 'chat.queue.edit' | 'chat.queue.delete' | 'chat.abort' | 'session.resume' | 'session.history' | 'session.refresh' | 'session.tool.detail' | 'session.title.set' | 'fs.ls' | 'fs.read' | 'fs.write' | 'fs.export.markdown-pdf' | 'fs.export.markdown-pdf.setup' | 'fs.archive.zip' | 'fs.transfer' | 'fs.transfer.start' | 'fs.transfer.chunk' | 'fs.transfer.finish' | 'fs.transfer.abort' | 'fs.rename' | 'skill.list' | 'skill.install' | 'skill.doctor' | 'skill.setup' | 'skill.use' | 'region.probe' | 'region.switch' | 'upgrade.start' | 'upgrade.status' | 'upgrade.set-policy' | 'agents.refresh' | 'models.refresh' | 'agent.config.get' | 'agent.config.upsert' | 'agent.config.clear' | 'agent.config.test' | 'agent.capabilities.list' | 'manager.channel.get' | 'manager.channel.upsert' | 'session.wechat-rpa.channel.get' | 'session.wechat-rpa.channel.upsert' | 'session.wechat-rpa.channel.sync' | 'session.wechat-rpa.outbound.cancel' | 'manager.wechat-rpa.channel.get' | 'manager.wechat-rpa.channel.upsert' | 'manager.wechat-rpa.channel.sync' | 'manager.wechat-rpa.outbound.cancel' | 'wechat-rpa.helper.runtime' | 'wecom.send' | 'external.send' | 'room.sync' | 'room.send' | 'room.bind' | 'room.unbind';
|
|
1
|
+
export type ReqMethod = 'chat.send' | 'chat.enqueue' | 'chat.queue.get' | 'chat.queue.edit' | 'chat.queue.delete' | 'chat.abort' | 'session.resume' | 'session.history' | 'session.refresh' | 'session.tool.detail' | 'session.title.set' | 'fs.ls' | 'fs.read' | 'fs.write' | 'fs.export.markdown-pdf' | 'fs.export.markdown-pdf.setup' | 'fs.archive.zip' | 'fs.transfer' | 'fs.transfer.start' | 'fs.transfer.chunk' | 'fs.transfer.finish' | 'fs.transfer.abort' | 'fs.rename' | 'skill.list' | 'skill.install' | 'skill.doctor' | 'skill.setup' | 'skill.use' | 'region.probe' | 'region.switch' | 'upgrade.start' | 'upgrade.status' | 'upgrade.set-policy' | 'agents.refresh' | 'models.refresh' | 'agent.config.get' | 'agent.config.upsert' | 'agent.config.clear' | 'agent.config.test' | 'agent.capabilities.list' | 'manager.channel.get' | 'manager.channel.upsert' | 'session.wechat-rpa.channel.get' | 'session.wechat-rpa.channel.upsert' | 'session.wechat-rpa.channel.sync' | 'session.wechat-rpa.outbound.cancel' | 'manager.wechat-rpa.channel.get' | 'manager.wechat-rpa.channel.upsert' | 'manager.wechat-rpa.channel.sync' | 'manager.wechat-rpa.outbound.cancel' | 'wechat-rpa.helper.runtime' | 'wecom.send' | 'external.send' | 'room.sync' | 'room.send' | 'room.bind' | 'room.agent.bind-managed' | 'room.unbind';
|
|
2
2
|
//# sourceMappingURL=methods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../src/methods.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,WAAW,GACX,cAAc,GACd,gBAAgB,GAChB,iBAAiB,GACjB,mBAAmB,GACnB,YAAY,GACZ,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,qBAAqB,GACrB,mBAAmB,GACnB,OAAO,GACP,SAAS,GACT,UAAU,GACV,wBAAwB,GACxB,8BAA8B,GAC9B,gBAAgB,GAChB,aAAa,GACb,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB,WAAW,GAGX,YAAY,GACZ,eAAe,GACf,cAAc,GACd,aAAa,GACb,WAAW,GACX,cAAc,GACd,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,oBAAoB,GACpB,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,qBAAqB,GACrB,oBAAoB,GACpB,mBAAmB,GACnB,yBAAyB,GACzB,qBAAqB,GACrB,wBAAwB,GACxB,gCAAgC,GAChC,mCAAmC,GACnC,iCAAiC,GACjC,oCAAoC,GACpC,gCAAgC,GAChC,mCAAmC,GACnC,iCAAiC,GACjC,oCAAoC,GACpC,2BAA2B,GAC3B,YAAY,GACZ,eAAe,GACf,WAAW,GACX,WAAW,GACX,WAAW,GACX,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../src/methods.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,WAAW,GACX,cAAc,GACd,gBAAgB,GAChB,iBAAiB,GACjB,mBAAmB,GACnB,YAAY,GACZ,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,qBAAqB,GACrB,mBAAmB,GACnB,OAAO,GACP,SAAS,GACT,UAAU,GACV,wBAAwB,GACxB,8BAA8B,GAC9B,gBAAgB,GAChB,aAAa,GACb,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB,WAAW,GAGX,YAAY,GACZ,eAAe,GACf,cAAc,GACd,aAAa,GACb,WAAW,GACX,cAAc,GACd,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,oBAAoB,GACpB,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,qBAAqB,GACrB,oBAAoB,GACpB,mBAAmB,GACnB,yBAAyB,GACzB,qBAAqB,GACrB,wBAAwB,GACxB,gCAAgC,GAChC,mCAAmC,GACnC,iCAAiC,GACjC,oCAAoC,GACpC,gCAAgC,GAChC,mCAAmC,GACnC,iCAAiC,GACjC,oCAAoC,GACpC,2BAA2B,GAC3B,YAAY,GACZ,eAAe,GACf,WAAW,GACX,WAAW,GACX,WAAW,GACX,yBAAyB,GACzB,aAAa,CAAA"}
|
|
@@ -32,11 +32,23 @@ export type AgentConfigSummary = {
|
|
|
32
32
|
error?: string;
|
|
33
33
|
updatedAt?: string;
|
|
34
34
|
};
|
|
35
|
+
export type AgentRuntimeSummary = {
|
|
36
|
+
/** Version of the Agent CLI selected by the Shennian daemon. */
|
|
37
|
+
cliVersion?: string;
|
|
38
|
+
/** Version bundled with the locally installed desktop app, when detectable. */
|
|
39
|
+
desktopVersion?: string;
|
|
40
|
+
/** Compatibility is only reported when both versions are known. */
|
|
41
|
+
compatibility?: 'compatible' | 'version_mismatch';
|
|
42
|
+
/** Shennian never upgrades third-party Agents automatically. */
|
|
43
|
+
upgradeAction?: 'manual';
|
|
44
|
+
};
|
|
35
45
|
export type AgentInfo = {
|
|
36
46
|
type: AgentType;
|
|
37
47
|
models: ModelInfo[];
|
|
38
48
|
/** Per-machine Agent provider config summary (additive, non-secret). */
|
|
39
49
|
config?: AgentConfigSummary;
|
|
50
|
+
/** Non-secret runtime version and compatibility summary. */
|
|
51
|
+
runtime?: AgentRuntimeSummary;
|
|
40
52
|
};
|
|
41
53
|
export declare function isAvailableBuiltinAgentType(value: string): value is BuiltinAgentType;
|
|
42
54
|
export declare function isAvailableAgentType(value: string): value is AgentType;
|
|
@@ -134,12 +146,19 @@ export type WeChatRpaPreflightCheck = {
|
|
|
134
146
|
};
|
|
135
147
|
export type NianSession = {
|
|
136
148
|
id: string;
|
|
149
|
+
agentIdentityId?: string | null;
|
|
137
150
|
machineId: string;
|
|
138
151
|
userId: string;
|
|
139
152
|
agentType: AgentType;
|
|
140
153
|
agentSessionId: string | null;
|
|
141
154
|
sourceMode?: NativeSessionSourceMode | null;
|
|
142
155
|
modelId?: string | null;
|
|
156
|
+
/** Agent-owned conversations follow the Agent model until explicitly overridden. */
|
|
157
|
+
modelSource?: 'agent' | 'session';
|
|
158
|
+
/** Owner-only live Agent policy used when modelSource is agent. */
|
|
159
|
+
agentDefaultModelId?: string | null;
|
|
160
|
+
/** Owner-only live Agent prompt applied at the start of the next run. */
|
|
161
|
+
agentSystemPrompt?: string | null;
|
|
143
162
|
managerDefaultWorkerAgentType?: AgentType | null;
|
|
144
163
|
managerDefaultWorkerModelId?: string | null;
|
|
145
164
|
title: string;
|
|
@@ -168,6 +187,7 @@ export type ChatSendParams = {
|
|
|
168
187
|
workDir: string;
|
|
169
188
|
agentSessionId?: string | null;
|
|
170
189
|
modelId?: string;
|
|
190
|
+
systemPrompt?: string | null;
|
|
171
191
|
managerDefaultWorkerAgentType?: AgentType | null;
|
|
172
192
|
managerDefaultWorkerModelId?: string | null;
|
|
173
193
|
reasoningEffort?: string | null;
|
|
@@ -190,6 +210,7 @@ export type QueuedChatMessage = {
|
|
|
190
210
|
workDir: string;
|
|
191
211
|
agentSessionId?: string | null;
|
|
192
212
|
modelId?: string | null;
|
|
213
|
+
systemPrompt?: string | null;
|
|
193
214
|
reasoningEffort?: string | null;
|
|
194
215
|
clientMessageId?: string | null;
|
|
195
216
|
attachments?: Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAElE,MAAM,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAElE,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,OAAO,GACP,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,UAAU,GACV,IAAI,GACJ,SAAS,CAAA;AACb,MAAM,MAAM,eAAe,GAAG,UAAU,MAAM,EAAE,CAAA;AAChD,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG,eAAe,CAAA;AAE1D,eAAO,MAAM,4BAA4B,uBAEO,CAAA;AAChD,eAAO,MAAM,6BAA6B,4FASM,CAAA;AAIhD,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,yBAAyB,CAAC,EAAE,KAAK,CAAC;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AAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAC5D,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
export const DISABLED_BUILTIN_AGENT_TYPES = [
|
|
2
|
-
|
|
1
|
+
export const DISABLED_BUILTIN_AGENT_TYPES = [
|
|
2
|
+
'openclaw',
|
|
3
|
+
];
|
|
4
|
+
export const AVAILABLE_BUILTIN_AGENT_TYPES = [
|
|
5
|
+
'claude',
|
|
6
|
+
'codex',
|
|
7
|
+
'workbuddy',
|
|
8
|
+
'gemini',
|
|
9
|
+
'cursor',
|
|
10
|
+
'opencode',
|
|
11
|
+
'pi',
|
|
12
|
+
'manager',
|
|
13
|
+
];
|
|
3
14
|
const AVAILABLE_BUILTIN_AGENT_TYPE_SET = new Set(AVAILABLE_BUILTIN_AGENT_TYPES);
|
|
4
15
|
export function isAvailableBuiltinAgentType(value) {
|
|
5
16
|
return AVAILABLE_BUILTIN_AGENT_TYPE_SET.has(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,UAAU;CACoC,CAAA;AAChD,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,QAAQ;IACR,OAAO;IACP,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,IAAI;IACJ,SAAS;CACqC,CAAA;AAEhD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