aws-runtime-bridge 1.9.169 → 1.9.170
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/CHANGELOG.md +33 -0
- package/dist/adapter/AcodeSdkAdapter.d.ts +46 -0
- package/dist/adapter/AcodeSdkAdapter.js +4 -4
- package/dist/adapter/ClaudeSdkAdapter.js +2 -2
- package/dist/adapter/types.d.ts +7 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.js +2 -2
- package/dist/index.js +1 -1
- package/dist/routes/agent-state.d.ts +2 -0
- package/dist/routes/agent-state.js +2 -0
- package/dist/routes/capabilities.js +1 -1
- package/dist/routes/debug-mount.d.ts +2 -0
- package/dist/routes/debug-mount.js +2 -0
- package/dist/routes/mcp.js +1 -1
- package/dist/routes/plugins.js +1 -1
- package/dist/routes/skills.js +1 -1
- package/dist/routes/terminal.js +28 -32
- package/dist/services/acode-bg-manager.d.ts +2 -0
- package/dist/services/agent-capability-sync.js +1 -1
- package/dist/services/debug-mount.d.ts +122 -0
- package/dist/services/debug-mount.js +2 -0
- package/dist/services/desktop-mcp-manager.js +1 -1
- package/dist/services/instance-ai-config-service.js +1 -1
- package/dist/services/instance-features.d.ts +4 -0
- package/dist/services/instance-features.js +1 -1
- package/dist/services/instance-init-service.js +1 -1
- package/dist/services/mcp-deploy.d.ts +31 -0
- package/dist/services/mcp-deploy.js +4 -3
- package/dist/services/mcp-env-injector.d.ts +24 -0
- package/dist/services/mcp-env-injector.js +1 -1
- package/dist/services/mcp-package.d.ts +35 -0
- package/dist/services/mcp-package.js +2 -0
- package/dist/services/mcp-probe-client.d.ts +25 -0
- package/dist/services/mcp-probe-client.js +2 -0
- package/dist/services/panel-env.d.ts +5 -0
- package/dist/services/panel-env.js +1 -1
- package/dist/services/plugin-deployment.d.ts +36 -0
- package/dist/services/plugin-deployment.js +3 -0
- package/dist/services/plugin-event-buffer.js +2 -1
- package/dist/services/plugin-fs.d.ts +5 -0
- package/dist/services/plugin-fs.js +2 -0
- package/dist/services/plugin-handler-adapter.d.ts +7 -0
- package/dist/services/plugin-handler-adapter.js +3 -0
- package/dist/services/plugin-listener-runner.d.ts +18 -0
- package/dist/services/plugin-listener-runner.js +8 -0
- package/dist/services/plugin-loader.d.ts +32 -0
- package/dist/services/plugin-loader.js +2 -0
- package/dist/services/plugin-manager.d.ts +17 -136
- package/dist/services/plugin-manager.js +4 -15
- package/dist/services/plugin-manifest.d.ts +83 -0
- package/dist/services/plugin-manifest.js +2 -0
- package/dist/services/plugin-runtime.d.ts +67 -0
- package/dist/services/plugin-runtime.js +1 -0
- package/dist/services/skill-manager.d.ts +15 -0
- package/dist/services/skill-manager.js +3 -2
- package/dist/types.d.ts +6 -0
- package/dist/utils/mcp-utils.js +1 -1
- package/package/acode/dist/compaction.d.ts +35 -1
- package/package/acode/dist/compaction.js +6 -6
- package/package/acode/dist/plugin-types.d.ts +6 -27
- package/package/acode/dist/runtime.d.ts +37 -0
- package/package/acode/dist/runtime.js +31 -30
- package/package/acode/dist/tool-group-manager.d.ts +10 -0
- package/package/acode/dist/tool-group-manager.js +5 -10
- package/package/acode/dist/types.d.ts +2 -0
- package/package/aws-client-agent-mcp/dist/ability-market-tools.d.ts +18 -0
- package/package/aws-client-agent-mcp/dist/ability-market-tools.js +2 -0
- package/package/aws-client-agent-mcp/dist/agent-client.d.ts +13 -4
- package/package/aws-client-agent-mcp/dist/agent-client.js +1 -1
- package/package/aws-client-agent-mcp/dist/http-client.d.ts +2 -0
- package/package/aws-client-agent-mcp/dist/http-client.js +1 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.d.ts +0 -7
- package/package/aws-client-agent-mcp/dist/mcp-server.js +12 -12
- package/package/aws-client-agent-mcp/dist/mcp-tools.d.ts +1 -0
- package/package/aws-client-agent-mcp/dist/mcp-tools.js +20 -20
- package/package/aws-client-agent-mcp/dist/memory-store.d.ts +1 -1
- package/package/aws-client-agent-mcp/dist/memory-store.js +2 -2
- package/package/aws-client-agent-mcp/dist/memory-tools.js +7 -7
- package/package/aws-client-agent-mcp/dist/tool-groups.js +2 -2
- package/package/aws-client-agent-mcp/dist/types.d.ts +0 -21
- package/package.json +3 -2
- package/dist/services/builtin-commands/create-plugin.md +0 -44
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type MemoryType = '
|
|
1
|
+
export type MemoryType = 'instance_memory' | 'instance_long_memory' | 'project_memory' | 'session_context';
|
|
2
2
|
|
|
3
3
|
export declare function normalizeBoundFilePath(filePath: string): string;
|
|
4
4
|
export interface MemoryRecord {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const E=["recently_memory","agent_memory","project_memory","session_context"],h=["recently_memory","agent_memory"],C=64,R=32,Y=128,$=64,P=1024;function L(y){const e=String(y||"").trim().replace(/\\/g,"/");if(!e)return e;const t=e.startsWith("@/")?e.substring(1):e;return t.startsWith("./")?t:`./${t.replace(/^\/+/,"")}`}class T extends Error{details;constructor(e,t){super(e),this.name="MemoryCapacityError",this.details=t}}const b=/^([a-zA-Z_][a-zA-Z0-9_]*):\/\/(.*)$/,g="local",S=50,x=10;function D(y){const e=(y||"").trim();return e?e.split("|").map(t=>t.trim()).filter(Boolean).map(t=>t.split(/\s+/).filter(Boolean)):[]}function O(y,e){return y.length===0?!1:y.some(t=>t.every(i=>e.includes(i)))}class p{storePath;domainJsonCache=new Map;constructor(e){this.storePath=e}nowIso(){return new Date().toISOString()}normalizeUri(e){const t=String(e||"").trim(),i=b.exec(t);if(!i)throw new Error(`Invalid memory uri: ${e}`);const o=i[1],r=i[2];if(!o||!r)throw new Error(`Invalid memory uri: ${e}`);const a=o.toLowerCase(),s=r.replace(/^\/+|\/+$/g,"");if(!s)throw new Error(`Invalid memory uri path: ${e}`);return{uri:`${a}://${s}`,domain:a,path:s}}normalizeMemoryType(e,t=E){const i=String(e||"").trim();if(!t.includes(i))throw new Error(`Invalid memory_type: ${e}`);return i}ensureTypeMatch(e,t){if(t&&e.memory_type!==t)throw new Error(`Memory type mismatch: expected ${t}, actual ${e.memory_type}`)}async ensureStoreDir(){const{mkdir:e}=await import("node:fs/promises");await e(this.storePath,{recursive:!0})}async loadMemoryFile(e){const{readFile:t}=await import("node:fs/promises");try{const i=await t(e,"utf-8"),o=JSON.parse(i),r=o.by_uri&&typeof o.by_uri=="object"?o.by_uri:{},a={};for(const[s,d]of Object.entries(r)){const n=this.normalizeMemoryType(d.memory_type||"project_memory"),l=this.normalizeUri(d.uri||s),m=d;let c=m.memory_status;c||(m.update_status==="updating"?c="updating":m.recall_status==="recalling"?c="recalling":c="normal");const u={...d};delete u.update_status,delete u.recall_status,a[l.uri]={...u,uri:l.uri,domain:l.domain,path:l.path,memory_type:n,memory_status:c}}return{by_uri:a}}catch{return{by_uri:{}}}}async loadData(){const{readdir:e}=await import("node:fs/promises"),t=await import("node:path");try{const i=await e(this.storePath,{withFileTypes:!0}),o={by_uri:{}};for(const r of i){if(!r.isFile()||!r.name.endsWith(".json"))continue;const a=await this.loadMemoryFile(t.join(this.storePath,r.name));Object.assign(o.by_uri,a.by_uri)}return o}catch{return{by_uri:{}}}}async writeJsonAtomically(e,t,i=JSON.stringify(t,null,2)){const{rename:o,rm:r,writeFile:a}=await import("node:fs/promises"),s=`${e}.${process.pid}.${Date.now()}.tmp`;try{await a(s,i,"utf-8"),await o(s,e)}catch(d){throw await r(s,{force:!0}),d}}async saveData(e){const{readFile:t,readdir:i,rm:o}=await import("node:fs/promises"),r=await import("node:path");await this.ensureStoreDir();const a=new Map;for(const n of Object.values(e.by_uri)){const l=a.get(n.domain)??{by_uri:{}};l.by_uri[n.uri]=n,a.set(n.domain,l)}for(const[n,l]of a.entries()){const m=r.join(this.storePath,`${n}.json`),c=JSON.stringify(l,null,2);if(this.domainJsonCache.get(m)===c)continue;let _;try{_=await t(m,"utf-8")}catch{_=void 0}if(_===c){this.domainJsonCache.set(m,c);continue}await this.writeJsonAtomically(m,l,c),this.domainJsonCache.set(m,c)}const s=new Set([...a.keys()].map(n=>`${n}.json`)),d=await i(this.storePath,{withFileTypes:!0});for(const n of d)if(n.isFile()&&n.name.endsWith(".json")&&!s.has(n.name)){const l=r.join(this.storePath,n.name);await o(l,{force:!0}),this.domainJsonCache.delete(l)}}createEmptyStats(){return{total:0,listable:{count:0,limit:64,hardLimit:128,exceeded:!1,hardExceeded:!1},by_type:{recently_memory:{count:0,limit:32,hardLimit:64,exceeded:!1,hardExceeded:!1,listable:!0,domainCount:0,by_domain:{}},agent_memory:{count:0,limit:32,hardLimit:64,exceeded:!1,hardExceeded:!1,listable:!0,domainCount:0,by_domain:{}},project_memory:{count:0,limit:null,hardLimit:null,exceeded:!1,hardExceeded:!1,listable:!1,domainCount:0,by_domain:{}},session_context:{count:0,limit:null,hardLimit:1024,exceeded:!1,hardExceeded:!1,listable:!1,domainCount:0,by_domain:{}}}}}calculateStats(e){const t=this.createEmptyStats();for(const i of Object.values(e.by_uri)){t.total+=1;const o=t.by_type[i.memory_type];o.count+=1;const r=d=>h.includes(d)?32:null,a=d=>h.includes(d)?64:d==="session_context"?1024:null,s=o.by_domain[i.domain]??{count:0,limit:r(i.memory_type),hardLimit:a(i.memory_type),exceeded:!1,hardExceeded:!1};s.count+=1,o.by_domain[i.domain]=s,h.includes(i.memory_type)&&(t.listable.count+=1)}t.listable.exceeded=t.listable.count>t.listable.limit,t.listable.hardExceeded=t.listable.count>=t.listable.hardLimit;for(const i of E){const o=t.by_type[i];o.domainCount=Object.keys(o.by_domain).length,o.limit!==null&&o.hardLimit!==null&&(o.exceeded=o.domainCount>o.limit,o.hardExceeded=o.domainCount>=o.hardLimit);for(const r of Object.values(o.by_domain))r.limit!==null&&r.hardLimit!==null&&(r.exceeded=r.count>r.limit,r.hardExceeded=r.count>=r.hardLimit)}return t}generateId(e){return`${e.replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}_${Date.now().toString(36)}`}ensureListableMemoryCapacity(e,t,i){if(!h.includes(t))return;const r=this.calculateStats(e).by_type[t],a=r.by_domain[i.domain];if(!a&&r.domainCount>=64)throw new T(`Cannot create ${t}: hard domain type limit 64 reached. Please delete an existing ${t} domain type before creating a new ${t}.`,{code:"MEMORY_TYPE_LIMIT_REACHED",memory_type:t,limit:64,current:r.domainCount,recommended_actions:[`list_memories({ memory_type: '${t}' })`,`delete_memory({ uri, memory_type: '${t}' })`]});if(a&&a.count>=64)throw new T(`Cannot create ${t}: hard memory limit 64 reached under domain ${i.domain}. Please delete or archive existing ${i.domain}://${t} memories before creating a new one.`,{code:"MEMORY_TYPE_LIMIT_REACHED",memory_type:t,domain:i.domain,limit:64,current:a.count,recommended_actions:[`list_memories({ memory_type: '${t}' })`,`delete_memory({ uri, memory_type: '${t}' })`]})}ensureSessionContextCapacity(e,t,i){if(t!=="session_context")return;const o=Object.values(e.by_uri).filter(r=>r.memory_type==="session_context"&&r.domain===i.domain).length;if(o>=1024)throw new T(`Cannot create session_context: hard limit 1024 reached under domain ${i.domain}. Please delete existing session_context memories before creating a new one.`,{code:"MEMORY_TYPE_LIMIT_REACHED",memory_type:t,domain:i.domain,limit:1024,current:o,recommended_actions:["list_memories({ memory_type: 'session_context' })","delete_memory({ uri, memory_type: 'session_context' })"]})}async getStats(){const e=await this.loadData();return this.calculateStats(e)}static calcAgentMemoryExpiresAt(){return new Date(Date.now()+432e5).toISOString()}static isExpirableType(e){return e==="agent_memory"||e==="recently_memory"}async createMemory(e){const t=this.normalizeMemoryType(e.memory_type),i=this.normalizeUri(e.uri),o=await this.loadData();if(o.by_uri[i.uri])throw new Error(`Memory already exists: ${i.uri}`);this.ensureListableMemoryCapacity(o,t,i),this.ensureSessionContextCapacity(o,t,i);const r=this.nowIso(),a={id:this.generateId(i.uri),uri:i.uri,domain:i.domain,path:i.path,title:e.title||void 0,content:String(e.content||""),memory_type:t,createdAt:r,updatedAt:r,version:1,keywords:e.keywords,bound_files:e.bound_files,file_md5_map:e.file_md5_map||void 0,updating_agent_id:void 0,last_check_time:e.last_check_time||void 0,expiresAt:e.expiresAt||(p.isExpirableType(t)?p.calcAgentMemoryExpiresAt():void 0),memory_status:"normal"};return o.by_uri[i.uri]=a,await this.saveData(o),a}async readMemory(e){const t=this.normalizeUri(e.uri),i=typeof e.memory_type=="string"?this.normalizeMemoryType(e.memory_type):void 0,r=(await this.loadData()).by_uri[t.uri]??null;return r?(this.ensureTypeMatch(r,i),r):null}async updateMemory(e){const t=this.normalizeUri(e.uri),i=typeof e.memory_type=="string"?this.normalizeMemoryType(e.memory_type):void 0,o=await this.loadData(),r=o.by_uri[t.uri];if(!r)throw new Error(`Memory not found: ${t.uri}`);this.ensureTypeMatch(r,i);let a=r.content;if(typeof e.old_string=="string"&&typeof e.new_string=="string"){const m=e.old_string;if(!m)throw new Error("old_string cannot be empty when replacing");const c=a.split(m).length-1;if(c===0)throw new Error("old_string not found in memory content");if(c>1)throw new Error("old_string appears multiple times; replace is ambiguous");a=a.replace(m,e.new_string)}typeof e.append=="string"&&e.append.length>0&&(a=`${a}${e.append}`);const s=a!==r.content||typeof e.title=="string"&&e.title!==r.title,d=this.nowIso();let n=r.expiresAt;if(p.isExpirableType(r.memory_type))if(r.memory_type==="recently_memory")n=new Date(Date.now()+24*60*60*1e3).toISOString();else{const m=r.expiresAt?new Date(r.expiresAt):null,c=r.updatedAt?new Date(r.updatedAt):null,u=m&&c&&!isNaN(c.getTime())?Math.max(12*60*60*1e3,m.getTime()-c.getTime()):12*60*60*1e3;n=new Date(Date.now()+u*2).toISOString()}e.expiresAt!==void 0&&(n=e.expiresAt);const l={...r,content:a,title:e.title!==void 0?e.title:r.title,updatedAt:d,version:r.version+1,keywords:e.keywords!==void 0?e.keywords:r.keywords,bound_files:e.bound_files!==void 0?e.bound_files:r.bound_files,file_md5_map:e.file_md5_map!==void 0?e.file_md5_map:e.bound_files!==void 0?void 0:r.file_md5_map,memory_status:e.memory_status!==void 0?e.memory_status:r.memory_status==="updating"?"normal":r.memory_status||"normal",updating_agent_id:e.memory_status!==void 0?e.updating_agent_id||void 0:r.memory_status==="updating"?void 0:r.updating_agent_id,last_check_time:e.last_check_time!==void 0?e.last_check_time:r.last_check_time,expiresAt:n};return o.by_uri[t.uri]=l,await this.saveData(o),l}async deleteMemory(e){const t=this.normalizeUri(e.uri),i=typeof e.memory_type=="string"?this.normalizeMemoryType(e.memory_type):void 0,o=await this.loadData(),r=o.by_uri[t.uri];return r?(this.ensureTypeMatch(r,i),delete o.by_uri[t.uri],await this.saveData(o),!0):!1}async listExpiredRecentlyMemories(){const e=await this.loadData(),t=new Date,i=[];for(const o of Object.values(e.by_uri))o.memory_type!=="agent_memory"&&o.memory_type!=="recently_memory"||o.expiresAt&&(new Date(o.expiresAt)>t||o.memory_status==="recalling"&&o.updating_agent_id!==g||i.push(o));return i.sort((o,r)=>o.expiresAt.localeCompare(r.expiresAt))}async searchMemory(e){const t=await this.loadData(),o=String(e.query||"").trim().toLowerCase(),r=e.memory_type?this.normalizeMemoryType(e.memory_type):void 0,a=typeof e.limit=="number"&&e.limit>0?e.limit:10,s=e.keywords?.map(c=>c.toLowerCase()),d=e.keyword_mode==="all"?"all":"any",n=D(o);if(n.length===0&&(!s||s.length===0))return{query:o,results:[]};const l=new Set,m=[];for(const c of Object.values(t.by_uri)){if(r&&c.memory_type!==r||l.has(c.id))continue;let u=0;if(s&&s.length>0&&c.keywords){const _=c.keywords.map(f=>f.toLowerCase());if(d==="all"){if(s.every(w=>_.includes(w)))u+=10*s.length;else if(n.length===0)continue}else for(const f of s)_.includes(f)&&(u+=10)}if(n.length>0){const _=`${c.uri}
|
|
1
|
+
const E=["instance_memory","instance_long_memory","project_memory","session_context"],h=["instance_memory","instance_long_memory"],C=64,R=32,Y=128,$=64,P=1024;function L(y){const e=String(y||"").trim().replace(/\\/g,"/");if(!e)return e;const t=e.startsWith("@/")?e.substring(1):e;return t.startsWith("./")?t:`./${t.replace(/^\/+/,"")}`}class T extends Error{details;constructor(e,t){super(e),this.name="MemoryCapacityError",this.details=t}}const b=/^([a-zA-Z_][a-zA-Z0-9_]*):\/\/(.*)$/,g="local",S=50,x=10;function D(y){const e=(y||"").trim();return e?e.split("|").map(t=>t.trim()).filter(Boolean).map(t=>t.split(/\s+/).filter(Boolean)):[]}function O(y,e){return y.length===0?!1:y.some(t=>t.every(o=>e.includes(o)))}class p{storePath;domainJsonCache=new Map;constructor(e){this.storePath=e}nowIso(){return new Date().toISOString()}normalizeUri(e){const t=String(e||"").trim(),o=b.exec(t);if(!o)throw new Error(`Invalid memory uri: ${e}`);const r=o[1],n=o[2];if(!r||!n)throw new Error(`Invalid memory uri: ${e}`);const a=r.toLowerCase(),s=n.replace(/^\/+|\/+$/g,"");if(!s)throw new Error(`Invalid memory uri path: ${e}`);return{uri:`${a}://${s}`,domain:a,path:s}}normalizeMemoryType(e,t=E){const o=String(e||"").trim();if(!t.includes(o))throw new Error(`Invalid memory_type: ${e}`);return o}ensureTypeMatch(e,t){if(t&&e.memory_type!==t)throw new Error(`Memory type mismatch: expected ${t}, actual ${e.memory_type}`)}async ensureStoreDir(){const{mkdir:e}=await import("node:fs/promises");await e(this.storePath,{recursive:!0})}async loadMemoryFile(e){const{readFile:t}=await import("node:fs/promises");try{const o=await t(e,"utf-8"),r=JSON.parse(o),n=r.by_uri&&typeof r.by_uri=="object"?r.by_uri:{},a={};for(const[s,d]of Object.entries(n)){const i=this.normalizeMemoryType(d.memory_type||"project_memory"),l=this.normalizeUri(d.uri||s),m=d;let c=m.memory_status;c||(m.update_status==="updating"?c="updating":m.recall_status==="recalling"?c="recalling":c="normal");const u={...d};delete u.update_status,delete u.recall_status,a[l.uri]={...u,uri:l.uri,domain:l.domain,path:l.path,memory_type:i,memory_status:c}}return{by_uri:a}}catch{return{by_uri:{}}}}async loadData(){const{readdir:e}=await import("node:fs/promises"),t=await import("node:path");try{const o=await e(this.storePath,{withFileTypes:!0}),r={by_uri:{}};for(const n of o){if(!n.isFile()||!n.name.endsWith(".json"))continue;const a=await this.loadMemoryFile(t.join(this.storePath,n.name));Object.assign(r.by_uri,a.by_uri)}return r}catch{return{by_uri:{}}}}async writeJsonAtomically(e,t,o=JSON.stringify(t,null,2)){const{rename:r,rm:n,writeFile:a}=await import("node:fs/promises"),s=`${e}.${process.pid}.${Date.now()}.tmp`;try{await a(s,o,"utf-8"),await r(s,e)}catch(d){throw await n(s,{force:!0}),d}}async saveData(e){const{readFile:t,readdir:o,rm:r}=await import("node:fs/promises"),n=await import("node:path");await this.ensureStoreDir();const a=new Map;for(const i of Object.values(e.by_uri)){const l=a.get(i.domain)??{by_uri:{}};l.by_uri[i.uri]=i,a.set(i.domain,l)}for(const[i,l]of a.entries()){const m=n.join(this.storePath,`${i}.json`),c=JSON.stringify(l,null,2);if(this.domainJsonCache.get(m)===c)continue;let _;try{_=await t(m,"utf-8")}catch{_=void 0}if(_===c){this.domainJsonCache.set(m,c);continue}await this.writeJsonAtomically(m,l,c),this.domainJsonCache.set(m,c)}const s=new Set([...a.keys()].map(i=>`${i}.json`)),d=await o(this.storePath,{withFileTypes:!0});for(const i of d)if(i.isFile()&&i.name.endsWith(".json")&&!s.has(i.name)){const l=n.join(this.storePath,i.name);await r(l,{force:!0}),this.domainJsonCache.delete(l)}}createEmptyStats(){return{total:0,listable:{count:0,limit:64,hardLimit:128,exceeded:!1,hardExceeded:!1},by_type:{instance_memory:{count:0,limit:32,hardLimit:64,exceeded:!1,hardExceeded:!1,listable:!0,domainCount:0,by_domain:{}},instance_long_memory:{count:0,limit:32,hardLimit:64,exceeded:!1,hardExceeded:!1,listable:!0,domainCount:0,by_domain:{}},project_memory:{count:0,limit:null,hardLimit:null,exceeded:!1,hardExceeded:!1,listable:!1,domainCount:0,by_domain:{}},session_context:{count:0,limit:null,hardLimit:1024,exceeded:!1,hardExceeded:!1,listable:!1,domainCount:0,by_domain:{}}}}}calculateStats(e){const t=this.createEmptyStats();for(const o of Object.values(e.by_uri)){t.total+=1;const r=t.by_type[o.memory_type];r.count+=1;const n=d=>h.includes(d)?32:null,a=d=>h.includes(d)?64:d==="session_context"?1024:null,s=r.by_domain[o.domain]??{count:0,limit:n(o.memory_type),hardLimit:a(o.memory_type),exceeded:!1,hardExceeded:!1};s.count+=1,r.by_domain[o.domain]=s,h.includes(o.memory_type)&&(t.listable.count+=1)}t.listable.exceeded=t.listable.count>t.listable.limit,t.listable.hardExceeded=t.listable.count>=t.listable.hardLimit;for(const o of E){const r=t.by_type[o];r.domainCount=Object.keys(r.by_domain).length,r.limit!==null&&r.hardLimit!==null&&(r.exceeded=r.domainCount>r.limit,r.hardExceeded=r.domainCount>=r.hardLimit);for(const n of Object.values(r.by_domain))n.limit!==null&&n.hardLimit!==null&&(n.exceeded=n.count>n.limit,n.hardExceeded=n.count>=n.hardLimit)}return t}generateId(e){return`${e.replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}_${Date.now().toString(36)}`}ensureListableMemoryCapacity(e,t,o){if(!h.includes(t))return;const n=this.calculateStats(e).by_type[t],a=n.by_domain[o.domain];if(!a&&n.domainCount>=64)throw new T(`Cannot create ${t}: hard domain type limit 64 reached. Please delete an existing ${t} domain type before creating a new ${t}.`,{code:"MEMORY_TYPE_LIMIT_REACHED",memory_type:t,limit:64,current:n.domainCount,recommended_actions:[`list_memories({ memory_type: '${t}' })`,`delete_memory({ uri, memory_type: '${t}' })`]});if(a&&a.count>=64)throw new T(`Cannot create ${t}: hard memory limit 64 reached under domain ${o.domain}. Please delete or archive existing ${o.domain}://${t} memories before creating a new one.`,{code:"MEMORY_TYPE_LIMIT_REACHED",memory_type:t,domain:o.domain,limit:64,current:a.count,recommended_actions:[`list_memories({ memory_type: '${t}' })`,`delete_memory({ uri, memory_type: '${t}' })`]})}ensureSessionContextCapacity(e,t,o){if(t!=="session_context")return;const r=Object.values(e.by_uri).filter(n=>n.memory_type==="session_context"&&n.domain===o.domain).length;if(r>=1024)throw new T(`Cannot create session_context: hard limit 1024 reached under domain ${o.domain}. Please delete existing session_context memories before creating a new one.`,{code:"MEMORY_TYPE_LIMIT_REACHED",memory_type:t,domain:o.domain,limit:1024,current:r,recommended_actions:["list_memories({ memory_type: 'session_context' })","delete_memory({ uri, memory_type: 'session_context' })"]})}async getStats(){const e=await this.loadData();return this.calculateStats(e)}static calcAgentMemoryExpiresAt(){return new Date(Date.now()+432e5).toISOString()}static isExpirableType(e){return e==="instance_long_memory"||e==="instance_memory"}async createMemory(e){const t=this.normalizeMemoryType(e.memory_type),o=this.normalizeUri(e.uri),r=await this.loadData();if(r.by_uri[o.uri])throw new Error(`Memory already exists: ${o.uri}`);this.ensureListableMemoryCapacity(r,t,o),this.ensureSessionContextCapacity(r,t,o);const n=this.nowIso(),a={id:this.generateId(o.uri),uri:o.uri,domain:o.domain,path:o.path,title:e.title||void 0,content:String(e.content||""),memory_type:t,createdAt:n,updatedAt:n,version:1,keywords:e.keywords,bound_files:e.bound_files,file_md5_map:e.file_md5_map||void 0,updating_agent_id:void 0,last_check_time:e.last_check_time||void 0,expiresAt:e.expiresAt||(p.isExpirableType(t)?p.calcAgentMemoryExpiresAt():void 0),memory_status:"normal"};return r.by_uri[o.uri]=a,await this.saveData(r),a}async readMemory(e){const t=this.normalizeUri(e.uri),o=typeof e.memory_type=="string"?this.normalizeMemoryType(e.memory_type):void 0,n=(await this.loadData()).by_uri[t.uri]??null;return n?(this.ensureTypeMatch(n,o),n):null}async updateMemory(e){const t=this.normalizeUri(e.uri),o=typeof e.memory_type=="string"?this.normalizeMemoryType(e.memory_type):void 0,r=await this.loadData(),n=r.by_uri[t.uri];if(!n)throw new Error(`Memory not found: ${t.uri}`);this.ensureTypeMatch(n,o);let a=n.content;if(typeof e.old_string=="string"&&typeof e.new_string=="string"){const m=e.old_string;if(!m)throw new Error("old_string cannot be empty when replacing");const c=a.split(m).length-1;if(c===0)throw new Error("old_string not found in memory content");if(c>1)throw new Error("old_string appears multiple times; replace is ambiguous");a=a.replace(m,e.new_string)}typeof e.append=="string"&&e.append.length>0&&(a=`${a}${e.append}`);const s=a!==n.content||typeof e.title=="string"&&e.title!==n.title,d=this.nowIso();let i=n.expiresAt;if(p.isExpirableType(n.memory_type))if(n.memory_type==="instance_memory")i=new Date(Date.now()+24*60*60*1e3).toISOString();else{const m=n.expiresAt?new Date(n.expiresAt):null,c=n.updatedAt?new Date(n.updatedAt):null,u=m&&c&&!isNaN(c.getTime())?Math.max(12*60*60*1e3,m.getTime()-c.getTime()):12*60*60*1e3;i=new Date(Date.now()+u*2).toISOString()}e.expiresAt!==void 0&&(i=e.expiresAt);const l={...n,content:a,title:e.title!==void 0?e.title:n.title,updatedAt:d,version:n.version+1,keywords:e.keywords!==void 0?e.keywords:n.keywords,bound_files:e.bound_files!==void 0?e.bound_files:n.bound_files,file_md5_map:e.file_md5_map!==void 0?e.file_md5_map:e.bound_files!==void 0?void 0:n.file_md5_map,memory_status:e.memory_status!==void 0?e.memory_status:n.memory_status==="updating"?"normal":n.memory_status||"normal",updating_agent_id:e.memory_status!==void 0?e.updating_agent_id||void 0:n.memory_status==="updating"?void 0:n.updating_agent_id,last_check_time:e.last_check_time!==void 0?e.last_check_time:n.last_check_time,expiresAt:i};return r.by_uri[t.uri]=l,await this.saveData(r),l}async deleteMemory(e){const t=this.normalizeUri(e.uri),o=typeof e.memory_type=="string"?this.normalizeMemoryType(e.memory_type):void 0,r=await this.loadData(),n=r.by_uri[t.uri];return n?(this.ensureTypeMatch(n,o),delete r.by_uri[t.uri],await this.saveData(r),!0):!1}async listExpiredRecentlyMemories(){const e=await this.loadData(),t=new Date,o=[];for(const r of Object.values(e.by_uri))r.memory_type!=="instance_long_memory"&&r.memory_type!=="instance_memory"||r.expiresAt&&(new Date(r.expiresAt)>t||r.memory_status==="recalling"&&r.updating_agent_id!==g||o.push(r));return o.sort((r,n)=>r.expiresAt.localeCompare(n.expiresAt))}async searchMemory(e){const t=await this.loadData(),r=String(e.query||"").trim().toLowerCase(),n=e.memory_type?this.normalizeMemoryType(e.memory_type):void 0,a=typeof e.limit=="number"&&e.limit>0?e.limit:10,s=e.keywords?.map(c=>c.toLowerCase()),d=e.keyword_mode==="all"?"all":"any",i=D(r);if(i.length===0&&(!s||s.length===0))return{query:r,results:[]};const l=new Set,m=[];for(const c of Object.values(t.by_uri)){if(n&&c.memory_type!==n||l.has(c.id))continue;let u=0;if(s&&s.length>0&&c.keywords){const _=c.keywords.map(f=>f.toLowerCase());if(d==="all"){if(s.every(w=>_.includes(w)))u+=10*s.length;else if(i.length===0)continue}else for(const f of s)_.includes(f)&&(u+=10)}if(i.length>0){const _=`${c.uri}
|
|
2
2
|
${c.title||""}
|
|
3
|
-
${c.content}`.toLowerCase();if(!O(
|
|
3
|
+
${c.content}`.toLowerCase();if(!O(i,_)&&u===0)continue;for(const f of i){const w=f.filter(M=>_.includes(M)).length;if(w>0){const M=c.uri.toLowerCase(),I=f.filter(A=>M.includes(A)).length;u+=w+I}}}u!==0&&(l.add(c.id),m.push({score:u,record:c}))}return m.sort((c,u)=>u.score!==c.score?u.score-c.score:u.record.updatedAt.localeCompare(c.record.updatedAt)),{query:r,results:m.slice(0,a).map(c=>c.record)}}async listByType(e){const t=e==="session_context"||e==="project_memory"?E:h,o=this.normalizeMemoryType(e,t),r=await this.loadData(),n=new Set,a=[];for(const s of Object.values(r.by_uri))s.memory_type===o&&(n.has(s.id)||(n.add(s.id),a.push(s)));return a.sort((s,d)=>d.updatedAt.localeCompare(s.updatedAt)),a}async listByFile(e,t){const o=await this.loadData(),r=typeof t=="object"&&t!==null?t.memory_type:t,n=r?this.normalizeMemoryType(r):void 0,a=L(e),s=new Set,d=[];for(const i of Object.values(o.by_uri))n&&i.memory_type!==n||s.has(i.id)||i.bound_files&&i.bound_files.length>0&&i.bound_files.some(m=>L(m)===a)&&(s.add(i.id),d.push(i));return d.sort((i,l)=>l.updatedAt.localeCompare(i.updatedAt)),d}async markExpiredMemoriesRecalling(e){const t=await this.listExpiredRecentlyMemories();if(t.length===0)return{marked:0,uris:[]};const o=t.filter(i=>i.memory_status!=="recalling"),r=e?o.filter(i=>e.includes(i.uri)):o.slice(0,S);if(r.length===0){const i=t.filter(l=>l.memory_status==="recalling").map(l=>l.uri);return{marked:i.length,uris:i}}const n=await this.loadData(),a=this.nowIso(),s=new Date(Date.now()+x*60*1e3).toISOString(),d=[];for(const i of r){const l=n.by_uri[i.uri];l&&(l.memory_status="recalling",l.updating_agent_id=g,l.lease_expires_at=s,l.updatedAt=a,l.version=(l.version||1)+1,d.push(i.uri))}return d.length>0&&await this.saveData(n),{marked:d.length,uris:d}}async clearRecallingExpiredMemories(e){const t=await this.loadData(),o=new Date,r=[];for(const n of Object.values(t.by_uri))p.isExpirableType(n.memory_type)&&n.memory_status==="recalling"&&n.updating_agent_id===g&&n.expiresAt&&(new Date(n.expiresAt)>o||r.push(n.uri));if(e){const n=new Set(e),a=r.filter(s=>n.has(s));r.length=0,r.push(...a)}if(r.length===0)return{deleted:0,uris:[]};for(const n of r)delete t.by_uri[n];return await this.saveData(t),{deleted:r.length,uris:r}}async claimMemoryUpdate(e,t,o){throw new Error("claimMemoryUpdate not supported in local MemoryStore")}async renewMemoryLease(e){throw new Error("renewMemoryLease not supported in local MemoryStore")}async releaseMemoryClaim(e){throw new Error("releaseMemoryClaim not supported in local MemoryStore")}async releaseAllMemoryClaims(){throw new Error("releaseAllMemoryClaims not supported in local MemoryStore")}async getMyClaimedUris(){throw new Error("getMyClaimedUris not supported in local MemoryStore")}}export{T as MemoryCapacityError,p as MemoryStore,L as normalizeBoundFilePath};
|
|
4
4
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const e={type:"string",enum:["
|
|
1
|
+
const e={type:"string",enum:["instance_memory","instance_long_memory","project_memory"],description:"\u8BB0\u5FC6\u7C7B\u578B\uFF1Ainstance_memory \u8868\u793A Agent \u5B9E\u4F8B\u5373\u65F6\u8BB0\u5FC6\uFF08\u4F1A\u8BDD\u7EA7\u77ED\u671F\u5DE5\u4F5C\u8BB0\u5FC6\uFF0C\u6709\u6761\u6570\u4E0A\u9650\uFF0C\u8FC7\u671F\u540E\u8D70\u56DE\u5FC6\u6D41\u7A0B\uFF09\uFF1Binstance_long_memory \u8868\u793A Agent \u5B9E\u4F8B\u957F\u671F\u8BB0\u5FC6\uFF08\u5BF9\u5916\u90E8\u73AF\u5883\u7684\u8BA4\u77E5\u8BB0\u5FC6\uFF0C\u8FC7\u671F\u540E\u8D70\u56DE\u5FC6\u6D41\u7A0B\uFF09\uFF1Bproject_memory \u8868\u793A\u9879\u76EE\u8BB0\u5FC6\uFF08\u5BF9\u5F53\u524D\u5DE5\u4F5C\u533A\u9879\u76EE\u7684\u7406\u89E3\uFF0C\u89D2\u8272\u7EA7\u5171\u4EAB\u3001\u65E0\u8FC7\u671F\uFF09\u3002"},r={type:"string",enum:["instance_memory","instance_long_memory","project_memory","session_context"],description:"\u53EF\u76F4\u63A5\u5217\u51FA\u7684\u8BB0\u5FC6\u7C7B\u578B\u3002instance_long_memory \u4E3B\u8981\u7528 search_memory \u68C0\u7D22\uFF1Bproject_memory \u4E0E session_context \u540C\u6837\u652F\u6301 list\u3002"},t={type:"string",description:"\u8BB0\u5FC6 URI\uFF0C\u683C\u5F0F\u4E3A domain://path\uFF0C\u4F8B\u5982 core://agent/profile \u6216 task://todo/current\u3002domain \u4F1A\u81EA\u52A8\u8F6C\u5C0F\u5199\u3002"},n={name:"create_memory",description:"\u5728\u5F53\u524D Agent \u5DE5\u4F5C\u533A\u521B\u5EFA\u4E00\u6761\u672C\u5730\u8BB0\u5FC6\u3002\u9002\u5408\u4FDD\u5B58\u9879\u76EE\u8BB0\u5FC6\u3001Agent \u5B9E\u4F8B\u957F\u671F\u8BB0\u5FC6\u6216 Agent \u5B9E\u4F8B\u5373\u65F6\u8BB0\u5FC6\uFF1B\u540C\u4E00 uri \u5DF2\u5B58\u5728\u65F6\u4F1A\u5931\u8D25\uFF0C\u907F\u514D\u610F\u5916\u8986\u76D6\u3002",inputSchema:{type:"object",properties:{memory_type:{type:"string",enum:["instance_memory","instance_long_memory","project_memory"],description:`\u8BB0\u5FC6\u7C7B\u578B\uFF1Ainstance_memory \u8868\u793A Agent \u5B9E\u4F8B\u5373\u65F6\u8BB0\u5FC6\uFF08\u4F1A\u8BDD\u7EA7\u77ED\u671F\u5DE5\u4F5C\u8BB0\u5FC6\uFF0C\u6709\u6761\u6570\u4E0A\u9650\uFF0C\u8FC7\u671F\u540E\u8D70\u56DE\u5FC6\u6D41\u7A0B\uFF09\uFF1Binstance_long_memory \u8868\u793A Agent \u5B9E\u4F8B\u957F\u671F\u8BB0\u5FC6\uFF08\u5BF9\u5916\u90E8\u73AF\u5883\u7684\u8BA4\u77E5\u8BB0\u5FC6\uFF0C\u8FC7\u671F\u540E\u8D70\u56DE\u5FC6\u6D41\u7A0B\uFF09\uFF1Bproject_memory \u8868\u793A\u9879\u76EE\u8BB0\u5FC6\uFF08\u5BF9\u5F53\u524D\u5DE5\u4F5C\u533A\u9879\u76EE\u7684\u7406\u89E3\uFF0C\u89D2\u8272\u7EA7\u5171\u4EAB\u3001\u65E0\u8FC7\u671F\uFF09\u3002
|
|
2
2
|
\u6CE8\u610F\uFF1A\u9009\u62E9 project_memory \u65F6\uFF0C\u5E94\u540C\u65F6\u586B\u5199 bound_files \u5173\u8054\u5230\u5177\u4F53\u6587\u4EF6\uFF0C\u4EE5\u4FBF\u957F\u671F\u7EF4\u62A4\u4E0E\u53D8\u66F4\u8FFD\u8E2A\u3002`},uri:t,title:{type:"string",description:"\u8BB0\u5FC6\u6807\u9898\uFF0C\u7528\u4E8E\u5FEB\u901F\u8BC6\u522B\u8BB0\u5FC6\u5185\u5BB9\u3002"},content:{type:"string",description:"\u8BB0\u5FC6\u5185\u5BB9\u3002"},keywords:{type:"array",items:{type:"string"},description:'\u5173\u952E\u8BCD\u5217\u8868\uFF0C\u7528\u4E8E\u5FEB\u901F\u641C\u7D22\u548C\u5206\u7C7B\uFF0C\u4F8B\u5982 ["React", "\u524D\u7AEF", "\u6700\u4F73\u5B9E\u8DF5"]\u3002'},bound_files:{type:"array",items:{type:"string"},description:`\u7ED1\u5B9A\u7684\u6587\u4EF6\u8DEF\u5F84\u5217\u8868\uFF0C\u7528\u4E8E\u81EA\u52A8\u68C0\u6D4B\u6587\u4EF6\u53D8\u66F4\u5E76\u63D0\u9192\u66F4\u65B0\u8BB0\u5FC6\uFF0C\u4F8B\u5982 ["./path/to/file.md"]\u3002\uFF08/ \u524D\u7F00\u4F1A\u88AB\u89C6\u4E3A\u5DE5\u4F5C\u533A\u6839\u8DEF\u5F84\uFF0C\u7EDF\u4E00\u8F6C\u4E3A ./\uFF09
|
|
3
|
-
\u3010\u5F3A\u70C8\u5EFA\u8BAE\u3011\u5F53 memory_type=project_memory \u65F6\uFF0C\u5E94\u81F3\u5C11\u5173\u8054\u4E00\u4E2A\u5177\u4F53\u6587\u4EF6\uFF08\u5982\u8BE5\u6761\u9879\u76EE\u8BB0\u5FC6\u6240\u5BF9\u5E94\u7684\u6838\u5FC3\u6E90\u7801\u3001\u914D\u7F6E\u6216\u6587\u6863\u6587\u4EF6\uFF09\uFF0C\u4EE5\u4FBF\u957F\u671F\u7EF4\u62A4\u4E0E\u53D8\u66F4\u8FFD\u8E2A\u3002`}},required:["memory_type","uri","content"]}},
|
|
3
|
+
\u3010\u5F3A\u70C8\u5EFA\u8BAE\u3011\u5F53 memory_type=project_memory \u65F6\uFF0C\u5E94\u81F3\u5C11\u5173\u8054\u4E00\u4E2A\u5177\u4F53\u6587\u4EF6\uFF08\u5982\u8BE5\u6761\u9879\u76EE\u8BB0\u5FC6\u6240\u5BF9\u5E94\u7684\u6838\u5FC3\u6E90\u7801\u3001\u914D\u7F6E\u6216\u6587\u6863\u6587\u4EF6\uFF09\uFF0C\u4EE5\u4FBF\u957F\u671F\u7EF4\u62A4\u4E0E\u53D8\u66F4\u8FFD\u8E2A\u3002`}},required:["memory_type","uri","content"]}},i={name:"read_memory",description:"\u6309 uri \u8BFB\u53D6\u5F53\u524D Agent \u5DE5\u4F5C\u533A\u7684\u4E00\u6761\u672C\u5730\u8BB0\u5FC6\u3002\u53EF\u4F20 memory_type \u505A\u7C7B\u578B\u6821\u9A8C\uFF0C\u907F\u514D\u8BFB\u9519\u5206\u7C7B\u3002",inputSchema:{type:"object",properties:{uri:t,memory_type:e},required:["uri"]}},o={name:"update_memory",description:"\u66F4\u65B0\u5F53\u524D Agent \u5DE5\u4F5C\u533A\u7684\u4E00\u6761\u672C\u5730\u8BB0\u5FC6\u3002\u652F\u6301\u4E09\u79CD\u5199\u6CD5\uFF1A1) \u7CBE\u786E\u66FF\u6362\u65F6\u5FC5\u987B\u540C\u65F6\u63D0\u4F9B old_string \u548C new_string\uFF1B2) \u8FFD\u52A0\u65F6\u53EA\u63D0\u4F9B append\uFF1B3) \u4EC5\u4F20 uri\uFF08\u4E0D\u63D0\u4F9B\u5185\u5BB9\u53C2\u6570\uFF09\u505A\u65E0\u5185\u5BB9\u66F4\u65B0\u2014\u2014\u6B64\u65F6\u5185\u5BB9\u4E0D\u53D8\uFF0C\u4F46\u4F1A\u5237\u65B0\u7ED1\u5B9A\u6587\u4EF6 MD5\u3001\u91CA\u653E updating \u72B6\u6001\u3001\u5E76\u5BF9 instance_long_memory/instance_memory \u7EED\u671F TTL\xD72\u3002\u82E5\u8BB0\u5FC6\u4E0D\u5B58\u5728\u8BF7\u4F7F\u7528 create_memory\u3002",inputSchema:{type:"object",properties:{uri:t,memory_type:e,title:{type:"string",description:"\u66F4\u65B0\u6807\u9898\u3002\u4F20\u5165\u6B64\u5B57\u6BB5\u4F1A\u8986\u76D6\u73B0\u6709\u6807\u9898\u3002"},old_string:{type:"string",minLength:1,description:"\u8981\u88AB\u66FF\u6362\u7684\u65E7\u5185\u5BB9\u3002\u66FF\u6362\u65F6\u5FC5\u987B\u4E0E new_string \u540C\u65F6\u4F20\u5165\uFF1B\u8FFD\u52A0\u6216\u4EC5\u72B6\u6001\u66F4\u65B0\u65F6\u4E0D\u8981\u4F20\u6B64\u5B57\u6BB5\u3002"},new_string:{type:"string",description:"\u66FF\u6362\u540E\u7684\u65B0\u5185\u5BB9\u3002\u66FF\u6362\u65F6\u5FC5\u987B\u4E0E old_string \u540C\u65F6\u4F20\u5165\uFF1B\u8FFD\u52A0\u6216\u4EC5\u72B6\u6001\u66F4\u65B0\u65F6\u4E0D\u8981\u4F20\u6B64\u5B57\u6BB5\u3002\u5141\u8BB8\u4E3A\u7A7A\u5B57\u7B26\u4E32\u8868\u793A\u5220\u9664\u65E7\u5185\u5BB9\u3002"},append:{type:"string",minLength:1,description:"\u8FFD\u52A0\u5230\u8BB0\u5FC6\u672B\u5C3E\u7684\u5185\u5BB9\u3002\u8FFD\u52A0\u65F6\u53EA\u4F20 append\uFF0C\u4E0D\u8981\u4F20 old_string/new_string\u3002"},keywords:{type:"array",items:{type:"string"},description:"\u66F4\u65B0\u5173\u952E\u8BCD\u5217\u8868\u3002"},bound_files:{type:"array",items:{type:"string"},description:"\u66F4\u65B0\u7ED1\u5B9A\u6587\u4EF6\u8DEF\u5F84\u5217\u8868\u3002\u66F4\u65B0\u540E\u4F1A\u91CD\u65B0\u8BA1\u7B97\u6587\u4EF6 MD5\u3002"}},required:["uri"]}},m={name:"delete_memory",description:`\u5220\u9664\u5F53\u524D Agent \u5DE5\u4F5C\u533A\u7684\u672C\u5730\u8BB0\u5FC6\u3002\u652F\u6301\u4E24\u79CD\u8C03\u7528\u65B9\u5F0F\uFF08uri \u4E0E memories \u4E92\u65A5\uFF09\uFF1A
|
|
4
4
|
1) \u5355\u6761\uFF1A\u4F20 uri\uFF08+ \u53EF\u9009 memory_type \u505A\u7C7B\u578B\u6821\u9A8C\uFF09\uFF0C\u8FD4\u56DE { deleted: boolean }\u3002
|
|
5
5
|
2) \u6279\u91CF\uFF1A\u4F20 memories \u6570\u7EC4\uFF0C\u6BCF\u9879\u4E3A { uri, memory_type? }\uFF08\u5B57\u6BB5\u7ED3\u6784\u4E0E read_memory \u4E00\u81F4\uFF09\uFF0C\u8FD4\u56DE { deleted: number, not_found: string[], failed: Array<{uri, reason}> }\u3002
|
|
6
6
|
\u6279\u91CF\u6A21\u5F0F\u9010\u6761\u5220\u9664\uFF0C\u5355\u6761\u5931\u8D25\uFF08\u7C7B\u578B\u4E0D\u5339\u914D\u7B49\uFF09\u4E0D\u963B\u65AD\u5176\u4ED6\uFF1B\u6BCF\u6761\u53EF\u72EC\u7ACB\u6307\u5B9A memory_type\uFF0C\u7701\u7565\u65F6\u7531\u7CFB\u7EDF\u81EA\u52A8\u5224\u5B9A\u3002
|
|
7
|
-
\u9002\u7528\u573A\u666F\uFF1A\u8FC7\u671F\u56DE\u5FC6\u6D41\u7A0B\u4E2D recalling \u72B6\u6001\u540C\u65F6\u542B
|
|
7
|
+
\u9002\u7528\u573A\u666F\uFF1A\u8FC7\u671F\u56DE\u5FC6\u6D41\u7A0B\u4E2D recalling \u72B6\u6001\u540C\u65F6\u542B instance_long_memory \u4E0E instance_memory\uFF0C\u53EF\u7528\u4E00\u6B21\u8C03\u7528\u8DE8\u7C7B\u578B\u6279\u91CF\u6E05\u7406\u3002`,inputSchema:{type:"object",properties:{uri:t,memory_type:e,memories:{type:"array",items:{type:"object",properties:{uri:t,memory_type:e},required:["uri"]},description:"\u6279\u91CF\u5220\u9664\u7684\u6761\u76EE\u5217\u8868\uFF0C\u6BCF\u9879\u4E3A { uri, memory_type? }\u3002\u4E0E uri \u4E92\u65A5\u3002memory_type \u53EF\u9009\uFF0C\u4E0D\u4F20\u65F6\u7531\u7CFB\u7EDF\u81EA\u52A8\u5224\u5B9A\u7C7B\u578B\u3002"}},anyOf:[{required:["uri"]},{required:["memories"]}]}},p={name:"search_memory",description:`\u6309\u5173\u952E\u5B57\u641C\u7D22\u5F53\u524D Agent \u5DE5\u4F5C\u533A\u7684\u672C\u5730\u8BB0\u5FC6\u3002\u4F1A\u540C\u65F6\u5339\u914D uri\u3001title \u4E0E content\uFF0C\u4F18\u5148\u6309\u5173\u952E\u8BCD\u5339\u914D\uFF0C\u7136\u540E\u6309\u5185\u5BB9\u5339\u914D\u3002\u652F\u6301scope\u53C2\u6570\u641C\u7D22\u5B50Agent\uFF08\u5DE5\u4F5C\u533A\u8DEF\u5F84\u4E3A\u5F53\u524D\u8DEF\u5F84\u5B50\u76EE\u5F55\u7684Agent\uFF09\u7ED1\u5B9A\u4E86\u6587\u4EF6\u7684\u8BB0\u5FC6\u3002
|
|
8
8
|
|
|
9
9
|
\u3010\u641C\u7D22\u8BED\u6CD5\u3011
|
|
10
10
|
- OR \u641C\u7D22\uFF1A\u4F7F\u7528 | \u5206\u9694\u591A\u4E2A\u8BCD\uFF0C\u5339\u914D\u4EFB\u4E00\u5373\u8FD4\u56DE\u3002\u4F8B\u5982\u300C\u67B6\u6784|\u6280\u672F\u300D\u5339\u914D\u5305\u542B\u300C\u67B6\u6784\u300D\u6216\u300C\u6280\u672F\u300D\u7684\u8BB0\u5F55\u3002
|
|
@@ -18,15 +18,15 @@ const e={type:"string",enum:["recently_memory","agent_memory","project_memory"],
|
|
|
18
18
|
|
|
19
19
|
\u3010\u641C\u7D22\u6548\u7387\u3011
|
|
20
20
|
- \u641C\u7D22\u7ED3\u679C\u4F7F\u7528 5 \u79D2\u5185\u5B58\u7F13\u5B58\uFF0C\u8FDE\u7EED\u641C\u7D22\u4E0D\u4F1A\u91CD\u590D\u8BFB\u76D8\u3002
|
|
21
|
-
- \u8BB0\u5FC6\u5199\u5165\u64CD\u4F5C\u4F1A\u81EA\u52A8\u6E05\u9664\u7F13\u5B58\uFF0C\u786E\u4FDD\u6570\u636E\u4E00\u81F4\u6027\u3002`,inputSchema:{type:"object",properties:{query:{type:"string",description:"\u641C\u7D22\u5173\u952E\u5B57\u3002\u652F\u6301 | OR \u5206\u9694\u7B26\u548C\u7A7A\u683C AND \u8BCD\u7EC4\u3002\u4F8B\u5982\u300C\u67B6\u6784|\u6280\u672F \u8BBE\u8BA1\u300D\u8868\u793A\u641C\u7D22\u5305\u542B\u300C\u67B6\u6784\u300D\u6216\u540C\u65F6\u5305\u542B\u300C\u6280\u672F+\u8BBE\u8BA1\u300D\u7684\u8BB0\u5F55\u3002"},limit:{type:"number",description:"\u6700\u591A\u8FD4\u56DE\u6761\u6570\uFF0C\u9ED8\u8BA4 10\u3002"},memory_type:e,keywords:{type:"array",items:{type:"string"},description:"\u6309\u5173\u952E\u8BCD\u8FC7\u6EE4\u3002\u914D\u5408 keyword_mode \u63A7\u5236\u5339\u914D\u903B\u8F91\uFF08any=\u4EFB\u4E00\u5339\u914D\uFF0Call=\u5168\u90E8\u5339\u914D\uFF09\u3002\u5173\u952E\u8BCD\u5339\u914D\u4F18\u5148\u7EA7\u9AD8\u4E8E\u5185\u5BB9\u5339\u914D\u3002"},keyword_mode:{type:"string",enum:["any","all"],description:"\u5173\u952E\u8BCD\u8FC7\u6EE4\u6A21\u5F0F\uFF1Aany\uFF08\u9ED8\u8BA4\uFF0C\u4EFB\u4E00\u5173\u952E\u8BCD\u5339\u914D\u5373\u9009\u4E2D\uFF09\u3001all\uFF08\u6240\u6709\u5173\u952E\u8BCD\u90FD\u9700\u5339\u914D\uFF09\u3002"},scope:{type:"string",enum:["own","children","all"],description:"\u641C\u7D22\u8303\u56F4\uFF1Aown\uFF08\u9ED8\u8BA4\uFF0C\u4EC5\u641C\u7D22\u81EA\u5DF1\u7684\u8BB0\u5FC6\uFF09\u3001children\uFF08\u641C\u7D22\u5B50Agent\u7ED1\u5B9A\u4E86\u6587\u4EF6\u7684\u8BB0\u5FC6\uFF09\u3001all\uFF08\u5408\u5E76\u641C\u7D22\u81EA\u5DF1\u548C\u5B50Agent\u7684\u8BB0\u5FC6\uFF09\u3002"}},required:["query"]}},
|
|
22
|
-
\u8FC7\u671F\u6761\u4EF6\uFF1A\u4E0A\u8FF0\u4E24\u79CD\u7C7B\u578B\u7684 expires_at < NOW()\u3002\u521D\u59CB TTL 12h\uFF1Bupdate_memory \u7EED\u671F\
|
|
21
|
+
- \u8BB0\u5FC6\u5199\u5165\u64CD\u4F5C\u4F1A\u81EA\u52A8\u6E05\u9664\u7F13\u5B58\uFF0C\u786E\u4FDD\u6570\u636E\u4E00\u81F4\u6027\u3002`,inputSchema:{type:"object",properties:{query:{type:"string",description:"\u641C\u7D22\u5173\u952E\u5B57\u3002\u652F\u6301 | OR \u5206\u9694\u7B26\u548C\u7A7A\u683C AND \u8BCD\u7EC4\u3002\u4F8B\u5982\u300C\u67B6\u6784|\u6280\u672F \u8BBE\u8BA1\u300D\u8868\u793A\u641C\u7D22\u5305\u542B\u300C\u67B6\u6784\u300D\u6216\u540C\u65F6\u5305\u542B\u300C\u6280\u672F+\u8BBE\u8BA1\u300D\u7684\u8BB0\u5F55\u3002"},limit:{type:"number",description:"\u6700\u591A\u8FD4\u56DE\u6761\u6570\uFF0C\u9ED8\u8BA4 10\u3002"},memory_type:e,keywords:{type:"array",items:{type:"string"},description:"\u6309\u5173\u952E\u8BCD\u8FC7\u6EE4\u3002\u914D\u5408 keyword_mode \u63A7\u5236\u5339\u914D\u903B\u8F91\uFF08any=\u4EFB\u4E00\u5339\u914D\uFF0Call=\u5168\u90E8\u5339\u914D\uFF09\u3002\u5173\u952E\u8BCD\u5339\u914D\u4F18\u5148\u7EA7\u9AD8\u4E8E\u5185\u5BB9\u5339\u914D\u3002"},keyword_mode:{type:"string",enum:["any","all"],description:"\u5173\u952E\u8BCD\u8FC7\u6EE4\u6A21\u5F0F\uFF1Aany\uFF08\u9ED8\u8BA4\uFF0C\u4EFB\u4E00\u5173\u952E\u8BCD\u5339\u914D\u5373\u9009\u4E2D\uFF09\u3001all\uFF08\u6240\u6709\u5173\u952E\u8BCD\u90FD\u9700\u5339\u914D\uFF09\u3002"},scope:{type:"string",enum:["own","children","all"],description:"\u641C\u7D22\u8303\u56F4\uFF1Aown\uFF08\u9ED8\u8BA4\uFF0C\u4EC5\u641C\u7D22\u81EA\u5DF1\u7684\u8BB0\u5FC6\uFF09\u3001children\uFF08\u641C\u7D22\u5B50Agent\u7ED1\u5B9A\u4E86\u6587\u4EF6\u7684\u8BB0\u5FC6\uFF09\u3001all\uFF08\u5408\u5E76\u641C\u7D22\u81EA\u5DF1\u548C\u5B50Agent\u7684\u8BB0\u5FC6\uFF09\u3002"}},required:["query"]}},s={name:"list_memories",description:"\u6309\u7C7B\u578B\u5217\u51FA\u5F53\u524D Agent \u5DE5\u4F5C\u533A\u7684\u5373\u65F6/\u957F\u671F/\u9879\u76EE\u8BB0\u5FC6\uFF0C\u652F\u6301\u5206\u9875\u3002\u53EF\u5217\u7C7B\u578B\uFF1Ainstance_memory\u3001instance_long_memory\u3001project_memory\u3001session_context\u3002\u5206\u9875\u53C2\u6570\u5747\u4E3A\u53EF\u9009\uFF1Aoffset\uFF08\u504F\u79FB\u91CF\uFF0C\u4ECE 0 \u5F00\u59CB\uFF0C\u9ED8\u8BA4 0\uFF09\u3001limit\uFF08\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 30\uFF09\u3002\u8FD4\u56DE\u7ED3\u679C\u5305\u542B\u5206\u9875\u5143\u4FE1\u606F { memory_type, total, offset, limit, has_more, memories }\uFF0Chas_more \u4E3A true \u65F6\u53EF\u7528\u589E\u5927 offset \u7EE7\u7EED\u7FFB\u9875\u3002instance_long_memory \u4E3B\u8981\u7528 search_memory \u68C0\u7D22\uFF1Bproject_memory \u540C\u6837\u652F\u6301 list\u3002",inputSchema:{type:"object",properties:{memory_type:r,offset:{type:"integer",minimum:0,description:"\u5206\u9875\u504F\u79FB\u91CF\uFF0C\u8DF3\u8FC7\u524D N \u6761\u8BB0\u5F55\uFF08\u4ECE 0 \u5F00\u59CB\uFF09\uFF0C\u9ED8\u8BA4 0\u3002"},limit:{type:"integer",minimum:1,description:"\u6BCF\u9875\u8FD4\u56DE\u7684\u6761\u6570\uFF0C\u9ED8\u8BA4 30\u3002"}},required:["memory_type"]}},y={name:"get_memory_stats",description:"\u83B7\u53D6\u5F53\u524D Agent \u5DE5\u4F5C\u533A\u672C\u5730\u8BB0\u5FC6\u7684\u5BB9\u91CF\u7EDF\u8BA1\u3002\u9ED8\u8BA4\u8FD4\u56DE\u5373\u65F6/\u957F\u671F/\u9879\u76EE\u603B\u6570\u3001\u5373\u65F6/\u957F\u671F\u4E0B\u7684 URI domain \u7C7B\u578B\u5360\u7528\u3001\u4EE5\u53CA\u6BCF\u4E2A domain \u4E0B memory \u6761\u6570\u5360\u7528\u3002",inputSchema:{type:"object",properties:{memory_type:{...e,description:"\u8BB0\u5FC6\u7C7B\u578B\uFF08\u53EF\u9009\uFF09\u3002\u4E0D\u4F20\u65F6\u8FD4\u56DE\u5373\u65F6/\u957F\u671F/\u9879\u76EE\u603B\u6570\u4E0E\u5404 domain \u5360\u7528\u7EDF\u8BA1\uFF1B\u4F20\u6307\u5B9A\u7C7B\u578B\u65F6\u53EA\u8FD4\u56DE\u8BE5\u7C7B\u578B\u7684\u5360\u7528\u8BE6\u60C5\u3002"}},required:[]}},_={name:"list_memories_by_file",description:"\u67E5\u8BE2\u7ED1\u5B9A\u4E86\u6307\u5B9A\u6587\u4EF6\u7684\u6240\u6709 Memory\u3002\u9ED8\u8BA4\u5408\u5E76\u641C\u7D22\u81EA\u8EAB\u3001\u540C\u5DE5\u4F5C\u8DEF\u5F84\u5176\u4ED6\u89D2\u8272\uFF08\u540Cbridge\u5B9E\u4F8B\uFF09\u4E0E\u5B50Agent\uFF08\u5DE5\u4F5C\u533A\u8DEF\u5F84\u4E3A\u5F53\u524D\u8DEF\u5F84\u5B50\u76EE\u5F55\u7684Agent\uFF09\u7ED1\u5B9A\u4E86\u6587\u4EF6\u7684\u8BB0\u5FC6\u3002\u5B50Agent\u7684\u8BB0\u5FC6\u4F1A\u505Apath_prefix\u81EA\u52A8\u5339\u914D\uFF0C\u65E0\u9700\u624B\u52A8\u8BA1\u7B97\u8DEF\u5F84\u3002\u540C\u5DE5\u4F5C\u8DEF\u5F84\u5176\u4ED6\u89D2\u8272\u7684\u5171\u4EAB\u8BB0\u5FC6\u4EC5\u9650\u7ED1\u5B9A\u6587\u4EF6\u7684project_memory\uFF0C\u5E26 readonly=true \u4E0E source_role_name \u6765\u6E90\u6807\u8BB0\uFF0C\u53EA\u8BFB\u4E0D\u53EF\u4FEE\u6539\u3002\u4F8B\u5982\u7236Agent\u641C\u7D22 ./a/b/c/src/a.txt\uFF0C\u5B50Agent(\u5DE5\u4F5C\u8DEF\u5F84./a/b/c)\u7ED1\u5B9A./src/a.txt\u7684\u8BB0\u5FC6\u4F1A\u88AB\u81EA\u52A8\u5339\u914D\u3002",inputSchema:{type:"object",properties:{file_path:{type:"string",description:"\u6587\u4EF6\u8DEF\u5F84\uFF0C\u4F8B\u5982 /path/to/file.md"},memory_type:e,scope:{type:"string",enum:["own","children","all"],description:"\u641C\u7D22\u8303\u56F4\uFF1Aown\uFF08\u4EC5\u641C\u7D22\u81EA\u5DF1\u7684\u8BB0\u5FC6\uFF09\u3001children\uFF08\u641C\u7D22\u5B50Agent\u7ED1\u5B9A\u4E86\u6587\u4EF6\u7684\u8BB0\u5FC6\uFF0C\u6309path_prefix\u81EA\u52A8\u5339\u914D\uFF09\u3001all\uFF08\u9ED8\u8BA4\uFF0C\u5408\u5E76\u641C\u7D22\u81EA\u5DF1\u3001\u540C\u5DE5\u4F5C\u8DEF\u5F84\u5176\u4ED6\u89D2\u8272\u7684\u53EA\u8BFB\u5171\u4EAB\u8BB0\u5FC6\uFF08\u4EC5project_memory\uFF09\u3001\u5B50Agent\u7684\u8BB0\u5FC6\uFF09\u3002"}},required:["file_path"]}},c={name:"abandon_memory_update",description:"\u653E\u5F03\u6307\u5B9A Memory \u7684\u66F4\u65B0\u4E2D\u72B6\u6001\u3002\u5F53\u7CFB\u7EDF\u68C0\u6D4B\u5230\u6587\u4EF6\u53D8\u66F4\u5E76\u81EA\u52A8\u6807\u8BB0\u4E3A\u66F4\u65B0\u4E2D\u540E\uFF0C\u5982\u679C Agent \u51B3\u5B9A\u6682\u4E0D\u66F4\u65B0\uFF0C\u53EF\u4EE5\u8C03\u7528\u6B64\u5DE5\u5177\u6E05\u9664\u66F4\u65B0\u6807\u8BB0\u3002\u6CE8\u610F\uFF1A\u82E5\u5F53\u524D\u5DF2\u7ED1\u5B9A\u7684\u6587\u4EF6\u4E2D\u5B58\u5728\u5DF2\u5220\u9664\u7684\u6587\u4EF6\uFF0C\u653E\u5F03\u66F4\u65B0\u5C06\u5931\u8D25\uFF0C\u9700\u5148\u901A\u8FC7 update_memory \u4FEE\u6B63 bound_files \u5217\u8868\uFF08\u79FB\u9664\u4E0D\u5B58\u5728\u7684\u6587\u4EF6\uFF09\u3002",inputSchema:{type:"object",properties:{uri:t,memory_type:e},required:["uri"]}},a={name:"memory_recurrence",description:`\u83B7\u53D6\u5DF2\u8FC7\u671F\u7684\u53EF\u8FC7\u671F\u8BB0\u5FC6\uFF08instance_long_memory\uFF1AAgent \u5B9E\u4F8B\u957F\u671F\u8BB0\u5FC6\uFF1Binstance_memory\uFF1AAgent \u5B9E\u4F8B\u5373\u65F6\u8BB0\u5FC6\uFF09\u3002
|
|
22
|
+
\u8FC7\u671F\u6761\u4EF6\uFF1A\u4E0A\u8FF0\u4E24\u79CD\u7C7B\u578B\u7684 expires_at < NOW()\u3002\u521D\u59CB TTL 12h\uFF1Bupdate_memory \u7EED\u671F\uFF1Ainstance_memory \u5237\u65B0\u4E3A\u56FA\u5B9A\u5468\u671F\uFF0Cinstance_long_memory \u6BCF\u6B21\u7EED\u671F TTL \xD72\u3002
|
|
23
23
|
\u8C03\u7528\u540E\uFF0C\u7CFB\u7EDF\u4F1A\u539F\u5B50\u8BA4\u9886\u6700\u591A 50 \u6761\u5DF2\u8FC7\u671F\u8BB0\u5FC6\u4E3A[\u56DE\u5FC6\u4E2D](recalling)\u72B6\u6001\uFF08\u8BA4\u9886\u8005+\u8BA4\u9886\u79DF\u7EA6\uFF0C\u5E42\u7B49\u53EF\u91CD\u590D\u8C03\u7528\uFF09\u3002
|
|
24
24
|
\u5DF2\u7EED\u671F\u7684\u8BB0\u5FC6\uFF08expiresAt \u5728\u672A\u6765\uFF09\u4E0D\u4F1A\u518D\u6B21\u51FA\u73B0\uFF1B\u51B3\u5B9A\u4E0D\u4FDD\u7559\u7684\u8BB0\u5FC6\u4FDD\u6301[\u56DE\u5FC6\u4E2D]\u72B6\u6001\uFF0C
|
|
25
25
|
\u5728\u672C\u6279\u5BA1\u67E5\u5B8C\u6BD5\u540E\u901A\u8FC7 memory_recurrence_complete \u6E05\u7406\u5220\u9664\u3002
|
|
26
26
|
Agent \u5E94\u5BA1\u67E5\u8FD9\u4E9B\u8BB0\u5FC6\u5185\u5BB9\uFF0C\u51B3\u5B9A\u662F\uFF1A
|
|
27
27
|
1) \u901A\u8FC7 update_memory \u7EED\u671F\uFF08\u7EED\u671F\u540E\u4E0D\u518D\u88AB\u672C\u6D41\u7A0B\u56DE\u6536\uFF09
|
|
28
28
|
2) \u4E0D\u7EED\u671F\uFF0C\u672C\u6279\u5BA1\u67E5\u5B8C\u6BD5\u540E\u8C03\u7528 memory_recurrence_complete \u5220\u9664\u5B83\u4EEC`,inputSchema:{type:"object",properties:{limit:{type:"number",description:"\u6BCF\u6B21\u6279\u91CF\u5904\u7406\u7684\u8BB0\u5FC6\u6570\u91CF\uFF08\u6309\u8FC7\u671F\u65F6\u95F4\u6700\u65E9\u4F18\u5148\uFF0C\u9ED8\u8BA4 10\uFF09\u3002\u4F8B\u5982 totalExpired=40\u3001limit=10 \u65F6\u7B2C\u4E00\u6B21\u8FD4\u56DE 10 \u6761\uFF0Cremaining=30\u3002",default:10}},required:[]}},d={name:"memory_recurrence_complete",description:`\u5B8C\u6210\u5373\u5C06\u9057\u5FD8\u7684\u8BB0\u5FC6\u758F\u7406\u5DE5\u4F5C\u3002
|
|
29
|
-
\u5220\u9664\u672C\u4EBA\u8BA4\u9886\u7684[\u56DE\u5FC6\u4E2D](recalling)\u72B6\u6001\u5DF2\u8FC7\u671F\u53EF\u8FC7\u671F\u8BB0\u5FC6\
|
|
29
|
+
\u5220\u9664\u672C\u4EBA\u8BA4\u9886\u7684[\u56DE\u5FC6\u4E2D](recalling)\u72B6\u6001\u5DF2\u8FC7\u671F\u53EF\u8FC7\u671F\u8BB0\u5FC6\uFF08instance_long_memory / instance_memory\uFF09\u3002
|
|
30
30
|
\u63A8\u8350\u7528\u6CD5\uFF1A\u968F\u5BA1\u67E5\u5206\u6279\u6E05\u7406\uFF08\u6BCF\u6279\u4F20\u5165\u672C\u6279\u786E\u5B9A\u5220\u9664\u7684 URI\uFF09\uFF1B\u5168\u90E8\u6279\u6B21\u5904\u7406\u5B8C\u6BD5\u540E\u4E0D\u5E26\u53C2\u6570\u8C03\u7528\u4E00\u6B21\uFF0C\u6E05\u7406\u5269\u4F59\u5168\u90E8\u3002
|
|
31
|
-
\u8BE5\u5DE5\u5177\u4EC5\u5220\u9664\uFF0C\u4E0D\u505A\u5F52\u6863\uFF1B\u9700\u8981\u957F\u671F\u4FDD\u7559\u7684\u5185\u5BB9\u8BF7\u5148\u8C03\u7528 create_memory \u4FDD\u5B58\u540E\u518D\u5220\u9664\u65E7\u6761\u76EE\u3002`,inputSchema:{type:"object",properties:{uris:{type:"array",items:{type:"string"},description:"\u53EF\u9009\u3002\u672C\u6279\u786E\u5B9A\u5220\u9664\u7684 memory URI \u5217\u8868\uFF1B\u4E0D\u4F20\u65F6\u5220\u9664\u672C\u4EBA\u8BA4\u9886\u7684\u5168\u90E8[\u56DE\u5FC6\u4E2D]\u5DF2\u8FC7\u671F\u8BB0\u5FC6\u3002"}},required:[]}};export{c as ABANDON_MEMORY_UPDATE_TOOL,n as CREATE_MEMORY_TOOL,m as DELETE_MEMORY_TOOL,
|
|
31
|
+
\u8BE5\u5DE5\u5177\u4EC5\u5220\u9664\uFF0C\u4E0D\u505A\u5F52\u6863\uFF1B\u9700\u8981\u957F\u671F\u4FDD\u7559\u7684\u5185\u5BB9\u8BF7\u5148\u8C03\u7528 create_memory \u4FDD\u5B58\u540E\u518D\u5220\u9664\u65E7\u6761\u76EE\u3002`,inputSchema:{type:"object",properties:{uris:{type:"array",items:{type:"string"},description:"\u53EF\u9009\u3002\u672C\u6279\u786E\u5B9A\u5220\u9664\u7684 memory URI \u5217\u8868\uFF1B\u4E0D\u4F20\u65F6\u5220\u9664\u672C\u4EBA\u8BA4\u9886\u7684\u5168\u90E8[\u56DE\u5FC6\u4E2D]\u5DF2\u8FC7\u671F\u8BB0\u5FC6\u3002"}},required:[]}};export{c as ABANDON_MEMORY_UPDATE_TOOL,n as CREATE_MEMORY_TOOL,m as DELETE_MEMORY_TOOL,y as GET_MEMORY_STATS_TOOL,_ as LIST_MEMORIES_BY_FILE_TOOL,s as LIST_MEMORIES_TOOL,d as MEMORY_RECURRENCE_COMPLETE_TOOL,a as MEMORY_RECURRENCE_TOOL,i as READ_MEMORY_TOOL,p as SEARCH_MEMORY_TOOL,o as UPDATE_MEMORY_TOOL};
|
|
32
32
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{DEBUG_LOG_TOOL_NAMES as
|
|
2
|
-
`)}export{r as BRIDGE_LAZY_CAPABILITIES,a as TOOL_GROUPS,
|
|
1
|
+
import{DEBUG_LOG_TOOL_NAMES as i,DRAW_TOOL_NAMES as s,EMAIL_TOOL_NAMES as n,FILE_CHANGES_HISTORY_TOOL_NAMES as u,HIRE_TOOL_NAMES as d,LAUNCH_CONFIG_TOOL_NAMES as f,ABILITY_DEV_TOOL_NAMES as c,ABILITY_MARKET_TOOL_NAMES as p,MEETING_TOOL_NAMES as y,OFFICE_TOOL_NAMES as m,PENCIL_TOOL_NAMES as b,TASK_TOOL_NAMES as _}from"./mcp-tools.js";const S=new Set(["disabled","collapsed","expanded"]);function A(e){if(e===!0)return"expanded";if(e===!1)return"disabled";if(typeof e=="string"&&S.has(e))return e}const a=[{key:"launch",label:"\u542F\u52A8\u9879\u7BA1\u7406",featureKey:"agentSys.launchItem",toolNames:f,collapsible:!0,defaultState:"collapsed",summary:"\u7BA1\u7406\u9879\u76EE\u4E2D\u4E1A\u52A1\u7A0B\u5E8F\u7684\u8D77\u505C\uFF0C\u82E5\u540E\u9762\u9700\u8981\u542F\u52A8\u9879\u76EE\u5E94\u4F7F\u7528\u6B64\u5DE5\u5177"},{key:"hire",label:"\u62DB\u8058\u5DE5\u5177",featureKey:"agentSys.hire",toolNames:d,collapsible:!0,defaultState:"collapsed",summary:"\u62DB\u8058\u65B0\u7684\u540C\u4E8B Agent\uFF08\u5355\u4E2A\u6216\u6279\u91CF\uFF09"},{key:"abilityMarket",label:"\u80FD\u529B\u5E02\u573A",featureKey:"agentSys.skillInstall",toolNames:p,collapsible:!0,defaultState:"collapsed",summary:"\u6D4F\u89C8\u80FD\u529B\u5E02\u573A\u5E76\u628A MCP\u3001Skill\u3001Plugin \u5B89\u88C5/\u5378\u8F7D\u5230\u81EA\u8EAB\u6240\u5728\u89D2\u8272\u5B9E\u4F8B\u6216\u5168\u5C40\u914D\u7F6E\u6A21\u677F\uFF08scope\uFF09\uFF0C\u6D4F\u89C8\u65F6\u53EF\u62FF\u5230\u73AF\u5883\u53D8\u91CF\u5951\u7EA6\uFF08envSchema\uFF09\uFF0C\u5B89\u88C5\u65F6\u901A\u8FC7 env \u914D\u7F6E\uFF08\u8303\u56F4=\u5F53\u524D\u5B9E\u4F8B\uFF09\uFF1B\u5B89\u88C5\u5B8C\u6210\u5373\u8FD4\u56DE\u5DE5\u5177\u6E05\u5355\u4E0E\u8C03\u7528\u65B9\u5F0F"},{key:"abilityDev",label:"\u80FD\u529B\u5F00\u53D1\uFF08MCP/\u63D2\u4EF6/Skill\uFF09",featureKey:"agentSys.abilityDev",toolNames:c,collapsible:!0,defaultState:"collapsed",summary:"\u5728\u81EA\u5DF1\u4F1A\u8BDD\u5DE5\u4F5C\u533A\u5185\u81EA\u7814 MCP/\u63D2\u4EF6/Skill\uFF1A\u7528 ability_dev_ide \u8BFB\u7F16\u5199\u89C4\u8303\uFF08action=guide\uFF09\u5E76\u4E34\u65F6\u6302\u8F7D\u8C03\u8BD5\u4E0E\u6392\u969C\uFF08action=mount/unmount/list/logs\uFF0C\u4E0D\u6301\u4E45\u5316\u3001\u6587\u4EF6\u53D8\u66F4\u81EA\u52A8\u91CD\u8F7D\uFF09\uFF0C\u8C03\u8BD5\u901A\u8FC7\u540E\u8F6C\u6B63\uFF08formal_ability\uFF0C\u9ED8\u8BA4\u5165\u5168\u5C40\u914D\u7F6E\u6A21\u677F\u4E14\u521D\u59CB\u5316\u5173\u95ED\uFF09\uFF1B\u67E5\u770B\u81EA\u8EAB\u5168\u90E8\u80FD\u529B\u7528 list_my_abilities"},{key:"pencil",label:"\u8BBE\u8BA1\u753B\u5E03(pencil)",featureKey:"pencil",toolNames:b,collapsible:!0,defaultState:"collapsed",summary:"UI design editor. Open-source Figma alternative."},{key:"draw",label:"\u7ED8\u56FE",featureKey:"draw",toolNames:s,collapsible:!0,defaultState:"collapsed",summary:"\u7ED8\u5236 draw.io \u6D41\u7A0B\u56FE / \u6CF3\u9053\u56FE\uFF0C\u5BFC\u51FA XML"},{key:"office",label:"Office \u6587\u4EF6",featureKey:"office",toolNames:m,collapsible:!0,defaultState:"collapsed",summary:"\u521B\u5EFA\u4E0E\u7F16\u8F91 Word/Excel/PowerPoint\uFF08docx/xlsx/pptx\uFF0CApache POI \u683C\u5F0F\u5C42\uFF09\uFF1AWord \u652F\u6301 run/\u5355\u5143\u683C\u7EA7\u7CBE\u51C6\u7F16\u8F91\u3001\u6279\u6CE8\u3001\u4FEE\u8BA2\u3001\u516C\u5F0F\u3001\u76EE\u5F55\u9875\u7801\u3001\u4E09\u7EBF\u8868\u3001\u6807\u9898\u7F16\u53F7\u4E0E\u683C\u5F0F\u89C4\u8303\u68C0\u67E5/\u4E00\u952E\u4FEE\u6B63\uFF1B\u6821\u9A8C\u3001\u751F\u6210 HTML \u9884\u89C8\u3001\u5728 Dashboard \u9762\u677F\u4E2D\u5B9E\u65F6\u67E5\u770B\uFF0C\u53EF\u53D1\u6D88\u606F\u5361\u7247\u5206\u4EAB\u6587\u4EF6\uFF1B\u6587\u6863\u81EA\u52A8\u767B\u8BB0\u4E3A\u4E91\u6587\u6863\uFF0C\u652F\u6301\u5217\u51FA/\u5206\u4EAB\u7ED9\u5176\u4ED6 Agent \u534F\u4F5C\uFF08read|write\uFF09\u4E0E\u8FFD\u8D76\u53D8\u66F4"},{key:"task",label:"\u6D41\u7A0B\u4EFB\u52A1",featureKey:"collaboration.task",toolNames:_,collapsible:!0,defaultState:"collapsed",summary:"\u5904\u7406\u6D41\u7A0B\u7EBF\u4EFB\u52A1\uFF1A\u67E5\u770B\u5F53\u524D\u4EFB\u52A1\u3001\u63D0\u4EA4\u6267\u884C\u7ED3\u679C\u3001\u56DE\u9000\u4EFB\u52A1\u3001\u7ED9\u6D41\u7A0B\u5B9E\u4F8B\u7559\u8A00"},{key:"meeting",label:"\u4F1A\u8BAE",featureKey:"collaboration.meeting",toolNames:y,collapsible:!0,defaultState:"collapsed",summary:"\u521B\u5EFA/\u52A0\u5165\u4F1A\u8BAE\u3001\u53D1\u8A00\u3001\u67E5\u770B\u4F1A\u8BAE\u4FE1\u606F\u3001\u79BB\u5F00/\u7ED3\u675F\u4F1A\u8BAE"},{key:"debug",label:"\u8C03\u8BD5\u65E5\u5FD7",featureKey:"collaboration.debug",toolNames:i,collapsible:!0,defaultState:"collapsed",summary:"\u6309\u6761\u4EF6\u5206\u9875\u67E5\u8BE2 Debug \u65E5\u5FD7\u4E0E\u83B7\u53D6\u65E5\u5FD7\u4E0A\u62A5\u914D\u7F6E"},{key:"fileHistory",label:"\u6587\u4EF6\u53D8\u66F4\u5386\u53F2",featureKey:"collaboration.fileHistory",toolNames:u,collapsible:!0,defaultState:"collapsed",summary:"\u6309\u89D2\u8272/\u5B9E\u4F8B/\u6587\u4EF6\u8DEF\u5F84\u8FC7\u6EE4\u67E5\u8BE2\u6587\u4EF6\u53D8\u66F4\u5386\u53F2"},{key:"email",label:"\u90AE\u7BB1",featureKey:"email",toolNames:n,collapsible:!0,defaultState:"collapsed",summary:"\u6536\u53D1\u89D2\u8272\u5B9E\u4F8B\u57DF\u540D\u90AE\u7BB1\uFF08xxxxx@\u57DF\u540D\uFF09\uFF1A\u53D1\u4FE1\u3001\u5217\u90AE\u4EF6\u3001\u8BFB\u6B63\u6587\u4E0E\u9644\u4EF6\u3001\u56DE\u4FE1\u4FDD\u6301\u7EBF\u7A0B\u3001\u786E\u8BA4\u4E1A\u52A1\u6D88\u8D39"}],O=new Map(a.map(e=>[e.key,e])),N=(()=>{const e=new Map;for(const l of a)for(const t of l.toolNames)e.set(t,l);return e})();function k(e){return O.get(e)}const r=[{key:"browser",label:"\u6D4F\u89C8\u5668\u64CD\u4F5C",featureKey:"browser",defaultState:"collapsed",summary:"\u542F\u52A8\u6D4F\u89C8\u5668\u4F1A\u8BDD\u3001\u5BFC\u822A\u3001\u622A\u56FE\u4E0E\u9875\u9762\u4EA4\u4E92"},{key:"desktop",label:"\u684C\u9762\u64CD\u4F5C",featureKey:"desktop",defaultState:"disabled",summary:"\u622A\u5C4F\u3001\u9F20\u6807\u952E\u76D8\u63A7\u5236\u4E0E UI \u81EA\u52A8\u5316\uFF08Computer Use\uFF09"}];function x(e){return r.find(l=>l.key===e)}function L(e){return N.get(e)}function M(e){const l=a.find(o=>o.featureKey===e);return l?l.defaultState:r.find(o=>o.featureKey===e)?.defaultState}function I(e){return r.find(l=>e.startsWith(`${l.key}_`))}function g(){return a.filter(e=>e.collapsible).map(e=>e.key)}const T="ACODE_TOOL_GROUPS_V1:";function K(){const e=a.filter(l=>l.collapsible).map(l=>({key:l.key,label:l.label,toolNames:[...l.toolNames]}));return`${T}${JSON.stringify({groups:e})}`}function G(e,l,t){return e.featureKey&&l==="disabled"?"disabled":e.collapsible&&l==="collapsed"&&!t?"collapsed":"expanded"}function P(e){return e.length===0?void 0:["## \u6309\u9700\u5DE5\u5177\u96C6","","\u4EE5\u4E0B\u5DE5\u5177\u96C6\u9ED8\u8BA4\u6536\u8D77\u4EE5\u4FDD\u6301\u5DE5\u5177\u5217\u8868\u7A33\u5B9A\u5E76\u8282\u7701\u4E0A\u4E0B\u6587\u3002\u5F53\u4EFB\u52A1\u9700\u8981\u65F6\uFF0C\u5148\u8C03\u7528 expand_tools \u5C55\u5F00\uFF0C","\u5DE5\u5177\u5B9A\u4E49\uFF08\u540D\u79F0/\u8BF4\u660E/\u53C2\u6570 schema\uFF09\u968F expand_tools \u7684\u8FD4\u56DE\u7ED3\u679C\u4E0B\u53D1\uFF0C\u5F53\u8F6E\u5373\u53EF\u7ECF call_tool \u8C03\u7528\uFF1A",'call_tool({ name: "<\u5DE5\u5177\u540D>", arguments: {...} })',"",...e.map(t=>`- ${t.key}\uFF08${t.label}\uFF09\uFF1A${t.summary}`),"",'\u793A\u4F8B\uFF1Aexpand_tools({ group: "pencil" })'].join(`
|
|
2
|
+
`)}export{r as BRIDGE_LAZY_CAPABILITIES,a as TOOL_GROUPS,T as TOOL_GROUP_MANIFEST_PREFIX,K as buildToolGroupManifest,P as buildToolGroupPrompt,g as collapsibleToolGroupKeys,M as defaultStateForFeatureKey,I as findBridgeCapabilityByToolName,x as findBridgeLazyCapability,k as findToolGroup,L as findToolGroupByToolName,A as normalizeFeatureState,G as resolveToolGroupState};
|
|
3
3
|
|
|
@@ -535,33 +535,12 @@ export interface TaskInstanceCommentArgs {
|
|
|
535
535
|
content: string;
|
|
536
536
|
}
|
|
537
537
|
|
|
538
|
-
export interface PluginCatalogTool {
|
|
539
|
-
name: string;
|
|
540
|
-
description: string;
|
|
541
|
-
requiredParams?: string[];
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
export interface PluginCatalogEntry {
|
|
545
|
-
plugin: string;
|
|
546
|
-
version?: string;
|
|
547
|
-
description?: string;
|
|
548
|
-
status: "enabled" | "disabled" | "error";
|
|
549
|
-
tools: PluginCatalogTool[];
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
export interface PluginCatalogSnapshot {
|
|
553
|
-
revision: number;
|
|
554
|
-
plugins: PluginCatalogEntry[];
|
|
555
|
-
}
|
|
556
|
-
|
|
557
538
|
export interface PollMessageResult {
|
|
558
539
|
|
|
559
540
|
systemMessages?: DirectMessage[];
|
|
560
541
|
directMessages: DirectMessage[];
|
|
561
542
|
groupMessages: GroupMessage[];
|
|
562
543
|
fromBuffer: boolean;
|
|
563
|
-
|
|
564
|
-
pluginCatalog?: PluginCatalogSnapshot;
|
|
565
544
|
}
|
|
566
545
|
|
|
567
546
|
export type AgentActionType = "skill" | "mcp" | "idle" | "edit_file" | "write_file" | "read_file" | "bash" | "search" | "web" | "thinking" | "tool_using";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aws-runtime-bridge",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.170",
|
|
4
4
|
"description": "AgentsWorkStudio runtime bridge service for machine-level agent runtime integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"prestart": "npm run build:agent-mcp && npm run build:acode",
|
|
47
47
|
"start": "node dist/index.js",
|
|
48
48
|
"predev": "npm run build:all",
|
|
49
|
-
"dev": "tsc -p tsconfig.json && node scripts/
|
|
49
|
+
"dev": "tsc -p tsconfig.json && node scripts/dev-runner.mjs",
|
|
50
50
|
"prepublishOnly": "npm run build",
|
|
51
51
|
"prepack": "node scripts/prepack-guard.mjs",
|
|
52
52
|
"postpack": "node scripts/postpack-restore.mjs",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"node-screenshots": "^0.2.8",
|
|
75
75
|
"playwright": "^1.62.0",
|
|
76
76
|
"tar": "^7.5.15",
|
|
77
|
+
"temml": "^0.13.5",
|
|
77
78
|
"typescript": "^5.9.3",
|
|
78
79
|
"typescript-language-server": "^4.3.4",
|
|
79
80
|
"unzipper": "^0.12.3",
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-plugin
|
|
3
|
-
description: 引导 Agent 开发一个新的 ACode 插件(获取开发规范、生成脚手架;$ARGUMENTS 传插件名与用途)
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 创建 ACode 插件(内置 /create-plugin 命令)
|
|
7
|
-
|
|
8
|
-
用户要求创建插件时执行本流程。插件名/用途:$ARGUMENTS(未给出时先向用户确认)。
|
|
9
|
-
|
|
10
|
-
## 1. 开发规范(权威)
|
|
11
|
-
完整规范见仓库 `docs/plugin-development-guide.md`,先读取它。要点:
|
|
12
|
-
|
|
13
|
-
- 插件 = 一个目录 + 四类声明文件,零框架依赖:
|
|
14
|
-
- `plugin.json`(必需):`name`(kebab-case,保留前缀 `system.`/`aws-`/`acode-` 不可用)、`version`、`description`、`tools`、`listeners`、`commands`、`userConfig`(安装时向用户要的配置)。
|
|
15
|
-
- `tools/tools.json`(可选):注入给 agent 的工具目录;handler 支持 `process`(跑命令)/ `module`(JS 函数)/ `mcp`(预留)。
|
|
16
|
-
- `listeners/listeners.json`(可选):事件监听器,对接 poll_message 的 `[plugin-event]`。
|
|
17
|
-
- `commands/`(可选):斜杠命令 markdown,如 `mycmd.md` 定义 `/mycmd`。
|
|
18
|
-
- 未知清单字段会被剥离而非报错。
|
|
19
|
-
|
|
20
|
-
## 2. 生成脚手架
|
|
21
|
-
用文件工具在当前工作区创建插件目录,推荐结构:
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
<插件名>/
|
|
25
|
-
├── plugin.json
|
|
26
|
-
├── tools/tools.json # 如无工具可省略
|
|
27
|
-
├── listeners/listeners.json # 如无监听可省略
|
|
28
|
-
└── commands/ # 如无斜杠命令可省略
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
`plugin.json` 最小示例:
|
|
32
|
-
|
|
33
|
-
```json
|
|
34
|
-
{
|
|
35
|
-
"name": "<插件名>",
|
|
36
|
-
"version": "0.1.0",
|
|
37
|
-
"description": "<一句话描述>"
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## 3. 校验并安装生效
|
|
42
|
-
- 目录就绪后校验:确认 `plugin.json` 存在且 `name` 合法、各引用文件存在、JSON 语法正确。
|
|
43
|
-
- 安装:经 `function_call` 调用内置插件 plugin-manager 的 manage 工具,`function_call { "tool": "plugin-manager.manage", "params": { "action": "install", "source": "local:<插件目录绝对路径>" } }`(插件管理默认可用,无需额外能力开关)。
|
|
44
|
-
- 安装后:下一次 poll_message 的 `pluginCatalog` 可见新插件工具;监听器开始向 poll_message 投递 `[plugin-event]`。
|