qlogicagent 2.20.6 → 2.20.7
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/README.md +27 -54
- package/dist/agent-contract.js +1 -1
- package/dist/agent.js +42 -41
- package/dist/cli.js +1 -1
- package/dist/host-contract.js +1 -1
- package/dist/index.js +539 -565
- package/dist/orchestration.js +14 -14
- package/dist/project-memory-host.js +30 -33
- package/dist/protocol.js +1 -1
- package/dist/types/agent/memory-recall-context.d.ts +7 -0
- package/dist/types/agent/tool-loop/artifact-final-contract.d.ts +2 -0
- package/dist/types/agent/tool-loop/direct-response-contract.d.ts +12 -0
- package/dist/types/agent/tool-loop/final-status-stream-suppressor.d.ts +22 -0
- package/dist/types/agent/tool-loop/loop-helpers.d.ts +2 -2
- package/dist/types/agent/tool-loop.d.ts +5 -1
- package/dist/types/agent/types.d.ts +27 -15
- package/dist/types/cli/acp-commands.d.ts +1 -1
- package/dist/types/cli/acp-extended-handlers.d.ts +13 -3
- package/dist/types/cli/agent-runtime-session-state.d.ts +1 -0
- package/dist/types/cli/base-tool-bootstrap.d.ts +0 -7
- package/dist/types/cli/community-skill-installer.d.ts +2 -0
- package/dist/types/cli/core-tool-coordinator.d.ts +0 -3
- package/dist/types/cli/core-tools/registry.d.ts +1 -4
- package/dist/types/cli/handlers/config-handler.d.ts +0 -1
- package/dist/types/cli/handlers/goal-handler.d.ts +24 -0
- package/dist/types/cli/handlers/memory-handler.d.ts +1 -2
- package/dist/types/cli/handlers/skill-curator-handler.d.ts +8 -0
- package/dist/types/cli/handlers/turn-handler.d.ts +9 -12
- package/dist/types/cli/memory-candidate-service.d.ts +1 -8
- package/dist/types/cli/memory-coordinator.d.ts +1 -13
- package/dist/types/cli/product-acp-params.d.ts +1 -0
- package/dist/types/cli/provider-core-facade.d.ts +2 -30
- package/dist/types/cli/rpc-registry.d.ts +2 -4
- package/dist/types/cli/runtime-hook-bootstrap.d.ts +1 -2
- package/dist/types/cli/stdio-acp-request-host.d.ts +1 -2
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +0 -2
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +0 -7
- package/dist/types/cli/stdio-runtime-services.d.ts +1 -8
- package/dist/types/cli/stdio-server.d.ts +0 -4
- package/dist/types/cli/tool-bootstrap-core-registration.d.ts +0 -4
- package/dist/types/cli/tool-bootstrap.d.ts +0 -17
- package/dist/types/contracts/memory-recall-packet.d.ts +31 -0
- package/dist/types/contracts/memory-response-contract.d.ts +2 -0
- package/dist/types/contracts/tool-execution-evidence.d.ts +8 -0
- package/dist/types/contracts/tool-name.d.ts +10 -0
- package/dist/types/contracts/turn-event.d.ts +36 -3
- package/dist/types/host-contract/acp-content.d.ts +45 -0
- package/dist/types/host-contract/index.d.ts +59 -48
- package/dist/types/orchestration/agent-instance.d.ts +21 -1
- package/dist/types/orchestration/agent-roster.d.ts +14 -15
- package/dist/types/orchestration/dag-scheduler.d.ts +4 -0
- package/dist/types/orchestration/goal-context-envelope.d.ts +7 -0
- package/dist/types/orchestration/goal-loop-coordinator.d.ts +55 -12
- package/dist/types/orchestration/goal-mode-adapters.d.ts +13 -1
- package/dist/types/orchestration/goal-run-persistence.d.ts +9 -2
- package/dist/types/orchestration/goal-run-types.d.ts +127 -13
- package/dist/types/orchestration/index.d.ts +1 -1
- package/dist/types/orchestration/product-persistence.d.ts +10 -1
- package/dist/types/orchestration/product-planner.d.ts +3 -3
- package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +1 -0
- package/dist/types/orchestration/workflow/data-item.d.ts +1 -1
- package/dist/types/orchestration/workflow/expression.d.ts +1 -2
- package/dist/types/orchestration/workflow/workflow-patch.d.ts +1 -2
- package/dist/types/orchestration/workflow/workflow-render.d.ts +1 -2
- package/dist/types/project-memory-host.d.ts +1 -0
- package/dist/types/protocol/agent-contract.d.ts +10 -8
- package/dist/types/protocol/methods.d.ts +2 -19
- package/dist/types/protocol/notifications.d.ts +1 -1
- package/dist/types/protocol/wire/acp-agent-management.d.ts +48 -6
- package/dist/types/protocol/wire/acp-protocol.d.ts +11 -24
- package/dist/types/protocol/wire/agent-methods.d.ts +5 -142
- package/dist/types/protocol/wire/chat-types.d.ts +50 -0
- package/dist/types/protocol/wire/index.d.ts +2 -2
- package/dist/types/protocol/wire/notification-payloads.d.ts +73 -122
- package/dist/types/protocol/wire/thread-protocol.d.ts +4 -40
- package/dist/types/runtime/community/community-consent-client.d.ts +0 -13
- package/dist/types/runtime/context/context-compression-strategies.d.ts +29 -0
- package/dist/types/runtime/context/context-envelope.d.ts +3 -0
- package/dist/types/runtime/execution/dream-agent.d.ts +4 -5
- package/dist/types/runtime/execution/mcp-capability-selection.d.ts +54 -0
- package/dist/types/runtime/execution/memory-decay.d.ts +1 -1
- package/dist/types/runtime/execution/search-result-quality.d.ts +22 -0
- package/dist/types/runtime/execution/streaming-tool-executor.d.ts +2 -0
- package/dist/types/runtime/execution/tool-result-storage.d.ts +44 -0
- package/dist/types/runtime/hooks/memory-hooks.d.ts +3 -2
- package/dist/types/runtime/infra/agent-paths.d.ts +0 -8
- package/dist/types/runtime/infra/default-path-service.d.ts +0 -2
- package/dist/types/runtime/infra/llmrouter-managed-inference.d.ts +54 -1
- package/dist/types/runtime/infra/media-persistence.d.ts +6 -36
- package/dist/types/runtime/memory/implicit-extraction.d.ts +7 -15
- package/dist/types/runtime/memory/memory-recall-attribution.d.ts +24 -0
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +14 -0
- package/dist/types/runtime/ports/index.d.ts +1 -3
- package/dist/types/runtime/ports/memory-provider.d.ts +2 -19
- package/dist/types/runtime/ports/memory-writer.d.ts +1 -1
- package/dist/types/runtime/ports/path-service.d.ts +0 -2
- package/dist/types/runtime/prompt/capability-routing-policy.d.ts +13 -0
- package/dist/types/runtime/prompt/environment-context.d.ts +3 -6
- package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +8 -13
- package/dist/types/runtime/prompt/tool-necessity-policy.d.ts +12 -0
- package/dist/types/skills/mcp/mcp-manager.d.ts +29 -4
- package/dist/types/skills/memory/host-memory-provider.d.ts +3 -9
- package/dist/types/skills/memory/memdir.d.ts +1 -1
- package/dist/types/skills/memory/memory-content-safety.d.ts +1 -0
- package/dist/types/skills/permissions/hook-runner.d.ts +3 -3
- package/dist/types/skills/portable-tool.d.ts +5 -0
- package/dist/types/skills/skill-system/skill-lifecycle.d.ts +1 -0
- package/dist/types/skills/tools/exec-tool.d.ts +1 -5
- package/dist/types/skills/tools/shell/command-compatibility.d.ts +3 -0
- package/dist/types/skills/tools/shell/index.d.ts +4 -3
- package/dist/types/skills/tools/shell/shell-exec.d.ts +15 -8
- package/dist/types/skills/tools/shell/shell-provider.d.ts +26 -0
- package/dist/types/transport/acp-server.d.ts +4 -1
- package/dist/types/transport/host-community-client.d.ts +0 -1
- package/dist/types/transport/host-request-client.d.ts +1 -0
- package/dist/types/transport/host-run-state-client.d.ts +1 -1
- package/dist/workflow-host.js +6 -6
- package/package.json +4 -3
- package/dist/skills/mcp/astraclaw-native-mcp-server.js +0 -12
- package/dist/types/cli/core-tools/checkpoint-tool-bootstrap.d.ts +0 -9
- package/dist/types/cli/core-tools/checkpoint-tool-service.d.ts +0 -7
- package/dist/types/cli/core-tools/config-tool-bootstrap.d.ts +0 -7
- package/dist/types/cli/core-tools/config-tool-service.d.ts +0 -13
- package/dist/types/cli/core-tools/monitor-tool-bootstrap.d.ts +0 -7
- package/dist/types/cli/core-tools/monitor-tool-service.d.ts +0 -6
- package/dist/types/cli/dev-tool-bootstrap.d.ts +0 -9
- package/dist/types/cli/dev-tools/dev-tool-bootstrap-service.d.ts +0 -7
- package/dist/types/cli/dev-tools/dev-tool-registry.d.ts +0 -8
- package/dist/types/cli/dev-tools/incremental-repo-map.d.ts +0 -81
- package/dist/types/cli/dev-tools/lsp-supervisor.d.ts +0 -59
- package/dist/types/cli/dev-tools/lsp-tool-service.d.ts +0 -7
- package/dist/types/cli/handlers/media-handler.d.ts +0 -19
- package/dist/types/cli/handlers/skills-handler.d.ts +0 -37
- package/dist/types/cli/industrial-runtime-store.d.ts +0 -16
- package/dist/types/cli/media-capability-schema.d.ts +0 -49
- package/dist/types/cli/media-file-api-service.d.ts +0 -73
- package/dist/types/cli/media-file-tool-service.d.ts +0 -13
- package/dist/types/cli/media-inline.d.ts +0 -31
- package/dist/types/cli/media-runtime-facade.d.ts +0 -51
- package/dist/types/cli/media-understanding.d.ts +0 -102
- package/dist/types/cli/skill-invocation-service.d.ts +0 -10
- package/dist/types/cli/skill-tools-bootstrap.d.ts +0 -35
- package/dist/types/cli/skills-query-service.d.ts +0 -41
- package/dist/types/cli/tool-bootstrap-media-registration.d.ts +0 -20
- package/dist/types/cli/turn-media-setup.d.ts +0 -34
- package/dist/types/cli/turn-preview-browser-setup.d.ts +0 -15
- package/dist/types/runtime/infra/astraclaw-capabilities.d.ts +0 -33
- package/dist/types/runtime/infra/builtin-skills-seed.d.ts +0 -31
- package/dist/types/runtime/infra/checkpoint-backend.d.ts +0 -9
- package/dist/types/runtime/infra/industrial-runtime-session-server.d.ts +0 -20
- package/dist/types/runtime/infra/migrate-project-skills.d.ts +0 -24
- package/dist/types/runtime/infra/project-skill-manifest.d.ts +0 -21
- package/dist/types/runtime/infra/skill-resolver.d.ts +0 -74
- package/dist/types/runtime/infra/worktree-backend.d.ts +0 -86
- package/dist/types/runtime/ports/checkpoint-contracts.d.ts +0 -19
- package/dist/types/runtime/ports/worktree-contracts.d.ts +0 -22
- package/dist/types/skills/mcp/astraclaw-native-mcp-server.d.ts +0 -1
- package/dist/types/skills/memory/memory-tool.d.ts +0 -87
- package/dist/types/skills/tools/checkpoint-tool.d.ts +0 -66
- package/dist/types/skills/tools/config-tool.d.ts +0 -61
- package/dist/types/skills/tools/file-management-tool.d.ts +0 -90
- package/dist/types/skills/tools/image-generate-tool.d.ts +0 -98
- package/dist/types/skills/tools/instructions-tool.d.ts +0 -65
- package/dist/types/skills/tools/lsp-tool.d.ts +0 -153
- package/dist/types/skills/tools/media-cancel-tool.d.ts +0 -30
- package/dist/types/skills/tools/media-understand-tool.d.ts +0 -28
- package/dist/types/skills/tools/monitor-tool.d.ts +0 -113
- package/dist/types/skills/tools/music-generate-tool.d.ts +0 -80
- package/dist/types/skills/tools/notebook-edit-tool.d.ts +0 -15
- package/dist/types/skills/tools/preview-browser-tool.d.ts +0 -136
- package/dist/types/skills/tools/repo-map-tool.d.ts +0 -52
- package/dist/types/skills/tools/skill-tool.d.ts +0 -142
- package/dist/types/skills/tools/sleep-tool.d.ts +0 -49
- package/dist/types/skills/tools/stt-tool.d.ts +0 -33
- package/dist/types/skills/tools/subagent-decision-tool.d.ts +0 -15
- package/dist/types/skills/tools/three-d-generate-tool.d.ts +0 -46
- package/dist/types/skills/tools/tts-tool.d.ts +0 -50
- package/dist/types/skills/tools/video-edit-tool.d.ts +0 -72
- package/dist/types/skills/tools/video-generate-tool.d.ts +0 -162
- package/dist/types/skills/tools/video-merge-tool.d.ts +0 -105
- package/dist/types/skills/tools/video-upscale-tool.d.ts +0 -45
- package/dist/types/skills/tools/voice-clone-tool.d.ts +0 -40
- package/dist/types/skills/tools/worktree-tool.d.ts +0 -69
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qlogicagent",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.7",
|
|
4
4
|
"description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -135,9 +135,11 @@
|
|
|
135
135
|
"benchmark:multi-session-live:resume": "tsx benchmarks/multi-session-real/live-runner.ts --resume",
|
|
136
136
|
"benchmark:subagent-delegation-live": "tsx benchmarks/subagent-delegation/live-runner.ts",
|
|
137
137
|
"benchmark:workflow-authoring": "tsx benchmarks/workflow-authoring/runner.ts",
|
|
138
|
+
"benchmark:goal-long-horizon": "tsx benchmarks/goal-long-horizon/runner.ts",
|
|
138
139
|
"check": "node scripts/run-check.mjs",
|
|
139
140
|
"test:watch": "vitest",
|
|
140
141
|
"benchmark:hermes-superiority": "tsx benchmarks/hermes-superiority/runner.ts",
|
|
142
|
+
"benchmark:product-blackbox": "tsx benchmarks/product-blackbox/runner.ts",
|
|
141
143
|
"lint": "oxlint .",
|
|
142
144
|
"check:encoding-corruption": "node scripts/check-encoding-corruption.mjs",
|
|
143
145
|
"check:mechanical-rules": "node scripts/check-mechanical-rules.mjs",
|
|
@@ -173,8 +175,7 @@
|
|
|
173
175
|
"nanoid": "^5.1.5",
|
|
174
176
|
"pino": "^9.6.0",
|
|
175
177
|
"pino-pretty": "^13.0.0",
|
|
176
|
-
"typescript": "^5.9.3"
|
|
177
|
-
"typescript-language-server": "5.3.0"
|
|
178
|
+
"typescript": "^5.9.3"
|
|
178
179
|
},
|
|
179
180
|
"devDependencies": {
|
|
180
181
|
"@types/better-sqlite3": "^7.6.13",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createInterface as Ze}from"node:readline";import{existsSync as Xe,readFileSync as et}from"node:fs";import{readFileSync as Se}from"node:fs";import{randomUUID as Te}from"node:crypto";import{readdirSync as Mt,readFileSync as Rt,statSync as se,writeFileSync as Et}from"node:fs";import{readdir as ie,readFile as ae,stat as le,writeFile as ce}from"node:fs/promises";import{join as d}from"node:path";import{homedir as X}from"node:os";import{join as u}from"node:path";import{existsSync as yt}from"node:fs";import{createHash as ct}from"node:crypto";import{resolve as dt}from"node:path";var P=".qlogicagent";function p(){return process.env.QLOGICAGENT_HOME||u(X(),P)}function v(){return u(p(),"skills")}function C(){return u(p(),"mcp.json")}function ee(t){if(!t)throw new Error("getProjectAgentDir: cwd is required (must not fall back to process.cwd())");return u(t,P)}function x(t){return u(ee(t),"skills-disabled.json")}import{readFileSync as te,writeFileSync as Tt,mkdirSync as wt,renameSync as kt}from"node:fs";import{dirname as Pt,join as re}from"node:path";function f(){return{version:1,disabled:[]}}function oe(t){let e;try{e=te(t,"utf8")}catch(n){return n.code==="ENOENT"?{list:f(),corrupt:!1}:(console.error(`[project-skill-manifest] Cannot read skill mute list at ${t} (${n instanceof Error?n.message:String(n)}); treating it as empty for reads \u2014 muted skills may reactivate.`),{list:f(),corrupt:!0})}let r;try{r=JSON.parse(e)}catch(n){return console.error(`[project-skill-manifest] Skill mute list at ${t} is corrupted (${n instanceof Error?n.message:String(n)}); treating it as empty for reads \u2014 muted skills may reactivate.`),{list:f(),corrupt:!0}}return!r||typeof r!="object"||!Array.isArray(r.disabled)?(console.error(`[project-skill-manifest] Skill mute list at ${t} has an unexpected shape; treating it as empty for reads \u2014 muted skills may reactivate.`),{list:f(),corrupt:!0}):{list:{version:1,disabled:[...new Set(r.disabled.filter(n=>typeof n=="string"&&n.trim().length>0))]},corrupt:!1}}function A(t){return oe(t).list}function ne(){return re(p(),"skills-disabled.json")}function M(){return new Set(A(ne()).disabled)}function R(t){return new Set(A(x(t)).disabled)}var ue=["auto-skill-","test-skill-"],de=".skills_prompt_snapshot.json";function me(t){return ue.some(e=>t.startsWith(e))}function pe(t){let e=t.replace(/\r\n/g,`
|
|
3
|
-
`),r=e.match(/^---\n[\s\S]*?^version:\s*(\S+)/m),o=e.match(/^---\n[\s\S]*?^category:\s*(.+)/m),n=e.match(/^---\n[\s\S]*?^author:\s*(.+)/m),i=e.match(/^---\n[\s\S]*?^requires:\s*(.+)/m),s=e.match(/^---\n[\s\S]*?^environments:\s*(.+)/m),a=e.match(/^---\n([\s\S]*?)\n---/)?.[1]??"";return{version:r?.[1],description:fe(a),category:o?.[1]?.trim()||void 0,author:n?.[1]?.trim()||void 0,requiredTools:D(i?.[1]),environments:D(s?.[1])}}function fe(t){let e=t.split(`
|
|
4
|
-
`),r=e.findIndex(s=>/^description:/.test(s));if(r===-1)return;let o=e[r].replace(/^description:[ \t]*/,"").trim(),n=/^[>|][+-]?$/.test(o),i=[];!n&&o&&i.push(o);for(let s=r+1;s<e.length;s++){let a=e[s];if(!/^[ \t]/.test(a))break;let l=a.trim();l&&i.push(l)}if(i.length!==0)return i.join(" ").replace(/^["']|["']$/g,"").trim()||void 0}var E=new Map,b=new Map;function ge(t,e,r,o){let n=e.has(t.name),i=r.has(t.name),s=!ve(t.meta,o);return{name:t.name,filePath:t.filePath,baseDir:t.baseDir,globallyDisabled:n,projectDisabled:i,active:!n&&!i&&!s,systemGenerated:t.systemGenerated,description:t.meta.description,version:t.meta.version,category:t.meta.category,author:t.meta.author,requiredTools:t.meta.requiredTools,environments:t.meta.environments}}async function he(t){let e;try{e=await ie(t,{withFileTypes:!0})}catch{e=[]}let r=[];for(let s of e){if(!s.isDirectory()||s.name.startsWith("."))continue;let a=d(t,s.name),l=d(a,"SKILL.md");try{let y=await le(l);if(!y.isFile())continue;r.push({name:s.name,filePath:l,baseDir:a,mtimeMs:y.mtimeMs,size:y.size})}catch{continue}}r.sort((s,a)=>s.name.localeCompare(a.name));let o=r.map(s=>`${s.name}:${s.mtimeMs}:${s.size}`).join("|"),n=E.get(t);if(n&&n.fingerprint===o)return n.raw;let i=[];for(let s of r){let a;try{a=await ae(s.filePath,"utf8")}catch{continue}i.push({name:s.name,filePath:s.filePath,baseDir:s.baseDir,systemGenerated:me(s.name),mtimeMs:s.mtimeMs,size:s.size,meta:pe(a)})}return E.set(t,{fingerprint:o,raw:i}),be(t,i),i}async function ye(t,e){let r=v(),o=M(),n=t?R(t):new Set,i=b.get(r);return i||(i=he(r).finally(()=>b.delete(r)),b.set(r,i)),(await i).map(a=>ge(a,o,n,e))}async function I(t,e){return(await ye(t,e)).filter(r=>r.active)}function j(t){let e=v(),r=d(e,t),o=d(r,"SKILL.md");try{if(se(o).isFile())return{baseDir:r,filePath:o}}catch{}return null}function D(t){if(!t)return;let e=t.replace(/^\[|\]$/g,"").split(/[,\s]+/).map(r=>r.replace(/^["']|["']$/g,"").trim()).filter(Boolean);return e.length>0?e:void 0}function ve(t,e){if(t.environments&&e?.currentEnvironment&&!t.environments.includes(e.currentEnvironment))return!1;if(t.requiredTools){if(!e?.availableToolNames)return!1;let r=new Set(e.availableToolNames);return t.requiredTools.every(o=>r.has(o))}return!0}async function be(t,e){try{let o={version:1,entries:e.map(n=>({name:n.name,size:n.size,mtimeMs:n.mtimeMs,description:n.meta.description,version:n.meta.version,requiredTools:n.meta.requiredTools,environments:n.meta.environments}))};await ce(d(t,de),JSON.stringify(o,null,2),"utf8")}catch{}}var L="astraclaw_capabilities";async function O(t){if(t.tool==="skills_list")return{handled:!0,result:{skills:(await I(t.projectRoot,{availableToolNames:t.availableToolNames,currentEnvironment:t.currentEnvironment??process.platform})).map(we)}};if(t.tool==="skill_view"){let e=typeof t.args.name=="string"?t.args.name.trim():"";if(!e)throw new Error("skill_view requires a skill name");let r=j(e);if(!r)throw new Error(`Skill not found: ${e}`);return{handled:!0,result:{name:e,content:Se(r.filePath,"utf8")}}}if(t.tool==="mcp_connectors_list"){let e=t.mcpServerFailures??[],r=e.length>0?{failedServers:e,note:`${e.length} configured MCP server(s) are unavailable this session; their tools are missing from this list.`}:{};if(!t.toolCatalog)return{handled:!0,result:{tools:[],note:"AstraClaw MCP connector catalog is not attached to this capability server instance.",...e.length>0?{failedServers:e}:{}}};let o=t.toolCatalog.getToolManifest().filter(n=>n.function.name.startsWith("mcp__")).map(n=>({toolName:n.function.name,server:_e(n.function.name),name:Pe(n.function.name),description:n.function.description,inputSchema:n.function.parameters}));return{handled:!0,result:{tools:o,count:o.length,...r}}}if(t.tool==="mcp_tool_call"){if(!t.toolCatalog)throw new Error("AstraClaw MCP connector catalog is not attached");let e=typeof t.args.toolName=="string"?t.args.toolName.trim():"";if(!e.startsWith("mcp__"))throw new Error("mcp_tool_call requires a connector toolName returned by mcp_connectors_list");let r=t.toolCatalog.findTool(e);if(!r?.execute)throw new Error(`MCP connector tool not found or not executable: ${e}`);let o=ke(t.args.args),n=`astraclaw_mcp_${Te().slice(0,8)}`,i=await r.execute(n,o);return{handled:!0,result:{toolName:e,content:i.content,details:i.details,imageUrls:i.imageUrls}}}return{handled:!1}}function we(t){return{name:t.name,description:t.description,version:t.version,category:t.category,requiredTools:t.requiredTools,environments:t.environments}}function ke(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{}}function _e(t){let e=t.split("__");return e.length>=3?e[1]??"":""}function Pe(t){let e=t.split("__");return e.length>=3?e.slice(2).join("__"):t}import m from"node:path";import{fileURLToPath as Re}from"node:url";import{createRuntime as Ee}from"mcporter";var $=new Set(["gateway","agents_list","session_status","sessions_send","sessions_list","sessions_history","sessions_spawn","cron","config","workflow","subagent_decision"]),Ce=new Set([...$,"agent"]);function N(t){return t?.riskLevel?t.riskLevel:t?.isDangerous?"system":t?.isReadOnly?"read":t?.isEgress?"external_egress":"write"}var S=class{toolPool=new Map;setTools(e){this.toolPool.clear();for(let r of e)this.toolPool.set(r.name,r)}addTool(e){this.toolPool.set(e.name,e)}addTools(e){for(let r of e)this.addTool(r)}removeTool(e){return this.toolPool.delete(e)}findTool(e){return this.toolPool.get(e)}hasTool(e){return this.toolPool.has(e)}getToolNames(){return Array.from(this.toolPool.keys())}getToolCount(){return this.toolPool.size}async executeTool(e,r,o,n){let i=this.toolPool.get(e);if(!i)throw new Error(`Tool not found: ${e}`);return i.execute(r,o,n)}getTools(){return Array.from(this.toolPool.values()).filter(e=>e.isEnabled?.()!==!1)}getToolManifest(){let e=[];for(let r of this.toolPool.values()){if(r.isEnabled?.()===!1)continue;let o=N(r);e.push({type:"function",function:{name:r.name,description:r.description,parameters:r.parameters},meta:{category:r.category??"other",displayName:r.displayName??{key:`capability.tool.${r.name}.name`,fallback:r.label},displayDescription:r.displayDescription??{key:`capability.tool.${r.name}.description`,fallback:""},parallelSafe:r.isConcurrencySafe??!1,riskLevel:o,isReadOnly:o==="read",isDangerous:o==="system",isDelete:r.isDelete??!1,isEgress:r.isEgress??o==="external_egress",egressCarriesData:r.egressCarriesData??!1,...r.executionTimeoutMs!==void 0?{executionTimeoutMs:r.executionTimeoutMs}:{}}})}return e}},F=new S;function U(t){F.addTools(t)}function q(t){return F.removeTool(t)}var xe=new Set(["describe","fetch","find","get","inspect","list","query","read","search","stat"]),Ae=new Set(["append","copy","create","delete","edit","move","patch","remove","rename","set","update","upload","write"]);function G(t){let e=t.annotations,r=Me(t.name),o=r.some(l=>Ae.has(l)),n=r.some(l=>xe.has(l)),i=e?.destructiveHint===!0||o,s=e?.readOnlyHint===!0||!i&&n,a=s||e?.idempotentHint===!0&&!i;return{isReadOnly:s,isConcurrencySafe:a,isDestructive:i}}function Me(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}var w=12e4,z=1e3,W=9e5;function De(t){if(t===void 0)return w;if(!Number.isInteger(t)||t<z||t>W)throw new RangeError(`MCP callTimeoutMs must be an integer between ${z} and ${W}`);return t}var g=3,Ie=1e3;async function je(t,e){let r=e.sleep??(i=>new Promise(s=>setTimeout(s,i))),o=Math.max(1,e.attempts),n;for(let i=1;i<=o;i++)try{return await t()}catch(s){n=s,i<o&&(e.onRetry?.(i,s),await r(e.baseDelayMs*i))}throw n}var h=class{runtime=null;definitions=[];toolsByServer=new Map;injectedNames=new Set;log;workspaceRoot;toolCatalog;serverToolFilters=new Map;serverOAuth=new Map;serverCallTimeouts=new Map;failedServers=new Map;constructor(e){this.log=e.log??{info:()=>{},warn:()=>{}},this.workspaceRoot=e.workspaceRoot?m.resolve(e.workspaceRoot):void 0,this.toolCatalog=e.toolCatalog,this.definitions=e.servers.filter(r=>!r.disabled).filter(r=>{let o=Ve(r);for(let n of o)this.log.warn(`[mcp] rejected server "${r.name}": ${n.message}`);return r.tools&&this.serverToolFilters.set(r.name,r.tools),r.oauth===!0&&this.serverOAuth.set(r.name,!0),this.serverCallTimeouts.set(r.name,De(r.callTimeoutMs)),o.length===0}).map(r=>this.toServerDefinition(r)).filter(r=>r!==null)}markServerFailed(e,r,o){this.failedServers.set(e,{name:e,phase:r,error:o}),console.error(`[mcp] server "${e}" unavailable this session (${r}): ${o}`)}toServerDefinition(e){if((e.type??(e.url?"http":"stdio"))==="http"){if(!e.url)return this.log.warn(`[mcp] server "${e.name}" is type "http" but has no url, skipping`),this.markServerFailed(e.name,"config",'type "http" but no url'),null;let o;try{o=new URL(e.url)}catch{return this.log.warn(`[mcp] server "${e.name}" has an invalid url "${e.url}", skipping`),this.markServerFailed(e.name,"config",`invalid url "${e.url}"`),null}return{name:e.name,command:{kind:"http",url:o,headers:e.headers}}}return e.command?{name:e.name,command:{kind:"stdio",command:e.command,args:e.args??[],cwd:e.cwd??this.workspaceRoot??process.cwd()},env:e.env}:(this.log.warn(`[mcp] server "${e.name}" is type "stdio" but has no command, skipping`),this.markServerFailed(e.name,"config",'type "stdio" but no command'),null)}async connectAll(){this.definitions.length!==0&&(this.runtime=await Ee({servers:this.definitions,clientInfo:{name:"qlogicagent",version:"1.0.0"},logger:{info:e=>this.log.info(`[mcp] ${e}`),warn:e=>this.log.warn(`[mcp] ${e}`),error:(e,r)=>this.log.warn(`[mcp] ${e}${r?` (${r instanceof Error?r.message:String(r)})`:""}`),debug:()=>{}}}),await Promise.allSettled(this.definitions.map(async e=>{try{let r=await je(()=>this.runtime.listTools(e.name,{includeSchema:!0,disableOAuth:this.serverOAuth.get(e.name)!==!0}),{attempts:g,baseDelayMs:Ie,onRetry:(n,i)=>this.log.warn(`[mcp] connect attempt ${n}/${g} for ${e.name} failed, retrying: ${i instanceof Error?i.message:i}`)}),o=J(r,this.serverToolFilters.get(e.name));this.toolsByServer.set(e.name,o),this.failedServers.delete(e.name),this.log.info(`[mcp] connected to ${e.name} (${o.length}/${r.length} tools)`)}catch(r){this.log.warn(`[mcp] failed to connect to ${e.name} after ${g} attempts: ${r instanceof Error?r.message:r}`),this.markServerFailed(e.name,"connect",`${r instanceof Error?r.message:String(r)} (after ${g} attempts)`)}})))}injectTools(){for(let[e,r]of this.toolsByServer){let o=this.injectPortableTools(e,r);this.log.info(`[mcp] injected ${o.length} tools from ${e}`)}}async refreshServerTools(e){if(!this.runtime)throw new Error("MCP runtime is not connected");let r=await this.runtime.listTools(e,{includeSchema:!0,disableOAuth:this.serverOAuth.get(e)!==!0}),o=J(r,this.serverToolFilters.get(e));return this.toolsByServer.set(e,o),this.failedServers.delete(e),this.retractServerTools(e),this.injectPortableTools(e,o),o.length}getConnectedServers(){return Array.from(this.toolsByServer.keys())}getFailedServers(){return Array.from(this.failedServers.values())}getToolCount(){let e=0;for(let r of this.toolsByServer.values())e+=r.length;return e}async disconnectAll(){for(let r of this.injectedNames)this.removeRegisteredTool(r);this.injectedNames.clear(),this.toolsByServer.clear(),this.failedServers.clear();let e=this.runtime;if(this.runtime=null,e)try{await e.close()}catch{}}toPortableTool(e,r){let o=G({name:r.name,description:r.description});return{name:`mcp__${B(e)}__${r.name}`,label:`[${e}] ${r.name}`,category:"mcp",description:r.description??`MCP tool from ${e}`,parameters:r.inputSchema??{type:"object",properties:{}},isConcurrencySafe:o.isConcurrencySafe,isReadOnly:o.isReadOnly,isDestructive:o.isDestructive,searchHint:`mcp ${e} ${r.name.replace(/[_-]+/g," ")}`,executionTimeoutMs:this.serverCallTimeouts.get(e)??w,execute:async(n,i)=>{let s=this.runtime;if(!s)return{content:[{type:"text",text:`MCP server "${e}" is not connected.`}],details:{error:"mcp_not_connected"}};try{let a=await s.callTool(e,r.name,{args:i,timeoutMs:this.serverCallTimeouts.get(e)??w});return Le(a)}catch(a){let l=a instanceof Error?a.message:String(a);return{content:[{type:"text",text:`MCP tool error: ${l}`}],details:{error:l}}}}}}wrapToolsForWorkspaceBoundary(e){return this.workspaceRoot?e.map(r=>{if(!r.execute)return r;let o=r.execute;return{...r,execute:async(n,i,s)=>{let a=$e(r.name,i,this.workspaceRoot);return a?{content:[{type:"text",text:a}],details:{type:"mcp",error:"workspace_boundary"}}:o(n,i,s)}}}):e}injectPortableTools(e,r){let o=this.wrapToolsForWorkspaceBoundary(r.map(n=>this.toPortableTool(e,n)));this.registerTools(o);for(let n of o)this.injectedNames.add(n.name);return o}retractServerTools(e){let r=`mcp__${B(e)}__`;for(let o of[...this.injectedNames])o.startsWith(r)&&(this.removeRegisteredTool(o),this.injectedNames.delete(o))}registerTools(e){this.toolCatalog?this.toolCatalog.addTools(e):U(e)}removeRegisteredTool(e){return this.toolCatalog?.removeTool(e)??q(e)}};function Le(t){let e=t&&typeof t=="object"?t:{},o=(Array.isArray(e.content)?e.content:[]).filter(a=>!!a&&typeof a=="object"),n=o.filter(a=>a.type==="text"&&typeof a.text=="string").map(a=>a.text),i=o.filter(a=>!(a.type==="text"&&typeof a.text=="string")).map(a=>typeof a.type=="string"&&a.type?a.type:"unknown"),s=n.join(`
|
|
5
|
-
`);if(i.length>0){let a=[...new Set(i)].join(", ");s=s?`${s}
|
|
6
|
-
|
|
7
|
-
[${i.length} non-text blocks omitted: ${a}]`:`[output contains only non-text blocks: ${a}]`}return{content:[{type:"text",text:s||"(no text output)"}],...e.isError?{details:{error:"mcp_tool_error"}}:{}}}function B(t){return t.replace(/[^a-zA-Z0-9_]/g,"_").toLowerCase()}var Oe=/(?:^|_)(path|paths|file|files|filename|filenames|dir|dirs|directory|directories|folder|folders|cwd|root|uri)(?:$|_)/i;function $e(t,e,r){if(!r)return null;for(let o of k(e)){let n=Ue(o.value,r);if(n&&!qe(n.candidate,n.root,n.pathApi))return`Blocked: MCP tool "${t}" path "${o.value}" is outside the workspace boundary "${n.root}"`}return null}function k(t,e="",r=0){if(r>8)return[];if(typeof t=="string")return Ne(e,t)?[{key:e,value:t}]:[];if(Array.isArray(t))return t.flatMap(n=>k(n,e,r+1));if(!t||typeof t!="object")return[];let o=[];for(let[n,i]of Object.entries(t))o.push(...k(i,n,r+1));return o}function Ne(t,e){if(!Oe.test(t))return!1;let r=e.trim();return!r||/^https?:\/\//i.test(r)?!1:Fe(r)}function Fe(t){return m.isAbsolute(t)||/^[A-Za-z]:[\\/]/.test(t)||/^\\\\/.test(t)||/^file:\/\//i.test(t)||t.includes("../")||t.includes("..\\")||t.startsWith(".\\")||t.startsWith("./")||t.includes("/")||t.includes("\\")}function Ue(t,e){let r=t.trim();if(/^file:\/\//i.test(r))try{r=Re(r)}catch{return null}let o=H(r)||H(e)?m.win32:m,n=o.resolve(e);return{candidate:o.isAbsolute(r)?o.resolve(r):o.resolve(n,r),root:n,pathApi:o}}function qe(t,e,r){let o=r.relative(e,t);return o===""||!o.startsWith("..")&&!r.isAbsolute(o)}function H(t){return/^[A-Za-z]:[\\/]/.test(t)||/^\\\\/.test(t)}function Q(t){if(!t||typeof t!="object")return[];let e=t,r=[],o=e.mcpServers??e.servers??e;for(let[n,i]of Object.entries(o)){if(!i||typeof i!="object")continue;let s=i;if(typeof s.url=="string"){r.push({name:n,type:"http",url:s.url,headers:s.headers&&typeof s.headers=="object"?s.headers:void 0,disabled:s.disabled===!0,oauth:s.oauth===!0,tools:V(s.tools),callTimeoutMs:typeof s.callTimeoutMs=="number"?s.callTimeoutMs:void 0});continue}typeof s.command=="string"&&r.push({name:n,type:"stdio",command:s.command,args:Array.isArray(s.args)?s.args:void 0,env:s.env&&typeof s.env=="object"?s.env:void 0,cwd:typeof s.cwd=="string"?s.cwd:void 0,disabled:s.disabled===!0,oauth:s.oauth===!0,tools:V(s.tools),callTimeoutMs:typeof s.callTimeoutMs=="number"?s.callTimeoutMs:void 0})}return r}function J(t,e){let r=new Set(e?.include??[]),o=new Set(e?.exclude??[]);return t.filter(n=>r.size>0&&!r.has(n.name)?!1:!o.has(n.name))}function V(t){if(!t||typeof t!="object")return;let e=t,r=K(e.include),o=K(e.exclude);if(!(!r&&!o))return{...r?{include:r}:{},...o?{exclude:o}:{}}}function K(t){if(!Array.isArray(t))return;let e=t.filter(r=>typeof r=="string"&&r.trim().length>0);return e.length>0?e:void 0}var Ge=new Set(["bash","sh","zsh","fish","cmd","cmd.exe","powershell","powershell.exe","pwsh","pwsh.exe"]),ze=new Set(["-c","/c","-command","-encodedcommand","-e"]),We=["curl","wget","invokewebrequest","invoke-restmethod","iwr","irm","nc","netcat"],Be=["env","processenv","apikey","api_key","token","secret","credential","credentials","awsaccesskey","awssecret"],He=["authorizedkeys","sshknownhosts","crontab","launchctl","schtasks","startup","runkey","runonce","bashrc","profile"],Je=/\bssh-(?:rsa|ed25519|ecdsa-[^\s]+)\s+[A-Za-z0-9+/=]{40,}/i;function Ve(t){let e=[],r=[t.command??"",...t.args??[],...Object.keys(t.env??{}),...Object.values(t.env??{})].join(`
|
|
8
|
-
`);if(Je.test(r)&&e.push({code:"ioc_public_key",message:"configuration contains an inline SSH public key IOC"}),(t.type??(t.url?"http":"stdio"))!=="stdio"||!Ke(t.command))return e;let o=Qe(t.args??[]);if(!o)return e;let n=Ye(o);return T(n,He)&&e.push({code:"persistence",message:"stdio shell command attempts a persistence write"}),T(n,We)&&T(n,Be)&&e.push({code:"dangerous_egress",message:"stdio shell command combines network egress with likely secret access"}),e}function Ke(t){if(!t)return!1;let e=m.basename(t).toLowerCase();return Ge.has(e)}function Qe(t){for(let e=0;e<t.length;e++){let r=t[e]?.toLowerCase();if(r&&ze.has(r))return t.slice(e+1).join(" ")}return""}function Ye(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"")}function T(t,e){return e.some(r=>t.includes(r))}var tt=[{name:"skills_list",description:"List AstraClaw skills active for the current workspace.",inputSchema:{type:"object",properties:{},additionalProperties:!1}},{name:"skill_view",description:"Read the full SKILL.md instructions for one AstraClaw skill.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Skill name from skills_list."}},required:["name"],additionalProperties:!1}},{name:"mcp_connectors_list",description:"List MCP connector tools installed in AstraClaw's Plugins page and shared with this external agent.",inputSchema:{type:"object",properties:{},additionalProperties:!1}},{name:"mcp_tool_call",description:"Call one AstraClaw shared MCP connector tool by toolName from mcp_connectors_list.",inputSchema:{type:"object",properties:{toolName:{type:"string",description:"Connector tool name, for example mcp__filesystem__read_text_file."},args:{type:"object",description:"Arguments for the connector tool."}},required:["toolName"],additionalProperties:!1}}],_=class{tools=new Map;findTool(e){return this.tools.get(e)}getToolManifest(){return Array.from(this.tools.values()).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.parameters}}))}getToolNames(){return Array.from(this.tools.keys())}setTools(e){this.tools.clear(),this.addTools(e)}addTool(e){this.tools.set(e.name,e)}addTools(e){for(let r of e)this.addTool(r)}removeTool(e){return this.tools.delete(e)}},c=null,rt=Ze({input:process.stdin,crlfDelay:Number.POSITIVE_INFINITY});rt.on("line",t=>{ot(t)});async function ot(t){let e=t.trim();if(!e)return;let r;try{r=JSON.parse(e)}catch{return}if(r.id===void 0||r.id===null)return r.method==="notifications/initialized",void 0;try{let o=await nt(r);Z({jsonrpc:"2.0",id:r.id,result:o})}catch(o){Z({jsonrpc:"2.0",id:r.id,error:{code:-32603,message:o instanceof Error?o.message:String(o)}})}}async function nt(t){switch(t.method){case"initialize":return{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:L,version:"1.0.0"}};case"tools/list":return{tools:tt};case"tools/call":{let e=Y(t.params),r=typeof e.name=="string"?e.name:"",o=Y(e.arguments),n=st(),i=r==="mcp_connectors_list"||r==="mcp_tool_call"?await it(n):void 0,s=await O({tool:r,args:o,projectRoot:n,toolCatalog:i,mcpServerFailures:i?c?.manager?.getFailedServers():void 0});if(!s.handled)throw new Error(`Unknown tool: ${r}`);return{content:[{type:"text",text:JSON.stringify(s.result)}]}}default:throw new Error(`Unknown method: ${t.method}`)}}function st(){return process.env.ASTRACLAW_PROJECT_ROOT||process.env.QLOGICAGENT_PROJECT_ROOT||process.cwd()}async function it(t){if(c?.projectRoot===t)return await c.ready,c.catalog;c?.manager?.disconnectAll().catch(()=>{});let e=new _,r=new h({servers:at(),workspaceRoot:t,toolCatalog:e,log:{info:n=>process.stderr.write(`${n}
|
|
9
|
-
`),warn:n=>process.stderr.write(`${n}
|
|
10
|
-
`)}}),o=r.connectAll().then(()=>r.injectTools());return c={projectRoot:t,catalog:e,manager:r,ready:o},await o,e}function at(){let t=process.env.ASTRACLAW_MCP_CONFIG_PATH||C();if(!Xe(t))return[];try{let e=et(t,"utf8").replace(/^\uFEFF/,"");return Q(JSON.parse(e))}catch(e){return process.stderr.write(`[astraclaw-native-mcp] failed to read MCP config: ${e instanceof Error?e.message:String(e)}
|
|
11
|
-
`),[]}}function Y(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{}}function Z(t){process.stdout.write(`${JSON.stringify(t)}
|
|
12
|
-
`)}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ToolCatalog } from "../../runtime/ports/index.js";
|
|
2
|
-
export interface CheckpointToolRegistrationDeps {
|
|
3
|
-
config: Record<string, unknown>;
|
|
4
|
-
toolCatalog: ToolCatalog;
|
|
5
|
-
host: {
|
|
6
|
-
readonly currentSessionId: string;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export declare function registerCheckpointTool({ config, host, toolCatalog }: CheckpointToolRegistrationDeps): void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CheckpointBackend } from "../../runtime/ports/index.js";
|
|
2
|
-
export interface CheckpointToolServiceOptions {
|
|
3
|
-
config: Record<string, unknown>;
|
|
4
|
-
sessionId: string;
|
|
5
|
-
cwd?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function createCheckpointToolService(options: CheckpointToolServiceOptions): CheckpointBackend;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ToolCatalog } from "../../runtime/ports/index.js";
|
|
2
|
-
import type { HostProfileClient } from "../../transport/host-profile-client.js";
|
|
3
|
-
export interface ConfigToolRegistrationDeps {
|
|
4
|
-
toolCatalog: ToolCatalog;
|
|
5
|
-
resolveHostProfileClient?: () => HostProfileClient | undefined;
|
|
6
|
-
}
|
|
7
|
-
export declare function registerConfigTool({ toolCatalog, resolveHostProfileClient }: ConfigToolRegistrationDeps): void;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Config tool service — a thin compute-side proxy over the gateway-owned tunable store.
|
|
3
|
-
*
|
|
4
|
-
* Defaults/coercion/validation come from the public qlogicagent/tunables contract. Persistent
|
|
5
|
-
* overrides are read and mutated only through HostProfileClient's private X7 profile service.
|
|
6
|
-
* The agent never reads or writes settings.json and has no local fallback.
|
|
7
|
-
*/
|
|
8
|
-
import type { ConfigToolDeps } from "../../skills/tools/config-tool.js";
|
|
9
|
-
import type { HostProfileClient } from "../../transport/host-profile-client.js";
|
|
10
|
-
export interface ConfigToolServiceOptions {
|
|
11
|
-
resolveHostProfileClient?: () => HostProfileClient | undefined;
|
|
12
|
-
}
|
|
13
|
-
export declare function createConfigToolService(options?: ConfigToolServiceOptions): ConfigToolDeps;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ToolCatalog } from "../../runtime/ports/index.js";
|
|
2
|
-
import type { AgentLogger } from "../../agent/types.js";
|
|
3
|
-
export interface MonitorToolRegistrationDeps {
|
|
4
|
-
log: AgentLogger;
|
|
5
|
-
toolCatalog: ToolCatalog;
|
|
6
|
-
}
|
|
7
|
-
export declare function registerMonitorTool({ log, toolCatalog }: MonitorToolRegistrationDeps): void;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { AgentLogger } from "../../agent/types.js";
|
|
2
|
-
import type { MonitorToolDeps } from "../../skills/tools/monitor-tool.js";
|
|
3
|
-
export interface MonitorToolService extends MonitorToolDeps {
|
|
4
|
-
dispose(): void;
|
|
5
|
-
}
|
|
6
|
-
export declare function createMonitorToolService(log: AgentLogger): MonitorToolService;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ToolCatalog } from "../runtime/ports/index.js";
|
|
2
|
-
export interface DevToolBootstrapDeps {
|
|
3
|
-
config: Record<string, unknown>;
|
|
4
|
-
/** Immutable project root resolved for the canonical session/turn. */
|
|
5
|
-
workdir: string;
|
|
6
|
-
toolCatalog: ToolCatalog;
|
|
7
|
-
}
|
|
8
|
-
export declare const devToolRegistrationModule: import("../runtime/ports/tool-contracts.js").ToolRegistrationModule<DevToolBootstrapDeps>;
|
|
9
|
-
export declare function configureDevToolBootstrap(deps: DevToolBootstrapDeps): void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ToolCatalog } from "../../runtime/ports/index.js";
|
|
2
|
-
export interface DevToolBootstrapServiceDeps {
|
|
3
|
-
workdir: string;
|
|
4
|
-
config?: Record<string, unknown>;
|
|
5
|
-
toolCatalog: ToolCatalog;
|
|
6
|
-
}
|
|
7
|
-
export declare function registerDevTools(deps: DevToolBootstrapServiceDeps): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createLspTool } from "../../skills/tools/lsp-tool.js";
|
|
2
|
-
import { createRepoMapTool } from "../../skills/tools/repo-map-tool.js";
|
|
3
|
-
export interface DevToolRegistryOptions {
|
|
4
|
-
workdir: string;
|
|
5
|
-
config?: Record<string, unknown>;
|
|
6
|
-
}
|
|
7
|
-
export type DevTool = ReturnType<typeof createRepoMapTool> | ReturnType<typeof createLspTool>;
|
|
8
|
-
export declare function buildDevTools(options: DevToolRegistryOptions): DevTool[];
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import type { RepoMapQuery, RepoMapResult } from "../../skills/tools/repo-map-tool.js";
|
|
2
|
-
export type RepoMapChangeType = "created" | "modified" | "deleted";
|
|
3
|
-
export interface RepoMapWatcher {
|
|
4
|
-
on(event: "error", listener: (error: Error) => void): RepoMapWatcher;
|
|
5
|
-
close(): void;
|
|
6
|
-
}
|
|
7
|
-
export type RepoMapWatchFactory = (root: string, options: {
|
|
8
|
-
recursive: true;
|
|
9
|
-
persistent: false;
|
|
10
|
-
}, listener: (eventType: "rename" | "change", filename: string | Buffer | null) => void) => RepoMapWatcher;
|
|
11
|
-
export interface IncrementalRepoMapOptions {
|
|
12
|
-
workspaceRoot: string;
|
|
13
|
-
maxFileBytes?: number;
|
|
14
|
-
maxIndexedFiles?: number;
|
|
15
|
-
maxTotalBytes?: number;
|
|
16
|
-
maxScanMs?: number;
|
|
17
|
-
maxDepth?: number;
|
|
18
|
-
idleTimeoutMs?: number;
|
|
19
|
-
now?: () => number;
|
|
20
|
-
watch?: boolean;
|
|
21
|
-
watchFactory?: RepoMapWatchFactory;
|
|
22
|
-
}
|
|
23
|
-
export declare class IncrementalRepoMap {
|
|
24
|
-
private readonly workspaceRoot;
|
|
25
|
-
private readonly maxFileBytes;
|
|
26
|
-
private readonly maxIndexedFiles;
|
|
27
|
-
private readonly maxTotalBytes;
|
|
28
|
-
private readonly maxScanMs;
|
|
29
|
-
private readonly maxDepth;
|
|
30
|
-
private readonly idleTimeoutMs;
|
|
31
|
-
private readonly now;
|
|
32
|
-
private readonly watchEnabled;
|
|
33
|
-
private readonly watchFactory;
|
|
34
|
-
private readonly abortController;
|
|
35
|
-
private workspaceRealPathPromise?;
|
|
36
|
-
private readonly pending;
|
|
37
|
-
private files;
|
|
38
|
-
private watcher?;
|
|
39
|
-
private watcherReliable;
|
|
40
|
-
private watcherWarning?;
|
|
41
|
-
private nextWatchRetryAt;
|
|
42
|
-
private forceFullRequested;
|
|
43
|
-
private initialized;
|
|
44
|
-
private generation;
|
|
45
|
-
private indexPartial;
|
|
46
|
-
private indexWarning?;
|
|
47
|
-
private disposed;
|
|
48
|
-
private refreshPromise?;
|
|
49
|
-
private activeQueries;
|
|
50
|
-
private idleTimer?;
|
|
51
|
-
constructor(options: IncrementalRepoMapOptions);
|
|
52
|
-
markChanged(filePath: string, changeType?: RepoMapChangeType): void;
|
|
53
|
-
getMap(query?: RepoMapQuery): Promise<RepoMapResult>;
|
|
54
|
-
releaseIdleResources(): void;
|
|
55
|
-
dispose(): void;
|
|
56
|
-
private beginQuery;
|
|
57
|
-
private finishQuery;
|
|
58
|
-
private scheduleIdleRelease;
|
|
59
|
-
private clearIdleTimer;
|
|
60
|
-
private tryStartWatcher;
|
|
61
|
-
private invalidateWatcher;
|
|
62
|
-
private maybeRebuildWatcher;
|
|
63
|
-
private refresh;
|
|
64
|
-
private runRefresh;
|
|
65
|
-
private applyIncrementalWithFallback;
|
|
66
|
-
private applyIncremental;
|
|
67
|
-
private buildFullIndex;
|
|
68
|
-
private scanDirectory;
|
|
69
|
-
private loadPath;
|
|
70
|
-
private createScanBudget;
|
|
71
|
-
private checkScanTime;
|
|
72
|
-
private reserveIndexedFile;
|
|
73
|
-
private stopScan;
|
|
74
|
-
private commitFullIndex;
|
|
75
|
-
private canonicalPathInsideWorkspace;
|
|
76
|
-
private getWorkspaceRealPath;
|
|
77
|
-
private throwIfAborted;
|
|
78
|
-
private takePending;
|
|
79
|
-
private restorePending;
|
|
80
|
-
private toRelativePath;
|
|
81
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { type ChildProcessWithoutNullStreams } from "node:child_process";
|
|
2
|
-
import type { LspOperation, LspResult } from "../../skills/tools/lsp-tool.js";
|
|
3
|
-
export interface LspServerDefinition {
|
|
4
|
-
id: string;
|
|
5
|
-
command: string;
|
|
6
|
-
args?: readonly string[];
|
|
7
|
-
extensions: readonly string[];
|
|
8
|
-
languageId: string | ((filePath: string) => string);
|
|
9
|
-
env?: NodeJS.ProcessEnv;
|
|
10
|
-
}
|
|
11
|
-
export interface LspSpawnOptions {
|
|
12
|
-
cwd: string;
|
|
13
|
-
env: NodeJS.ProcessEnv;
|
|
14
|
-
stdio: ["pipe", "pipe", "pipe"];
|
|
15
|
-
shell: false;
|
|
16
|
-
windowsHide: true;
|
|
17
|
-
}
|
|
18
|
-
export type LspSpawnFactory = (command: string, args: readonly string[], options: LspSpawnOptions) => ChildProcessWithoutNullStreams;
|
|
19
|
-
export interface LspSupervisorOptions {
|
|
20
|
-
serverDefinitions: readonly LspServerDefinition[];
|
|
21
|
-
spawn?: LspSpawnFactory;
|
|
22
|
-
requestTimeoutMs?: number;
|
|
23
|
-
shutdownTimeoutMs?: number;
|
|
24
|
-
idleTimeoutMs?: number;
|
|
25
|
-
stderrTailBytes?: number;
|
|
26
|
-
diagnosticSettleMs?: number;
|
|
27
|
-
}
|
|
28
|
-
export interface LspSupervisorOperationParams {
|
|
29
|
-
workspaceRoot: string;
|
|
30
|
-
operation: LspOperation;
|
|
31
|
-
filePath: string;
|
|
32
|
-
line?: number;
|
|
33
|
-
character?: number;
|
|
34
|
-
newName?: string;
|
|
35
|
-
includeContext?: boolean;
|
|
36
|
-
}
|
|
37
|
-
export interface LspSupervisor {
|
|
38
|
-
executeOperation(params: LspSupervisorOperationParams, signal?: AbortSignal): Promise<LspResult>;
|
|
39
|
-
supportedLanguages(): string[];
|
|
40
|
-
dispose(): Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
export type LspSupervisorErrorCode = "LSP_SERVER_NOT_CONFIGURED" | "LSP_PATH_OUTSIDE_WORKSPACE" | "LSP_DIAGNOSTICS_UNAVAILABLE" | "LSP_FILE_TOO_LARGE" | "LSP_SUPERVISOR_DISPOSED" | "LSP_PROCESS_ERROR" | "LSP_PROCESS_EXIT" | "LSP_PROTOCOL_ERROR" | "LSP_REQUEST_ABORTED" | "LSP_REQUEST_TIMEOUT" | "LSP_RESPONSE_ERROR";
|
|
43
|
-
export interface LspErrorDiagnostics {
|
|
44
|
-
serverId?: string;
|
|
45
|
-
command?: string;
|
|
46
|
-
pid?: number;
|
|
47
|
-
exitCode?: number | null;
|
|
48
|
-
signal?: NodeJS.Signals | null;
|
|
49
|
-
stderrTail?: string;
|
|
50
|
-
method?: string;
|
|
51
|
-
data?: unknown;
|
|
52
|
-
}
|
|
53
|
-
export declare class LspSupervisorError extends Error {
|
|
54
|
-
readonly code: LspSupervisorErrorCode;
|
|
55
|
-
readonly diagnostics: LspErrorDiagnostics;
|
|
56
|
-
constructor(code: LspSupervisorErrorCode, message: string, diagnostics?: LspErrorDiagnostics);
|
|
57
|
-
}
|
|
58
|
-
export declare function buildDefaultLspServerDefinitions(): LspServerDefinition[];
|
|
59
|
-
export declare function createLspSupervisor(options: LspSupervisorOptions): LspSupervisor;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { LspToolDeps } from "../../skills/tools/lsp-tool.js";
|
|
2
|
-
import type { LspSupervisor } from "./lsp-supervisor.js";
|
|
3
|
-
export interface LspToolServiceOptions {
|
|
4
|
-
workdir: string;
|
|
5
|
-
supervisor?: LspSupervisor;
|
|
6
|
-
}
|
|
7
|
-
export declare function createLspToolDeps(options: LspToolServiceOptions): LspToolDeps;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Media handlers — extracted from StdioServer.
|
|
3
|
-
* Handles: media.listModels, media.cancel, media.status, media.stt
|
|
4
|
-
*/
|
|
5
|
-
import { type MediaClient } from "../provider-core-facade.js";
|
|
6
|
-
import { type AgentRpcError, type AgentRpcRequest } from "../../protocol/wire/index.js";
|
|
7
|
-
export interface MediaHandlerHost {
|
|
8
|
-
mediaClient?: Pick<MediaClient, "getTransport" | "listMediaModels"> | null;
|
|
9
|
-
sendResponse(id: string | number, result?: unknown, error?: AgentRpcError): void;
|
|
10
|
-
}
|
|
11
|
-
export declare function handleMediaListModels(this: MediaHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
12
|
-
export declare function handleMediaCancel(this: MediaHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
13
|
-
export declare function handleMediaStatus(this: MediaHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* `media.stt` — Speech-to-text transcription.
|
|
16
|
-
* Accepts base64-encoded audio, calls the designated STT provider (zhipu GLM-ASR-2512).
|
|
17
|
-
* This is a non-session utility: no turn/session is created.
|
|
18
|
-
*/
|
|
19
|
-
export declare function handleMediaStt(this: MediaHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skills management handlers — extracted from StdioServer.
|
|
3
|
-
* Handles: skills.list, skills.activate, skills.deactivate, skills.delete,
|
|
4
|
-
* skills.promote, skills.stats, skills.pin, skills.unpin,
|
|
5
|
-
* skills.curator, skills.lifecycle
|
|
6
|
-
*/
|
|
7
|
-
import { type AgentRpcError, type AgentRpcRequest } from "../../protocol/wire/index.js";
|
|
8
|
-
import type { HostCapabilityClient } from "../../transport/host-capability-client.js";
|
|
9
|
-
export interface SkillsHandlerHost {
|
|
10
|
-
projectLocator?: {
|
|
11
|
-
resolveProjectRoot(projectId: string): string | undefined;
|
|
12
|
-
};
|
|
13
|
-
getActiveProjectRoot(): string;
|
|
14
|
-
getHostCapabilityClient(): HostCapabilityClient | undefined;
|
|
15
|
-
sendNotification(method: string, params: Record<string, unknown>): void;
|
|
16
|
-
sendResponse(id: string | number, result?: unknown, error?: AgentRpcError): void;
|
|
17
|
-
}
|
|
18
|
-
export declare function extractSkillMeta(skillMdPath: string): {
|
|
19
|
-
version?: string;
|
|
20
|
-
description?: string;
|
|
21
|
-
};
|
|
22
|
-
export declare function handleSkillsList(this: SkillsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
23
|
-
export declare function handleSkillsActivate(this: SkillsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
24
|
-
export declare function handleSkillsDeactivate(this: SkillsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
25
|
-
export declare function handleSkillsDelete(this: SkillsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
26
|
-
export declare function handleSkillsPromote(this: SkillsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Per-project opt-out: mute (or un-mute) a globally-installed skill in ONE project so the agent
|
|
29
|
-
* doesn't see it there — cuts context and mis-triggering without uninstalling the skill. The file
|
|
30
|
-
* stays in the global store and stays active in every other project. This is the "本项目技能" toggle.
|
|
31
|
-
*/
|
|
32
|
-
export declare function handleSkillsSetProjectDisabled(this: SkillsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
33
|
-
export declare function handleSkillsStats(this: SkillsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
34
|
-
export declare function handleSkillsPin(this: SkillsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
35
|
-
export declare function handleSkillsUnpin(this: SkillsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
36
|
-
export declare function handleSkillsCurator(this: SkillsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
37
|
-
export declare function handleSkillsLifecycle(this: SkillsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
interface ActiveRuntimeEntry {
|
|
2
|
-
version: string;
|
|
3
|
-
entrypoint: string;
|
|
4
|
-
}
|
|
5
|
-
export interface ValidatedActiveIndustrialRuntime extends ActiveRuntimeEntry {
|
|
6
|
-
absoluteEntrypoint: string;
|
|
7
|
-
}
|
|
8
|
-
export interface IndustrialRuntimeStoreOptions {
|
|
9
|
-
rootDir?: string;
|
|
10
|
-
}
|
|
11
|
-
/** Read-only projection of the Runtime-owned industrial runtime store. */
|
|
12
|
-
export declare function industrialRuntimeRoot(): string;
|
|
13
|
-
export declare function runtimeEntrypoint(runtimeId: string, options?: IndustrialRuntimeStoreOptions): Promise<string | undefined>;
|
|
14
|
-
export declare function activeIndustrialRuntime(runtimeId: string, options?: IndustrialRuntimeStoreOptions): Promise<ValidatedActiveIndustrialRuntime | undefined>;
|
|
15
|
-
export declare function runtimePathEntries(options?: IndustrialRuntimeStoreOptions): Promise<string[]>;
|
|
16
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { MediaCapability, MediaRequest } from "./provider-core-facade.js";
|
|
2
|
-
export type MediaMode = "text2image" | "img2img" | "inpainting" | "outpainting" | "text2video" | "img2video" | "first_last_frame" | "video2video" | "multimodal_reference" | "edit" | "merge" | "upscale" | "extend" | "text2music" | "cover" | "realtime" | "text2speech" | "voice_clone" | "text2_3d" | "img2_3d" | "speech2text";
|
|
3
|
-
export interface MediaCapabilityLimits {
|
|
4
|
-
sizes?: string[];
|
|
5
|
-
resolutions?: string[];
|
|
6
|
-
aspectRatios?: string[];
|
|
7
|
-
fps?: number[];
|
|
8
|
-
durationSeconds?: {
|
|
9
|
-
min?: number;
|
|
10
|
-
max?: number;
|
|
11
|
-
};
|
|
12
|
-
maxReferenceImages?: number;
|
|
13
|
-
maxReferenceVideos?: number;
|
|
14
|
-
maxReferenceAudios?: number;
|
|
15
|
-
maxSourceVideos?: number;
|
|
16
|
-
maxOutputs?: number;
|
|
17
|
-
voices?: string[];
|
|
18
|
-
maxCharacters?: number;
|
|
19
|
-
formats?: string[];
|
|
20
|
-
outputFormats?: string[];
|
|
21
|
-
}
|
|
22
|
-
export interface MediaCapabilityFeatures {
|
|
23
|
-
transparentBackground?: boolean;
|
|
24
|
-
generateAudio?: boolean;
|
|
25
|
-
returnLastFrame?: boolean;
|
|
26
|
-
serviceTiers?: string[];
|
|
27
|
-
videoTools?: string[];
|
|
28
|
-
}
|
|
29
|
-
export interface NormalizedMediaCapabilitySchema {
|
|
30
|
-
mediaType: MediaCapability;
|
|
31
|
-
modes: MediaMode[];
|
|
32
|
-
declaredModes: MediaMode[];
|
|
33
|
-
limits: MediaCapabilityLimits;
|
|
34
|
-
features: MediaCapabilityFeatures;
|
|
35
|
-
source: "declared" | "fallback";
|
|
36
|
-
raw?: Record<string, unknown>;
|
|
37
|
-
}
|
|
38
|
-
export type MediaCapabilityDecision = {
|
|
39
|
-
allowed: true;
|
|
40
|
-
mode: MediaMode;
|
|
41
|
-
reason?: undefined;
|
|
42
|
-
} | {
|
|
43
|
-
allowed: false;
|
|
44
|
-
mode: MediaMode;
|
|
45
|
-
reason: string;
|
|
46
|
-
};
|
|
47
|
-
export declare function normalizeMediaCapabilitySchema(mediaType: MediaCapability, rawCapabilities: unknown): NormalizedMediaCapabilitySchema;
|
|
48
|
-
export declare function resolveMediaCapabilityDecision(request: MediaRequest, schema: NormalizedMediaCapabilitySchema): MediaCapabilityDecision;
|
|
49
|
-
export declare function buildMediaToolParameterSchema(toolName: string, baseSchema: Record<string, unknown>, capability: NormalizedMediaCapabilitySchema): Record<string, unknown>;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { type MediaCapability, type VolcengineFileTransport } from "./provider-core-facade.js";
|
|
2
|
-
export interface MediaFileApiProvider {
|
|
3
|
-
id: string;
|
|
4
|
-
type: "volcengine" | "gemini";
|
|
5
|
-
}
|
|
6
|
-
export interface MediaFileServiceContext {
|
|
7
|
-
mediaClient: {
|
|
8
|
-
getTransport(providerId: string): unknown;
|
|
9
|
-
} | undefined;
|
|
10
|
-
mediaProviders: Partial<Record<MediaCapability, {
|
|
11
|
-
provider: string;
|
|
12
|
-
model: string;
|
|
13
|
-
}>>;
|
|
14
|
-
mediaApiKeys: Record<string, string>;
|
|
15
|
-
}
|
|
16
|
-
export interface MediaFileUploadInput {
|
|
17
|
-
buffer: Buffer;
|
|
18
|
-
filename: string;
|
|
19
|
-
mimeType: string;
|
|
20
|
-
bytes: number;
|
|
21
|
-
purpose?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface MediaFileUploadResult {
|
|
24
|
-
fileId: string;
|
|
25
|
-
url?: string;
|
|
26
|
-
filename: string;
|
|
27
|
-
bytes: number;
|
|
28
|
-
provider: string;
|
|
29
|
-
}
|
|
30
|
-
export interface MediaFileInfo {
|
|
31
|
-
id: string;
|
|
32
|
-
filename: string;
|
|
33
|
-
bytes: number;
|
|
34
|
-
status: string;
|
|
35
|
-
createdAt?: string;
|
|
36
|
-
url?: string;
|
|
37
|
-
}
|
|
38
|
-
interface GeminiFileInfo {
|
|
39
|
-
name: string;
|
|
40
|
-
uri?: string;
|
|
41
|
-
state?: string;
|
|
42
|
-
displayName?: string;
|
|
43
|
-
sizeBytes?: string | number;
|
|
44
|
-
createTime?: string;
|
|
45
|
-
}
|
|
46
|
-
interface GeminiFileApiClient {
|
|
47
|
-
uploadFile(buffer: Buffer, apiKey: string, options: {
|
|
48
|
-
mimeType: string;
|
|
49
|
-
displayName: string;
|
|
50
|
-
}): Promise<GeminiFileInfo>;
|
|
51
|
-
waitForProcessing(fileName: string, apiKey: string): Promise<GeminiFileInfo>;
|
|
52
|
-
getFile(fileId: string, apiKey: string): Promise<GeminiFileInfo>;
|
|
53
|
-
listFiles(apiKey: string, options: {
|
|
54
|
-
pageSize: number;
|
|
55
|
-
}): Promise<{
|
|
56
|
-
files: GeminiFileInfo[];
|
|
57
|
-
}>;
|
|
58
|
-
deleteFile(fileId: string, apiKey: string): Promise<void>;
|
|
59
|
-
}
|
|
60
|
-
export interface MediaFileApiServiceDeps {
|
|
61
|
-
createGeminiFileApi?: () => GeminiFileApiClient;
|
|
62
|
-
isVolcengineFileTransport?: (transport: unknown) => transport is VolcengineFileTransport;
|
|
63
|
-
}
|
|
64
|
-
export interface MediaFileApiService {
|
|
65
|
-
resolveProvider(context: MediaFileServiceContext): MediaFileApiProvider | undefined;
|
|
66
|
-
uploadFile(context: MediaFileServiceContext, input: MediaFileUploadInput): Promise<MediaFileUploadResult>;
|
|
67
|
-
queryFile(context: MediaFileServiceContext, fileId: string): Promise<MediaFileInfo>;
|
|
68
|
-
listFiles(context: MediaFileServiceContext, limit: number): Promise<MediaFileInfo[]>;
|
|
69
|
-
deleteFile(context: MediaFileServiceContext, fileId: string): Promise<void>;
|
|
70
|
-
}
|
|
71
|
-
export declare function createMediaFileApiService(deps?: MediaFileApiServiceDeps): MediaFileApiService;
|
|
72
|
-
export declare const defaultMediaFileApiService: MediaFileApiService;
|
|
73
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { FileDeleteToolDeps, FileQueryToolDeps, FileUploadToolDeps } from "../skills/tools/file-management-tool.js";
|
|
2
|
-
import { type MediaFileApiService, type MediaFileServiceContext } from "./media-file-api-service.js";
|
|
3
|
-
export interface MediaFileToolServiceOptions {
|
|
4
|
-
getContext(): MediaFileServiceContext;
|
|
5
|
-
resolvePath(filePath: string): string;
|
|
6
|
-
mediaFileApiService?: MediaFileApiService;
|
|
7
|
-
maxUploadBytes?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface MediaFileToolService extends FileUploadToolDeps, FileQueryToolDeps, FileDeleteToolDeps {
|
|
10
|
-
isAvailable(): boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function createMediaFileToolService(options: MediaFileToolServiceOptions): MediaFileToolService;
|
|
13
|
-
export declare function isMediaFileApiAvailable(context: MediaFileServiceContext, apiService?: MediaFileApiService): boolean;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolve a media reference into a form a REMOTE model can consume, by rewriting a LOCAL file path to
|
|
3
|
-
* the gateway's `/api/media/local?src=file://…` proxy URL.
|
|
4
|
-
*
|
|
5
|
-
* Why the proxy URL (not a raw path, not base64, not the provider file-API upload):
|
|
6
|
-
* - A tool result (e.g. the `read` tool reading a workspace image) carries a RAW local path
|
|
7
|
-
* (`C:\…\assets\images\x.jpg`) a remote model cannot fetch → the understanding model returns empty.
|
|
8
|
-
* - A base64 `data:` URL blows past the LLM gateway's request-size limit → HTTP 413.
|
|
9
|
-
* - The provider file-API upload (media-file-api-service) needs a Files-API provider that isn't always
|
|
10
|
-
* configured → "no provider".
|
|
11
|
-
* - The `127.0.0.1/api/media/local` proxy URL is exactly what user-attachments use: provider-core's
|
|
12
|
-
* FileUploadAdapter (given QLOGICAGENT_HUB_URL) relays it to hub OSS → a small public URL. Proven path.
|
|
13
|
-
*
|
|
14
|
-
* Remote (`http`/`https`/`data`/`blob`) URLs, non-media extensions, and missing files pass through
|
|
15
|
-
* unchanged. Never throws.
|
|
16
|
-
*/
|
|
17
|
-
export declare function resolveLocalMediaForModel(url: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Resolve an IMAGE reference for an understanding call, preferring a self-contained base64 `data:` URL
|
|
20
|
-
* for a small LOCAL image over the upload path. A local image inlined as base64 is delivered inside the
|
|
21
|
-
* request (the model provider fetches nothing), so it sidesteps the whole local→upload→OSS→signed-URL
|
|
22
|
-
* chain that a text main model's image understanding otherwise depends on (an unsigned private-OSS URL
|
|
23
|
-
* the provider 403s on is the classic silent-empty fault). Behavior:
|
|
24
|
-
* - `data:` URL → returned as-is (already inline).
|
|
25
|
-
* - public `http(s)`/`blob:` URL → returned as-is (the provider fetches it server-side).
|
|
26
|
-
* - LOCAL image (raw path / `file://` / the 127.0.0.1 media-proxy URL) within the inline ceiling →
|
|
27
|
-
* read + base64 `data:` URL.
|
|
28
|
-
* - LOCAL image over the ceiling (or unreadable) → fall back to resolveLocalMediaForModel (proxy/upload).
|
|
29
|
-
* Only images inline as base64 — video is far too large, so it always takes the URL path. Never throws.
|
|
30
|
-
*/
|
|
31
|
-
export declare function resolveImageForUnderstanding(url: string): string;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { type MediaCapability, type MediaClient, type MediaRequest, type MediaResult, type ProviderToolAPI } from "./provider-core-facade.js";
|
|
2
|
-
import type { MediaFileServiceContext } from "./media-file-api-service.js";
|
|
3
|
-
export interface MediaUsageCallbackEvent {
|
|
4
|
-
mediaType: string;
|
|
5
|
-
provider: string;
|
|
6
|
-
model: string;
|
|
7
|
-
billingUnit: string;
|
|
8
|
-
billingQuantity: number;
|
|
9
|
-
}
|
|
10
|
-
export interface MediaCapabilityCheckEvent {
|
|
11
|
-
mediaType: string;
|
|
12
|
-
provider: string;
|
|
13
|
-
model: string;
|
|
14
|
-
mode: string;
|
|
15
|
-
allowed: boolean;
|
|
16
|
-
reason?: string;
|
|
17
|
-
capabilities: {
|
|
18
|
-
modes: string[];
|
|
19
|
-
source: string;
|
|
20
|
-
limits: Record<string, unknown>;
|
|
21
|
-
features: Record<string, unknown>;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export declare function setProviderToolAPI(api: ProviderToolAPI | undefined): void;
|
|
25
|
-
export declare function getProviderToolAPI(): ProviderToolAPI | undefined;
|
|
26
|
-
export declare function setMediaClientConfig(client: MediaClient | undefined, apiKeys?: Record<string, string>, onMediaUsage?: (event: MediaUsageCallbackEvent) => void, providers?: Partial<Record<MediaCapability, {
|
|
27
|
-
provider: string;
|
|
28
|
-
model: string;
|
|
29
|
-
}>>, onMediaProgress?: (taskId: string, mediaType: string, percent: number, status: string, provider?: string) => void, onMediaCapabilityCheck?: (event: MediaCapabilityCheckEvent) => void): void;
|
|
30
|
-
export declare function getMediaRuntimeContext(): MediaFileServiceContext;
|
|
31
|
-
export declare function runWithMediaOutputDir<T>(outputDir: string | undefined, fn: () => Promise<T>): Promise<T>;
|
|
32
|
-
export declare function generateMedia(request: MediaRequest): Promise<MediaResult>;
|
|
33
|
-
/**
|
|
34
|
-
* Ensure an image size satisfies the resolved model's minimum resolution.
|
|
35
|
-
* Only applies to models with a known minimum (Volcengine Seedream); everything
|
|
36
|
-
* else is returned unchanged so providers that require small sizes (e.g. OpenAI
|
|
37
|
-
* 1024×1024) keep working. Sub-minimum "WxH" sizes are scaled up preserving
|
|
38
|
-
* aspect ratio; anything unparseable falls back to the always-valid named "2K".
|
|
39
|
-
*/
|
|
40
|
-
export declare function normalizeImageSize(size: string | undefined, providerId: string | undefined, modelId: string | undefined): string | undefined;
|
|
41
|
-
export declare function isMediaAvailable(mediaType: string): boolean;
|
|
42
|
-
export declare function isMediaOperationAvailable(mediaType: string, operation: string): boolean;
|
|
43
|
-
export declare function isMediaOperationDeclaredAvailable(mediaType: string, operation: string): boolean;
|
|
44
|
-
export declare function generateMusicLyrics(prompt: string): Promise<string>;
|
|
45
|
-
export declare function cancelMediaTask(params: {
|
|
46
|
-
taskId: string;
|
|
47
|
-
provider?: string;
|
|
48
|
-
}): Promise<{
|
|
49
|
-
ok: boolean;
|
|
50
|
-
message: string;
|
|
51
|
-
}>;
|