shennian 0.5.13 → 0.5.15
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 +121 -51
- package/dist/src/agents/acp/adapter.js +2 -2
- package/dist/src/agents/acp/discovery.js +1 -1
- package/dist/src/agents/adapter.js +2 -1
- package/dist/src/agents/claude-permission-bridge.js +3 -0
- package/dist/src/agents/claude-permission-protocol.js +1 -0
- package/dist/src/agents/claude-permission-relay-server.js +3 -0
- package/dist/src/agents/claude.js +7 -7
- package/dist/src/agents/codex-managed-room-tools.js +1 -1
- package/dist/src/agents/codex-runtime.js +7 -7
- package/dist/src/agents/codex.js +3 -3
- package/dist/src/agents/project-client.js +1 -0
- package/dist/src/agents/public-delivery-client.js +1 -1
- package/dist/src/agents/workbuddy.js +3 -2
- package/dist/src/commands/daemon.js +9 -9
- package/dist/src/commands/pair-browser.js +1 -1
- package/dist/src/commands/pair.js +11 -11
- package/dist/src/commands/project.js +4 -0
- package/dist/src/commands/setup.js +4 -0
- package/dist/src/commands/steward.js +3 -0
- package/dist/src/daemon-ipc/agent-readiness.js +1 -1
- package/dist/src/daemon-ipc/control.js +1 -1
- package/dist/src/index.js +3 -3
- package/dist/src/session/conversation-export.js +1 -0
- package/dist/src/session/handlers/chat-adapter-config.js +1 -1
- package/dist/src/session/handlers/chat-events.js +2 -2
- package/dist/src/session/handlers/chat-session-lifecycle.js +1 -1
- package/dist/src/session/handlers/chat.js +1 -1
- package/dist/src/session/handlers/steward.js +1 -0
- package/dist/src/session/manager.js +1 -1
- package/dist/src/session/queue.js +1 -1
- package/dist/src/session/store.js +2 -2
- package/dist/src/skill/hosts.js +1 -0
- package/dist/src/skill/updater.js +1 -1
- package/dist/src/steward/session.js +2 -0
- package/dist/src/steward/templates.js +66 -0
- package/dist/src/steward/workspace.js +1 -0
- package/dist/src/upgrade/engine.js +2 -2
- package/dist/src/upgrade/npm-command.js +1 -0
- package/dist/src/upgrade/updater-launcher.js +3 -3
- package/node_modules/@shennian/wire/dist/message-payload.js +5 -5
- package/node_modules/@shennian/wire/dist/session.js +1 -1
- package/node_modules/ws/lib/websocket.js +17 -3
- package/node_modules/ws/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const g=/^\s*::git-[a-z-]+\{[^\n]*\}\s*$/gm,E=/^\s*\{\s*"v"\s*:\s*1\s*,\s*"type"\s*:\s*"(tool|tool_use|tool_result)"/,x=/^\s*<environment_context>\s*[^]*?<\/environment_context>\s*$/i,b=/<(cwd|shell|current_date|timezone)>[^<]*<\/\1>/gi,R=/^\s*<recommended_plugins>[^]*?<\/recommended_plugins>\s*/i,P=/^\s*<turn_aborted>[^]*?<\/turn_aborted>\s*$/i,h=/^\s*<codex_internal_context\b[^>]*>[^]*?<\/codex_internal_context>\s*$/i,S=/^\s*# AGENTS\.md instructions for [^\n]+\n+\s*<INSTRUCTIONS>\s*[^]*?<\/INSTRUCTIONS>\s*(?:<environment_context>[^]*?<\/environment_context>)?\s*$/i,T=/^\s*\{\s*"v"\s*:\s*1\s*,\s*"type"\s*:\s*"approval_pending"/,v=/(?:<\/?(?:environment_context|instructions|system|developer|codex_internal_context|recommended_plugins)\b|#\s*AGENTS\.md instructions\b)/i,N=/\bdata:[a-z0-9.+-]+\/[a-z0-9.+-]+;base64,[a-z0-9+/=\s]+/i,A=/(?:^|\s)(?=[A-Za-z0-9+/]{80,}={0,2}(?=\s|$))(?=[A-Za-z0-9+/]*[A-Z])(?=[A-Za-z0-9+/]*[a-z])(?=[A-Za-z0-9+/]*[0-9])[A-Za-z0-9+/]{80,}={0,2}(?=\s|$)/,I=new Set(["tool","tool_use","tool_result","thinking","system","developer","context","environment_context","channel_delivery_status"]);function C(e){return e.replace(/[[\]\\]/g,"\\$&")}function O(e){const t=C(e.name);return e.kind==="image"?``:`[${t}](<${e.path}>)`}function w(e,t){if(!t?.length)return e;const n=new Set(t.map(O));return e.split(`
|
|
2
2
|
`).filter(s=>!n.has(s.trim())).join(`
|
|
3
3
|
`).replace(/\n{3,}/g,`
|
|
4
4
|
|
|
5
|
-
`).trim()}function u(e){if(!e||e[0]!=="{")return null;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null)return t}catch{}return null}function
|
|
6
|
-
`);if(!/(^|\n)\s*::git-[a-z-]+\{[^\n]*\}\s*(?=\n|$)/.test(t))return t;const r=t.replace(
|
|
7
|
-
`).replace(/\n+$/g,""):""}function
|
|
8
|
-
`).trim();if(!n||
|
|
5
|
+
`).trim()}function u(e){if(!e||e[0]!=="{")return null;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null)return t}catch{}return null}function D(e){if(typeof e!="object"||e===null)return null;const t=e,n=typeof t.path=="string"?t.path:"",r=typeof t.name=="string"?t.name:"",s=typeof t.mimeType=="string"?t.mimeType:"",l=t.kind==="image"||t.kind==="file"||t.kind==="folder"?t.kind:null;if(!n||!r||!s||!l)return null;const f=typeof t.previewData=="string"&&t.previewData.trim()?t.previewData.trim():void 0,p=typeof t.byteSize=="number"&&Number.isSafeInteger(t.byteSize)&&t.byteSize>=0?t.byteSize:void 0,d=typeof t.sha256=="string"&&/^[a-f0-9]{64}$/i.test(t.sha256)?t.sha256.toLowerCase():void 0;return{path:n,name:r,mimeType:s,kind:l,...p!==void 0?{byteSize:p}:{},...d?{sha256:d}:{},...f?{previewData:f}:{}}}function o(e){const t=u(e);if(!t||t.v!==1)return null;if(t.type==="user"&&typeof t.content=="string"){const n=Array.isArray(t.attachments)?t.attachments.map(D).filter(r=>r!=null):void 0;return{v:1,type:"user",content:t.content,...n?.length?{attachments:n}:{}}}return t}function z(e){const t=o(e);return t?.type==="user"?t:null}function M(e,t){return t?.length?JSON.stringify({v:1,type:"user",content:e,attachments:t}):e}function $(e){if(E.test(e))return!0;const t=o(e);return!t||typeof t!="object"?!1:t.type==="tool"||t.type==="tool_use"||t.type==="tool_result"}function k(e){return T.test(e)?!0:o(e)?.type==="approval_pending"}function j(e,t="say"){return JSON.stringify({v:1,type:"steward_say",content:e,source:t})}function G(e){const t=o(e);if(!t||t.type!=="steward_say")return null;const n=t;return typeof n.content!="string"||!n.content.trim()?null:{v:1,type:"steward_say",content:n.content,source:n.source==="fallback"?"fallback":"say"}}function J(e){return V(e)?.agentVisible===!1}function V(e){const t=o(e);if(!t||t.type!=="channel_delivery_status")return null;const n=t;if(n.v!==1||n.channel!=="wechat"||n.agentVisible!==!1)return null;const r=typeof n.status=="string"&&n.status.trim()?n.status.trim():"";if(!r)return null;const s=typeof n.content=="string"&&n.content.trim()?n.content:r==="manual_review"?"\u53D1\u9001\u72B6\u6001\u4E0D\u786E\u5B9A\uFF0C\u8BF7\u68C0\u67E5\u5FAE\u4FE1":"\u672A\u80FD\u81EA\u52A8\u53D1\u9001\u5230\u5FAE\u4FE1";return{v:1,type:"channel_delivery_status",channel:"wechat",status:r,agentVisible:!1,content:s,replyId:i(n.replyId),idempotencyKey:i(n.idempotencyKey),bindingId:i(n.bindingId),reasonCode:i(n.reasonCode),copyText:i(n.copyText),copyableContentRef:i(n.copyableContentRef),errorSummary:i(n.errorSummary)}}function U(e){const t=e?.trim();return`${!t||t==="codex"?"Codex":t==="workbuddy"?"WorkBuddy":t} \u6B63\u5728\u7B49\u5F85\u7528\u6237\u786E\u8BA4\u540E\u7EE7\u7EED\u3002`}function Z(e){return JSON.stringify({v:1,type:"approval_pending",title:e?.title?.trim()||"\u9700\u8981\u7528\u6237\u786E\u8BA4",content:e?.content?.trim()||U(e?.source),source:e?.source?.trim()||"codex",actionHint:e?.permission?e?.actionHint?.trim():e?.actionHint?.trim()||"\u5F53\u524D\u795E\u5FF5\u6682\u4E0D\u652F\u6301\u8FDC\u7A0B\u786E\u8BA4\uFF0C\u8BF7\u56DE\u5230\u8FD0\u884C Codex \u7684\u7535\u8111/\u7EC8\u7AEF\u5B8C\u6210\u786E\u8BA4\u3002",...e?.permission?{permission:e.permission}:{}})}function y(e){if(!x.test(e))return!1;const t=new Set;for(const n of e.matchAll(b))n[1]&&t.add(n[1].toLowerCase());return t.has("current_date")&&t.has("timezone")&&e.includes("<workspace_roots>")?!0:t.has("cwd")&&t.has("shell")&&t.has("current_date")&&t.has("timezone")}function X(e){return P.test(e)}function _(e){return S.test(e)}function L(e){const t=e.match(R);if(t){const n=e.slice(t[0].length).trim();return!n||y(n)||_(n)}return y(e)||X(e)||h.test(e)||_(e)}function c(e){if(!e)return"";const t=e.replace(/\r\n/g,`
|
|
6
|
+
`);if(!/(^|\n)\s*::git-[a-z-]+\{[^\n]*\}\s*(?=\n|$)/.test(t))return t;const r=t.replace(g,"");return r.trim()?r.replace(/[ \t]+\n/g,`
|
|
7
|
+
`).replace(/\n+$/g,""):""}function m(e){if(!e)return"";const t=z(e);if(t)return w(t.content,t.attachments);const n=o(e);if(n){if(typeof n.content=="string")return c(n.content);if("text"in n&&typeof n.text=="string")return c(n.text)}try{const r=JSON.parse(e);if(typeof r=="string")return r;if(typeof r=="object"&&r!==null){const s=r;if(typeof s.content=="string")return c(s.content);if(typeof s.text=="string")return c(s.text)}}catch{}return c(e)}function a(e,t=160){if(typeof e!="string"||!Number.isSafeInteger(t)||t<1)return null;const n=e.replace(/\r\n/g,`
|
|
8
|
+
`).trim();if(!n||v.test(n)||N.test(n)||A.test(n)||u(n))return null;const r=n.replace(/\s+/g," ");return r.length>t?`${r.slice(0,t)}\u2026`:r}function B(e,t=160){if(!e||$(e)||L(e))return null;if(k(e))return a("\u9700\u8981\u7528\u6237\u786E\u8BA4",t);const n=o(e);if(n){const r=typeof n.type=="string"?n.type.toLowerCase():"";return!r||I.has(r)?null:a(m(e),t)}return u(e)?null:a(m(e),t)}function i(e){return typeof e=="string"&&e.trim()?e:void 0}export{Z as buildApprovalPendingPayload,j as buildStewardSayPayload,M as buildUserMessagePayload,m as extractPayloadText,J as isAgentHiddenPayload,k as isApprovalPendingPayload,_ as isCodexProjectInstructionsPayload,X as isCodexTurnAbortedPayload,L as isSystemControlPayload,y as isSystemEnvironmentContextPayload,$ as isToolPayload,V as parseChannelDeliveryStatusPayload,G as parseStewardSayPayload,o as parseStructuredMessagePayload,z as parseUserMessagePayload,a as sanitizeSessionPreview,B as sessionPreviewFromPayload,c as stripGitDirectiveArtifacts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a="codex_desktop_send_unavailable",c=["gemini","openclaw"],i=["claude","codex","workbuddy","cursor","opencode","pi","pi-coding-agent"],s=new Set(i);function d(e){return typeof e.supportsAgent=="boolean"?e.supportsAgent:e.supportsManagedAgent===!0||e.supportsManagedNativeFull===!0}function A(e,n){return Array.isArray(e.supportedAgentExecutionModes)?e.supportedAgentExecutionModes.includes(n):n==="native-full"?e.supportsManagedNativeFull===!0:e.supportsManagedAgent===!0}function u(e){return e.sessionScope==="steward"}function p(e){return s.has(e)}function r(e){return e.startsWith("custom:")||/^acp:[a-z0-9][a-z0-9._-]{0,63}$/.test(e)||p(e)}function l(e){const n=[],o=new Set;for(const t of e)!r(t)||o.has(t)||(o.add(t),n.push(t));return n}function f(e){if(!e?.length)return[];const n=[],o=new Set;for(const t of e)!r(t.type)||o.has(t.type)||(o.add(t.type),n.push(t));return n}function g(e){return e.nativeSessionVisibility==="internal"||u(e)||e.id.startsWith("sess_worker_")||e.agentType==="manager"||e.sessionMode==="manager"||!!e.agentIdentityId}export{i as AVAILABLE_BUILTIN_AGENT_TYPES,a as CODEX_DESKTOP_SEND_UNAVAILABLE,c as DISABLED_BUILTIN_AGENT_TYPES,d as agentInfoSupportsAgent,A as agentInfoSupportsExecutionMode,f as filterAvailableAgentInfos,l as filterAvailableAgentTypes,r as isAvailableAgentType,p as isAvailableBuiltinAgentType,g as isInternalSession,u as isStewardSession};
|
|
@@ -75,11 +75,24 @@ class WebSocket extends EventEmitter {
|
|
|
75
75
|
this._redirects = 0;
|
|
76
76
|
|
|
77
77
|
if (protocols === undefined) {
|
|
78
|
-
protocols
|
|
78
|
+
if (!options || options.protocols === undefined) {
|
|
79
|
+
protocols = [];
|
|
80
|
+
} else if (Array.isArray(options.protocols)) {
|
|
81
|
+
protocols = options.protocols;
|
|
82
|
+
} else {
|
|
83
|
+
protocols = [options.protocols];
|
|
84
|
+
}
|
|
79
85
|
} else if (!Array.isArray(protocols)) {
|
|
80
86
|
if (typeof protocols === 'object' && protocols !== null) {
|
|
81
87
|
options = protocols;
|
|
82
|
-
|
|
88
|
+
|
|
89
|
+
if (options.protocols === undefined) {
|
|
90
|
+
protocols = [];
|
|
91
|
+
} else if (Array.isArray(options.protocols)) {
|
|
92
|
+
protocols = options.protocols;
|
|
93
|
+
} else {
|
|
94
|
+
protocols = [options.protocols];
|
|
95
|
+
}
|
|
83
96
|
} else {
|
|
84
97
|
protocols = [protocols];
|
|
85
98
|
}
|
|
@@ -318,7 +331,6 @@ class WebSocket extends EventEmitter {
|
|
|
318
331
|
return;
|
|
319
332
|
}
|
|
320
333
|
|
|
321
|
-
this._readyState = WebSocket.CLOSING;
|
|
322
334
|
this._sender.close(code, data, !this._isServer, (err) => {
|
|
323
335
|
//
|
|
324
336
|
// This error is handled by the `'error'` listener on the socket. We only
|
|
@@ -336,6 +348,7 @@ class WebSocket extends EventEmitter {
|
|
|
336
348
|
}
|
|
337
349
|
});
|
|
338
350
|
|
|
351
|
+
this._readyState = WebSocket.CLOSING;
|
|
339
352
|
setCloseTimer(this);
|
|
340
353
|
}
|
|
341
354
|
|
|
@@ -681,6 +694,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
681
694
|
socketPath: undefined,
|
|
682
695
|
hostname: undefined,
|
|
683
696
|
protocol: undefined,
|
|
697
|
+
protocols: undefined,
|
|
684
698
|
timeout: undefined,
|
|
685
699
|
method: 'GET',
|
|
686
700
|
host: undefined,
|