aitable-workflow-core 0.1.15 → 0.1.16-beta.1786022310508

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.
@@ -0,0 +1,14 @@
1
+ import{a as c}from"./chunk-EI7MMDWY.js";import{access as _e,cp as te,mkdir as ne,mkdtemp as ct,readFile as T,rm as lt,writeFile as A}from"fs/promises";import h from"path";import ft from"os";import K from"yaml";import{createHash as Ie}from"crypto";import{readFile as G,writeFile as Be}from"fs/promises";import O from"path";var ie=".migrate-meta.json";async function z(e){try{let t=await G(O.join(e,ie),"utf8");return JSON.parse(t)}catch{return null}}c(z,"readMigrateMeta");async function J(e,t){let r=O.join(e,ie);await Be(r,JSON.stringify(t,null,2)+`
2
+ `,"utf8")}c(J,"writeMigrateMeta");function H(e){return Ie("sha256").update(e,"utf8").digest("hex").slice(0,16)}c(H,"hashFileContent");async function U(e,t){let r={};for(let n of t)try{let f=await G(O.join(e,n),"utf8");r[n]=H(f)}catch{}return r}c(U,"buildConfigSnapshot");async function L(e,t){let r={};for(let n of t)try{r[n]=await G(O.join(e,n),"utf8")}catch{}return r}c(L,"buildConfigBaseContents");import{readdir as Ae}from"fs/promises";import se from"path";var ae=new Set(["profile/profile.yml","aitable-workflow.config.yml","coding-agents.config.json"]),Ke=new Set(["package.json",".npmrc","npmrc",".gitignore",".migrate-meta.json",".migrate-conflicts.yml"]),Oe=["wiki/","skills/","profile/prompts/","profile/escalation/","profile/fastpath/","profile/troubleshoot/"],Je=new Set([".env",".env.example"]),Ue=/^workspaces\/[^/]+\/AGENTS\.md$/,Le=["lib/","workflows/"];function We(e){let t=e.replace(/\\/g,"/");if(ae.has(t))return"config";if(Ke.has(t))return"managed";if(Je.has(t)||Ue.test(t))return"content";for(let r of Oe)if(t.startsWith(r))return"content";for(let r of Le)if(t.startsWith(r))return"template";return"content"}c(We,"classifyFile");function W(){return[...ae]}c(W,"getConfigFilePaths");async function Z(e){let t=[];return await ce(e,e,t),t}c(Z,"classifyDirectory");var qe=new Set(["node_modules",".migrate-backup",".git","traces"]);async function ce(e,t,r){let n=await Ae(t,{withFileTypes:!0});for(let f of n){let a=se.join(t,f.name);if(f.isDirectory())qe.has(f.name)||await ce(e,a,r);else if(f.isFile()){let o=se.relative(e,a).replace(/\\/g,"/");r.push({relativePath:o,category:We(o)})}}}c(ce,"walkDir");function le(e,t,r){let n=[],f=[],a=[],o=[],s=[];return{merged:d(e,t,r,[]),conflicts:n,deprecated:f,newKeys:a,userPreserved:o,templateUpdated:s};function d(y,p,g,k){return V(y)&&V(p)&&V(g)?M(y,p,g,k):V(p)&&V(g)&&!V(y)?M(V(y)?y:{},p,g,k):j(y,p,g,k)}function M(y,p,g,k){let C=new Set;for(let l of Object.keys(y))C.add(l);for(let l of Object.keys(p))C.add(l);for(let l of Object.keys(g))C.add(l);let P={};for(let l of C){let _=l in y,I=l in p,N=l in g,E=[...k,l],D=E.join(".");!_&&!I&&N?(P[l]=g[l],a.push({path:E,pathString:D,theirsValue:g[l]})):!_&&I&&!N?P[l]=p[l]:!_&&I&&N?B(p[l],g[l])?P[l]=p[l]:V(p[l])&&V(g[l])?P[l]=M({},p[l],g[l],E):(P[l]=p[l],n.push({path:E,pathString:D,baseValue:void 0,oursValue:p[l],theirsValue:g[l]})):_&&!N?I&&!B(y[l],p[l])?(P[l]=p[l],n.push({path:E,pathString:D,baseValue:y[l],oursValue:p[l],theirsValue:void 0})):f.push({path:E,pathString:D,baseValue:y[l]}):_&&!I&&N?(P[l]=g[l],s.push(D)):P[l]=d(y[l],p[l],g[l],E)}return P}function j(y,p,g,k){let C=B(y,p),P=B(y,g),l=B(p,g);return C&&P?p:C&&!P?(s.push(k.join(".")),g):!C&&P?(o.push(k.join(".")),p):(l||(n.push({path:k,pathString:k.join("."),baseValue:y,oursValue:p,theirsValue:g}),o.push(k.join("."))),p)}}c(le,"threeWayMerge");function V(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}c(V,"isPlainObject");function B(e,t){if(e===t)return!0;if(e==null||t==null)return e===t;if(typeof e!=typeof t)return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((r,n)=>B(r,t[n]));if(typeof e=="object"){let r=e,n=t,f=Object.keys(r),a=Object.keys(n);return f.length!==a.length?!1:f.every(o=>Object.prototype.hasOwnProperty.call(n,o)&&B(r[o],n[o]))}return!1}c(B,"deepEqual");import{cp as ue,mkdir as Xe,readdir as Q,readFile as Ye,rm as ge,writeFile as Ge}from"fs/promises";import x from"path";var pe=".migrate-backup",fe=3,de=new Set(["node_modules",".migrate-backup",".git"]);async function me(e,t){let r=new Date,n=r.toISOString().replace(/[:.]/g,""),f=x.join(e,pe),a=x.join(f,n);await Xe(a,{recursive:!0});let o=await Q(e,{withFileTypes:!0});for(let u of o){if(de.has(u.name))continue;let d=x.join(e,u.name),M=x.join(a,u.name);await ue(d,M,{recursive:!0,force:!0,errorOnExist:!1})}let s=x.join(a,".backup-info.json");return await Ge(s,JSON.stringify({timestamp:r.toISOString(),cliVersion:t},null,2)+`
3
+ `,"utf8"),{timestamp:r.toISOString(),dirName:n,fullPath:a,cliVersion:t}}c(me,"createBackup");async function q(e){let t=x.join(e,pe),r;try{r=(await Q(t,{withFileTypes:!0})).filter(a=>a.isDirectory()).map(a=>a.name)}catch{return[]}let n=[];for(let f of r){let a=x.join(t,f),o=x.join(a,".backup-info.json");try{let s=JSON.parse(await Ye(o,"utf8"));n.push({timestamp:s.timestamp,dirName:f,fullPath:a,cliVersion:s.cliVersion})}catch{n.push({timestamp:f,dirName:f,fullPath:a,cliVersion:"unknown"})}}return n.sort((f,a)=>a.timestamp.localeCompare(f.timestamp)),n}c(q,"listBackups");async function we(e,t){let r=await Q(e,{withFileTypes:!0});for(let n of r){if(de.has(n.name))continue;let f=x.join(e,n.name);await ge(f,{recursive:!0,force:!0})}await ue(t.fullPath,e,{recursive:!0,force:!0,errorOnExist:!1,filter:c(n=>x.relative(t.fullPath,n)!==".backup-info.json","filter")})}c(we,"rollbackToBackup");async function he(e){let t=await q(e);if(t.length<=fe)return 0;let r=t.slice(fe);for(let n of r)await ge(n.fullPath,{recursive:!0,force:!0});return r.length}c(he,"pruneBackups");import{readFile as ye}from"fs/promises";var ke=/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/;function ze(e){let t=new Map;for(let r of e.split(`
4
+ `)){let n=ke.exec(r.trim());n&&t.set(n[1],n[2])}return t}c(ze,"parseEnvKeys");async function ve(e,t){let r;try{r=await ye(t,"utf8")}catch{return[]}let n="";try{n=await ye(e,"utf8")}catch{}let f=ze(n),a=[],o=r.split(`
5
+ `);for(let s=0;s<o.length;s++){let u=ke.exec(o[s].trim());if(!u)continue;let d=u[1],M=u[2];if(f.has(d))continue;let j;s>0&&o[s-1].trim().startsWith("#")&&(j=o[s-1].trim().replace(/^#\s*/,"")),a.push({key:d,exampleValue:M,comment:j})}return a}c(ve,"detectNewEnvVars");var Pe=["dependencies","devDependencies","optionalDependencies","peerDependencies"],He="aitable-workflow-";function Ce(e,t,r){let n=JSON.parse(JSON.stringify(t)),f=[];for(let a of Pe){let o=e[a];if(!o||typeof o!="object")continue;let s=n[a]??{};for(let[u,d]of Object.entries(o))u in s||u.startsWith(He)||(s[u]=d,f.push(u));n[a]=s}for(let a of Pe){let o=n[a];if(!(!o||typeof o!="object"))for(let[s,u]of Object.entries(o)){let d=r[s];d&&(o[s]=d)}}return{merged:n,preservedDeps:f}}c(Ce,"mergePackageJson");function Me(e){console.log(""),console.log("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),console.log("\u2551 aitable-workflow migrate \u2551"),console.log(`\u2551 ${e.templateName} \xB7 ${e.profileName} \u2192 ${e.newVersion.padEnd(33)}\u2551`),console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"),console.log(""),console.log(`\u6A21\u677F\u7248\u672C: ${e.oldVersion} \u2192 ${e.newVersion}`),console.log(""),console.log("\u2500\u2500 \u914D\u7F6E\u5408\u5E76 (config) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");for(let o of e.configMerges){if(o.noChange){console.log(` \u2713 ${o.relativePath} \u2014 \u65E0\u53D8\u5316`);continue}console.log(` \u2713 ${o.relativePath}`),o.userPreservedCount>0&&console.log(` \u251C \u4FDD\u7559: ${o.userPreservedCount} \u9879\u7528\u6237\u914D\u7F6E`),o.templateUpdatedCount>0&&console.log(` \u251C \u66F4\u65B0: ${o.templateUpdatedCount} \u9879\u6A21\u677F\u53D8\u66F4`);for(let s of o.newKeys)console.log(` \u2514 \u65B0\u589E: ${s.pathString}`);for(let s of o.deprecated)console.log(` \u2514 \u79FB\u9664: ${s.pathString} (\u5DF2\u5E9F\u5F03)`)}let t=e.contentFiles.filter(o=>o.action==="preserve"),r=e.contentFiles.filter(o=>o.action==="add-new");if(t.length>0||r.length>0){console.log(""),console.log("\u2500\u2500 \u5185\u5BB9\u4FDD\u7559 (content) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");let o=Ze(t.map(s=>s.relativePath));for(let[s,u]of o)console.log(` \u2713 ${s} \u2014 \u4FDD\u7559 (${u} \u6587\u4EF6)`);for(let s of r)console.log(` + ${s.relativePath} (\u65B0\u589E)`)}if(e.newEnvVars.length>0){console.log(" \u2713 .env \u2014 \u4FDD\u7559");for(let o of e.newEnvVars){let s=o.comment?` (${o.comment})`:"";console.log(` \u2514 \u26A0 \u65B0\u589E\u53D8\u91CF: ${o.key}${s}`)}}let n=e.templateFiles.filter(o=>o.action==="overwrite"),f=e.templateFiles.filter(o=>o.action==="add-new");if(n.length>0||f.length>0){console.log(""),console.log("\u2500\u2500 \u6A21\u677F\u66F4\u65B0 (template) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");let o=n.filter(s=>s.userModified);if(o.length>0){console.log(" \u26A0 \u4EE5\u4E0B\u6A21\u677F\u6587\u4EF6\u5DF2\u88AB\u624B\u52A8\u4FEE\u6539\uFF0C\u5347\u7EA7\u5C06\u8986\u76D6\u4F60\u7684\u4FEE\u6539\uFF1A");for(let s of o)console.log(` ${s.relativePath}`)}for(let s of n.filter(u=>!u.userModified))console.log(` \u21BB ${s.relativePath}`);for(let s of f)console.log(` + ${s.relativePath} (\u65B0\u589E)`)}if(e.managedFiles.length>0){console.log(""),console.log("\u2500\u2500 \u91CD\u65B0\u751F\u6210 (managed) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");for(let o of e.managedFiles)o.preservedDeps&&o.preservedDeps.length>0?console.log(` \u21BB ${o.relativePath} (\u4FDD\u7559\u81EA\u5B9A\u4E49\u4F9D\u8D56: ${o.preservedDeps.join(", ")})`):console.log(` \u21BB ${o.relativePath}`)}let a=e.configMerges.reduce((o,s)=>o+s.conflicts.length,0);if(a>0){console.log(""),console.log("\u2500\u2500 \u51B2\u7A81 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),console.log(` \u26A0 ${a} \u5904\u51B2\u7A81\uFF08\u5DF2\u4FDD\u7559\u4F60\u7684\u503C\uFF0C\u8BF7\u5BA1\u67E5\uFF09:`);for(let o of e.configMerges)for(let s of o.conflicts)console.log(` ${o.relativePath} \u2192 ${s.pathString}`),console.log(` \u4F60\u7684\u503C: ${JSON.stringify(s.oursValue)}`),console.log(` \u65B0\u6A21\u677F\u503C: ${JSON.stringify(s.theirsValue)}`);console.log(""),console.log(" \u51B2\u7A81\u8BE6\u60C5\u5C06\u5199\u5165 .migrate-conflicts.yml")}console.log("")}c(Me,"printMigrationPreview");function Re(){console.log("[dry-run] \u4EE5\u4E0A\u4E3A\u9884\u89C8\uFF0C\u672A\u6267\u884C\u4EFB\u4F55\u5199\u5165\u64CD\u4F5C\u3002"),console.log(` \u53BB\u6389 --dry-run \u6267\u884C\u5B9E\u9645\u8FC1\u79FB\u3002
6
+ `)}c(Re,"printDryRunFooter");function Se(e){console.log(`\u2713 \u8FC1\u79FB\u5B8C\u6210
7
+ `),console.log("\u4E0B\u4E00\u6B65:"),console.log(` 1. cd ${e}`),console.log(" 2. tnpm i"),console.log(" 3. aitable-workflow setup"),console.log(` 4. aitable-workflow run
8
+ `)}c(Se,"printPostMigrateSteps");function Ze(e){let t=new Map;for(let r of e){let n=r.split("/")[0];t.set(n,(t.get(n)??0)+1)}return[...t.entries()].sort((r,n)=>r[0].localeCompare(n[0]))}c(Ze,"groupByPrefix");import{cp as Ee,access as Qe,readFile as et,readdir as Fe,rename as tt,writeFile as nt}from"fs/promises";import S from"path";import{fileURLToPath as rt}from"url";async function $(e){try{return await Qe(e),!0}catch{return!1}}c($,"exists");async function ee(){let e=S.dirname(rt(import.meta.url));for(let t=0;t<8;t++){let r=S.join(e,"templates");if(await $(r))return r;let n=S.dirname(e);if(n===e)break;e=n}throw new Error("\u627E\u4E0D\u5230\u5185\u7F6E templates \u76EE\u5F55(\u8BF7\u901A\u8FC7 templatesDir \u6CE8\u5165,\u6216\u786E\u8BA4 aitable-workflow-cli \u5DF2\u968F\u5305\u53D1\u5E03 templates)")}c(ee,"resolveTemplatesDir");async function ot(e){let t=e??await ee();return(await Fe(t,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name).sort()}c(ot,"listTemplates");async function it(e,t){let r=t??await ee(),n=S.join(r,e,"profiles");return await $(n)?(await Fe(n,{withFileTypes:!0})).filter(a=>a.isDirectory()).map(a=>a.name).sort():[]}c(it,"listProfiles");async function be(e,t,r,n,f={},a,o){let s=n??await ee(),u=S.join(s,e);if(!await $(u)){let g=await ot(s);throw new Error(`\u672A\u627E\u5230\u6A21\u677F "${e}"\u3002\u53EF\u7528\u6A21\u677F: ${g.join(", ")||"(\u7A7A)"}`)}let d;if(a){if(d=S.join(u,"profiles",a),!await $(d)){let g=await it(e,s);throw new Error(`\u6A21\u677F "${e}" \u672A\u627E\u5230 profile "${a}"\u3002\u53EF\u7528 profile: ${g.join(", ")||"(\u65E0)"}`)}}else{let g=S.join(u,"profiles","default");await $(g)&&(d=g,a="default")}let M=S.join(t,"package.json"),j=r||!await $(M),y=S.join(u,"profiles");await Ee(u,t,{recursive:!0,force:r,errorOnExist:!1,filter:c(g=>g!==y&&!g.startsWith(y+S.sep),"filter")}),d&&await Ee(d,t,{recursive:!0,force:!0,errorOnExist:!1}),j&&await at(M,f);let p=S.join(t,"npmrc");if(await $(p)&&await tt(p,S.join(t,".npmrc")),o){let g=W(),[k,C]=await Promise.all([U(t,g),L(t,g)]);await J(t,{schema_version:1,template:e,profile:a??"default",cli_version:o,scaffolded_at:new Date().toISOString(),config_snapshot:k,config_base_contents:C})}return{template:e,from:u,target:t,...a?{profile:a}:{}}}c(be,"scaffoldFromTemplate");var st=["dependencies","devDependencies","optionalDependencies","peerDependencies"];async function at(e,t){if(!await $(e)||Object.keys(t).length===0)return;let r=JSON.parse(await et(e,"utf8")),n=!1;for(let f of st){let a=r[f];if(!(!a||typeof a!="object"||Array.isArray(a)))for(let[o,s]of Object.entries(a)){let u=t[o];!u||s===u||(a[o]=u,n=!0)}}n&&await nt(e,`${JSON.stringify(r,null,2)}
9
+ `,"utf8")}c(at,"pinPackageVersions");async function ln(e){let t=ut(e.config),r=e.cliVersion??"unknown";if(e.list){let u=await q(t);if(u.length===0)console.log("\u65E0\u5907\u4EFD\u8BB0\u5F55\u3002");else{console.log("\u5907\u4EFD\u5217\u8868\uFF08\u6700\u65B0\u5728\u524D\uFF09\uFF1A");for(let d of u)console.log(` ${d.timestamp} CLI ${d.cliVersion} ${d.fullPath}`)}return{plan:xe(r)}}if(e.rollback){let u=await q(t);if(u.length===0)throw new Error("\u65E0\u53EF\u7528\u5907\u4EFD\uFF0C\u65E0\u6CD5\u56DE\u6EDA\u3002");let d=u[0];return console.log(`\u56DE\u6EDA\u5230\u5907\u4EFD: ${d.timestamp} (CLI ${d.cliVersion})`),await we(t,d),console.log(`\u2713 \u56DE\u6EDA\u5B8C\u6210\u3002
10
+ `),{plan:xe(r)}}let n=await z(t),f=e.template??n?.template??await gt(t),a=e.profile??n?.profile??"default",o=n?.cli_version??await pt(t)??"unknown";if(!f)throw new Error("\u65E0\u6CD5\u786E\u5B9A\u9879\u76EE\u4F7F\u7528\u7684\u6A21\u677F\u3002\u8BF7\u901A\u8FC7 --template <name> \u6307\u5B9A\uFF0C\u6216\u786E\u4FDD .migrate-meta.json \u5B58\u5728\u3002");let s=await ct(h.join(ft.tmpdir(),"migrate-template-"));try{await be(f,s,!0,e.templatesDir,e.templatePackageVersions,a);let u=W(),d=[],M=new Map;for(let i of u){let w=h.join(t,i),m=h.join(s,i),v,R;try{v=await T(w,"utf8")}catch{}try{R=await T(m,"utf8")}catch{}if(!v&&!R)continue;if(!v&&R){M.set(i,{result:{merged:{},conflicts:[],deprecated:[],newKeys:[],userPreserved:[],templateUpdated:[]},base:{},oursContent:"",theirsContent:R}),d.push({relativePath:i,conflicts:[],deprecated:[],newKeys:[],userPreservedCount:0,templateUpdatedCount:0,noChange:!1});continue}if(v&&!R)continue;let F=n?.config_base_contents?.[i],X=i.endsWith(".json")?Y=>JSON.parse(Y):Y=>K.parse(Y)??{},oe=F?X(F):{},$e=X(v),Te=X(R),b=le(oe,$e,Te);M.set(i,{result:b,base:oe,oursContent:v,theirsContent:R}),d.push({relativePath:i,conflicts:b.conflicts,deprecated:b.deprecated,newKeys:b.newKeys,userPreservedCount:b.userPreserved.length,templateUpdatedCount:b.templateUpdated.length,noChange:b.conflicts.length===0&&b.newKeys.length===0&&b.deprecated.length===0&&b.userPreserved.length===0&&b.templateUpdated.length===0})}let j=await Z(t),y=await Z(s),p=new Set(j.map(i=>i.relativePath)),g=new Set(y.map(i=>i.relativePath)),k=[];for(let i of j)i.category==="content"&&k.push({relativePath:i.relativePath,action:"preserve"});for(let i of y)i.category==="content"&&!p.has(i.relativePath)&&k.push({relativePath:i.relativePath,action:"add-new"});let C=[];for(let i of y)if(i.category==="template")if(p.has(i.relativePath)){let w=!1,m=n?.config_snapshot;if(m)try{let v=await T(h.join(t,i.relativePath),"utf8"),R=m[i.relativePath];R&&H(v)!==R&&(w=!0)}catch{}C.push({relativePath:i.relativePath,action:"overwrite",userModified:w})}else C.push({relativePath:i.relativePath,action:"add-new",userModified:!1});let P=[],l;if(g.has("package.json")){let i={},w={};try{i=JSON.parse(await T(h.join(t,"package.json"),"utf8"))}catch{}try{w=JSON.parse(await T(h.join(s,"package.json"),"utf8"))}catch{}l=Ce(i,w,e.templatePackageVersions??{}),P.push({relativePath:"package.json",preservedDeps:l.preservedDeps})}for(let i of[".npmrc",".gitignore"])g.has(i)&&P.push({relativePath:i});let _=[];for(let i of j)if(i.category==="template"&&i.relativePath.endsWith("workflow.yml"))try{let m=K.parse(await T(h.join(t,i.relativePath),"utf8")).tracker;if(m?.base_id||m?.table_id){let v=h.dirname(i.relativePath).split("/").pop()??i.relativePath;_.push({workflow:v,baseId:m.base_id??"",tableId:m.table_id??""})}}catch{}let I=await ve(h.join(t,".env"),h.join(s,".env.example")),N={templateName:f,profileName:a,oldVersion:o,newVersion:r,configMerges:d,contentFiles:k,templateFiles:C,managedFiles:P,newEnvVars:I,workflowTrackerFields:_};if(Me(N),e.dryRun)return Re(),{plan:N};if(!e.force){let{confirm:i}=await import("@inquirer/prompts");if(!await i({message:"\u786E\u8BA4\u6267\u884C\u8FC1\u79FB\uFF1F",default:!0}))throw new Error("cancelled")}let E;e.noBackup||(E=await me(t,r),console.log(`\u2713 \u5DF2\u5907\u4EFD\u5230: ${E.fullPath}`));for(let i of u){let w=d.find(F=>F.relativePath===i);if(!w||w.noChange)continue;let m=M.get(i);if(!m)continue;let v=h.join(t,i);if(!m.oursContent&&m.theirsContent){await ne(h.dirname(v),{recursive:!0}),await A(v,m.theirsContent,"utf8");continue}if(!m.theirsContent)continue;if(i.endsWith(".json"))await A(v,JSON.stringify(m.result.merged,null,2)+`
11
+ `,"utf8");else{let F=K.parseDocument(m.oursContent);dt(F,m.base,m.result.merged),await A(v,F.toString(),"utf8")}}for(let i of C){let w=h.join(s,i.relativePath),m=h.join(t,i.relativePath);await ne(h.dirname(m),{recursive:!0}),await te(w,m,{force:!0})}for(let i of _){if(!i.baseId&&!i.tableId)continue;let w=C.filter(m=>m.relativePath.endsWith("workflow.yml")&&m.relativePath.includes(i.workflow));for(let m of w){let v=h.join(t,m.relativePath);try{let R=await T(v,"utf8"),F=K.parseDocument(R);i.baseId&&F.setIn(["tracker","base_id"],i.baseId),i.tableId&&F.setIn(["tracker","table_id"],i.tableId),await A(v,F.toString(),"utf8")}catch{}}}if(l){let i=h.join(t,"package.json");await A(i,JSON.stringify(l.merged,null,2)+`
12
+ `,"utf8")}for(let i of[".npmrc",".gitignore"]){let w=h.join(s,i),m=h.join(t,i);try{await _e(w),await te(w,m,{force:!0})}catch{}}for(let i of k){if(i.action!=="add-new")continue;let w=h.join(s,i.relativePath),m=h.join(t,i.relativePath);await ne(h.dirname(m),{recursive:!0}),await te(w,m,{force:!1,errorOnExist:!1})}let D,re=d.flatMap(i=>i.conflicts.map(w=>({file:i.relativePath,...w})));if(re.length>0){D=h.join(t,".migrate-conflicts.yml");let i=re.map(w=>({file:w.file,path:w.pathString,your_value:w.oursValue,template_value:w.theirsValue,base_value:w.baseValue}));await A(D,K.stringify(i),"utf8")}let De=await U(t,u),Ve=await L(s,u);return await J(t,{schema_version:1,template:f,profile:a,cli_version:r,scaffolded_at:new Date().toISOString(),config_snapshot:De,config_base_contents:Ve}),await he(t),Se(t),{plan:N,backup:E,conflictFile:D}}finally{await lt(s,{recursive:!0,force:!0}).catch(()=>{})}}c(ln,"runMigrate");async function fn(e,t){try{let r=await z(e);if(!r||r.cli_version===t)return;console.warn(`\u26A0 CLI \u7248\u672C\u5DF2\u4ECE ${r.cli_version} \u5347\u7EA7\u5230 ${t}\uFF0C\u6A21\u677F\u53EF\u80FD\u5DF2\u66F4\u65B0\u3002
13
+ \u8FD0\u884C aitable-workflow migrate \u4EE5\u5347\u7EA7\u9879\u76EE\u914D\u7F6E\u3002
14
+ `)}catch{}}c(fn,"checkMigrateHint");function ut(e){if(!e)return process.cwd();let t=h.resolve(e),r=h.extname(t).toLowerCase();return r===".yml"||r===".yaml"?h.dirname(t):t}c(ut,"resolveConfigDir");async function gt(e){try{return await _e(h.join(e,"workflows")),"support-qa"}catch{return}}c(gt,"inferTemplateName");async function pt(e){try{return JSON.parse(await T(h.join(e,"package.json"),"utf8")).dependencies?.["aitable-workflow-core"]?.replace(/^\^/,"")}catch{return}}c(pt,"inferCliVersion");function dt(e,t,r){Ne(e,[],t,r)}c(dt,"applyMergeToDoc");function Ne(e,t,r,n){if(je(r)&&je(n)){let f=new Set([...Object.keys(r),...Object.keys(n)]);for(let a of f){let o=[...t,a];a in n?a in r?Ne(e,o,r[a],n[a]):e.setIn(o,n[a]):e.deleteIn(o)}}else mt(r,n)||e.setIn(t,n)}c(Ne,"applyRecursive");function je(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}c(je,"isPlainObject");function mt(e,t){return JSON.stringify(e)===JSON.stringify(t)}c(mt,"deepEqualSimple");function xe(e){return{templateName:"",profileName:"",oldVersion:"",newVersion:e,configMerges:[],contentFiles:[],templateFiles:[],managedFiles:[],newEnvVars:[],workflowTrackerFields:[]}}c(xe,"emptyPlan");export{ot as a,it as b,be as c,ln as d,fn as e};
package/dist/index.d.ts CHANGED
@@ -4231,6 +4231,34 @@ declare function activateGlobalDwsOnPath(options?: GlobalDwsActivationOptions):
4231
4231
  */
4232
4232
  declare function ensureTsxRegistered(): Promise<void>;
4233
4233
 
4234
+ type FingerprintWindowOptions = {
4235
+ /** globalVar 顶层 key(不同用途必须用不同 key,否则互相污染) */
4236
+ key: string;
4237
+ /** 记录存活时长,缺省 10 分钟 */
4238
+ ttlMs?: number;
4239
+ /** 窗口容量上限(超出丢弃最旧),缺省 50 */
4240
+ capacity?: number;
4241
+ /**
4242
+ * 单个 part 参与指纹前的最大长度,缺省 300(防超长正文拖慢 hash)。
4243
+ * 传数组则逐位生效(第 i 个 part 用第 i 个上限,超出长度的 part 回退到最后一个上限),
4244
+ * 供需要"各字段不同截断长度"的调用方精确复现旧指纹。
4245
+ */
4246
+ maxPartLength?: number | number[];
4247
+ };
4248
+ type FingerprintWindow = {
4249
+ /**
4250
+ * 登记一条指纹。
4251
+ * @returns true = 本次是窗口内首次出现(调用方应当真正记一笔);
4252
+ * false = 窗口内已有同签名(调用方只记日志即可)。
4253
+ */
4254
+ mark: (get: (key: string) => unknown, set: (key: string, value: unknown) => void, ...parts: string[]) => boolean;
4255
+ /** 只查不写:窗口内是否见过该指纹 */
4256
+ has: (get: (key: string) => unknown, ...parts: string[]) => boolean;
4257
+ /** 计算指纹(供测试与调用方自定义比对) */
4258
+ fingerprint: (...parts: string[]) => string;
4259
+ };
4260
+ declare function createFingerprintWindow(options: FingerprintWindowOptions): FingerprintWindow;
4261
+
4234
4262
  /**
4235
4263
  * aitable-workflow — 配置变量插值
4236
4264
  *
@@ -4418,6 +4446,59 @@ type CheckOptions = {
4418
4446
  };
4419
4447
  declare function runCheck(options: CheckOptions): Promise<ConfigCheckResult>;
4420
4448
 
4449
+ /**
4450
+ * aitable-workflow — 实例自定义 preflight 扩展点
4451
+ *
4452
+ * 通用机制只能校验通用结构(schema_version、roles、env、step config 对齐 recipe.meta);
4453
+ * 而每个模板都有自己的「镜像一致性」约束——例如 support-qa 要求 workflow.yml 里
4454
+ * 「处置动作」列的 options 与代码里的 action 闭集逐字相同、admin-kb-update 的事件
4455
+ * 过滤必须锚在某个具名状态上。这类校验只有模板自己知道怎么写。
4456
+ *
4457
+ * 约定:实例根下存在 `lib/preflight.ts`(或 .js)且导出 `preflight(configDir)` 时,
4458
+ * 在 `aitable-workflow config` 与 `run` / `setup` 启动期加载执行。
4459
+ *
4460
+ * 三级分档决定「错到什么程度停什么」:
4461
+ * - fatal:实例级不可信(profile 解析不了、人设缺失/被放开闸门)→ 拒绝启动;
4462
+ * - error:可归因到单个 workflow(带 workflowId)→ 只停该轨道,其余工作流照跑;
4463
+ * - warn :某个可选能力关不上(规则文件坏了)→ 该能力优雅关闭,主环照跑。
4464
+ *
4465
+ * 这样「一个规则文件写错就整个实例起不来」和「配错了却静默每条消息都失败」两种极端都避开。
4466
+ */
4467
+ type PreflightLevel = "fatal" | "error" | "warn";
4468
+ type PreflightIssue = {
4469
+ level: PreflightLevel;
4470
+ message: string;
4471
+ /** 该问题归属的工作流;仅 level=error 时用于「只停这一个轨道」 */
4472
+ workflowId?: string;
4473
+ };
4474
+ /** 实例 preflight 模块的导出契约 */
4475
+ type PreflightModule = {
4476
+ preflight: (configDir: string) => PreflightIssue[] | Promise<PreflightIssue[]>;
4477
+ };
4478
+ type PreflightOutcome = {
4479
+ issues: PreflightIssue[];
4480
+ /** 是否存在 fatal(调用方据此拒启) */
4481
+ hasFatal: boolean;
4482
+ /** 因工作流级 error 而应跳过的工作流 id */
4483
+ blockedWorkflowIds: string[];
4484
+ /** preflight 模块本身是否存在(不存在 = 该模板没有自定义校验,不是错误) */
4485
+ present: boolean;
4486
+ };
4487
+ /**
4488
+ * 运行实例自定义 preflight。
4489
+ *
4490
+ * 模块不存在 → present:false 且零 issue(模板未提供自定义校验,合法)。
4491
+ * 模块本身加载/执行抛错 → 记一条 fatal(校验器坏了不能当作「校验通过」放行)。
4492
+ */
4493
+ declare function runInstancePreflight(configDir: string): Promise<PreflightOutcome>;
4494
+ /** 把 preflight 结果转成 config 命令/UI 的模块结果(与其它校验模块同构展示) */
4495
+ declare function preflightModuleResult(outcome: PreflightOutcome): ModuleResult;
4496
+ /**
4497
+ * 打印启动期 preflight 摘要(无论成败都打,使"哪个轨道没起来、为什么"在终端直接可见,
4498
+ * 不需要翻表)。返回值同 outcome,便于链式调用。
4499
+ */
4500
+ declare function logPreflightSummary(outcome: PreflightOutcome): PreflightOutcome;
4501
+
4421
4502
  /**
4422
4503
  * aitable-workflow — Profile 加载器
4423
4504
  *
@@ -5176,6 +5257,14 @@ type App = {
5176
5257
  settings: Settings;
5177
5258
  /** 全部工作流实例(单工作流模式为 1 个) */
5178
5259
  instances: WorkflowInstance[];
5260
+ /**
5261
+ * 装配失败而被跳过的工作流(空数组 = 全部正常)。
5262
+ *
5263
+ * 单个工作流的配置错(tracker 缺失、事件源建失败等)只停该轨道,不拖累其余
5264
+ * 工作流(如 config-sync / daily-review)。调用方(CLI/server)可据此向运维展示
5265
+ * "哪个轨道没起来、为什么",无需翻表。全部工作流都跳过时 createApp 仍报错退出。
5266
+ */
5267
+ skippedWorkflows: SkippedWorkflow[];
5179
5268
  /** @deprecated 兼容单工作流:= instances[0].workflow */
5180
5269
  workflow: WorkflowTemplate;
5181
5270
  /** @deprecated 兼容单工作流:= instances[0].tracker */
@@ -5185,6 +5274,12 @@ type App = {
5185
5274
  start: () => Promise<void>;
5186
5275
  stop: () => Promise<void>;
5187
5276
  };
5277
+ /** 装配失败被跳过的工作流 */
5278
+ type SkippedWorkflow = {
5279
+ id: string;
5280
+ /** 人可读原因(启动摘要与运维界面直接展示) */
5281
+ reason: string;
5282
+ };
5188
5283
  type CreateAppOptions = {
5189
5284
  onRunEvent?: RunEventSink;
5190
5285
  };
@@ -5870,18 +5965,8 @@ interface WizardResult {
5870
5965
  scaffold: ScaffoldResult;
5871
5966
  }
5872
5967
 
5873
- /**
5874
- * 已废弃的模板:不在可用模板列表展示,且显式 `--template <name>` 也直接报错拒用。
5875
- * 代码与模板资产暂保留(供存量项目参考 / 后续移除),但不再允许新建实例。
5876
- *
5877
- * aitable-handoff:早于 profile v2 架构,配置事实源仍散落在 workflow.yml,
5878
- * 已由 support-qa(profile v2 + profiles/ 业务包)取代。
5879
- */
5880
- declare const DEPRECATED_TEMPLATES: ReadonlySet<string>;
5881
- /** 列出可用模板名(默认隐藏已废弃模板) */
5882
- declare function listTemplates(templatesDir?: string, options?: {
5883
- includeDeprecated?: boolean;
5884
- }): Promise<string[]>;
5968
+ /** 列出可用模板名 */
5969
+ declare function listTemplates(templatesDir?: string): Promise<string[]>;
5885
5970
  /** 列出某模板可选的 profile 业务包名(templates/<name>/profiles/*) */
5886
5971
  declare function listProfiles(name: string, templatesDir?: string): Promise<string[]>;
5887
5972
  interface TemplateScaffoldResult {
@@ -6562,4 +6647,4 @@ interface KbIngestCommandOptions {
6562
6647
  /** `kb ingest <url|path>`:从远程源或本地目录导入文档,转为 .md 存入 wiki 目录 */
6563
6648
  declare function runKbIngestCommand(urlOrPath: string, options: KbIngestCommandOptions): Promise<void>;
6564
6649
 
6565
- export { AGENT_TO_ENGINE, type AIToolkit, type AgentAdapter, type AgentConfig, type AgentEngine, type AgentEvent, type AgentEventType, type AgentExecutor, type AgentExecutorKind, type AgentIdDTO, type AgentLifecycleEvent, type AgentLifecyclePhase, type AgentMemoryToolkit, type AgentOptions, type AgentSession, type AgentType, type AitableAgentConfigMeta, type AnyToolkitDescriptor, type ApiError, type App, type ApprovalCreateParams, type ApprovalStatus, type ApprovalToolkit, type AtOptions, type AutoDiscoveryOptions, type AutoDiscoveryResult, BASE_AGENT_DEFS, type BaseAgentOptions, type BaseTablesCache, type BlockReasonDTO, type BuildBriefOptions, type CIRunStatus, type CIToolkit, type CardAction, type CardPayload, type CheckItem, type CheckOptions, type CheckStatus, type ClaudeCodeConfig, type ClaudeCodeOptions, type CodeReviewToolkit, type CodexConfig, type CodexOptions, type CodingAgentDetection, type CodingAgentInfo, type CodingAgentRunner, type CodingAgentSelection, type CodingAgentsConfig, type CodingRunOptions, type CodingRunResult, type CodingToolkit, type CollectContextOptions, type CommandResult, type CommandRunOptions, type CommandRunner, type CompactOptions, type CompactResult, type Config, type ConfigAccess, type ConfigCheckResult, type ConfigDefaultStrategy, type ConfigFileMergeSummary, type ConfigFileRef, type ConfigHint, type ConfigHintEntry, type ConfigHintType, type ConfigOwnership, type ConfigSetupPolicy, type ConfigSurfaceItem, type ConfigSurfaceOwner, type ConfigSurfaceSource, type ConfigSurfaceValueType, type ConfigValueType, type CreateAppOptions, type CreateProjectRequestDTO, type CreateWorkflowRequestDTO, type CreateWorkflowResponseDTO, type CredentialEntry, type CredentialsStore, type CronSchedulerConfig, CronSchedulerSource, DEPRECATED_TEMPLATES, type DefinitionLoadFailure, type DefinitionLoadResult, type DeleteProjectResponseDTO, type DesignArtifactManifestDTO, type DesignArtifactValidationDTO, type DesignContext, type DesignDiscoverySnapshotDTO, type DesignEventDTO, type DesignOptions, type DesignResult, type DetectedAgentInfo, type DetectedCodingAgent, type DetectedCodingEngine, type DetectionResult, type DingTalkActionCard$1 as DingTalkActionCard, type DingTalkActionCardButton$1 as DingTalkActionCardButton, type DingTalkActionCardButtons$1 as DingTalkActionCardButtons, type DingTalkActionCardResult$1 as DingTalkActionCardResult, type DingTalkAtUserIdResolver, type DingTalkAtUserIdResolverOptions, type DingTalkContactCandidate, type DingTalkContactSearch, type DingTalkGroupMessageResult$1 as DingTalkGroupMessageResult, DingTalkRobotClient, type DingTalkRobotClientConfig, type DingTalkRobotSendOptions, type DingTalkRobotUserSendOptions, type DingTalkStreamMessageEventContext, type DingTalkWebhookActionCard, type DingTalkWebhookMentionEventContext, type DiscoveryCapabilities, type DiscoveryResult, DwsClient, type DwsClientOptions, DwsError, type DwsMaintenanceOptions, type DwsMaintenanceResult, type DwsRunner, ENGINE_TO_AGENT, type EdgeDefinition, type EnsureTableOptions, type EnvJsonMapSpec, type EventBinding, type EventCallback, type EventContext, type EventHandlerDefinition, type EventHandlerMeta, type EventHandlerRecipeDefinition, type EventSource, type EventSourceConfig, type EventSourceDefinition, type ExternalEvent, type FieldDefinition, type FieldDefinitionConfig, type FieldPlan, type FieldType, type FieldTypeEnum, type FieldsConfig, type FileRefHint, type FileToolkit, type FilesPatchDTO, type FilesReplaceDTO, type FilesResponseDTO, type FilledForm, type FormAnswerValue, type FormAnswers, type FormOption, type FormQuestion, type GenericAgentConfig, type GitToolkit, type GlobalDwsActivationOptions, type GlobalDwsActivationResult, type GlobalVarStore, type HandlerInitContext, type HandlerInstance, InMemoryGlobalVarStore, InMemoryObjectStore, type Inference, type IngestOptions, type IngestReport, type IngestResult, type InitAnswers, type InitConfigDTO, type InitOptions, type InitResponseDTO, type Invocation, KNOWN_AGENT_IDS, type KbCommandOptions, type KbIngestCommandOptions, type KbProgressInfo, type KbRunSummary, type KnownAgentType, type LLMCallOptions, type LLMCallTrace, type LoadSettingsOptions, type LoadWorkflowOptions, LocalSpawnExecutor, type MemoryEntry, type MemoryQuery, type MemoryScope, type MemoryScopeInput, type MemoryToolkitConfig, type MessageEmotionContext, type MessageTarget, type MessagingToolkit, type MigrateOptions, type MigrateResult, type MigrationPlan, type ModelSwitchable, type ModuleResult, type MrComment, type MrCreateParams, type MultiWorkflowConfig, type NeedsHuman, type NotificationConfig, type ObjectStore, type ObjectStoreConfig, type OutboundChannel, type PendingAction, type PresignedUpload, type ProgressReporter, type ProjectDTO, type ProjectExportDTO, type ProjectFileDTO, type ProjectStateDTO, type ProjectTaskDTO, type ProjectWorkflowDTO, type ProjectsResponseDTO, type QoderConfig, type QoderOptions, type QuestionForm, type QuestionType, RELAY_OVERLOAD_CODE, RELAY_REJECTED_CODE, type RecipeCheckIssue, type RecipeCheckLevel, type RecipeCheckResult, type RecipeConfig, type RecipeContext, type RecipeDefinition, type RecipeInspectRow, type RecipeMeta, type RecipeResult, type RecipeResultStatus, type RecoverResult, type RecoveryActionDTO, type ReferencedFields, type RelayAgent, RelayAgentSession, type RelayAgentSessionConfig, type RelayArtifactFile, type RelayArtifactManifest, type RelayErrorMessage, type RelayEventMessage, RelayExecutor, type RelayExecutorConfig, type RelayInboundMessage, type RelayMessage, type RelayMessageType, type RelayOutboundMessage, type RelayPingMessage, type RelayPongMessage, type RelayReadyAckMessage, type RelayReadyMessage, type RelayResultMessage, type RelayRunAgentMessage, type RelayRunDwsMessage, type RelayTransport, type RelayUploadGrantMessage, type RelayUploadRequestMessage, type ReplyResult, type ReplyToConversationOptions, type ResetWorkflowResponseDTO, type ResolvedDingTalkStreamMessageEventContext, type ResolvedDingTalkWebhookMentionEventContext, type RoleConfigDTO, type RolesConfig, type RunCodingAgentOptions, type RunDesignOptions, type RunDiscoveryOptions, type RunEventDTO, type RunEventSink, type RunExecutionEventDTO, type RunRecordSnapshot, type RunRecordSnapshotDTO, type RunRecordStatusDTO, type RunResult, type RunSnapshotDTO, type ScaffoldOptions, type ScaffoldResult, type SessionReplyEntry, type SessionReplyOptions, type Settings, type SetupEventDTO, type SetupOptions, type SetupSchemaField, type SetupSchemaSummaryDTO, ShellNotAllowedError, type ShellRunOptions, type ShellRunResult, type ShellToolkit, type SingleWorkflowConfig, type StageIdDTO, type StageRuntimeDTO, type StatesConfig, type StepDefinition, type StepSLA, type StepTrace, type SyncOptions, type SyncResult, type TableRef, type TableToolkit, type TaskEventDTO, type TaskStatusDTO, type TemplateScaffoldResult, type TodoCreateParams, type TodoToolkit, type Toolkit, type ToolkitContext, type ToolkitDescriptor, ToolkitError, type ToolkitMethodMeta, type ToolkitPermission, Tracer, type TrackerConfig, type ValidationResult, type ViewDef, type ViewSyncResult, type ViewType, type ViewsConfig, type WebhookSendOptions, type WizardOptions, type WizardResult, type WorkflowCheckResult, type WorkflowCodingEngine, type WorkflowDTO, type WorkflowEntry, type WorkflowFilesResponseDTO, type WorkflowInstance, type WorkflowMeta, type WorkflowResponseDTO, type WorkflowStepDTO, type WorkflowTemplate, type WorkflowsResponseDTO, type WorktreeResult, type WriteRolesResult, type WriteTarget, activateGlobalDwsOnPath, agentEngineSchema, agentToEngine, assertTableBelongsToBase, buildAgentChoices, buildArtifactKey, buildDesignBrief, buildDiscoveryForm, buildEnvSource, buildEnvSourceSync, buildFixPrompt, buildMetaPrompt, checkEnv, checkMigrateHint, checkWorkflowRecipes, checkWorkflows, chooseDetectedEngine, codingAgentsConfigSchema, coerceJsonValue, coerceYamlValue, collectConfigHints, collectDesignContext, collectEnvRefDetails, collectEnvRefs, commandsInFlight, composeToolkitRegistry, configSchema, createApp, createDingTalkAtUserIdResolver, createExecShellToolkit, createLocalSpawnExecutor, createPerWorkflowSettings, createRelayExecutor, createWorkflowTable, credentialsFilePath, defaultCommandRunner, defaultToolkitRegistry, deriveEnvJsonMapSpec, describeConfigPath, designBlockedStateFixture, designEventsFixture, designFailedStateFixture, detectAgents, detectCodingEngines, detectInstalledAgents, detectInstalledCodingAgents, detectSourceType, drainCommands, dwsPayload, emptyStore, engineToAgent, ensureLatestDws, ensureTableExists, ensureTsxRegistered, fieldDefinitionSchema, fieldTypeSchema, fileRefConfigSchema, findArrayPayload, findConflictingCredential, findCursor, formatAnswerDisplay, formatCommandError, generateCodingAgentsConfig, generateMainConfig, getActiveCredential, getAgentConfig, getAgentDef, getAitableAgentConfigMeta, getConfigHint, getConfigValueAtPath, getCurrentDwsRunner, getCurrentExecutor, getFileRefHint, getGlobalDwsBinPath, getTracer, getZodObjectShape, globalVarRefPath, hasOssCredentials, heuristicInference, inferSkeleton, ingest, initTable, initTracer, initialTableFields, interpolateEnv, isAllowedArtifactPath, isEngineDetected, isGlobalVarRef, isOwnedAutoCreateHint, isRecord, isRelayMessage, isSafeRelativePath, listCodingAgents, listCredentials, listProfiles, listTemplates, loadAgentConfig, loadEventHandlerDefinition, loadEventHandlerDefinitionResult, loadRecipeDefinition, loadRecipeDefinitionResult, loadSettings, loadWorkflowTemplate, logger, maskSecret, normalizeArtifactRelPath, normalizeByType, padStaffId, parseEnvExampleValues, parseEnvValue, prependGlobalDwsToPath, printFieldPlan, printKbProgress, printKbSummary, printViewSyncResult, projectFilesFixture, projectStateResponseFixture, readCredentials, requireAgentDef, resolveAllCollections, resolveCodingAgentSelection, resolveCompileAgent, resolveConfigPath, resolveDingTalkAtUserId, resolveDingTalkStreamMessageEventContext, resolveDingTalkWebhookMentionEventContext, resolveGlobalVarRef, runAutoDiscovery, runCheck, runCodingAgent, runCodingAgentViaSpawn, runDesign, runDesignCommand, runDiscovery, runEventsFixture, runInit, runKbCompileCommand, runKbIngestCommand, runKbStatusCommand, runKbUpdateCommand, runMigrate, runSetupCommand, runSync, runWithDwsRunner, runWithExecutor, saveCredential, scaffold, scaffoldFromTemplate, serializeForm, serializeForms, sessionWebhookRegistry, setActiveAgent, setGlobalDwsRunner, setInJson, setupEventsFixture, setupKnowledgeBases, setupSurfaceTables, shellToken, snapshotRunRecord, stringOrNull, summarizeForms, syncFieldsFromWorkflow, syncViewsFromDesign, tableRefConfigSchema, trackerSchema, validateDesignOutput, validateStateConsistency, viewDefSchema, viewTypeSchema, workflowPreviewFixture, workspaceAgentConfigPath, writeBack, writeCredentials, writeEnvFile, writeJsonFile, writeRoleDefinitions, writeTableIdToConfig, writeYaml, zodToFormatExample };
6650
+ export { AGENT_TO_ENGINE, type AIToolkit, type AgentAdapter, type AgentConfig, type AgentEngine, type AgentEvent, type AgentEventType, type AgentExecutor, type AgentExecutorKind, type AgentIdDTO, type AgentLifecycleEvent, type AgentLifecyclePhase, type AgentMemoryToolkit, type AgentOptions, type AgentSession, type AgentType, type AitableAgentConfigMeta, type AnyToolkitDescriptor, type ApiError, type App, type ApprovalCreateParams, type ApprovalStatus, type ApprovalToolkit, type AtOptions, type AutoDiscoveryOptions, type AutoDiscoveryResult, BASE_AGENT_DEFS, type BaseAgentOptions, type BaseTablesCache, type BlockReasonDTO, type BuildBriefOptions, type CIRunStatus, type CIToolkit, type CardAction, type CardPayload, type CheckItem, type CheckOptions, type CheckStatus, type ClaudeCodeConfig, type ClaudeCodeOptions, type CodeReviewToolkit, type CodexConfig, type CodexOptions, type CodingAgentDetection, type CodingAgentInfo, type CodingAgentRunner, type CodingAgentSelection, type CodingAgentsConfig, type CodingRunOptions, type CodingRunResult, type CodingToolkit, type CollectContextOptions, type CommandResult, type CommandRunOptions, type CommandRunner, type CompactOptions, type CompactResult, type Config, type ConfigAccess, type ConfigCheckResult, type ConfigDefaultStrategy, type ConfigFileMergeSummary, type ConfigFileRef, type ConfigHint, type ConfigHintEntry, type ConfigHintType, type ConfigOwnership, type ConfigSetupPolicy, type ConfigSurfaceItem, type ConfigSurfaceOwner, type ConfigSurfaceSource, type ConfigSurfaceValueType, type ConfigValueType, type CreateAppOptions, type CreateProjectRequestDTO, type CreateWorkflowRequestDTO, type CreateWorkflowResponseDTO, type CredentialEntry, type CredentialsStore, type CronSchedulerConfig, CronSchedulerSource, type DefinitionLoadFailure, type DefinitionLoadResult, type DeleteProjectResponseDTO, type DesignArtifactManifestDTO, type DesignArtifactValidationDTO, type DesignContext, type DesignDiscoverySnapshotDTO, type DesignEventDTO, type DesignOptions, type DesignResult, type DetectedAgentInfo, type DetectedCodingAgent, type DetectedCodingEngine, type DetectionResult, type DingTalkActionCard$1 as DingTalkActionCard, type DingTalkActionCardButton$1 as DingTalkActionCardButton, type DingTalkActionCardButtons$1 as DingTalkActionCardButtons, type DingTalkActionCardResult$1 as DingTalkActionCardResult, type DingTalkAtUserIdResolver, type DingTalkAtUserIdResolverOptions, type DingTalkContactCandidate, type DingTalkContactSearch, type DingTalkGroupMessageResult$1 as DingTalkGroupMessageResult, DingTalkRobotClient, type DingTalkRobotClientConfig, type DingTalkRobotSendOptions, type DingTalkRobotUserSendOptions, type DingTalkStreamMessageEventContext, type DingTalkWebhookActionCard, type DingTalkWebhookMentionEventContext, type DiscoveryCapabilities, type DiscoveryResult, DwsClient, type DwsClientOptions, DwsError, type DwsMaintenanceOptions, type DwsMaintenanceResult, type DwsRunner, ENGINE_TO_AGENT, type EdgeDefinition, type EnsureTableOptions, type EnvJsonMapSpec, type EventBinding, type EventCallback, type EventContext, type EventHandlerDefinition, type EventHandlerMeta, type EventHandlerRecipeDefinition, type EventSource, type EventSourceConfig, type EventSourceDefinition, type ExternalEvent, type FieldDefinition, type FieldDefinitionConfig, type FieldPlan, type FieldType, type FieldTypeEnum, type FieldsConfig, type FileRefHint, type FileToolkit, type FilesPatchDTO, type FilesReplaceDTO, type FilesResponseDTO, type FilledForm, type FingerprintWindow, type FingerprintWindowOptions, type FormAnswerValue, type FormAnswers, type FormOption, type FormQuestion, type GenericAgentConfig, type GitToolkit, type GlobalDwsActivationOptions, type GlobalDwsActivationResult, type GlobalVarStore, type HandlerInitContext, type HandlerInstance, InMemoryGlobalVarStore, InMemoryObjectStore, type Inference, type IngestOptions, type IngestReport, type IngestResult, type InitAnswers, type InitConfigDTO, type InitOptions, type InitResponseDTO, type Invocation, KNOWN_AGENT_IDS, type KbCommandOptions, type KbIngestCommandOptions, type KbProgressInfo, type KbRunSummary, type KnownAgentType, type LLMCallOptions, type LLMCallTrace, type LoadSettingsOptions, type LoadWorkflowOptions, LocalSpawnExecutor, type MemoryEntry, type MemoryQuery, type MemoryScope, type MemoryScopeInput, type MemoryToolkitConfig, type MessageEmotionContext, type MessageTarget, type MessagingToolkit, type MigrateOptions, type MigrateResult, type MigrationPlan, type ModelSwitchable, type ModuleResult, type MrComment, type MrCreateParams, type MultiWorkflowConfig, type NeedsHuman, type NotificationConfig, type ObjectStore, type ObjectStoreConfig, type OutboundChannel, type PendingAction, type PreflightIssue, type PreflightLevel, type PreflightModule, type PreflightOutcome, type PresignedUpload, type ProgressReporter, type ProjectDTO, type ProjectExportDTO, type ProjectFileDTO, type ProjectStateDTO, type ProjectTaskDTO, type ProjectWorkflowDTO, type ProjectsResponseDTO, type QoderConfig, type QoderOptions, type QuestionForm, type QuestionType, RELAY_OVERLOAD_CODE, RELAY_REJECTED_CODE, type RecipeCheckIssue, type RecipeCheckLevel, type RecipeCheckResult, type RecipeConfig, type RecipeContext, type RecipeDefinition, type RecipeInspectRow, type RecipeMeta, type RecipeResult, type RecipeResultStatus, type RecoverResult, type RecoveryActionDTO, type ReferencedFields, type RelayAgent, RelayAgentSession, type RelayAgentSessionConfig, type RelayArtifactFile, type RelayArtifactManifest, type RelayErrorMessage, type RelayEventMessage, RelayExecutor, type RelayExecutorConfig, type RelayInboundMessage, type RelayMessage, type RelayMessageType, type RelayOutboundMessage, type RelayPingMessage, type RelayPongMessage, type RelayReadyAckMessage, type RelayReadyMessage, type RelayResultMessage, type RelayRunAgentMessage, type RelayRunDwsMessage, type RelayTransport, type RelayUploadGrantMessage, type RelayUploadRequestMessage, type ReplyResult, type ReplyToConversationOptions, type ResetWorkflowResponseDTO, type ResolvedDingTalkStreamMessageEventContext, type ResolvedDingTalkWebhookMentionEventContext, type RoleConfigDTO, type RolesConfig, type RunCodingAgentOptions, type RunDesignOptions, type RunDiscoveryOptions, type RunEventDTO, type RunEventSink, type RunExecutionEventDTO, type RunRecordSnapshot, type RunRecordSnapshotDTO, type RunRecordStatusDTO, type RunResult, type RunSnapshotDTO, type ScaffoldOptions, type ScaffoldResult, type SessionReplyEntry, type SessionReplyOptions, type Settings, type SetupEventDTO, type SetupOptions, type SetupSchemaField, type SetupSchemaSummaryDTO, ShellNotAllowedError, type ShellRunOptions, type ShellRunResult, type ShellToolkit, type SingleWorkflowConfig, type SkippedWorkflow, type StageIdDTO, type StageRuntimeDTO, type StatesConfig, type StepDefinition, type StepSLA, type StepTrace, type SyncOptions, type SyncResult, type TableRef, type TableToolkit, type TaskEventDTO, type TaskStatusDTO, type TemplateScaffoldResult, type TodoCreateParams, type TodoToolkit, type Toolkit, type ToolkitContext, type ToolkitDescriptor, ToolkitError, type ToolkitMethodMeta, type ToolkitPermission, Tracer, type TrackerConfig, type ValidationResult, type ViewDef, type ViewSyncResult, type ViewType, type ViewsConfig, type WebhookSendOptions, type WizardOptions, type WizardResult, type WorkflowCheckResult, type WorkflowCodingEngine, type WorkflowDTO, type WorkflowEntry, type WorkflowFilesResponseDTO, type WorkflowInstance, type WorkflowMeta, type WorkflowResponseDTO, type WorkflowStepDTO, type WorkflowTemplate, type WorkflowsResponseDTO, type WorktreeResult, type WriteRolesResult, type WriteTarget, activateGlobalDwsOnPath, agentEngineSchema, agentToEngine, assertTableBelongsToBase, buildAgentChoices, buildArtifactKey, buildDesignBrief, buildDiscoveryForm, buildEnvSource, buildEnvSourceSync, buildFixPrompt, buildMetaPrompt, checkEnv, checkMigrateHint, checkWorkflowRecipes, checkWorkflows, chooseDetectedEngine, codingAgentsConfigSchema, coerceJsonValue, coerceYamlValue, collectConfigHints, collectDesignContext, collectEnvRefDetails, collectEnvRefs, commandsInFlight, composeToolkitRegistry, configSchema, createApp, createDingTalkAtUserIdResolver, createExecShellToolkit, createFingerprintWindow, createLocalSpawnExecutor, createPerWorkflowSettings, createRelayExecutor, createWorkflowTable, credentialsFilePath, defaultCommandRunner, defaultToolkitRegistry, deriveEnvJsonMapSpec, describeConfigPath, designBlockedStateFixture, designEventsFixture, designFailedStateFixture, detectAgents, detectCodingEngines, detectInstalledAgents, detectInstalledCodingAgents, detectSourceType, drainCommands, dwsPayload, emptyStore, engineToAgent, ensureLatestDws, ensureTableExists, ensureTsxRegistered, fieldDefinitionSchema, fieldTypeSchema, fileRefConfigSchema, findArrayPayload, findConflictingCredential, findCursor, formatAnswerDisplay, formatCommandError, generateCodingAgentsConfig, generateMainConfig, getActiveCredential, getAgentConfig, getAgentDef, getAitableAgentConfigMeta, getConfigHint, getConfigValueAtPath, getCurrentDwsRunner, getCurrentExecutor, getFileRefHint, getGlobalDwsBinPath, getTracer, getZodObjectShape, globalVarRefPath, hasOssCredentials, heuristicInference, inferSkeleton, ingest, initTable, initTracer, initialTableFields, interpolateEnv, isAllowedArtifactPath, isEngineDetected, isGlobalVarRef, isOwnedAutoCreateHint, isRecord, isRelayMessage, isSafeRelativePath, listCodingAgents, listCredentials, listProfiles, listTemplates, loadAgentConfig, loadEventHandlerDefinition, loadEventHandlerDefinitionResult, loadRecipeDefinition, loadRecipeDefinitionResult, loadSettings, loadWorkflowTemplate, logPreflightSummary, logger, maskSecret, normalizeArtifactRelPath, normalizeByType, padStaffId, parseEnvExampleValues, parseEnvValue, preflightModuleResult, prependGlobalDwsToPath, printFieldPlan, printKbProgress, printKbSummary, printViewSyncResult, projectFilesFixture, projectStateResponseFixture, readCredentials, requireAgentDef, resolveAllCollections, resolveCodingAgentSelection, resolveCompileAgent, resolveConfigPath, resolveDingTalkAtUserId, resolveDingTalkStreamMessageEventContext, resolveDingTalkWebhookMentionEventContext, resolveGlobalVarRef, runAutoDiscovery, runCheck, runCodingAgent, runCodingAgentViaSpawn, runDesign, runDesignCommand, runDiscovery, runEventsFixture, runInit, runInstancePreflight, runKbCompileCommand, runKbIngestCommand, runKbStatusCommand, runKbUpdateCommand, runMigrate, runSetupCommand, runSync, runWithDwsRunner, runWithExecutor, saveCredential, scaffold, scaffoldFromTemplate, serializeForm, serializeForms, sessionWebhookRegistry, setActiveAgent, setGlobalDwsRunner, setInJson, setupEventsFixture, setupKnowledgeBases, setupSurfaceTables, shellToken, snapshotRunRecord, stringOrNull, summarizeForms, syncFieldsFromWorkflow, syncViewsFromDesign, tableRefConfigSchema, trackerSchema, validateDesignOutput, validateStateConsistency, viewDefSchema, viewTypeSchema, workflowPreviewFixture, workspaceAgentConfigPath, writeBack, writeCredentials, writeEnvFile, writeJsonFile, writeRoleDefinitions, writeTableIdToConfig, writeYaml, zodToFormatExample };