grix-connector 4.18.0 → 4.18.1
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/adapter/claude/claude-adapter.js +22 -22
- package/dist/adapter/claude/config-paths.js +1 -0
- package/dist/adapter/claude/model-list.js +1 -1
- package/dist/adapter/claude/session-history.js +2 -2
- package/dist/adapter/claude/session-scanner.js +1 -1
- package/dist/adapter/claude/skill-scanner.js +2 -2
- package/dist/adapter/claude/usage-parser.js +8 -8
- package/dist/assets/dsh-bridge/{grix-dsh-bridge-4.18.0.tgz → grix-dsh-bridge-4.18.1.tgz} +0 -0
- package/dist/assets/dsh-bridge/manifest.json +4 -4
- package/dist/bridge/bridge.js +2 -2
- package/dist/bridge/provider-quota.js +1 -1
- package/dist/bridge/session-control-router.js +2 -2
- package/dist/bridge/session-list.js +2 -2
- package/dist/bridge/session-scan-cache.js +1 -1
- package/dist/bridge/session-usage.js +1 -1
- package/dist/bridge/skill-actions.js +1 -1
- package/dist/bridge/toolbar-meta.js +1 -1
- package/dist/core/config/index.js +1 -1
- package/dist/core/config/paths.js +1 -1
- package/dist/core/skill-sync/enable-roots.js +1 -1
- package/dist/core/skill-sync/library-skills.js +1 -1
- package/dist/core/skill-sync/skill-enable.js +1 -1
- package/dist/grix.js +0 -0
- package/dist/manager.js +1 -1
- package/openclaw-plugin/audit-recorder-worker.js +52 -52
- package/openclaw-plugin/index.js +65 -65
- package/package.json +1 -1
- package/dist/adapter/claude/claude-bridge-server.js +0 -1
- package/dist/adapter/claude/claude-tools.js +0 -1
- package/dist/adapter/claude/claude-worker-client.js +0 -1
- package/dist/adapter/claude/mcp-http-launcher.js +0 -2
- package/dist/adapter/claude/result-timeout.js +0 -1
- package/dist/adapter/deepseek/deepseek-adapter.js +0 -6
- package/dist/adapter/deepseek/index.js +0 -1
- package/dist/adapter/qwen/index.js +0 -1
- package/dist/adapter/qwen/qwen-adapter.js +0 -4
- package/dist/aibot/client.js +0 -1
- package/dist/aibot/index.js +0 -1
- package/dist/aibot/types.js +0 -0
- package/dist/core/access/allowlist-gate.js +0 -1
- package/dist/core/access/allowlist-store.js +0 -1
- package/dist/core/access/index.js +0 -1
- package/dist/core/file-ops/handler.js +0 -1
- package/dist/core/file-ops/list-files.js +0 -1
- package/dist/core/file-ops/types.js +0 -0
- package/dist/log.js +0 -3
- package/dist/main.js +0 -31
- package/dist/mcp/stream-http/config.js +0 -1
- package/dist/mcp/stream-http/connection-binding.js +0 -1
- package/dist/mcp/stream-http/event-tool-executor.js +0 -1
- package/dist/mcp/stream-http/gateway.js +0 -1
- package/dist/mcp/stream-http/index.js +0 -1
- package/dist/mcp/stream-http/security.js +0 -1
- package/dist/mcp/stream-http/session-manager.js +0 -1
- package/dist/mcp/stream-http/tool-executor.js +0 -1
- package/dist/mcp/stream-http/tool-registry.js +0 -1
- package/dist/mcp/stream-http/tool-schemas.js +0 -1
- package/dist/session/index.js +0 -1
- package/dist/session/manager.js +0 -1
- package/dist/transport/index.js +0 -1
- package/dist/transport/json-rpc.js +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import p from"node:path";import{homedir as a}from"node:os";import{expandHomePath as j}from"../../core/config/index.js";function u(e,c={}){const{platform:r=process.platform,homeDir:n=a(),pathImpl:o=p}=c,t=r==="win32"?Object.keys(e).find(l=>l.toUpperCase()==="CLAUDE_CONFIG_DIR"):"CLAUDE_CONFIG_DIR",s=(t?e[t]:void 0)?.trim(),i=s?j(s,{platform:r,homeDir:n,pathImpl:o}):o.join(n,".claude");return{dir:i,claudeJson:s?o.join(i,".claude.json"):o.join(n,".claude.json"),settings:o.join(i,"settings.json"),projectsDir:o.join(i,"projects"),skillsDir:o.join(i,"skills"),pluginsDir:o.join(i,"plugins"),credentialsJson:o.join(i,".credentials.json")}}export{u as resolveClaudeConfigPaths};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{execFileSync as
|
|
1
|
+
import{execFileSync as w}from"node:child_process";import{readJSONFile as g}from"../../core/util/json-file.js";import{log as i}from"../../core/log/index.js";import{resolveClaudeConfigPaths as C}from"./config-paths.js";const y="default",I={id:y,displayName:"\u9ED8\u8BA4\uFF08CLI \u81EA\u52A8\u9009\u62E9\uFF09"};function K(e){const t=String(e??"").trim();return t===y?"":t}function E(e){return[I,...e.filter(t=>t.id!==y)]}const D=[{id:"opus",displayName:"Opus"},{id:"sonnet",displayName:"Sonnet"},{id:"haiku",displayName:"Haiku"},{id:"claude-fable-5-1",displayName:"Claude Fable 5.1"},{id:"claude-opus-5-5",displayName:"Claude Opus 5.5"},{id:"claude-sonnet-5-5",displayName:"Claude Sonnet 5.5"},{id:"claude-haiku-5-5",displayName:"Claude Haiku 5.5"},{id:"claude-opus-4-8",displayName:"Claude Opus 4.8"},{id:"claude-opus-4-7",displayName:"Claude Opus 4.7"},{id:"claude-opus-4-6",displayName:"Claude Opus 4.6"}],c=E(D),M=3600*1e3,S=300*1e3,b="oauth-2025-04-20";let r=null,k=0,f="";function x(e=C({})){return g(e.settings)?.env??{}}function N(e){return!(!e?.accessToken||e.expiresAt&&Date.now()>e.expiresAt-S)}function U(e){if(process.platform==="darwin")try{const t=process.env.USER||process.env.LOGNAME||"";if(!t)return null;const o=w("security",["find-generic-password","-s","Claude Code-credentials","-a",t,"-w"],{encoding:"utf-8",timeout:5e3,windowsHide:!0}).trim(),a=JSON.parse(o)?.claudeAiOauth;return N(a)?a.accessToken:(a?.accessToken&&i.info("model-list","Claude OAuth token expired, skipping keychain"),null)}catch{return null}else try{const o=g(e.credentialsJson)?.claudeAiOauth;return N(o)?o.accessToken:(o?.accessToken&&i.info("model-list","Claude OAuth token expired, skipping credentials file"),null)}catch{return null}}async function R(e=C({})){if(r&&f===e.dir&&Date.now()-k<M)return r;const t=x(e),o=(t.ANTHROPIC_BASE_URL??"").trim()||"https://api.anthropic.com",p=(t.ANTHROPIC_AUTH_TOKEN??"").trim(),a=(t.ANTHROPIC_API_KEY??"").trim();let l=p||a,O=!!p,_=!1;const d=n=>(r=n,f=e.dir,k=Date.now(),n);if(!l){const n=U(e);n&&(l=n,O=!0,_=!0,i.info("model-list","Using Claude CLI OAuth token from Keychain for model list"))}if(!l)return i.info("model-list","No API credentials found, using fallback model list"),d(c);try{const n=`${o.replace(/\/+$/,"")}/v1/models`,u={"anthropic-version":"2023-06-01"};O?(u.Authorization=`Bearer ${l}`,_&&(u["anthropic-beta"]=b)):u["x-api-key"]=l;const T=new AbortController,L=setTimeout(()=>T.abort(),1e4),m=await fetch(n,{headers:u,signal:T.signal});if(clearTimeout(L),!m.ok)return i.warn("model-list",`API returned ${m.status}, using fallback model list`),d(c);const A=(await m.json()).data;if(!Array.isArray(A)||A.length===0)return i.warn("model-list","API returned empty model list, using fallback"),d(c);const h=E(A.map(s=>({id:s.id,displayName:s.display_name||s.name||s.id})));return i.info("model-list",`Fetched ${h.length} models from API: ${h.map(s=>s.id).join(", ")}`),d(h)}catch(n){return i.warn("model-list",`Failed to fetch models: ${n instanceof Error?n.message:n}, using fallback`),d(c)}}function $(e=C({})){return r&&f===e.dir?r:c}function J(){r=null,k=0,f=""}export{y as CLAUDE_DEFAULT_MODEL_ID,I as CLAUDE_DEFAULT_MODEL_OPTION,R as fetchAvailableModels,$ as getCachedModels,x as readSettingsEnv,J as resetModelCache,K as toClaudeCliModelId};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
`)}return t==null?"":String(t)}function
|
|
1
|
+
import{join as h,resolve as _,sep as S}from"node:path";import{resolveClaudeConfigPaths as x}from"./config-paths.js";import{SESSION_HISTORY_ERROR_CODES as g,SessionHistoryError as m,readJsonlHistoryPage as A,registerSessionHistoryReader as P}from"../shared/session-history.js";import{encodeProjectPath as j,resolveSessionJsonlPath as T}from"./usage-parser.js";const E=/^[A-Za-z0-9][A-Za-z0-9_-]*$/,k=new Set(["summary","custom-title","ai-title","file-history-snapshot","queue-operation"]),b=["<local-command-caveat","<command-name","<local-command-stdout"];function p(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function v(t){const o=t.trimStart();return b.some(s=>o.startsWith(s))}function w(t){if(typeof t=="string")return t;if(Array.isArray(t)){const o=[];for(const s of t)p(s)&&s.type==="text"&&typeof s.text=="string"&&o.push(s.text);return o.join(`
|
|
2
|
+
`)}return t==null?"":String(t)}function C(t,o){if(t.isSidechain===!0||t.isMeta===!0)return[];const s=typeof t.type=="string"?t.type:"";if(k.has(s))return[];const u=typeof t.uuid=="string"&&t.uuid?t.uuid:o,y=typeof t.parentUuid=="string"?t.parentUuid:null,f=typeof t.timestamp=="string"?t.timestamp:"",a=p(t.message)?t.message:void 0,c=[];if(s==="user"){const i=a?.content;if(typeof i=="string")c.push({role:"user",content:i,msg_type:"text"});else if(Array.isArray(i))for(const r of i){if(!p(r))continue;const n=r;if(n.type==="text"&&typeof n.text=="string"){if(v(n.text))continue;c.push({role:"user",content:n.text,msg_type:"text"})}else if(n.type==="tool_result"){const e={};typeof n.tool_use_id=="string"&&(e.tool_use_id=n.tool_use_id),n.is_error===!0&&(e.is_error=!0),c.push({role:"tool",content:w(n.content),msg_type:"tool_result",...Object.keys(e).length>0?{extra:e}:{}})}}}else if(s==="assistant"){const i=a?.content,r=typeof a?.model=="string"?a.model:void 0;if(typeof i=="string")c.push({role:"assistant",content:i,msg_type:"text",...r?{extra:{model:r}}:{}});else if(Array.isArray(i))for(const n of i){if(!p(n))continue;const e=n;if(e.type==="text"&&typeof e.text=="string")c.push({role:"assistant",content:e.text,msg_type:"text",...r?{extra:{model:r}}:{}});else if(e.type==="thinking"&&typeof e.thinking=="string")c.push({role:"assistant",content:e.thinking,msg_type:"thinking"});else if(e.type==="tool_use"){const l={};typeof e.name=="string"&&(l.tool_name=e.name),typeof e.id=="string"&&(l.tool_use_id=e.id);let d="{}";try{d=JSON.stringify(e.input??{})}catch{}c.push({role:"assistant",content:d,msg_type:"tool_use",...Object.keys(l).length>0?{extra:l}:{}})}}}else if(s==="system")c.push({role:"system",content:String(t.content??""),msg_type:typeof t.subtype=="string"?t.subtype:"system"});else return[];return c.map((i,r)=>({native_message_id:r===0?u:`${u}#${r}`,native_parent_id:y,created_at:f,...i}))}function O(t,o){if(!E.test(t.agent_session_id))throw new m(g.invalidAgentSession,`invalid agent_session_id: ${t.agent_session_id}`);const s=o?.claudeConfigPaths??x({}),u=o?.projectsDir??s.projectsDir,y=o?.projectsDir?h(o.projectsDir,j(t.cwd),`${t.agent_session_id}.jsonl`):T(t.agent_session_id,t.cwd,s),f=_(u),a=_(y);if(a!==f&&!a.startsWith(f+S))throw new m(g.invalidAgentSession,`transcript path escapes projects dir: ${t.agent_session_id}`);return a}async function R(t,o){const s=O(t,o);return{...await A({filePath:s,cursor:t.cursor,limit:t.limit,mapLine:C,sourceLabel:"claude session transcript",logTag:"claude-session-history"}),...t.sync_run_id?{sync_run_id:t.sync_run_id}:{}}}P("claude",R);export{R as readClaudeSessionHistory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readdirSync as
|
|
1
|
+
import{readdirSync as l,statSync as d}from"node:fs";import u from"node:path";import{resolveClaudeConfigPaths as p}from"./config-paths.js";import{log as h}from"../../core/log/index.js";import{readFirstLines as y}from"../../core/util/read-first-lines.js";import{makeTitle as f}from"../../core/util/session-title.js";function T(s){const t=s.trim();return t?t.startsWith("<local-command-caveat>")||t.startsWith("<local-command-stdout>")||t.startsWith("<command-name>"):!0}function m(s){if(T(s))return;const t=s.match(/<channel[^>]*>([\s\S]+?)<\/channel>/);if(t){const o=t[1].trim();if(o)return f(o)}return f(s)}function S(s){for(const t of s)try{const o=JSON.parse(t);if(o.type!=="user")continue;const i=o.message?.content;if(typeof i=="string"){const e=m(i);if(e)return e;continue}if(Array.isArray(i)){for(const e of i)if(e.type==="text"&&e.text){const r=m(e.text);if(r)return r}}}catch{}}function C(s){try{const t=d(s),o=y(s,131072);let i="",e="",r="";for(const a of o.slice(0,80))try{const n=JSON.parse(a);if(n.sessionId&&!i&&(i=n.sessionId),n.type==="custom-title"&&n.customTitle&&!n.customTitle.startsWith("grix-")&&(e=n.customTitle),n.type==="ai-title"&&n.aiTitle&&!e&&(e=n.aiTitle),n.cwd&&!r&&(r=n.cwd),i&&e&&r)break}catch{}if(!i)return null;const c=e||S(o);return{sessionId:i,cwd:r||void 0,title:c,mtimeMs:Math.round(t.mtimeMs)}}catch{return null}}function A(s=p({}).projectsDir){const t=[];let o;try{o=l(s,{withFileTypes:!0})}catch{return t}for(const i of o){if(!i.isDirectory())continue;const e=u.join(s,i.name);let r;try{r=l(e,{withFileTypes:!0})}catch{continue}for(const c of r){if(!c.isFile()||!c.name.endsWith(".jsonl"))continue;const a=u.join(e,c.name),n=C(a);n&&t.push({sessionId:n.sessionId,cwd:n.cwd||"",title:n.title,updatedAt:n.mtimeMs,filePath:a})}}return t.sort((i,e)=>e.updatedAt-i.updatedAt),h.info("claude-session-scanner",`Scanned ${t.length} Claude sessions from ${s}`),t}export{A as scanClaudeSessions};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{readdirSync as x,readFileSync as j,existsSync as h,statSync as D}from"node:fs";import{dirname as S,join as t,resolve as b}from"node:path";import{homedir as H}from"node:os";import{log as
|
|
2
|
-
`)){const a=p.indexOf(":");if(a===-1)continue;const m=p.slice(0,a).trim();let u=p.slice(a+1).trim();(u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'"))&&(u=u.slice(1,-1)),m==="name"?n=u:m==="description"?l=u:m==="trigger"&&(o=u)}return{name:n,description:l,trigger:o}}function q(r,e,s){if(!h(r))return[];const c=[];try{for(const n of x(r,{withFileTypes:!0})){const l=t(r,n.name);if(!_(n,l)||n.name.startsWith("."))continue;const o=t(l,"SKILL.md");if(h(o))try{const p=j(o,"utf-8"),a=y(p);a.name&&c.push({name:a.name,description:a.description,trigger:a.trigger,source:e,pluginName:s,filePath:o,managed:h(t(l,
|
|
1
|
+
import{readdirSync as x,readFileSync as j,existsSync as h,statSync as D}from"node:fs";import{dirname as S,join as t,resolve as b}from"node:path";import{homedir as H}from"node:os";import{log as P}from"../../core/log/index.js";import{findGitProjectRoot as w}from"../../core/util/git-project-root.js";import{resolveClaudeConfigPaths as L}from"./config-paths.js";const v=".grix-managed";function y(r){const e=r.trim();if(!e.startsWith("---"))return{name:"",description:""};const s=e.indexOf("---",3);if(s===-1)return{name:"",description:""};const c=e.slice(3,s).trim();let n="",l="",o;for(const p of c.split(`
|
|
2
|
+
`)){const a=p.indexOf(":");if(a===-1)continue;const m=p.slice(0,a).trim();let u=p.slice(a+1).trim();(u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'"))&&(u=u.slice(1,-1)),m==="name"?n=u:m==="description"?l=u:m==="trigger"&&(o=u)}return{name:n,description:l,trigger:o}}function q(r,e,s){if(!h(r))return[];const c=[];try{for(const n of x(r,{withFileTypes:!0})){const l=t(r,n.name);if(!_(n,l)||n.name.startsWith("."))continue;const o=t(l,"SKILL.md");if(h(o))try{const p=j(o,"utf-8"),a=y(p);a.name&&c.push({name:a.name,description:a.description,trigger:a.trigger,source:e,pluginName:s,filePath:o,managed:h(t(l,v))})}catch{}}}catch{}return c}function i(r,e,s){if(!h(r))return[];const c=s?.maxDepth??6,n=s?.includeHiddenDirs??!1,l=[],o=(p,a)=>{if(a>c)return;let m;try{m=x(p,{withFileTypes:!0,encoding:"utf8"})}catch{return}for(const u of m){const f=t(p,u.name);if(s?.rootMarkdownFiles&&a===0&&u.name.endsWith(".md")){if(!n&&u.name.startsWith(".")||!F(u,f))continue;try{const g=j(f,"utf-8"),d=y(g);d.name&&l.push({name:d.name,description:d.description,trigger:d.trigger,source:e,pluginName:s?.pluginName,filePath:f})}catch{}continue}if(!_(u,f)||!n&&u.name.startsWith(".")||u.name==="node_modules")continue;const k=t(f,"SKILL.md");if(h(k))try{const g=j(k,"utf-8"),d=y(g);d.name&&l.push({name:d.name,description:d.description,trigger:d.trigger,source:e,pluginName:s?.pluginName,filePath:k,managed:h(t(f,v))})}catch{}o(f,a+1)}};return o(r,0),l}function M(r){return r.map(e=>({...e,managed:!0}))}function _(r,e){if(r.isDirectory())return!0;if(!r.isSymbolicLink())return!1;try{return D(e).isDirectory()}catch{return!1}}function F(r,e){if(r.isFile())return!0;if(!r.isSymbolicLink())return!1;try{return D(e).isFile()}catch{return!1}}function C(r){const e=[],s=new Set;for(const c of r){const n=c.name.trim().toLowerCase();s.has(n)||(s.add(n),e.push(c))}return e}function I(r){const e=r.filePath?.trim();if(!e)return 0;try{const s=D(e).mtimeMs,c=D(S(e)).mtimeMs;return Math.max(s,c)}catch{return 0}}function N(r){return r.map((e,s)=>({entry:e,index:s,timeMs:I(e)})).sort((e,s)=>e.timeMs!==s.timeMs?s.timeMs-e.timeMs:e.index-s.index).map(e=>e.entry)}function A(r){const e=[],s=new Set;let c=b(r);for(;;){s.has(c)||(e.push(c),s.add(c));const n=S(c);if(n===c)break;c=n}return e}function R(r,e){const s=[r.settings];e&&(s.push(t(e,".claude","settings.json")),s.push(t(e,".claude","settings.local.json")));const c=new Map;for(const n of s)if(h(n))try{const o=JSON.parse(j(n,"utf-8"))?.enabledPlugins;if(!o||typeof o!="object")continue;for(const[p,a]of Object.entries(o))typeof a=="boolean"&&c.set(p,a)}catch{}return c}function G(r,e){const s=t(r.pluginsDir,"installed_plugins.json");if(!h(s))return[];const c=[];try{const n=j(s,"utf-8"),o=JSON.parse(n)?.plugins;if(!o||typeof o!="object")return c;const p=R(r,e),a=e?b(e):void 0;for(const[m,u]of Object.entries(o))if(Array.isArray(u)&&p.get(m)===!0)for(const f of u){const k=f?.installPath;if(!k||!h(k))continue;if(f?.scope==="local"){const O=typeof f?.projectPath=="string"?b(f.projectPath):void 0;if(!a||O!==a)continue}const g=t(k,"skills"),d=m.split("@")[0],E=M(q(g,"plugin",d));c.push(...E)}}catch{}return c}function z(r,e){const s=(r??"").trim().toLowerCase(),c=(e??"").trim().toLowerCase();return c==="deveco"?"deveco":s==="claude"?"claude":s==="codex"?"codex":s==="pi"&&c==="omp"?"omp":s==="pi"?"pi":s==="cursor"?"cursor":s==="codewhale"?"codewhale":s==="opencode"?"opencode":s==="agy"?"gemini":s==="openhuman"?"none":s==="deepseek-harness"?"deepseek":c==="kiro"?"kiro":c==="qwen"?"qwen":c==="reasonix"?"reasonix":c==="kimi"?"kimi":c==="hermes"?"hermes":c==="copilot"?"copilot":c==="traecli"?"traecli":c==="codebuddy"?"codebuddy":c==="gemini"?"gemini":c==="grok"||c==="qwenpaw"||c==="zeroclaw"?"none":c==="qodercli"?"qodercli":c==="qoderclicn"?"qoderclicn":c==="mcode"||c==="dim"?"none":"gemini"}function B(r){const e=[],s=r.homeDir??H();switch(r.mode){case"claude":{const n={maxDepth:0},l=r.claudeConfigPaths??L(r.env??{},{homeDir:s});r.projectDir&&e.push(...i(t(r.projectDir,".claude","skills"),"project",n)),e.push(...i(l.skillsDir,"global",n)),e.push(...G(l,r.projectDir));break}case"codex":{const n=process.env.CODEX_HOME?.trim()||t(s,".codex"),l=r.includeSharedAgentSkills??/^(1|true|yes|on)$/i.test(process.env.GRIX_CODEX_INCLUDE_SHARED_AGENT_SKILLS??"");if(r.projectDir)for(const o of A(r.projectDir))e.push(...i(t(o,".agents","skills"),"project")),e.push(...i(t(o,".codex","skills"),"project"));l&&e.push(...i(t(s,".agents","skills"),"codex")),e.push(...i(t(n,"skills"),"codex")),e.push(...M(i(t(n,"skills",".system"),"codex")));break}case"gemini":{const n={maxDepth:0};r.projectDir&&(e.push(...i(t(r.projectDir,".gemini","skills"),"project",n)),e.push(...i(t(r.projectDir,".agents","skills"),"project",n))),e.push(...i(t(s,".gemini","skills"),"gemini",n)),e.push(...i(t(s,".agents","skills"),"gemini",n));break}case"pi":{r.projectDir&&e.push(...i(t(r.projectDir,".pi","skills"),"project")),e.push(...i(t(s,".pi","agent","skills"),"pi"));break}case"kiro":{r.projectDir&&e.push(...i(t(r.projectDir,".kiro","skills"),"project")),e.push(...i(t(s,".kiro","skills"),"kiro"));break}case"qwen":{const n={maxDepth:0};r.projectDir&&(e.push(...i(t(r.projectDir,".qwen","skills"),"project",n)),e.push(...i(t(r.projectDir,".agents","skills"),"project",n))),e.push(...i(t(s,".qwen","skills"),"global",n)),e.push(...i(t(s,".agents","skills"),"global",n));break}case"cursor":{const n={maxDepth:0};r.projectDir&&(e.push(...i(t(r.projectDir,".agents","skills"),"project",n)),e.push(...i(t(r.projectDir,".cursor","skills"),"project",n))),e.push(...i(t(s,".agents","skills"),"global",n)),e.push(...i(t(s,".cursor","skills"),"global",n));break}case"codewhale":{r.projectDir&&e.push(...i(t(r.projectDir,".codewhale","skills"),"project")),e.push(...i(t(s,".codewhale","skills"),"global"));break}case"opencode":{const n=process.env.XDG_CONFIG_HOME?.trim()||t(s,".config");r.projectDir&&(e.push(...i(t(r.projectDir,".opencode","skills"),"project")),e.push(...i(t(r.projectDir,".opencode","skill"),"project"))),e.push(...i(t(n,"opencode","skills"),"global")),e.push(...i(t(n,"opencode","skill"),"global")),e.push(...i(t(s,".claude","skills"),"global")),e.push(...i(t(s,".agents","skills"),"global"));break}case"deveco":{const n=process.env.XDG_CONFIG_HOME?.trim()||t(s,".config");r.projectDir&&(e.push(...i(t(r.projectDir,".deveco","skills"),"project")),e.push(...i(t(r.projectDir,".deveco","skill"),"project"))),e.push(...i(t(n,"deveco","skills"),"global")),e.push(...i(t(n,"deveco","skill"),"global")),e.push(...i(t(s,".claude","skills"),"global")),e.push(...i(t(s,".agents","skills"),"global"));break}case"reasonix":{e.push(...i(t(s,".reasonix","skills"),"global"));break}case"kimi":{const n=process.env.KIMI_CODE_HOME?.trim()||t(s,".kimi-code"),l={rootMarkdownFiles:!0};if(r.projectDir){const o=w(r.projectDir);e.push(...i(t(o,".kimi-code","skills"),"project",l)),e.push(...i(t(o,".agents","skills"),"project",l))}e.push(...i(t(n,"skills"),"global",l)),e.push(...i(t(s,".agents","skills"),"global",l));break}case"deepseek":{const n=r.env??process.env,l=n.DSH_HOME?.trim()||t(s,".dsh"),o=n.DSH_AGENTS_HOME?.trim()||t(s,".agents"),p={rootMarkdownFiles:!0,maxDepth:0};if(r.projectDir){const a=w(r.projectDir);e.push(...i(t(a,".dsh","skills"),"project",p)),e.push(...i(t(a,".agents","skills"),"project",p))}e.push(...i(t(l,"skills"),"global",p)),e.push(...i(t(o,"skills"),"global",p));break}case"hermes":{const n=r.env??process.env,l=n.HERMES_HOME?.trim()||n.GRIX_HERMES_HOME?.trim()||t(s,".hermes");e.push(...i(t(l,"skills"),"global"));break}case"copilot":{r.projectDir&&(e.push(...i(t(r.projectDir,".github","skills"),"project")),e.push(...i(t(r.projectDir,".claude","skills"),"project")),e.push(...i(t(r.projectDir,".agents","skills"),"project"))),e.push(...i(t(s,".copilot","skills"),"global")),e.push(...i(t(s,".agents","skills"),"global"));break}case"traecli":{r.projectDir&&e.push(...i(t(r.projectDir,".trae","skills"),"project")),e.push(...i(t(s,".trae","skills"),"global"));break}case"omp":{const l=(r.env??process.env).PI_CODING_AGENT_DIR?.trim()||t(s,".omp","agent");r.projectDir&&e.push(...i(t(r.projectDir,".omp","skills"),"project")),e.push(...i(t(l,"skills"),"omp"));break}case"codebuddy":{e.push(...i(t(s,".codebuddy","skills"),"global"));break}case"qodercli":{r.projectDir&&(e.push(...i(t(r.projectDir,".qoder","skills"),"project")),e.push(...i(t(r.projectDir,".agents","skills"),"project"))),e.push(...i(t(s,".qoder","skills"),"global"));break}case"qoderclicn":{r.projectDir&&e.push(...i(t(r.projectDir,".agents","skills"),"project")),e.push(...i(t(s,".qoder-cn","skills"),"global"));break}case"none":break}const c=N(C(e));return P.info("skill-scanner",`Scanned skills: mode=${r.mode} count=${c.length}`),c}export{v as MANAGED_MARKER,C as dedupeSkills,M as markManaged,y as parseSkillFrontmatter,z as resolveSkillScanMode,i as scanSkillTree,B as scanSkills,N as sortSkillsByRecentTime};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{closeSync as
|
|
2
|
-
`):""}function
|
|
3
|
-
`);let
|
|
4
|
-
`),stopReason:
|
|
5
|
-
`)){const k
|
|
6
|
-
`);for(let
|
|
7
|
-
`),c=new Set,
|
|
8
|
-
`);let
|
|
1
|
+
import{closeSync as v,createReadStream as K,existsSync as D,openSync as X,readdirSync as q,readFileSync as M,readSync as H,realpathSync as Q,statSync as N}from"node:fs";import{createInterface as V}from"node:readline";import C from"node:path";import{resolveClaudeConfigPaths as g}from"./config-paths.js";import{log as j}from"../../core/log/index.js";function Y(t){let e=t;try{e=Q(t)}catch{}return e.replace(/[^a-zA-Z0-9]/g,"-")}function Z(t,e,n=g({})){return C.join(n.projectsDir,Y(e),`${t}.jsonl`)}const G=5e3,J=64,S=new Map,I=new Map,x=new Map;function P(t,e){return`${e.projectsDir}\0${t}`}function W(t,e){for(S.delete(t),S.set(t,e);S.size>J;){const n=S.keys().next();if(n.done)break;S.delete(n.value)}}function at(t,e=g({})){if(t===void 0){S.clear(),x.clear(),I.clear();return}const n=P(t,e);S.delete(n),x.delete(n)}function lt(t,e,n=g({})){if(!t||!e||!C.isAbsolute(e)||C.basename(e)!==`${t}.jsonl`)return;const o=P(t,n);if(x.get(o)!==e)for(x.delete(o),x.set(o,e);x.size>J;){const r=x.keys().next();if(r.done)break;x.delete(r.value)}}function tt(t,e){const n=`${t}.jsonl`;let o;try{o=q(e,{withFileTypes:!0})}catch{return null}let r=null;for(const s of o){if(!s.isDirectory())continue;const i=C.join(e,s.name,n);try{const c=N(i);if(!c.isFile()||c.size===0)continue;(!r||c.size>r.size)&&(r={path:i,size:c.size})}catch{}}return r?.path??null}function A(t,e,n=g({})){const o=P(t,n),r=x.get(o);if(r&&D(r))return r;const s=Z(t,e,n);if(D(s))return S.delete(o),s;const i=S.get(o);if(i&&D(i))return i;const c=Date.now(),l=I.get(n.projectsDir)??0;if(c-l<G)return s;I.set(n.projectsDir,c);const a=tt(t,n.projectsDir);return W(o,a),a?(j.warn("usage-parser",`Session ${t} transcript drifted off the bound cwd: reading ${a} instead of ${s}`),a):s}function z(){return{inputTokens:0,outputTokens:0,cacheReadInputTokens:0,cacheCreationInputTokens:0}}function $(t,e){t.inputTokens+=e.input_tokens??0,t.outputTokens+=e.output_tokens??0,t.cacheReadInputTokens+=e.cache_read_input_tokens??0,t.cacheCreationInputTokens+=e.cache_creation_input_tokens??0}async function ut(t,e,n=g({})){const o=A(t,e,n);j.info("usage-parser",`Parsing session usage from ${o}`);const r=new Map,s=z();let i=0;try{const l=V({input:K(o,"utf8"),crlfDelay:1/0});for await(const a of l)if(a.trim())try{const p=JSON.parse(a);if(p.type!=="assistant")continue;const u=p.message?.usage;if(!u)continue;const f=p.message?.model??"unknown";i++,$(s,u);let y=r.get(f);y||(y={turns:0,usage:z()},r.set(f,y)),y.turns++,$(y.usage,u)}catch{}}catch(l){return l.code==="ENOENT"?(j.info("usage-parser",`Session JSONL not found: ${o}`),null):(j.error("usage-parser",`Failed to parse session usage: ${l}`),null)}return i===0?null:{models:[...r.entries()].map(([l,a])=>({model:l,turns:a.turns,total:a.usage})),total:s,turns:i}}const T=64*1024,et=9e4,nt=new Set(["No response requested."]);function L(t){return nt.has(t.trim())}function B(t){return t.isApiErrorMessage===!0}function O(t){const e=t.message;return e?.content?(Array.isArray(e.content)?e.content:[{type:"text",text:String(e.content)}]).map(o=>o).filter(o=>o.type==="text"&&o.text?.trim()).map(o=>o.text.trim()).join(`
|
|
2
|
+
`):""}function ft(t,e,n,o=g({})){const r=A(t,e,o);try{const s=M(r);let i;n!==void 0&&n>0?i=n<s.length?s.subarray(n):Buffer.alloc(0):i=s.length>T?s.subarray(s.length-T):s;const c=i.toString("utf8").split(`
|
|
3
|
+
`);let l;for(let a=c.length-1;a>=0;a--){const p=c[a].trim();if(!p)continue;let u;try{u=JSON.parse(p)}catch{continue}if(u.type!=="assistant")continue;const f=u.message;if(B(u))return{text:"",stopReason:l!==void 0?l:f?.stop_reason??null,apiError:!0,apiErrorText:O(u)};if(!f?.content)continue;const y=Array.isArray(f.content)?f.content:[{type:"text",text:String(f.content)}],d=[];let h=0;for(const b of y){const m=b;if(!(m.type!=="text"||!m.text?.trim())){if(L(m.text)){h++;continue}d.push(m.text)}}if(d.length>0)return{text:d.join(`
|
|
4
|
+
`),stopReason:l!==void 0?l:f.stop_reason??null};h>0&&l===void 0&&(l=f.stop_reason??null)}return l!==void 0?{text:"",stopReason:l,metaOnly:!0}:null}catch{return null}}function pt(t,e,n,o=g({})){const r=A(t,e,o),s=n>0?n:0;let i;try{const c=N(r).size;if(s>=c)return{segments:[],newOffset:s};const l=c-s,a=Buffer.alloc(l);i=X(r,"r");const p=H(i,a,0,l,s),u=a.subarray(0,p);let f=-1;for(let k=u.length-1;k>=0;k--)if(u[k]===10){f=k;break}if(f<0)return{segments:[],newOffset:s};const y=u.subarray(0,f+1),d=s+y.length,h=[];let b=!1,m="";for(const k of y.toString("utf8").split(`
|
|
5
|
+
`)){const _=k.trim();if(!_)continue;let R;try{R=JSON.parse(_)}catch{continue}if(R.type!=="assistant")continue;if(B(R)){b=!0,m=O(R)||m;continue}const w=R.message;if(!w?.content)continue;const U=Array.isArray(w.content)?w.content:[{type:"text",text:String(w.content)}];for(const F of U){const E=F;E.type!=="text"||!E.text?.trim()||L(E.text)||h.push(E.text)}}return{segments:h,newOffset:d,apiError:b,apiErrorText:m}}catch{return{segments:[],newOffset:s}}finally{if(i!==void 0)try{v(i)}catch{}}}function yt(t,e,n,o=g({})){const r=A(t,e,o);let s=null,i;try{const a=N(r);s=Date.now()-a.mtimeMs,i=M(r)}catch{return{lastStopReason:null,freshMs:null}}let c;n!==void 0&&n>0?c=n<i.length?i.subarray(n):Buffer.alloc(0):c=i.length>T?i.subarray(i.length-T):i;const l=c.toString("utf8").split(`
|
|
6
|
+
`);for(let a=l.length-1;a>=0;a--){const p=l[a].trim();if(!p)continue;let u;try{u=JSON.parse(p)}catch{continue}if(u.type!=="assistant")continue;const f=u.message;if(f)return{lastStopReason:f.stop_reason??null,freshMs:s}}return{lastStopReason:null,freshMs:s}}function dt(t,e,n=g({})){const o=A(t,e,n);let r;try{r=M(o)}catch{return 0}const i=(r.length>T?r.subarray(r.length-T):r).toString("utf8").split(`
|
|
7
|
+
`),c=new Set,l=new Set,a=/<task-id>\s*([^<\s]+)\s*<\/task-id>/;for(const u of i){const f=u.trim();if(!f)continue;if(f.includes("task-notification")){const h=a.exec(f);h&&l.add(h[1]);continue}let y;try{y=JSON.parse(f)}catch{continue}const d=y.toolUseResult;d&&typeof d.backgroundTaskId=="string"&&c.add(d.backgroundTaskId)}let p=0;for(const u of c)l.has(u)||p++;return p}function gt(t,e,n,o=!1,r=g({})){const s=A(t,e,r);try{const i=N(s);if(o&&Date.now()-i.mtimeMs<et)return!1;const c=M(s),a=(n>0&&n<c.length?c.subarray(n):c.length>T?c.subarray(c.length-T):c).toString("utf8").split(`
|
|
8
|
+
`);let p=!1,u=!1;for(const f of a){const y=f.trim();if(!y)continue;let d;try{d=JSON.parse(y)}catch{continue}if(d.type==="user"){const b=d.message?.content??d.content;(Array.isArray(b)?b:[]).some(_=>typeof _=="object"&&_!==null&&_.type==="tool_result")&&(p=!0,u=!1)}else d.type==="assistant"&&p&&(u=!0)}return p&&!u}catch{return!1}}export{at as clearSessionJsonlDriftCache,dt as countPendingBackgroundTasks,Y as encodeProjectPath,ft as extractLastAssistantEntry,pt as extractTextBlocksAfterOffset,gt as hasTerminalToolResultAfterOffset,lt as noteSessionJsonlPath,ut as parseClaudeSessionUsage,yt as probeSessionTurnState,Z as resolveBoundSessionJsonlPath,A as resolveSessionJsonlPath};
|
|
Binary file
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"bridgeVersion": "4.18.
|
|
4
|
-
"tarball": "grix-dsh-bridge-4.18.
|
|
3
|
+
"bridgeVersion": "4.18.1",
|
|
4
|
+
"tarball": "grix-dsh-bridge-4.18.1.tgz",
|
|
5
5
|
"size": 24211,
|
|
6
6
|
"unpackedSize": 96662,
|
|
7
|
-
"shasum": "
|
|
8
|
-
"integrity": "sha512-
|
|
7
|
+
"shasum": "d8c2a168ef773e4da9763f34f9bb52b40f3be892",
|
|
8
|
+
"integrity": "sha512-ZDgXMvdYTfStWi4OzJ0jZrpH1TqpcronvrUXo3CP0+k3DEGO/nhi6bBXMC068ms9Rw9/0ckWdUJBZJ8Ox1qs5g=="
|
|
9
9
|
}
|