@picoflow/ezgraph 0.0.6 → 0.0.8

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.
Files changed (60) hide show
  1. package/README.md +247 -86
  2. package/dist/framework/base-graph.js +1 -1
  3. package/dist/framework/conversation-node.js +1 -1
  4. package/dist/framework/conversation-runner.js +1 -1
  5. package/dist/framework/decision/decision-node.js +1 -0
  6. package/dist/framework/decision/decision-provider.js +1 -0
  7. package/dist/framework/decision/decision-runner.js +1 -0
  8. package/dist/framework/decision/decision-types.js +1 -0
  9. package/dist/framework/decision/decision-validation.js +1 -0
  10. package/dist/framework/decision/typesafe-provider.js +1 -0
  11. package/dist/framework/graph-engine.js +1 -1
  12. package/dist/framework/graph-node.js +1 -1
  13. package/dist/framework/graph-state.js +1 -1
  14. package/dist/framework/langchain-llm-gateway.js +1 -1
  15. package/dist/framework/langchain-provider.adapter.js +1 -1
  16. package/dist/framework/node-invocation.js +1 -0
  17. package/dist/framework/node-outcome.js +1 -1
  18. package/dist/framework/node-state.js +1 -1
  19. package/dist/framework/persistence/session-manager.js +1 -1
  20. package/dist/framework/session-log.js +1 -1
  21. package/dist/framework/state-graph-ext.js +1 -1
  22. package/dist/framework/tool-response.js +1 -0
  23. package/dist/index.js +1 -1
  24. package/dist/testing/scripted-decisions.js +1 -0
  25. package/dist/testing/turn-harness.js +1 -1
  26. package/dist/testing.js +1 -1
  27. package/dist/types/npmlib/src/index.d.ts +11 -5
  28. package/dist/types/npmlib/src/testing.d.ts +1 -0
  29. package/dist/types/src/framework/base-graph.d.ts +28 -14
  30. package/dist/types/src/framework/conversation-node.d.ts +9 -15
  31. package/dist/types/src/framework/conversation-runner.d.ts +9 -9
  32. package/dist/types/src/framework/decision/decision-node.d.ts +17 -0
  33. package/dist/types/src/framework/decision/decision-provider.d.ts +14 -0
  34. package/dist/types/src/framework/decision/decision-runner.d.ts +18 -0
  35. package/dist/types/src/framework/decision/decision-types.d.ts +126 -0
  36. package/dist/types/src/framework/decision/decision-validation.d.ts +4 -0
  37. package/dist/types/src/framework/decision/typesafe-provider.d.ts +12 -0
  38. package/dist/types/src/framework/graph-engine.d.ts +4 -0
  39. package/dist/types/src/framework/graph-llm.config.d.ts +3 -3
  40. package/dist/types/src/framework/graph-node.d.ts +51 -36
  41. package/dist/types/src/framework/graph-registry.d.ts +10 -5
  42. package/dist/types/src/framework/graph-state-support.d.ts +1 -1
  43. package/dist/types/src/framework/graph-state.d.ts +6 -5
  44. package/dist/types/src/framework/langchain-provider.adapter.d.ts +2 -2
  45. package/dist/types/src/framework/llm-gateway.d.ts +4 -4
  46. package/dist/types/src/framework/model-stop-reason.d.ts +2 -2
  47. package/dist/types/src/framework/node-invocation.d.ts +12 -0
  48. package/dist/types/src/framework/node-outcome.d.ts +3 -32
  49. package/dist/types/src/framework/node-state.d.ts +3 -2
  50. package/dist/types/src/framework/openai-auth-provider.d.ts +1 -1
  51. package/dist/types/src/framework/persistence/session-manager.d.ts +4 -0
  52. package/dist/types/src/framework/session-log.d.ts +30 -0
  53. package/dist/types/src/framework/state-graph-ext.d.ts +4 -10
  54. package/dist/types/src/framework/token-usage.d.ts +2 -2
  55. package/dist/types/src/framework/tool-response.d.ts +29 -0
  56. package/dist/types/src/testing/scripted-decisions.d.ts +24 -0
  57. package/dist/types/src/testing/turn-harness.d.ts +2 -0
  58. package/package.json +11 -7
  59. package/dist/framework/conversation-tool-result.js +0 -1
  60. package/dist/types/src/framework/conversation-tool-result.d.ts +0 -19
