crewx 0.9.0-rc.2 → 0.9.0-rc.21
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/assets/MarketPage-DDPL2d7x.js +36 -0
- package/dist/assets/{PromptTab-hdXDbbT6.js → PromptTab-UC3K4qx2.js} +3 -3
- package/dist/assets/{arc--CBVVcyH.js → arc-DdP3-fUR.js} +1 -1
- package/dist/assets/{architectureDiagram-UYN6MBPD-DUiYwqJn.js → architectureDiagram-UYN6MBPD-D16VON1i.js} +1 -1
- package/dist/assets/{blockDiagram-ZHA2E4KO-DV86vAgG.js → blockDiagram-ZHA2E4KO-qs1dIRkl.js} +4 -4
- package/dist/assets/{c4Diagram-6F5ED5ID-CvWE7Cx_.js → c4Diagram-6F5ED5ID-BeDy8akQ.js} +1 -1
- package/dist/assets/channel-DtrxBSkc.js +1 -0
- package/dist/assets/{chunk-5HRBRIJM-DAxM5Ul_.js → chunk-5HRBRIJM-BC1zIb11.js} +1 -1
- package/dist/assets/{chunk-7U56Z5CX-BuYaEj8L.js → chunk-7U56Z5CX-BuGil3QD.js} +1 -1
- package/dist/assets/{chunk-ASOPGD6M-2Kx0e45C.js → chunk-ASOPGD6M-DmKdDtBQ.js} +1 -1
- package/dist/assets/{chunk-KFBOBJHC-CR4QS6Rt.js → chunk-KFBOBJHC-D3BvHLPa.js} +1 -1
- package/dist/assets/{chunk-T2TOU4HS-CffcwNHx.js → chunk-T2TOU4HS-B5MoUp-N.js} +1 -1
- package/dist/assets/{chunk-TMUBEWPD-BGpYtekN.js → chunk-TMUBEWPD-AvWe_lsV.js} +1 -1
- package/dist/assets/classDiagram-LNE6IOMH-BMT5B_JB.js +1 -0
- package/dist/assets/classDiagram-v2-MQ7JQ4JX-BMT5B_JB.js +1 -0
- package/dist/assets/{dagre-4EVJKHTY-yBWukkrE.js → dagre-4EVJKHTY-B6DewFyM.js} +1 -1
- package/dist/assets/{diagram-QW4FP2JN-CIr1PLq3.js → diagram-QW4FP2JN-BTsQ8JSd.js} +1 -1
- package/dist/assets/{erDiagram-6RL3IURR-xG7SygyU.js → erDiagram-6RL3IURR-BM5nvgVR.js} +1 -1
- package/dist/assets/{flowDiagram-7ASYPVHJ-CKalfOqp.js → flowDiagram-7ASYPVHJ-D1UCCuOG.js} +1 -1
- package/dist/assets/{ganttDiagram-NTVNEXSI-Bnx7zrX4.js → ganttDiagram-NTVNEXSI-CNIGs7Cn.js} +1 -1
- package/dist/assets/{gitGraph-YCYPL57B-TQlF0fiA.js → gitGraph-YCYPL57B-DSLjx1yQ.js} +1 -1
- package/dist/assets/{gitGraphDiagram-NRZ2UAAF-DxlaFkwO.js → gitGraphDiagram-NRZ2UAAF-B11zX1Fa.js} +1 -1
- package/dist/assets/{infoDiagram-A4XQUW5V-B1-arkqa.js → infoDiagram-A4XQUW5V-DkjvODYl.js} +1 -1
- package/dist/assets/{journeyDiagram-G5WM74LC-Cj439GUX.js → journeyDiagram-G5WM74LC-BkCQPMn6.js} +1 -1
- package/dist/assets/{kanban-definition-QRCXZQQD-BvrIwEIc.js → kanban-definition-QRCXZQQD-_OX7pNfJ.js} +1 -1
- package/dist/assets/{linear-BKYNK0ri.js → linear-BYjwVAR6.js} +1 -1
- package/dist/assets/main-CZdKLdUl.css +10 -0
- package/dist/assets/main-CkkZNCy-.js +1561 -0
- package/dist/assets/{mindmap-definition-GWI6TPTV-BExfJY0G.js → mindmap-definition-GWI6TPTV-BzYpSnv8.js} +1 -1
- package/dist/assets/ort-wasm-simd-threaded.asyncify-DMmc6YqF.wasm +0 -0
- package/dist/assets/{pieDiagram-YF2LJOPJ-RPWpvrC8.js → pieDiagram-YF2LJOPJ-CEFg6ao0.js} +1 -1
- package/dist/assets/{quadrantDiagram-OS5C2QUG-DmbBzk5Q.js → quadrantDiagram-OS5C2QUG-_5w2x3VV.js} +1 -1
- package/dist/assets/{requirementDiagram-MIRIMTAZ-DFQuFXq3.js → requirementDiagram-MIRIMTAZ-B_VQYReZ.js} +1 -1
- package/dist/assets/{sankeyDiagram-Y46BX6SQ-p_bw56lJ.js → sankeyDiagram-Y46BX6SQ-CgmOlLhh.js} +1 -1
- package/dist/assets/{sequenceDiagram-G6AWOVSC-DTbBkLeD.js → sequenceDiagram-G6AWOVSC-MGVt0Ai2.js} +1 -1
- package/dist/assets/{stateDiagram-MAYHULR4-DBvC6UcF.js → stateDiagram-MAYHULR4-DaZjgTu-.js} +1 -1
- package/dist/assets/stateDiagram-v2-4JROLMXI-DN1wGYkV.js +1 -0
- package/dist/assets/{timeline-definition-U7ZMHBDA-B6utvIg1.js → timeline-definition-U7ZMHBDA-CusetmK6.js} +1 -1
- package/dist/assets/transformers.web-BN8Ug43_.js +45 -0
- package/dist/assets/{xychartDiagram-6QU3TZC5-BHG0s1Ye.js → xychartDiagram-6QU3TZC5-CTndf-if.js} +1 -1
- package/dist/index.html +2 -2
- package/dist-server/app.module.js +4 -0
- package/dist-server/bootstrap/codex-writable-roots.js +88 -0
- package/dist-server/bootstrap/crewx-server.js +10 -2
- package/dist-server/common/decorator/skip-request-log.decorator.js +8 -0
- package/dist-server/common/interceptor/http-logging.interceptor.js +17 -4
- package/dist-server/common/task-log/stdout-json-fallback.js +200 -0
- package/dist-server/domain/agent/agent.controller.js +14 -0
- package/dist-server/domain/agent/agent.service.js +246 -18
- package/dist-server/domain/agent/dto/create-agent.dto.js +12 -0
- package/dist-server/domain/agent/dto/remote-provider.dto.js +82 -0
- package/dist-server/domain/agent/dto/reorder-agents.dto.js +51 -0
- package/dist-server/domain/agent/dto/update-agent.dto.js +3 -1
- package/dist-server/domain/agent/provider.controller.js +12 -1
- package/dist-server/domain/doc/doc.controller.js +43 -9
- package/dist-server/domain/doc/doc.service.js +80 -6
- package/dist-server/domain/doc/image-constants.js +11 -1
- package/dist-server/domain/events/workspace-events.controller.js +2 -0
- package/dist-server/domain/message/dto/send-message.dto.js +49 -1
- package/dist-server/domain/message/message.controller.js +1 -1
- package/dist-server/domain/message/message.module.js +2 -1
- package/dist-server/domain/message/message.service.js +83 -13
- package/dist-server/domain/settings/settings.service.js +188 -1
- package/dist-server/domain/system/system.controller.js +41 -0
- package/dist-server/domain/system/system.module.js +19 -0
- package/dist-server/domain/task/task.constants.js +8 -1
- package/dist-server/domain/task/task.service.js +59 -67
- package/dist-server/domain/thread/dto/list-threads.dto.js +18 -0
- package/dist-server/domain/thread/overdrive.types.js +38 -0
- package/dist-server/domain/thread/thread.service.js +83 -70
- package/dist-server/domain/usage/usage.controller.js +18 -0
- package/dist-server/domain/usage/usage.module.js +1 -0
- package/dist-server/domain/usage/usage.service.js +246 -4
- package/dist-server/domain/usage-report/dto/usage-report.dto.js +2 -0
- package/dist-server/domain/usage-report/usage-report.controller.js +72 -0
- package/dist-server/domain/usage-report/usage-report.module.js +23 -0
- package/dist-server/domain/usage-report/usage-report.service.js +135 -0
- package/dist-server/domain/wi/wi.service.js +45 -3
- package/dist-server/main.js +1 -0
- package/dist-server/repository/repository.module.js +2 -0
- package/dist-server/repository/task.repository.js +56 -0
- package/dist-server/repository/thread.repository.js +13 -0
- package/dist-server/repository/usage-report.repository.js +27 -0
- package/package.json +9 -9
- package/packages/cli/dist/bootstrap/codex-writable-roots.d.ts +45 -0
- package/packages/cli/dist/bootstrap/codex-writable-roots.js +88 -0
- package/packages/cli/dist/bootstrap/crewx-cli.js +2 -0
- package/packages/cli/dist/commands/execute.js +10 -2
- package/packages/cli/dist/commands/parse-common-flags.d.ts +5 -1
- package/packages/cli/dist/commands/parse-common-flags.js +9 -2
- package/packages/cli/dist/commands/ps.js +51 -2
- package/packages/cli/dist/commands/query.js +10 -2
- package/packages/cli/dist/commands/restart.js +20 -6
- package/packages/cli/dist/commands/write-output.d.ts +3 -0
- package/packages/cli/dist/commands/write-output.js +24 -0
- package/packages/cli/dist/main.js +7 -0
- package/packages/cli/package.json +1 -1
- package/dist/assets/MarketPage-T1o_oIrw.js +0 -41
- package/dist/assets/channel-7q16D7P9.js +0 -1
- package/dist/assets/classDiagram-LNE6IOMH-C6qjk4uc.js +0 -1
- package/dist/assets/classDiagram-v2-MQ7JQ4JX-C6qjk4uc.js +0 -1
- package/dist/assets/main-C5mwv79r.css +0 -10
- package/dist/assets/main-DmvFaz-d.js +0 -1486
- package/dist/assets/stateDiagram-v2-4JROLMXI-CCMApx_v.js +0 -1
package/dist/assets/{xychartDiagram-6QU3TZC5-BHG0s1Ye.js → xychartDiagram-6QU3TZC5-CTndf-if.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as ui,g as gi,n as Ft,o as xi,a as di,b as pi,_ as a,l as Xt,G as fi,e as mi,v as yi,E as At,i as bi,C as Nt,D as Ai,I as wi,aj as Ci,K as Bt}from"./main-
|
|
1
|
+
import{s as ui,g as gi,n as Ft,o as xi,a as di,b as pi,_ as a,l as Xt,G as fi,e as mi,v as yi,E as At,i as bi,C as Nt,D as Ai,I as wi,aj as Ci,K as Bt}from"./main-CkkZNCy-.js";import{i as Si}from"./init-Gi6I4Gst.js";import{o as _i}from"./ordinal-Cboi1Yqb.js";import{l as Wt}from"./linear-BYjwVAR6.js";function ki(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function pt(){var e=_i().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,u,f=!1,p=0,k=0,R=.5;delete e.unknown;function w(){var y=t().length,D=n<s,S=D?n:s,v=D?s:n;o=(v-S)/Math.max(1,y-p+k*2),f&&(o=Math.floor(o)),S+=(v-S-o*(y-p))*R,u=o*(1-p),f&&(S=Math.round(S),u=Math.round(u));var m=ki(y).map(function(_){return S+o*_});return i(D?m.reverse():m)}return e.domain=function(y){return arguments.length?(t(y),w()):t()},e.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,w()):[s,n]},e.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,f=!0,w()},e.bandwidth=function(){return u},e.step=function(){return o},e.round=function(y){return arguments.length?(f=!!y,w()):f},e.padding=function(y){return arguments.length?(p=Math.min(1,k=+y),w()):p},e.paddingInner=function(y){return arguments.length?(p=Math.min(1,y),w()):p},e.paddingOuter=function(y){return arguments.length?(k=+y,w()):k},e.align=function(y){return arguments.length?(R=Math.max(0,Math.min(1,y)),w()):R},e.copy=function(){return pt(t(),[s,n]).round(f).paddingInner(p).paddingOuter(k).align(R)},Si.apply(w(),arguments)}var ft=function(){var e=a(function(B,h,c,g){for(c=c||{},g=B.length;g--;c[B[g]]=h);return c},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],u=[1,7],f=[1,5,10,12,14,16,18,19,21,23,34,35,36],p=[1,25],k=[1,26],R=[1,28],w=[1,29],y=[1,30],D=[1,31],S=[1,32],v=[1,33],m=[1,34],_=[1,35],l=[1,36],E=[1,37],X=[1,43],vt=[1,42],Pt=[1,47],et=[1,50],C=[1,10,12,14,16,18,19,21,23,34,35,36],lt=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],I=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],Lt=[1,64],ct={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,c,g,x,A,r,N){var d=r.length-1;switch(A){case 5:x.setOrientation(r[d]);break;case 9:x.setDiagramTitle(r[d].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[d]);break;case 13:x.setLineData(r[d-1],r[d]);break;case 14:x.setBarData({text:"",type:"text"},r[d]);break;case 15:x.setBarData(r[d-1],r[d]);break;case 16:this.$=r[d].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[d].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[d-1];break;case 20:this.$=[Number(r[d-2]),...r[d]];break;case 21:this.$=[Number(r[d])];break;case 22:x.setXAxisTitle(r[d]);break;case 23:x.setXAxisTitle(r[d-1]);break;case 24:x.setXAxisTitle({type:"text",text:""});break;case 25:x.setXAxisBand(r[d]);break;case 26:x.setXAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 27:this.$=r[d-1];break;case 28:this.$=[r[d-2],...r[d]];break;case 29:this.$=[r[d]];break;case 30:x.setYAxisTitle(r[d]);break;case 31:x.setYAxisTitle(r[d-1]);break;case 32:x.setYAxisTitle({type:"text",text:""});break;case 33:x.setYAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 37:this.$={text:r[d],type:"text"};break;case 38:this.$={text:r[d],type:"text"};break;case 39:this.$={text:r[d],type:"markdown"};break;case 40:this.$=r[d];break;case 41:this.$=r[d-1]+""+r[d];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:u}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:u}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(f,[2,34]),e(f,[2,35]),e(f,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:u}),{1:[2,3]},e(f,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:u}),{11:23,37:24,38:p,39:k,40:27,41:R,42:w,43:y,44:D,45:S,46:v,47:m,48:_,49:l,50:E},{11:39,13:38,24:X,27:vt,29:40,30:41,37:24,38:p,39:k,40:27,41:R,42:w,43:y,44:D,45:S,46:v,47:m,48:_,49:l,50:E},{11:45,15:44,27:Pt,33:46,37:24,38:p,39:k,40:27,41:R,42:w,43:y,44:D,45:S,46:v,47:m,48:_,49:l,50:E},{11:49,17:48,24:et,37:24,38:p,39:k,40:27,41:R,42:w,43:y,44:D,45:S,46:v,47:m,48:_,49:l,50:E},{11:52,17:51,24:et,37:24,38:p,39:k,40:27,41:R,42:w,43:y,44:D,45:S,46:v,47:m,48:_,49:l,50:E},{20:[1,53]},{22:[1,54]},e(C,[2,18]),{1:[2,2]},e(C,[2,8]),e(C,[2,9]),e(lt,[2,37],{40:55,41:R,42:w,43:y,44:D,45:S,46:v,47:m,48:_,49:l,50:E}),e(lt,[2,38]),e(lt,[2,39]),e(I,[2,40]),e(I,[2,42]),e(I,[2,43]),e(I,[2,44]),e(I,[2,45]),e(I,[2,46]),e(I,[2,47]),e(I,[2,48]),e(I,[2,49]),e(I,[2,50]),e(I,[2,51]),e(C,[2,10]),e(C,[2,22],{30:41,29:56,24:X,27:vt}),e(C,[2,24]),e(C,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:p,39:k,40:27,41:R,42:w,43:y,44:D,45:S,46:v,47:m,48:_,49:l,50:E},e(C,[2,11]),e(C,[2,30],{33:60,27:Pt}),e(C,[2,32]),{31:[1,61]},e(C,[2,12]),{17:62,24:et},{25:63,27:Lt},e(C,[2,14]),{17:65,24:et},e(C,[2,16]),e(C,[2,17]),e(I,[2,41]),e(C,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(C,[2,31]),{27:[1,69]},e(C,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(C,[2,15]),e(C,[2,26]),e(C,[2,27]),{11:59,32:72,37:24,38:p,39:k,40:27,41:R,42:w,43:y,44:D,45:S,46:v,47:m,48:_,49:l,50:E},e(C,[2,33]),e(C,[2,19]),{25:73,27:Lt},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,c){if(c.recoverable)this.trace(h);else{var g=new Error(h);throw g.hash=c,g}},"parseError"),parse:a(function(h){var c=this,g=[0],x=[],A=[null],r=[],N=this.table,d="",nt=0,Et=0,oi=2,It=1,hi=r.slice.call(arguments,1),T=Object.create(this.lexer),W={yy:{}};for(var ut in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ut)&&(W.yy[ut]=this.yy[ut]);T.setInput(h,W.yy),W.yy.lexer=T,W.yy.parser=this,typeof T.yylloc>"u"&&(T.yylloc={});var gt=T.yylloc;r.push(gt);var li=T.options&&T.options.ranges;typeof W.yy.parseError=="function"?this.parseError=W.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ci(L){g.length=g.length-2*L,A.length=A.length-L,r.length=r.length-L}a(ci,"popStack");function Mt(){var L;return L=x.pop()||T.lex()||It,typeof L!="number"&&(L instanceof Array&&(x=L,L=x.pop()),L=c.symbols_[L]||L),L}a(Mt,"lex");for(var P,O,M,xt,z={},at,V,Vt,rt;;){if(O=g[g.length-1],this.defaultActions[O]?M=this.defaultActions[O]:((P===null||typeof P>"u")&&(P=Mt()),M=N[O]&&N[O][P]),typeof M>"u"||!M.length||!M[0]){var dt="";rt=[];for(at in N[O])this.terminals_[at]&&at>oi&&rt.push("'"+this.terminals_[at]+"'");T.showPosition?dt="Parse error on line "+(nt+1)+`:
|
|
2
2
|
`+T.showPosition()+`
|
|
3
3
|
Expecting `+rt.join(", ")+", got '"+(this.terminals_[P]||P)+"'":dt="Parse error on line "+(nt+1)+": Unexpected "+(P==It?"end of input":"'"+(this.terminals_[P]||P)+"'"),this.parseError(dt,{text:T.match,token:this.terminals_[P]||P,line:T.yylineno,loc:gt,expected:rt})}if(M[0]instanceof Array&&M.length>1)throw new Error("Parse Error: multiple actions possible at state: "+O+", token: "+P);switch(M[0]){case 1:g.push(P),A.push(T.yytext),r.push(T.yylloc),g.push(M[1]),P=null,Et=T.yyleng,d=T.yytext,nt=T.yylineno,gt=T.yylloc;break;case 2:if(V=this.productions_[M[1]][1],z.$=A[A.length-V],z._$={first_line:r[r.length-(V||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(V||1)].first_column,last_column:r[r.length-1].last_column},li&&(z._$.range=[r[r.length-(V||1)].range[0],r[r.length-1].range[1]]),xt=this.performAction.apply(z,[d,Et,nt,W.yy,M[1],A,r].concat(hi)),typeof xt<"u")return xt;V&&(g=g.slice(0,-1*V*2),A=A.slice(0,-1*V),r=r.slice(0,-1*V)),g.push(this.productions_[M[1]][0]),A.push(z.$),r.push(z._$),Vt=N[g[g.length-2]][g[g.length-1]],g.push(Vt);break;case 3:return!0}}return!0},"parse")},ri=function(){var B={EOF:1,parseError:a(function(c,g){if(this.yy.parser)this.yy.parser.parseError(c,g);else throw new Error(c)},"parseError"),setInput:a(function(h,c){return this.yy=c||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var c=h.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:a(function(h){var c=h.length,g=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===x.length?this.yylloc.first_column:0)+x[x.length-g.length].length-g[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(h){this.unput(this.match.slice(h))},"less"),pastInput:a(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var h=this.pastInput(),c=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
|
package/dist/index.html
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
gtag('config', 'G-B8B6SJ01KK', { send_page_view: false });
|
|
14
14
|
</script>
|
|
15
15
|
<!-- ga-end -->
|
|
16
|
-
<script type="module" crossorigin src="/assets/main-
|
|
17
|
-
<link rel="stylesheet" crossorigin href="/assets/main-
|
|
16
|
+
<script type="module" crossorigin src="/assets/main-CkkZNCy-.js"></script>
|
|
17
|
+
<link rel="stylesheet" crossorigin href="/assets/main-CZdKLdUl.css">
|
|
18
18
|
</head>
|
|
19
19
|
<body>
|
|
20
20
|
<div id="root"></div>
|
|
@@ -15,6 +15,7 @@ const workspace_middleware_js_1 = require("./common/middleware/workspace.middlew
|
|
|
15
15
|
const config_1 = require("@nestjs/config");
|
|
16
16
|
const cli_module_js_1 = require("./domain/cli/cli.module.js");
|
|
17
17
|
const usage_module_js_1 = require("./domain/usage/usage.module.js");
|
|
18
|
+
const usage_report_module_js_1 = require("./domain/usage-report/usage-report.module.js");
|
|
18
19
|
const task_module_js_1 = require("./domain/task/task.module.js");
|
|
19
20
|
const mcp_module_js_1 = require("./domain/mcp/mcp.module.js");
|
|
20
21
|
const agent_module_js_1 = require("./domain/agent/agent.module.js");
|
|
@@ -47,6 +48,7 @@ const auth_module_js_1 = require("./domain/auth/auth.module.js");
|
|
|
47
48
|
const settings_module_js_1 = require("./domain/settings/settings.module.js");
|
|
48
49
|
const events_module_js_1 = require("./domain/events/events.module.js");
|
|
49
50
|
const token_module_js_1 = require("./domain/token/token.module.js");
|
|
51
|
+
const system_module_js_1 = require("./domain/system/system.module.js");
|
|
50
52
|
let AppModule = class AppModule {
|
|
51
53
|
configure(consumer) {
|
|
52
54
|
consumer
|
|
@@ -70,6 +72,7 @@ exports.AppModule = AppModule = __decorate([
|
|
|
70
72
|
task_module_js_1.TaskModule,
|
|
71
73
|
agent_module_js_1.AgentModule,
|
|
72
74
|
usage_module_js_1.UsageModule,
|
|
75
|
+
usage_report_module_js_1.UsageReportModule,
|
|
73
76
|
document_module_js_1.DocumentModule,
|
|
74
77
|
doc_module_js_1.DocModule,
|
|
75
78
|
knowledge_module_js_1.KnowledgeModule,
|
|
@@ -94,6 +97,7 @@ exports.AppModule = AppModule = __decorate([
|
|
|
94
97
|
health_module_js_1.HealthModule,
|
|
95
98
|
settings_module_js_1.SettingsModule,
|
|
96
99
|
token_module_js_1.TokenModule,
|
|
100
|
+
system_module_js_1.SystemModule,
|
|
97
101
|
],
|
|
98
102
|
controllers: [],
|
|
99
103
|
providers: [
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Server-layer policy: inject CrewX home as an extra writable root for Codex
|
|
4
|
+
* `workspace-write` sandbox invocations.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors packages/cli/src/bootstrap/codex-writable-roots.ts. Duplicated
|
|
7
|
+
* (rather than imported from the CLI package) so the server product layer
|
|
8
|
+
* doesn't depend on CLI internals; both stay small, product-specific
|
|
9
|
+
* consumers of the SDK's `additionalArgsProvider` extension point
|
|
10
|
+
* (WI-20260703-001), keeping the SDK itself free of CrewX-specific paths.
|
|
11
|
+
*
|
|
12
|
+
* Why `-c sandbox_workspace_write.writable_roots=[...]` instead of `--add-dir`:
|
|
13
|
+
* Verified against codex-cli 0.139.0 (`codex exec --help` / `codex exec resume --help`):
|
|
14
|
+
* - `codex exec` supports `--add-dir <DIR>`.
|
|
15
|
+
* - `codex exec resume` does NOT support `--add-dir` (only `-c/--config`).
|
|
16
|
+
* Using the `-c` config-override form works identically for both `exec` and
|
|
17
|
+
* `exec resume`, avoiding a resume-incompatible flag.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.resolveCrewxHome = resolveCrewxHome;
|
|
21
|
+
exports.escapeTomlBasicString = escapeTomlBasicString;
|
|
22
|
+
exports.buildCodexWritableRootArgs = buildCodexWritableRootArgs;
|
|
23
|
+
exports.createCodexWritableRootsProvider = createCodexWritableRootsProvider;
|
|
24
|
+
const os_1 = require("os");
|
|
25
|
+
const path_1 = require("path");
|
|
26
|
+
/**
|
|
27
|
+
* crewx.yaml / query-option `mode` values for which Codex is NOT running in
|
|
28
|
+
* (or being pushed into) a `workspace-write`-equivalent sandbox. Injecting an
|
|
29
|
+
* extra writable root is meaningless (read-only/plan) or redundant
|
|
30
|
+
* (full-access variants already allow writes everywhere) in these modes.
|
|
31
|
+
*/
|
|
32
|
+
const NO_INJECT_MODES = new Set([
|
|
33
|
+
'read-only',
|
|
34
|
+
'plan',
|
|
35
|
+
'agent-full-access',
|
|
36
|
+
'yolo',
|
|
37
|
+
'danger-full-access',
|
|
38
|
+
]);
|
|
39
|
+
/**
|
|
40
|
+
* Resolve CrewX home directory.
|
|
41
|
+
* Priority: `CREWX_HOME` env var → `~/.crewx`.
|
|
42
|
+
*/
|
|
43
|
+
function resolveCrewxHome() {
|
|
44
|
+
return process.env.CREWX_HOME ?? (0, path_1.join)((0, os_1.homedir)(), '.crewx');
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Escape a string for embedding inside a TOML basic string (`"..."`).
|
|
48
|
+
* Sufficient for filesystem paths: handles backslash (Windows paths),
|
|
49
|
+
* double-quote, and control characters that could otherwise break TOML
|
|
50
|
+
* parsing of the `-c key="value"` override.
|
|
51
|
+
*/
|
|
52
|
+
function escapeTomlBasicString(value) {
|
|
53
|
+
return value
|
|
54
|
+
.replace(/\\/g, '\\\\')
|
|
55
|
+
.replace(/"/g, '\\"')
|
|
56
|
+
.replace(/\n/g, '\\n')
|
|
57
|
+
.replace(/\r/g, '\\r')
|
|
58
|
+
.replace(/\t/g, '\\t');
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Build the `-c sandbox_workspace_write.writable_roots=["<path>"]` arg pair.
|
|
62
|
+
* Works for both `codex exec` and `codex exec resume` (config-override form).
|
|
63
|
+
*/
|
|
64
|
+
function buildCodexWritableRootArgs(crewxHome) {
|
|
65
|
+
const escaped = escapeTomlBasicString(crewxHome);
|
|
66
|
+
return ['-c', `sandbox_workspace_write.writable_roots=["${escaped}"]`];
|
|
67
|
+
}
|
|
68
|
+
function isCodexProvider(ctx) {
|
|
69
|
+
return ctx.providerId === 'codex' || ctx.providerStr === 'cli/codex';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create an `AdditionalArgsProvider` (SDK extension point, WI-20260703-001)
|
|
73
|
+
* that injects CrewX home as a Codex writable root for `workspace-write`
|
|
74
|
+
* equivalent modes (`agent`, `auto`, `undefined`).
|
|
75
|
+
*
|
|
76
|
+
* No-ops for:
|
|
77
|
+
* - Non-codex providers.
|
|
78
|
+
* - Modes in {@link NO_INJECT_MODES} (read-only/plan/agent-full-access/yolo/danger-full-access).
|
|
79
|
+
*/
|
|
80
|
+
function createCodexWritableRootsProvider(crewxHome = resolveCrewxHome()) {
|
|
81
|
+
return (ctx) => {
|
|
82
|
+
if (!isCodexProvider(ctx))
|
|
83
|
+
return [];
|
|
84
|
+
if (ctx.mode !== undefined && NO_INJECT_MODES.has(ctx.mode))
|
|
85
|
+
return [];
|
|
86
|
+
return buildCodexWritableRootArgs(crewxHome);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -10,6 +10,7 @@ const repository_1 = require("@crewx/sdk/repository");
|
|
|
10
10
|
const node_1 = require("@crewx/sdk/tools/node");
|
|
11
11
|
const server_conversation_plugin_js_1 = require("../domain/events/server-conversation.plugin.js");
|
|
12
12
|
const token_service_js_1 = require("../domain/token/token.service.js");
|
|
13
|
+
const codex_writable_roots_js_1 = require("./codex-writable-roots.js");
|
|
13
14
|
const SERVER_VERSION = (() => {
|
|
14
15
|
try {
|
|
15
16
|
const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../../package.json'), 'utf8'));
|
|
@@ -34,8 +35,14 @@ const SERVER_VERSION = (() => {
|
|
|
34
35
|
*
|
|
35
36
|
* workspaceRoot used by FileLoggerPlugin: directory of the yaml when present,
|
|
36
37
|
* otherwise process.cwd() so logs land in the launch directory.
|
|
38
|
+
*
|
|
39
|
+
* `additionalArgsProvider` defaults to `createCodexWritableRootsProvider()`
|
|
40
|
+
* (server-layer policy, WI-20260703-002-UI) so Codex agent/auto sessions can
|
|
41
|
+
* write into CrewX home even outside the workspace sandbox root. The same
|
|
42
|
+
* provider instance is threaded through the recursive `remoteFactory` call so
|
|
43
|
+
* file:// remote delegation inherits identical Codex sandbox behavior.
|
|
37
44
|
*/
|
|
38
|
-
async function createServerCrewx(configPath, bus) {
|
|
45
|
+
async function createServerCrewx(configPath, bus, additionalArgsProvider = (0, codex_writable_roots_js_1.createCodexWritableRootsProvider)()) {
|
|
39
46
|
let yamlPath;
|
|
40
47
|
let workspaceRoot;
|
|
41
48
|
if (configPath !== undefined) {
|
|
@@ -73,7 +80,8 @@ async function createServerCrewx(configPath, bus) {
|
|
|
73
80
|
handle.close();
|
|
74
81
|
}
|
|
75
82
|
const crewx = await sdk_1.Crewx.loadYaml(yamlPath, {
|
|
76
|
-
remoteFactory: (p) => createServerCrewx(p, bus),
|
|
83
|
+
remoteFactory: (p) => createServerCrewx(p, bus, additionalArgsProvider),
|
|
84
|
+
additionalArgsProvider,
|
|
77
85
|
});
|
|
78
86
|
(0, node_1.registerBuiltinTools)(crewx);
|
|
79
87
|
await crewx.use(new plugins_1.FileLoggerPlugin({ workspaceRoot, version: SERVER_VERSION }));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SkipRequestLog = exports.SKIP_REQUEST_LOG_KEY = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
exports.SKIP_REQUEST_LOG_KEY = 'skipRequestLog';
|
|
6
|
+
/** Mark a controller or handler to skip HTTP request logging. */
|
|
7
|
+
const SkipRequestLog = () => (0, common_1.SetMetadata)(exports.SKIP_REQUEST_LOG_KEY, true);
|
|
8
|
+
exports.SkipRequestLog = SkipRequestLog;
|
|
@@ -11,19 +11,23 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.HttpLoggingInterceptor = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
|
+
const core_1 = require("@nestjs/core");
|
|
14
15
|
const rxjs_1 = require("rxjs");
|
|
15
|
-
const
|
|
16
|
+
const node_crypto_1 = require("node:crypto");
|
|
16
17
|
const request_log_repository_js_1 = require("../../repository/request-log.repository.js");
|
|
18
|
+
const skip_request_log_decorator_js_1 = require("../decorator/skip-request-log.decorator.js");
|
|
17
19
|
const BATCH_SIZE = 500;
|
|
18
20
|
const FLUSH_INTERVAL_MS = 30_000;
|
|
19
21
|
/** Paths to skip logging (healthcheck endpoints) */
|
|
20
22
|
const SKIP_PATHS = new Set(['/health', '/healthz', '/ready', '/readiness', '/liveness']);
|
|
21
23
|
let HttpLoggingInterceptor = class HttpLoggingInterceptor {
|
|
22
24
|
repo;
|
|
25
|
+
reflector;
|
|
23
26
|
queue = [];
|
|
24
27
|
flushTimer;
|
|
25
|
-
constructor(repo) {
|
|
28
|
+
constructor(repo, reflector) {
|
|
26
29
|
this.repo = repo;
|
|
30
|
+
this.reflector = reflector;
|
|
27
31
|
this.flushTimer = setInterval(() => this.flush(), FLUSH_INTERVAL_MS);
|
|
28
32
|
}
|
|
29
33
|
intercept(context, next) {
|
|
@@ -33,6 +37,14 @@ let HttpLoggingInterceptor = class HttpLoggingInterceptor {
|
|
|
33
37
|
if (SKIP_PATHS.has(req.path)) {
|
|
34
38
|
return next.handle();
|
|
35
39
|
}
|
|
40
|
+
// Skip if @SkipRequestLog() decorator is applied to handler or controller class
|
|
41
|
+
const skipByDecorator = this.reflector.getAllAndOverride(skip_request_log_decorator_js_1.SKIP_REQUEST_LOG_KEY, [
|
|
42
|
+
context.getHandler(),
|
|
43
|
+
context.getClass(),
|
|
44
|
+
]);
|
|
45
|
+
if (skipByDecorator) {
|
|
46
|
+
return next.handle();
|
|
47
|
+
}
|
|
36
48
|
// Skip if X-Skip-Request-Log header is set
|
|
37
49
|
if (req.headers['x-skip-request-log'] === 'true') {
|
|
38
50
|
return next.handle();
|
|
@@ -55,7 +67,7 @@ let HttpLoggingInterceptor = class HttpLoggingInterceptor {
|
|
|
55
67
|
const statusCode = res.statusCode;
|
|
56
68
|
const now = new Date();
|
|
57
69
|
const entry = {
|
|
58
|
-
id: (0,
|
|
70
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
59
71
|
path: req.path,
|
|
60
72
|
method: req.method,
|
|
61
73
|
status_code: statusCode,
|
|
@@ -120,5 +132,6 @@ let HttpLoggingInterceptor = class HttpLoggingInterceptor {
|
|
|
120
132
|
exports.HttpLoggingInterceptor = HttpLoggingInterceptor;
|
|
121
133
|
exports.HttpLoggingInterceptor = HttpLoggingInterceptor = __decorate([
|
|
122
134
|
(0, common_1.Injectable)(),
|
|
123
|
-
__metadata("design:paramtypes", [request_log_repository_js_1.RequestLogRepository
|
|
135
|
+
__metadata("design:paramtypes", [request_log_repository_js_1.RequestLogRepository,
|
|
136
|
+
core_1.Reflector])
|
|
124
137
|
], HttpLoggingInterceptor);
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldSkipRawStdoutJsonFallback = shouldSkipRawStdoutJsonFallback;
|
|
4
|
+
/**
|
|
5
|
+
* Read-side defense against raw provider-protocol JSON leaking into task logs.
|
|
6
|
+
*
|
|
7
|
+
* When a stdout line parses as valid JSON but `parseStdoutEvent()` returns no
|
|
8
|
+
* displayable entries (e.g. a metadata-only event, or an event type the
|
|
9
|
+
* adapter recognizes but has nothing to show for), the caller falls back to
|
|
10
|
+
* rendering the raw line as `{ type: 'text', content: message }`. That raw
|
|
11
|
+
* fallback is correct for genuine plain-text stdout, but wrong for provider
|
|
12
|
+
* protocol JSON — showing the JSON envelope itself to users.
|
|
13
|
+
*
|
|
14
|
+
* `shouldSkipRawStdoutJsonFallback()` decides whether that fallback should be
|
|
15
|
+
* suppressed. It is intentionally NOT a "known type name" whitelist: matching
|
|
16
|
+
* only on `type` would risk swallowing plain-text/natural-language stdout
|
|
17
|
+
* that happens to be JSON-shaped with a `type` field (e.g. an
|
|
18
|
+
* `antigravity` provider that has no structured protocol at all, or a
|
|
19
|
+
* provider-unaware caller). Instead each provider's known event envelopes are
|
|
20
|
+
* checked structurally (the fields that provider actually emits for that
|
|
21
|
+
* event, per its CLI adapter), and only a genuine structural match is
|
|
22
|
+
* suppressed.
|
|
23
|
+
*
|
|
24
|
+
* Policy:
|
|
25
|
+
* - Invalid/truncated JSON never skips (JSON.parse throws → false). The raw
|
|
26
|
+
* text fallback must remain for partial/corrupted stdout.
|
|
27
|
+
* - If `providerId` is a known adapter key, that provider's envelope is
|
|
28
|
+
* checked (provider-aware). A confirmed provider may use a broader,
|
|
29
|
+
* provider-only structural marker (e.g. OpenCode's `sessionID`/`part`,
|
|
30
|
+
* present on every OpenCode event) so that *future* event type names the
|
|
31
|
+
* adapter doesn't parse yet are still recognized as protocol JSON, not
|
|
32
|
+
* raw text — this is what actually closes the WI-012 class of leak.
|
|
33
|
+
* - If `providerId` is absent (or not a recognized adapter key), only the
|
|
34
|
+
* narrow, specific known-type signatures are checked, and only when they
|
|
35
|
+
* structurally match ANY known provider's envelope — never skip on `type`
|
|
36
|
+
* name alone, and never use a provider-only generic marker (e.g. `part`)
|
|
37
|
+
* as a cross-provider signal (it is not unique enough without a confirmed
|
|
38
|
+
* providerId).
|
|
39
|
+
* - Plain-text providers (e.g. `antigravity`) have no structured protocol —
|
|
40
|
+
* registered explicitly to always return false so their (non-JSON, or
|
|
41
|
+
* incidentally JSON-shaped) stdout is never dropped.
|
|
42
|
+
*
|
|
43
|
+
* @see ThreadService.parseLogs / TaskService.parseLogs — shared by both to
|
|
44
|
+
* avoid re-drifting duplicates (WI-20260704-016).
|
|
45
|
+
*/
|
|
46
|
+
function shouldSkipRawStdoutJsonFallback(message, providerId) {
|
|
47
|
+
const trimmed = message.trimStart();
|
|
48
|
+
if (!trimmed.startsWith('{'))
|
|
49
|
+
return false;
|
|
50
|
+
let obj;
|
|
51
|
+
try {
|
|
52
|
+
obj = JSON.parse(trimmed);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
const type = obj.type;
|
|
58
|
+
if (typeof type !== 'string')
|
|
59
|
+
return false;
|
|
60
|
+
const matcher = providerId ? PROVIDER_AWARE_MATCHERS[providerId] : undefined;
|
|
61
|
+
if (matcher)
|
|
62
|
+
return matcher(obj, type);
|
|
63
|
+
// providerId absent, or not a recognized adapter key: require a structural
|
|
64
|
+
// match against ANY known provider's *specific* envelope signatures
|
|
65
|
+
// (never skip on type name alone, never use a provider-only generic marker).
|
|
66
|
+
return Object.values(STRICT_ENVELOPE_MATCHERS).some((fn) => fn(obj, type));
|
|
67
|
+
}
|
|
68
|
+
function isPlainObject(value) {
|
|
69
|
+
return typeof value === 'object' && value !== null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Claude Code CLI stream-json protocol.
|
|
73
|
+
* @see packages/sdk/src/provider/cli/adapters/claude.ts
|
|
74
|
+
*/
|
|
75
|
+
function isClaudeEnvelope(obj, type) {
|
|
76
|
+
if (type === 'assistant' || type === 'user') {
|
|
77
|
+
const message = obj.message;
|
|
78
|
+
return isPlainObject(message) && Array.isArray(message.content);
|
|
79
|
+
}
|
|
80
|
+
if (type === 'system') {
|
|
81
|
+
// Claude's init/system event: { type: 'system', subtype: 'init', session_id, ... }
|
|
82
|
+
return typeof obj.subtype === 'string' || typeof obj.session_id === 'string';
|
|
83
|
+
}
|
|
84
|
+
if (type === 'result') {
|
|
85
|
+
return (typeof obj.result === 'string'
|
|
86
|
+
|| isPlainObject(obj.usage)
|
|
87
|
+
|| typeof obj['total_cost_usd'] === 'number'
|
|
88
|
+
|| typeof obj.is_error === 'boolean');
|
|
89
|
+
}
|
|
90
|
+
if (type === 'rate_limit_event') {
|
|
91
|
+
return isPlainObject(obj.rate_limit_info);
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* OpenAI Codex CLI JSON protocol.
|
|
97
|
+
* @see packages/sdk/src/provider/cli/adapters/codex.ts
|
|
98
|
+
*/
|
|
99
|
+
function isCodexEnvelope(obj, type) {
|
|
100
|
+
// item.updated is a transient progress notification with no displayable
|
|
101
|
+
// payload contract — always metadata-only regardless of `item` shape.
|
|
102
|
+
if (type === 'item.updated')
|
|
103
|
+
return true;
|
|
104
|
+
// thread.*/turn.* is Codex's own namespace for turn/thread lifecycle
|
|
105
|
+
// events; any event under this namespace is a protocol envelope, current
|
|
106
|
+
// or future, not raw stdout text.
|
|
107
|
+
if (type.startsWith('thread.') || type.startsWith('turn.'))
|
|
108
|
+
return true;
|
|
109
|
+
if (type === 'item.started' || type === 'item.completed') {
|
|
110
|
+
const item = obj.item;
|
|
111
|
+
return isPlainObject(item) && typeof item.type === 'string';
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* OpenCode CLI `--format json` protocol — strict variant.
|
|
117
|
+
* Used when providerId is absent/unrecognized: only the specific known
|
|
118
|
+
* event types are matched, each requiring its own structural field.
|
|
119
|
+
* @see packages/sdk/src/provider/cli/adapters/opencode.ts
|
|
120
|
+
*/
|
|
121
|
+
function isOpenCodeEnvelopeStrict(obj, type) {
|
|
122
|
+
if (type === 'step_start' || type === 'step_finish') {
|
|
123
|
+
return (typeof obj.stepID === 'string'
|
|
124
|
+
|| typeof obj.sessionID === 'string'
|
|
125
|
+
|| isPlainObject(obj.part));
|
|
126
|
+
}
|
|
127
|
+
if (type === 'text' || type === 'tool_use') {
|
|
128
|
+
return isPlainObject(obj.part);
|
|
129
|
+
}
|
|
130
|
+
if (type === 'result') {
|
|
131
|
+
return typeof obj.result === 'string';
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* OpenCode CLI `--format json` protocol — permissive variant.
|
|
137
|
+
* Used only once providerId is confirmed 'opencode'. OpenCode puts a
|
|
138
|
+
* `sessionID`/`stepID`/`part` marker on every event it emits, so any type —
|
|
139
|
+
* including ones the current adapter doesn't parse yet — is recognized as
|
|
140
|
+
* OpenCode protocol JSON, not raw stdout text.
|
|
141
|
+
*/
|
|
142
|
+
function isOpenCodeEnvelopePermissive(obj, type) {
|
|
143
|
+
if (typeof obj.stepID === 'string')
|
|
144
|
+
return true;
|
|
145
|
+
if (typeof obj.sessionID === 'string')
|
|
146
|
+
return true;
|
|
147
|
+
if (isPlainObject(obj.part))
|
|
148
|
+
return true;
|
|
149
|
+
if (type === 'result' && typeof obj.result === 'string')
|
|
150
|
+
return true;
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* GitHub Copilot CLI protocol.
|
|
155
|
+
* @see packages/sdk/src/provider/cli/adapters/copilot.ts
|
|
156
|
+
*/
|
|
157
|
+
function isCopilotEnvelope(obj, type) {
|
|
158
|
+
// assistant.*/tool.execution*/user.message is Copilot's own event
|
|
159
|
+
// namespace (mirrors the adapter's own parseEvent gate) — any event under
|
|
160
|
+
// it, current or future, carries a `data` payload object.
|
|
161
|
+
if (type.startsWith('assistant.') || type.startsWith('tool.execution') || type === 'user.message') {
|
|
162
|
+
return isPlainObject(obj.data);
|
|
163
|
+
}
|
|
164
|
+
if (type === 'result') {
|
|
165
|
+
return typeof obj.result === 'string';
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Gemini CLI protocol (deprecated, parse-only for historical logs).
|
|
171
|
+
* @see packages/sdk/src/provider/cli/adapters/gemini.ts
|
|
172
|
+
*/
|
|
173
|
+
function isGeminiEnvelope(obj, type) {
|
|
174
|
+
if (type === 'message') {
|
|
175
|
+
return typeof obj.role === 'string';
|
|
176
|
+
}
|
|
177
|
+
if (type === 'tool_use') {
|
|
178
|
+
return typeof obj.tool_name === 'string' || typeof obj.tool_id === 'string';
|
|
179
|
+
}
|
|
180
|
+
if (type === 'tool_result') {
|
|
181
|
+
return typeof obj.tool_id === 'string' || typeof obj.status === 'string';
|
|
182
|
+
}
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
/** Used when providerId is absent/unrecognized: narrow, specific-type signatures only. */
|
|
186
|
+
const STRICT_ENVELOPE_MATCHERS = {
|
|
187
|
+
claude: isClaudeEnvelope,
|
|
188
|
+
codex: isCodexEnvelope,
|
|
189
|
+
opencode: isOpenCodeEnvelopeStrict,
|
|
190
|
+
copilot: isCopilotEnvelope,
|
|
191
|
+
gemini: isGeminiEnvelope,
|
|
192
|
+
};
|
|
193
|
+
/** Used when providerId is confirmed: allows provider-only generic markers. */
|
|
194
|
+
const PROVIDER_AWARE_MATCHERS = {
|
|
195
|
+
...STRICT_ENVELOPE_MATCHERS,
|
|
196
|
+
opencode: isOpenCodeEnvelopePermissive,
|
|
197
|
+
// Plain-text provider — no structured stdout protocol at all. Never skip,
|
|
198
|
+
// even if its (non-JSON) stdout happens to be JSON-shaped.
|
|
199
|
+
antigravity: () => false,
|
|
200
|
+
};
|
|
@@ -19,6 +19,7 @@ const agent_service_js_1 = require("./agent.service.js");
|
|
|
19
19
|
const create_agent_dto_js_1 = require("./dto/create-agent.dto.js");
|
|
20
20
|
const update_agent_dto_js_1 = require("./dto/update-agent.dto.js");
|
|
21
21
|
const preview_prompt_dto_js_1 = require("./dto/preview-prompt.dto.js");
|
|
22
|
+
const reorder_agents_dto_js_1 = require("./dto/reorder-agents.dto.js");
|
|
22
23
|
let AgentController = class AgentController {
|
|
23
24
|
agentService;
|
|
24
25
|
constructor(agentService) {
|
|
@@ -49,6 +50,11 @@ let AgentController = class AgentController {
|
|
|
49
50
|
this.agentService.deleteAgent(id);
|
|
50
51
|
return { success: true };
|
|
51
52
|
}
|
|
53
|
+
// PATCH /api/v1/agents/reorder — reorder agents and optionally move them across teams
|
|
54
|
+
reorderAgents(dto) {
|
|
55
|
+
const data = this.agentService.reorderAgents(dto);
|
|
56
|
+
return { success: true, data };
|
|
57
|
+
}
|
|
52
58
|
};
|
|
53
59
|
exports.AgentController = AgentController;
|
|
54
60
|
__decorate([
|
|
@@ -89,6 +95,14 @@ __decorate([
|
|
|
89
95
|
__metadata("design:paramtypes", [String]),
|
|
90
96
|
__metadata("design:returntype", void 0)
|
|
91
97
|
], AgentController.prototype, "deleteAgent", null);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, swagger_1.ApiOperation)({ operationId: 'AGT.REORDER', summary: 'Reorder agents' }),
|
|
100
|
+
(0, common_1.Patch)('reorder'),
|
|
101
|
+
__param(0, (0, common_1.Body)()),
|
|
102
|
+
__metadata("design:type", Function),
|
|
103
|
+
__metadata("design:paramtypes", [reorder_agents_dto_js_1.ReorderAgentsDto]),
|
|
104
|
+
__metadata("design:returntype", void 0)
|
|
105
|
+
], AgentController.prototype, "reorderAgents", null);
|
|
92
106
|
exports.AgentController = AgentController = __decorate([
|
|
93
107
|
(0, swagger_1.ApiTags)('agents'),
|
|
94
108
|
(0, common_1.Controller)('ws/:slug/agents'),
|