@crewx/sdk 0.9.0-rc.191 → 0.9.0-rc.192
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/desktop/index.js +3 -3
- package/dist/esm/desktop/index.js +3 -3
- package/dist/esm/index.js +290 -290
- package/dist/esm/plugins/index.js +76 -76
- package/dist/esm/process/index.js +1 -1
- package/dist/esm/repository/index.js +109 -109
- package/dist/index.d.ts +1 -1
- package/dist/index.js +286 -286
- package/dist/lifecycle/task-stop.d.ts +7 -3
- package/dist/plugins/index.js +79 -79
- package/dist/process/index.js +1 -1
- package/dist/repository/index.d.ts +1 -1
- package/dist/repository/index.js +111 -111
- package/dist/repository/task.repository.d.ts +10 -0
- package/package.json +1 -1
package/dist/process/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var child_process=require('child_process');var O=3e3;var b=2e3,g=25,M=100;function R(e){return e instanceof Error?e:e===void 0?void 0:new Error(String(e))}function C(e){return typeof e=="object"&&e!==null&&"code"in e?String(e.code):void 0}function S(e){return Number.isSafeInteger(e)&&e>0}function h(e,t){try{let r=child_process.spawnSync(e,t,{encoding:"utf8",timeout:O,windowsHide:!0});return {status:r.status,stdout:typeof r.stdout=="string"?r.stdout:"",stderr:typeof r.stderr=="string"?r.stderr:"",error:r.error}}catch(r){return {status:null,stdout:"",stderr:"",error:R(r)}}}function X(e,t){return new Promise(r=>{let n;try{n=child_process.spawn(e,t,{windowsHide:!0});}catch(c){r({status:null,stdout:"",stderr:"",error:R(c)});return}let o="",s="",u=false,i,d=setTimeout(()=>{try{n.kill();}catch{}i({status:null,stdout:o,stderr:s,error:new Error(`Command timed out after ${O}ms`)});},O);i=c=>{u||(u=true,clearTimeout(d),r(c));},n.stdout?.setEncoding("utf8"),n.stderr?.setEncoding("utf8"),n.stdout?.on("data",c=>{o+=String(c);}),n.stderr?.on("data",c=>{s+=String(c);}),n.once("error",c=>{i({status:null,stdout:o,stderr:s,error:c});}),n.once("close",c=>{i({status:c,stdout:o,stderr:s});});})}async function I(e,t,r){return r.runCommandAsync?r.runCommandAsync(e,t):r.runCommand?r.runCommand(e,t):X(e,t)}function G(e){return new Promise(t=>{setTimeout(t,Math.max(0,e));})}function E(){return new Promise(e=>{setImmediate(e);})}function w(e,t=process.kill){try{return t(e,0),"alive"}catch(r){return C(r)==="ESRCH"?"not_found":C(r)==="EPERM"?"alive":"unknown"}}function H(e,t){if(!S(e))return {status:"unknown"};let r=t.platform??process.platform,n=t.runCommand??h,o=r==="win32"?"powershell.exe":"ps",s=r==="win32"?["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",`$p = Get-CimInstance -ClassName Win32_Process -Filter 'ProcessId = ${e}' -ErrorAction Stop; if ($null -ne $p) { [Console]::Write([string]$p.CommandLine) }`]:["-p",String(e),"-o","command="],u;try{u=n(o,s);}catch{return {status:"unknown"}}if(u.error||u.status!==0)return {status:"unknown"};let i=u.stdout.trim();return i?{status:"found",commandLine:i}:{status:"not_found"}}function J(e,t){let r=w(-e,t),n=w(e,t);return r==="alive"||n==="alive"?"alive":r==="unknown"||n==="unknown"?"unknown":"not_found"}async function x(e,t,r,n){let o=Math.max(0,r),s=Math.max(1,n.pollIntervalMs??g),u=Date.now()+o,i,d=o===0,c=n.sleep?Promise.resolve().then(()=>n.sleep(o)).then(()=>{},()=>{}):new Promise(a=>{i=setTimeout(a,o);});c.then(()=>{d=true;});try{for(await E();;){let a=J(e,t);if(a==="not_found")return a;let m=u-Date.now();if(d||m<=0)return a;await Promise.race([c,G(Math.min(s,m))]);}}finally{i!==void 0&&clearTimeout(i);}}async function N(e,t,r,n,o){let s=await x(e,t,o.hardConfirmMs??M,{...o,sleep:void 0});return s==="not_found"?r?{status:"not_found",pid:e,method:n}:{status:"terminated",pid:e,method:n}:s==="alive"?{status:"failed",pid:e,method:n,error:"Process is still running after termination attempt"}:{status:"failed",pid:e,method:n,error:"Unable to verify process termination"}}function B(e,t,r={}){let n=H(e,r);if(n.status!=="found")return n.status;let o=r.platform??process.platform,s=o==="win32"?n.commandLine.toLowerCase():n.commandLine;return t.filter(i=>i.trim().length>0).some(i=>{let d=o==="win32"?i.toLowerCase():i;return s.includes(d)})?"owned":"not_owned"}async function V(e,t,r={}){if(!S(e))return "unknown";let n=r.platform??process.platform,o=n==="win32"?"powershell.exe":"ps",s=n==="win32"?["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",`$p = Get-CimInstance -ClassName Win32_Process -Filter 'ProcessId = ${e}' -ErrorAction Stop; if ($null -ne $p) { [Console]::Write([string]$p.CommandLine) }`]:["-p",String(e),"-o","command="],u;try{u=await I(o,s,r);}catch{return "unknown"}if(u.error||u.status!==0)return "unknown";let i=u.stdout.trim();if(!i)return "not_found";let d=n==="win32"?i.toLowerCase():i;return t.filter(a=>a.trim().length>0).some(a=>{let m=n==="win32"?a.toLowerCase():a;return d.includes(m)})?"owned":"not_owned"}var j=3e3,Y=/^(?:(\d+)-)?(?:(\d+):)?(\d{1,2}):(\d{2})$/,Z=/^\s*(\d+)\s+(\S+)\s+(\S+)\s*$/,q=/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})\.(\d{6})([+-]\d{3})$/;function v(e){let t=Y.exec(e.trim());if(!t)return;let[,r="0",n="0",o="0",s="0"]=t;return ((Number(r)*24+Number(n))*60+Number(o))*60+Number(s)}function A(e){let t=e.trim(),r=q.exec(t);if(r){let[,o,s,u,i,d,c,a,m]=r;return Date.UTC(Number(o),Number(s)-1,Number(u),Number(i),Number(d),Number(c),Math.trunc(Number(a)/1e3))-Number(m)*6e4}let n=Date.parse(t);return Number.isFinite(n)?n:void 0}function U(e,t){return t==="win32"?{command:"powershell.exe",args:["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",`$p = Get-CimInstance -ClassName Win32_Process -Filter 'ProcessId = ${e}' -ErrorAction Stop; if ($null -ne $p) { [Console]::Write($p.CreationDate.ToUniversalTime().ToString('o')) }`]}:{command:"ps",args:["-p",String(e),"-o","pgid=","-o","etime=","-o","stat="]}}function D(e,t,r){if(e.error)return {status:"unknown"};let n=e.stdout.trim();if(!n)return e.status===0||e.status===1?{status:"not_found"}:{status:"unknown"};if(e.status!==0)return {status:"unknown"};if(t==="win32"){let u=A(n);return u===void 0?{status:"unknown"}:{status:"found",startedAtMs:u,groupId:null}}let o=Z.exec(n),s=o?v(o[2]):void 0;return !o||s===void 0?{status:"unknown"}:o[3].startsWith("Z")?{status:"unknown"}:{status:"found",startedAtMs:r-s*1e3,groupId:Number(o[1])}}function z(e,t={}){if(!S(e))return {status:"unknown"};let r=t.platform??process.platform,{command:n,args:o}=U(e,r),s=t.runCommand??h,u;try{u=s(n,o);}catch{return {status:"unknown"}}return D(u,r,Date.now())}async function Q(e,t={}){if(!S(e))return {status:"unknown"};let r=t.platform??process.platform,{command:n,args:o}=U(e,r),s;try{s=await I(n,o,t);}catch{return {status:"unknown"}}return D(s,r,Date.now())}async function ee(e,t={}){let r=t.platform??process.platform,n=r==="win32"?"taskkill":"process-group",o=f=>({status:"failed",pid:e,method:n,error:f});if(!S(e))return o("Invalid process ID");let s=t.kill??process.kill,u=w(e,s);if(u==="not_found")return {status:"not_found",pid:e,method:n};if(u!=="alive")return o("Unable to determine whether the process is alive");if(r==="win32"){let f;try{f=await I("taskkill",["/PID",String(e),"/T","/F"],t);}catch(P){f={status:null,stdout:"",stderr:"",error:R(P)};}let p=w(e,s);return p==="not_found"?f.status===0&&!f.error?{status:"terminated",pid:e,method:n}:{status:"not_found",pid:e,method:n}:o(p==="alive"?"Process is still running after termination attempt":"Unable to verify process termination")}let i,d=t.signal??"SIGKILL";try{s(-e,d);}catch(f){i=f;}if(d==="SIGKILL")return N(e,s,i,n,t);if(await x(e,s,t.graceMs??b,t)==="not_found")return i?{status:"not_found",pid:e,method:n}:{status:"terminated",pid:e,method:n};let a;try{s(-e,"SIGKILL");}catch(f){a=f;}let m=await N(e,s,a,n,t);return m.status==="terminated"?m:m.status==="not_found"?i?m:{status:"terminated",pid:e,method:n}:o(m.error??"Process termination failed")}var $=1e3,ne=["SIGTERM","SIGINT","SIGHUP","SIGKILL"],re=6e4,te=100,oe=3e4,se=1e3;function y(e,t,r){return Number.isFinite(e)&&e>=t&&e<=r}function ie(e){return Number.isSafeInteger(e)&&e>1&&e!==process.pid}function L(e,t){try{return t(-e,0),"alive"}catch(r){let n=C(r);return n==="ESRCH"?"not_found":n==="EPERM"?"denied":"unknown"}}function T(e,t,r){try{return r(-e,t),"sent"}catch(n){let o=C(n);return o==="ESRCH"?"empty":o==="EPERM"?"denied":"failed"}}function _(){return performance.now()}async function k(e,t,r,n){let o=_()+r;for(;;){await E();let s=L(e,t);if(s==="not_found")return s;let u=o-_();if(u<=0)return s;await G(Math.min(n,u));}}async function ue(e,t,r,n){for(;;){await E();let o=L(e,t);if(o==="not_found"||o==="alive")return o;let s=r-_();if(s<=0)return o;await G(Math.min(n,s));}}function l(e,t,r,n){return {status:t,groupId:e,...r?{lastSignal:r}:{},...n?{errorKind:n}:{}}}async function ae(e,t={}){let r=t.signal??"SIGTERM",n=t.graceMs??b,o=t.hardConfirmMs??$,s=t.pollIntervalMs??g;if(!ie(e))return l(e,"failed",void 0,"invalid_group_id");if(!ne.includes(r)||!y(n,0,re)||!y(o,te,oe)||!y(s,1,se))return l(e,"failed",void 0,"invalid_option");if((t.platform??process.platform)==="win32")return l(e,"unsupported",void 0,"unsupported_platform");let i=t.kill??process.kill,d=L(e,i);if(d==="not_found")return l(e,"exited");let c=n;if(d==="denied"&&r!=="SIGKILL"&&n>0){let p=_()+n,P=await ue(e,i,p,s);if(P==="not_found")return l(e,"exited");if(P!=="alive")return l(e,"failed",void 0,P==="denied"?"probe_denied":"probe_failed");c=Math.max(0,p-_());}else if(d!=="alive")return l(e,"failed",void 0,d==="denied"?"probe_denied":"probe_failed");let a;if(r!=="SIGKILL"){let p=T(e,r,i);if(p==="empty")return l(e,"exited");if(p!=="sent")return l(e,"failed",void 0,p==="denied"?"signal_denied":"signal_failed");a=r;let P=await k(e,i,c,s);if(P==="not_found")return l(e,"exited",a);if(P!=="alive")return l(e,"failed",a,P==="denied"?"probe_denied":"probe_failed")}let m=T(e,"SIGKILL",i);if(m==="empty")return l(e,"exited",a);if(m!=="sent")return l(e,"failed",a,m==="denied"?"signal_denied":"signal_failed");a="SIGKILL";let f=await k(e,i,o,s);return f==="not_found"?l(e,"exited",a):f==="alive"?l(e,"failed",a,"still_running"):l(e,"failed",a,f==="denied"?"probe_denied":"probe_failed")}exports.OWNED_GROUP_KILL_CONFIRM_MS=$;exports.PROCESS_START_TIME_TOLERANCE_MS=j;exports.UNIX_PROCESS_POLL_INTERVAL_MS=g;exports.UNIX_SIGKILL_CONFIRM_MS=M;exports.UNIX_SIGTERM_GRACE_MS=b;exports.checkProcessOwnership=B;exports.checkProcessOwnershipAsync=V;exports.parseProcessElapsedSeconds=v;exports.parseWindowsCreationDate=A;exports.probeProcessLiveness=w;exports.readProcessIdentity=z;exports.readProcessIdentityAsync=Q;exports.terminateOwnedProcessGroup=ae;exports.terminateProcessTree=ee;
|
|
1
|
+
'use strict';var child_process=require('child_process');var O=3e3;var b=2e3,g=25,L=100;function R(e){return e instanceof Error?e:e===void 0?void 0:new Error(String(e))}function y(e){return typeof e=="object"&&e!==null&&"code"in e?String(e.code):void 0}function S(e){return Number.isSafeInteger(e)&&e>0}function X(e){let r=e.trim();if(!r)return "";let n=/^(?:"([^"]+)"|'([^']+)')/.exec(r);return n?.[1]??n?.[2]??r.split(/\s+/,1)[0]??""}function J(e,r,n){let t=n==="win32"?e.toLowerCase():e,o=n==="win32"?r.toLowerCase():r;if(!o.trim())return false;if(o==="agy"){let s=X(e).split(/[\\/]/).pop()??"",i=n==="win32"?s.toLowerCase():s;return i==="agy"||n==="win32"&&(i==="agy.exe"||i==="agy.cmd")}return t.includes(o)}function h(e,r,n){return r.some(t=>J(e,t,n))}function x(e,r){try{let n=child_process.spawnSync(e,r,{encoding:"utf8",timeout:O,windowsHide:!0});return {status:n.status,stdout:typeof n.stdout=="string"?n.stdout:"",stderr:typeof n.stderr=="string"?n.stderr:"",error:n.error}}catch(n){return {status:null,stdout:"",stderr:"",error:R(n)}}}function B(e,r){return new Promise(n=>{let t;try{t=child_process.spawn(e,r,{windowsHide:!0});}catch(a){n({status:null,stdout:"",stderr:"",error:R(a)});return}let o="",s="",i=false,u,m=setTimeout(()=>{try{t.kill();}catch{}u({status:null,stdout:o,stderr:s,error:new Error(`Command timed out after ${O}ms`)});},O);u=a=>{i||(i=true,clearTimeout(m),n(a));},t.stdout?.setEncoding("utf8"),t.stderr?.setEncoding("utf8"),t.stdout?.on("data",a=>{o+=String(a);}),t.stderr?.on("data",a=>{s+=String(a);}),t.once("error",a=>{u({status:null,stdout:o,stderr:s,error:a});}),t.once("close",a=>{u({status:a,stdout:o,stderr:s});});})}async function I(e,r,n){return n.runCommandAsync?n.runCommandAsync(e,r):n.runCommand?n.runCommand(e,r):B(e,r)}function G(e){return new Promise(r=>{setTimeout(r,Math.max(0,e));})}function E(){return new Promise(e=>{setImmediate(e);})}function w(e,r=process.kill){try{return r(e,0),"alive"}catch(n){return y(n)==="ESRCH"?"not_found":y(n)==="EPERM"?"alive":"unknown"}}function V(e,r){if(!S(e))return {status:"unknown"};let n=r.platform??process.platform,t=r.runCommand??x,o=n==="win32"?"powershell.exe":"ps",s=n==="win32"?["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",`$p = Get-CimInstance -ClassName Win32_Process -Filter 'ProcessId = ${e}' -ErrorAction Stop; if ($null -ne $p) { [Console]::Write([string]$p.CommandLine) }`]:["-p",String(e),"-o","command="],i;try{i=t(o,s);}catch{return {status:"unknown"}}if(i.error||i.status!==0)return {status:"unknown"};let u=i.stdout.trim();return u?{status:"found",commandLine:u}:{status:"not_found"}}function j(e,r){let n=w(-e,r),t=w(e,r);return n==="alive"||t==="alive"?"alive":n==="unknown"||t==="unknown"?"unknown":"not_found"}async function v(e,r,n,t){let o=Math.max(0,n),s=Math.max(1,t.pollIntervalMs??g),i=Date.now()+o,u,m=o===0,a=t.sleep?Promise.resolve().then(()=>t.sleep(o)).then(()=>{},()=>{}):new Promise(c=>{u=setTimeout(c,o);});a.then(()=>{m=true;});try{for(await E();;){let c=j(e,r);if(c==="not_found")return c;let f=i-Date.now();if(m||f<=0)return c;await Promise.race([a,G(Math.min(s,f))]);}}finally{u!==void 0&&clearTimeout(u);}}async function k(e,r,n,t,o){let s=await v(e,r,o.hardConfirmMs??L,{...o,sleep:void 0});return s==="not_found"?n?{status:"not_found",pid:e,method:t}:{status:"terminated",pid:e,method:t}:s==="alive"?{status:"failed",pid:e,method:t,error:"Process is still running after termination attempt"}:{status:"failed",pid:e,method:t,error:"Unable to verify process termination"}}function z(e,r,n={}){let t=V(e,n);if(t.status!=="found")return t.status;let o=n.platform??process.platform;return h(t.commandLine,r,o)?"owned":"not_owned"}async function q(e,r,n={}){if(!S(e))return "unknown";let t=n.platform??process.platform,o=t==="win32"?"powershell.exe":"ps",s=t==="win32"?["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",`$p = Get-CimInstance -ClassName Win32_Process -Filter 'ProcessId = ${e}' -ErrorAction Stop; if ($null -ne $p) { [Console]::Write([string]$p.CommandLine) }`]:["-p",String(e),"-o","command="],i;try{i=await I(o,s,n);}catch{return "unknown"}if(i.error||i.status!==0)return "unknown";let u=i.stdout.trim();return u?h(u,r,t)?"owned":"not_owned":"not_found"}var Y=3e3,Z=/^(?:(\d+)-)?(?:(\d+):)?(\d{1,2}):(\d{2})$/,Q=/^\s*(\d+)\s+(\S+)\s+(\S+)\s*$/,ee=/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})\.(\d{6})([+-]\d{3})$/;function A(e){let r=Z.exec(e.trim());if(!r)return;let[,n="0",t="0",o="0",s="0"]=r;return ((Number(n)*24+Number(t))*60+Number(o))*60+Number(s)}function U(e){let r=e.trim(),n=ee.exec(r);if(n){let[,o,s,i,u,m,a,c,f]=n;return Date.UTC(Number(o),Number(s)-1,Number(i),Number(u),Number(m),Number(a),Math.trunc(Number(c)/1e3))-Number(f)*6e4}let t=Date.parse(r);return Number.isFinite(t)?t:void 0}function D(e,r){return r==="win32"?{command:"powershell.exe",args:["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",`$p = Get-CimInstance -ClassName Win32_Process -Filter 'ProcessId = ${e}' -ErrorAction Stop; if ($null -ne $p) { [Console]::Write($p.CreationDate.ToUniversalTime().ToString('o')) }`]}:{command:"ps",args:["-p",String(e),"-o","pgid=","-o","etime=","-o","stat="]}}function $(e,r,n){if(e.error)return {status:"unknown"};let t=e.stdout.trim();if(!t)return e.status===0||e.status===1?{status:"not_found"}:{status:"unknown"};if(e.status!==0)return {status:"unknown"};if(r==="win32"){let i=U(t);return i===void 0?{status:"unknown"}:{status:"found",startedAtMs:i,groupId:null}}let o=Q.exec(t),s=o?A(o[2]):void 0;return !o||s===void 0?{status:"unknown"}:o[3].startsWith("Z")?{status:"unknown"}:{status:"found",startedAtMs:n-s*1e3,groupId:Number(o[1])}}function ne(e,r={}){if(!S(e))return {status:"unknown"};let n=r.platform??process.platform,{command:t,args:o}=D(e,n),s=r.runCommand??x,i;try{i=s(t,o);}catch{return {status:"unknown"}}return $(i,n,Date.now())}async function re(e,r={}){if(!S(e))return {status:"unknown"};let n=r.platform??process.platform,{command:t,args:o}=D(e,n),s;try{s=await I(t,o,r);}catch{return {status:"unknown"}}return $(s,n,Date.now())}async function te(e,r={}){let n=r.platform??process.platform,t=n==="win32"?"taskkill":"process-group",o=l=>({status:"failed",pid:e,method:t,error:l});if(!S(e))return o("Invalid process ID");let s=r.kill??process.kill,i=w(e,s);if(i==="not_found")return {status:"not_found",pid:e,method:t};if(i!=="alive")return o("Unable to determine whether the process is alive");if(n==="win32"){let l;try{l=await I("taskkill",["/PID",String(e),"/T","/F"],r);}catch(P){l={status:null,stdout:"",stderr:"",error:R(P)};}let p=w(e,s);return p==="not_found"?l.status===0&&!l.error?{status:"terminated",pid:e,method:t}:{status:"not_found",pid:e,method:t}:o(p==="alive"?"Process is still running after termination attempt":"Unable to verify process termination")}let u,m=r.signal??"SIGKILL";try{s(-e,m);}catch(l){u=l;}if(m==="SIGKILL")return k(e,s,u,t,r);if(await v(e,s,r.graceMs??b,r)==="not_found")return u?{status:"not_found",pid:e,method:t}:{status:"terminated",pid:e,method:t};let c;try{s(-e,"SIGKILL");}catch(l){c=l;}let f=await k(e,s,c,t,r);return f.status==="terminated"?f:f.status==="not_found"?u?f:{status:"terminated",pid:e,method:t}:o(f.error??"Process termination failed")}var K=1e3,oe=["SIGTERM","SIGINT","SIGHUP","SIGKILL"],se=6e4,ie=100,ue=3e4,ae=1e3;function C(e,r,n){return Number.isFinite(e)&&e>=r&&e<=n}function ce(e){return Number.isSafeInteger(e)&&e>1&&e!==process.pid}function N(e,r){try{return r(-e,0),"alive"}catch(n){let t=y(n);return t==="ESRCH"?"not_found":t==="EPERM"?"denied":"unknown"}}function M(e,r,n){try{return n(-e,r),"sent"}catch(t){let o=y(t);return o==="ESRCH"?"empty":o==="EPERM"?"denied":"failed"}}function _(){return performance.now()}async function T(e,r,n,t){let o=_()+n;for(;;){await E();let s=N(e,r);if(s==="not_found")return s;let i=o-_();if(i<=0)return s;await G(Math.min(t,i));}}async function de(e,r,n,t){for(;;){await E();let o=N(e,r);if(o==="not_found"||o==="alive")return o;let s=n-_();if(s<=0)return o;await G(Math.min(t,s));}}function d(e,r,n,t){return {status:r,groupId:e,...n?{lastSignal:n}:{},...t?{errorKind:t}:{}}}async function me(e,r={}){let n=r.signal??"SIGTERM",t=r.graceMs??b,o=r.hardConfirmMs??K,s=r.pollIntervalMs??g;if(!ce(e))return d(e,"failed",void 0,"invalid_group_id");if(!oe.includes(n)||!C(t,0,se)||!C(o,ie,ue)||!C(s,1,ae))return d(e,"failed",void 0,"invalid_option");if((r.platform??process.platform)==="win32")return d(e,"unsupported",void 0,"unsupported_platform");let u=r.kill??process.kill,m=N(e,u);if(m==="not_found")return d(e,"exited");let a=t;if(m==="denied"&&n!=="SIGKILL"&&t>0){let p=_()+t,P=await de(e,u,p,s);if(P==="not_found")return d(e,"exited");if(P!=="alive")return d(e,"failed",void 0,P==="denied"?"probe_denied":"probe_failed");a=Math.max(0,p-_());}else if(m!=="alive")return d(e,"failed",void 0,m==="denied"?"probe_denied":"probe_failed");let c;if(n!=="SIGKILL"){let p=M(e,n,u);if(p==="empty")return d(e,"exited");if(p!=="sent")return d(e,"failed",void 0,p==="denied"?"signal_denied":"signal_failed");c=n;let P=await T(e,u,a,s);if(P==="not_found")return d(e,"exited",c);if(P!=="alive")return d(e,"failed",c,P==="denied"?"probe_denied":"probe_failed")}let f=M(e,"SIGKILL",u);if(f==="empty")return d(e,"exited",c);if(f!=="sent")return d(e,"failed",c,f==="denied"?"signal_denied":"signal_failed");c="SIGKILL";let l=await T(e,u,o,s);return l==="not_found"?d(e,"exited",c):l==="alive"?d(e,"failed",c,"still_running"):d(e,"failed",c,l==="denied"?"probe_denied":"probe_failed")}exports.OWNED_GROUP_KILL_CONFIRM_MS=K;exports.PROCESS_START_TIME_TOLERANCE_MS=Y;exports.UNIX_PROCESS_POLL_INTERVAL_MS=g;exports.UNIX_SIGKILL_CONFIRM_MS=L;exports.UNIX_SIGTERM_GRACE_MS=b;exports.checkProcessOwnership=z;exports.checkProcessOwnershipAsync=q;exports.parseProcessElapsedSeconds=A;exports.parseWindowsCreationDate=U;exports.probeProcessLiveness=w;exports.readProcessIdentity=ne;exports.readProcessIdentityAsync=re;exports.terminateOwnedProcessGroup=me;exports.terminateProcessTree=te;
|
|
@@ -26,7 +26,7 @@ export type { ReapOrphanedTasksOptions } from './task.repository.js';
|
|
|
26
26
|
export type { ProviderInputEpochEntry, ProviderInputRecord } from './task.repository.js';
|
|
27
27
|
export { countRatedTasks, listRatedTasks, RATED_TASK_EXCERPT_MAX_CHARS, RATED_TASK_LIST_MAX_LIMIT, setTaskRating, TASK_RATINGS, TaskRatingError, } from './task.repository.js';
|
|
28
28
|
export type { CountRatedTasksInput, ListRatedTasksInput, RatedTaskRow, SetTaskRatingInput, SetTaskRatingResult, TaskRating, TaskRatingErrorCode, } from './task.repository.js';
|
|
29
|
-
export type { FinalizeTaskStopOptions, TaskStopMethod, TaskStopOrigin, TaskStopRequestContext, TaskStopRequestResult, } from './task.repository.js';
|
|
29
|
+
export type { FinalizeTaskStopOptions, TaskStopMethod, TaskStopOrigin, TaskStopRequestContext, TaskStopRequestReceipt, TaskStopRequestResult, } from './task.repository.js';
|
|
30
30
|
export { INSTRUCTION_STOP_EPOCH_MISMATCH, INSTRUCTION_STOP_GENERATION_ALREADY_SETTLED, INSTRUCTION_STOP_PROCESS_TERMINATION_FAILED, INSTRUCTION_STOP_REQUEST_FAILED, INSTRUCTION_STOP_SETTLE_CAS_FAILED, INSTRUCTION_STOP_TARGET_PID_MISSING, INSTRUCTION_STOP_WORKSPACE_MISMATCH, stopTask, resolveTaskStopMethod, TASK_STOP_DEFAULT_GRACE_MS, TASK_STOP_DEFAULT_POLL_MS, TASK_STOP_OWNED_PROCESS_MARKERS, } from '../lifecycle/task-stop.js';
|
|
31
31
|
export type { StopTaskGenerationForInstructionOptions, StopTaskOptions, StopTaskProcessControl, StopTaskResult, StopTaskStatus, } from '../lifecycle/task-stop.js';
|
|
32
32
|
export { runHeartbeatTick, startTaskHeartbeat, stopTaskHeartbeat, TASK_STOP_POLL_INTERVAL_MS, taskHeartbeatRegistry, } from '../lifecycle/task-heartbeat.js';
|