@@ -1 +1 @@
1
- const Ge=g;(function(n,p){const Gi={n:0xc3,p:0xc6,H:0xaf,u:0xc1,v:0xdf},GG=g,H=n();while(!![]){try{const u=parseInt(GG(0xae))/0x1+-parseInt(GG(0xcb))/0x2+-parseInt(GG(Gi.n))/0x3+-parseInt(GG(Gi.p))/0x4*(parseInt(GG(0xa2))/0x5)+-parseInt(GG(0xa8))/0x6+parseInt(GG(Gi.H))/0x7*(-parseInt(GG(Gi.u))/0x8)+-parseInt(GG(0xac))/0x9*(-parseInt(GG(Gi.v))/0xa);if(u===p)break;else H['push'](H['shift']());}catch(v){H['push'](H['shift']());}}}(e,0xf2844));var E=Object[Ge(0xc2)],S=(n,p)=>E(n,'name',{'value':p,'configurable':!0x0});import{HumanMessage as X}from'@langchain/core/messages';import{randomUUID as a}from'node:crypto';import{GraphRegistry as U,registeredGraphId as i,registeredGraphSchemaVersion as c}from'./graph-registry.js';import{LangChainLlmGateway as q}from'./langchain-llm-gateway.js';import{SessionLogError as f,createSessionLogs as o,withSessionLogs as Y}from'./session-log.js';import{withTurnContext as Z}from'./turn-context.js';import{SessionManager as m,SessionTurnError as J,SESSION_BUSY as Q,SESSION_COMPLETED as s}from'./persistence/session-manager.js';import{parseJsonObjectResponse as K}from'./json-response.js';function e(){const GH=['y29UzMLN','jYbPCYbHBhjLywr5ihbYB2nLC3nPBMCGysb0DxjUlG','CMvSzwfZzvr1CM4','z2v0r3jHCgHZ','ANnVBLjLC3vSDa','nw11DKf1tG','y29Kzq','D2L0Afr1CM5ty29Wzq','C2vZC2LVBNm','CMvXDwLYzxnvC2vYtwvZC2fNzq','BwvZC2fNzq','ndm3ntCYofzVD1f3vW','ChjLCgfYzuLUChv0','CMvZCg9UC2u','BMfTzxm','mti3otm2oeX2vKDczq','z3jHCgHZ','mZu2nZLVr01ys0y','mtrWy2vUAfm','Aw5MBgLNAhrtzxnZAw9UCW','vw5HyMXLihrVihbLCNnPC3qGC2vZC2LVBIbLCNjVCIbSB2C6','CMvZCg9UC2vnB2rL','r3jHCgHfBMDPBMu','oYbLEhbLy3rLzca','BwfW','ANnVBG','y29TCgXLDgvK','CMvNAxn0zxjhCMfWAa','yMvNAw5uDxjU','y29UzMXPy3rszxn1Bhq','ywrK','C2LNBMfS','zgvSzxrLu2vZC2LVBG','ChjVDMLKzxjZ','AgfZ','jYbYzxn0B3jLihjLDhvYBMvKihnJAgvTysb2zxjZAw9Uia','nJy3nJmYofLive1rvq','zgvMAw5LuhjVCgvYDhK','mJe1mZa4nxPurxPQzW','BgXTr2f0zxDHEuzHy3rVCNK','y3jLyxrL','nJm4oty2ogXJD0jKuq','y2HHDfjLC3vSDa','zw5KrMfPBgvKvhvYBG','y29UzMLNtwfUywDLCG','BgXTq29UzMLN','mZCYntGXme1UC25pAa','z3jHCgHoyw1L','DMfSAwrHDgvtzxnZAw9Uswq','y29TCgXLDgvKu2vZC2LVBLjLC3vSDa','z3jHCgG','CMvNAxn0CNK','CMvNAxn0zxi','CMvZDg9YzvnLC3nPB25eB2m','r3jHCgGGjW','z2v0u2vZC2LVBG','y2XVC2u','zg9JDw1LBNq','zxjYB3i','DhjPBq','C2f2zvn0yxrL','CNvU','jYbPCYbUB3qGCMvNAxn0zxjLzc4','C3rYAw5N','BM9Kzxm','C2nOzw1HvMvYC2LVBG','ntmWs0Diq1vn','Aw52B2TL','C2vZC2LVBK1HBMfNzxi','CMvZDg9YzvnLC3nPB25eB2n1BwvUDa','u2vZC2LVBIaN','z2v0r3jHCgHezwzPBML0Aw9U','zgvSzxrL','CgvYC2LZDe1Pz3jHDgvKu2vZC2LVBG','DxnLCK1LC3nHz2u','DxnLCK1LC3nHz2uGBxvZDcbIzsbHig5VBI1LBxb0EsbZDhjPBMCU','C2vZC2LVBKLK'];e=function(){return GH;};return e();}function g(G,j){G=G-0x95;const S=e();let C=S[G];if(g['bNAqUg']===undefined){var E=function(F){const U='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let w='',i='';for(let c=0x0,q,f,o=0x0;f=F['charAt'](o++);~f&&(q=c%0x4?q*0x40+f:f,c++%0x4)?w+=String['fromCharCode'](0xff&q>>(-0x2*c&0x6)):0x0){f=U['indexOf'](f);}for(let Y=0x0,R=w['length'];Y<R;Y++){i+='%'+('00'+w['charCodeAt'](Y)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(i);};g['DQckiz']=E,g['gfuxCv']={},g['bNAqUg']=!![];}const X=S[0x0],a=G+X,N=g['gfuxCv'][a];return!N?(C=g['DQckiz'](C),g['gfuxCv'][a]=C):C=N,C;}class R{static{S(this,Ge(0xb3));}[Ge(0xd0)]=new U();['sessions'];[Ge(0xc4)];[Ge(0xb0)]=new Set();constructor(n={}){const Gc={n:0xe1,p:0xb8},Gj=Ge;this['sessions']=n[Gj(Gc.n)]??new m(),this[Gj(0xc4)]=n['llmGatewayFactory']??(p=>new q(p,n['providers']?{'providers':n[Gj(0xbe)]}:{})),this[Gj(Gc.p)](n[Gj(0xad)]??[]);}static async[Ge(0xc5)](n={}){const Gq={n:0xc4,p:0xad},GS=Ge,p=await m['fromConfig'](n[GS(0xc9)]);return new R({'sessionManager':p,...n[GS(0xc4)]?{'llmGatewayFactory':n[GS(Gq.n)]}:{},...n[GS(Gq.p)]?{'graphs':n[GS(Gq.p)]}:{},...n['providers']?{'providers':n['providers']}:{}});}[Ge(0xb8)](n){const Gf={n:0xd0,p:0xd1},GC=Ge,p=n[GC(0xb5)](H=>new H(this[GC(0xc4)](H[GC(0x97)]()[GC(0xca)])));return this[GC(Gf.n)][GC(Gf.p)](p),this;}[Ge(0xa0)](){const Gg=Ge;return this[Gg(0xd0)][Gg(0xab)]();}['getSession'](n){const GY={n:0xd4},GE=Ge;return this[GE(0xa5)][GE(GY.n)](w(n));}async[Ge(0xda)](n){const GZ={n:0xd3,p:0x9b,H:0x9c,u:0xb0,v:0xbf,t:0xba,B:0x96,r:0x9e,z:0xbc},GR={n:0xdd,p:0xcf,H:0xde,u:0xcf,v:0xc0,t:0xde,B:0xde,r:0xa5,z:0xb7,h:0xb2,d:0xcf,l:0xa5,y:0xba,P:0xa3,A:0xa7,k:0xc8,W:0xd7,G0:0xb0},GX=Ge,H=this['registry']['get'](n['graphName']);if(!H)return{'status':0x190,'body':{'success':!0x1,'completed':!0x0,'message':GX(GZ.n)+(n[GX(0xcc)]??'')+GX(0xdb)}};const B=typeof n[GX(0x9a)]==GX(0xdc)?n[GX(0x9a)][GX(0xd8)]():void 0x0;if(H[GX(0xa6)]!==!0x1&&!B)return{'status':0x190,'body':{'success':!0x1,'completed':!0x1,'message':GX(GZ.p)}};let z;try{z=n[GX(GZ.H)]?w(n['sessionId']):a();}catch(A){return{'status':0x190,'body':{'success':!0x1,'completed':!0x1,'message':A instanceof Error?A[GX(0xa7)]:String(A)}};}const h=i(H),d=c(H),l={'graphId':h,'graphSchemaVersion':d,'llmConfig':H[GX(0xca)]},y=o();if(this[GX(GZ.u)][GX(GZ.v)](z))return this[GX(GZ.t)](z,Q,GX(GZ.B)+z+GX(GZ.r));this['inflightSessions'][GX(0xbb)](z);const P={'session':z,...n[GX(GZ.z)]===void 0x0?{}:{'signal':n['signal']}};return this[GX(0xa4)](P,y,async()=>{const Ga=GX;let k=!0x0,W,G0;try{const G1=a(),G2=await this[Ga(0xa5)][Ga(0xb9)](z,G1,l);W=G1,G0=G2['expectedRevision'];const G3=G2[Ga(0xd6)]['graph'][Ga(GR.n)]?G2[Ga(0xd6)]:void 0x0;G3&&G3[Ga(GR.p)][Ga(GR.H)]!==d&&(k=!0x1);const G4=G3?H[Ga(0xd2)]?await H[Ga(0xd2)](G3):G3:void 0x0;if(G4&&G4[Ga(GR.u)][Ga(0xde)]!==d)throw new Error(Ga(0xd3)+h+Ga(GR.v)+G4[Ga(0xcf)][Ga(GR.t)]+Ga(0xb4)+d+'.');G3&&G4&&G4['graph'][Ga(0xde)]!==G3[Ga(GR.u)][Ga(GR.B)]&&await this[Ga(0xa5)][Ga(0x99)](G4,{'owner':G1,'expectedRevision':G0}),k=!0x0;const G5=G4?this[Ga(GR.r)][Ga(0x95)](G4,h):void 0x0;if(G5?.[Ga(GR.z)])return await this['sessions'][Ga(0x9f)](z,G1,G0),this[Ga(0xce)](H[Ga(GR.h)],z);const G6=await H[Ga(GR.d)][Ga(0xe0)]({...B?H[Ga(0xa9)](G5,new X(B)):G5??{},'config':{...G5?.[Ga(0x9d)]??{},...n[Ga(0x9d)]??{}},'inputConsumed':!0x1,'response':''});return await this[Ga(GR.l)][Ga(0xd9)](z,G6,l,y,{'owner':G1,'expectedRevision':G0}),H['responseMode']==='json'?this['jsonResult'](z,G6[Ga(0xaa)]):this['chatResult'](z,G6['response'],G6['completed']);}catch(G7){if(G7 instanceof J)return this[Ga(GR.y)](z,G7[Ga(GR.P)],G7[Ga(GR.A)]);const G8=G7 instanceof Error?G7[Ga(0xa7)]:String(G7);if(f({'chat_service':G8}),W)try{await this['sessions'][Ga(GR.k)](z,W,l,k?y:void 0x0,G0);}catch(G9){console[Ga(GR.W)](Ga(0xb1),G9);}return{'status':0x190,'session':z,'body':{'success':!0x1,'completed':!0x1,'message':G8,'session':z}};}finally{this[Ga(GR.G0)][Ga(0x98)](z);}});}[Ge(0xa4)](n,p,H){return Z(n,()=>Y(p,H));}async[Ge(0xbd)](n){const GI={n:0xbd},GN=Ge;if(!n)return{'status':0x190,'body':{'success':!0x1,'message':'SESSION_ID\x20is\x20required.'}};try{const p=w(n);return await this[GN(0xa5)][GN(GI.n)](p),{'status':0xc8,'body':{'success':!0x0,'session':p}};}catch(H){return{'status':0x190,'body':{'success':!0x1,'session':n,'message':H instanceof Error?H[GN(0xa7)]:String(H)}};}}async[Ge(0xd5)](){const GF=Ge;await this[GF(0xa5)]['close']();}[Ge(0xba)](n,p,H){return{'status':0x199,'session':n,'body':{'success':!0x1,'completed':!0x1,'message':H,'code':p,'session':n}};}[Ge(0xce)](n,p){const Gs={n:0xc7},GU=Ge,H='This\x20conversation\x20is\x20already\x20complete.';return n===GU(0xb6)?this['conflictResult'](p,s,H):this[GU(Gs.n)](p,H,!0x0);}[Ge(0xa1)](n,p){return{'status':0xc8,'session':n,'contentType':'application/json','body':K(p)};}[Ge(0xc7)](n,p,H){return{'status':0xc8,'session':n,'body':{'success':!0x0,'completed':H,'message':p,'bot':p,'session':n}};}}function w(n){const Gp={n:0xd8},Gw=Ge,p=n[Gw(Gp.n)]();if(!/^[A-Za-z0-9_-]{1,128}$/['test'](p))throw new Error('SESSION_ID\x20must\x20be\x201-128\x20letters,\x20numbers,\x20underscores,\x20or\x20hyphens.');return p;}S(w,Ge(0xcd));export{R as GraphEngine};
1
+ const Kc=e;(function(d,X){const KQ={d:0xe0,X:0xdb,T:0xc1,g:0xb4},Kh=e,T=d();while(!![]){try{const g=parseInt(Kh(0xa0))/0x1+parseInt(Kh(KQ.d))/0x2+parseInt(Kh(KQ.X))/0x3+parseInt(Kh(KQ.T))/0x4+-parseInt(Kh(0xce))/0x5+parseInt(Kh(0xd6))/0x6+parseInt(Kh(KQ.g))/0x7*(-parseInt(Kh(0xa3))/0x8);if(g===X)break;else T['push'](T['shift']());}catch(p){T['push'](T['shift']());}}}(K,0x8258d));var P=Object['defineProperty'],y=(d,X)=>P(d,Kc(0xc5),{'value':X,'configurable':!0x0});import{HumanMessage as I}from'@langchain/core/messages';function K(){const KR=['z2v0','jYbJB21WBgv0zwqGD2L0Ag91DcbWCM9KDwnPBMCGC3rHDguU','C2f2zvn0yxrL','zgvSzxrLu2vZC2LVBG','mtmZyKPmquzc','C2LNBMfS','yxbWBgLJyxrPB24VANnVBG','zg9JDw1LBNq','y2HHDfjLC3vSDa','CNvU','z3jHCgG','u0vtu0LptL9jrcbPCYbYzxf1AxjLzc4','ANnVBG','jYbYzxn0B3jLihjLDhvYBMvKihnJAgvTysb2zxjZAw9Uia','BwfW','CMvZDg9YzvnLC3nPB25eB2n1BwvUDa','z3jHCgHZ','mti2mZCWmhbWs2TtCq','y29UzMLN','C3rYAw5N','CMvZCg9UC2vnB2rL','BMfTzq','CMvSzwfZzvr1CM4','DxnLCK1LC3nHz2uGBxvZDcbIzsbHig5VBI1LBxb0EsbZDhjPBMCU','C2vZC2LVBK1HBMfNzxi','BM9Kzxm','y3jLyxrL','CMvZCg9UC2u','jYbPCYbUB3qGCMvNAxn0zxjLzc4','ChjLCgfYzuLUChv0','ntG5nda1y0DYtxje','zgvJAxnPB25qCM92AwrLCNm','yxr0ywnOrgvJAxnPB25qCM92AwrLCLjLC29SDMvY','DgvZDa','C2vZC2LVBKLK','C3rYzwfT','y29UzMXPy3rszxn1Bhq','ChjVDMLKzxjZ','mJK0odeYnhbwwMLgBq','Aw52B2TL','CMvXDwLYzxnvC2vYtwvZC2fNzq','zxHWzwn0zwrszxzPC2LVBG','y29Kzq','mtu3otGZmgfArvHPzG','ANnVBLjLC3vSDa','DxnLCK1LC3nHz2u','CMvNAxn0zxjhCMfWAa','zgvSzxrL','mtiWnJCYnfHLC1jRra','CMvNAxn0CNK','Aw5MBgLNAhrtzxnZAw9UCW','BgXTq29UzMLN','z3jHCgHoyw1L','z2v0u2vZC2LVBG','Aw5WDxrdB25ZDw1Lza','CMvZB2X2zq','D2L0Afr1CM5ty29Wzq','vw5HyMXLihrVihbLCNnPC3qGC2vZC2LVBIbLCNjVCIbSB2C6','oYbLEhbLy3rLzca','r3jHCgGGjW','zxjYB3i','z2v0r3jHCgHezwzPBML0Aw9U','C2vZC2LVBNm','odGXodyXqKPzvuvt','y29TCgXLDgvK','zNjVBunVBMzPzW','oteYntyWuwjHww5m','BgXTr2f0zxDHEuzHy3rVCNK','u2vZC2LVBIaN','jYbPCYbHBhjLywr5ihbYB2nLC3nPBMCGysb0DxjUlG','DMfSAwrHDgvtzxnZAw9Uswq','C2nOzw1HvMvYC2LVBG','CMvZDg9YzvnLC3nPB25eB2m','z2v0r3jHCgHZ','DhjPBq','yMvNAw5uDxjU','y2XVC2u','y29TCgXLDgvKu2vZC2LVBLjLC3vSDa','BwvZC2fNzq'];K=function(){return KR;};return K();}function e(j,C){j=j-0x9d;const I=K();let J=I[j];if(e['pjzpNm']===undefined){var F=function(c){const s='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let P='',n='';for(let o=0x0,z,H,t=0x0;H=c['charAt'](t++);~H&&(z=o%0x4?z*0x40+H:H,o++%0x4)?P+=String['fromCharCode'](0xff&z>>(-0x2*o&0x6)):0x0){H=s['indexOf'](H);}for(let E=0x0,q=P['length'];E<q;E++){n+='%'+('00'+P['charCodeAt'](E)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(n);};e['bOrkSb']=F,e['wJSDQu']={},e['pjzpNm']=!![];}const V=I[0x0],m=j+V,h=e['wJSDQu'][m];return!h?(J=e['bOrkSb'](J),e['wJSDQu'][m]=J):J=h,J;}import{randomUUID as J}from'node:crypto';import{GraphRegistry as m,registeredGraphId as h,registeredGraphSchemaVersion as c}from'./graph-registry.js';import{LangChainLlmGateway as s}from'./langchain-llm-gateway.js';import{SessionLogError as n,createSessionLogs as o,drainSessionLogs as t,restoreSessionLogs as D,withSessionLogs as Q}from'./session-log.js';import{withTurnContext as Z}from'./turn-context.js';import{SessionManager as b,SessionTurnError as u,SESSION_BUSY as r,SESSION_COMPLETED as S}from'./persistence/session-manager.js';import{parseJsonObjectResponse as f}from'./json-response.js';import{DecisionProviderRegistry as v}from'./decision/decision-provider.js';class M{static{y(this,'GraphEngine');}[Kc(0xe1)]=new m();[Kc(0x9f)];[Kc(0xa4)];['decisionProviders'];[Kc(0xe2)]=new Set();constructor(d={}){const KZ={d:0xc8,X:0xcf,T:0xcf,g:0xa4,p:0xde},Ks=Kc;this[Ks(0x9f)]=d[Ks(KZ.d)]??new b(),this[Ks(KZ.X)]=new v(d[Ks(KZ.T)]??[]),this['llmGatewayFactory']=d[Ks(KZ.g)]??(X=>new s(X,d[Ks(0xd5)]?{'providers':d[Ks(0xd5)]}:{})),this[Ks(KZ.p)](d['graphs']??[]);}static async[Kc(0xca)](d={}){const KO={d:0xc0,X:0xc0,T:0xd5,g:0xcf},KP=Kc,X=await b[KP(0xa2)](d['configManager']);return new M({'sessionManager':X,...d['llmGatewayFactory']?{'llmGatewayFactory':d[KP(0xa4)]}:{},...d[KP(KO.d)]?{'graphs':d[KP(KO.X)]}:{},...d[KP(KO.T)]?{'providers':d[KP(0xd5)]}:{},...d[KP(KO.g)]?{'decisionProviders':d['decisionProviders']}:{}});}[Kc(0xde)](d){const Ku={d:0xbe},Kb={d:0x9e,X:0xd0},Kn=Kc,X=d[Kn(Ku.d)](T=>{const Ko=Kn,g=new T(this[Ko(0xa4)](T[Ko(Kb.d)]()[Ko(0xe3)]));return g[Ko(Kb.X)]?.(p=>this['decisionProviders'][Ko(0xe7)](p)),g[Ko(0xba)],g;});return this[Kn(0xe1)]['register'](X),this;}[Kc(0xaa)](){return this['registry']['names']();}[Kc(0xe5)](d){const KA={d:0x9f},Kz=Kc;return this[Kz(KA.d)]['getSession'](w(d));}async[Kc(0xb9)](X){const Kr={d:0xcc,X:0xdd,T:0xab,g:0xa5,p:0xa6,a:0xe2,G:0xb5},Kx={d:0x9f,X:0xac,T:0xb7,g:0xba,p:0xa9,a:0xa9,G:0xa8,W:0xeb,Y:0xa8,L:0xea,i:0x9f,l:0xc4,K0:0xc2,K1:0xba,K2:0xba,K3:0xd7,K4:0xb1,K5:0xbc,K6:0xa1,K7:0xda,K8:0x9d,K9:0xe9,KK:0xdf},KH=Kc,T=this[KH(0xe1)][KH(0xb0)](X[KH(0xe4)]);if(!T)return{'status':0x190,'body':{'success':!0x1,'completed':!0x0,'message':'Graph\x20\x27'+(X['graphName']??'')+KH(Kr.d)}};const p=typeof X[KH(Kr.X)]==KH(0xc3)?X['userMessage'][KH(Kr.T)]():void 0x0;if(T[KH(0xd8)]!==!0x1&&!p)return{'status':0x190,'body':{'success':!0x1,'completed':!0x1,'message':KH(0xc7)}};let a;try{a=X[KH(0xd2)]?w(X['sessionId']):J();}catch(K0){return{'status':0x190,'body':{'success':!0x1,'completed':!0x1,'message':K0 instanceof Error?K0[KH(0xaf)]:String(K0)}};}const G=h(T),W=c(T),Y={'graphId':G,'graphSchemaVersion':W,'llmConfig':T['llmConfig']},L=o();if(this['inflightSessions']['has'](a))return this[KH(0xd4)](a,r,KH(Kr.g)+a+KH(Kr.p));this[KH(Kr.a)]['add'](a);const i={'session':a,...X[KH(0xb5)]===void 0x0?{}:{'signal':X[KH(Kr.G)]}};return this['withTurnScope'](i,L,async()=>{const Kt=KH;let K1=!0x0,K2,K3;try{const K4=J(),K5=await this[Kt(Kx.d)][Kt(Kx.X)](a,K4,Y);K2=K4,K3=K5[Kt(0xd9)];const K6=K5[Kt(Kx.T)][Kt(Kx.g)][Kt(0xc9)]?K5[Kt(0xb7)]:void 0x0;K6&&K6[Kt(0xba)][Kt(0xa8)]!==W&&(K1=!0x1);const K7=K6?T[Kt(Kx.p)]?await T[Kt(Kx.a)](K6):K6:void 0x0;if(K7&&K7[Kt(0xba)][Kt(Kx.G)]!==W)throw new Error(Kt(Kx.W)+G+Kt(0xbd)+K7[Kt(0xba)][Kt(Kx.Y)]+Kt(Kx.L)+W+'.');K6&&K7&&K7['graph'][Kt(0xa8)]!==K6[Kt(0xba)][Kt(Kx.G)]&&await this[Kt(Kx.d)]['persistMigratedSession'](K7,{'owner':K4,'expectedRevision':K3}),K1=!0x0;const K8=K7?this[Kt(Kx.d)][Kt(0xbf)](K7,G):void 0x0;if(K8?.[Kt(0xa1)])return await this[Kt(Kx.i)][Kt(0xc6)](a,K4,K3),this[Kt(0xae)](T[Kt(Kx.l)],a);const K9={...p?T[Kt(0xcd)](K8,new I(p)):K8??{},'config':{...K8?.[Kt(Kx.K0)]??{},...X[Kt(0xc2)]??{}},'inputConsumed':!0x1,'response':''};let KK;if(T['graph'][Kt(0xd3)]){const Ke=await T[Kt(Kx.K1)][Kt(0xd3)](K9,{'streamMode':'values'});for await(const Kj of Ke){if(KK=Kj,KK[Kt(0xe6)]!==!0x0)continue;const KC=t(L);let KI;try{KI=await this['sessions']['saveState'](a,KK,Y,KC,{'owner':K4,...K3===void 0x0?{}:{'expectedRevision':K3},'keepTurn':!0x0});}catch(KJ){throw D(L,KC),KJ;}K3=KI['revision'];}}else KK=await T[Kt(Kx.K2)][Kt(Kx.K3)](K9);if(!KK)throw new Error('Graph\x20\x27'+G+Kt(Kx.K4));return await this[Kt(Kx.d)][Kt(0xb2)](a,KK,Y,L,{'owner':K4,...K3===void 0x0?{}:{'expectedRevision':K3}}),T[Kt(0xc4)]===Kt(Kx.K5)?this[Kt(0xdc)](a,KK[Kt(0xcb)]):this['chatResult'](a,KK[Kt(0xcb)],KK[Kt(Kx.K6)]);}catch(KF){if(KF instanceof u)return this['conflictResult'](a,KF[Kt(Kx.K7)],KF['message']);const KV=KF instanceof Error?KF['message']:String(KF);if(n({'chat_service':KV}),K2)try{await this[Kt(0x9f)]['endFailedTurn'](a,K2,Y,K1?L:void 0x0,K3);}catch(Km){console[Kt(Kx.K8)](Kt(Kx.K9),Km);}return{'status':0x190,'session':a,'body':{'success':!0x1,'completed':!0x1,'message':KV,'session':a}};}finally{this['inflightSessions'][Kt(Kx.KK)](a);}});}[Kc(0xe8)](d,X,T){return Z(d,()=>Q(X,T));}async[Kc(0xb3)](d){const Kf={d:0xbb},KE=Kc;if(!d)return{'status':0x190,'body':{'success':!0x1,'message':KE(Kf.d)}};try{const X=w(d);return await this['sessions'][KE(0xb3)](X),{'status':0xc8,'body':{'success':!0x0,'session':X}};}catch(T){return{'status':0x190,'body':{'success':!0x1,'session':d,'message':T instanceof Error?T[KE(0xaf)]:String(T)}};}}async[Kc(0xad)](){const Kk=Kc;await this[Kk(0x9f)][Kk(0xad)]();}['conflictResult'](d,X,T){return{'status':0x199,'session':d,'body':{'success':!0x1,'completed':!0x1,'message':T,'code':X,'session':d}};}[Kc(0xae)](d,X){const Ky={d:0xd4},Kq=Kc,T='This\x20conversation\x20is\x20already\x20complete.';return d===Kq(0xbc)?this[Kq(Ky.d)](X,S,T):this['chatResult'](X,T,!0x0);}[Kc(0xdc)](d,X){const KD=Kc;return{'status':0xc8,'session':d,'contentType':KD(0xb6),'body':f(X)};}[Kc(0xb8)](d,X,T){return{'status':0xc8,'session':d,'body':{'success':!0x0,'completed':T,'message':X,'bot':X,'session':d}};}}function w(d){const KN={d:0xd1},KM=Kc,X=d[KM(0xab)]();if(!/^[A-Za-z0-9_-]{1,128}$/[KM(KN.d)](X))throw new Error('SESSION_ID\x20must\x20be\x201-128\x20letters,\x20numbers,\x20underscores,\x20or\x20hyphens.');return X;}y(w,Kc(0xa7));export{M as GraphEngine};
@@ -1 +1 @@
1
- var v=Object.defineProperty;var n=(s,e)=>v(s,"name",{value:e,configurable:!0});import"reflect-metadata";import{AIMessage as f,HumanMessage as N}from"@langchain/core/messages";import{END as d}from"@langchain/langgraph";import{GraphLlm as m}from"./graph-llm.config.js";import{GraphStateSupport as C}from"./graph-state-support.js";import{ConversationRunner as T,DEFAULT_CONVERSATION_POLICY as O,DEFAULT_MAX_AGENT_ROUNDS as E,EmptyModelResponseError as A}from"./conversation-runner.js";import{currentTurnSignal as L}from"./turn-context.js";import{createConversationToolResult as H,resolveConversationToolResult as M}from"./conversation-tool-result.js";import{createNodeOutcomeBuilder as U,forwardedHistoryUpdate as $,preserveOutcomeRouteTarget as _}from"./node-outcome.js";import{parseJsonObjectResponse as y}from"./json-response.js";import{stableClassId as p}from"./stable-id.js";import{SessionLogWarning as G}from"./session-log.js";import{GRAPH_NODE_LOCAL_STATE as oe}from"./node-outcome.js";const P=Symbol("GRAPH_NODE_CLASS"),g=Symbol("graph-node-tool-handlers");function Q(s){if(!s.trim())throw new Error("A tool handler requires a tool name.");return(e,t)=>{const o=Reflect.getOwnMetadata(g,e)??[];if(o.some(r=>r.toolName===s))throw new Error(`Tool '${s}' already has a handler.`);o.push({toolName:s,methodName:t}),Reflect.defineMetadata(g,o,e)}}n(Q,"Tool");class R{static{n(this,"GraphNode")}llmGateway;runtime;static[P]=!0;static id(){return this.name}supportsAutomaticOutcomeRouting=!1;name;id;constructor(e,t){this.llmGateway=e,this.runtime=t;const o=new.target;this.name=o.name,this.id=p(o,"graph node")}defineTool(){return[]}getLlmConfig(){return{}}route(e){throw new Error(`Graph node '${this.id}' does not define a branch route.`)}async handleTool(e,t,o){const r=this.toolHandler(t.name);if(!r)return this.rejectToolCall(t.name,`Unsupported tool '${t.name}'.`);const i=this.runtime.requireTool(r.toolName),l=b(t.args);if(!l.ok)return this.rejectToolCall(r.toolName,l.error);const a=i.schema.safeParse(l.value);if(!a.success)return this.rejectToolCall(r.toolName,J(a.error));const u=a.data,h=this[r.methodName];if(!h)throw new Error(`Tool '${r.toolName}' is decorated on missing method '${String(r.methodName)}'.`);const c=await h.call(this,u,o,e);return M(c,o)}rejectToolCall(e,t){return G({tool_call:t,node:this.id,tool:e}),{output:{accepted:!1,error:t}}}onInvalidJsonResponse(e){throw e.error}onEmptyModelResponse(e){throw new A(e.reason)}invoke=n(async e=>{const t=await this.run(e),o=await this.resolveJsonResponse(e,t),r=this.runtime.resolveLlmConfig(this.getLlmConfig()),i=x(r,this.runtime.resolveLlmConfig()),l=(e.nodes??{})[this.id];if(i&&l?.model===void 0)return o;const a=this.runtime.saveNode(this.id,{model:i?void 0:m.modelMetadata(r)}),u=o.nodes??{},h=a.nodes??{};return _(o,{...o,nodes:{...u,[this.id]:{...u[this.id]??{},...h[this.id]??{}}}})},"invoke");obtainTools(){return this.toolHandlers().map(({toolName:e})=>this.runtime.requireTool(e)).sort((e,t)=>e.name==="terminate_session"?1:t.name==="terminate_session"?-1:0)}validateTools(){this.obtainTools()}llmConfig(){return this.runtime.resolveLlmConfig(this.getLlmConfig())}llmCallOptions(){return this.runtime.llmCallOptions()}async runConversation(e,t){const o=await this.runAgentLoop(e,t);if(!o.stopReason)return o;const r=await this.onEmptyModelResponse({state:e,conversation:o,reason:o.stopReason});return{...o,response:r}}runAgentLoop(e,t){return new T(this.llmGateway).run({systemPrompt:this.getPrompt(e),history:this.history(e),tools:this.obtainTools(),llmConfig:this.llmConfig(),executeTool:n(o=>this.handleTool(e,o,t),"executeTool"),maxAgentRounds:this.runtime.maxAgentRounds,emptyHistorySeed:this.runtime.conversationPolicy.emptyHistorySeed,emptyResponseRecovery:this.runtime.conversationPolicy.emptyResponseRecovery,callOptions:this.llmCallOptions()})}toolResult(e){return H(e)}historySpace(){return this.runtime.historySpace(this.id)}history(e){return e.histories[this.historySpace()]??[]}historyUpdate(e){return{histories:{[this.historySpace()]:e}}}respond(e){return{...this.runtime.respond(e),...this.historyUpdate([new f(e)])}}complete(e){return{...this.runtime.complete(e),...this.historyUpdate([new f(e)])}}stay(e,t=e.response){const o=w(this.id,"stay",t);return this.outcomeBuilder({currentNode:this.id,...this.runtime.respond(o),...this.historyUpdate(S(e,o)),tokens:e.usage},void 0,d)}resumeAt(e,t){const o=p(e,"graph node");return this.outcomeBuilder({currentNode:o,inputConsumed:!0,response:"",...this.historyUpdate(t.messages),tokens:t.usage},void 0,d)}advance(e,t){return this.transition(e,t,!0)}transition(e,t,o){const r=p(e,"graph node"),i={currentNode:r,inputConsumed:!0,response:"",...this.historyUpdate(t.messages),tokens:t.usage};return o?this.outcomeBuilder(i,(l,a)=>{const u=this.historySpace(),h=[...l.histories[u]??[]].reverse().find(c=>N.isInstance(c));return $({sourceSpace:u,targetSpace:this.runtime.historySpace(r),...h?{latestInput:h}:{},...a?{fallbackMessage:a}:{}})},e):this.outcomeBuilder(i,void 0,e)}finish(e,t){const o=w(this.id,"finish",e);return this.outcomeBuilder({...this.runtime.complete(o),...this.historyUpdate(S(t,o)),tokens:t.usage},void 0,d)}state(e){return e.nodes[this.id]??{}}save(e){return this.runtime.saveNode(this.id,e)}remove(...e){return this.runtime.removeNode(this.id,...e)}outcomeBuilder(e,t,o=d){return U({update:{...e,outcomeRoute:typeof o=="string"?o:p(o,"graph node")},nodeName:this.id,saveNode:n((r,i)=>this.runtime.saveNode(r,i),"saveNode"),routeTarget:o,...t?{forwardInput:t}:{}})}toolHandler(e){return this.toolHandlers().find(t=>t.toolName===e)}async resolveJsonResponse(e,t){if(!this.runtime.expectsJsonResponse()||t.completed!==!0)return t;try{return y(t.response??""),t}catch(o){const r=await this.onInvalidJsonResponse({state:e,update:t,response:t.response??"",error:o instanceof Error?o:new Error(String(o))});return(r.completed===!0||r.response)&&y(r.response??""),r}}toolHandlers(){let e=Object.getPrototypeOf(this);const t=[];for(;e&&e!==R.prototype;){const r=Reflect.getOwnMetadata(g,e)??[];t.push(...r),e=Object.getPrototypeOf(e)}const o=new Set;for(const r of t){if(o.has(r.toolName))throw new Error(`Graph node '${this.id}' has more than one handler for tool '${r.toolName}'.`);o.add(r.toolName)}return t}}function w(s,e,t){if(!t?.trim())throw new Error(`Graph node '${s}' cannot ${e} without an assistant response.`);return t}n(w,"requireOutcomeResponse");function S(s,e){return s.response===e?s.messages:[...s.messages,new f(e)]}n(S,"conversationMessagesWithResponse");function x(s,e){return s.model===e.model&&JSON.stringify(m.parameters(s))===JSON.stringify(m.parameters(e))}n(x,"sameLlmConfig");class Z extends C{static{n(this,"GraphNodeRuntime")}defaultLlmConfig;historySpaces;initialHistorySpace;responseMode;maxAgentRounds;conversationPolicy;tools=new Map;constructor(e,t,o={},r="default",i="chat",l=E,a=O){super(e),this.defaultLlmConfig=t,this.historySpaces=o,this.initialHistorySpace=r,this.responseMode=i,this.maxAgentRounds=l,this.conversationPolicy=a}llmCallOptions(){const{llmTimeoutMs:e}=this.conversationPolicy,t=L();return{...e===void 0?{}:{timeoutMs:e},...t===void 0?{}:{signal:t}}}expectsJsonResponse(){return this.responseMode==="json"}historySpace(e){return e?this.historySpaces[e]??this.initialHistorySpace:this.initialHistorySpace}resolveLlmConfig(e={}){return m.resolveConfig(this.defaultLlmConfig,e)}registerTools(e,t){for(const o of t){const r=this.tools.get(o.name);if(r)throw new Error(`Tool '${o.name}' is defined by both '${r.owner}' and '${e}'.`);this.tools.set(o.name,{definition:o,owner:e})}}requireTool(e){const t=this.tools.get(e);if(!t)throw new Error(`Tool '${e}' is not defined in this graph.`);return t.definition}input(e){return this.latestInput({messages:e.histories[this.historySpace(e.currentNode)]??[]})}respond(e){return this.responseUpdate(e)}complete(e){return this.endUpdate(e)}saveNode(e,t){return this.saveState(e,t)}removeNode(e,...t){return this.removeState(e,...t)}}function b(s){if(typeof s!="string")return{ok:!0,value:s};try{return{ok:!0,value:JSON.parse(s)}}catch(e){return{ok:!1,error:`Tool arguments were not valid JSON: ${e instanceof Error?e.message:String(e)}`}}}n(b,"coerceToolArgs");function J(s){return s.issues.map(e=>e.path.length>0?`${e.path.join(".")}: ${e.message}`:e.message).join("; ")}n(J,"formatToolArgumentError");export{P as GRAPH_NODE_CLASS,oe as GRAPH_NODE_LOCAL_STATE,R as GraphNode,Z as GraphNodeRuntime,Q as Tool};
1
+ var E=Object.defineProperty;var i=(n,e)=>E(n,"name",{value:e,configurable:!0});import"reflect-metadata";import{AIMessage as p,HumanMessage as R}from"@langchain/core/messages";import{Command as c,END as u,isCommand as w}from"@langchain/langgraph";import{GraphLlm as m}from"./graph-llm.config.js";import{GraphStateSupport as T}from"./graph-state-support.js";import{ConversationRunner as O,DEFAULT_CONVERSATION_POLICY as H,DEFAULT_MAX_AGENT_ROUNDS as $,EmptyModelResponseError as A}from"./conversation-runner.js";import{currentTurnSignal as b}from"./turn-context.js";import{combineGraphNodeUpdates as G}from"./node-outcome.js";import{parseJsonObjectResponse as S}from"./json-response.js";import{stableClassId as f}from"./stable-id.js";import{SessionLogWarning as k}from"./session-log.js";import{isToolResponse as N,stay as L}from"./tool-response.js";import{invocationGraphState as I,hasNodeInvocation as M,invocationHistory as P,invocationNodeState as _,invocationUpdate as D,appendInvocationHistory as U,replaceInvocationNodeState as j,saveInvocationNodeState as x,withNodeInvocation as J}from"./node-invocation.js";import{DecisionConfigurationError as q,resolveDecisionOptions as F}from"./decision/decision-types.js";import{GRAPH_NODE_LOCAL_STATE as fe}from"./node-outcome.js";const z=Symbol("GRAPH_NODE_CLASS"),g=Symbol("graph-node-tool-handlers");function ce(n){if(!n.trim())throw new Error("A tool handler requires a tool name.");return(e,t)=>{const o=Reflect.getOwnMetadata(g,e)??[];if(o.some(r=>r.toolName===n))throw new Error(`Tool '${n}' already has a handler.`);o.push({toolName:n,methodName:t}),Reflect.defineMetadata(g,o,e)}}i(ce,"Tool");class C{static{i(this,"GraphNode")}llmGateway;runtime;static[z]=!0;static id(){return this.name}name;id;constructor(e,t){this.llmGateway=e,this.runtime=t;const o=new.target;this.name=o.name,this.id=f(o,"graph node")}get graph(){return this.runtime}defineTool(){return[]}getLlmConfig(){return{}}route(e){throw new Error(`Graph node '${this.id}' does not define a branch route.`)}async handleTool(e,t,o){const r=this.toolHandler(t.name);if(!r)return this.rejectToolCall(t.name,`Unsupported tool '${t.name}'.`);const d=this.runtime.requireTool(r.toolName),s=X(t.args);if(!s.ok)return this.rejectToolCall(r.toolName,s.error);const a=d.schema.safeParse(s.value);if(!a.success)return this.rejectToolCall(r.toolName,Y(a.error));const h=a.data,l=this[r.methodName];if(!l)throw new Error(`Tool '${r.toolName}' is decorated on missing method '${String(r.methodName)}'.`);const v=await l.call(this,h,o,e);if(N(v))return v;throw new Error(`Tool '${r.toolName}' on '${this.id}' must return a ToolResponse.`)}rejectToolCall(e,t){return k({tool_call:t,node:this.id,tool:e}),L(JSON.stringify({accepted:!1,error:t}))}usesChatModel(){return!0}onInvalidJsonResponse(e){throw e.error}onEmptyModelResponse(e){throw new A(e.reason)}invoke=i(e=>this.runtime.withInvocation(this.id,e,async()=>{const t=this.resolveNodeResponse(await this.run(e)),o=W(t),r=await this.resolveJsonResponse(e,o);if(this.runtime.stageNodeEntries(r.nodes),this.usesChatModel()){const s=this.runtime.resolveLlmConfig(this.getLlmConfig()),a=V(s,this.runtime.resolveLlmConfig()),h=(e.nodes??{})[this.id];(!a||h?.model!==void 0)&&this.runtime.saveNode(this.id,{model:a?void 0:m.modelMetadata(s)})}const d=G(r,this.runtime.stagedUpdate());return w(t)?new c({update:d,...t.goto===void 0?{}:{goto:t.goto},...t.graph===void 0?{}:{graph:t.graph},...t.resume===void 0?{}:{resume:t.resume}}):d}),"invoke");obtainTools(){return this.toolHandlers().map(({toolName:e})=>this.runtime.requireTool(e)).sort((e,t)=>e.name==="terminate_session"?1:t.name==="terminate_session"?-1:0)}validateTools(){this.obtainTools()}llmConfig(){return this.runtime.resolveLlmConfig(this.getLlmConfig())}llmCallOptions(){return this.runtime.llmCallOptions()}async runConversation(e,t){const o=await this.runAgentLoop(e,t);if(!o.stopReason)return o;const r=await this.onEmptyModelResponse({state:e,conversation:o,reason:o.stopReason});return{...o,response:r}}runAgentLoop(e,t){return new O(this.llmGateway).run({systemPrompt:this.getPrompt(e),history:this.history(e),tools:this.obtainTools(),llmConfig:this.llmConfig(),executeTool:i(o=>this.handleTool(e,o,t),"executeTool"),maxAgentRounds:this.runtime.maxAgentRounds,emptyHistorySeed:this.runtime.conversationPolicy.emptyHistorySeed,emptyResponseRecovery:this.runtime.conversationPolicy.emptyResponseRecovery,callOptions:this.llmCallOptions()})}historySpace(){return this.runtime.historySpace(this.id)}history(e){return this.runtime.hasInvocation()?this.runtime.invocationHistory(this.historySpace()):e.histories[this.historySpace()]??[]}historyUpdate(e){return{histories:{[this.historySpace()]:e}}}respond(e){return{...this.runtime.respond(e),...this.historyUpdate([new p(e)])}}complete(e){return{...this.runtime.complete(e),...this.historyUpdate([new p(e)])}}resolveNodeResponse(e){if(!N(e))return e;if(e.kind==="stay")throw new Error(`Graph node '${this.id}' can only return stay() from a tool handler.`);if(e.cleanup)throw new Error(`Graph node '${this.id}' can only use withCleanup() from a tool handler.`);if(e.feedback!==void 0)throw new Error(`Graph node '${this.id}' can only use withToolFeedback() from a tool handler.`);if(e.messages&&this.graph.appendHistory(this.historySpace(),e.messages),e.kind==="go"||e.kind==="directTo"){if(!e.target)throw new Error(`Graph node '${this.id}' selected ${e.kind}() without a target.`);const t=f(e.target,"graph node"),o=this.graph.historySpace(t);if(e.state&&this.graph.saveNodeState(e.target,e.state),e.message&&this.graph.appendHistory(o,[e.message]),e.kind==="directTo"){const r=y(this.id,e);return this.graph.appendHistory(o,[new p(r)]),new c({update:{currentNode:t,response:r,inputConsumed:!0,completed:!1,...e.usage===void 0?{}:{tokens:e.usage}},goto:u})}return new c({update:{currentNode:t,response:"",inputConsumed:!0,completed:!1,...e.usage===void 0?{}:{tokens:e.usage}},goto:t})}if(e.message)throw new Error(`Graph node '${this.id}' can only use withMessage() with go() or directTo().`);if(e.kind==="direct"){const t=y(this.id,e);return this.graph.appendHistory(this.historySpace(),[new p(t)]),new c({update:{currentNode:this.id,response:t,inputConsumed:!0,completed:!1,...e.usage===void 0?{}:{tokens:e.usage}},goto:u})}if(e.kind==="finish"){const t=y(this.id,e);return this.graph.appendHistory(this.historySpace(),[new p(t)]),new c({update:{...this.graph.complete(t),...e.usage===void 0?{}:{tokens:e.usage}},goto:u})}throw new Error(`Graph node '${this.id}' returned an unsupported response kind '${e.kind}'.`)}state(e){return this.runtime.hasInvocation()?this.runtime.nodeState(this.id):e.nodes[this.id]??{}}getState(){return this.runtime.nodeState(this.id)}saveState(e){this.runtime.saveNode(this.id,e)}save(e){return this.runtime.saveNode(this.id,e)}remove(...e){return this.runtime.removeNode(this.id,...e)}toolHandler(e){return this.toolHandlers().find(t=>t.toolName===e)}async resolveJsonResponse(e,t){if(!this.runtime.expectsJsonResponse()||t.completed!==!0)return t;try{return S(t.response??""),t}catch(o){const r=await this.onInvalidJsonResponse({state:e,update:t,response:t.response??"",error:o instanceof Error?o:new Error(String(o))});return(r.completed===!0||r.response)&&S(r.response??""),r}}toolHandlers(){let e=Object.getPrototypeOf(this);const t=[];for(;e&&e!==C.prototype;){const r=Reflect.getOwnMetadata(g,e)??[];t.push(...r),e=Object.getPrototypeOf(e)}const o=new Set;for(const r of t){if(o.has(r.toolName))throw new Error(`Graph node '${this.id}' has more than one handler for tool '${r.toolName}'.`);o.add(r.toolName)}return t}}function V(n,e){return n.model===e.model&&JSON.stringify(m.parameters(n))===JSON.stringify(m.parameters(e))}i(V,"sameLlmConfig");class le extends T{static{i(this,"GraphNodeRuntime")}defaultLlmConfig;historySpaces;initialHistorySpace;responseMode;maxAgentRounds;conversationPolicy;decisionOptions;decisionErrorHandler;tools=new Map;constructor(e,t,o={},r="default",d="chat",s=$,a=H,h={},l){super(e),this.defaultLlmConfig=t,this.historySpaces=o,this.initialHistorySpace=r,this.responseMode=d,this.maxAgentRounds=s,this.conversationPolicy=a,this.decisionOptions=h,this.decisionErrorHandler=l}llmCallOptions(){const{llmTimeoutMs:e}=this.conversationPolicy,t=b();return{...e===void 0?{}:{timeoutMs:e},...t===void 0?{}:{signal:t}}}expectsJsonResponse(){return this.responseMode==="json"}historySpace(e){return e?this.historySpaces[e]??this.initialHistorySpace:this.initialHistorySpace}resolveLlmConfig(e={}){return m.resolveConfig(this.defaultLlmConfig,e)}resolveDecisionOptions(e={}){return F(this.decisionOptions,e)}decisionProviderResolver;attachDecisionProviderResolver(e){this.decisionProviderResolver=e}resolveDecisionProvider(e){if(!this.decisionProviderResolver)throw new q(`Decision provider '${e}' cannot be resolved before the graph is attached to an engine.`);return this.decisionProviderResolver(e)}async handleDecisionError(e){return await this.decisionErrorHandler?.(e)??null}registerTools(e,t){for(const o of t){const r=this.tools.get(o.name);if(r)throw new Error(`Tool '${o.name}' is defined by both '${r.owner}' and '${e}'.`);this.tools.set(o.name,{definition:o,owner:e})}}requireTool(e){const t=this.tools.get(e);if(!t)throw new Error(`Tool '${e}' is not defined in this graph.`);return t.definition}input(e){return this.latestInput({messages:e.histories[this.historySpace(e.currentNode)]??[]})}getConversation(e){const o=(this.hasInvocation()?this.invocationHistory(e):[]).filter(r=>R.isInstance(r)&&r.additional_kwargs?.ezgraphInternal!==!0).map(r=>typeof r.content=="string"?r.content:JSON.stringify(r.content));return{request:o.at(-1)??"",priorRequests:o.slice(-5,-1)}}respond(e){return this.responseUpdate(e)}complete(e){return this.endUpdate(e)}withInvocation(e,t,o){return J(this,e,t,o)}nodeState(e){return _(this,e)}hasInvocation(){return M(this)}graphState(){return I(this)}appendHistory(e,t){U(this,e,t)}invocationHistory(e){return P(this,e)}stagedUpdate(){return D(this)}stageNodeEntries(e){for(const[t,o]of Object.entries(e??{}))!o||typeof o!="object"||Array.isArray(o)||j(this,t,o)}saveNode(e,t){return x(this,e,t),{nodes:{[e]:this.nodeState(e)}}}saveNodeState(e,t){this.saveNode(f(e,"graph node"),t)}removeNode(e,...t){return this.saveNode(e,Object.fromEntries(t.map(o=>[o,void 0])))}}function W(n){if(!w(n))return n;if(Array.isArray(n.update))throw new Error("GraphNode Command updates must be state objects.");return n.update??{}}i(W,"commandUpdate");function y(n,e){if(!e.response?.trim())throw new Error(`Graph node '${n}' selected ${e.kind}() without a response.`);return e.response}i(y,"requireNodeResponse");function X(n){if(typeof n!="string")return{ok:!0,value:n};try{return{ok:!0,value:JSON.parse(n)}}catch(e){return{ok:!1,error:`Tool arguments were not valid JSON: ${e instanceof Error?e.message:String(e)}`}}}i(X,"coerceToolArgs");function Y(n){return n.issues.map(e=>e.path.length>0?`${e.path.join(".")}: ${e.message}`:e.message).join("; ")}i(Y,"formatToolArgumentError");export{z as GRAPH_NODE_CLASS,fe as GRAPH_NODE_LOCAL_STATE,C as GraphNode,le as GraphNodeRuntime,ce as Tool};
@@ -1 +1 @@
1
- var c=Object.defineProperty;var e=(n,u)=>c(n,"name",{value:u,configurable:!0});import{Annotation as o,messagesStateReducer as s}from"@langchain/langgraph";import{mergeNodeStates as a}from"./node-state.js";import{addTokenUsage as f,emptyTokenUsage as m}from"./token-usage.js";const R="end";function k(n,u){return o.Root({histories:o({reducer:e((t,r)=>i(t??{},r??{}),"reducer"),default:e(()=>({}),"default")}),currentNode:o({reducer:e((t,r)=>r,"reducer"),default:e(()=>n,"default")}),config:o({reducer:e((t,r)=>({...t,...r}),"reducer"),default:e(()=>({}),"default")}),nodes:o({reducer:a,default:e(()=>u?u():{},"default")}),tokens:o({reducer:f,default:m}),inputConsumed:o({reducer:e((t,r)=>r,"reducer"),default:e(()=>!1,"default")}),response:o({reducer:e((t,r)=>r,"reducer"),default:e(()=>"","default")}),completed:o({reducer:e((t,r)=>r,"reducer"),default:e(()=>!1,"default")}),outcomeRoute:o({reducer:e((t,r)=>r,"reducer"),default:e(()=>{},"default")})})}e(k,"createGraphStateAnnotation");function i(n,u){const t={...n};for(const[r,d]of Object.entries(u))t[r]=s(t[r]??[],d);return t}e(i,"mergeHistories");export{R as GRAPH_END_NODE,k as createGraphStateAnnotation};
1
+ var u=Object.defineProperty;var e=(d,n)=>u(d,"name",{value:n,configurable:!0});import{Annotation as o,messagesStateReducer as c}from"@langchain/langgraph";import{replaceNodeStates as a}from"./node-state.js";import{addTokenUsage as f,emptyTokenUsage as i}from"./token-usage.js";import{addDecisionUsage as m,emptyDecisionUsage as p}from"./decision/decision-types.js";const A="end";function N(d,n){return o.Root({histories:o({reducer:e((t,r)=>l(t??{},r??{}),"reducer"),default:e(()=>({}),"default")}),currentNode:o({reducer:e((t,r)=>r,"reducer"),default:e(()=>d,"default")}),config:o({reducer:e((t,r)=>({...t,...r}),"reducer"),default:e(()=>({}),"default")}),nodes:o({reducer:a,default:e(()=>n?n():{},"default")}),tokens:o({reducer:f,default:i}),decisionUsage:o({reducer:m,default:p}),inputConsumed:o({reducer:e((t,r)=>r,"reducer"),default:e(()=>!1,"default")}),response:o({reducer:e((t,r)=>r,"reducer"),default:e(()=>"","default")}),completed:o({reducer:e((t,r)=>r,"reducer"),default:e(()=>!1,"default")})})}e(N,"createGraphStateAnnotation");function l(d,n){const t={...d};for(const[r,s]of Object.entries(n))t[r]=c(t[r]??[],s);return t}e(l,"mergeHistories");export{A as GRAPH_END_NODE,N as createGraphStateAnnotation};
@@ -1 +1 @@
1
- var M=Object.defineProperty;var p=(c,n)=>M(c,"name",{value:n,configurable:!0});import{HumanMessage as f,SystemMessage as h}from"@langchain/core/messages";import{initChatModel as k}from"langchain";import{assertLlmTimeoutMs as S}from"./llm-gateway.js";import{GraphLlm as m}from"./graph-llm.config.js";import{langChainModelInitialization as x}from"./langchain-provider.adapter.js";import{validateModelProviderAdapters as A}from"./model-provider.js";import{SessionLogWarning as T}from"./session-log.js";import{modelExecution as u,tokenUsageFromMessage as l}from"./token-usage.js";import{isOpenAIAuthConfig as w,openAIAuthMessageText as v}from"./openai-auth-provider.js";class K{static{p(this,"LangChainLlmGateway")}models=new Map;llmConfig;providers;constructor(n,e={}){this.llmConfig=m.validateConfig(n),this.providers=e.providers??[],A(this.providers)}async generate(n,e,o=this.llmConfig,i){const t=await this.invoke(o,i,async s=>(await this.getModel(o)).invoke([new h(n),new f(e)],s));return{value:w(o)?v(t.content):typeof t.content=="string"?t.content:JSON.stringify(t.content),usage:l(t),execution:u(o)}}async structured(n,e,o,i,t=this.llmConfig,s,a){const r=await this.invoke(t,a,async d=>(await this.getModel(t)).withStructuredOutput(n,{name:i,method:"functionCalling",includeRaw:!0}).invoke(this.messages(e,s,o),d));return{value:r.parsed,usage:l(r.raw),execution:u(t)}}async respond(n,e,o=this.llmConfig,i){const t=await this.invoke(o,i,async s=>(await this.getModel(o)).invoke([new h(n),...e],s));return{value:w(o)?v(t.content):typeof t.content=="string"?t.content:JSON.stringify(t.content),usage:l(t),execution:u(o)}}async agent(n,e,o,i=this.llmConfig,t){const s=await this.invoke(i,t,async a=>y(await this.getModel(i),o,i.params.forceToolCalls).invoke([new h(n),...e],a));return{value:s,usage:l(s),execution:u(i)}}async toolCall(n,e,o,i=this.llmConfig,t,s){const a=await this.invoke(i,s,async d=>y(await this.getModel(i),o,i.params.forceToolCalls).invoke(this.messages(n,t,e),d)),r=a.tool_calls?.[0];return{value:r?{name:r.name,args:r.args}:void 0,usage:l(a),execution:u(i)}}messages(n,e,o){return[new h(n),...e??[],new f(o)]}getModel(n){const e=x(n,this.providers),o=e.cacheKey??JSON.stringify({model:e.model,options:e.options}),i=this.models.get(o);if(i)return i;const t=k(e.model,e.options).then(s=>(m.validateProfile(n,s.profile),s));return this.models.set(o,t),t}async invoke(n,e,o){const i=e?.timeoutMs===void 0?void 0:S(e.timeoutMs),t=i===void 0?void 0:AbortSignal.timeout(i),s=[e?.signal,t].filter(r=>r!==void 0),a=s.length>1?AbortSignal.any(s):s[0];try{return await o(a?{signal:a}:void 0)}catch(r){const d=t?.aborted===!0&&e?.signal?.aborted!==!0,g=d?`Model call for '${m.modelIdentifier(n)}' exceeded its ${String(i)} ms timeout.`:r instanceof Error?r.message:String(r);throw T({llm_call:g,model:m.modelIdentifier(n)}),d?new Error(g,{cause:r}):r}}}function y(c,n,e=!1){if(n.length>0&&c.profile.toolCalling===!1)throw new Error("The selected model profile reports that tool calling is unsupported.");if(e&&c.profile.toolChoice===!1)throw new Error("The selected model profile reports that tool choice is unsupported.");return c.bindTools(n,e?{tool_choice:"any"}:void 0)}p(y,"bindTools");export{K as LangChainLlmGateway};
1
+ var k=Object.defineProperty;var g=(l,o)=>k(l,"name",{value:o,configurable:!0});import{HumanMessage as w,SystemMessage as h}from"@langchain/core/messages";import{initChatModel as x}from"langchain";import{assertLlmTimeoutMs as S}from"./llm-gateway.js";import{GraphLlm as m}from"./graph-llm.config.js";import{langChainModelInitialization as T}from"./langchain-provider.adapter.js";import{validateModelProviderAdapters as b}from"./model-provider.js";import{SessionLogWarning as A}from"./session-log.js";import{modelExecution as d,tokenUsageFromMessage as u}from"./token-usage.js";import{isOpenAIAuthConfig as v,openAIAuthMessageText as y}from"./openai-auth-provider.js";class K{static{g(this,"LangChainLlmGateway")}models=new Map;llmConfig;providers;constructor(o,e={}){this.llmConfig=m.validateConfig(o),this.providers=e.providers??[],b(this.providers)}async generate(o,e,n=this.llmConfig,i){const t=await this.invoke(n,i,async s=>(await this.getModel(n)).invoke([new h(o),new w(e)],s));return{value:v(n)?y(t.content):typeof t.content=="string"?t.content:JSON.stringify(t.content),usage:u(t),execution:d(n)}}async structured(o,e,n,i,t=this.llmConfig,s,a){const c=await this.invoke(t,a,async r=>(await this.getModel(t)).withStructuredOutput(o,{name:i,method:"functionCalling",includeRaw:!0}).invoke(this.messages(e,s,n),r));return{value:c.parsed,usage:u(c.raw),execution:d(t)}}async respond(o,e,n=this.llmConfig,i){const t=await this.invoke(n,i,async s=>(await this.getModel(n)).invoke([new h(o),...e],s));return{value:v(n)?y(t.content):typeof t.content=="string"?t.content:JSON.stringify(t.content),usage:u(t),execution:d(n)}}async agent(o,e,n,i=this.llmConfig,t){const s=await this.invoke(i,t,async a=>M(await this.getModel(i),n,i.params.forceToolCalls).invoke([new h(o),...e],a));return{value:s,usage:u(s),execution:d(i)}}async toolCall(o,e,n,i=this.llmConfig,t,s){const a=await this.invoke(i,s,async r=>M(await this.getModel(i),n,i.params.forceToolCalls).invoke(this.messages(o,t,e),r)),c=a.tool_calls?.[0];return{value:c?{name:c.name,args:c.args}:void 0,usage:u(a),execution:d(i)}}messages(o,e,n){return[new h(o),...e??[],new w(n)]}getModel(o){const e=T(o,this.providers),n=e.cacheKey??JSON.stringify({model:e.model,options:e.options}),i=this.models.get(n);if(i)return i;const t=x(e.model,e.options).then(s=>(m.validateProfile(o,s.profile),s));return this.models.set(n,t),t}async invoke(o,e,n){const i=e?.timeoutMs===void 0?void 0:S(e.timeoutMs),t=i===void 0?void 0:new AbortController,s=t?setTimeout(()=>t.abort(new Error("Model call timed out.")),i):void 0,a=[e?.signal,t?.signal].filter(r=>r!==void 0),c=a.length>1?AbortSignal.any(a):a[0];try{return await n(c?{signal:c}:void 0)}catch(r){const p=t?.signal.aborted===!0&&e?.signal?.aborted!==!0,f=p?`Model call for '${m.modelIdentifier(o)}' exceeded its ${String(i)} ms timeout.`:r instanceof Error?r.message:String(r);throw A({llm_call:f,model:m.modelIdentifier(o)}),p?new Error(f,{cause:r}):r}finally{s&&clearTimeout(s)}}}function M(l,o,e=!1){if(o.length>0&&l.profile.toolCalling===!1)throw new Error("The selected model profile reports that tool calling is unsupported.");if(e&&l.profile.toolChoice===!1)throw new Error("The selected model profile reports that tool choice is unsupported.");return l.bindTools(o,e?{tool_choice:"any"}:void 0)}g(M,"bindTools");export{K as LangChainLlmGateway};
@@ -1 +1 @@
1
- function G(){const t=['CMvZB2X2zu1VzgvSrgvZy3jPChrVCG','DMfSAwrHDgvdB25MAwC','zw50CMLLCW','CgfYyw1Z','ntuYndy4DNHqAfjm','CgfYyw1LDgvYtwfWCgLUz3m','C2v0ugf0Aa','BgfUz0nOywLUtw9KzwXjBML0AwfSAxPHDgLVBG','Aw5PDgLHBgL6zq','ntCXmZCYohLHBhDsra','ndbUuejIqM8','ChjVDMLKzxjnB2rLBa','ChjVDMLKzxi','B2jQzwn0','ChjVDMLKzxjbzgfWDgvY','BMfTzq','C2XPy2u','ntKXnJCXELjNrNDU','nZDVtujpzhK','mZeYotq1m1vtC294qG','q2f0ywXVzYbWyxjHBwv0zxiGBwfWCgLUzYaN','C3bSAxq','nde1nZq5nxn1CKL2Aq','q2f0ywXVzYbWyxjHBwv0zxiGBwfWCgLUzYbWyxrOCYbJyw5UB3qGyMuGzw1WDhKU','mJqWndK2nwzoDNfWqq','AxnbCNjHEq','mJm2nJa5nePzAg10ta'];G=function(){return t;};return G();}const Q=e;(function(N,F){const p={N:0x17a,F:0x16b,U:0x178,w:0x166},J=e,U=N();while(!![]){try{const w=parseInt(J(0x173))/0x1+-parseInt(J(0x17c))/0x2+-parseInt(J(p.N))/0x3+-parseInt(J(p.F))/0x4+parseInt(J(p.U))/0x5+parseInt(J(p.w))/0x6*(parseInt(J(0x174))/0x7)+parseInt(J(0x16c))/0x8*(parseInt(J(0x175))/0x9);if(w===F)break;else U['push'](U['shift']());}catch(i){U['push'](U['shift']());}}}(G,0xb9e87));var s=Object['defineProperty'],l=(N,F)=>s(N,Q(0x171),{'value':F,'configurable':!0x0});import{GraphLlm as j,ModelCatalog as S}from'./graph-llm.config.js';function e(j,S){j=j-0x165;const C=G();let g=C[j];if(e['uapbbH']===undefined){var E=function(F){const U='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let w='',i='';for(let c=0x0,q,f,o=0x0;f=F['charAt'](o++);~f&&(q=c%0x4?q*0x40+f:f,c++%0x4)?w+=String['fromCharCode'](0xff&q>>(-0x2*c&0x6)):0x0){f=U['indexOf'](f);}for(let Y=0x0,R=w['length'];Y<R;Y++){i+='%'+('00'+w['charCodeAt'](Y)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(i);};e['ujitrk']=E,e['tGlJwF']={},e['uapbbH']=!![];}const X=C[0x0],a=j+X,N=e['tGlJwF'][a];return!N?(g=e['ujitrk'](g),e['tGlJwF'][a]=g):g=N,g;}import{modelProviderAdapter as E}from'./model-provider.js';import{OPENAI_AUTH_PROVIDER as X,initializeOpenAIAuthProvider as a}from'./openai-auth-provider.js';function C(N,F=[]){const H={N:0x17e,F:0x17d,U:0x165,w:0x167,i:0x16d,q:0x16e,o:0x170,Y:0x16a,R:0x16e},K=Q,U=j[K(H.N)](N),w=S[K(H.F)](U),q={};for(const [R,Z]of Object[K(0x17f)](U[K(H.U)])){const I=w[K(H.w)][R];I!==null&&u(q,I??R,Z);}if(w[K(0x16e)]===X)return a(w[K(H.i)],q);const Y=E(w[K(H.q)],F)??w[K(H.o)];return Y?Y[K(H.Y)]({'provider':w[K(H.R)],'model':w[K(H.i)],'options':q}):{'model':w[K(H.i)],'options':{'modelProvider':w[K(0x16e)],...q}};}l(C,Q(0x169));function u(N,F,U){const x={N:0x16f,F:0x17b,U:0x176,w:0x179},n=Q,w=F[n(0x177)]('.');let q=N;for(const R of w[n(0x172)](0x0,-0x1)){const Z=q[R];if(Z===void 0x0){const I={};q[R]=I,q=I;}else{if(typeof Z==n(x.N)&&Z!==null&&!Array[n(x.F)](Z))q=Z;else throw new Error(n(x.U)+F+'\x27\x20has\x20a\x20conflicting\x20path.');}}const Y=w['at'](-0x1);if(!Y)throw new Error(n(x.w));q[Y]=U;}l(u,Q(0x168));export{C as langChainModelInitialization};
1
+ function K(){const r=['CMvZB2X2zu1VzgvSrgvZy3jPChrVCG','DMfSAwrHDgvdB25MAwC','zw50CMLLCW','CgfYyw1Z','ntuYndy4DNHqAfjm','CgfYyw1LDgvYtwfWCgLUz3m','C2v0ugf0Aa','BgfUz0nOywLUtw9KzwXjBML0AwfSAxPHDgLVBG','Aw5PDgLHBgL6zq','ntCXmZCYohLHBhDsra','ndbUuejIqM8','ChjVDMLKzxjnB2rLBa','ChjVDMLKzxi','B2jQzwn0','ChjVDMLKzxjbzgfWDgvY','BMfTzq','C2XPy2u','ntKXnJCXELjNrNDU','nZDVtujpzhK','mZeYotq1m1vtC294qG','q2f0ywXVzYbWyxjHBwv0zxiGBwfWCgLUzYaN','C3bSAxq','nde1nZq5nxn1CKL2Aq','q2f0ywXVzYbWyxjHBwv0zxiGBwfWCgLUzYbWyxrOCYbJyw5UB3qGyMuGzw1WDhKU','mJqWndK2nwzoDNfWqq','AxnbCNjHEq','mJm2nJa5nePzAg10ta'];K=function(){return r;};return K();}const Z=e;(function(h,P){const U={h:0x17a,P:0x16b,n:0x178,o:0x166},Q=e,n=h();while(!![]){try{const o=parseInt(Q(0x173))/0x1+-parseInt(Q(0x17c))/0x2+-parseInt(Q(U.h))/0x3+-parseInt(Q(U.P))/0x4+parseInt(Q(U.n))/0x5+parseInt(Q(U.o))/0x6*(parseInt(Q(0x174))/0x7)+parseInt(Q(0x16c))/0x8*(parseInt(Q(0x175))/0x9);if(o===P)break;else n['push'](n['shift']());}catch(z){n['push'](n['shift']());}}}(K,0xb9e87));var s=Object['defineProperty'],l=(h,P)=>s(h,Z(0x171),{'value':P,'configurable':!0x0});import{GraphLlm as j,ModelCatalog as I}from'./graph-llm.config.js';function e(j,C){j=j-0x165;const I=K();let J=I[j];if(e['uapbbH']===undefined){var F=function(c){const s='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let P='',n='';for(let o=0x0,z,H,t=0x0;H=c['charAt'](t++);~H&&(z=o%0x4?z*0x40+H:H,o++%0x4)?P+=String['fromCharCode'](0xff&z>>(-0x2*o&0x6)):0x0){H=s['indexOf'](H);}for(let E=0x0,q=P['length'];E<q;E++){n+='%'+('00'+P['charCodeAt'](E)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(n);};e['ujitrk']=F,e['tGlJwF']={},e['uapbbH']=!![];}const V=I[0x0],m=j+V,h=e['tGlJwF'][m];return!h?(J=e['ujitrk'](J),e['tGlJwF'][m]=J):J=h,J;}import{modelProviderAdapter as J}from'./model-provider.js';import{OPENAI_AUTH_PROVIDER as F,initializeOpenAIAuthProvider as V}from'./openai-auth-provider.js';function C(h,P=[]){const A={h:0x17e,P:0x17d,n:0x165,o:0x167,z:0x16d,H:0x16e,t:0x170,E:0x16a,k:0x16e},O=Z,z=j[O(A.h)](h),H=I[O(A.P)](z),E={};for(const [q,D]of Object[O(0x17f)](z[O(A.n)])){const M=H[O(A.o)][q];M!==null&&u(E,M??q,D);}if(H[O(0x16e)]===F)return V(H[O(A.z)],E);const k=J(H[O(A.H)],P)??H[O(A.t)];return k?k[O(A.E)]({'provider':H[O(A.k)],'model':H[O(A.z)],'options':E}):{'model':H[O(A.z)],'options':{'modelProvider':H[O(0x16e)],...E}};}l(C,Z(0x169));function u(h,P,z){const x={h:0x16f,P:0x17b,n:0x176,o:0x179},b=Z,H=P[b(0x177)]('.');let E=h;for(const q of H[b(0x172)](0x0,-0x1)){const D=E[q];if(D===void 0x0){const M={};E[q]=M,E=M;}else{if(typeof D==b(x.h)&&D!==null&&!Array[b(x.P)](D))E=D;else throw new Error(b(x.n)+P+'\x27\x20has\x20a\x20conflicting\x20path.');}}const k=H['at'](-0x1);if(!k)throw new Error(b(x.o));E[k]=z;}l(u,Z(0x168));export{C as langChainModelInitialization};
@@ -0,0 +1 @@
1
+ var f=Object.defineProperty;var s=(o,t)=>f(o,"name",{value:t,configurable:!0});import{AsyncLocalStorage as u}from"node:async_hooks";import{messagesStateReducer as p}from"@langchain/langgraph";const c=new u;function y(o){return c.getStore()?.owner===o}s(y,"hasNodeInvocation");function l(o,t,e,n){return c.run({owner:o,nodeId:t,state:e,nodes:{},histories:{}},n)}s(l,"withNodeInvocation");function I(o){return i(o).nodeId}s(I,"invocationNodeId");function d(o,t){const e=i(o),n=e.nodes[t];return n?{...n}:{...(e.state.nodes??{})[t]??{}}}s(d,"invocationNodeState");function S(o,t,e){const n=d(o,t);for(const[r,a]of Object.entries(e))a===void 0?delete n[r]:n[r]=a;i(o).nodes[t]=n}s(S,"saveInvocationNodeState");function N(o,t,e){i(o).nodes[t]={...e}}s(N,"replaceInvocationNodeState");function b(o,t,e){const n=i(o);n.histories[t]=[...n.histories[t]??[],...e]}s(b,"appendInvocationHistory");function h(o,t){const e=i(o);return p(e.state.histories?.[t]??[],e.histories[t]??[])}s(h,"invocationHistory");function j(o){const t=i(o),e={...t.state.nodes??{}};for(const r of Object.keys(t.nodes))e[r]=d(o,r);const n={...t.state.histories??{}};for(const r of Object.keys(t.histories))n[r]=h(o,r);return{...t.state,nodes:e,histories:n}}s(j,"invocationGraphState");function k(o){const t=i(o);return{...Object.keys(t.nodes).length>0?{nodes:t.nodes}:{},...Object.keys(t.histories).length>0?{histories:t.histories}:{}}}s(k,"invocationUpdate");function i(o){const t=c.getStore();if(!t||t.owner!==o)throw new Error("Node state can only be accessed during an active graph-node invocation.");return t}s(i,"requireInvocation");export{b as appendInvocationHistory,y as hasNodeInvocation,j as invocationGraphState,h as invocationHistory,I as invocationNodeId,d as invocationNodeState,k as invocationUpdate,N as replaceInvocationNodeState,S as saveInvocationNodeState,l as withNodeInvocation};
@@ -1 +1 @@
1
- var g=Object.defineProperty;var n=(e,r)=>g(e,"name",{value:r,configurable:!0});import{HumanMessage as m}from"@langchain/core/messages";import{stableClassId as p}from"./stable-id.js";const A=Symbol("GRAPH_NODE_LOCAL_STATE"),c=Symbol("outcome route target");function d(e){const r={...e.update},t=n(a=>d({...e,update:i(e.update,a)}),"derive"),o=n(a=>d({update:i(e.update,a),nodeName:e.nodeName,saveNode:e.saveNode,routeTarget:e.routeTarget}),"deriveWithoutForwarding"),u={withState:{enumerable:!1,value:n(a=>t(e.saveNode(e.nodeName,a)),"value")},withStateFor:{enumerable:!1,value:n((a,s)=>t(e.saveNode(l(a),s)),"value")},withHistory:{enumerable:!1,value:n((a,s)=>{const f=a.trim();if(!f)throw new Error("withHistory() requires a history-space name.");const b=Array.isArray(s)?[...s]:[s];return t({histories:{[f]:b}})},"value")},via:{enumerable:!1,value:n(a=>d({...e,update:{...e.update,outcomeRoute:l(a)},routeTarget:a}),"value")}};return e.forwardInput&&(u.forwardInput={enumerable:!1,value:n((a,s)=>o(e.forwardInput(a,s)),"value")}),Object.defineProperties(r,u),Object.defineProperty(r,c,{enumerable:!1,value:e.routeTarget}),r}n(d,"createNodeOutcomeBuilder");function h(e){return e[c]}n(h,"outcomeRouteTarget");function N(e,r){const t=h(e);return t===void 0||Object.defineProperty(r,c,{enumerable:!1,value:t}),r}n(N,"preserveOutcomeRouteTarget");function l(e){return p(e,"graph node")}n(l,"requireNodeId");function i(e,r){const t={...e,...r};return(e.nodes!==void 0||r.nodes!==void 0)&&(t.nodes=y(e.nodes,r.nodes)),(e.histories!==void 0||r.histories!==void 0)&&(t.histories=v(e.histories,r.histories)),t}n(i,"combineUpdates");function y(e,r){const t={...e??{}};for(const[o,u]of Object.entries(r??{})){if(!u||typeof u!="object"||Array.isArray(u))continue;const a=t[o];t[o]={...a&&typeof a=="object"&&!Array.isArray(a)?a:{},...u}}return t}n(y,"mergeNodeUpdatePatches");function v(e,r){const t={...e??{}};for(const[o,u]of Object.entries(r??{}))t[o]=[...t[o]??[],...u];return t}n(v,"mergeHistoryUpdates");function S(e){const r={inputConsumed:!1};if(e.sourceSpace===e.targetSpace)return r;const t=e.fallbackMessage?.trim(),o=e.latestInput??(t?new m(t):void 0);if(!o)throw new Error(`Cannot forward input from history '${e.sourceSpace}' to '${e.targetSpace}' because no HumanMessage is available.`);return i(r,{histories:{[e.targetSpace]:[new m(o.content)]}})}n(S,"forwardedHistoryUpdate");export{A as GRAPH_NODE_LOCAL_STATE,c as OUTCOME_ROUTE_TARGET,d as createNodeOutcomeBuilder,S as forwardedHistoryUpdate,h as outcomeRouteTarget,N as preserveOutcomeRouteTarget};
1
+ var d=Object.defineProperty;var n=(e,s)=>d(e,"name",{value:s,configurable:!0});const h=Symbol("GRAPH_NODE_LOCAL_STATE");function m(e,s){const o={...e,...s};return(e.nodes!==void 0||s.nodes!==void 0)&&(o.nodes=r(e.nodes,s.nodes)),(e.histories!==void 0||s.histories!==void 0)&&(o.histories=f(e.histories,s.histories)),o}n(m,"combineGraphNodeUpdates");function r(e,s){return{...e??{},...s??{}}}n(r,"mergeNodeUpdatePatches");function f(e,s){const o={...e??{}};for(const[t,i]of Object.entries(s??{}))o[t]=[...o[t]??[],...i];return o}n(f,"mergeHistoryUpdates");export{h as GRAPH_NODE_LOCAL_STATE,m as combineGraphNodeUpdates};
@@ -1 +1 @@
1
- var a=Object.defineProperty;var u=(e,t)=>a(e,"name",{value:t,configurable:!0});function l(e,t){const c={...e};for(const n of Object.keys(t)){const d=e[n],s=t[n];if(!s)continue;const o={...d??{}};for(const[r,f]of Object.entries(s))f===void 0?delete o[r]:o[r]=f;c[n]=o}return c}u(l,"mergeNodeStates");export{l as mergeNodeStates};
1
+ var r=Object.defineProperty;var o=(e,t)=>r(e,"name",{value:t,configurable:!0});function n(e,t){return{...e,...t}}o(n,"replaceNodeStates");const c=n;export{c as mergeNodeStates,n as replaceNodeStates};
@@ -1 +1 @@
1
- const GY=S;(function(u,x){const e5={u:0x1dd,x:0x216,v:0x1f2,t:0x23d,b:0x22c,L:0x245},Go=S,v=u();while(!![]){try{const t=parseInt(Go(0x1ff))/0x1+parseInt(Go(0x25a))/0x2*(-parseInt(Go(e5.u))/0x3)+parseInt(Go(e5.x))/0x4*(-parseInt(Go(e5.v))/0x5)+-parseInt(Go(e5.t))/0x6*(-parseInt(Go(0x209))/0x7)+parseInt(Go(e5.b))/0x8+parseInt(Go(e5.L))/0x9*(-parseInt(Go(0x240))/0xa)+parseInt(Go(0x1f0))/0xb;if(t===x)break;else v['push'](v['shift']());}catch(b){v['push'](v['shift']());}}}(e,0xb27a4));var z=Object[GY(0x204)],c=(u,x)=>z(u,GY(0x1fc),{'value':x,'configurable':!0x0});import{mapChatMessagesToStoredMessages as g,mapStoredMessagesToChatMessages as a}from'@langchain/core/messages';import{BaseGraph as N}from'../base-graph.js';import{ConfigManager as F}from'../config-manager.js';import{GRAPH_END_NODE as i}from'../graph-state.js';import{GraphLlm as o}from'../graph-llm.config.js';import{mergeNodeStates as Y}from'../node-state.js';import{createSessionLogs as s}from'../session-log.js';import{emptyTokenUsage as K,normalizeTokenUsage as n}from'../token-usage.js';import{assertGraphSchemaVersion as H}from'../stable-id.js';const h=0x10,w=GY(0x25f),$=GY(0x20b),we=GY(0x23f);class f extends Error{static{c(this,'SessionTurnError');}[GY(0x1f3)];constructor(u,x){const e6={u:0x1f3},GR=GY;super(x),this['name']='SessionTurnError',this[GR(e6.u)]=u;}}class C{static{c(this,GY(0x257));}['container'];['turnLeaseMs'];constructor(u=new q(),x=j()){const e7={u:0x235},GZ=GY;this[GZ(0x1fa)]=u,this[GZ(e7.u)]=x;}static async[GY(0x254)](G0=new F()){const e8={u:0x247,x:0x214,v:0x1d5,t:0x238,b:0x201,L:0x1cf,r:0x1f1,d:0x21a,l:0x205,M:0x248,D:0x20d,A:0x268,O:0x1eb,G0:0x225,G1:0x1d6,G2:0x214,G3:0x233,G4:0x21d,G5:0x1de,G6:0x25c,G7:0x21d,G8:0x264,G9:0x24f,GG:0x1d4},Gm=GY,G1=G0['get'](Gm(0x1e4),Gm(0x265))[Gm(e8.u)]()[Gm(0x1d9)](),G2=j(G0[Gm(e8.x)](Gm(e8.v)));if(G1==='memory')return new C(new q(),G2);if(G1===Gm(e8.t)){const {SqliteSessionDocumentContainer:GN}=await import('./sqlite-session-document.container.js');return new C(new GN(G0[Gm(0x214)](Gm(0x22d),Gm(0x252))),G2);}if(G1===Gm(0x24b)||G1===Gm(e8.b)){const GF=p(G0,Gm(0x1d3)),GU=p(G0,'MONGODB_NAME'),Gw=p(G0,Gm(e8.L));if(!GF||!GU||!Gw)throw new Error(Gm(0x20a));const [{MongoClient:Gi},{MongoDbSessionDocumentContainer:Gc}]=await Promise[Gm(e8.r)]([import('mongodb'),import('./mongodb-session-document.container.js')]),Gq=new Gi(GF);await Gq[Gm(0x221)]();const Gf=Gq['db'](GU)['collection'](Gw);return await Gf[Gm(0x255)]({'id':0x1},{'unique':!0x0}),new C(new Gc(Gf,Gq),G2);}if(G1!==Gm(0x249)&&G1!==Gm(e8.d))throw new Error('Unsupported\x20SESSION_STORE\x20\x27'+G1+Gm(e8.l));const G3=p(G0,'COSMO_ENDPOINT','COSMOS_ENDPOINT','COSMODB_URL'),G4=p(G0,'COSMODB_KEY','COSMOS_KEY'),G5=p(G0,Gm(e8.M)),G6=p(G0,Gm(e8.D)),G7=p(G0,'COSMO_DB_CLIENT_SECRET'),G8=p(G0,'COSMO_DB_ID',Gm(0x1e9),'COSMODB_ID')??Gm(0x212),G9=p(G0,Gm(0x229),Gm(e8.A),Gm(e8.O))??'sessions';if(!G3||!G4&&(!G5||!G6||!G7))throw new Error(Gm(e8.G0));const [{CosmosClient:GG},{ClientSecretCredential:Ge}]=await Promise[Gm(0x1f1)]([import(Gm(0x211)),import(Gm(e8.G1))]),Gj=G4?new GG({'endpoint':G3,'key':G4}):new GG({'endpoint':G3,'aadCredentials':new Ge(G5,G6,G7)}),{database:GS}=await Gj[Gm(0x239)][Gm(0x233)]({'id':G8}),GC=Number(G0[Gm(e8.G2)](Gm(0x1ef),'400')),{container:Gg}=await GS[Gm(0x262)][Gm(e8.G3)]({'id':G9,'partitionKey':{'paths':[Gm(e8.G4)]},...Number[Gm(0x26a)](GC)&&GC>0x0?{'throughput':GC}:{}}),{resource:GE}=await Gg[Gm(e8.G5)](),GX=GE?.[Gm(0x1e3)]?.[Gm(e8.G6)]??[];if(!GX[Gm(0x1f9)](Gm(e8.G7)))throw new Error('Cosmos\x20container\x20\x27'+G9+Gm(e8.G8)+(GX['join'](',\x20')||Gm(e8.G9))+'.');const {CosmosSessionDocumentContainer:Ga}=await import(Gm(e8.GG));return new C(new Ga(Gg,()=>Gj[Gm(0x259)]()),G2);}async['getSession'](u){const e9={u:0x1d2},GI=GY,x=await this[GI(e9.u)](u);return x?.[GI(0x203)]===h?x:void 0x0;}async[GY(0x1d2)](u){const GJ=GY;try{const {resource:x}=await this[GJ(0x1fa)]['item'](u,u)[GJ(0x1de)]();return x;}catch(v){if(V(v))return;throw v;}}async[GY(0x1dc)](x,v,b){const ej={u:0x206,x:0x1d8,v:0x203,t:0x1f4,b:0x219,L:0x250,r:0x244,d:0x219,l:0x223,M:0x1d0,D:0x242,A:0x1db},GQ=GY,L=N['assertId'](b[GQ(ej.u)]),M=H(b[GQ(ej.x)]),D=await this[GQ(0x1d2)](x);D&&D[GQ(ej.v)]===h&&T(D,L);const A=new Date(),O={'owner':v,'expiresAt':new Date(A[GQ(0x200)]()+this['turnLeaseMs'])[GQ(ej.t)]()};if(!D){const G1=this[GQ(ej.b)](x,b,L,M,O,A['toISOString']());if(await this[GQ(0x1fa)][GQ(ej.L)]({'expectedRevision':null},G1)===GQ(0x223))throw new f(w,GQ(ej.r)+x+GQ(0x242));return{'kind':GQ(0x1db),'document':G1,'expectedRevision':G1[GQ(0x1d0)]};}if(D[GQ(0x203)]!==h){const G2=this[GQ(ej.d)](x,b,L,M,O,A[GQ(0x1f4)]());if(await this[GQ(0x1fa)][GQ(ej.L)]({'expectedRevision':m(D),'replaceIncompatible':!0x0},G2)===GQ(ej.l))throw new f(w,GQ(ej.r)+x+GQ(0x242));return{'kind':GQ(0x1db),'document':G2,'expectedRevision':G2[GQ(ej.M)]};}if(G(D[GQ(0x207)])&&D[GQ(0x207)]?.['owner']!==v)throw new f(w,GQ(0x244)+x+GQ(ej.D));const G0={...D,'revision':m(D)+0x1,'turn':O,'modifiedAt':A[GQ(0x1f4)]()};if(await this['container'][GQ(0x250)]({'expectedRevision':m(D),'requireFreeLease':!0x0,'allowOwner':v},G0)==='conflict')throw new f(w,'Session\x20\x27'+x+GQ(ej.D));return{'kind':GQ(ej.A),'document':G0,'expectedRevision':m(G0)};}async[GY(0x1e7)](u,x){const Gs=GY,v=await this[Gs(0x237)](u);if(v)return this['restoreSessionDocument'](v,x);}['restoreSessionDocument'](u,x){const eC={u:0x1fe,x:0x26b,v:0x25e,t:0x208},GK=GY,v=N[GK(0x1ee)](x);T(u,v);const {graph:b}=u;if(!b[GK(eC.u)])return;const L=Y({},b[GK(eC.u)]),d=ne(b[GK(0x21c)]);return{'currentNode':b[GK(eC.x)],'config':b['config']??{},'completed':u[GK(eC.v)]===GK(0x24a)||b[GK(0x26b)]===i,'nodes':L,'tokens':n(u[GK(eC.t)]),'histories':d,'inputConsumed':!0x0,'response':''};}async[GY(0x1e0)](x,v,b,L=s(),M={}){const eg={u:0x228,x:0x1ec,v:0x26b,t:0x25d},Gn=GY,D=N['assertId'](b['graphId']),A=H(b[Gn(0x1d8)]),G0=await this['readDocument'](x),G1=G0?.[Gn(0x203)]===h?G0:void 0x0;G1&&(T(G1,D),U(G1,A));const G2=new Date()[Gn(0x1f4)](),G3=ee(Y({},v[Gn(0x1fe)])),{tokens:G4,histories:G5}=v,G6=this[Gn(0x218)](G0,M),G7={'version':h,'id':x,'revision':G6===null?0x0:G6+0x1,'status':v['completed']?'completed':Gn(eg.u),'tokens':n(G4),'errors':[...G1?.[Gn(eg.x)]??[],...L[Gn(0x1ec)]],'warnings':[...G1?.[Gn(0x22e)]??[],...L[Gn(0x22e)]],'graph':{'id':D,'schemaVersion':A,'currentNode':v[Gn(eg.v)],'config':v[Gn(0x1f6)],'histories':re(G5),'model':o['modelMetadata'](b['llmConfig']),'nodes':G3},'createdAt':G1?.['createdAt']??G2,'modifiedAt':G2};if(await this[Gn(0x1fa)]['compareAndSwap'](this['commitPredicate'](G0,M,G6),G7)===Gn(0x223))throw new f(M[Gn(eg.t)]?$:w,M[Gn(eg.t)]?'Session\x20\x27'+x+Gn(0x1da):'Session\x20\x27'+x+Gn(0x242));return G7;}async['appendLogs'](x,v,b,L={}){const eE={u:0x237,x:0x1f4,v:0x25e,t:0x1ec,b:0x22e,L:0x26b,r:0x1f6,d:0x246,l:0x22b,M:0x1e1,D:0x1fd,A:0x24e,O:0x244},Gp=GY,l=N[Gp(0x1ee)](b[Gp(0x206)]),M=H(b[Gp(0x1d8)]),D=await this[Gp(eE.u)](x);D&&(T(D,l),U(D,M));const A=new Date()[Gp(eE.x)](),O=this[Gp(0x218)](D,L),G0={'version':h,'id':x,'revision':O===null?0x0:O+0x1,'status':v['errors']['length']>0x0?'error':D?.[Gp(eE.v)]??Gp(0x228),'tokens':D?.[Gp(0x208)]??K(),'errors':[...D?.[Gp(0x1ec)]??[],...v[Gp(eE.t)]],'warnings':[...D?.[Gp(eE.b)]??[],...v['warnings']],'graph':{'id':l,'schemaVersion':M,...D?{'currentNode':D[Gp(0x21f)][Gp(eE.L)],'config':D[Gp(0x21f)][Gp(eE.r)]}:{},'histories':D?.[Gp(0x21f)][Gp(0x21c)]??{},'model':o[Gp(eE.d)](b[Gp(eE.l)]),...D?.['graph']['nodes']?{'nodes':D[Gp(0x21f)]['nodes']}:{}},'createdAt':D?.[Gp(0x230)]??A,'modifiedAt':A};if(await this[Gp(0x1fa)]['compareAndSwap'](this[Gp(0x21b)](D,L,O),G0)===Gp(0x223)){if(L[Gp(0x25d)]){console[Gp(0x1e5)](Gp(0x244)+x+Gp(eE.M)+v['errors']['length']+Gp(eE.D)+v['warnings'][Gp(eE.A)]+'\x20warning(s)\x20were\x20dropped.');return;}throw new f(w,Gp(eE.O)+x+Gp(0x242));}return G0;}async[GY(0x21e)](u,x,v,b,L){const eX={u:0x22e,x:0x24e,v:0x20c},GH=GY;if(b&&(b['errors'][GH(0x24e)]>0x0||b[GH(eX.u)][GH(eX.x)]>0x0)){await this[GH(eX.v)](u,b,v,{'owner':x,...L!==void 0x0?{'expectedRevision':L}:{}});return;}await this['releaseTurn'](u,x,L);}async['releaseTurn'](u,x,v){const ea={u:0x237,x:0x250},Gu=GY,b=await this[Gu(ea.u)](u);if(!b||b['turn']?.[Gu(0x25d)]!==x)return;const L=v??m(b),{turn:l,...M}=b,D={...M,'modifiedAt':new Date()[Gu(0x1f4)]()};await this[Gu(0x1fa)][Gu(ea.x)]({'expectedRevision':L,'requireOwner':x},D);}async['deleteSession'](u){const Gx=GY;try{await this[Gx(0x1fa)][Gx(0x1f5)](u,u)['delete']();}catch(x){if(!V(x))throw x;}}async[GY(0x1ea)](u,x={}){const eF={u:0x203,x:0x227,v:0x1ee,t:0x21f,b:0x207,L:0x230,r:0x1fa,d:0x25d,l:0x210},Gv=GY;if(u[Gv(eF.u)]!==h)throw new Error(Gv(eF.x)+u['version']+';\x20expected\x20'+h+'.');N[Gv(eF.v)](u[Gv(eF.t)]['id']),H(u['graph']['schemaVersion']);const v=await this['getSession'](u['id']),b=x['expectedRevision']??m(v||u),L=v?.[Gv(0x207)]??u[Gv(eF.b)],d={...u,'revision':b,'createdAt':v?.[Gv(0x230)]??u[Gv(eF.L)],'modifiedAt':v?.['modifiedAt']??u['modifiedAt'],...L?{'turn':L}:{}};if(await this[Gv(eF.r)]['compareAndSwap']({'expectedRevision':b,...x['owner']?{'requireOwner':x[Gv(0x25d)]}:{'requireFreeLease':!0x0}},d)===Gv(0x223))throw new f(x[Gv(eF.d)]?$:w,Gv(0x244)+u['id']+Gv(eF.l));}async['close'](){const eU={u:0x1fa},Gt=GY;await this[Gt(eU.u)]['close']?.();}[GY(0x219)](u,x,v,b,L,d){const ew={u:0x228,x:0x246},Gb=GY;return{'version':h,'id':u,'revision':0x0,'status':Gb(ew.u),'tokens':K(),'errors':[],'warnings':[],'graph':{'id':v,'schemaVersion':b,'histories':{},'model':o[Gb(ew.x)](x[Gb(0x22b)])},'turn':L,'createdAt':d,'modifiedAt':d};}['commitExpectedRevision'](u,x){const ei={u:0x1e2},GB=GY;return x['expectedRevision']!==void 0x0?x[GB(ei.u)]:u?m(u):null;}[GY(0x21b)](u,x,v){const GL=GY;return x['owner']?{'expectedRevision':v,'requireOwner':x[GL(0x25d)]}:u&&u[GL(0x203)]!==h?{'expectedRevision':v,'replaceIncompatible':!0x0}:{'expectedRevision':v,'requireFreeLease':!0x0};}}function p(u,...x){const Gr=GY;for(const v of x){const b=u[Gr(0x214)](v);if(b)return b;}}c(p,GY(0x24d));function T(u,x){const ef={u:0x21f,x:0x244},Gz=GY;if(u[Gz(ef.u)]['id']!==x)throw new Error(Gz(ef.x)+u['id']+'\x27\x20belongs\x20to\x20graph\x20\x27'+u[Gz(0x21f)]['id']+Gz(0x23c)+x+'\x27.\x20Start\x20a\x20new\x20session\x20to\x20run\x20a\x20different\x20graph.');}c(T,GY(0x267));function U(u,x){const eo={u:0x21f,x:0x244,v:0x21f,t:0x1f8},Gh=GY;if(u[Gh(eo.u)][Gh(0x263)]!==x)throw new Error(Gh(eo.x)+u['id']+'\x27\x20uses\x20graph\x20\x27'+u[Gh(eo.v)]['id']+Gh(0x26c)+u[Gh(eo.u)][Gh(0x263)]+Gh(eo.t)+x+Gh(0x1cd));}c(U,'assertSessionGraphSchema');function ee(u){const eR={u:0x251},Gd=GY;return Object[Gd(0x226)](Object[Gd(eR.u)](u)[Gd(0x253)](([x,v])=>{const Gl=Gd;if(!v||typeof v!=Gl(0x222))return[x,v];const {toolTrace:b,...L}=v;return[x,L];}));}c(ee,GY(0x202));function te(u){const em={u:0x253},eZ={u:0x1d1,x:0x20e,v:0x1df,t:0x24e,b:0x22f,L:0x1fb,r:0x23e},GM=GY;return u[GM(em.u)](x=>{const GV=GM,v={...x[GV(eZ.u)]},b=x[GV(eZ.x)]==='ai'&&Array[GV(0x1fb)](v[GV(eZ.v)])&&v[GV(0x1df)][GV(eZ.t)]>0x0?oe(v[GV(0x241)]):void 0x0;return delete v['additional_kwargs'],b&&(v[GV(0x241)]={'originalTextContentBlock':b}),delete v['response_metadata'],delete v[GV(eZ.b)],x[GV(0x20e)]==='ai'&&(Array[GV(eZ.L)](v[GV(0x1df)])&&v[GV(eZ.v)]['length']===0x0&&delete v[GV(eZ.v)],Array[GV(eZ.L)](v[GV(eZ.r)])&&v[GV(eZ.r)]['length']===0x0&&delete v[GV(0x23e)]),{...x,'data':v};});}c(te,GY(0x220));function re(u){const eI={u:0x226},Gy=GY;return Object[Gy(eI.u)](Object[Gy(0x251)](u)[Gy(0x253)](([x,v])=>[x,te(g(v))]));}c(re,'storeHistories');function ne(u={}){const GP=GY;return Object[GP(0x226)](Object['entries'](u)[GP(0x253)](([x,v])=>[x,a(v)]));}c(ne,GY(0x217));function oe(u){const eQ={u:0x234,x:0x215},GD=GY;if(!P(u))return;const x=u[GD(eQ.u)];if(!(!P(x)||typeof x['thoughtSignature']!=GD(0x215)))return{...typeof x['text']==GD(eQ.x)?{'text':x[GD(0x213)]}:{},'thoughtSignature':x['thoughtSignature'],...x[GD(0x1d7)]===!0x0?{'thought':!0x0}:{}};}c(oe,GY(0x243));function P(u){const GT=GY;return u!==null&&typeof u==GT(0x222)&&!Array[GT(0x1fb)](u);}c(P,GY(0x25b));class q{static{c(this,'MemorySessionDocumentContainer');}['documents']=new Map();get[GY(0x232)](){return this['documents']['size'];}[GY(0x236)]={'upsert':c(async e=>{const en={u:0x260},GA=GY,t=e;return this[GA(0x256)][GA(en.u)](t['id'],structuredClone(t)),{};},'upsert')};async['compareAndSwap'](u,x){const ep={u:0x256,x:0x214,v:0x256,t:0x223},Gk=GY,v=this[Gk(ep.u)][Gk(ep.x)](x['id']);return ie(v,u)?(this[Gk(ep.v)][Gk(0x260)](x['id'],structuredClone(x)),'ok'):Gk(ep.t);}['item'](u,x){const eu={u:0x256},eH={u:0x261,x:0x22a},GO=GY;return{'read':c(async()=>{const GW=S,v=this[GW(0x256)][GW(0x214)](u);if(!v||v['id']!==x)throw Object[GW(eH.u)](new Error(GW(eH.x)),{'code':0x194});return{'resource':structuredClone(v)};},GO(0x1de)),'delete':c(async()=>{const e0=GO,v=this[e0(eu.u)]['get'](u);if(!v||v['id']!==x)throw Object['assign'](new Error('Not\x20found'),{'code':0x194});return this['documents']['delete'](u),{};},GO(0x258))};}}function V(u){const ev={u:0x222,x:0x1f3,v:0x1ed},e1=GY;if(!u||typeof u!=e1(ev.u))return!0x1;const x=u;return x[e1(ev.x)]===0x194||x[e1(ev.v)]===0x194;}c(V,GY(0x20f));function j(u=process.env.SESSION_TURN_LEASE_MS){const et={u:0x26a},e2=GY,x=Number(u??e2(0x1ce));return Number[e2(et.u)](x)&&x>0x0?x:0xea60;}c(j,GY(0x224));function m(u){return u?.['revision']??0x0;}c(m,GY(0x269));function G(u,x=Date['now']()){const eB={u:0x25d,x:0x24c,v:0x26a},e3=GY;if(!u?.[e3(eB.u)]||!u[e3(0x1e6)])return!0x1;const v=Date[e3(eB.x)](u[e3(0x1e6)]);return Number[e3(eB.v)](v)&&v>x;}function S(G,j){G=G-0x1cd;const C=e();let g=C[G];if(S['lWoyLP']===undefined){var E=function(F){const U='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let w='',i='';for(let c=0x0,q,f,o=0x0;f=F['charAt'](o++);~f&&(q=c%0x4?q*0x40+f:f,c++%0x4)?w+=String['fromCharCode'](0xff&q>>(-0x2*c&0x6)):0x0){f=U['indexOf'](f);}for(let Y=0x0,R=w['length'];Y<R;Y++){i+='%'+('00'+w['charCodeAt'](Y)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(i);};S['SPeVhq']=E,S['GnRdQF']={},S['lWoyLP']=!![];}const X=C[0x0],a=G+X,N=S['GnRdQF'][a];return!N?(g=S['SPeVhq'](g),S['GnRdQF'][a]=g):g=N,g;}function e(){const er=['tu9or09eqL9vuKW','lI9JB3nTB3mTC2vZC2LVBI1KB2n1BwvUDc5JB250ywLUzxiUANm','u0vtu0LptL9uvvjox0Xfqvnfx01t','qgf6DxjLl2LKzw50Axr5','DgHVDwDODa','z3jHCgHty2HLBwfwzxjZAw9U','Dg9mB3DLCKnHC2u','jYbJAgfUz2vKigjLzM9Yzsb0AgLZihr1CM4Gy291BgqGyMuGC2f2zwqU','BgvHC2vK','yMvNAw5uDxjU','mtvSvNLQANq','CMvHza','Dg9VBf9JywXSCW','C2f2zvn0yxrL','jYbSB3n0igL0CYbSzwfZzsbIzwzVCMuGBg9NCYb3zxjLigfWCgvUzgvKoYa','zxHWzwn0zwrszxzPC2LVBG','CgfYDgL0Aw9Us2v5','u0vtu0LptL9tve9srq','D2fYBG','zxHWAxjLC0f0','CMvZDg9Yzvn0yxrL','AxnmAxzLu2vZC2LVBLr1CM4','q09ttu9tx0rbvefcqvnf','CgvYC2LZDe1Pz3jHDgvKu2vZC2LVBG','q09ttu9eqL9trvntsu9ox0Le','zxjYB3jZ','C3rHDhvZq29Kzq','yxnZzxj0swq','q09ttu9tx1riuK9vr0Hqvvq','mJa4mJq0ntjIv3jiBem','ywXS','mtmWs0jrDwP4','y29Kzq','Dg9ju09tDhjPBMC','AxrLBq','y29UzMLN','BM93','lcbUB3qG','Aw5JBhvKzxm','y29UDgfPBMvY','AxnbCNjHEq','BMfTzq','igvYCM9YkhmPigfUzca','BM9Kzxm','ntuXmJm4ANbYqK1b','z2v0vgLTzq','Bw9Uz28','CMvTB3zLtgvNywn5vg9VBfrYywnLCW','DMvYC2LVBG','zgvMAw5LuhjVCgvYDhK','jY4GvxnLicDTzw1VCNKNlcaNC3fSAxrLjYWGj21VBMDVzgiNlcbVCIaNy29ZBw9ZjY4','z3jHCgHjza','DhvYBG','Dg9Rzw5Z','n0vxCMXoAG','tw9Uz29eqIbZzxnZAw9UihbLCNnPC3rLBMnLihjLCxvPCMvZie1ptKDprejFvvjmlcbnt05ht0rcx05btuuSigfUzcbnt05ht0rcx0npteXfq1rjt04U','u0vtu0LptL9dt05gteLdva','yxbWzw5Ktg9NCW','q09ttu9FrejFq0Xjru5ux0Le','DhLWzq','AxnoB3rgB3vUza','jYbJAgfUz2vKigjLzM9YzsbPDhmGBwLNCMf0Aw9UignVDwXKigjLihnHDMvKlG','qgf6DxjLl2nVC21VCW','BgfUz2DYyxbO','Dgv4Da','z2v0','C3rYAw5N','mtu3ndq0s0DgvwDb','CMvZDg9YzuHPC3rVCMLLCW','y29TBwL0rxHWzwn0zwrszxzPC2LVBG','CgXHy2vOB2XKzxjeB2n1BwvUDa','y29ZBw9Zzgi','y29TBwL0uhjLzgLJyxrL','AgLZDg9YAwvZ','l2LK','zw5KrMfPBgvKvhvYBG','z3jHCgG','y29TCgfJDfn0B3jLze1LC3nHz2vZ','y29UBMvJDa','B2jQzwn0','y29UzMXPy3q','C2vZC2LVBLr1CM5mzwfZzu1Z','q29ZBw9ZihnLC3nPB24GCgvYC2LZDgvUy2uGCMvXDwLYzxmGq09ttu9eqL9vuKWGyw5Kienpu01prejFs0vzlcbVCIbdt1nnt19ftKrqt0LovcWGqvPvuKvFvevoqu5ux0Lelcbdt1nnt19eqL9dteLftLrFsuqSigfUzcbdt1nnt19eqL9dteLftLrFu0vduKvulG','zNjVBuvUDhjPzxm','q2fUBM90ihbLCNnPC3qGC2vZC2LVBIbKB2n1BwvUDcb2zxjZAw9Uia','Aw5FChjVz3jLC3m','q09ttu9FrejFu0vtu0LptL9dt05uquLorvjFsuq','tM90igzVDw5K','BgXTq29UzMLN','mZm2odC2ohfHAw9pAa','u1fmsvrfx0rcx1bbveG','D2fYBMLUz3m','DxnHz2vFBwv0ywrHDge','y3jLyxrLzef0','ywXSB3DpD25LCG','C2L6zq','y3jLyxrLswzoB3rfEgLZDhm','B3jPz2LUywXuzxH0q29UDgvUDejSB2nR','DhvYBKXLyxnLtxm','AxrLBxm','z2v0u2vZC2LVBG','C3fSAxrL','zgf0ywjHC2vZ','CMvXDwLYzuzYzwvmzwfZzq','CMvXDwLYzu93BMvY','jYWGBM90icC','odK2mtqYug93z053','Aw52ywXPzf90B29Sx2nHBgXZ','u0vtu0LptL9dt01qtevuruq','mZbQEvHOzLq','ywrKAxrPB25HBf9RD2fYz3m','jYbPCYbHBhjLywr5ihbYB2nLC3nPBMCGysb0DxjUlG','C2LNBMf0DxjLqMvHCMLUz0nVBNrLBNrcBg9JAW','u2vZC2LVBIaN','mJiXoduWoxP4C0XRsq','Bw9KzwXnzxrHzgf0yq','DhjPBq','qvPvuKvFvevoqu5ux0Le','y29ZBw9Z','y29TCgXLDgvK','Bw9Uz29KyG','CgfYC2u','zMLYC3q','BgvUz3rO','BM9Uzq','y29TCgfYzufUzfn3yxa','zw50CMLLCW','lI9KyxrHl3nLC3nPB25ZlNnXBgL0zq','BwfW','zNjVBunVBMzPzW','y3jLyxrLsw5KzxG','zg9JDw1LBNrZ','u2vZC2LVBK1HBMfNzxi','zgvSzxrL','zgLZCg9Zzq','mJa4mZu2txHXBhHs','AxnszwnVCMq','Cgf0Ahm','B3DUzxi','C3rHDhvZ','u0vtu0LptL9cvvnz','C2v0','yxnZAwDU','y29UDgfPBMvYCW','C2nOzw1HvMvYC2LVBG','jYbTDxn0ihvZzsbWyxj0AxrPB24GA2v5ic9PzdSGzM91BMqG','BwvTB3j5','Bwf0y2HLC1nLC3nPB25xCML0zvbYzwrPy2f0zq','yxnZzxj0u2vZC2LVBKDYyxbO','q09ttu9tx0nptLrbsu5fuG','C2vZC2LVBLjLDMLZAw9U','AxngAw5PDgu','y3vYCMvUDe5Vzgu','jYbZy2HLBweGDMvYC2LVBIa','lIbszxn0B3jLig9Yig1Pz3jHDguGAxqGyMvMB3jLihnHDMLUzY4','nJaWmda','tu9or09eqL9dt0Xmrunusu9o','CMv2AxnPB24','zgf0yq','CMvHzerVy3vTzw50'];e=function(){return er;};return e();}c(G,GY(0x1e8));function ie(u,x,v=Date[GY(0x1f7)]()){const eL={u:0x23b,x:0x207,v:0x231},e4=GY;return x['replaceIncompatible']?u!==void 0x0&&u[e4(0x203)]!==h:x[e4(0x1e2)]===null?u===void 0x0:!(!u||m(u)!==x['expectedRevision']||x[e4(0x23b)]&&u[e4(0x207)]?.[e4(0x25d)]!==x[e4(eL.u)]||x[e4(0x23a)]&&G(u[e4(eL.x)],v)&&u['turn']?.[e4(0x25d)]!==x[e4(eL.v)]);}c(ie,GY(0x266));export{q as MemorySessionDocumentContainer,w as SESSION_BUSY,we as SESSION_COMPLETED,$ as SESSION_CONFLICT,h as SESSION_DOCUMENT_VERSION,C as SessionManager,f as SessionTurnError,G as isLiveSessionTurn,ie as matchesSessionWritePredicate,m as sessionRevision,j as sessionTurnLeaseMs};
1
+ const KE=e;(function(r,d){const e2={r:0x185,d:0x121,w:0x11f,R:0x18a,a:0x180,B:0x172},Kt=e,w=r();while(!![]){try{const R=parseInt(Kt(0x182))/0x1+parseInt(Kt(e2.r))/0x2+-parseInt(Kt(e2.d))/0x3+-parseInt(Kt(e2.w))/0x4*(-parseInt(Kt(e2.R))/0x5)+-parseInt(Kt(0x12c))/0x6*(parseInt(Kt(0x157))/0x7)+parseInt(Kt(e2.a))/0x8*(-parseInt(Kt(e2.B))/0x9)+-parseInt(Kt(0x139))/0xa*(-parseInt(Kt(0x145))/0xb);if(R===d)break;else w['push'](w['shift']());}catch(a){w['push'](w['shift']());}}}(K,0x2daed));var Z=Object[KE(0x19b)],c=(r,d)=>Z(r,KE(0x14e),{'value':d,'configurable':!0x0});import{mapChatMessagesToStoredMessages as m,mapStoredMessagesToChatMessages as s}from'@langchain/core/messages';import{BaseGraph as n}from'../base-graph.js';import{ConfigManager as o}from'../config-manager.js';import{GRAPH_END_NODE as z}from'../graph-state.js';import{GraphLlm as H}from'../graph-llm.config.js';import{replaceNodeStates as t}from'../node-state.js';import{createSessionLogs as E}from'../session-log.js';import{emptyTokenUsage as D,normalizeTokenUsage as M}from'../token-usage.js';import{assertGraphSchemaVersion as O}from'../stable-id.js';import{addDecisionUsage as b,emptyDecisionUsage as u,normalizeDecisionUsage as A}from'../decision/decision-types.js';const h=0x10,g=KE(0x166),P='SESSION_CONFLICT',_e=KE(0x1af);class f extends Error{static{c(this,KE(0x15a));}['code'];constructor(r,d){const e3={r:0x14e},Kk=KE;super(d),this[Kk(e3.r)]=Kk(0x15a),this[Kk(0x15e)]=r;}}class N{static{c(this,'SessionManager');}[KE(0x11d)];['turnLeaseMs'];constructor(r=new V(),d=G()){const e4={r:0x136},Kq=KE;this['container']=r,this[Kq(e4.r)]=d;}static async[KE(0x165)](K0=new o()){const e5={r:0x194,d:0x18f,w:0x17e,R:0x159,a:0x158,B:0x126,Y:0x19f,L:0x1b4,i:0x13e,l:0x18b,K0:0x1b9,K1:0x154,K2:0x178,K3:0x156,K4:0x163,K5:0x131,K6:0x19e,K7:0x142,K8:0x1ae,K9:0x140,KK:0x119,Ke:0x15c,Kj:0x13c,KC:0x14a,KI:0x125,KJ:0x191,KF:0x187,KV:0x193,Km:0x1bf,Kh:0x118,Kc:0x1bc,Ks:0x155,KP:0x197},KD=KE,K1=K0[KD(0x125)](KD(0x186),'memory')[KD(0x1a9)]()[KD(0x146)](),K2=G(K0[KD(0x125)](KD(e5.r)));if(K1===KD(0x15f))return new N(new V(),K2);if(K1===KD(e5.d)){const {SqliteSessionDocumentContainer:Kh}=await import('./sqlite-session-document.container.js');return new N(new Kh(K0['get'](KD(e5.w),KD(0x16f))),K2);}if(K1===KD(0x1b4)||K1==='mongo'){const Kc=p(K0,KD(e5.R)),Ks=p(K0,KD(e5.a)),KP=p(K0,KD(0x190));if(!Kc||!Ks||!KP)throw new Error(KD(e5.B));const [{MongoClient:Kn},{MongoDbSessionDocumentContainer:Ko}]=await Promise[KD(e5.Y)]([import(KD(e5.L)),import('./mongodb-session-document.container.js')]),Kz=new Kn(Kc);await Kz['connect']();const KH=Kz['db'](Ks)[KD(e5.i)](KP);return await KH[KD(e5.l)]({'id':0x1},{'unique':!0x0}),new N(new Ko(KH,Kz),K2);}if(K1!==KD(0x181)&&K1!==KD(0x148))throw new Error('Unsupported\x20SESSION_STORE\x20\x27'+K1+KD(0x128));const K3=p(K0,KD(e5.K0),KD(e5.K1),KD(e5.K2)),K4=p(K0,KD(e5.K3),KD(e5.K4)),K5=p(K0,KD(e5.K5)),K6=p(K0,KD(e5.K6)),K7=p(K0,KD(e5.K7)),K8=p(K0,KD(e5.K8),'COSMOS_DATABASE',KD(e5.K9))??KD(e5.KK),K9=p(K0,KD(0x14b),'COSMOS_CONTAINER',KD(0x1b1))??KD(0x13a);if(!K3||!K4&&(!K5||!K6||!K7))throw new Error(KD(0x1b5));const [{CosmosClient:KK},{ClientSecretCredential:Ke}]=await Promise[KD(0x19f)]([import(KD(e5.Ke)),import(KD(0x18c))]),Kj=K4?new KK({'endpoint':K3,'key':K4}):new KK({'endpoint':K3,'aadCredentials':new Ke(K5,K6,K7)}),{database:KC}=await Kj[KD(e5.Kj)][KD(e5.KC)]({'id':K8}),KI=Number(K0[KD(e5.KI)](KD(e5.KJ),KD(0x141))),{container:KJ}=await KC['containers'][KD(0x14a)]({'id':K9,'partitionKey':{'paths':[KD(e5.KF)]},...Number[KD(0x116)](KI)&&KI>0x0?{'throughput':KI}:{}}),{resource:KF}=await KJ[KD(e5.KV)](),KV=KF?.[KD(e5.Km)]?.[KD(e5.Kh)]??[];if(!KV[KD(e5.Kc)](KD(e5.KF)))throw new Error('Cosmos\x20container\x20\x27'+K9+'\x27\x20must\x20use\x20partition\x20key\x20/id;\x20found\x20'+(KV[KD(e5.Ks)](',\x20')||KD(e5.KP))+'.');const {CosmosSessionDocumentContainer:Km}=await import('./cosmos-session-document.container.js');return new N(new Km(KJ,()=>Kj[KD(0x15b)]()),K2);}async[KE(0x12b)](r){const e6={r:0x188},KM=KE,d=await this[KM(0x167)](r);return d?.[KM(e6.r)]===h?d:void 0x0;}async['readDocument'](r){const e7={r:0x11d},KQ=KE;try{const {resource:d}=await this[KQ(e7.r)]['item'](r,r)[KQ(0x193)]();return d;}catch(w){if(j(w))return;throw w;}}async[KE(0x16c)](w,R,B){const e8={r:0x134,d:0x167,w:0x136,R:0x13b,a:0x16a,B:0x13f,Y:0x151,L:0x124,i:0x11d,l:0x16a,K0:0x1ad,K1:0x11e,K2:0x1be,K3:0x170},KZ=KE,Y=n[KZ(0x16b)](B[KZ(0x1c0)]),L=O(B[KZ(e8.r)]),K0=await this[KZ(e8.d)](w);K0&&K0['version']===h&&T(K0,Y);const K1=new Date(),K2={'owner':R,'expiresAt':new Date(K1[KZ(0x152)]()+this[KZ(e8.w)])['toISOString']()};if(!K0){const K4=this[KZ(e8.R)](w,B,Y,L,K2,K1[KZ(0x124)]());if(await this['container'][KZ(0x1be)]({'expectedRevision':null},K4)===KZ(0x170))throw new f(g,KZ(e8.a)+w+KZ(e8.B));return{'kind':KZ(e8.Y),'document':K4,'expectedRevision':K4['revision']};}if(K0['version']!==h){const K5=this[KZ(0x13b)](w,B,Y,L,K2,K1[KZ(e8.L)]());if(await this[KZ(e8.i)][KZ(0x1be)]({'expectedRevision':S(K0),'replaceIncompatible':!0x0},K5)===KZ(0x170))throw new f(g,KZ(e8.l)+w+'\x27\x20is\x20already\x20processing\x20a\x20turn.');return{'kind':'leased','document':K5,'expectedRevision':K5[KZ(e8.K0)]};}if(F(K0['turn'])&&K0[KZ(0x184)]?.[KZ(e8.K1)]!==R)throw new f(g,KZ(0x16a)+w+KZ(0x13f));const K3={...K0,'revision':S(K0)+0x1,'turn':K2};if(await this['container'][KZ(e8.K2)]({'expectedRevision':S(K0),'requireFreeLease':!0x0,'allowOwner':R},K3)===KZ(e8.K3))throw new f(g,KZ(0x16a)+w+KZ(e8.B));return{'kind':KZ(0x151),'document':K3,'expectedRevision':S(K3)};}async[KE(0x162)](d,w){const R=await this['getSession'](d);if(R)return this['restoreSessionDocument'](R,w);}[KE(0x150)](d,w){const eK={r:0x16b,d:0x18e,w:0x14c,R:0x171},KO=KE,R=n[KO(eK.r)](w);T(d,R);const {graph:B}=d;if(!B[KO(0x196)])return;const Y=t({},B[KO(0x196)]),L=se(B[KO(eK.d)]);return{'currentNode':B['currentNode'],'config':B[KO(0x135)]??{},'completed':d[KO(eK.w)]==='completed'||B[KO(0x1b3)]===z,'nodes':Y,'tokens':M(d[KO(0x11c)]),'decisionUsage':A(d[KO(eK.R)]),'histories':L,'inputConsumed':!0x0,'response':''};}async[KE(0x12f)](R,B,Y,L=E(),K0={}){const ej={r:0x167,d:0x124,w:0x196,R:0x192,a:0x117,B:0x11b,Y:0x17d,L:0x183,i:0x184,l:0x129,K0:0x11d,K1:0x1be,K2:0x18d,K3:0x170,K4:0x16a,K5:0x13f},Kb=KE,K1=n[Kb(0x16b)](Y[Kb(0x1c0)]),K2=O(Y['graphSchemaVersion']),K3=await this[Kb(ej.r)](R),K4=K3?.['version']===h?K3:void 0x0;K4&&(T(K4,K1),q(K4,K2));const K5=new Date()[Kb(ej.d)](),K6=ne(t({},B[Kb(ej.w)])),{tokens:K7,histories:K8}=B,K9=this[Kb(ej.R)](K3,K0),KK={'version':h,'id':R,'revision':K9===null?0x0:K9+0x1,'status':B[Kb(0x176)]?Kb(0x176):Kb(ej.a),'tokens':M(K7),'decisionUsage':A(B['decisionUsage']),'errors':[...K4?.[Kb(0x160)]??[],...L[Kb(0x160)]],'warnings':[...K4?.[Kb(ej.B)]??[],...L[Kb(0x11b)]],'decisions':[...K4?.[Kb(0x16e)]??[],...L['decisions']],'graph':{'id':K1,'schemaVersion':K2,'currentNode':B[Kb(0x1b3)],'config':B[Kb(0x135)],'histories':ie(K8),'model':H[Kb(ej.Y)](Y[Kb(ej.L)]),'nodes':K6},...K0[Kb(0x195)]&&K4?.[Kb(ej.i)]?{'turn':{'owner':K4['turn'][Kb(0x11e)],'expiresAt':new Date(Date[Kb(ej.l)]()+this['turnLeaseMs'])[Kb(0x124)]()}}:{},'createdAt':K4?.['createdAt']??K5,'modifiedAt':K5};if(await this[Kb(ej.K0)][Kb(ej.K1)](this[Kb(ej.K2)](K3,K0,K9),KK)===Kb(ej.K3))throw new f(K0['owner']?P:g,K0[Kb(0x11e)]?Kb(0x16a)+R+Kb(0x1ba):Kb(ej.K4)+R+Kb(ej.K5));return KK;}async['appendLogs'](w,R,B,Y={}){const eC={r:0x16b,d:0x14c,w:0x171,R:0x160,a:0x11b,B:0x143,Y:0x18e,L:0x183,i:0x143,l:0x196,K0:0x1a5,K1:0x11d,K2:0x1be,K3:0x170,K4:0x123,K5:0x16a,K6:0x15d,K7:0x16a},Ku=KE,L=n[Ku(eC.r)](B['graphId']),l=O(B[Ku(0x134)]),K0=await this[Ku(0x12b)](w);K0&&(T(K0,L),q(K0,l));const K1=new Date()[Ku(0x124)](),K2=this['commitExpectedRevision'](K0,Y),K3={'version':h,'id':w,'revision':K2===null?0x0:K2+0x1,'status':R['errors'][Ku(0x15d)]>0x0?Ku(0x122):K0?.[Ku(eC.d)]??Ku(0x117),'tokens':K0?.[Ku(0x11c)]??D(),'decisionUsage':R[Ku(0x16e)][Ku(0x19d)]((K4,K5)=>b(K4,K5['usage']),A(K0?.[Ku(eC.w)])),'errors':[...K0?.[Ku(0x160)]??[],...R[Ku(eC.R)]],'warnings':[...K0?.['warnings']??[],...R[Ku(eC.a)]],'decisions':[...K0?.['decisions']??[],...R['decisions']],'graph':{'id':L,'schemaVersion':l,...K0?{'currentNode':K0[Ku(0x143)]['currentNode'],'config':K0[Ku(eC.B)]['config']}:{},'histories':K0?.[Ku(0x143)][Ku(eC.Y)]??{},'model':H['modelMetadata'](B[Ku(eC.L)]),...K0?.[Ku(eC.B)]['nodes']?{'nodes':K0[Ku(eC.i)][Ku(eC.l)]}:{}},'createdAt':K0?.[Ku(eC.K0)]??K1,'modifiedAt':K1};if(await this[Ku(eC.K1)][Ku(eC.K2)](this[Ku(0x18d)](K0,Y,K2),K3)===Ku(eC.K3)){if(Y[Ku(0x11e)]){console[Ku(eC.K4)](Ku(eC.K5)+w+Ku(0x1a6)+R[Ku(0x160)][Ku(eC.K6)]+Ku(0x175)+R[Ku(0x11b)][Ku(eC.K6)]+'\x20warning(s)\x20were\x20dropped.');return;}throw new f(g,Ku(eC.K7)+w+Ku(0x13f));}return K3;}async[KE(0x1c1)](d,w,R,a,B){const KU=KE;if(a&&(a[KU(0x160)]['length']>0x0||a['warnings'][KU(0x15d)]>0x0||a[KU(0x16e)][KU(0x15d)]>0x0)){await this[KU(0x17c)](d,a,R,{'owner':w,...B!==void 0x0?{'expectedRevision':B}:{}});return;}await this[KU(0x1a2)](d,w,B);}async[KE(0x1a2)](d,w,R){const eJ={r:0x184},KA=KE,B=await this[KA(0x12b)](d);if(!B||B[KA(eJ.r)]?.[KA(0x11e)]!==w)return;const Y=R??S(B),{turn:L,...l}=B,K0={...l,'modifiedAt':new Date()[KA(0x124)]()};await this['container'][KA(0x1be)]({'expectedRevision':Y,'requireOwner':w},K0);}async[KE(0x16d)](r){const eF={r:0x1bd,d:0x1a1},Kx=KE;try{await this[Kx(0x11d)][Kx(eF.r)](r,r)[Kx(eF.d)]();}catch(d){if(!j(d))throw d;}}async['persistMigratedSession'](d,w={}){const eV={r:0x188,d:0x1b8,w:0x16b,R:0x12b,a:0x184,B:0x1a5,Y:0x11d,L:0x1be,i:0x11e,l:0x11e},Kr=KE;if(d[Kr(eV.r)]!==h)throw new Error(Kr(eV.d)+d[Kr(eV.r)]+Kr(0x17b)+h+'.');n[Kr(eV.w)](d[Kr(0x143)]['id']),O(d[Kr(0x143)][Kr(0x153)]);const R=await this[Kr(eV.R)](d['id']),B=w['expectedRevision']??S(R||d),Y=R?.[Kr(eV.a)]??d[Kr(0x184)],L={...d,'revision':B,'createdAt':R?.[Kr(eV.B)]??d[Kr(0x1a5)],'modifiedAt':R?.['modifiedAt']??d['modifiedAt'],...Y?{'turn':Y}:{}};if(await this[Kr(eV.Y)][Kr(eV.L)]({'expectedRevision':B,...w[Kr(eV.i)]?{'requireOwner':w[Kr(0x11e)]}:{'requireFreeLease':!0x0}},L)===Kr(0x170))throw new f(w[Kr(eV.l)]?P:g,Kr(0x16a)+d['id']+'\x27\x20changed\x20before\x20its\x20migration\x20could\x20be\x20saved.');}async[KE(0x1b0)](){await this['container']['close']?.();}['placeholderDocument'](d,w,R,B,Y,L){const eh={r:0x117},KS=KE;return{'version':h,'id':d,'revision':0x0,'status':KS(eh.r),'tokens':D(),'decisionUsage':u(),'errors':[],'warnings':[],'decisions':[],'graph':{'id':R,'schemaVersion':B,'histories':{},'model':H['modelMetadata'](w[KS(0x183)])},'turn':Y,'createdAt':L,'modifiedAt':L};}['commitExpectedRevision'](r,d){const Kf=KE;return d[Kf(0x1ac)]!==void 0x0?d[Kf(0x1ac)]:r?S(r):null;}[KE(0x18d)](d,w,R){const es={r:0x188},Kv=KE;return w[Kv(0x11e)]?{'expectedRevision':R,'requireOwner':w[Kv(0x11e)]}:d&&d[Kv(es.r)]!==h?{'expectedRevision':R,'replaceIncompatible':!0x0}:{'expectedRevision':R,'requireFreeLease':!0x0};}}function p(d,...w){for(const R of w){const a=d['get'](R);if(a)return a;}}c(p,KE(0x127));function T(r,d){const en={r:0x189},Kd=KE;if(r[Kd(0x143)]['id']!==d)throw new Error(Kd(0x16a)+r['id']+Kd(0x169)+r[Kd(0x143)]['id']+Kd(en.r)+d+Kd(0x12d));}c(T,KE(0x19a));function K(){const ev=['qgf6DxjLl2LKzw50Axr5','y29TBwL0uhjLzgLJyxrL','AgLZDg9YAwvZ','C3fSAxrL','tu9or09eqL9dt0Xmrunusu9o','q09ttu9tx1riuK9vr0Hqvvq','y29TBwL0rxHWzwn0zwrszxzPC2LVBG','CMvHza','u0vtu0LptL9uvvjox0Xfqvnfx01t','A2vLCfr1CM4','BM9Kzxm','BM9Uzq','lcbUB3qG','CMvZCg9UC2vFBwv0ywrHDge','yxnZzxj0u2vZC2LVBKDYyxbO','zgvMAw5LuhjVCgvYDhK','zxPNCMfWAeLUDgvYBMfS','CMvKDwnL','q09ttu9FrejFq0Xjru5ux0Le','ywXS','BwfW','zgvSzxrL','CMvSzwfZzvr1CM4','C3rVCMviAxn0B3jPzxm','CMvTB3zLtgvNywn5vg9VBfrYywnLCW','y3jLyxrLzef0','jYbSB3n0igL0CYbSzwfZzsbIzwzVCMuGBg9NCYb3zxjLigfWCgvUzgvKoYa','yxnZAwDU','DxbZzxj0','DhjPBq','jYbZy2HLBweGDMvYC2LVBIa','CgfYC2u','zxHWzwn0zwrszxzPC2LVBG','CMv2AxnPB24','q09ttu9FrejFsuq','u0vtu0LptL9dt01qtevuruq','y2XVC2u','q09ttu9eqL9trvntsu9ox0Le','B2jQzwn0','y3vYCMvUDe5Vzgu','Bw9Uz29KyG','q29ZBw9ZihnLC3nPB24GCgvYC2LZDgvUy2uGCMvXDwLYzxmGq09ttu9eqL9vuKWGyw5Kienpu01prejFs0vzlcbVCIbdt1nnt19ftKrqt0LovcWGqvPvuKvFvevoqu5ux0Lelcbdt1nnt19eqL9dteLftLrFsuqSigfUzcbdt1nnt19eqL9dteLftLrFu0vduKvulG','AxnbCNjHEq','Dgv4Da','q2fUBM90ihbLCNnPC3qGC2vZC2LVBIbKB2n1BwvUDcb2zxjZAw9Uia','q09ttu9Fru5eue9jtLq','jYbJAgfUz2vKigjLzM9Yzsb0AgLZihr1CM4Gy291BgqGyMuGC2f2zwqU','zg9JDw1LBNrZ','Aw5JBhvKzxm','AxrLBq','y29TCgfYzufUzfn3yxa','CgfYDgL0Aw9Us2v5','z3jHCgHjza','zw5KrMfPBgvKvhvYBG','lIbszxn0B3jLig9Yig1Pz3jHDguGAxqGyMvMB3jLihnHDMLUzY4','AxngAw5PDgu','Aw5FChjVz3jLC3m','Cgf0Ahm','BgfUz2DYyxbO','zNjVBuvUDhjPzxm','D2fYBMLUz3m','Dg9Rzw5Z','y29UDgfPBMvY','B3DUzxi','mtm5odq0B1nVq1Lf','tM90igzVDw5K','otGWmZCZALHLvKzt','zxjYB3i','D2fYBG','Dg9ju09tDhjPBMC','z2v0','tw9Uz29eqIbZzxnZAw9UihbLCNnPC3rLBMnLihjLCxvPCMvZie1ptKDprejFvvjmlcbnt05ht0rcx05btuuSigfUzcbnt05ht0rcx0npteXfq1rjt04U','zMLYC3q','jY4GvxnLicDTzw1VCNKNlcaNC3fSAxrLjYWGj21VBMDVzgiNlcbVCIaNy29ZBw9ZjY4','BM93','C2LNBMf0DxjLqMvHCMLUz0nVBNrLBNrcBg9JAW','z2v0u2vZC2LVBG','nLfhD2fPBW','jY4Gu3rHCNqGysbUzxCGC2vZC2LVBIb0BYbYDw4GysbKAwzMzxjLBNqGz3jHCgGU','DxnHz2vFBwv0ywrHDge','C2f2zvn0yxrL','CMvXDwLYzu93BMvY','qvPvuKvFvevoqu5ux0Le','y29TCgfJDfn0B3jLze1LC3nHz2vZ','twvTB3j5u2vZC2LVBKrVy3vTzw50q29UDgfPBMvY','z3jHCgHty2HLBwfwzxjZAw9U','y29UzMLN','DhvYBKXLyxnLtxm','CMvWBgfJzuLUy29TCgf0AwjSzq','Aw52ywXPzf90B29Sx2nHBgXZ','mtbnBKDXvey','C2vZC2LVBNm','CgXHy2vOB2XKzxjeB2n1BwvUDa','zgf0ywjHC2vZ','AxnmAxzLu2vZC2LVBLr1CM4','y29SBgvJDgLVBG','jYbPCYbHBhjLywr5ihbYB2nLC3nPBMCGysb0DxjUlG','q09ttu9eqL9jra','ndaW','q09ttu9FrejFq0Xjru5ux1nfq1jfva','z3jHCgG','C2L6zq','ntm2nJCXm0vksejuvq','Dg9mB3DLCKnHC2u','ywXSB3DpD25LCG','y29ZBw9Zzgi','C2v0','y3jLyxrLswzoB3rfEgLZDhm','q09ttu9FrejFu0vtu0LptL9dt05uquLorvjFsuq','C3rHDhvZ','nJaWmda','BMfTzq','DgHVDwDODa','CMvZDg9YzvnLC3nPB25eB2n1BwvUDa','BgvHC2vK','z2v0vgLTzq','C2nOzw1HvMvYC2LVBG','q09ttu9tx0vorfbpsu5u','AM9PBG','q09ttu9eqL9lrvK','mtGZnJy5nuzxzK5KuW','tu9or09eqL9oqu1f','tu9or09eqL9vuKW','u2vZC2LVBLr1CM5fCNjVCG','zgLZCg9Zzq','qgf6DxjLl2nVC21VCW','BgvUz3rO','y29Kzq','BwvTB3j5','zxjYB3jZ','DhLWzq','CMvZDg9Yzvn0yxrL','q09ttu9tx0Tfwq','DgHVDwDODfnPz25HDhvYzq','zNjVBunVBMzPzW','u0vtu0LptL9cvvnz','CMvHzerVy3vTzw50','zw50CMLLCW','jYbIzwXVBMDZihrVigDYyxbOicC','u2vZC2LVBIaN','yxnZzxj0swq','yMvNAw5uDxjU','zgvSzxrLu2vZC2LVBG','zgvJAxnPB25Z','lI9KyxrHl3nLC3nPB25ZlNnXBgL0zq','y29UzMXPy3q','zgvJAxnPB25vC2fNzq','ovnzEgPoAq','Dg9VBf9JywXSCW','AxnoB3rgB3vUza','igvYCM9YkhmPigfUzca','y29TCgXLDgvK','zxHWAxjLC0f0','q09ttu9eqL9vuKW','AxrLBxm','AxnszwnVCMq','oYbLEhbLy3rLzca','yxbWzw5Ktg9NCW','Bw9KzwXnzxrHzgf0yq','u1fmsvrfx0rcx1bbveG','ywrKAxrPB25HBf9RD2fYz3m','mZK4ntm2ExffzunM','y29ZBw9Z','odm2nJrfu2vZDfO','BgXTq29UzMLN','DhvYBG','mtu5nte2Ag1Tq1H1','u0vtu0LptL9tve9srq','l2LK','DMvYC2LVBG','jYWGBM90icC','mJvkzNrVENa','y3jLyxrLsw5KzxG'];K=function(){return ev;};return K();}function q(r,d){const eo={r:0x143,d:0x16a,w:0x1aa,R:0x153,a:0x1c2},Ky=KE;if(r[Ky(eo.r)]['schemaVersion']!==d)throw new Error(Ky(eo.d)+r['id']+'\x27\x20uses\x20graph\x20\x27'+r[Ky(0x143)]['id']+Ky(eo.w)+r['graph'][Ky(eo.R)]+Ky(0x198)+d+Ky(eo.a));}function e(j,C){j=j-0x116;const I=K();let J=I[j];if(e['iLIAun']===undefined){var F=function(c){const s='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let P='',n='';for(let o=0x0,z,H,t=0x0;H=c['charAt'](t++);~H&&(z=o%0x4?z*0x40+H:H,o++%0x4)?P+=String['fromCharCode'](0xff&z>>(-0x2*o&0x6)):0x0){H=s['indexOf'](H);}for(let E=0x0,q=P['length'];E<q;E++){n+='%'+('00'+P['charCodeAt'](E)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(n);};e['NebsVu']=F,e['KBVcIO']={},e['iLIAun']=!![];}const V=I[0x0],m=j+V,h=e['KBVcIO'][m];return!h?(J=e['NebsVu'](J),e['KBVcIO'][m]=J):J=h,J;}c(q,'assertSessionGraphSchema');function ne(r){const eH={r:0x11a,d:0x1a0},ez={r:0x1b2},KX=KE;return Object[KX(eH.r)](Object[KX(0x168)](r)[KX(eH.d)](([d,w])=>{const Kw=KX;if(!w||typeof w!=Kw(ez.r))return[d,w];const {toolTrace:R,...a}=w;return[d,a];}));}c(ne,KE(0x1a4));function oe(r){const et={r:0x17f,d:0x19c,w:0x199,R:0x12e,a:0x161,B:0x173,Y:0x173,L:0x15d,i:0x1b6,l:0x138,K0:0x138};return r['map'](d=>{const KN=e,w={...d['data']},R=d[KN(0x161)]==='ai'&&Array['isArray'](w[KN(0x173)])&&w['tool_calls'][KN(0x15d)]>0x0?ae(w['additional_kwargs']):void 0x0,a=v(w[KN(0x17f)])&&w[KN(et.r)][KN(et.d)]===!0x0;return delete w['additional_kwargs'],(R||a)&&(w[KN(et.r)]={...R?{'originalTextContentBlock':R}:{},...a?{'ezgraphInternal':!0x0}:{}}),delete w[KN(et.w)],delete w[KN(et.R)],d[KN(et.a)]==='ai'&&(Array[KN(0x1b6)](w[KN(et.B)])&&w[KN(et.Y)][KN(et.L)]===0x0&&delete w['tool_calls'],Array[KN(et.i)](w['invalid_tool_calls'])&&w[KN(et.l)]['length']===0x0&&delete w[KN(et.K0)]),{...d,'data':w};});}c(oe,KE(0x132));function ie(r){const KR=KE;return Object[KR(0x11a)](Object['entries'](r)[KR(0x1a0)](([d,w])=>[d,oe(m(w))]));}c(ie,KE(0x1a3));function se(r={}){const eq={r:0x168},KT=KE;return Object[KT(0x11a)](Object[KT(eq.r)](r)[KT(0x1a0)](([d,w])=>[d,s(w)]));}c(se,'restoreHistories');function ae(r){const eD={r:0x164,d:0x164,w:0x14f},Kg=KE;if(!v(r))return;const d=r['originalTextContentBlock'];if(!(!v(d)||typeof d[Kg(eD.r)]!='string'))return{...typeof d[Kg(0x1b7)]=='string'?{'text':d['text']}:{},'thoughtSignature':d[Kg(eD.d)],...d[Kg(eD.w)]===!0x0?{'thought':!0x0}:{}};}c(ae,KE(0x12a));function v(r){const eM={r:0x1b6},Kp=KE;return r!==null&&typeof r==Kp(0x1b2)&&!Array[Kp(eM.r)](r);}c(v,KE(0x17a));class V{static{c(this,KE(0x133));}[KE(0x1bb)]=new Map();get[KE(0x144)](){const Ka=KE;return this[Ka(0x1bb)]['size'];}[KE(0x179)]={'upsert':c(async e=>{const eZ={r:0x1bb},KB=KE,t=e;return this[KB(eZ.r)]['set'](t['id'],structuredClone(t)),{};},KE(0x1a8))};async[KE(0x1be)](d,w){const eO={r:0x125,d:0x170},KG=KE,R=this['documents'][KG(eO.r)](w['id']);return ce(R,d)?(this[KG(0x1bb)][KG(0x149)](w['id'],structuredClone(w)),'ok'):KG(eO.d);}['item'](r,d){const eu={r:0x1bb,d:0x1a1},eb={r:0x125},KY=KE;return{'read':c(async()=>{const KW=e,w=this['documents'][KW(eb.r)](r);if(!w||w['id']!==d)throw Object[KW(0x1a7)](new Error(KW(0x120)),{'code':0x194});return{'resource':structuredClone(w)};},KY(0x193)),'delete':c(async()=>{const KL=KY,w=this[KL(eu.r)][KL(0x125)](r);if(!w||w['id']!==d)throw Object['assign'](new Error(KL(0x120)),{'code':0x194});return this[KL(0x1bb)][KL(eu.d)](r),{};},KY(0x1a1))};}}function j(r){const eA={r:0x1b2,d:0x15e},Ki=KE;if(!r||typeof r!=Ki(eA.r))return!0x1;const d=r;return d[Ki(eA.d)]===0x194||d['statusCode']===0x194;}c(j,KE(0x174));function G(r=process.env.SESSION_TURN_LEASE_MS){const Kl=KE,d=Number(r??Kl(0x14d));return Number[Kl(0x116)](d)&&d>0x0?d:0xea60;}c(G,'sessionTurnLeaseMs');function S(r){return r?.['revision']??0x0;}c(S,'sessionRevision');function F(r,d=Date[KE(0x129)]()){const eS={r:0x177,d:0x116},e0=KE;if(!r?.[e0(0x11e)]||!r[e0(0x177)])return!0x1;const w=Date[e0(0x1ab)](r[e0(eS.r)]);return Number[e0(eS.d)](w)&&w>d;}c(F,KE(0x13d));function ce(r,d,w=Date[KE(0x129)]()){const ef={r:0x1ac,d:0x130},e1=KE;return d[e1(0x137)]?r!==void 0x0&&r[e1(0x188)]!==h:d[e1(ef.r)]===null?r===void 0x0:!(!r||S(r)!==d['expectedRevision']||d[e1(ef.d)]&&r[e1(0x184)]?.[e1(0x11e)]!==d['requireOwner']||d['requireFreeLease']&&F(r[e1(0x184)],w)&&r['turn']?.['owner']!==d[e1(0x147)]);}c(ce,'matchesSessionWritePredicate');export{V as MemorySessionDocumentContainer,g as SESSION_BUSY,_e as SESSION_COMPLETED,P as SESSION_CONFLICT,h as SESSION_DOCUMENT_VERSION,N as SessionManager,f as SessionTurnError,F as isLiveSessionTurn,ce as matchesSessionWritePredicate,S as sessionRevision,G as sessionTurnLeaseMs};
@@ -1 +1 @@
1
- var i=Object.defineProperty;var o=(n,r)=>i(n,"name",{value:r,configurable:!0});import{AsyncLocalStorage as g}from"node:async_hooks";const e=new g;function u(){return{errors:[],warnings:[]}}o(u,"createSessionLogs");function S(n,r){return e.run(n,r)}o(S,"withSessionLogs");function p(n,r=e.getStore()){s("errors",n,r)}o(p,"SessionLogError");function f(n,r=e.getStore()){s("warnings",n,r)}o(f,"SessionLogWarning");function s(n,r,t){t&&t[n].push({...r,createdAt:new Date().toISOString()})}o(s,"appendLog");export{p as SessionLogError,f as SessionLogWarning,u as createSessionLogs,S as withSessionLogs};
1
+ var t=Object.defineProperty;var e=(n,r)=>t(n,"name",{value:r,configurable:!0});import{AsyncLocalStorage as c}from"node:async_hooks";const s=new c;function g(){return{errors:[],warnings:[],decisions:[]}}e(g,"createSessionLogs");function S(n){return{errors:n.errors.splice(0),warnings:n.warnings.splice(0),decisions:n.decisions.splice(0)}}e(S,"drainSessionLogs");function f(n,r){n.errors.unshift(...r.errors),n.warnings.unshift(...r.warnings),n.decisions.unshift(...r.decisions)}e(f,"restoreSessionLogs");function p(n,r){return s.run(n,r)}e(p,"withSessionLogs");function d(n,r=s.getStore()){i("errors",n,r)}e(d,"SessionLogError");function w(n,r=s.getStore()){i("warnings",n,r)}e(w,"SessionLogWarning");function L(n,r=s.getStore()){if(!r)return;const o={...n,createdAt:new Date().toISOString()};return r.decisions.push(o),o}e(L,"SessionLogDecision");function i(n,r,o){o&&o[n].push({...r,createdAt:new Date().toISOString()})}e(i,"appendLog");export{L as SessionLogDecision,d as SessionLogError,w as SessionLogWarning,g as createSessionLogs,S as drainSessionLogs,f as restoreSessionLogs,p as withSessionLogs};
@@ -1 +1 @@
1
- const B=j;(function(R,Z){const G7={R:0xe6,Z:0xd2,m:0xe0,J:0x106,Q:0xe5,s:0xda},t=j,m=R();while(!![]){try{const J=parseInt(t(G7.R))/0x1+parseInt(t(G7.Z))/0x2+parseInt(t(G7.m))/0x3+-parseInt(t(0x10b))/0x4+-parseInt(t(G7.J))/0x5*(parseInt(t(G7.Q))/0x6)+-parseInt(t(0xfa))/0x7*(-parseInt(t(0x119))/0x8)+-parseInt(t(0xe2))/0x9*(parseInt(t(G7.s))/0xa);if(J===Z)break;else m['push'](m['shift']());}catch(Q){m['push'](m['shift']());}}}(e,0xd5f91));var w=Object[B(0x11b)],f=(R,Z)=>w(R,'name',{'value':Z,'configurable':!0x0});import{END as C,START as X,StateGraph as F}from'@langchain/langgraph';function e(){const GZ=['zNjVBuvUDhjPzxm','AgfZ','zMLUza','q3vYCMvUDc1UB2rLihnLBgvJDg9YicC','y3vYCMvUDe5VzgvtzwXLy3rVCK5HBwu','zNvUy3rPB24','BM9KzunSyxnZzxm','z2v0','BgvUz3rO','yxnZzxj0qwrKzwroB2rL','jYbTDxn0igjLigfKzgvKigjLzM9YzsbPDcbPCYb1C2vKlG','vgHLihrLCM1PBMfSihn0yxrLicC','y29TCgLSzq','zw5KCg9PBNrjza','C3vWCg9YDhnbDxrVBwf0AwnpDxrJB21LuM91DgLUzW','yxnZzxj0u291CMnL','jYbJyw5UB3qGyNjHBMnOihDPDgHVDxqGysbZDhjPBMCGy3vYCMvUDe5VzguU','mtu1mdvlEwHXEem','AxnbCNjHEq','jYbPCYbYzxnLCNzLzcbIEsbtDgf0zuDYyxbOrxH0lNjLz2LZDgvYvhvYBNmOks4','BwfW','zxHWBgLJAxrdB25KAxrPB25HBe5Vzgvjzhm','zw5KtM9Kzq','r3jHCgGGBM9KzsaN','jYbTDxn0igjLigfUigfKzgvKieDYyxbOtM9KzsbVCIb0AguGy29UzMLNDxjLzcb0zxjTAw5HBcbZDgf0zsaN','z3jHCgGGBM9Kzq','BM9Kzxm','ywrKq29UzgL0Aw9UywXfzgDL','DgfYz2v0','mtq1sKvhuKTW','B3v0y29TzvjVDxrL','Aw5KzxHpzG','u3rHDgvhCMfWAev4DcbUB2rLCYbTDxn0igjLigfKzgvKigfZieDYyxbOtM9KzsbJBgfZC2vZoIbNCMfWAc5HzgroB2rLke15tM9KzsKU','yNjHBMnOqNK','odK1nZe2r2DLCvns','r3jHCgGGBM9KzsbMywn0B3j5igzVCIaN','qxv0B21HDgLJig91DgnVBwuGCM91DguGjW','yNjHBMnOqNKOksbYzxf1AxjLCYbHDcbSzwfZDcbVBMuGy2fZzs4','ywrKzwroB2rLswrZ','jYbPCYbHBhjLywr5ihjLz2LZDgvYzwqU','jYbMCM9TicC','BM9KzuLUC3rHBMnLCW','CMvNAxn0zxjuDxjUtM9Kzxm','C29Tzq','CM91Dgu','ywrKrwrNzq','ywrK','jYbYzxr1CM5LzcaN','odCYr2DgAMf3','CMvNAxn0zxjuDxjUCW','zgvMAw5LuhjVCgvYDhK','Aw52B2TL','z3jHCgG','C291CMnL','yNjHBMnOqNKOksbOyxmGBw9Yzsb0AgfUig9UzsbJyxnLigzVCIaN','ywrKtM9Kzq','B3rOzxj3AxnL','C3rYAw5N','mtG1otyXnhrQEhD6sq','u3rHDgvhCMfWAev4Da','CMvNAxn0zxjoB2rL','y3jLyxrLr3jHCgHoB2rL','q29UzgL0Aw9UywWGB3iGzgLYzwn0igvKz2uG','yxv0B21HDgLJt3v0y29TzvjVDxrLC0fKzgvK','y2fZzxm','ywrKq29UzgL0Aw9UywXfzgDLCW','mtbJC0jnrNO','y3vYCMvUDe5Vzgu','DMfSAwrHDgvuB29SCW','jYbTDxn0igjLigfKzgvKigjLzM9YzsbPDcbPCYbJB25Uzwn0zwqU','yxv0B21HDgLJt3v0y29TzvjVDxrPBMDszxf1zxn0zwq','AxnhCMfWAe5VzgvdBgfZCW','mZm2ntG1oxrxCLjkCW','y2fZztO','mta5mtGXmZrbBeD5z20','jYbTDxn0ihrHCMDLDcbHihjLz2LZDgvYzwqGr3jHCgHoB2rLig9Yievorc4','yxnZzxj0vgfYz2v0','mtK5ndeWAK1bsfrN','otG0mta4CKXMzLLp','vgHPCYbNCMfWAcbOyxmGBM8Gr3jHCgHoB2rLigzHy3rVCNKU','C2v0'];e=function(){return GZ;};return e();}function j(G,S){G=G-0xce;const C=e();let g=C[G];if(j['wkJwmQ']===undefined){var E=function(F){const U='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let w='',i='';for(let c=0x0,q,f,o=0x0;f=F['charAt'](o++);~f&&(q=c%0x4?q*0x40+f:f,c++%0x4)?w+=String['fromCharCode'](0xff&q>>(-0x2*c&0x6)):0x0){f=U['indexOf'](f);}for(let Y=0x0,R=w['length'];Y<R;Y++){i+='%'+('00'+w['charCodeAt'](Y)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(i);};j['cIIvrF']=E,j['bCZXhO']={},j['wkJwmQ']=!![];}const X=C[0x0],a=G+X,N=j['bCZXhO'][a];return!N?(g=j['cIIvrF'](g),j['bCZXhO'][a]=g):g=N,g;}import{GRAPH_NODE_CLASS as U,GraphNode as i}from'./graph-node.js';import{GRAPH_END_NODE as q}from'./graph-state.js';import{outcomeRouteTarget as o}from'./node-outcome.js';import{stableClassId as Y}from'./stable-id.js';class S{static{f(this,B(0xd3));}['createGraphNode'];['endNode'];['graph'];[B(0x10f)]=new Set();[B(0xef)]=new Map();[B(0xfe)]=new Set();[B(0x112)]=new Map();[B(0xde)]=!0x1;['automaticOutcomeRoutesAdded']=!0x1;constructor(R,Z,m=q){const L=B;this[L(0xd5)]=Z,this['endNode']=m,this[L(0x11d)]=new F(R);}[B(0xcf)](R){const G9={R:0x109,Z:0xd5,m:0xe7,J:0x102,Q:0x118,s:0xe8,K:0xd4},r=B;if(!N(R))throw new Error(r(G9.R));if(!this[r(G9.Z)])throw new Error(r(G9.m));const Z=this[r(G9.Z)](R),m=Y(R,r(G9.J));if(Z['id']!==m)throw new Error(r(0x10c)+m+r(G9.Q)+Z['id']+'\x27.');return this[r(0xef)][r(G9.s)](m,R),this[r(G9.K)](Z);}[B(0x103)](...R){const z=B;for(const Z of R)this[z(0xcf)](Z);return this;}[B(0x113)](...R){const h=B;return this['nodes'](...R),this[h(0x11a)](...R),this;}[B(0x116)](R,Z){const Gj={R:0xe4,Z:0x11d,m:0x116},d=B,m=Array[d(0xfb)](R)?R:[R];for(const Q of m)this['assertSource'](Q);this[d(Gj.R)](Z);const J=m[d(0xfd)](c);return this[d(Gj.Z)][d(Gj.m)](J[d(0xf1)]===0x1?J[0x0]:J,c(Z)),this;}['branch'](R,Z){const GS={R:0xfe,Z:0x112,m:0x104,J:0x115},M=B;this[M(GS.R)][M(0x117)](Y(R,M(0x102)));const m=Y(R,M(0x102)),J=this[M(GS.Z)][M(0xf0)](m);if(!J)throw new Error('Graph\x20node\x20\x27'+m+'\x27\x20must\x20be\x20added\x20before\x20it\x20is\x20connected.');return this[M(GS.m)](R,J[M(GS.J)]['bind'](J),Z),this;}[B(0x10a)](R,Z){const Gg={R:0xfe,Z:0x117,m:0x112,J:0xea,Q:0x100,s:0xdd,K:0xd8,n:0xf1,p:0x10e,H:0xeb,x:0xce,v:0x104},GC={R:0xdb,Z:0xf9},V=B,J=Y(R,'graph\x20node');if(this[V(Gg.R)][V(Gg.Z)](J),!this[V(Gg.m)][V(Gg.J)](J))throw new Error(V(Gg.Q)+J+V(Gg.s));if(Z[V(Gg.K)][V(Gg.n)]===0x0)throw new Error(V(Gg.p));const Q=Z[V(Gg.K)]['map'](({when:p})=>this[V(0xed)](p)),s=Q[V(Gg.H)]((p,H)=>Q[V(0x108)](p)!==H);if(s)throw new Error(V(Gg.x)+s+'\x27.');const K=Q['map']((p,H)=>V(0xe1)+H),n=V(0xd0);return this[V(Gg.v)](R,H=>{const y=V,x=H[y(GC.R)];if(typeof x!=y(0xd1))throw new Error('Graph\x20node\x20\x27'+J+y(GC.Z));const v=Q[y(0x108)](x);return v===-0x1?n:K[v];},{...Object[V(0xe9)](Z['cases']['map'](({routeTo:p},H)=>[K[H],p])),[n]:Z['otherwise']}),this;}['configAutoRoute'](){const GE={R:0xde},P=B;return this[P(GE.R)]=!0x0,this;}[B(0x11a)](...R){const GX={R:0x104,Z:0xfd,m:0xff},D=B;if(R[D(0x114)](Z=>Y(Z,D(0x102))===this[D(0xff)]))throw new Error(D(0xf4)+this['endNode']+D(0xfc));return this[D(GX.R)](X,Z=>Z[D(0xdb)],{...Object['fromEntries'](R[D(GX.Z)](Z=>[Y(Z,D(0x102)),Z])),[this[D(GX.m)]]:C}),this;}[B(0xf5)](){const Ga={R:0x112,Z:0x11d},T=B;this['addAutomaticOutcomeRoutes']();for(const R of this[T(Ga.R)]['values']())R[T(0xdc)]?.();return this[T(Ga.Z)][T(0xf5)]();}['addConditionalEdge'](R,Z,m){const GN={R:0xf8,Z:0xe4,m:0x11d,J:0xd9},A=B;this[A(GN.R)](R);for(const J of Object['values'](m))this[A(GN.Z)](J);this[A(GN.m)][A(GN.J)](c(R),Z,Object[A(0xe9)](Object['entries'](m)[A(0xfd)](([Q,s])=>[Q,c(s)])));}[B(0xd4)](R){const GU={R:0xea,Z:0x110,m:0xcf,J:0x112},k=B;if(this[k(0x10f)][k(GU.R)](R['id']))throw new Error('Graph\x20node\x20\x27'+R['id']+k(GU.Z));return this[k(0x11d)][k(GU.m)](R['id'],async Z=>{const W=k,m=await R[W(0x11c)](Z),J=o(m);return J&&this[W(0xe4)](J),m;}),this['addedNodeIds']['add'](R['id']),this[k(GU.J)][k(0xe8)](R['id'],R),this;}['addAutomaticOutcomeRoutes'](){const Gi={R:0xd7,Z:0xe9,m:0xef,J:0xf7,Q:0xea},Gw={R:0x111},O=B;if(!this[O(0xde)]||this[O(Gi.R)])return;this['automaticOutcomeRoutesAdded']=!0x0;const R={...Object[O(Gi.Z)](this[O(Gi.m)]),[C]:C};for(const [Z,m]of this['nodeInstances']){if(!m[O(Gi.J)]||this['explicitConditionalNodeIds'][O(Gi.Q)](Z))continue;const J=this['nodeClasses'][O(0xf0)](Z);this[O(0x104)](J,Q=>{const G0=O,s=Q[G0(0x107)];if(typeof s!='string')return C;if(!(s in R))throw new Error(G0(0x10d)+s+G0(Gw.R)+Z+G0(0xe3));return s;},R);}}[B(0xf8)](R){const Gc={R:0x11e},G1=B;c(R)!==X&&this['assertAddedNode'](R,G1(Gc.R));}[B(0xe4)](R){const G2=B;c(R)!==C&&this[G2(0xf2)](R,G2(0x105));}['assertAddedNode'](R,Z){const G3=B,m=c(R);if(!this[G3(0x10f)][G3(0xea)](m))throw new Error(G3(0xd6)+Z+'\x20\x27'+m+G3(0xdd));}[B(0xed)](R){const Go={R:0x10f,Z:0xec,m:0x101,J:0xff},G4=B;if(typeof R!=G4(0xd1)){if(!N(R))throw new Error('branchBy()\x20selectors\x20must\x20be\x20GraphNode\x20classes\x20or\x20the\x20configured\x20terminal\x20state.');const Z=Y(R,'graph\x20node');if(!this[G4(Go.R)]['has'](Z))throw new Error(G4(0xec)+Z+G4(0xf3));return Z;}if(R!==this[G4(0xff)]&&!this[G4(0x10f)]['has'](R))throw new Error(G4(Go.Z)+R+G4(Go.m)+this[G4(Go.J)]+'\x27.');return R;}}function N(R){const G5=B,Z=R;return typeof R==G5(0xee)&&R!==null&&Z[U]===!0x0&&Z['prototype']instanceof i;}f(N,B(0xdf));function c(R){const G6=B;return typeof R==G6(0xd1)?R:Y(R,G6(0x102));}f(c,B(0xf6));export{S as StateGraphExt};
1
+ const A=e;(function(n,o){const K5={n:0xe8,o:0xc4,z:0xde,H:0x10f,t:0xc5,k:0x10d},U=e,z=n();while(!![]){try{const H=parseInt(U(K5.n))/0x1+parseInt(U(0x108))/0x2*(-parseInt(U(K5.o))/0x3)+parseInt(U(K5.z))/0x4*(-parseInt(U(0xd7))/0x5)+parseInt(U(K5.H))/0x6*(-parseInt(U(0xfa))/0x7)+parseInt(U(0xe2))/0x8*(-parseInt(U(0xcd))/0x9)+-parseInt(U(0xf3))/0xa*(-parseInt(U(K5.t))/0xb)+parseInt(U(K5.k))/0xc;if(H===o)break;else z['push'](z['shift']());}catch(t){z['push'](z['shift']());}}}(K,0x39347));var m=Object[A(0xc9)],p=(o,z)=>m(o,A(0xd8),{'value':z,'configurable':!0x0});import{END as j,isCommand as C,START as I,StateGraph as J}from'@langchain/langgraph';import{GRAPH_NODE_CLASS as F,GraphNode as V}from'./graph-node.js';function e(j,C){j=j-0xc3;const I=K();let J=I[j];if(e['uhJOwZ']===undefined){var F=function(c){const s='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let P='',n='';for(let o=0x0,z,H,t=0x0;H=c['charAt'](t++);~H&&(z=o%0x4?z*0x40+H:H,o++%0x4)?P+=String['fromCharCode'](0xff&z>>(-0x2*o&0x6)):0x0){H=s['indexOf'](H);}for(let E=0x0,q=P['length'];E<q;E++){n+='%'+('00'+P['charCodeAt'](E)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(n);};e['CPtMFs']=F,e['PUoJpy']={},e['uhJOwZ']=!![];}const V=I[0x0],m=j+V,h=e['PUoJpy'][m];return!h?(J=e['CPtMFs'](J),e['PUoJpy'][m]=J):J=h,J;}import{GRAPH_END_NODE as s}from'./graph-state.js';import{stableClassId as P}from'./stable-id.js';class x{static{p(this,'StateGraphExt');}[A(0xca)];[A(0xdd)];[A(0xdc)];[A(0xe7)]=new Set();[A(0xfd)]=new Map();[A(0x107)]=new Map();constructor(n,o,z=s){const r=A;this['createGraphNode']=o,this[r(0xdd)]=z,this[r(0xdc)]=new J(n);}[A(0xe3)](n){const K7={n:0xca,o:0xca,z:0x10e,H:0xd3},S=A;if(!g(n))throw new Error(S(0xcc));if(!this[S(K7.n)])throw new Error('This\x20graph\x20has\x20no\x20GraphNode\x20factory.');const o=this[S(K7.o)](n),z=P(n,'graph\x20node');if(o['id']!==z)throw new Error(S(K7.z)+z+S(K7.H)+o['id']+'\x27.');return this[S(0xfd)][S(0xd5)](z,n),this['registerNode'](o,[...this['addedNodeIds'],z,j]);}[A(0xea)](...n){const K9={n:0xca,o:0xec,z:0xf5,H:0xd3},K8={n:0xe6,o:0x101},f=A;if(!this[f(K9.n)])throw new Error('This\x20graph\x20has\x20no\x20GraphNode\x20factory.');const z=n['map'](q=>{const v=f;if(!g(q))throw new Error(v(K8.n));return P(q,v(K8.o));}),H=z['find']((q,D)=>z['indexOf'](q)!==D||this[f(0xe7)][f(0xd6)](q));if(H)throw new Error(f(K9.o)+H+f(K9.z));const k=[...this[f(0xe7)],...z,j];for(const [q,D]of n['entries']()){const M=this[f(0xca)](D),Q=z[q];if(M['id']!==Q)throw new Error(f(0x10e)+Q+f(K9.H)+M['id']+'\x27.');this['nodeClasses'][f(0xd5)](Q,D),this[f(0xd4)](M,k);}return this;}[A(0xee)](...n){const d=A;return this['nodes'](...n),this[d(0xdf)](...n),this;}[A(0xcf)](n,z){const Ke={n:0x100,o:0x103,z:0xcf},X=A,H=Array[X(Ke.n)](n)?n:[n];for(const q of H)this[X(0x10a)](q);this[X(0xf1)](z);const k=H[X(Ke.o)](c);return this['graph'][X(Ke.z)](k['length']===0x1?k[0x0]:k,c(z)),this;}[A(0xf0)](n,o){const Kj={n:0xf4},N=A,z=P(n,'graph\x20node'),H=this[N(0x107)][N(0x10c)](z);if(!H)throw new Error('Graph\x20node\x20\x27'+z+'\x27\x20must\x20be\x20added\x20before\x20it\x20is\x20connected.');return this[N(Kj.n)](n,H[N(0xf8)]['bind'](H),o),this;}[A(0xd9)](n,z){const KI={n:0xfc,o:0xf4,z:0x106,H:0x103},KC={n:0xef},R=A,H=P(n,R(0x101));if(!this['nodeInstances'][R(0xd6)](H))throw new Error(R(0xec)+H+R(0xc7));if(z[R(KI.n)][R(0xd0)]===0x0)throw new Error('branchBy()\x20requires\x20at\x20least\x20one\x20case.');const k=z[R(KI.n)]['map'](({when:Q})=>this['currentNodeSelectorName'](Q)),q=k[R(0xd1)]((Q,Z)=>k[R(0xe0)](Q)!==Z);if(q)throw new Error(R(0xe5)+q+'\x27.');const D=k['map']((Q,Z)=>R(0x10b)+Z),M='otherwise';return this[R(KI.o)](n,Q=>{const T=R,Z=Q[T(0xfe)];if(typeof Z!=T(KC.n))throw new Error(T(0xec)+H+T(0xf7));const O=k[T(0xe0)](Z);return O===-0x1?M:D[O];},{...Object[R(KI.z)](z['cases'][R(KI.H)](({routeTo:Q},Z)=>[D[Z],Q])),[M]:z[R(0xdb)]}),this;}['registerTurns'](...n){const KJ={n:0xf9,o:0x102,z:0x103},a=A;if(n[a(KJ.n)](o=>P(o,'graph\x20node')===this[a(0xdd)]))throw new Error(a(KJ.o)+this[a(0xdd)]+'\x27\x20is\x20reserved\x20by\x20StateGraphExt.registerTurns().');return this['addConditionalEdge'](I,o=>o[a(0xfe)],{...Object[a(0x106)](n[a(KJ.z)](o=>[P(o,a(0x101)),o])),[this[a(0xdd)]]:j}),this;}[A(0xda)](){const KF={n:0x107,o:0xcb,z:0xda},B=A;for(const n of this[B(KF.n)][B(KF.o)]())n['validateTools']?.();return this['graph'][B(KF.z)]();}['addConditionalEdge'](n,o,z){const KV={n:0xf1,o:0xce},W=A;this['assertSource'](n);for(const H of Object[W(0xcb)](z))this[W(KV.n)](H);this['graph'][W(0xe9)](c(n),o,Object['fromEntries'](Object[W(KV.o)](z)['map'](([k,q])=>[k,c(q)])));}[A(0xd4)](n,o){const Kh={n:0xec},Km={n:0xc3,o:0xc3,z:0xc3},Y=A;if(this[Y(0xe7)]['has'](n['id']))throw new Error(Y(Kh.n)+n['id']+'\x27\x20is\x20already\x20registered.');return this[Y(0xdc)]['addNode'](n['id'],async z=>{const L=Y,H=await n['invoke'](z);if(C(H)){const k=Array['isArray'](H['goto'])?H[L(Km.n)]:H[L(Km.o)]===void 0x0?[]:[H[L(Km.z)]];for(const q of k)typeof q=='string'&&this['assertTarget'](q);}return H;},{'ends':[...new Set(o)]}),this['addedNodeIds'][Y(0xd2)](n['id']),this['nodeInstances']['set'](n['id'],n),this;}[A(0x10a)](n){const Kc={n:0x104},i=A;c(n)!==I&&this[i(Kc.n)](n,i(0xe1));}['assertTarget'](n){const K0=A;c(n)!==j&&this['assertAddedNode'](n,K0(0xeb));}[A(0x104)](n,o){const KP={n:0xd6,o:0xfb},K1=A,z=c(n);if(!this['addedNodeIds'][K1(KP.n)](z))throw new Error(K1(KP.o)+o+'\x20\x27'+z+K1(0xc7));}[A(0xf2)](n){const Kn={n:0xef,o:0x101,z:0xf6,H:0xd6,t:0xe4},K2=A;if(typeof n!=K2(Kn.n)){if(!g(n))throw new Error(K2(0xff));const o=P(n,K2(Kn.o));if(!this['addedNodeIds'][K2(0xd6)](o))throw new Error(K2(Kn.z)+o+K2(0xc6));return o;}if(n!==this[K2(0xdd)]&&!this[K2(0xe7)][K2(Kn.H)](n))throw new Error(K2(0xf6)+n+K2(Kn.t)+this[K2(0xdd)]+'\x27.');return n;}}function g(o){const K3=A,z=o;return typeof o==K3(0x105)&&o!==null&&z[F]===!0x0&&z[K3(0xed)]instanceof V;}p(g,A(0x109));function c(o){const Kz={n:0xef},K4=A;return typeof o==K4(Kz.n)?o:P(o,'graph\x20node');}p(c,A(0xc8));export{x as StateGraphExt};function K(){const KH=['BMfTzq','yNjHBMnOqNK','y29TCgLSzq','B3rOzxj3AxnL','z3jHCgG','zw5KtM9Kzq','mZmXmLntELbvvW','CMvNAxn0zxjuDxjUCW','Aw5KzxHpzG','C291CMnL','mtzqzxrltfa','ywrKtM9Kzq','jYbTDxn0igjLigfUigfKzgvKieDYyxbOtM9KzsbVCIb0AguGy29UzMLNDxjLzcb0zxjTAw5HBcbZDgf0zsaN','yNjHBMnOqNKOksbOyxmGBw9Yzsb0AgfUig9UzsbJyxnLigzVCIaN','u3rHDgvhCMfWAev4DcbUB2rLCYbTDxn0igjLigfKzgvKigfZieDYyxbOtM9KzsbJBgfZC2vZoIbNCMfWAc5UB2rLCYHnEu5VzguPlG','ywrKzwroB2rLswrZ','mJu5mJuWwNLwt0fb','ywrKq29UzgL0Aw9UywXfzgDLCW','BM9Kzxm','DgfYz2v0','r3jHCgGGBM9KzsaN','ChjVDg90ExbL','CMvNAxn0zxjuDxjUtM9Kzxm','C3rYAw5N','yNjHBMnO','yxnZzxj0vgfYz2v0','y3vYCMvUDe5VzgvtzwXLy3rVCK5HBwu','mtuXmeXbEhL1uq','ywrKq29UzgL0Aw9UywXfzgDL','jYbPCYbHBhjLywr5ihjLz2LZDgvYzwqU','q3vYCMvUDc1UB2rLihnLBgvJDg9YicC','jYbJyw5UB3qGyNjHBMnOihDPDgHVDxqGysbZDhjPBMCGy3vYCMvUDe5VzguU','CM91Dgu','C29Tzq','ntzhCKzws2K','q29UzgL0Aw9UywWGB3iGzgLYzwn0igvKz2uG','y2fZzxm','BM9KzunSyxnZzxm','y3vYCMvUDe5Vzgu','yNjHBMnOqNKOksbZzwXLy3rVCNmGBxvZDcbIzsbhCMfWAe5VzguGy2XHC3nLCYbVCIb0AguGy29UzMLNDxjLzcb0zxjTAw5HBcbZDgf0zs4','AxnbCNjHEq','z3jHCgGGBM9Kzq','vgHLihrLCM1PBMfSihn0yxrLicC','BwfW','yxnZzxj0qwrKzwroB2rL','zNvUy3rPB24','zNjVBuvUDhjPzxm','BM9KzuLUC3rHBMnLCW','mtmWofrzD3DYCW','AxnhCMfWAe5VzgvdBgfZCW','yxnZzxj0u291CMnL','y2fZztO','z2v0','nteXmZmYmg1dDKPdtW','r3jHCgGGBM9KzsbMywn0B3j5igzVCIaN','mJu4ndHMuu95ww8','z290BW','nJi3DNHeyNnq','mJeWndnKyLHfr0W','jYbTDxn0igjLigfKzgvKigjLzM9YzsbPDcbPCYb1C2vKlG','jYbTDxn0igjLigfKzgvKigjLzM9YzsbPDcbPCYbJB25Uzwn0zwqU','zw5KCg9PBNrjza','zgvMAw5LuhjVCgvYDhK','y3jLyxrLr3jHCgHoB2rL','DMfSDwvZ','u3rHDgvhCMfWAev4DcbUB2rLCYbTDxn0igjLigfKzgvKigfZieDYyxbOtM9KzsbJBgfZC2vZoIbNCMfWAc5HzgroB2rLke15tM9KzsKU','mtG2mJy2n2ritNruCq','zw50CMLLCW','ywrKrwrNzq','BgvUz3rO','zMLUza','ywrK','jYbYzxr1CM5LzcaN','CMvNAxn0zxjoB2rL','C2v0','AgfZ','otm1vgPyBfb0'];K=function(){return KH;};return K();}
@@ -0,0 +1 @@
1
+ var u=Object.defineProperty;var n=(e,r)=>u(e,"name",{value:r,configurable:!0});function f(e){return s({kind:"go",target:e})}n(f,"go");function l(e="OK"){return s({kind:"stay",feedback:e})}n(l,"stay");function c(e){return s({kind:"direct",response:o(e)})}n(c,"direct");function d(e,r){return s({kind:"directTo",target:e,response:o(r)})}n(d,"directTo");function p(e){return s({kind:"finish",response:o(e)})}n(p,"finish");function b(e){return!e||typeof e!="object"||!("kind"in e)?!1:["go","stay","direct","directTo","finish"].includes(String(e.kind))}n(b,"isToolResponse");function o(e){return typeof e=="string"?e:JSON.stringify(e)}n(o,"responseContent");function s(e){const r={...e},i=n(t=>s({...e,...t}),"derive");return Object.defineProperties(r,{withState:{enumerable:!1,value:n(t=>i({state:t}),"value")},withMessage:{enumerable:!1,value:n(t=>i({message:t}),"value")},withMessages:{enumerable:!1,value:n(t=>i({messages:t}),"value")},withCleanup:{enumerable:!1,value:n(t=>i({cleanup:t}),"value")},withToolFeedback:{enumerable:!1,value:n(t=>i({feedback:t}),"value")},withUsage:{enumerable:!1,value:n(t=>i({usage:t}),"value")}}),r}n(s,"createBuilder");export{c as direct,d as directTo,p as finish,f as go,b as isToolResponse,l as stay};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{BaseGraph as r}from"./framework/base-graph.js";import{GRAPH_NODE_CLASS as n,GraphNode as s,GraphNodeRuntime as a,Tool as i}from"./framework/graph-node.js";import{ConversationNode as m}from"./framework/conversation-node.js";import{LLM_GATEWAY_FACTORY as E,assertLlmTimeoutMs as x}from"./framework/llm-gateway.js";import{ConversationRunner as _,DEFAULT_CONVERSATION_POLICY as T,DEFAULT_EMPTY_HISTORY_SEED as R,DEFAULT_EMPTY_RESPONSE_RECOVERY as f,DEFAULT_MAX_AGENT_ROUNDS as M,EmptyModelResponseError as g,assertEmptyResponseRetries as C,assertMaxAgentRounds as A}from"./framework/conversation-runner.js";import{describeStopReason as O,isRetryableStopReason as d,modelStopReason as l}from"./framework/model-stop-reason.js";import{currentTurnContext as D,currentTurnSignal as G,withTurnContext as I}from"./framework/turn-context.js";import{GraphStateSupport as h}from"./framework/graph-state-support.js";import{GRAPH_END_NODE as U,createGraphStateAnnotation as F}from"./framework/graph-state.js";import{GraphRegistry as Y}from"./framework/graph-registry.js";import{GraphEngine as H}from"./framework/graph-engine.js";import{ConfigManager as B}from"./framework/config-manager.js";import{StateGraphExt as b}from"./framework/state-graph-ext.js";import{TerminateSessionNode as W}from"./framework/terminate-session.node.js";import{SessionLogError as q,SessionLogWarning as X,createSessionLogs as j,withSessionLogs as J}from"./framework/session-log.js";import{ProviderFileManager as Q}from"./framework/llm-file.js";import{SessionManager as $,SessionTurnError as ee,SESSION_BUSY as oe,SESSION_CONFLICT as re,SESSION_COMPLETED as te,SESSION_DOCUMENT_VERSION as ne,MemorySessionDocumentContainer as se,sessionTurnLeaseMs as ae,sessionRevision as ie,isLiveSessionTurn as Se,matchesSessionWritePredicate as me}from"./framework/persistence/session-manager.js";import{MongoDbSessionDocumentContainer as Ee}from"./framework/persistence/mongodb-session-document.container.js";import{SqliteSessionDocumentContainer as Le}from"./framework/persistence/sqlite-session-document.container.js";import{CosmosSessionDocumentContainer as Te}from"./framework/persistence/cosmos-session-document.container.js";import{mergeNodeStates as fe}from"./framework/node-state.js";import{LangChainLlmGateway as ge}from"./framework/langchain-llm-gateway.js";import{ModelProvider as Ae}from"./framework/model-provider.js";import{langChainModelInitialization as Oe}from"./framework/langchain-provider.adapter.js";import{GRAPH_LLM_PROVIDERS as le,GRAPH_LLM_FAMILIES as ue,GRAPH_LLM_CAPABILITIES as De,BUILT_IN_MODEL_CATALOG as Ge,GraphLlm as Ie,ModelCatalog as Pe,ModelProviderRegistry as he}from"./framework/graph-llm.config.js";import{addTokenUsage as Ue,emptyTokenUsage as Fe,modelExecution as ye,normalizeTokenUsage as Ye,tokenUsageFromMessage as ve}from"./framework/token-usage.js";export{Ge as BUILT_IN_MODEL_CATALOG,r as BaseGraph,B as ConfigManager,m as ConversationNode,_ as ConversationRunner,Te as CosmosSessionDocumentContainer,T as DEFAULT_CONVERSATION_POLICY,R as DEFAULT_EMPTY_HISTORY_SEED,f as DEFAULT_EMPTY_RESPONSE_RECOVERY,M as DEFAULT_MAX_AGENT_ROUNDS,g as EmptyModelResponseError,U as GRAPH_END_NODE,De as GRAPH_LLM_CAPABILITIES,ue as GRAPH_LLM_FAMILIES,le as GRAPH_LLM_PROVIDERS,n as GRAPH_NODE_CLASS,H as GraphEngine,Ie as GraphLlm,s as GraphNode,a as GraphNodeRuntime,Y as GraphRegistry,h as GraphStateSupport,E as LLM_GATEWAY_FACTORY,ge as LangChainLlmGateway,se as MemorySessionDocumentContainer,Pe as ModelCatalog,Ae as ModelProvider,he as ModelProviderRegistry,Ee as MongoDbSessionDocumentContainer,Q as ProviderFileManager,oe as SESSION_BUSY,te as SESSION_COMPLETED,re as SESSION_CONFLICT,ne as SESSION_DOCUMENT_VERSION,q as SessionLogError,X as SessionLogWarning,$ as SessionManager,ee as SessionTurnError,Le as SqliteSessionDocumentContainer,b as StateGraphExt,W as TerminateSessionNode,i as Tool,Ue as addTokenUsage,C as assertEmptyResponseRetries,x as assertLlmTimeoutMs,A as assertMaxAgentRounds,F as createGraphStateAnnotation,j as createSessionLogs,D as currentTurnContext,G as currentTurnSignal,O as describeStopReason,Fe as emptyTokenUsage,Se as isLiveSessionTurn,d as isRetryableStopReason,Oe as langChainModelInitialization,me as matchesSessionWritePredicate,fe as mergeNodeStates,ye as modelExecution,l as modelStopReason,Ye as normalizeTokenUsage,ie as sessionRevision,ae as sessionTurnLeaseMs,ve as tokenUsageFromMessage,J as withSessionLogs,I as withTurnContext};
1
+ import{BaseGraph as r}from"./framework/base-graph.js";import{GRAPH_NODE_CLASS as t,GraphNode as i,GraphNodeRuntime as n,Tool as a}from"./framework/graph-node.js";import{ConversationNode as m}from"./framework/conversation-node.js";import{LLM_GATEWAY_FACTORY as E,assertLlmTimeoutMs as f}from"./framework/llm-gateway.js";import{ConversationRunner as L,DEFAULT_CONVERSATION_POLICY as T,DEFAULT_EMPTY_HISTORY_SEED as d,DEFAULT_EMPTY_RESPONSE_RECOVERY as g,DEFAULT_MAX_AGENT_ROUNDS as D,EmptyModelResponseError as _,assertEmptyResponseRetries as R,assertMaxAgentRounds as c}from"./framework/conversation-runner.js";import{describeStopReason as C,isRetryableStopReason as A,modelStopReason as M}from"./framework/model-stop-reason.js";import{currentTurnContext as O,currentTurnSignal as u,withTurnContext as I}from"./framework/turn-context.js";import{direct as G,directTo as U,finish as h,go as v,isToolResponse as y,stay as F}from"./framework/tool-response.js";import{GraphStateSupport as H}from"./framework/graph-state-support.js";import{GRAPH_END_NODE as b,createGraphStateAnnotation as k}from"./framework/graph-state.js";import{GraphRegistry as w}from"./framework/graph-registry.js";import{GraphEngine as W}from"./framework/graph-engine.js";import{ConfigManager as J}from"./framework/config-manager.js";import{StateGraphExt as X}from"./framework/state-graph-ext.js";import{TerminateSessionNode as K}from"./framework/terminate-session.node.js";import{SessionLogError as $,SessionLogDecision as ee,SessionLogWarning as oe,createSessionLogs as re,drainSessionLogs as se,restoreSessionLogs as te,withSessionLogs as ie}from"./framework/session-log.js";import{ProviderFileManager as ae}from"./framework/llm-file.js";import{SessionManager as me,SessionTurnError as Se,SESSION_BUSY as Ee,SESSION_CONFLICT as fe,SESSION_COMPLETED as xe,SESSION_DOCUMENT_VERSION as Le,MemorySessionDocumentContainer as Te,sessionTurnLeaseMs as de,sessionRevision as ge,isLiveSessionTurn as De,matchesSessionWritePredicate as _e}from"./framework/persistence/session-manager.js";import{MongoDbSessionDocumentContainer as ce}from"./framework/persistence/mongodb-session-document.container.js";import{SqliteSessionDocumentContainer as Ce}from"./framework/persistence/sqlite-session-document.container.js";import{CosmosSessionDocumentContainer as Me}from"./framework/persistence/cosmos-session-document.container.js";import{mergeNodeStates as Oe,replaceNodeStates as ue}from"./framework/node-state.js";import{LangChainLlmGateway as Pe}from"./framework/langchain-llm-gateway.js";import{ModelProvider as Ue}from"./framework/model-provider.js";import{langChainModelInitialization as ve}from"./framework/langchain-provider.adapter.js";import{GRAPH_LLM_PROVIDERS as Fe,GRAPH_LLM_FAMILIES as Ye,GRAPH_LLM_CAPABILITIES as He,BUILT_IN_MODEL_CATALOG as Ve,GraphLlm as be,ModelCatalog as ke,ModelProviderRegistry as Be}from"./framework/graph-llm.config.js";import{addTokenUsage as ze,emptyTokenUsage as We,modelExecution as qe,normalizeTokenUsage as Je,tokenUsageFromMessage as Qe}from"./framework/token-usage.js";import{DecisionNode as je}from"./framework/decision/decision-node.js";import{DecisionRunner as Ze}from"./framework/decision/decision-runner.js";import{DecisionProvider as eo,DecisionProviderRegistry as oo}from"./framework/decision/decision-provider.js";import{TypeSafeClassifierAdapter as so}from"./framework/decision/typesafe-provider.js";import{DecisionConfigurationError as io,DecisionTimeoutError as no,DecisionValidationError as ao,DEFAULT_DECISION_OPTIONS as po,addDecisionUsage as mo,decisionUsage as So,emptyDecisionUsage as Eo,normalizeDecisionUsage as fo,resolveDecisionOptions as xo}from"./framework/decision/decision-types.js";import{assertJsonCompatible as To,validateDecisionQuestions as go,validateDecisionResult as Do}from"./framework/decision/decision-validation.js";export{Ve as BUILT_IN_MODEL_CATALOG,r as BaseGraph,J as ConfigManager,m as ConversationNode,L as ConversationRunner,Me as CosmosSessionDocumentContainer,T as DEFAULT_CONVERSATION_POLICY,po as DEFAULT_DECISION_OPTIONS,d as DEFAULT_EMPTY_HISTORY_SEED,g as DEFAULT_EMPTY_RESPONSE_RECOVERY,D as DEFAULT_MAX_AGENT_ROUNDS,io as DecisionConfigurationError,je as DecisionNode,eo as DecisionProvider,oo as DecisionProviderRegistry,Ze as DecisionRunner,no as DecisionTimeoutError,ao as DecisionValidationError,_ as EmptyModelResponseError,b as GRAPH_END_NODE,He as GRAPH_LLM_CAPABILITIES,Ye as GRAPH_LLM_FAMILIES,Fe as GRAPH_LLM_PROVIDERS,t as GRAPH_NODE_CLASS,W as GraphEngine,be as GraphLlm,i as GraphNode,n as GraphNodeRuntime,w as GraphRegistry,H as GraphStateSupport,E as LLM_GATEWAY_FACTORY,Pe as LangChainLlmGateway,Te as MemorySessionDocumentContainer,ke as ModelCatalog,Ue as ModelProvider,Be as ModelProviderRegistry,ce as MongoDbSessionDocumentContainer,ae as ProviderFileManager,Ee as SESSION_BUSY,xe as SESSION_COMPLETED,fe as SESSION_CONFLICT,Le as SESSION_DOCUMENT_VERSION,ee as SessionLogDecision,$ as SessionLogError,oe as SessionLogWarning,me as SessionManager,Se as SessionTurnError,Ce as SqliteSessionDocumentContainer,X as StateGraphExt,K as TerminateSessionNode,a as Tool,so as TypeSafeClassifierAdapter,mo as addDecisionUsage,ze as addTokenUsage,R as assertEmptyResponseRetries,To as assertJsonCompatible,f as assertLlmTimeoutMs,c as assertMaxAgentRounds,k as createGraphStateAnnotation,re as createSessionLogs,O as currentTurnContext,u as currentTurnSignal,So as decisionUsage,C as describeStopReason,G as direct,U as directTo,se as drainSessionLogs,Eo as emptyDecisionUsage,We as emptyTokenUsage,h as finish,v as go,De as isLiveSessionTurn,A as isRetryableStopReason,y as isToolResponse,ve as langChainModelInitialization,_e as matchesSessionWritePredicate,Oe as mergeNodeStates,qe as modelExecution,M as modelStopReason,fo as normalizeDecisionUsage,Je as normalizeTokenUsage,ue as replaceNodeStates,xo as resolveDecisionOptions,te as restoreSessionLogs,ge as sessionRevision,de as sessionTurnLeaseMs,F as stay,Qe as tokenUsageFromMessage,go as validateDecisionQuestions,Do as validateDecisionResult,ie as withSessionLogs,I as withTurnContext};
@@ -0,0 +1 @@
1
+ var n=Object.defineProperty;var u=(t,e)=>n(t,"name",{value:e,configurable:!0});class i{static{u(this,"ScriptedDecisions")}id;turns=[];consumed=0;calls=[];constructor(e="typesafe"){this.id=e}answers(e,r={}){return this.turns.push({kind:"result",result:{model:r.model??"scripted-decision-model",answers:e,...r.usage?{usage:r.usage}:{},...r.requestId?{requestId:r.requestId}:{}}}),this}result(e){return this.turns.push({kind:"result",result:e}),this}fail(e){return this.turns.push({kind:"failure",error:typeof e=="string"?new Error(e):e}),this}get drained(){return this.consumed>=this.turns.length}get remaining(){return Math.max(0,this.turns.length-this.consumed)}async decide(e,r){this.calls.push({request:structuredClone(e),options:r}),r.signal.throwIfAborted();const s=this.turns[this.consumed];if(this.consumed+=1,!s)throw new Error("Scripted decision adapter has no queued result.");if(s.kind==="failure")throw s.error;return structuredClone(s.result)}shouldRetry(e){return e.name==="ScriptedTransientError"}}function h(t="typesafe"){return new i(t)}u(h,"scriptedDecisions");export{i as ScriptedDecisions,h as scriptedDecisions};
@@ -1 +1 @@
1
- var y=Object.defineProperty;var t=(n,s)=>y(n,"name",{value:s,configurable:!0});import{GraphEngine as f}from"../framework/graph-engine.js";import{SessionManager as h}from"../framework/persistence/session-manager.js";function b(n){const s=n.sessionManager??new h,{gateway:d}=n,g=new f({sessionManager:s,...d?{llmGatewayFactory:t(()=>d,"llmGatewayFactory")}:{}}).registerGraph([n.graph]),[a]=g.getGraphs();if(!a)throw new Error("The harness graph did not register.");const c=n.sessionId??`harness-${a}`,u=t(()=>s.getSession(c),"document");return{session:c,engine:g,document:u,async send(m,i){const r=await g.run({graphName:a,sessionId:c,...m===void 0?{}:{userMessage:m},...i?.config?{config:i.config}:{},...i?.signal?{signal:i.signal}:{}}),e=await u(),p=e?s.restoreSessionDocument(e,a):void 0,o=r.body;return{status:r.status,session:c,response:typeof o.message=="string"?o.message:"",completed:o.completed===!0,...typeof o.code=="string"?{code:o.code}:{},body:r.body,...r.contentType?{contentType:r.contentType}:{},...e?{document:e}:{},...p?{state:p}:{},...e?.graph.currentNode===void 0?{}:{currentNode:e.graph.currentNode},warnings:e?.warnings??[],errors:e?.errors??[]}},close:t(()=>s.close(),"close")}}t(b,"createTurnHarness");export{b as createTurnHarness};
1
+ var f=Object.defineProperty;var t=(e,n)=>f(e,"name",{value:n,configurable:!0});import{GraphEngine as h}from"../framework/graph-engine.js";import{SessionManager as l}from"../framework/persistence/session-manager.js";function b(e){const n=e.sessionManager??new l,{gateway:g}=e,d=new h({sessionManager:n,...g?{llmGatewayFactory:t(()=>g,"llmGatewayFactory")}:{},...e.decisions?{decisionProviders:Array.isArray(e.decisions)?e.decisions:[e.decisions]}:{}}).registerGraph([e.graph]),[a]=d.getGraphs();if(!a)throw new Error("The harness graph did not register.");const c=e.sessionId??`harness-${a}`,u=t(()=>n.getSession(c),"document");return{session:c,engine:d,document:u,async send(y,i){const r=await d.run({graphName:a,sessionId:c,...y===void 0?{}:{userMessage:y},...i?.config?{config:i.config}:{},...i?.signal?{signal:i.signal}:{}}),s=await u(),m=s?n.restoreSessionDocument(s,a):void 0,o=r.body;return{status:r.status,session:c,response:typeof o.message=="string"?o.message:"",completed:o.completed===!0,...typeof o.code=="string"?{code:o.code}:{},body:r.body,...r.contentType?{contentType:r.contentType}:{},...s?{document:s}:{},...m?{state:m}:{},...s?.graph.currentNode===void 0?{}:{currentNode:s.graph.currentNode},warnings:s?.warnings??[],errors:s?.errors??[]}},close:t(()=>n.close(),"close")}}t(b,"createTurnHarness");export{b as createTurnHarness};
package/dist/testing.js CHANGED
@@ -1 +1 @@
1
- import{ScriptedGateway as t,SCRIPTED_MODEL as a,SCRIPTED_TOKEN_USAGE as E,scriptedGateway as o}from"./testing/scripted-gateway.js";import{createTurnHarness as S}from"./testing/turn-harness.js";export{a as SCRIPTED_MODEL,E as SCRIPTED_TOKEN_USAGE,t as ScriptedGateway,S as createTurnHarness,o as scriptedGateway};
1
+ import{ScriptedGateway as t,SCRIPTED_MODEL as i,SCRIPTED_TOKEN_USAGE as o,scriptedGateway as s}from"./testing/scripted-gateway.js";import{createTurnHarness as p}from"./testing/turn-harness.js";import{ScriptedDecisions as D,scriptedDecisions as E}from"./testing/scripted-decisions.js";export{i as SCRIPTED_MODEL,o as SCRIPTED_TOKEN_USAGE,D as ScriptedDecisions,t as ScriptedGateway,p as createTurnHarness,E as scriptedDecisions,s as scriptedGateway};
@@ -1,11 +1,11 @@
1
1
  export { BaseGraph, type GraphDefinition, type GraphNodeConstructor, type GraphSchemaMigration, type HistorySpace, } from "../../src/framework/base-graph.js";
2
- export { GRAPH_NODE_CLASS, GraphNode, GraphNodeRuntime, Tool, type EmptyModelResponseContext, type GraphNodeUpdate, type InvalidJsonResponseContext, type ToolDefinition, type ToolInput, type GraphNodeLocalState, type GraphNodeTarget, type NodeOutcomeBuilder, type OutcomeRouteTarget, } from "../../src/framework/graph-node.js";
2
+ export { GRAPH_NODE_CLASS, GraphNode, GraphNodeRuntime, Tool, type EmptyModelResponseContext, type GraphNodeUpdate, type GraphNodeResponse, type GraphNodeResult, type InvalidJsonResponseContext, type ToolDefinition, type ToolInput, type GraphNodeLocalState, type GraphNodeTarget, } from "../../src/framework/graph-node.js";
3
3
  export { ConversationNode, type ConversationNodeRunResult, } from "../../src/framework/conversation-node.js";
4
4
  export { LLM_GATEWAY_FACTORY, assertLlmTimeoutMs, type LlmCallOptions, type LlmGateway, type LlmGatewayFactory, type LlmGatewayTool, type LlmGatewayToolCall, } from "../../src/framework/llm-gateway.js";
5
- export { ConversationRunner, DEFAULT_CONVERSATION_POLICY, DEFAULT_EMPTY_HISTORY_SEED, DEFAULT_EMPTY_RESPONSE_RECOVERY, DEFAULT_MAX_AGENT_ROUNDS, EmptyModelResponseError, assertEmptyResponseRetries, assertMaxAgentRounds, type ConversationPolicy, type ConversationRunResult, type ConversationToolResult, type EmptyResponseRecovery, } from "../../src/framework/conversation-runner.js";
5
+ export { ConversationRunner, DEFAULT_CONVERSATION_POLICY, DEFAULT_EMPTY_HISTORY_SEED, DEFAULT_EMPTY_RESPONSE_RECOVERY, DEFAULT_MAX_AGENT_ROUNDS, EmptyModelResponseError, assertEmptyResponseRetries, assertMaxAgentRounds, type ConversationPolicy, type ConversationRunResult, type EmptyResponseRecovery, } from "../../src/framework/conversation-runner.js";
6
6
  export { describeStopReason, isRetryableStopReason, modelStopReason, type ModelStopCategory, type ModelStopReason, } from "../../src/framework/model-stop-reason.js";
7
7
  export { currentTurnContext, currentTurnSignal, withTurnContext, type TurnContext, } from "../../src/framework/turn-context.js";
8
- export { type ConversationToolResultBuilder } from "../../src/framework/conversation-tool-result.js";
8
+ export { direct, directTo, finish, go, isToolResponse, stay, type ToolResponse, type ToolResponseBuilder, type ToolResponseKind, } from "../../src/framework/tool-response.js";
9
9
  export { GraphStateSupport } from "../../src/framework/graph-state-support.js";
10
10
  export { GRAPH_END_NODE, createGraphStateAnnotation, type GraphState, } from "../../src/framework/graph-state.js";
11
11
  export { GraphRegistry, type RegisteredGraph, } from "../../src/framework/graph-registry.js";
@@ -13,15 +13,21 @@ export { GraphEngine, type GraphConstructor, type GraphEngineCreateOptions, type
13
13
  export { ConfigManager, type ConfigManagerOptions, } from "../../src/framework/config-manager.js";
14
14
  export { StateGraphExt, type CurrentNodeBranchOptions, type CurrentNodeSelector, type GraphEndpoint, type GraphNodeClass, type GraphNodeFactory, type RegisteredNode, } from "../../src/framework/state-graph-ext.js";
15
15
  export { TerminateSessionNode } from "../../src/framework/terminate-session.node.js";
16
- export { SessionLogError, SessionLogWarning, createSessionLogs, withSessionLogs, type SessionLogEntry, type SessionLogs, } from "../../src/framework/session-log.js";
16
+ export { SessionLogError, SessionLogDecision, SessionLogWarning, createSessionLogs, drainSessionLogs, restoreSessionLogs, withSessionLogs, type DecisionAuditEntry, type DecisionAuditInput, type DecisionAuditOutcome, type SessionLogEntry, type SessionLogs, } from "../../src/framework/session-log.js";
17
17
  export { ProviderFileManager, type LlmFile, } from "../../src/framework/llm-file.js";
18
18
  export { SessionManager, SessionTurnError, SESSION_BUSY, SESSION_CONFLICT, SESSION_COMPLETED, SESSION_DOCUMENT_VERSION, MemorySessionDocumentContainer, sessionTurnLeaseMs, sessionRevision, isLiveSessionTurn, matchesSessionWritePredicate, type SessionGraphMetadata, type SessionGraphDocument, type SessionGraphStatus, type SessionDocument, type SessionDocumentContainer, type SessionTurnLease, type SessionTurnCode, type SessionWritePredicate, type SessionWriteResult, type SessionWriteOptions, type BeginTurnResult, } from "../../src/framework/persistence/session-manager.js";
19
19
  export { MongoDbSessionDocumentContainer } from "../../src/framework/persistence/mongodb-session-document.container.js";
20
20
  export { SqliteSessionDocumentContainer } from "../../src/framework/persistence/sqlite-session-document.container.js";
21
21
  export { CosmosSessionDocumentContainer } from "../../src/framework/persistence/cosmos-session-document.container.js";
22
- export { mergeNodeStates, type GraphNodeStates, type NodeStateValue, } from "../../src/framework/node-state.js";
22
+ export { mergeNodeStates, replaceNodeStates, type GraphNodeStates, type NodeStateValue, } from "../../src/framework/node-state.js";
23
23
  export { LangChainLlmGateway, type LangChainLlmGatewayOptions, } from "../../src/framework/langchain-llm-gateway.js";
24
24
  export { ModelProvider, type BuiltInModelProviderConfigs, type CustomModelProviderOptions, type ModelProviderRuntimeConfig, type RegisteredModelProviderAdapter, } from "../../src/framework/model-provider.js";
25
25
  export { langChainModelInitialization, type LangChainModelInitialization, } from "../../src/framework/langchain-provider.adapter.js";
26
26
  export { GRAPH_LLM_PROVIDERS, GRAPH_LLM_FAMILIES, GRAPH_LLM_CAPABILITIES, BUILT_IN_MODEL_CATALOG, GraphLlm, ModelCatalog, ModelProviderRegistry, type BuiltInGraphLlmConfig, type BuiltInModelId, type BuiltInModelParameters, type CommonModelParameters, type GraphLlmConfig, type GraphLlmConfigOverride, type GraphLlmCapability, type GraphLlmFamily, type GraphLlmModelMetadata, type GraphLlmParameters, type GraphLlmProvider, type GraphLlmRequiredCapabilities, type ModelCatalogDocument, type ModelParameterProfile, type ModelProviderAdapter, type ModelProviderInitialization, type OpenAIAuthReasoningParameters, type RuntimeGraphLlmConfig, } from "../../src/framework/graph-llm.config.js";
27
27
  export { addTokenUsage, emptyTokenUsage, modelExecution, normalizeTokenUsage, tokenUsageFromMessage, type ModelExecution, type ModelResult, type TokenUsage, } from "../../src/framework/token-usage.js";
28
+ export { DecisionNode, } from "../../src/framework/decision/decision-node.js";
29
+ export { DecisionRunner, type DecisionRunOptions, } from "../../src/framework/decision/decision-runner.js";
30
+ export { DecisionProvider, DecisionProviderRegistry, type BuiltinDecisionProviderConfigs, } from "../../src/framework/decision/decision-provider.js";
31
+ export { TypeSafeClassifierAdapter, type TypeSafeProviderOptions, } from "../../src/framework/decision/typesafe-provider.js";
32
+ export { DecisionConfigurationError, DecisionTimeoutError, DecisionValidationError, DEFAULT_DECISION_OPTIONS, addDecisionUsage, decisionUsage, emptyDecisionUsage, normalizeDecisionUsage, resolveDecisionOptions, type Choice, type ChoiceAnswer, type DecisionAnswer, type DecisionAnswers, type DecisionCallOptions, type DecisionContext, type DecisionConversation, type DecisionEvidence, type DecisionErrorContext, type DecisionFailure, type DecisionMetadata, type DecisionOptions, type DecisionProviderAdapter, type DecisionQuestion, type DecisionQuestionMap, type DecisionRequest, type DecisionResult, type DecisionState, type DecisionTokenUsage, type DecisionUsage, type JsonObject, type JsonPrimitive, type JsonValue, type Noul, type NoulAnswer, type ResolvedDecisionOptions, type Score, type ScoreAnswer, } from "../../src/framework/decision/decision-types.js";
33
+ export { assertJsonCompatible, validateDecisionQuestions, validateDecisionResult, } from "../../src/framework/decision/decision-validation.js";
@@ -1,2 +1,3 @@
1
1
  export { ScriptedGateway, SCRIPTED_MODEL, SCRIPTED_TOKEN_USAGE, scriptedGateway, type ScriptedCall, } from "../../src/testing/scripted-gateway.js";
2
2
  export { createTurnHarness, type HarnessTurn, type TurnHarness, } from "../../src/testing/turn-harness.js";
3
+ export { ScriptedDecisions, scriptedDecisions, type ScriptedDecisionCall, } from "../../src/testing/scripted-decisions.js";