@treasuredata/tdx 0.8.1 → 0.8.2

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 (113) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/client/cdp-api-client.js +1 -1
  8. package/dist/client/engage-api-client.js +1 -1
  9. package/dist/client/http-client.js +1 -1
  10. package/dist/client/llm-api-client.js +1 -1
  11. package/dist/client/rate-limiter.js +1 -1
  12. package/dist/client/td-api-client.js +1 -1
  13. package/dist/client/trino-api-client.js +1 -1
  14. package/dist/client/workflow-client.js +1 -1
  15. package/dist/commands/activations.js +1 -1
  16. package/dist/commands/api-command.js +1 -1
  17. package/dist/commands/auth-command.js +1 -1
  18. package/dist/commands/chat-command.js +1 -1
  19. package/dist/commands/claude-command.d.ts.map +1 -1
  20. package/dist/commands/claude-command.js +1 -1
  21. package/dist/commands/claude-command.js.map +1 -1
  22. package/dist/commands/claude-statusline-command.js +1 -1
  23. package/dist/commands/claude-usage-command.js +1 -1
  24. package/dist/commands/command.js +1 -1
  25. package/dist/commands/connection-command.js +1 -1
  26. package/dist/commands/context-command.js +1 -1
  27. package/dist/commands/databases.js +1 -1
  28. package/dist/commands/describe.js +1 -1
  29. package/dist/commands/engage-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/llm-proxy.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profiles-command.js +1 -1
  35. package/dist/commands/query-command.js +1 -1
  36. package/dist/commands/segment-command.js +1 -1
  37. package/dist/commands/segment-create-command.js +1 -1
  38. package/dist/commands/segment-fields-command.js +1 -1
  39. package/dist/commands/segment-pull-command.js +1 -1
  40. package/dist/commands/segment-push-command.js +1 -1
  41. package/dist/commands/segment-update-command.js +1 -1
  42. package/dist/commands/segment-use-command.js +1 -1
  43. package/dist/commands/segments.js +1 -1
  44. package/dist/commands/show.js +1 -1
  45. package/dist/commands/tables.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/config.js +1 -1
  51. package/dist/core/connection-cache.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/core/user-cache.js +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/proxy/anthropic-adapter.js +1 -1
  61. package/dist/proxy/claude-usage-tracker.js +1 -1
  62. package/dist/proxy/context-signature.js +1 -1
  63. package/dist/proxy/conversation-utils.js +1 -1
  64. package/dist/proxy/server.js +1 -1
  65. package/dist/proxy/session-cache.js +1 -1
  66. package/dist/sdk/api.js +1 -1
  67. package/dist/sdk/connection.js +1 -1
  68. package/dist/sdk/engage.js +1 -1
  69. package/dist/sdk/errors.js +1 -1
  70. package/dist/sdk/index.js +1 -1
  71. package/dist/sdk/job.js +1 -1
  72. package/dist/sdk/llm.js +1 -1
  73. package/dist/sdk/query.js +1 -1
  74. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  75. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  76. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  77. package/dist/sdk/segment.js +1 -1
  78. package/dist/sdk/user.js +1 -1
  79. package/dist/sdk/workflow.js +1 -1
  80. package/dist/types/endpoints.js +1 -1
  81. package/dist/types/index.js +1 -1
  82. package/dist/utils/agent-ref-parser.js +1 -1
  83. package/dist/utils/async.js +1 -1
  84. package/dist/utils/chat-cache.js +1 -1
  85. package/dist/utils/colors.js +1 -1
  86. package/dist/utils/command-output.js +1 -1
  87. package/dist/utils/constants.js +1 -1
  88. package/dist/utils/diff.js +1 -1
  89. package/dist/utils/fields-display.js +1 -1
  90. package/dist/utils/file-permissions.js +1 -1
  91. package/dist/utils/format-detector.js +1 -1
  92. package/dist/utils/formatters.js +1 -1
  93. package/dist/utils/json-loader.js +1 -1
  94. package/dist/utils/llm-backup-utils.js +1 -1
  95. package/dist/utils/model-aliases.js +1 -1
  96. package/dist/utils/model-factors.js +1 -1
  97. package/dist/utils/option-validation.js +1 -1
  98. package/dist/utils/port.js +1 -1
  99. package/dist/utils/process.js +1 -1
  100. package/dist/utils/prompt.js +1 -1
  101. package/dist/utils/segment-path-parser.js +1 -1
  102. package/dist/utils/segment-ref-parser.js +1 -1
  103. package/dist/utils/spinner.js +1 -1
  104. package/dist/utils/sql-parser.js +1 -1
  105. package/dist/utils/sse-parser.js +1 -1
  106. package/dist/utils/string-utils.js +1 -1
  107. package/dist/utils/table-ref-parser.js +1 -1
  108. package/dist/utils/tdx-config.js +1 -1
  109. package/dist/utils/tdx-logger.js +1 -1
  110. package/dist/utils/tree-formatter.js +1 -1
  111. package/dist/utils/version-check.js +1 -1
  112. package/dist/utils/workflow-utils.js +1 -1
  113. package/package.json +1 -1
@@ -1 +1 @@
1
- function a56_0x43f3(){const _0x1b6645=['1025526fkfrRt','stringify','name','3267126XnxKQv','input_schema','sort','map','required','hex','localeCompare','filter','keys','4139674pNGhEc','3rSHHWO','1460761tnXHIV','properties','80upnrCR','2660ruLKcx','3077646vyeBhZ','2096tFsRRx','2096984AIneOM','sha256','substring'];a56_0x43f3=function(){return _0x1b6645;};return a56_0x43f3();}(function(_0x2c8305,_0x285ca0){const _0x4371b8=a56_0x2791,_0x387e26=_0x2c8305();while(!![]){try{const _0x9b0281=-parseInt(_0x4371b8(0x1bf))/0x1+parseInt(_0x4371b8(0x1b1))/0x2*(parseInt(_0x4371b8(0x1be))/0x3)+-parseInt(_0x4371b8(0x1c4))/0x4*(parseInt(_0x4371b8(0x1c2))/0x5)+-parseInt(_0x4371b8(0x1c3))/0x6+-parseInt(_0x4371b8(0x1bd))/0x7+parseInt(_0x4371b8(0x1c5))/0x8+-parseInt(_0x4371b8(0x1b4))/0x9*(-parseInt(_0x4371b8(0x1c1))/0xa);if(_0x9b0281===_0x285ca0)break;else _0x387e26['push'](_0x387e26['shift']());}catch(_0x380368){_0x387e26['push'](_0x387e26['shift']());}}}(a56_0x43f3,0xcbe4a));import{createHash}from'crypto';import{extractModelAlias,resolveModelAlias}from'../utils/model-aliases.js';function a56_0x2791(_0x650ee,_0x5f54b5){_0x650ee=_0x650ee-0x1b1;const _0x43f3a6=a56_0x43f3();let _0x27916c=_0x43f3a6[_0x650ee];return _0x27916c;}export function calculateContextSignature(_0x100da9,_0x1d665b,_0x42dda5,_0x66ad68){const _0x29e9f7=a56_0x2791,_0x314c70=extractModelAlias(_0x100da9),_0xea21b3=resolveModelAlias(_0x314c70),_0x2daeba=[..._0x1d665b||[]][_0x29e9f7(0x1b6)](),_0x4786af=(_0x42dda5||[])[_0x29e9f7(0x1bb)](_0x3f216b=>_0x3f216b!=null)[_0x29e9f7(0x1b7)](_0x2bddc3=>({'name':_0x2bddc3['name'],'params':Object[_0x29e9f7(0x1bc)](_0x2bddc3[_0x29e9f7(0x1b5)]?.[_0x29e9f7(0x1c0)]||{})[_0x29e9f7(0x1b6)](),'required':(_0x2bddc3[_0x29e9f7(0x1b5)]?.[_0x29e9f7(0x1b8)]||[])[_0x29e9f7(0x1b6)]()}))[_0x29e9f7(0x1b6)]((_0x185611,_0x52eb7b)=>_0x185611['name'][_0x29e9f7(0x1ba)](_0x52eb7b[_0x29e9f7(0x1b3)])),_0x8d2b7a=JSON[_0x29e9f7(0x1b2)]({'model':_0xea21b3,'prompts':_0x2daeba,'tools':_0x4786af,'reasoning':_0x66ad68});return createHash(_0x29e9f7(0x1c6))['update'](_0x8d2b7a)['digest'](_0x29e9f7(0x1b9))[_0x29e9f7(0x1c7)](0x0,0x10);}
1
+ (function(_0x36c026,_0x2688d3){const _0x57e29f=a56_0x1263,_0x19b565=_0x36c026();while(!![]){try{const _0x19f434=parseInt(_0x57e29f(0x120))/0x1+-parseInt(_0x57e29f(0x12a))/0x2+-parseInt(_0x57e29f(0x130))/0x3*(parseInt(_0x57e29f(0x12b))/0x4)+-parseInt(_0x57e29f(0x121))/0x5*(-parseInt(_0x57e29f(0x11d))/0x6)+parseInt(_0x57e29f(0x12d))/0x7*(-parseInt(_0x57e29f(0x129))/0x8)+-parseInt(_0x57e29f(0x11e))/0x9+-parseInt(_0x57e29f(0x12e))/0xa*(-parseInt(_0x57e29f(0x125))/0xb);if(_0x19f434===_0x2688d3)break;else _0x19b565['push'](_0x19b565['shift']());}catch(_0x36c44d){_0x19b565['push'](_0x19b565['shift']());}}}(a56_0xb0d5,0x33ab8));import{createHash}from'crypto';import{extractModelAlias,resolveModelAlias}from'../utils/model-aliases.js';function a56_0x1263(_0x52c443,_0x57d4c5){_0x52c443=_0x52c443-0x11c;const _0xb0d5e4=a56_0xb0d5();let _0x12636c=_0xb0d5e4[_0x52c443];return _0x12636c;}export function calculateContextSignature(_0x278b5e,_0x2546f3,_0x2bf12f,_0x262c4b){const _0x3965ac=a56_0x1263,_0x1feb47=extractModelAlias(_0x278b5e),_0x34466c=resolveModelAlias(_0x1feb47),_0xe1baa7=[..._0x2546f3||[]][_0x3965ac(0x11f)](),_0x29706a=(_0x2bf12f||[])['filter'](_0x3ab953=>_0x3ab953!=null)[_0x3965ac(0x128)](_0x1ee616=>({'name':_0x1ee616[_0x3965ac(0x122)],'params':Object[_0x3965ac(0x12c)](_0x1ee616[_0x3965ac(0x126)]?.[_0x3965ac(0x12f)]||{})[_0x3965ac(0x11f)](),'required':(_0x1ee616['input_schema']?.['required']||[])[_0x3965ac(0x11f)]()}))[_0x3965ac(0x11f)]((_0x3b0ef4,_0x47f09b)=>_0x3b0ef4[_0x3965ac(0x122)][_0x3965ac(0x123)](_0x47f09b[_0x3965ac(0x122)])),_0x10aee0=JSON['stringify']({'model':_0x34466c,'prompts':_0xe1baa7,'tools':_0x29706a,'reasoning':_0x262c4b});return createHash('sha256')[_0x3965ac(0x124)](_0x10aee0)[_0x3965ac(0x127)]('hex')[_0x3965ac(0x11c)](0x0,0x10);}function a56_0xb0d5(){const _0x46c600=['7910aDkdvE','name','localeCompare','update','11vqZMoJ','input_schema','digest','map','8EbeMyv','443480KAzAli','4zfQbgE','keys','708806NmNzVQ','5919070sRpThl','properties','437772ZGUIWn','substring','318NhxyBZ','3521016YgLkdg','sort','396033AjQjQo'];a56_0xb0d5=function(){return _0x46c600;};return a56_0xb0d5();}
@@ -1 +1 @@
1
- function a57_0x506c(_0x51692e,_0x84a1a7){_0x51692e=_0x51692e-0x1c3;const _0x1bd3fe=a57_0x1bd3();let _0x506c6a=_0x1bd3fe[_0x51692e];return _0x506c6a;}(function(_0x4c6756,_0x4f9d16){const _0x39d72d=a57_0x506c,_0xf2757d=_0x4c6756();while(!![]){try{const _0x303a8e=parseInt(_0x39d72d(0x1e1))/0x1+-parseInt(_0x39d72d(0x1d2))/0x2*(-parseInt(_0x39d72d(0x1da))/0x3)+-parseInt(_0x39d72d(0x1cb))/0x4+-parseInt(_0x39d72d(0x1ca))/0x5*(-parseInt(_0x39d72d(0x1d1))/0x6)+parseInt(_0x39d72d(0x1d6))/0x7+-parseInt(_0x39d72d(0x1e7))/0x8+parseInt(_0x39d72d(0x1e8))/0x9*(-parseInt(_0x39d72d(0x1cd))/0xa);if(_0x303a8e===_0x4f9d16)break;else _0xf2757d['push'](_0xf2757d['shift']());}catch(_0x258081){_0xf2757d['push'](_0xf2757d['shift']());}}}(a57_0x1bd3,0xc8860));export function formatConversationHistory(_0x327f59){const _0x1c24d6=a57_0x506c;if(!_0x327f59||!Array[_0x1c24d6(0x1d8)](_0x327f59))return'';const _0x106622=_0x327f59[_0x1c24d6(0x1e5)](_0x3281d0=>_0x3281d0!=null)[_0x1c24d6(0x1e3)](_0x25ffac=>{const _0x102cb6=_0x1c24d6,_0x50afc3=[],_0x1fe5eb=[];if(_0x25ffac[_0x102cb6(0x1d5)]!=null&&Array[_0x102cb6(0x1d8)](_0x25ffac[_0x102cb6(0x1d5)]))for(const _0x24a56c of _0x25ffac[_0x102cb6(0x1d5)]){if(!_0x24a56c)continue;if(_0x24a56c[_0x102cb6(0x1cc)]===_0x102cb6(0x1d3)&&_0x24a56c[_0x102cb6(0x1d3)])_0x50afc3['push'](_0x24a56c[_0x102cb6(0x1d3)]);else{if(_0x24a56c['type']==='tool_use'&&_0x24a56c[_0x102cb6(0x1e6)]){const _0x4784c5=_0x24a56c[_0x102cb6(0x1db)]?JSON[_0x102cb6(0x1e4)](_0x24a56c['input']):'{}';_0x1fe5eb[_0x102cb6(0x1c8)](_0x102cb6(0x1c7)+_0x24a56c[_0x102cb6(0x1e6)]+'\x22\x20id=\x22'+(_0x24a56c['id']||_0x102cb6(0x1c3))+_0x102cb6(0x1c9)+_0x4784c5);}else{if(_0x24a56c[_0x102cb6(0x1cc)]==='tool_result'&&_0x24a56c['tool_use_id']){let _0x17f86e='';if(typeof _0x24a56c[_0x102cb6(0x1d5)]==='string')_0x17f86e=_0x24a56c[_0x102cb6(0x1d5)];else _0x24a56c[_0x102cb6(0x1d5)]!=null&&Array[_0x102cb6(0x1d8)](_0x24a56c[_0x102cb6(0x1d5)])&&(_0x17f86e=_0x24a56c[_0x102cb6(0x1d5)][_0x102cb6(0x1e5)](_0x207b18=>_0x207b18&&_0x207b18[_0x102cb6(0x1cc)]===_0x102cb6(0x1d3)&&_0x207b18[_0x102cb6(0x1d3)])[_0x102cb6(0x1e3)](_0x163f3f=>_0x163f3f[_0x102cb6(0x1d3)])[_0x102cb6(0x1df)]('\x0a'));const _0x45befc=_0x24a56c[_0x102cb6(0x1c5)]?_0x102cb6(0x1de):'';_0x1fe5eb[_0x102cb6(0x1c8)](_0x102cb6(0x1c4)+_0x24a56c['tool_use_id']+'\x22'+_0x45befc+']\x0a'+_0x17f86e);}}}}else typeof _0x25ffac[_0x102cb6(0x1d5)]===_0x102cb6(0x1dd)&&_0x25ffac[_0x102cb6(0x1d5)]&&_0x50afc3[_0x102cb6(0x1c8)](_0x25ffac[_0x102cb6(0x1d5)]);if(_0x50afc3[_0x102cb6(0x1d0)]===0x0&&_0x1fe5eb[_0x102cb6(0x1d0)]===0x0)return null;const _0x1b704c=_0x25ffac['role']===_0x102cb6(0x1c6)?_0x102cb6(0x1d4):_0x102cb6(0x1d7),_0x234e75=[];return(_0x50afc3[_0x102cb6(0x1d0)]>0x0||_0x25ffac[_0x102cb6(0x1ce)]===_0x102cb6(0x1dc)&&_0x1fe5eb[_0x102cb6(0x1d0)]>0x0)&&_0x234e75['push'](_0x1b704c+'\x0a'+_0x50afc3[_0x102cb6(0x1df)]('\x0a\x0a')),_0x234e75['push'](..._0x1fe5eb),_0x234e75[_0x102cb6(0x1df)]('\x0a\x0a');})[_0x1c24d6(0x1e5)](_0x2b37bb=>_0x2b37bb!=null&&_0x2b37bb['length']>0x0)['join']('\x0a\x0a');return _0x106622?_0x106622+_0x1c24d6(0x1d9):'';}export function calculateConversationDelta(_0x1737f2,_0x5ae560){const _0xf3c68b=a57_0x506c;if(_0x5ae560['length']===0x0)return _0x1737f2;const _0x5811dd=_0x5ae560[_0xf3c68b(0x1d0)];return _0x1737f2['slice'](_0x5811dd);}export function extractLastUserMessage(_0x12e968,_0x24066d){const _0x60ecf4=a57_0x506c;let _0x4968c6=_0x12e968['filter'](_0x57cd3c=>_0x57cd3c['role']===_0x60ecf4(0x1c6))[_0x60ecf4(0x1e0)]();if(!_0x4968c6){_0x4968c6=_0x24066d[_0x60ecf4(0x1e5)](_0x100b1d=>_0x100b1d[_0x60ecf4(0x1ce)]===_0x60ecf4(0x1c6))[_0x60ecf4(0x1e0)]();if(!_0x4968c6)return{'message':null,'text':null,'error':_0x60ecf4(0x1e2)};}if(typeof _0x4968c6[_0x60ecf4(0x1d5)]==='string')return{'message':_0x4968c6,'text':_0x4968c6[_0x60ecf4(0x1d5)],'error':null};if(_0x4968c6[_0x60ecf4(0x1d5)]!=null&&Array['isArray'](_0x4968c6['content'])){const _0x14f3cf=_0x4968c6[_0x60ecf4(0x1d5)][_0x60ecf4(0x1e5)](_0x498c2f=>_0x498c2f&&_0x498c2f[_0x60ecf4(0x1cc)]===_0x60ecf4(0x1d3)&&_0x498c2f[_0x60ecf4(0x1d3)])[_0x60ecf4(0x1e3)](_0x4a4ff2=>_0x4a4ff2[_0x60ecf4(0x1d3)])[_0x60ecf4(0x1df)]('\x0a');return{'message':_0x4968c6,'text':_0x14f3cf,'error':null};}return{'message':_0x4968c6,'text':null,'error':_0x60ecf4(0x1cf)+typeof _0x4968c6['content']+'\x20'+_0x4968c6['content']};}function a57_0x1bd3(){const _0x2ac06b=['1198656WscBYs','5873643SVwRDf','unknown','[tool_result\x20tool_use_id=\x22','is_error','user','[tool_use\x20name=\x22','push','\x22]\x0a','5YxqCYi','2950776nhzlox','type','30vuiXwF','role','message.content\x20must\x20be\x20a\x20string\x20or\x20array,\x20got:\x20','length','7231944KBBANh','8442fJneXA','text','[user]','content','9737756phJQam','[assistant]','isArray','\x0a\x0a[chat\x20history\x20end]','441VQvsUL','input','assistant','string','\x20error=\x22true\x22','join','pop','449832wAbFOY','No\x20user\x20message\x20found\x20in\x20request','map','stringify','filter','name'];a57_0x1bd3=function(){return _0x2ac06b;};return a57_0x1bd3();}
1
+ (function(_0x26db2d,_0x6de9fc){const _0x3e5d6b=a57_0x4762,_0x4e10a1=_0x26db2d();while(!![]){try{const _0x49afea=-parseInt(_0x3e5d6b(0x1e9))/0x1*(parseInt(_0x3e5d6b(0x1f5))/0x2)+-parseInt(_0x3e5d6b(0x1f9))/0x3+-parseInt(_0x3e5d6b(0x1f3))/0x4*(parseInt(_0x3e5d6b(0x211))/0x5)+parseInt(_0x3e5d6b(0x1fe))/0x6*(parseInt(_0x3e5d6b(0x1ef))/0x7)+-parseInt(_0x3e5d6b(0x204))/0x8*(parseInt(_0x3e5d6b(0x1e8))/0x9)+parseInt(_0x3e5d6b(0x1ff))/0xa*(parseInt(_0x3e5d6b(0x20f))/0xb)+parseInt(_0x3e5d6b(0x1fc))/0xc*(parseInt(_0x3e5d6b(0x1e7))/0xd);if(_0x49afea===_0x6de9fc)break;else _0x4e10a1['push'](_0x4e10a1['shift']());}catch(_0x4fe95e){_0x4e10a1['push'](_0x4e10a1['shift']());}}}(a57_0x531b,0x433f0));function a57_0x4762(_0x5e38fd,_0x5421c5){_0x5e38fd=_0x5e38fd-0x1e7;const _0x531b90=a57_0x531b();let _0x476262=_0x531b90[_0x5e38fd];return _0x476262;}function a57_0x531b(){const _0x3f085c=['message.content\x20must\x20be\x20a\x20string\x20or\x20array,\x20got:\x20','assistant','6881VuJjVB','length','role','[user]','4IiPAYD','push','52IJmdxe','[assistant]','stringify','unknown','1234905Quavnr','join','isArray','4466808ZOkyVa','[tool_use\x20name=\x22','2274RFEkWR','10NhMZEf','text','\x22]\x0a','content','slice','1418384KQaIBo','user','tool_use_id','map','string','No\x20user\x20message\x20found\x20in\x20request','input','tool_result','name','pop','tool_use','5548213EZkonF','\x22\x20id=\x22','1283155IvZOKi','26OfKTXv','27iLXPoS','5608Cvkemv','type','[tool_result\x20tool_use_id=\x22','filter'];a57_0x531b=function(){return _0x3f085c;};return a57_0x531b();}export function formatConversationHistory(_0x8d9f3d){const _0x52e256=a57_0x4762;if(!_0x8d9f3d||!Array[_0x52e256(0x1fb)](_0x8d9f3d))return'';const _0x55b218=_0x8d9f3d[_0x52e256(0x1ec)](_0x255881=>_0x255881!=null)[_0x52e256(0x207)](_0x22f811=>{const _0x14f6f0=_0x52e256,_0x8172bf=[],_0x4849bc=[];if(_0x22f811[_0x14f6f0(0x202)]!=null&&Array['isArray'](_0x22f811[_0x14f6f0(0x202)]))for(const _0x3ae9ac of _0x22f811[_0x14f6f0(0x202)]){if(!_0x3ae9ac)continue;if(_0x3ae9ac[_0x14f6f0(0x1ea)]===_0x14f6f0(0x200)&&_0x3ae9ac[_0x14f6f0(0x200)])_0x8172bf[_0x14f6f0(0x1f4)](_0x3ae9ac[_0x14f6f0(0x200)]);else{if(_0x3ae9ac['type']===_0x14f6f0(0x20e)&&_0x3ae9ac['name']){const _0x363df1=_0x3ae9ac[_0x14f6f0(0x20a)]?JSON[_0x14f6f0(0x1f7)](_0x3ae9ac[_0x14f6f0(0x20a)]):'{}';_0x4849bc['push'](_0x14f6f0(0x1fd)+_0x3ae9ac[_0x14f6f0(0x20c)]+_0x14f6f0(0x210)+(_0x3ae9ac['id']||_0x14f6f0(0x1f8))+_0x14f6f0(0x201)+_0x363df1);}else{if(_0x3ae9ac[_0x14f6f0(0x1ea)]===_0x14f6f0(0x20b)&&_0x3ae9ac[_0x14f6f0(0x206)]){let _0x2f592c='';if(typeof _0x3ae9ac[_0x14f6f0(0x202)]===_0x14f6f0(0x208))_0x2f592c=_0x3ae9ac[_0x14f6f0(0x202)];else _0x3ae9ac[_0x14f6f0(0x202)]!=null&&Array[_0x14f6f0(0x1fb)](_0x3ae9ac[_0x14f6f0(0x202)])&&(_0x2f592c=_0x3ae9ac['content'][_0x14f6f0(0x1ec)](_0x5b9981=>_0x5b9981&&_0x5b9981[_0x14f6f0(0x1ea)]===_0x14f6f0(0x200)&&_0x5b9981[_0x14f6f0(0x200)])[_0x14f6f0(0x207)](_0x702919=>_0x702919[_0x14f6f0(0x200)])[_0x14f6f0(0x1fa)]('\x0a'));const _0x1c1bd2=_0x3ae9ac['is_error']?'\x20error=\x22true\x22':'';_0x4849bc[_0x14f6f0(0x1f4)](_0x14f6f0(0x1eb)+_0x3ae9ac[_0x14f6f0(0x206)]+'\x22'+_0x1c1bd2+']\x0a'+_0x2f592c);}}}}else typeof _0x22f811[_0x14f6f0(0x202)]===_0x14f6f0(0x208)&&_0x22f811[_0x14f6f0(0x202)]&&_0x8172bf[_0x14f6f0(0x1f4)](_0x22f811[_0x14f6f0(0x202)]);if(_0x8172bf['length']===0x0&&_0x4849bc['length']===0x0)return null;const _0x5e6652=_0x22f811[_0x14f6f0(0x1f1)]===_0x14f6f0(0x205)?_0x14f6f0(0x1f2):_0x14f6f0(0x1f6),_0x51927c=[];return(_0x8172bf[_0x14f6f0(0x1f0)]>0x0||_0x22f811[_0x14f6f0(0x1f1)]===_0x14f6f0(0x1ee)&&_0x4849bc[_0x14f6f0(0x1f0)]>0x0)&&_0x51927c['push'](_0x5e6652+'\x0a'+_0x8172bf[_0x14f6f0(0x1fa)]('\x0a\x0a')),_0x51927c[_0x14f6f0(0x1f4)](..._0x4849bc),_0x51927c['join']('\x0a\x0a');})[_0x52e256(0x1ec)](_0x17f791=>_0x17f791!=null&&_0x17f791['length']>0x0)[_0x52e256(0x1fa)]('\x0a\x0a');return _0x55b218?_0x55b218+'\x0a\x0a[chat\x20history\x20end]':'';}export function calculateConversationDelta(_0x3fa1b6,_0x498290){const _0x4b0a60=a57_0x4762;if(_0x498290[_0x4b0a60(0x1f0)]===0x0)return _0x3fa1b6;const _0x2c5553=_0x498290[_0x4b0a60(0x1f0)];return _0x3fa1b6[_0x4b0a60(0x203)](_0x2c5553);}export function extractLastUserMessage(_0x4a54fb,_0x79eb00){const _0x29a154=a57_0x4762;let _0x38fd3a=_0x4a54fb[_0x29a154(0x1ec)](_0x20e047=>_0x20e047[_0x29a154(0x1f1)]===_0x29a154(0x205))[_0x29a154(0x20d)]();if(!_0x38fd3a){_0x38fd3a=_0x79eb00['filter'](_0x33b4eb=>_0x33b4eb['role']===_0x29a154(0x205))[_0x29a154(0x20d)]();if(!_0x38fd3a)return{'message':null,'text':null,'error':_0x29a154(0x209)};}if(typeof _0x38fd3a[_0x29a154(0x202)]==='string')return{'message':_0x38fd3a,'text':_0x38fd3a[_0x29a154(0x202)],'error':null};if(_0x38fd3a[_0x29a154(0x202)]!=null&&Array[_0x29a154(0x1fb)](_0x38fd3a[_0x29a154(0x202)])){const _0x1bce73=_0x38fd3a[_0x29a154(0x202)]['filter'](_0x26160f=>_0x26160f&&_0x26160f[_0x29a154(0x1ea)]===_0x29a154(0x200)&&_0x26160f[_0x29a154(0x200)])[_0x29a154(0x207)](_0xcd49d2=>_0xcd49d2[_0x29a154(0x200)])['join']('\x0a');return{'message':_0x38fd3a,'text':_0x1bce73,'error':null};}return{'message':_0x38fd3a,'text':null,'error':_0x29a154(0x1ed)+typeof _0x38fd3a[_0x29a154(0x202)]+'\x20'+_0x38fd3a[_0x29a154(0x202)]};}
@@ -1 +1 @@
1
- const a58_0x4133b9=a58_0x3269;(function(_0x299b6e,_0x4f26e6){const _0x36f4cb=a58_0x3269,_0x690ee1=_0x299b6e();while(!![]){try{const _0x3118e9=-parseInt(_0x36f4cb(0x230))/0x1*(parseInt(_0x36f4cb(0x1df))/0x2)+parseInt(_0x36f4cb(0x21b))/0x3*(parseInt(_0x36f4cb(0x1c8))/0x4)+-parseInt(_0x36f4cb(0x1f6))/0x5+-parseInt(_0x36f4cb(0x232))/0x6*(-parseInt(_0x36f4cb(0x1dc))/0x7)+parseInt(_0x36f4cb(0x222))/0x8*(-parseInt(_0x36f4cb(0x200))/0x9)+-parseInt(_0x36f4cb(0x207))/0xa*(-parseInt(_0x36f4cb(0x1d9))/0xb)+parseInt(_0x36f4cb(0x254))/0xc;if(_0x3118e9===_0x4f26e6)break;else _0x690ee1['push'](_0x690ee1['shift']());}catch(_0x8f71ca){_0x690ee1['push'](_0x690ee1['shift']());}}}(a58_0x4b50,0xd6628));import a58_0x14a315 from'fastify';import a58_0x3e7426 from'@fastify/cors';function a58_0x4b50(){const _0x210c12=['x-api-key','...\x22','header:\x20','0.0.0.0','Stream\x20complete.\x20Sent\x20','delete','api_error','System\x20prompts:\x20','url','\x20->\x20','metadata','sessionCache','unknown','size','6567052uLgHku','Added\x20tool\x20names:','new\x20system\x20prompt(s)','send','embeddedSystemPrompts','thinking','post','Failed\x20to\x20start\x20proxy\x20server:\x20','output_tokens','validateMessageRequest','dev-us01',',\x20context=','stringify','\x20(reasoning:\x20','Started\x20cache\x20cleanup\x20interval\x20(runs\x20every\x20','text/event-stream',']\x20Building\x20a\x20new\x20context\x20for\x20model\x20','2422981slolPE',',\x20context:\x20','handleCountTokens','11858JuTfOj','tools','Embedded\x20in\x20chat\x20-\x20system\x20prompts:\x20','22dMLRbt','[CONTEXT\x20LENGTH\x20ERROR]\x20',']\x20model:\x20','join','debug','isUserError','Model\x20normalization:\x20','llm','Failed\x20to\x20reconstruct\x20message\x20-\x20all\x20parts\x20are\x20empty,\x20using\x20fallback','Including\x20tool\x20results','user_id','catch','server','projectId','\x20chars.\x20Cleared\x20chat\x20state\x20for\x20session\x20','model','/v1/messages/count_tokens','[PROXY\x20ERROR]\x20Unhandled\x20error\x20in\x20','POST','getAgentForModel','Chat\x20ID:\x20','[PROXY\x20ERROR]\x20Non-streaming\x20responses\x20are\x20not\x20yet\x20supported',':\x20messages=','5220335PzHhOx','set',',\x20model=','Reset\x20chat\x20ID\x20to\x20recover\x20on\x20next\x20request','profile','code','Creating/looking\x20up\x20agent\x20for:\x20','substring','messageHistory','clear','13005FurmWe','body','cleanupExpiredChats','cleanupInterval','stream',',\x20\x22','Failed\x20to\x20create\x20chat,\x20will\x20fall\x20back\x20to\x20lazy\x20creation:','10PZeQkj',',\x20tool_names=[','Context:','Validation\x20failed:\x20tools\x20must\x20be\x20an\x20array\x20if\x20provided','Failed\x20to\x20log\x20usage\x20entry\x20on\x20error:\x20','address','trace','chat','start','info','isArray','...','stop','new\x20tool(s)','agentCache','[PROXY\x20ERROR]\x20Chat\x20stream\x20is\x20undefined','Failed\x20to\x20log\x20usage\x20entry:\x20','push',',\x20tools:\x20','chatId','3WjzdIC','error','Failed\x20to\x20generate\x20tool\x20prompt:','get','Authorization','trim','messages','5176DHhoYi','[session:\x20','continue','embeddedToolsByName',',\x20system_prompts=','startChat',',\x20is\x20new\x20context:\x20','handleRouteError','name','warn','type','replace','GET','Proxy\x20server\x20started\x20at\x20localhost:','1417jjpegg','Concurrent\x20chat\x20creation\x20failed,\x20will\x20fall\x20back\x20to\x20lazy\x20creation:','1758RcxtUk','http://localhost:','text','has','logger','method',')\x20to\x20stay\x20under\x20','match','Final\x20message\x20is\x20empty\x20after\x20construction\x20-\x20starting\x20fresh\x20conversation','creating','config','Added\x20system\x20prompt\x20previews:','string',',\x20context\x20signature:\x20','Failed\x20to\x20initialize\x20chat\x20stream.\x20Please\x20try\x20again.','map','handleMessages','chats','filter','Agent\x20cached:\x20','add','toISOString','lastUsedAt','tdx','write','OPTIONS','Final\x20message\x20reconstructed\x20after\x20context\x20reset:','TD\x20LLM\x20Proxy\x20Server','writeHead','Unknown\x20error','\x20Input\x20size:\x20','/v1/messages','not_supported_error','INVALID_REQUEST','6171756YJfgJZ','length','getAddress','default','Validation\x20failed:\x20messages\x20array\x20is\x20required\x20and\x20must\x20not\x20be\x20empty','/health','port','data','usage','agentId','system',',\x20tools=','message','attributes','createPromise','end','\x20messages,\x20','now','\x0a---\x0a\x0a',']\x20Created\x20new\x20chat\x20for\x20model\x20','event','setupMiddleware','\x20|\x20','raw'];a58_0x4b50=function(){return _0x210c12;};return a58_0x4b50();}import{ErrorCode,SDKError}from'../sdk/index.js';import{transformTDStreamToAnthropic,formatAnthropicSSE,generateMessageId,generateToolPrompt,extractToolResults,estimateInputTokensFromRequest}from'./anthropic-adapter.js';import{colorizeJSON,colorizeJSONCompact}from'../utils/colors.js';import{extractModelAlias,resolveModelAlias}from'../utils/model-aliases.js';import{SessionCache}from'./session-cache.js';import{appendUsageEntry}from'./claude-usage-tracker.js';import{calculateContextSignature}from'./context-signature.js';import{formatConversationHistory,calculateConversationDelta,extractLastUserMessage}from'./conversation-utils.js';function extractSessionUUID(_0x58a671){const _0x3da6ce=a58_0x3269,_0xa6410e=_0x58a671[_0x3da6ce(0x239)](/_session_([a-f0-9-]+)$/i);if(_0xa6410e)return _0xa6410e[0x1];return _0x58a671;}function a58_0x3269(_0xb2a8a0,_0xb2b22){_0xb2a8a0=_0xb2a8a0-0x1ae;const _0x4b5067=a58_0x4b50();let _0x326935=_0x4b5067[_0xb2a8a0];return _0x326935;}function clearChatState(_0x36c5fc){const _0x72a359=a58_0x3269;_0x36c5fc['chatId']='',_0x36c5fc['embeddedSystemPrompts'][_0x72a359(0x1ff)](),_0x36c5fc[_0x72a359(0x225)][_0x72a359(0x1ff)]();}function mapBudgetTokensToReasoningEffort(_0x4efcfc,_0x513331){const _0x28cc5c=a58_0x3269;if(_0x513331!==_0x28cc5c(0x1d2))return 0x0;if(!_0x4efcfc||_0x4efcfc===0x0)return 0x0;if(_0x4efcfc<=0x400)return 0x1;if(_0x4efcfc<=0x800)return 0x2;if(_0x4efcfc<=0x1000)return 0x3;return 0x4;}const MAX_CHATS_PER_SESSION=0xa,CACHE_EXPIRATION_MS=0xa*0x3c*0x3e8,CLEANUP_INTERVAL_MS=0x3c*0x3e8;export class ProxyServer{[a58_0x4133b9(0x1eb)];['sessionCache'];[a58_0x4133b9(0x215)];[a58_0x4133b9(0x23c)];['cleanupInterval'];['logger'];constructor(_0x56a418){const _0x1fa103=a58_0x4133b9;this[_0x1fa103(0x236)]=_0x56a418[_0x1fa103(0x236)],this[_0x1fa103(0x23c)]=_0x56a418,this[_0x1fa103(0x1c5)]=new SessionCache({'maxChatsPerSession':MAX_CHATS_PER_SESSION,'cacheExpirationMs':CACHE_EXPIRATION_MS}),this[_0x1fa103(0x215)]=new Map(),this['server']=a58_0x14a315({'logger':![],'bodyLimit':0x40*0x400*0x400}),this[_0x1fa103(0x1b7)](),this['setupRoutes']();}async['getAgentForModel'](_0x3b3e5d,_0x2b678d=0x0){const _0xec466a=a58_0x4133b9,_0x6c0fff=extractModelAlias(_0x3b3e5d),_0x548c22=resolveModelAlias(_0x6c0fff),_0x402473=_0x548c22+'_'+_0x2b678d;let _0x5e128e=this[_0xec466a(0x215)]['get'](_0x402473);if(!_0x5e128e){this[_0xec466a(0x236)][_0xec466a(0x1e3)](_0xec466a(0x1e5)+_0x3b3e5d+_0xec466a(0x1c3)+_0x6c0fff+_0xec466a(0x1c3)+_0x548c22),this[_0xec466a(0x236)][_0xec466a(0x1e3)](_0xec466a(0x1fc)+_0x548c22+_0xec466a(0x1d5)+_0x2b678d+')');const _0x3e59fc=await this[_0xec466a(0x23c)][_0xec466a(0x249)]['llm']['getOrCreateDefaultAgent'](_0x548c22,_0x2b678d);_0x5e128e=_0x3e59fc['id'],this[_0xec466a(0x215)][_0xec466a(0x1f7)](_0x402473,_0x5e128e),this[_0xec466a(0x236)][_0xec466a(0x1e3)](_0xec466a(0x245)+_0x402473+_0xec466a(0x1c3)+_0x5e128e+'\x20('+_0x3e59fc[_0xec466a(0x1af)][_0xec466a(0x22a)]+')');}return _0x5e128e;}[a58_0x4133b9(0x202)](){const _0x5e8897=a58_0x4133b9;this[_0x5e8897(0x1c5)][_0x5e8897(0x202)]();}[a58_0x4133b9(0x1b7)](){const _0xd24d70=a58_0x4133b9;this[_0xd24d70(0x1eb)]['register'](a58_0x3e7426,{'origin':!![],'methods':[_0xd24d70(0x22e),_0xd24d70(0x1f1),_0xd24d70(0x24b)],'allowedHeaders':['Content-Type',_0xd24d70(0x21f),'anthropic-version',_0xd24d70(0x1ba)]}),this[_0xd24d70(0x1eb)]['setErrorHandler']((_0x99e54c,_0x3dc0c5,_0x572287)=>{const _0x4e0295=_0xd24d70;this[_0x4e0295(0x229)](_0x99e54c,_0x3dc0c5,_0x572287);});}[a58_0x4133b9(0x229)](_0x3b47a6,_0x522291,_0x388d74){const _0x2cfb96=a58_0x4133b9;if(_0x3b47a6 instanceof SDKError){const _0x5f2e1a=_0x3b47a6[_0x2cfb96(0x1e4)]()?0x190:0x1f4;_0x388d74['code'](_0x5f2e1a)[_0x2cfb96(0x1cb)]({'type':_0x2cfb96(0x21c),'error':{'type':_0x3b47a6[_0x2cfb96(0x1fb)],'message':_0x3b47a6['originalMessage'],'helpText':_0x3b47a6['helpText']}});}else{const _0x455365=_0x3b47a6 instanceof Error?_0x3b47a6['message']:_0x2cfb96(0x24f);this[_0x2cfb96(0x236)][_0x2cfb96(0x21c)](_0x2cfb96(0x1f0)+_0x522291['method']+'\x20'+_0x522291[_0x2cfb96(0x1c2)]+':',_0x3b47a6),_0x388d74[_0x2cfb96(0x1fb)](0x1f4)['send']({'type':'error','error':{'type':'api_error','message':_0x455365}});}}['setupRoutes'](){const _0x4a225e=a58_0x4133b9;this['server'][_0x4a225e(0x21e)](_0x4a225e(0x259),async()=>{const _0x5b8c9e=_0x4a225e;return{'status':'ok','message':_0x5b8c9e(0x24d)};}),this[_0x4a225e(0x1eb)][_0x4a225e(0x1ce)](_0x4a225e(0x251),async(_0x336e8b,_0x4e0284)=>{const _0x5468ab=_0x4a225e;return this[_0x5468ab(0x242)](_0x336e8b,_0x4e0284)[_0x5468ab(0x1ea)](_0x57595a=>{const _0x15d6b0=_0x5468ab;this[_0x15d6b0(0x229)](_0x57595a,_0x336e8b,_0x4e0284);});}),this[_0x4a225e(0x1eb)][_0x4a225e(0x1ce)](_0x4a225e(0x1ef),async(_0x1b4256,_0x5e4c48)=>{const _0x25bd53=_0x4a225e;return this[_0x25bd53(0x1db)](_0x1b4256)[_0x25bd53(0x1ea)](_0x1fcc7e=>{const _0x211652=_0x25bd53;this[_0x211652(0x229)](_0x1fcc7e,_0x1b4256,_0x5e4c48);});});}[a58_0x4133b9(0x1d1)](_0x3d150a){const _0xfc611=a58_0x4133b9;if(!_0x3d150a[_0xfc611(0x221)]||!Array[_0xfc611(0x211)](_0x3d150a[_0xfc611(0x221)])||_0x3d150a['messages'][_0xfc611(0x255)]===0x0)throw new SDKError(ErrorCode[_0xfc611(0x253)],_0xfc611(0x258));if(_0x3d150a[_0xfc611(0x1dd)]&&!Array['isArray'](_0x3d150a['tools']))throw new SDKError(ErrorCode[_0xfc611(0x253)],_0xfc611(0x20a));}async[a58_0x4133b9(0x242)](_0x38aece,_0x317b80){const _0x5ebc56=a58_0x4133b9,_0x3bc66d=_0x38aece[_0x5ebc56(0x201)];this[_0x5ebc56(0x1d1)](_0x3bc66d);const _0x2b1694=_0x3bc66d[_0x5ebc56(0x221)]?.[_0x5ebc56(0x255)]??0x0,_0x3701e4=_0x3bc66d['model']||_0x5ebc56(0x1c6);this['logger']['info'](_0x38aece[_0x5ebc56(0x237)]+'\x20'+_0x38aece[_0x5ebc56(0x1c2)]+_0x5ebc56(0x1f5)+_0x2b1694+_0x5ebc56(0x1f8)+_0x3701e4),this[_0x5ebc56(0x236)][_0x5ebc56(0x1e3)](_0x5ebc56(0x1bc)+colorizeJSONCompact(_0x38aece['headers']));this[_0x5ebc56(0x236)]['trace']&&this[_0x5ebc56(0x236)][_0x5ebc56(0x20d)](colorizeJSON(_0x3bc66d,{'color':!![]}));const _0x989e87=_0x3bc66d['metadata']?.[_0x5ebc56(0x1e9)]||_0x5ebc56(0x257),_0x1d824a=extractSessionUUID(_0x989e87),_0x4e42db=this[_0x5ebc56(0x1c5)]['getOrCreateSession'](_0x1d824a,this['config'][_0x5ebc56(0x1ec)]),_0x25d37e=[];if(_0x3bc66d[_0x5ebc56(0x25e)]){if(typeof _0x3bc66d[_0x5ebc56(0x25e)]==='string')_0x25d37e[_0x5ebc56(0x218)](_0x3bc66d['system']);else{if(Array['isArray'](_0x3bc66d['system']))for(const _0x11c5de of _0x3bc66d[_0x5ebc56(0x25e)]){_0x11c5de['type']===_0x5ebc56(0x234)&&_0x11c5de[_0x5ebc56(0x234)]&&_0x25d37e[_0x5ebc56(0x218)](_0x11c5de[_0x5ebc56(0x234)]);}}}const _0x243dab=_0x3bc66d[_0x5ebc56(0x1dd)]||[],_0x328420=_0x3bc66d[_0x5ebc56(0x1cd)]?.['budget_tokens'],_0x50a966=mapBudgetTokensToReasoningEffort(_0x328420,this[_0x5ebc56(0x23c)]['site']),_0x458720=calculateContextSignature(_0x3bc66d['model'],_0x25d37e,_0x243dab,_0x50a966);let _0x259ace=_0x4e42db[_0x5ebc56(0x243)]['get'](_0x458720);const _0x4af55a=!_0x259ace;if(!_0x259ace){const _0x57bb69=await this[_0x5ebc56(0x1f2)](_0x3bc66d[_0x5ebc56(0x1ee)],_0x50a966);_0x259ace={'chatId':'','agentId':_0x57bb69,'contextSignature':_0x458720,'embeddedSystemPrompts':new Set(),'embeddedToolsByName':new Map(),'messageHistory':[],'lastUsedAt':Date[_0x5ebc56(0x1b3)]()},_0x4e42db[_0x5ebc56(0x243)]['set'](_0x458720,_0x259ace);if(_0x4e42db[_0x5ebc56(0x243)][_0x5ebc56(0x1c7)]>MAX_CHATS_PER_SESSION){let _0x6e07b7=null,_0x58ce80=Date[_0x5ebc56(0x1b3)]();for(const [_0x30d00a,_0x4f46da]of _0x4e42db[_0x5ebc56(0x243)]){_0x4f46da[_0x5ebc56(0x248)]<_0x58ce80&&(_0x58ce80=_0x4f46da['lastUsedAt'],_0x6e07b7=_0x30d00a);}_0x6e07b7&&(_0x4e42db[_0x5ebc56(0x243)][_0x5ebc56(0x1bf)](_0x6e07b7),this[_0x5ebc56(0x236)][_0x5ebc56(0x1e3)]('Evicted\x20oldest\x20chat\x20(signature:\x20'+_0x6e07b7+_0x5ebc56(0x238)+MAX_CHATS_PER_SESSION+'\x20limit'));}}else _0x259ace[_0x5ebc56(0x248)]=Date['now']();if(!_0x259ace[_0x5ebc56(0x21a)]){if(_0x259ace[_0x5ebc56(0x23b)]&&_0x259ace[_0x5ebc56(0x1b0)]){this[_0x5ebc56(0x236)]['debug']('Waiting\x20for\x20concurrent\x20chat\x20creation\x20for\x20context:\x20'+_0x458720);try{_0x259ace[_0x5ebc56(0x21a)]=await _0x259ace['createPromise'];}catch(_0x1d12de){this['logger'][_0x5ebc56(0x21c)](_0x5ebc56(0x231),_0x1d12de);}}else{if(!_0x259ace[_0x5ebc56(0x23b)]){_0x259ace['creating']=!![],_0x259ace[_0x5ebc56(0x1b0)]=((async()=>{const _0x115b9e=_0x5ebc56;try{const _0x188a5d=await this[_0x115b9e(0x23c)][_0x115b9e(0x249)][_0x115b9e(0x1e6)][_0x115b9e(0x227)](_0x259ace[_0x115b9e(0x25d)]);return this['logger'][_0x115b9e(0x210)]('['+_0x188a5d['id']+_0x115b9e(0x1b5)+_0x3bc66d[_0x115b9e(0x1ee)]+_0x115b9e(0x1d3)+_0x458720),_0x188a5d['id'];}catch(_0x151bdc){this[_0x115b9e(0x236)]['error'](_0x115b9e(0x206),_0x151bdc);throw _0x151bdc;}finally{_0x259ace['creating']=![],_0x259ace[_0x115b9e(0x1b0)]=undefined;}})());try{_0x259ace[_0x5ebc56(0x21a)]=await _0x259ace[_0x5ebc56(0x1b0)];}catch{}}}}const _0x374202=_0x25d37e[_0x5ebc56(0x244)](_0x324a73=>!_0x259ace[_0x5ebc56(0x1cc)][_0x5ebc56(0x235)](_0x324a73)),_0x196cd3=_0x243dab[_0x5ebc56(0x244)](_0x118877=>!_0x259ace[_0x5ebc56(0x225)]['has'](_0x118877[_0x5ebc56(0x22a)]));this[_0x5ebc56(0x236)][_0x5ebc56(0x1e3)](_0x5ebc56(0x223)+_0x1d824a+_0x5ebc56(0x1e1)+_0x3bc66d[_0x5ebc56(0x1ee)]+_0x5ebc56(0x23f)+_0x458720+_0x5ebc56(0x228)+_0x4af55a),this[_0x5ebc56(0x236)][_0x5ebc56(0x1e3)](_0x5ebc56(0x1f3)+_0x259ace[_0x5ebc56(0x21a)]),this[_0x5ebc56(0x236)][_0x5ebc56(0x1e3)](_0x5ebc56(0x1c1)+_0x25d37e[_0x5ebc56(0x255)]+',\x20tools:\x20'+_0x243dab[_0x5ebc56(0x255)]),this['logger'][_0x5ebc56(0x1e3)](_0x5ebc56(0x1de)+_0x259ace[_0x5ebc56(0x1cc)][_0x5ebc56(0x1c7)]+',\x20tools:\x20'+_0x259ace[_0x5ebc56(0x225)]['size']),this[_0x5ebc56(0x236)][_0x5ebc56(0x1e3)]('New\x20-\x20system\x20prompts:\x20'+_0x374202[_0x5ebc56(0x255)]+_0x5ebc56(0x219)+_0x196cd3['length']);_0x374202[_0x5ebc56(0x255)]>0x0&&this[_0x5ebc56(0x236)]['debug'](_0x5ebc56(0x23d),_0x374202[_0x5ebc56(0x241)](_0x1412e8=>_0x1412e8[_0x5ebc56(0x1fd)](0x0,0x32)+_0x5ebc56(0x212))[_0x5ebc56(0x1e2)](_0x5ebc56(0x1b8)));_0x196cd3[_0x5ebc56(0x255)]>0x0&&this[_0x5ebc56(0x236)]['debug'](_0x5ebc56(0x1c9),_0x196cd3[_0x5ebc56(0x241)](_0x3720de=>_0x3720de['name'])[_0x5ebc56(0x1e2)](',\x20'));const _0x128ffc=calculateConversationDelta(_0x3bc66d[_0x5ebc56(0x221)],_0x259ace[_0x5ebc56(0x1fe)]),_0xd2ca24=extractLastUserMessage(_0x128ffc,_0x3bc66d[_0x5ebc56(0x221)]);if(_0xd2ca24['error'])throw new SDKError(ErrorCode['INVALID_REQUEST'],_0xd2ca24[_0x5ebc56(0x21c)]);const _0x31e331=_0xd2ca24['text']||'',_0x401d82=()=>{const _0x32cf45=_0x5ebc56,_0x4fea40=[];_0x25d37e[_0x32cf45(0x255)]>0x0&&_0x4fea40[_0x32cf45(0x218)](_0x25d37e[_0x32cf45(0x1e2)]('\x0a\x0a'));_0x243dab[_0x32cf45(0x255)]>0x0&&_0x4fea40['push'](generateToolPrompt(_0x243dab));if(_0x3bc66d[_0x32cf45(0x221)]&&_0x3bc66d[_0x32cf45(0x221)][_0x32cf45(0x255)]>0x1){const _0x2ba95b=formatConversationHistory(_0x3bc66d[_0x32cf45(0x221)]);_0x2ba95b&&_0x4fea40[_0x32cf45(0x218)]('\x0a\x0a<conversation_history>\x0a'+_0x2ba95b+'\x0a</conversation_history>');}return _0x4fea40[_0x32cf45(0x218)](_0x31e331),_0x4fea40[_0x32cf45(0x244)](_0x598e8f=>_0x598e8f&&_0x598e8f[_0x32cf45(0x220)]())[_0x32cf45(0x1e2)](_0x32cf45(0x1b4));};let _0x56d432;if(_0x4af55a){this[_0x5ebc56(0x236)]['info']('['+_0x259ace[_0x5ebc56(0x21a)]+_0x5ebc56(0x1d8)+_0x3bc66d[_0x5ebc56(0x1ee)]+_0x5ebc56(0x226)+_0x25d37e[_0x5ebc56(0x255)]+_0x5ebc56(0x25f)+_0x243dab[_0x5ebc56(0x255)]+_0x5ebc56(0x208)+_0x243dab[_0x5ebc56(0x241)](_0x264989=>_0x264989[_0x5ebc56(0x22a)])['join'](',\x20')+']'),_0x56d432=_0x401d82();for(const _0x3baf40 of _0x25d37e){_0x259ace[_0x5ebc56(0x1cc)]['add'](_0x3baf40);}for(const _0x763a46 of _0x243dab){_0x259ace[_0x5ebc56(0x225)][_0x5ebc56(0x1f7)](_0x763a46[_0x5ebc56(0x22a)],_0x763a46);}}else{const _0x24cccb=[];_0x374202[_0x5ebc56(0x255)]>0x0&&(_0x24cccb[_0x5ebc56(0x218)](_0x374202['join']('\x0a\x0a')),this[_0x5ebc56(0x236)][_0x5ebc56(0x1e3)]('Embedding',_0x374202[_0x5ebc56(0x255)],_0x5ebc56(0x1ca)));if(_0x196cd3[_0x5ebc56(0x255)]>0x0)try{_0x24cccb[_0x5ebc56(0x218)](generateToolPrompt(_0x196cd3)),this['logger'][_0x5ebc56(0x1e3)]('Embedding',_0x196cd3[_0x5ebc56(0x255)],_0x5ebc56(0x214));}catch(_0x220258){this['logger'][_0x5ebc56(0x21c)](_0x5ebc56(0x21d),_0x220258);}try{const _0x2dc7cd=extractToolResults(_0x128ffc);_0x2dc7cd&&(_0x24cccb[_0x5ebc56(0x218)](_0x2dc7cd),this['logger'][_0x5ebc56(0x1e3)](_0x5ebc56(0x1e8)));}catch(_0x46dcc4){this['logger']['error']('Failed\x20to\x20extract\x20tool\x20results:',_0x46dcc4);}_0x24cccb['push'](_0x31e331);const _0x26569d=_0x24cccb[_0x5ebc56(0x244)](_0x22ede2=>_0x22ede2&&_0x22ede2[_0x5ebc56(0x220)]());_0x56d432=_0x26569d['length']>0x1?_0x26569d[_0x5ebc56(0x1e2)](_0x5ebc56(0x1b4)):_0x31e331;for(const _0x5d7bb5 of _0x374202){_0x259ace[_0x5ebc56(0x1cc)][_0x5ebc56(0x246)](_0x5d7bb5);}for(const _0x3bd139 of _0x196cd3){_0x259ace[_0x5ebc56(0x225)]['set'](_0x3bd139[_0x5ebc56(0x22a)],_0x3bd139);}}(!_0x56d432||!_0x56d432[_0x5ebc56(0x220)]())&&(this[_0x5ebc56(0x236)]['warn'](_0x5ebc56(0x23a)),this['logger'][_0x5ebc56(0x22b)](_0x5ebc56(0x209),{'isNewContext':_0x4af55a,'userMessageLength':_0x31e331?.[_0x5ebc56(0x255)]||0x0,'systemPromptsCount':_0x25d37e[_0x5ebc56(0x255)],'toolsCount':_0x243dab[_0x5ebc56(0x255)],'messagesCount':_0x3bc66d['messages']?.[_0x5ebc56(0x255)]||0x0,'newMessagesCount':_0x128ffc[_0x5ebc56(0x255)]}),clearChatState(_0x259ace),_0x56d432=_0x401d82(),(!_0x56d432||!_0x56d432['trim']())&&(this[_0x5ebc56(0x236)][_0x5ebc56(0x21c)](_0x5ebc56(0x1e7)),this[_0x5ebc56(0x236)]['error']('Debug\x20info:',{'systemPromptsCount':_0x25d37e[_0x5ebc56(0x255)],'toolsCount':_0x243dab[_0x5ebc56(0x255)],'messagesCount':_0x3bc66d[_0x5ebc56(0x221)]?.[_0x5ebc56(0x255)]||0x0,'userMessageLength':_0x31e331?.[_0x5ebc56(0x255)]||0x0}),_0x56d432=_0x5ebc56(0x224)),this[_0x5ebc56(0x236)][_0x5ebc56(0x210)](_0x5ebc56(0x24c),_0x56d432['substring'](0x0,0x64)+_0x5ebc56(0x212)));const _0x2726cf=_0x3bc66d[_0x5ebc56(0x204)]!==![];if(_0x2726cf){_0x317b80[_0x5ebc56(0x1b9)][_0x5ebc56(0x24e)](0xc8,{'Content-Type':_0x5ebc56(0x1d7),'Cache-Control':'no-cache','Connection':'keep-alive','X-Accel-Buffering':'no'});const _0x41d9d4=generateMessageId();let _0x1d75fb=0x0,_0x2acfca=0x0;try{if(_0x259ace[_0x5ebc56(0x21a)]){const _0x14d485=_0x56d432[_0x5ebc56(0x1fd)](0x0,0x32)[_0x5ebc56(0x22d)](/\n/g,'\x20');this[_0x5ebc56(0x236)]['info']('['+_0x259ace[_0x5ebc56(0x21a)]+']\x20Continue\x20chat\x20for\x20model\x20'+_0x3bc66d[_0x5ebc56(0x1ee)]+_0x5ebc56(0x1d3)+_0x458720+',\x20'+_0x3bc66d['messages']['length']+_0x5ebc56(0x1b2)+_0x25d37e[_0x5ebc56(0x255)]+'\x20system\x20prompts,\x20'+_0x243dab['length']+'\x20tools,\x20message_size='+_0x56d432[_0x5ebc56(0x255)]+_0x5ebc56(0x205)+_0x14d485+_0x5ebc56(0x1bb));}const _0x31c456=this[_0x5ebc56(0x23c)][_0x5ebc56(0x249)][_0x5ebc56(0x1e6)][_0x5ebc56(0x20e)](_0x56d432,{'chatId':_0x259ace[_0x5ebc56(0x21a)]||undefined,'agentId':_0x259ace[_0x5ebc56(0x21a)]?undefined:_0x259ace[_0x5ebc56(0x25d)]});if(!_0x31c456){this[_0x5ebc56(0x236)][_0x5ebc56(0x21c)](_0x5ebc56(0x216)),this[_0x5ebc56(0x236)][_0x5ebc56(0x21c)]('Context:',JSON[_0x5ebc56(0x1d4)]({'chatId':_0x259ace[_0x5ebc56(0x21a)],'agentId':_0x259ace['agentId'],'model':_0x3bc66d['model'],'sessionId':_0x1d824a,'contextSignature':_0x458720})),_0x259ace['chatId']='',this['logger'][_0x5ebc56(0x22b)](_0x5ebc56(0x1f9));const _0x1f58ba=formatAnthropicSSE({'type':_0x5ebc56(0x21c),'error':{'type':_0x5ebc56(0x1c0),'message':_0x5ebc56(0x240)},'request_id':_0x41d9d4});_0x317b80[_0x5ebc56(0x1b9)][_0x5ebc56(0x24a)](_0x1f58ba),_0x317b80['raw']['end']();return;}_0x259ace[_0x5ebc56(0x1fe)]=_0x3bc66d[_0x5ebc56(0x221)];const _0x1b7e20=_0x259ace;async function*_0x3ffd83(_0x496b21){const _0x181d52=_0x5ebc56;for await(const _0x32dd68 of _0x496b21){if(_0x32dd68['type']===_0x181d52(0x1c4))_0x32dd68['data']['chatId']&&!_0x1b7e20[_0x181d52(0x21a)]&&(_0x1b7e20[_0x181d52(0x21a)]=_0x32dd68['data'][_0x181d52(0x21a)]);else _0x32dd68[_0x181d52(0x22c)]===_0x181d52(0x1b6)&&(yield _0x32dd68[_0x181d52(0x25b)]);}}const _0x1642c7=_0x3ffd83(_0x31c456);_0x1d75fb=estimateInputTokensFromRequest(_0x3bc66d);const _0x9a755d=transformTDStreamToAnthropic(_0x1642c7,_0x41d9d4,_0x3bc66d['model'],this[_0x5ebc56(0x236)],_0x31e331,_0x1d75fb),_0x3551be=_0x56d432['length'];let _0x3fa025=0x0;for await(const _0x416a2a of _0x9a755d){const _0x4d4b6a=formatAnthropicSSE(_0x416a2a);_0x3fa025++,this['logger'][_0x5ebc56(0x1e3)](colorizeJSONCompact(_0x416a2a,{'color':!![]})),_0x416a2a['type']===_0x5ebc56(0x21c)&&_0x416a2a[_0x5ebc56(0x21c)]['type']==='request_too_large'&&(clearChatState(_0x259ace),this[_0x5ebc56(0x236)][_0x5ebc56(0x22b)](_0x5ebc56(0x1e0)+_0x416a2a[_0x5ebc56(0x21c)][_0x5ebc56(0x1ae)]+_0x5ebc56(0x250)+_0x3551be+_0x5ebc56(0x1ed)+_0x1d824a+_0x5ebc56(0x1da)+_0x458720)),_0x416a2a[_0x5ebc56(0x22c)]==='message_delta'&&_0x416a2a[_0x5ebc56(0x25c)]?.[_0x5ebc56(0x1d0)]&&(_0x2acfca=_0x416a2a[_0x5ebc56(0x25c)][_0x5ebc56(0x1d0)]),_0x317b80[_0x5ebc56(0x1b9)][_0x5ebc56(0x24a)](_0x4d4b6a);}this['logger'][_0x5ebc56(0x1e3)](_0x5ebc56(0x1be)+_0x3fa025+'\x20SSE\x20events.'),appendUsageEntry(_0x1d824a,{'timestamp':new Date()[_0x5ebc56(0x247)](),'model':_0x3bc66d['model'],'inputTokens':_0x1d75fb,'outputTokens':_0x2acfca,'contextSignature':_0x458720,'profile':this[_0x5ebc56(0x23c)][_0x5ebc56(0x249)]?.['context']?.[_0x5ebc56(0x1fa)],'chatId':_0x259ace[_0x5ebc56(0x21a)]||undefined})[_0x5ebc56(0x1ea)](_0x3f7e4e=>{const _0x2abccd=_0x5ebc56;this[_0x2abccd(0x236)]['warn'](_0x2abccd(0x217)+_0x3f7e4e);}),_0x317b80[_0x5ebc56(0x1b9)][_0x5ebc56(0x1b1)]();}catch(_0x410c82){(_0x1d75fb>0x0||_0x2acfca>0x0)&&appendUsageEntry(_0x1d824a,{'timestamp':new Date()[_0x5ebc56(0x247)](),'model':_0x3bc66d[_0x5ebc56(0x1ee)],'inputTokens':_0x1d75fb,'outputTokens':_0x2acfca,'contextSignature':_0x458720,'profile':this[_0x5ebc56(0x23c)][_0x5ebc56(0x249)]?.['context']?.[_0x5ebc56(0x1fa)],'chatId':_0x259ace[_0x5ebc56(0x21a)]||undefined})[_0x5ebc56(0x1ea)](_0x4c808f=>{const _0x3092a7=_0x5ebc56;this[_0x3092a7(0x236)][_0x3092a7(0x22b)](_0x3092a7(0x20b)+_0x4c808f);});const _0xc7060f=_0x410c82 instanceof Error?_0x410c82[_0x5ebc56(0x1ae)]:'Unknown\x20error';this[_0x5ebc56(0x236)][_0x5ebc56(0x21c)]('[PROXY\x20ERROR]\x20Streaming\x20error:',_0x410c82),this[_0x5ebc56(0x236)][_0x5ebc56(0x21c)](_0x5ebc56(0x209),JSON[_0x5ebc56(0x1d4)]({'chatId':_0x259ace['chatId'],'agentId':_0x259ace[_0x5ebc56(0x25d)],'model':_0x3bc66d[_0x5ebc56(0x1ee)],'sessionId':_0x1d824a,'contextSignature':_0x458720})),_0x259ace[_0x5ebc56(0x21a)]='',this[_0x5ebc56(0x236)][_0x5ebc56(0x22b)]('Reset\x20chat\x20state\x20to\x20recover\x20on\x20next\x20request');const _0x149e2c=formatAnthropicSSE({'type':_0x5ebc56(0x21c),'error':{'type':_0x5ebc56(0x1c0),'message':_0xc7060f},'request_id':_0x41d9d4});_0x317b80[_0x5ebc56(0x1b9)][_0x5ebc56(0x24a)](_0x149e2c),_0x317b80[_0x5ebc56(0x1b9)][_0x5ebc56(0x1b1)]();}}else this[_0x5ebc56(0x236)][_0x5ebc56(0x21c)](_0x5ebc56(0x1f4)),_0x317b80['code'](0x1f5)[_0x5ebc56(0x1cb)]({'type':_0x5ebc56(0x21c),'error':{'type':_0x5ebc56(0x252),'message':'Non-streaming\x20responses\x20are\x20not\x20yet\x20supported'}});}async['handleCountTokens'](_0x437646){const _0x41619c=a58_0x4133b9,_0x399278=_0x437646['body'],_0x5ab75a=estimateInputTokensFromRequest(_0x399278);return this[_0x41619c(0x236)]['info'](_0x437646[_0x41619c(0x237)]+'\x20'+_0x437646[_0x41619c(0x1c2)]+':\x20estimated\x20input_tokens='+_0x5ab75a),{'input_tokens':_0x5ab75a};}async[a58_0x4133b9(0x20f)](){const _0x28cd9b=a58_0x4133b9;try{await this[_0x28cd9b(0x1eb)]['listen']({'port':this[_0x28cd9b(0x23c)][_0x28cd9b(0x25a)],'host':_0x28cd9b(0x1bd)}),this[_0x28cd9b(0x236)][_0x28cd9b(0x210)](_0x28cd9b(0x22f)+this[_0x28cd9b(0x23c)][_0x28cd9b(0x25a)]),this[_0x28cd9b(0x203)]=setInterval(()=>{const _0x2f1c71=_0x28cd9b;this[_0x2f1c71(0x202)]();},CLEANUP_INTERVAL_MS),this[_0x28cd9b(0x236)][_0x28cd9b(0x1e3)](_0x28cd9b(0x1d6)+CLEANUP_INTERVAL_MS/0x3e8+'s,\x20expires\x20after\x20'+CACHE_EXPIRATION_MS/0x3e8+'s)');}catch(_0x568624){const _0x312dac=_0x568624 instanceof Error?_0x568624[_0x28cd9b(0x1ae)]:_0x28cd9b(0x24f);throw new Error(_0x28cd9b(0x1cf)+_0x312dac);}}async[a58_0x4133b9(0x213)](){const _0x3ab010=a58_0x4133b9;this[_0x3ab010(0x203)]&&(clearInterval(this[_0x3ab010(0x203)]),this['cleanupInterval']=undefined),await this[_0x3ab010(0x1eb)]['close']();}[a58_0x4133b9(0x256)](){const _0x1634cd=a58_0x4133b9,_0x13db33=this[_0x1634cd(0x1eb)][_0x1634cd(0x1eb)][_0x1634cd(0x20c)]();if(typeof _0x13db33===_0x1634cd(0x23e))return _0x13db33;if(_0x13db33)return'http://'+_0x13db33['address']+':'+_0x13db33['port'];return _0x1634cd(0x233)+this[_0x1634cd(0x23c)][_0x1634cd(0x25a)];}}
1
+ const a58_0x44a4f9=a58_0x580c;(function(_0x287be6,_0x21bc9a){const _0x4b5e76=a58_0x580c,_0x203e44=_0x287be6();while(!![]){try{const _0x581b26=-parseInt(_0x4b5e76(0xe0))/0x1*(parseInt(_0x4b5e76(0xdd))/0x2)+-parseInt(_0x4b5e76(0xd9))/0x3*(-parseInt(_0x4b5e76(0xf1))/0x4)+parseInt(_0x4b5e76(0x111))/0x5+-parseInt(_0x4b5e76(0x13d))/0x6+-parseInt(_0x4b5e76(0xcc))/0x7*(parseInt(_0x4b5e76(0x110))/0x8)+-parseInt(_0x4b5e76(0x15e))/0x9*(parseInt(_0x4b5e76(0x126))/0xa)+parseInt(_0x4b5e76(0x10c))/0xb;if(_0x581b26===_0x21bc9a)break;else _0x203e44['push'](_0x203e44['shift']());}catch(_0x299a9d){_0x203e44['push'](_0x203e44['shift']());}}}(a58_0x8ca4,0xe4c75));import a58_0x575468 from'fastify';import a58_0x306298 from'@fastify/cors';import{ErrorCode,SDKError}from'../sdk/index.js';function a58_0x580c(_0x9e2504,_0x2c360a){_0x9e2504=_0x9e2504-0xc3;const _0x8ca40a=a58_0x8ca4();let _0x580c4a=_0x8ca40a[_0x9e2504];return _0x580c4a;}import{transformTDStreamToAnthropic,formatAnthropicSSE,generateMessageId,generateToolPrompt,extractToolResults,estimateInputTokensFromRequest}from'./anthropic-adapter.js';import{colorizeJSON,colorizeJSONCompact}from'../utils/colors.js';import{extractModelAlias,resolveModelAlias}from'../utils/model-aliases.js';import{SessionCache}from'./session-cache.js';import{appendUsageEntry}from'./claude-usage-tracker.js';import{calculateContextSignature}from'./context-signature.js';import{formatConversationHistory,calculateConversationDelta,extractLastUserMessage}from'./conversation-utils.js';function extractSessionUUID(_0x442317){const _0x3ccee3=_0x442317['match'](/_session_([a-f0-9-]+)$/i);if(_0x3ccee3)return _0x3ccee3[0x1];return _0x442317;}function clearChatState(_0x19da29){const _0xaea824=a58_0x580c;_0x19da29[_0xaea824(0xd0)]='',_0x19da29[_0xaea824(0xe1)]['clear'](),_0x19da29[_0xaea824(0x108)]['clear']();}function a58_0x8ca4(){const _0x25e4c8=['Debug\x20info:','handleMessages','map','/v1/messages','[PROXY\x20ERROR]\x20Streaming\x20error:','stringify','91nXtxpk','messageHistory',']\x20Continue\x20chat\x20for\x20model\x20','profile','chatId','Proxy\x20server\x20started\x20at\x20localhost:','\x20(reasoning:\x20',',\x20model=','OPTIONS','Chat\x20ID:\x20','getOrCreateSession','setupRoutes','\x20limit','3LAAHiX',',\x20tools=','s,\x20expires\x20after\x20',',\x20is\x20new\x20context:\x20','97928VGWDtv','set','Embedding','38qutxWv','embeddedSystemPrompts','method','not_supported_error','GET','continue','string',',\x20\x22','Content-Type','getOrCreateDefaultAgent','send','catch','handleCountTokens','close','headers','output_tokens','sessionCache','1003492XNxuJp','server','Final\x20message\x20reconstructed\x20after\x20context\x20reset:','text/event-stream','cleanupInterval','api_error','[PROXY\x20ERROR]\x20Unhandled\x20error\x20in\x20','size','Failed\x20to\x20log\x20usage\x20entry:\x20','\x20chars.\x20Cleared\x20chat\x20state\x20for\x20session\x20','\x20messages,\x20','attributes','creating','system','start','usage','originalMessage','setupMiddleware','budget_tokens','raw','\x0a\x0a<conversation_history>\x0a','warn','logger','embeddedToolsByName','toISOString','tdx','Including\x20tool\x20results','58431450jJiCjz','error','trace','tools','915608VbAZVH','4486420BxFaqt','name','\x20tools,\x20message_size=','join','anthropic-version','System\x20prompts:\x20','Validation\x20failed:\x20tools\x20must\x20be\x20an\x20array\x20if\x20provided','trim','Concurrent\x20chat\x20creation\x20failed,\x20will\x20fall\x20back\x20to\x20lazy\x20creation:','get','Added\x20tool\x20names:','getAgentForModel','type','startChat','[PROXY\x20ERROR]\x20Chat\x20stream\x20is\x20undefined','Waiting\x20for\x20concurrent\x20chat\x20creation\x20for\x20context:\x20','message','config','model','agentId','createPromise','1392590JLiXoN','add','Creating/looking\x20up\x20agent\x20for:\x20','header:\x20','POST','chat','http://localhost:','unknown','isArray','Context:','keep-alive','Failed\x20to\x20generate\x20tool\x20prompt:','\x20|\x20','isUserError','Unknown\x20error','post','validateMessageRequest','...','now',']\x20model:\x20','Validation\x20failed:\x20messages\x20array\x20is\x20required\x20and\x20must\x20not\x20be\x20empty','cleanupExpiredChats','has','3856116GfGpqL','debug','replace','substring','[session:\x20','site','stream',']\x20Created\x20new\x20chat\x20for\x20model\x20','/v1/messages/count_tokens','llm','Final\x20message\x20is\x20empty\x20after\x20construction\x20-\x20starting\x20fresh\x20conversation','info',',\x20context=','http://','Failed\x20to\x20start\x20proxy\x20server:\x20','data','register','messages','lastUsedAt','[PROXY\x20ERROR]\x20Non-streaming\x20responses\x20are\x20not\x20yet\x20supported','Evicted\x20oldest\x20chat\x20(signature:\x20','Agent\x20cached:\x20','Failed\x20to\x20reconstruct\x20message\x20-\x20all\x20parts\x20are\x20empty,\x20using\x20fallback','no-cache','getAddress','code','text','\x0a---\x0a\x0a','Failed\x20to\x20log\x20usage\x20entry\x20on\x20error:\x20','end','Stream\x20complete.\x20Sent\x20','port',':\x20messages=','99lgdyAt','helpText','Reset\x20chat\x20state\x20to\x20recover\x20on\x20next\x20request','Model\x20normalization:\x20','Embedded\x20in\x20chat\x20-\x20system\x20prompts:\x20','filter','user_id','TD\x20LLM\x20Proxy\x20Server',',\x20tools:\x20','Authorization','push','message_delta',',\x20tool_names=[','handleRouteError','INVALID_REQUEST','\x20->\x20','/health','url','request_too_large','agentCache','chats','event','write','stop','setErrorHandler','length','listen'];a58_0x8ca4=function(){return _0x25e4c8;};return a58_0x8ca4();}function mapBudgetTokensToReasoningEffort(_0x28436a,_0x1e795b){if(_0x1e795b!=='dev-us01')return 0x0;if(!_0x28436a||_0x28436a===0x0)return 0x0;if(_0x28436a<=0x400)return 0x1;if(_0x28436a<=0x800)return 0x2;if(_0x28436a<=0x1000)return 0x3;return 0x4;}const MAX_CHATS_PER_SESSION=0xa,CACHE_EXPIRATION_MS=0xa*0x3c*0x3e8,CLEANUP_INTERVAL_MS=0x3c*0x3e8;export class ProxyServer{[a58_0x44a4f9(0xf2)];[a58_0x44a4f9(0xf0)];[a58_0x44a4f9(0x171)];[a58_0x44a4f9(0x122)];[a58_0x44a4f9(0xf5)];[a58_0x44a4f9(0x107)];constructor(_0x42a2b1){const _0x3a9ada=a58_0x44a4f9;this['logger']=_0x42a2b1[_0x3a9ada(0x107)],this[_0x3a9ada(0x122)]=_0x42a2b1,this[_0x3a9ada(0xf0)]=new SessionCache({'maxChatsPerSession':MAX_CHATS_PER_SESSION,'cacheExpirationMs':CACHE_EXPIRATION_MS}),this[_0x3a9ada(0x171)]=new Map(),this['server']=a58_0x575468({'logger':![],'bodyLimit':0x40*0x400*0x400}),this[_0x3a9ada(0x102)](),this['setupRoutes']();}async[a58_0x44a4f9(0x11c)](_0x4410bd,_0x15a122=0x0){const _0x5f53fd=a58_0x44a4f9,_0x372b58=extractModelAlias(_0x4410bd),_0x424c61=resolveModelAlias(_0x372b58),_0x47f3d8=_0x424c61+'_'+_0x15a122;let _0x38d2e4=this[_0x5f53fd(0x171)][_0x5f53fd(0x11a)](_0x47f3d8);if(!_0x38d2e4){this[_0x5f53fd(0x107)]['debug'](_0x5f53fd(0x161)+_0x4410bd+_0x5f53fd(0x16d)+_0x372b58+'\x20->\x20'+_0x424c61),this[_0x5f53fd(0x107)][_0x5f53fd(0x13e)](_0x5f53fd(0x128)+_0x424c61+_0x5f53fd(0xd2)+_0x15a122+')');const _0x2b1aee=await this['config']['tdx'][_0x5f53fd(0x146)][_0x5f53fd(0xe9)](_0x424c61,_0x15a122);_0x38d2e4=_0x2b1aee['id'],this['agentCache'][_0x5f53fd(0xde)](_0x47f3d8,_0x38d2e4),this['logger']['debug'](_0x5f53fd(0x152)+_0x47f3d8+'\x20->\x20'+_0x38d2e4+'\x20('+_0x2b1aee[_0x5f53fd(0xfc)]['name']+')');}return _0x38d2e4;}['cleanupExpiredChats'](){const _0x16d0e2=a58_0x44a4f9;this[_0x16d0e2(0xf0)][_0x16d0e2(0x13b)]();}['setupMiddleware'](){const _0x279b9a=a58_0x44a4f9;this[_0x279b9a(0xf2)][_0x279b9a(0x14d)](a58_0x306298,{'origin':!![],'methods':[_0x279b9a(0xe4),_0x279b9a(0x12a),_0x279b9a(0xd4)],'allowedHeaders':[_0x279b9a(0xe8),_0x279b9a(0x167),_0x279b9a(0x115),'x-api-key']}),this[_0x279b9a(0xf2)][_0x279b9a(0xc3)]((_0x2a8827,_0x3e8a07,_0x3cd312)=>{this['handleRouteError'](_0x2a8827,_0x3e8a07,_0x3cd312);});}[a58_0x44a4f9(0x16b)](_0x11aff7,_0x570d08,_0x3d9876){const _0x534ade=a58_0x44a4f9;if(_0x11aff7 instanceof SDKError){const _0x57b618=_0x11aff7[_0x534ade(0x133)]()?0x190:0x1f4;_0x3d9876[_0x534ade(0x156)](_0x57b618)[_0x534ade(0xea)]({'type':_0x534ade(0x10d),'error':{'type':_0x11aff7['code'],'message':_0x11aff7[_0x534ade(0x101)],'helpText':_0x11aff7[_0x534ade(0x15f)]}});}else{const _0x1d20a3=_0x11aff7 instanceof Error?_0x11aff7[_0x534ade(0x121)]:_0x534ade(0x134);this['logger'][_0x534ade(0x10d)](_0x534ade(0xf7)+_0x570d08['method']+'\x20'+_0x570d08['url']+':',_0x11aff7),_0x3d9876['code'](0x1f4)[_0x534ade(0xea)]({'type':_0x534ade(0x10d),'error':{'type':_0x534ade(0xf6),'message':_0x1d20a3}});}}[a58_0x44a4f9(0xd7)](){const _0x5ccf5e=a58_0x44a4f9;this['server'][_0x5ccf5e(0x11a)](_0x5ccf5e(0x16e),async()=>{const _0x5e42f0=_0x5ccf5e;return{'status':'ok','message':_0x5e42f0(0x165)};}),this['server'][_0x5ccf5e(0x135)](_0x5ccf5e(0xc9),async(_0x1b06d2,_0x2d3e8b)=>{const _0x2defc7=_0x5ccf5e;return this[_0x2defc7(0xc7)](_0x1b06d2,_0x2d3e8b)[_0x2defc7(0xeb)](_0x4f5ba6=>{this['handleRouteError'](_0x4f5ba6,_0x1b06d2,_0x2d3e8b);});}),this['server'][_0x5ccf5e(0x135)](_0x5ccf5e(0x145),async(_0x152b49,_0x4bc525)=>{const _0x1d1134=_0x5ccf5e;return this[_0x1d1134(0xec)](_0x152b49)['catch'](_0x1df043=>{this['handleRouteError'](_0x1df043,_0x152b49,_0x4bc525);});});}[a58_0x44a4f9(0x136)](_0x19d6ed){const _0x55d6f3=a58_0x44a4f9;if(!_0x19d6ed[_0x55d6f3(0x14e)]||!Array[_0x55d6f3(0x12e)](_0x19d6ed[_0x55d6f3(0x14e)])||_0x19d6ed[_0x55d6f3(0x14e)][_0x55d6f3(0xc4)]===0x0)throw new SDKError(ErrorCode[_0x55d6f3(0x16c)],_0x55d6f3(0x13a));if(_0x19d6ed['tools']&&!Array[_0x55d6f3(0x12e)](_0x19d6ed[_0x55d6f3(0x10f)]))throw new SDKError(ErrorCode[_0x55d6f3(0x16c)],_0x55d6f3(0x117));}async[a58_0x44a4f9(0xc7)](_0x5650db,_0x2eb50b){const _0x50ed08=a58_0x44a4f9,_0x31e603=_0x5650db['body'];this['validateMessageRequest'](_0x31e603);const _0x4e09c1=_0x31e603[_0x50ed08(0x14e)]?.[_0x50ed08(0xc4)]??0x0,_0x33f3d2=_0x31e603[_0x50ed08(0x123)]||_0x50ed08(0x12d);this[_0x50ed08(0x107)][_0x50ed08(0x148)](_0x5650db[_0x50ed08(0xe2)]+'\x20'+_0x5650db[_0x50ed08(0x16f)]+_0x50ed08(0x15d)+_0x4e09c1+_0x50ed08(0xd3)+_0x33f3d2),this['logger']['debug'](_0x50ed08(0x129)+colorizeJSONCompact(_0x5650db[_0x50ed08(0xee)]));this['logger'][_0x50ed08(0x10e)]&&this[_0x50ed08(0x107)]['trace'](colorizeJSON(_0x31e603,{'color':!![]}));const _0x1735fc=_0x31e603['metadata']?.[_0x50ed08(0x164)]||'default',_0x51e968=extractSessionUUID(_0x1735fc),_0x767c78=this[_0x50ed08(0xf0)][_0x50ed08(0xd6)](_0x51e968,this[_0x50ed08(0x122)]['projectId']),_0x217eef=[];if(_0x31e603[_0x50ed08(0xfe)]){if(typeof _0x31e603[_0x50ed08(0xfe)]===_0x50ed08(0xe6))_0x217eef[_0x50ed08(0x168)](_0x31e603['system']);else{if(Array[_0x50ed08(0x12e)](_0x31e603[_0x50ed08(0xfe)]))for(const _0xddca52 of _0x31e603[_0x50ed08(0xfe)]){_0xddca52['type']==='text'&&_0xddca52['text']&&_0x217eef['push'](_0xddca52[_0x50ed08(0x157)]);}}}const _0x454a4c=_0x31e603[_0x50ed08(0x10f)]||[],_0x4f9388=_0x31e603['thinking']?.[_0x50ed08(0x103)],_0x400b5d=mapBudgetTokensToReasoningEffort(_0x4f9388,this[_0x50ed08(0x122)][_0x50ed08(0x142)]),_0x3c7daa=calculateContextSignature(_0x31e603['model'],_0x217eef,_0x454a4c,_0x400b5d);let _0x41fb41=_0x767c78['chats'][_0x50ed08(0x11a)](_0x3c7daa);const _0x1440ce=!_0x41fb41;if(!_0x41fb41){const _0x3a3f09=await this[_0x50ed08(0x11c)](_0x31e603['model'],_0x400b5d);_0x41fb41={'chatId':'','agentId':_0x3a3f09,'contextSignature':_0x3c7daa,'embeddedSystemPrompts':new Set(),'embeddedToolsByName':new Map(),'messageHistory':[],'lastUsedAt':Date[_0x50ed08(0x138)]()},_0x767c78[_0x50ed08(0x172)]['set'](_0x3c7daa,_0x41fb41);if(_0x767c78[_0x50ed08(0x172)][_0x50ed08(0xf8)]>MAX_CHATS_PER_SESSION){let _0x1ccec5=null,_0x2c22fa=Date[_0x50ed08(0x138)]();for(const [_0x49ed60,_0x57c4c6]of _0x767c78[_0x50ed08(0x172)]){_0x57c4c6[_0x50ed08(0x14f)]<_0x2c22fa&&(_0x2c22fa=_0x57c4c6[_0x50ed08(0x14f)],_0x1ccec5=_0x49ed60);}_0x1ccec5&&(_0x767c78[_0x50ed08(0x172)]['delete'](_0x1ccec5),this['logger'][_0x50ed08(0x13e)](_0x50ed08(0x151)+_0x1ccec5+')\x20to\x20stay\x20under\x20'+MAX_CHATS_PER_SESSION+_0x50ed08(0xd8)));}}else _0x41fb41[_0x50ed08(0x14f)]=Date[_0x50ed08(0x138)]();if(!_0x41fb41[_0x50ed08(0xd0)]){if(_0x41fb41['creating']&&_0x41fb41[_0x50ed08(0x125)]){this[_0x50ed08(0x107)]['debug'](_0x50ed08(0x120)+_0x3c7daa);try{_0x41fb41[_0x50ed08(0xd0)]=await _0x41fb41['createPromise'];}catch(_0x1bd3a5){this[_0x50ed08(0x107)][_0x50ed08(0x10d)](_0x50ed08(0x119),_0x1bd3a5);}}else{if(!_0x41fb41['creating']){_0x41fb41[_0x50ed08(0xfd)]=!![],_0x41fb41[_0x50ed08(0x125)]=((async()=>{const _0x4c9495=_0x50ed08;try{const _0x306c9b=await this[_0x4c9495(0x122)]['tdx'][_0x4c9495(0x146)][_0x4c9495(0x11e)](_0x41fb41[_0x4c9495(0x124)]);return this['logger'][_0x4c9495(0x148)]('['+_0x306c9b['id']+_0x4c9495(0x144)+_0x31e603['model']+_0x4c9495(0x149)+_0x3c7daa),_0x306c9b['id'];}catch(_0x245aac){this[_0x4c9495(0x107)][_0x4c9495(0x10d)]('Failed\x20to\x20create\x20chat,\x20will\x20fall\x20back\x20to\x20lazy\x20creation:',_0x245aac);throw _0x245aac;}finally{_0x41fb41['creating']=![],_0x41fb41[_0x4c9495(0x125)]=undefined;}})());try{_0x41fb41['chatId']=await _0x41fb41['createPromise'];}catch{}}}}const _0x14843e=_0x217eef[_0x50ed08(0x163)](_0x13e9f6=>!_0x41fb41[_0x50ed08(0xe1)][_0x50ed08(0x13c)](_0x13e9f6)),_0x529858=_0x454a4c['filter'](_0x1bc15b=>!_0x41fb41['embeddedToolsByName'][_0x50ed08(0x13c)](_0x1bc15b[_0x50ed08(0x112)]));this['logger'][_0x50ed08(0x13e)](_0x50ed08(0x141)+_0x51e968+_0x50ed08(0x139)+_0x31e603[_0x50ed08(0x123)]+',\x20context\x20signature:\x20'+_0x3c7daa+_0x50ed08(0xdc)+_0x1440ce),this[_0x50ed08(0x107)][_0x50ed08(0x13e)](_0x50ed08(0xd5)+_0x41fb41[_0x50ed08(0xd0)]),this['logger'][_0x50ed08(0x13e)](_0x50ed08(0x116)+_0x217eef[_0x50ed08(0xc4)]+_0x50ed08(0x166)+_0x454a4c[_0x50ed08(0xc4)]),this[_0x50ed08(0x107)][_0x50ed08(0x13e)](_0x50ed08(0x162)+_0x41fb41[_0x50ed08(0xe1)][_0x50ed08(0xf8)]+',\x20tools:\x20'+_0x41fb41[_0x50ed08(0x108)][_0x50ed08(0xf8)]),this[_0x50ed08(0x107)][_0x50ed08(0x13e)]('New\x20-\x20system\x20prompts:\x20'+_0x14843e['length']+_0x50ed08(0x166)+_0x529858[_0x50ed08(0xc4)]);_0x14843e[_0x50ed08(0xc4)]>0x0&&this[_0x50ed08(0x107)]['debug']('Added\x20system\x20prompt\x20previews:',_0x14843e['map'](_0x26cf2e=>_0x26cf2e[_0x50ed08(0x140)](0x0,0x32)+_0x50ed08(0x137))[_0x50ed08(0x114)](_0x50ed08(0x132)));_0x529858[_0x50ed08(0xc4)]>0x0&&this[_0x50ed08(0x107)]['debug'](_0x50ed08(0x11b),_0x529858[_0x50ed08(0xc8)](_0x2620b4=>_0x2620b4[_0x50ed08(0x112)])[_0x50ed08(0x114)](',\x20'));const _0x51327d=calculateConversationDelta(_0x31e603['messages'],_0x41fb41[_0x50ed08(0xcd)]),_0x2415b7=extractLastUserMessage(_0x51327d,_0x31e603['messages']);if(_0x2415b7[_0x50ed08(0x10d)])throw new SDKError(ErrorCode[_0x50ed08(0x16c)],_0x2415b7['error']);const _0x1ffe07=_0x2415b7[_0x50ed08(0x157)]||'',_0x2abf1e=()=>{const _0x68f410=_0x50ed08,_0x497d73=[];_0x217eef[_0x68f410(0xc4)]>0x0&&_0x497d73[_0x68f410(0x168)](_0x217eef[_0x68f410(0x114)]('\x0a\x0a'));_0x454a4c[_0x68f410(0xc4)]>0x0&&_0x497d73[_0x68f410(0x168)](generateToolPrompt(_0x454a4c));if(_0x31e603[_0x68f410(0x14e)]&&_0x31e603[_0x68f410(0x14e)]['length']>0x1){const _0x5169c2=formatConversationHistory(_0x31e603['messages']);_0x5169c2&&_0x497d73[_0x68f410(0x168)](_0x68f410(0x105)+_0x5169c2+'\x0a</conversation_history>');}return _0x497d73['push'](_0x1ffe07),_0x497d73[_0x68f410(0x163)](_0x3daf84=>_0x3daf84&&_0x3daf84['trim']())['join']('\x0a---\x0a\x0a');};let _0x42d5f2;if(_0x1440ce){this[_0x50ed08(0x107)][_0x50ed08(0x148)]('['+_0x41fb41[_0x50ed08(0xd0)]+']\x20Building\x20a\x20new\x20context\x20for\x20model\x20'+_0x31e603[_0x50ed08(0x123)]+',\x20system_prompts='+_0x217eef['length']+_0x50ed08(0xda)+_0x454a4c[_0x50ed08(0xc4)]+_0x50ed08(0x16a)+_0x454a4c[_0x50ed08(0xc8)](_0x4c45f1=>_0x4c45f1[_0x50ed08(0x112)])[_0x50ed08(0x114)](',\x20')+']'),_0x42d5f2=_0x2abf1e();for(const _0x4df9fe of _0x217eef){_0x41fb41['embeddedSystemPrompts'][_0x50ed08(0x127)](_0x4df9fe);}for(const _0x5d94ec of _0x454a4c){_0x41fb41[_0x50ed08(0x108)]['set'](_0x5d94ec[_0x50ed08(0x112)],_0x5d94ec);}}else{const _0x3a43cb=[];_0x14843e[_0x50ed08(0xc4)]>0x0&&(_0x3a43cb[_0x50ed08(0x168)](_0x14843e[_0x50ed08(0x114)]('\x0a\x0a')),this[_0x50ed08(0x107)][_0x50ed08(0x13e)]('Embedding',_0x14843e[_0x50ed08(0xc4)],'new\x20system\x20prompt(s)'));if(_0x529858[_0x50ed08(0xc4)]>0x0)try{_0x3a43cb[_0x50ed08(0x168)](generateToolPrompt(_0x529858)),this[_0x50ed08(0x107)][_0x50ed08(0x13e)](_0x50ed08(0xdf),_0x529858[_0x50ed08(0xc4)],'new\x20tool(s)');}catch(_0x27a10c){this[_0x50ed08(0x107)][_0x50ed08(0x10d)](_0x50ed08(0x131),_0x27a10c);}try{const _0x4e3bac=extractToolResults(_0x51327d);_0x4e3bac&&(_0x3a43cb[_0x50ed08(0x168)](_0x4e3bac),this[_0x50ed08(0x107)][_0x50ed08(0x13e)](_0x50ed08(0x10b)));}catch(_0x22b2ad){this[_0x50ed08(0x107)][_0x50ed08(0x10d)]('Failed\x20to\x20extract\x20tool\x20results:',_0x22b2ad);}_0x3a43cb['push'](_0x1ffe07);const _0x250a08=_0x3a43cb[_0x50ed08(0x163)](_0x10197b=>_0x10197b&&_0x10197b[_0x50ed08(0x118)]());_0x42d5f2=_0x250a08['length']>0x1?_0x250a08[_0x50ed08(0x114)](_0x50ed08(0x158)):_0x1ffe07;for(const _0x36d2e4 of _0x14843e){_0x41fb41[_0x50ed08(0xe1)][_0x50ed08(0x127)](_0x36d2e4);}for(const _0x5f360 of _0x529858){_0x41fb41['embeddedToolsByName']['set'](_0x5f360[_0x50ed08(0x112)],_0x5f360);}}(!_0x42d5f2||!_0x42d5f2['trim']())&&(this[_0x50ed08(0x107)][_0x50ed08(0x106)](_0x50ed08(0x147)),this[_0x50ed08(0x107)][_0x50ed08(0x106)](_0x50ed08(0x12f),{'isNewContext':_0x1440ce,'userMessageLength':_0x1ffe07?.[_0x50ed08(0xc4)]||0x0,'systemPromptsCount':_0x217eef['length'],'toolsCount':_0x454a4c[_0x50ed08(0xc4)],'messagesCount':_0x31e603[_0x50ed08(0x14e)]?.[_0x50ed08(0xc4)]||0x0,'newMessagesCount':_0x51327d[_0x50ed08(0xc4)]}),clearChatState(_0x41fb41),_0x42d5f2=_0x2abf1e(),(!_0x42d5f2||!_0x42d5f2['trim']())&&(this[_0x50ed08(0x107)]['error'](_0x50ed08(0x153)),this[_0x50ed08(0x107)][_0x50ed08(0x10d)](_0x50ed08(0xc6),{'systemPromptsCount':_0x217eef[_0x50ed08(0xc4)],'toolsCount':_0x454a4c[_0x50ed08(0xc4)],'messagesCount':_0x31e603[_0x50ed08(0x14e)]?.['length']||0x0,'userMessageLength':_0x1ffe07?.[_0x50ed08(0xc4)]||0x0}),_0x42d5f2=_0x50ed08(0xe5)),this[_0x50ed08(0x107)]['info'](_0x50ed08(0xf3),_0x42d5f2[_0x50ed08(0x140)](0x0,0x64)+_0x50ed08(0x137)));const _0x3ec16c=_0x31e603[_0x50ed08(0x143)]!==![];if(_0x3ec16c){_0x2eb50b[_0x50ed08(0x104)]['writeHead'](0xc8,{'Content-Type':_0x50ed08(0xf4),'Cache-Control':_0x50ed08(0x154),'Connection':_0x50ed08(0x130),'X-Accel-Buffering':'no'});const _0x2a2551=generateMessageId();let _0x6a88f9=0x0,_0x4ef6fb=0x0;try{if(_0x41fb41[_0x50ed08(0xd0)]){const _0x39d68b=_0x42d5f2[_0x50ed08(0x140)](0x0,0x32)[_0x50ed08(0x13f)](/\n/g,'\x20');this[_0x50ed08(0x107)]['info']('['+_0x41fb41[_0x50ed08(0xd0)]+_0x50ed08(0xce)+_0x31e603[_0x50ed08(0x123)]+_0x50ed08(0x149)+_0x3c7daa+',\x20'+_0x31e603[_0x50ed08(0x14e)][_0x50ed08(0xc4)]+_0x50ed08(0xfb)+_0x217eef[_0x50ed08(0xc4)]+'\x20system\x20prompts,\x20'+_0x454a4c[_0x50ed08(0xc4)]+_0x50ed08(0x113)+_0x42d5f2[_0x50ed08(0xc4)]+_0x50ed08(0xe7)+_0x39d68b+'...\x22');}const _0x59be3e=this[_0x50ed08(0x122)]['tdx'][_0x50ed08(0x146)][_0x50ed08(0x12b)](_0x42d5f2,{'chatId':_0x41fb41['chatId']||undefined,'agentId':_0x41fb41[_0x50ed08(0xd0)]?undefined:_0x41fb41['agentId']});if(!_0x59be3e){this[_0x50ed08(0x107)][_0x50ed08(0x10d)](_0x50ed08(0x11f)),this[_0x50ed08(0x107)]['error'](_0x50ed08(0x12f),JSON[_0x50ed08(0xcb)]({'chatId':_0x41fb41[_0x50ed08(0xd0)],'agentId':_0x41fb41[_0x50ed08(0x124)],'model':_0x31e603['model'],'sessionId':_0x51e968,'contextSignature':_0x3c7daa})),_0x41fb41[_0x50ed08(0xd0)]='',this[_0x50ed08(0x107)][_0x50ed08(0x106)]('Reset\x20chat\x20ID\x20to\x20recover\x20on\x20next\x20request');const _0x55409c=formatAnthropicSSE({'type':_0x50ed08(0x10d),'error':{'type':_0x50ed08(0xf6),'message':'Failed\x20to\x20initialize\x20chat\x20stream.\x20Please\x20try\x20again.'},'request_id':_0x2a2551});_0x2eb50b[_0x50ed08(0x104)][_0x50ed08(0x174)](_0x55409c),_0x2eb50b[_0x50ed08(0x104)][_0x50ed08(0x15a)]();return;}_0x41fb41[_0x50ed08(0xcd)]=_0x31e603[_0x50ed08(0x14e)];const _0x55f5ef=_0x41fb41;async function*_0x20a324(_0x51970a){const _0x58d495=_0x50ed08;for await(const _0x149d3c of _0x51970a){if(_0x149d3c[_0x58d495(0x11d)]==='metadata')_0x149d3c[_0x58d495(0x14c)]['chatId']&&!_0x55f5ef['chatId']&&(_0x55f5ef[_0x58d495(0xd0)]=_0x149d3c[_0x58d495(0x14c)][_0x58d495(0xd0)]);else _0x149d3c[_0x58d495(0x11d)]===_0x58d495(0x173)&&(yield _0x149d3c[_0x58d495(0x14c)]);}}const _0x341966=_0x20a324(_0x59be3e);_0x6a88f9=estimateInputTokensFromRequest(_0x31e603);const _0x46dc44=transformTDStreamToAnthropic(_0x341966,_0x2a2551,_0x31e603[_0x50ed08(0x123)],this[_0x50ed08(0x107)],_0x1ffe07,_0x6a88f9),_0x1175cc=_0x42d5f2[_0x50ed08(0xc4)];let _0x33ebf6=0x0;for await(const _0x4c3f6b of _0x46dc44){const _0x512416=formatAnthropicSSE(_0x4c3f6b);_0x33ebf6++,this['logger']['debug'](colorizeJSONCompact(_0x4c3f6b,{'color':!![]})),_0x4c3f6b[_0x50ed08(0x11d)]===_0x50ed08(0x10d)&&_0x4c3f6b[_0x50ed08(0x10d)][_0x50ed08(0x11d)]===_0x50ed08(0x170)&&(clearChatState(_0x41fb41),this[_0x50ed08(0x107)]['warn']('[CONTEXT\x20LENGTH\x20ERROR]\x20'+_0x4c3f6b[_0x50ed08(0x10d)][_0x50ed08(0x121)]+'\x20Input\x20size:\x20'+_0x1175cc+_0x50ed08(0xfa)+_0x51e968+',\x20context:\x20'+_0x3c7daa)),_0x4c3f6b[_0x50ed08(0x11d)]===_0x50ed08(0x169)&&_0x4c3f6b['usage']?.[_0x50ed08(0xef)]&&(_0x4ef6fb=_0x4c3f6b[_0x50ed08(0x100)][_0x50ed08(0xef)]),_0x2eb50b[_0x50ed08(0x104)][_0x50ed08(0x174)](_0x512416);}this[_0x50ed08(0x107)][_0x50ed08(0x13e)](_0x50ed08(0x15b)+_0x33ebf6+'\x20SSE\x20events.'),appendUsageEntry(_0x51e968,{'timestamp':new Date()['toISOString'](),'model':_0x31e603[_0x50ed08(0x123)],'inputTokens':_0x6a88f9,'outputTokens':_0x4ef6fb,'contextSignature':_0x3c7daa,'profile':this[_0x50ed08(0x122)][_0x50ed08(0x10a)]?.['context']?.[_0x50ed08(0xcf)],'chatId':_0x41fb41[_0x50ed08(0xd0)]||undefined})[_0x50ed08(0xeb)](_0x216a35=>{const _0x2e8732=_0x50ed08;this[_0x2e8732(0x107)]['warn'](_0x2e8732(0xf9)+_0x216a35);}),_0x2eb50b[_0x50ed08(0x104)][_0x50ed08(0x15a)]();}catch(_0x36e074){(_0x6a88f9>0x0||_0x4ef6fb>0x0)&&appendUsageEntry(_0x51e968,{'timestamp':new Date()[_0x50ed08(0x109)](),'model':_0x31e603[_0x50ed08(0x123)],'inputTokens':_0x6a88f9,'outputTokens':_0x4ef6fb,'contextSignature':_0x3c7daa,'profile':this['config']['tdx']?.['context']?.[_0x50ed08(0xcf)],'chatId':_0x41fb41['chatId']||undefined})['catch'](_0x1bb770=>{const _0x623eae=_0x50ed08;this[_0x623eae(0x107)][_0x623eae(0x106)](_0x623eae(0x159)+_0x1bb770);});const _0x4e6d12=_0x36e074 instanceof Error?_0x36e074[_0x50ed08(0x121)]:_0x50ed08(0x134);this[_0x50ed08(0x107)][_0x50ed08(0x10d)](_0x50ed08(0xca),_0x36e074),this[_0x50ed08(0x107)]['error']('Context:',JSON[_0x50ed08(0xcb)]({'chatId':_0x41fb41['chatId'],'agentId':_0x41fb41['agentId'],'model':_0x31e603[_0x50ed08(0x123)],'sessionId':_0x51e968,'contextSignature':_0x3c7daa})),_0x41fb41['chatId']='',this[_0x50ed08(0x107)][_0x50ed08(0x106)](_0x50ed08(0x160));const _0x313e23=formatAnthropicSSE({'type':_0x50ed08(0x10d),'error':{'type':_0x50ed08(0xf6),'message':_0x4e6d12},'request_id':_0x2a2551});_0x2eb50b[_0x50ed08(0x104)]['write'](_0x313e23),_0x2eb50b[_0x50ed08(0x104)][_0x50ed08(0x15a)]();}}else this[_0x50ed08(0x107)][_0x50ed08(0x10d)](_0x50ed08(0x150)),_0x2eb50b[_0x50ed08(0x156)](0x1f5)[_0x50ed08(0xea)]({'type':_0x50ed08(0x10d),'error':{'type':_0x50ed08(0xe3),'message':'Non-streaming\x20responses\x20are\x20not\x20yet\x20supported'}});}async['handleCountTokens'](_0x5f4741){const _0x2f24f6=a58_0x44a4f9,_0x49e2d6=_0x5f4741['body'],_0x490e76=estimateInputTokensFromRequest(_0x49e2d6);return this[_0x2f24f6(0x107)][_0x2f24f6(0x148)](_0x5f4741[_0x2f24f6(0xe2)]+'\x20'+_0x5f4741[_0x2f24f6(0x16f)]+':\x20estimated\x20input_tokens='+_0x490e76),{'input_tokens':_0x490e76};}async[a58_0x44a4f9(0xff)](){const _0x2262a4=a58_0x44a4f9;try{await this['server'][_0x2262a4(0xc5)]({'port':this[_0x2262a4(0x122)][_0x2262a4(0x15c)],'host':'0.0.0.0'}),this[_0x2262a4(0x107)]['info'](_0x2262a4(0xd1)+this[_0x2262a4(0x122)][_0x2262a4(0x15c)]),this[_0x2262a4(0xf5)]=setInterval(()=>{this['cleanupExpiredChats']();},CLEANUP_INTERVAL_MS),this['logger'][_0x2262a4(0x13e)]('Started\x20cache\x20cleanup\x20interval\x20(runs\x20every\x20'+CLEANUP_INTERVAL_MS/0x3e8+_0x2262a4(0xdb)+CACHE_EXPIRATION_MS/0x3e8+'s)');}catch(_0x3c3d75){const _0xa8a545=_0x3c3d75 instanceof Error?_0x3c3d75[_0x2262a4(0x121)]:'Unknown\x20error';throw new Error(_0x2262a4(0x14b)+_0xa8a545);}}async[a58_0x44a4f9(0x175)](){const _0xf8a927=a58_0x44a4f9;this[_0xf8a927(0xf5)]&&(clearInterval(this[_0xf8a927(0xf5)]),this['cleanupInterval']=undefined),await this[_0xf8a927(0xf2)][_0xf8a927(0xed)]();}[a58_0x44a4f9(0x155)](){const _0x369737=a58_0x44a4f9,_0x155298=this[_0x369737(0xf2)]['server']['address']();if(typeof _0x155298===_0x369737(0xe6))return _0x155298;if(_0x155298)return _0x369737(0x14a)+_0x155298['address']+':'+_0x155298[_0x369737(0x15c)];return _0x369737(0x12c)+this[_0x369737(0x122)][_0x369737(0x15c)];}}
@@ -1 +1 @@
1
- const a59_0x58762e=a59_0x2b88;function a59_0x22e9(){const _0x42bcd0=['values','getOrCreateSession','getOrCreateChat','156PTgKZX','200145tuqGSN','81egoxOG','chats','config','getTotalChatCount','1LNKRge','maxChatsPerSession','delete','clear','get','sessions','4548392MkgNCC','2234091ZnGYIi','cleanupExpiredChats','getSessionCount','lastUsedAt','getSession','now','84882iLkohp','1260838zysfuS','size','2073836QJpMXg','set','\x20not\x20found','2818390HVkXtX'];a59_0x22e9=function(){return _0x42bcd0;};return a59_0x22e9();}function a59_0x2b88(_0x20d912,_0x5240cb){_0x20d912=_0x20d912-0x1f0;const _0x22e954=a59_0x22e9();let _0x2b8825=_0x22e954[_0x20d912];return _0x2b8825;}(function(_0xe7d4,_0x30c2e8){const _0x5f30bb=a59_0x2b88,_0x2f04b6=_0xe7d4();while(!![]){try{const _0x856f7=-parseInt(_0x5f30bb(0x204))/0x1*(parseInt(_0x5f30bb(0x1f5))/0x2)+parseInt(_0x5f30bb(0x20b))/0x3+-parseInt(_0x5f30bb(0x1f7))/0x4+-parseInt(_0x5f30bb(0x1ff))/0x5*(parseInt(_0x5f30bb(0x1fe))/0x6)+parseInt(_0x5f30bb(0x1f4))/0x7+-parseInt(_0x5f30bb(0x20a))/0x8+parseInt(_0x5f30bb(0x200))/0x9*(parseInt(_0x5f30bb(0x1fa))/0xa);if(_0x856f7===_0x30c2e8)break;else _0x2f04b6['push'](_0x2f04b6['shift']());}catch(_0x1b27bc){_0x2f04b6['push'](_0x2f04b6['shift']());}}}(a59_0x22e9,0x82a99));export class SessionCache{['sessions'];['config'];constructor(_0x150bce){const _0xcc07a2=a59_0x2b88;this[_0xcc07a2(0x202)]=_0x150bce,this[_0xcc07a2(0x209)]=new Map();}[a59_0x58762e(0x1fc)](_0x3e3c05,_0x57fe6c){const _0x7c8269=a59_0x58762e;let _0x31d5f0=this[_0x7c8269(0x209)][_0x7c8269(0x208)](_0x3e3c05);return!_0x31d5f0&&(_0x31d5f0={'projectId':_0x57fe6c,'chats':new Map()},this[_0x7c8269(0x209)][_0x7c8269(0x1f8)](_0x3e3c05,_0x31d5f0)),_0x31d5f0;}[a59_0x58762e(0x1f2)](_0xd624c3){const _0x30973a=a59_0x58762e;return this[_0x30973a(0x209)][_0x30973a(0x208)](_0xd624c3);}[a59_0x58762e(0x1fd)](_0x1312a9,_0x259b90,_0x1c5d31){const _0x2bfbd2=a59_0x58762e,_0x3b4dc5=this[_0x2bfbd2(0x209)][_0x2bfbd2(0x208)](_0x1312a9);if(!_0x3b4dc5)throw new Error('Session\x20'+_0x1312a9+_0x2bfbd2(0x1f9));let _0x366ce4=_0x3b4dc5[_0x2bfbd2(0x201)]['get'](_0x259b90);if(!_0x366ce4){_0x366ce4={'chatId':'','agentId':_0x1c5d31,'contextSignature':_0x259b90,'embeddedSystemPrompts':new Set(),'embeddedToolsByName':new Map(),'messageHistory':[],'lastUsedAt':Date[_0x2bfbd2(0x1f3)]()},_0x3b4dc5[_0x2bfbd2(0x201)]['set'](_0x259b90,_0x366ce4);if(_0x3b4dc5['chats']['size']>this[_0x2bfbd2(0x202)][_0x2bfbd2(0x205)]){let _0x4d664e=null,_0x2950d4=Date[_0x2bfbd2(0x1f3)]();for(const [_0x1f2b87,_0x244d28]of _0x3b4dc5[_0x2bfbd2(0x201)]){_0x244d28['lastUsedAt']<_0x2950d4&&(_0x2950d4=_0x244d28[_0x2bfbd2(0x1f1)],_0x4d664e=_0x1f2b87);}_0x4d664e&&_0x3b4dc5['chats']['delete'](_0x4d664e);}}else _0x366ce4[_0x2bfbd2(0x1f1)]=Date[_0x2bfbd2(0x1f3)]();return _0x366ce4;}[a59_0x58762e(0x20c)](){const _0x17d56a=a59_0x58762e,_0x18fb70=Date[_0x17d56a(0x1f3)]();let _0x3f49e3=0x0;for(const [_0x425685,_0x1fb53c]of this[_0x17d56a(0x209)]){const _0x3c8519=[];for(const [_0x4b4ce5,_0x34c2cb]of _0x1fb53c[_0x17d56a(0x201)]){_0x18fb70-_0x34c2cb[_0x17d56a(0x1f1)]>this[_0x17d56a(0x202)]['cacheExpirationMs']&&_0x3c8519['push'](_0x4b4ce5);}for(const _0x4853aa of _0x3c8519){_0x1fb53c[_0x17d56a(0x201)][_0x17d56a(0x206)](_0x4853aa),_0x3f49e3++;}_0x1fb53c['chats'][_0x17d56a(0x1f6)]===0x0&&this[_0x17d56a(0x209)][_0x17d56a(0x206)](_0x425685);}return _0x3f49e3;}[a59_0x58762e(0x1f0)](){const _0x2eae5b=a59_0x58762e;return this['sessions'][_0x2eae5b(0x1f6)];}[a59_0x58762e(0x203)](){const _0x2f9770=a59_0x58762e;let _0x45a4d1=0x0;for(const _0x1f6b4e of this[_0x2f9770(0x209)][_0x2f9770(0x1fb)]()){_0x45a4d1+=_0x1f6b4e[_0x2f9770(0x201)][_0x2f9770(0x1f6)];}return _0x45a4d1;}['clear'](){const _0x1b0ea8=a59_0x58762e;this['sessions'][_0x1b0ea8(0x207)]();}}
1
+ const a59_0x49cb9e=a59_0x1b34;function a59_0x1b34(_0x121917,_0x26ddea){_0x121917=_0x121917-0x183;const _0xb62f51=a59_0xb62f();let _0x1b342f=_0xb62f51[_0x121917];return _0x1b342f;}(function(_0x4eb083,_0x4bb6ba){const _0x5487c4=a59_0x1b34,_0x1f72a6=_0x4eb083();while(!![]){try{const _0x4cb134=parseInt(_0x5487c4(0x18b))/0x1+parseInt(_0x5487c4(0x190))/0x2+parseInt(_0x5487c4(0x194))/0x3+parseInt(_0x5487c4(0x18c))/0x4*(parseInt(_0x5487c4(0x197))/0x5)+-parseInt(_0x5487c4(0x198))/0x6+parseInt(_0x5487c4(0x189))/0x7*(-parseInt(_0x5487c4(0x184))/0x8)+-parseInt(_0x5487c4(0x183))/0x9;if(_0x4cb134===_0x4bb6ba)break;else _0x1f72a6['push'](_0x1f72a6['shift']());}catch(_0x341d39){_0x1f72a6['push'](_0x1f72a6['shift']());}}}(a59_0xb62f,0x74321));export class SessionCache{[a59_0x49cb9e(0x19c)];[a59_0x49cb9e(0x18f)];constructor(_0x2fd717){const _0x33754c=a59_0x49cb9e;this[_0x33754c(0x18f)]=_0x2fd717,this['sessions']=new Map();}['getOrCreateSession'](_0x20dd1e,_0x510cd2){const _0x21b72f=a59_0x49cb9e;let _0x5e0d7e=this[_0x21b72f(0x19c)][_0x21b72f(0x193)](_0x20dd1e);return!_0x5e0d7e&&(_0x5e0d7e={'projectId':_0x510cd2,'chats':new Map()},this[_0x21b72f(0x19c)][_0x21b72f(0x196)](_0x20dd1e,_0x5e0d7e)),_0x5e0d7e;}[a59_0x49cb9e(0x192)](_0x478050){const _0x40b79d=a59_0x49cb9e;return this[_0x40b79d(0x19c)][_0x40b79d(0x193)](_0x478050);}[a59_0x49cb9e(0x199)](_0x2a5eb0,_0x5059ac,_0x5685ef){const _0x3d5f8b=a59_0x49cb9e,_0x658a33=this[_0x3d5f8b(0x19c)]['get'](_0x2a5eb0);if(!_0x658a33)throw new Error(_0x3d5f8b(0x18d)+_0x2a5eb0+'\x20not\x20found');let _0x20ed02=_0x658a33[_0x3d5f8b(0x186)][_0x3d5f8b(0x193)](_0x5059ac);if(!_0x20ed02){_0x20ed02={'chatId':'','agentId':_0x5685ef,'contextSignature':_0x5059ac,'embeddedSystemPrompts':new Set(),'embeddedToolsByName':new Map(),'messageHistory':[],'lastUsedAt':Date['now']()},_0x658a33['chats']['set'](_0x5059ac,_0x20ed02);if(_0x658a33[_0x3d5f8b(0x186)][_0x3d5f8b(0x19b)]>this[_0x3d5f8b(0x18f)][_0x3d5f8b(0x191)]){let _0x3ea67c=null,_0x59839d=Date['now']();for(const [_0x5adc5e,_0x283a16]of _0x658a33[_0x3d5f8b(0x186)]){_0x283a16[_0x3d5f8b(0x188)]<_0x59839d&&(_0x59839d=_0x283a16['lastUsedAt'],_0x3ea67c=_0x5adc5e);}_0x3ea67c&&_0x658a33[_0x3d5f8b(0x186)]['delete'](_0x3ea67c);}}else _0x20ed02[_0x3d5f8b(0x188)]=Date['now']();return _0x20ed02;}['cleanupExpiredChats'](){const _0x4cf0a7=a59_0x49cb9e,_0x408f51=Date['now']();let _0x56cb74=0x0;for(const [_0x33e4e4,_0x206d40]of this['sessions']){const _0x40b3a8=[];for(const [_0xa28174,_0x234b84]of _0x206d40[_0x4cf0a7(0x186)]){_0x408f51-_0x234b84['lastUsedAt']>this[_0x4cf0a7(0x18f)][_0x4cf0a7(0x18a)]&&_0x40b3a8['push'](_0xa28174);}for(const _0x3bf090 of _0x40b3a8){_0x206d40[_0x4cf0a7(0x186)][_0x4cf0a7(0x185)](_0x3bf090),_0x56cb74++;}_0x206d40[_0x4cf0a7(0x186)][_0x4cf0a7(0x19b)]===0x0&&this[_0x4cf0a7(0x19c)][_0x4cf0a7(0x185)](_0x33e4e4);}return _0x56cb74;}[a59_0x49cb9e(0x187)](){const _0x50aae2=a59_0x49cb9e;return this[_0x50aae2(0x19c)][_0x50aae2(0x19b)];}[a59_0x49cb9e(0x19a)](){const _0x554489=a59_0x49cb9e;let _0x21bceb=0x0;for(const _0x2e8a2a of this[_0x554489(0x19c)][_0x554489(0x195)]()){_0x21bceb+=_0x2e8a2a[_0x554489(0x186)]['size'];}return _0x21bceb;}[a59_0x49cb9e(0x18e)](){const _0x1a3054=a59_0x49cb9e;this[_0x1a3054(0x19c)]['clear']();}}function a59_0xb62f(){const _0x5e4e7f=['size','sessions','4722651QduyLg','16iVOpBE','delete','chats','getSessionCount','lastUsedAt','359849naebKh','cacheExpirationMs','49323tKJvnP','1490072JcRyVz','Session\x20','clear','config','814104UmwEWu','maxChatsPerSession','getSession','get','1459950RMiinX','values','set','5RbuIyH','1272318QewEde','getOrCreateChat','getTotalChatCount'];a59_0xb62f=function(){return _0x5e4e7f;};return a59_0xb62f();}
package/dist/sdk/api.js CHANGED
@@ -1 +1 @@
1
- const a60_0x13e9b2=a60_0x35c4;(function(_0x49d126,_0x1cf33c){const _0x376132=a60_0x35c4,_0x3ad981=_0x49d126();while(!![]){try{const _0x307c89=parseInt(_0x376132(0x17c))/0x1+-parseInt(_0x376132(0x176))/0x2+-parseInt(_0x376132(0x178))/0x3*(parseInt(_0x376132(0x18c))/0x4)+-parseInt(_0x376132(0x184))/0x5*(parseInt(_0x376132(0x18a))/0x6)+-parseInt(_0x376132(0x17b))/0x7*(parseInt(_0x376132(0x17e))/0x8)+parseInt(_0x376132(0x174))/0x9+parseInt(_0x376132(0x179))/0xa;if(_0x307c89===_0x1cf33c)break;else _0x3ad981['push'](_0x3ad981['shift']());}catch(_0xc440f7){_0x3ad981['push'](_0x3ad981['shift']());}}}(a60_0x576e,0x84468));import{HTTPClient}from'../client/http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,getTrinoHeaders,toHeaderRecord}from'../core/auth.js';import{readFileSync}from'fs';export class RawAPI{[a60_0x13e9b2(0x18b)];constructor(_0x37b6a1){const _0x1e3c42=a60_0x13e9b2;this[_0x1e3c42(0x18b)]=_0x37b6a1;}async[a60_0x13e9b2(0x188)](_0x4630da,_0x4692ce={}){const _0x1bbdc9=a60_0x13e9b2,{method:method=_0x1bbdc9(0x173),body:_0x364c80,headers:_0x4ae973={},apiType:apiType='td',includeHeaders:includeHeaders=![]}=_0x4692ce;if(!_0x4630da[_0x1bbdc9(0x182)]('/'))throw new Error('Endpoint\x20must\x20start\x20with\x20/:\x20'+_0x4630da);const _0x3a756d=getEndpoint(this[_0x1bbdc9(0x18b)][_0x1bbdc9(0x180)],apiType);let _0x2f36a3;if(apiType===_0x1bbdc9(0x183)){const _0xa16540=getTrinoHeaders(this[_0x1bbdc9(0x18b)][_0x1bbdc9(0x180)],this[_0x1bbdc9(0x18b)]['apiKey']);_0x2f36a3={..._0xa16540,..._0x4ae973};}else{const _0x42ce9c=getAuthHeaders(this[_0x1bbdc9(0x18b)][_0x1bbdc9(0x180)],this[_0x1bbdc9(0x18b)][_0x1bbdc9(0x186)]);_0x2f36a3={...toHeaderRecord(_0x42ce9c),..._0x4ae973};}const _0x2bd164=_0x2f36a3;let _0x357016;_0x364c80!==undefined&&(_0x357016=typeof _0x364c80===_0x1bbdc9(0x181)?_0x364c80:JSON['stringify'](_0x364c80),!_0x2bd164['Content-Type']&&(_0x2bd164[_0x1bbdc9(0x189)]=_0x1bbdc9(0x177)));const _0x242c03=new HTTPClient(_0x3a756d,_0x2bd164,this[_0x1bbdc9(0x18b)][_0x1bbdc9(0x17d)]),_0x4edd37=await _0x242c03[_0x1bbdc9(0x188)](method,_0x4630da,{'body':_0x357016,'includeHeaders':!![]});return includeHeaders?{'data':_0x4edd37[_0x1bbdc9(0x18e)],'status':_0x4edd37[_0x1bbdc9(0x17f)],'headers':_0x4edd37[_0x1bbdc9(0x18d)]}:{'data':_0x4edd37[_0x1bbdc9(0x18e)],'status':_0x4edd37['status']};}static[a60_0x13e9b2(0x175)](_0x480d9a){const _0x1b9967=a60_0x13e9b2;try{return readFileSync(_0x480d9a,_0x1b9967(0x187));}catch(_0x2b95c2){throw new Error(_0x1b9967(0x185)+_0x480d9a+'.\x20'+('Error:\x20'+(_0x2b95c2 instanceof Error?_0x2b95c2[_0x1b9967(0x17a)]:String(_0x2b95c2))));}}}function a60_0x35c4(_0x240e7f,_0xce3c3d){_0x240e7f=_0x240e7f-0x173;const _0x576e60=a60_0x576e();let _0x35c4f5=_0x576e60[_0x240e7f];return _0x35c4f5;}function a60_0x576e(){const _0x3eed46=['3GRUqNl','19003710PvoYur','message','3906nxhRDf','844086DJQRUq','logger','7496MRYIKP','status','site','string','startsWith','trino','212315VKGklE','Failed\x20to\x20read\x20request\x20body\x20from\x20file:\x20','apiKey','utf-8','request','Content-Type','84KMDCsQ','context','2516324RBnJSf','headers','data','GET','1298997xblQAN','readBodyFromFile','1201162NCDsbR','application/json'];a60_0x576e=function(){return _0x3eed46;};return a60_0x576e();}
1
+ function a60_0x403b(_0x5a17c8,_0x287f14){_0x5a17c8=_0x5a17c8-0x137;const _0x41aa5f=a60_0x41aa();let _0x403ba9=_0x41aa5f[_0x5a17c8];return _0x403ba9;}const a60_0xe88612=a60_0x403b;(function(_0x757869,_0x46021b){const _0x33fe97=a60_0x403b,_0xae055=_0x757869();while(!![]){try{const _0x5696c9=-parseInt(_0x33fe97(0x137))/0x1+-parseInt(_0x33fe97(0x13e))/0x2+-parseInt(_0x33fe97(0x146))/0x3+parseInt(_0x33fe97(0x143))/0x4*(parseInt(_0x33fe97(0x14e))/0x5)+-parseInt(_0x33fe97(0x14b))/0x6+-parseInt(_0x33fe97(0x144))/0x7*(-parseInt(_0x33fe97(0x147))/0x8)+parseInt(_0x33fe97(0x138))/0x9;if(_0x5696c9===_0x46021b)break;else _0xae055['push'](_0xae055['shift']());}catch(_0x5c9a45){_0xae055['push'](_0xae055['shift']());}}}(a60_0x41aa,0x7b34c));import{HTTPClient}from'../client/http-client.js';import{getEndpoint}from'../types/index.js';function a60_0x41aa(){const _0x5682ed=['19116036GuGJtZ','status','request','data','utf-8','readBodyFromFile','370496sSQEIV','logger','headers','context','GET','1960104asOOqJ','14LWNbRs','Error:\x20','2964462dqMgbR','3069656ubhriN','string','site','Content-Type','4667076BazzYv','Failed\x20to\x20read\x20request\x20body\x20from\x20file:\x20','Endpoint\x20must\x20start\x20with\x20/:\x20','5RKHFlN','apiKey','stringify','925544IOQgOT'];a60_0x41aa=function(){return _0x5682ed;};return a60_0x41aa();}import{getAuthHeaders,getTrinoHeaders,toHeaderRecord}from'../core/auth.js';import{readFileSync}from'fs';export class RawAPI{[a60_0xe88612(0x141)];constructor(_0x34f7b7){const _0x1933c2=a60_0xe88612;this[_0x1933c2(0x141)]=_0x34f7b7;}async[a60_0xe88612(0x13a)](_0x59caeb,_0x24bf08={}){const _0x20f447=a60_0xe88612,{method:method=_0x20f447(0x142),body:_0x954d19,headers:_0x447d1f={},apiType:apiType='td',includeHeaders:includeHeaders=![]}=_0x24bf08;if(!_0x59caeb['startsWith']('/'))throw new Error(_0x20f447(0x14d)+_0x59caeb);const _0x3b4006=getEndpoint(this['context'][_0x20f447(0x149)],apiType);let _0x1f1a3e;if(apiType==='trino'){const _0x2cb54d=getTrinoHeaders(this[_0x20f447(0x141)]['site'],this['context'][_0x20f447(0x14f)]);_0x1f1a3e={..._0x2cb54d,..._0x447d1f};}else{const _0x7caef=getAuthHeaders(this['context'][_0x20f447(0x149)],this[_0x20f447(0x141)]['apiKey']);_0x1f1a3e={...toHeaderRecord(_0x7caef),..._0x447d1f};}const _0x120601=_0x1f1a3e;let _0x12a19a;_0x954d19!==undefined&&(_0x12a19a=typeof _0x954d19===_0x20f447(0x148)?_0x954d19:JSON[_0x20f447(0x150)](_0x954d19),!_0x120601[_0x20f447(0x14a)]&&(_0x120601[_0x20f447(0x14a)]='application/json'));const _0x2e5710=new HTTPClient(_0x3b4006,_0x120601,this[_0x20f447(0x141)][_0x20f447(0x13f)]),_0x1379d8=await _0x2e5710['request'](method,_0x59caeb,{'body':_0x12a19a,'includeHeaders':!![]});return includeHeaders?{'data':_0x1379d8[_0x20f447(0x13b)],'status':_0x1379d8[_0x20f447(0x139)],'headers':_0x1379d8[_0x20f447(0x140)]}:{'data':_0x1379d8[_0x20f447(0x13b)],'status':_0x1379d8['status']};}static[a60_0xe88612(0x13d)](_0x2d7404){const _0x326306=a60_0xe88612;try{return readFileSync(_0x2d7404,_0x326306(0x13c));}catch(_0x48f4ce){throw new Error(_0x326306(0x14c)+_0x2d7404+'.\x20'+(_0x326306(0x145)+(_0x48f4ce instanceof Error?_0x48f4ce['message']:String(_0x48f4ce))));}}}
@@ -1 +1 @@
1
- const a61_0x1af565=a61_0x55aa;function a61_0x32bf(){const _0x19f1f8=['2929352AQYaYp','5sIYjsF','8110893EzuWor','12815570ylTsna','logger','127IneDdr','name','default','listConnections','profile','list','3884505OBgBwP','find','map','CONNECTION_NOT_FOUND','18dIkPEd','client','clearCache','findByName','Use\x20\x27tdx\x20connections\x27\x20to\x20list\x20available\x20connections','21626utpKRb','Connection\x20not\x20found:\x20','7487916RNTPDP','resolve','5273012DqXYuD','buildIdToNameMap'];a61_0x32bf=function(){return _0x19f1f8;};return a61_0x32bf();}(function(_0x4a5f42,_0x1f3b10){const _0x5102d5=a61_0x55aa,_0x57f135=_0x4a5f42();while(!![]){try{const _0xe4fa7d=-parseInt(_0x5102d5(0xad))/0x1*(parseInt(_0x5102d5(0xbc))/0x2)+parseInt(_0x5102d5(0xb3))/0x3+parseInt(_0x5102d5(0xc0))/0x4+-parseInt(_0x5102d5(0xc3))/0x5*(-parseInt(_0x5102d5(0xbe))/0x6)+-parseInt(_0x5102d5(0xaa))/0x7+-parseInt(_0x5102d5(0xc2))/0x8*(-parseInt(_0x5102d5(0xb7))/0x9)+-parseInt(_0x5102d5(0xab))/0xa;if(_0xe4fa7d===_0x1f3b10)break;else _0x57f135['push'](_0x57f135['shift']());}catch(_0x5e4e8e){_0x57f135['push'](_0x57f135['shift']());}}}(a61_0x32bf,0xbe681));function a61_0x55aa(_0x3ac2f3,_0x348f6d){_0x3ac2f3=_0x3ac2f3-0xaa;const _0x32bfe1=a61_0x32bf();let _0x55aa4f=_0x32bfe1[_0x3ac2f3];return _0x55aa4f;}import{TDApiClient}from'../client/td-api-client.js';import{SDKError,ErrorCode}from'./errors.js';import{loadCachedConnections,saveCachedConnections,clearConnectionCache}from'../core/connection-cache.js';export class ConnectionSDK{[a61_0x1af565(0xb8)];[a61_0x1af565(0xb1)];constructor(_0x2cc493){const _0x3fce34=a61_0x1af565;this[_0x3fce34(0xb8)]=new TDApiClient(_0x2cc493,_0x2cc493[_0x3fce34(0xac)]),this[_0x3fce34(0xb1)]=_0x2cc493[_0x3fce34(0xb1)]||_0x3fce34(0xaf);}async['list'](_0x47f180=![]){const _0x49b247=a61_0x1af565;if(!_0x47f180){const _0x5bf2bc=loadCachedConnections(this[_0x49b247(0xb1)]);if(_0x5bf2bc)return _0x5bf2bc;}const _0x2b7eae=await this[_0x49b247(0xb8)][_0x49b247(0xb0)]();return saveCachedConnections(this[_0x49b247(0xb1)],_0x2b7eae),_0x2b7eae;}[a61_0x1af565(0xb9)](){clearConnectionCache(this['profile']);}async['get'](_0x16362e){const _0x3dd27b=a61_0x1af565;return this[_0x3dd27b(0xb8)]['getConnection'](_0x16362e);}async[a61_0x1af565(0xba)](_0x100337){const _0x1a3561=a61_0x1af565,_0x38be3f=await this[_0x1a3561(0xb2)]();return _0x38be3f[_0x1a3561(0xb4)](_0x485d61=>_0x485d61[_0x1a3561(0xae)]===_0x100337);}async['findById'](_0x1e471f){const _0x2ddd26=a61_0x1af565,_0x6a0e7e=await this[_0x2ddd26(0xb2)]();return _0x6a0e7e[_0x2ddd26(0xb4)](_0xe1352d=>_0xe1352d['id']===_0x1e471f);}async[a61_0x1af565(0xbf)](_0x3a02fa){const _0x5976f8=a61_0x1af565;let _0x1c80e6=await this['findByName'](_0x3a02fa);if(!_0x1c80e6){const _0x1ebe82=await this[_0x5976f8(0xb2)](!![]);_0x1c80e6=_0x1ebe82[_0x5976f8(0xb4)](_0x1599ca=>_0x1599ca[_0x5976f8(0xae)]===_0x3a02fa);}if(!_0x1c80e6)throw new SDKError(ErrorCode[_0x5976f8(0xb6)],_0x5976f8(0xbd)+_0x3a02fa,undefined,{'helpText':_0x5976f8(0xbb)});return _0x1c80e6;}async[a61_0x1af565(0xc1)](){const _0x13c94e=a61_0x1af565,_0x4b9375=await this[_0x13c94e(0xb2)]();return new Map(_0x4b9375[_0x13c94e(0xb5)](_0x354704=>[_0x354704['id'],_0x354704[_0x13c94e(0xae)]]));}async['buildNameToIdMap'](){const _0x564d49=a61_0x1af565,_0x1e45bc=await this[_0x564d49(0xb2)]();return new Map(_0x1e45bc['map'](_0x49ec19=>[_0x49ec19['name'],parseInt(_0x49ec19['id'],0xa)]));}}
1
+ const a61_0x4aaf59=a61_0x59be;(function(_0x5ee0b5,_0x57df6e){const _0x52beee=a61_0x59be,_0x13b846=_0x5ee0b5();while(!![]){try{const _0x2c78f7=parseInt(_0x52beee(0x162))/0x1*(-parseInt(_0x52beee(0x176))/0x2)+-parseInt(_0x52beee(0x16e))/0x3*(-parseInt(_0x52beee(0x16a))/0x4)+parseInt(_0x52beee(0x15c))/0x5*(parseInt(_0x52beee(0x166))/0x6)+parseInt(_0x52beee(0x160))/0x7*(-parseInt(_0x52beee(0x179))/0x8)+-parseInt(_0x52beee(0x15d))/0x9*(-parseInt(_0x52beee(0x171))/0xa)+parseInt(_0x52beee(0x16c))/0xb+-parseInt(_0x52beee(0x167))/0xc;if(_0x2c78f7===_0x57df6e)break;else _0x13b846['push'](_0x13b846['shift']());}catch(_0x3a2cd6){_0x13b846['push'](_0x13b846['shift']());}}}(a61_0x73af,0x3efda));import{TDApiClient}from'../client/td-api-client.js';import{SDKError,ErrorCode}from'./errors.js';function a61_0x59be(_0xd2b686,_0x302c93){_0xd2b686=_0xd2b686-0x15b;const _0x73af98=a61_0x73af();let _0x59be60=_0x73af98[_0xd2b686];return _0x59be60;}function a61_0x73af(){const _0x2640c1=['resolve','500ZiMgkm','buildIdToNameMap','Use\x20\x27tdx\x20connections\x27\x20to\x20list\x20available\x20connections','816GbXKkr','get','10kBiUdd','9AWTdjv','buildNameToIdMap','name','10003ZPcbUF','map','606BUbhjs','client','Connection\x20not\x20found:\x20','profile','666654uThUXW','6765516LtGdmF','find','logger','4KphsfT','findById','4252501NaxASf','getConnection','64869utLGkc','CONNECTION_NOT_FOUND','findByName','4886290xYNPVB','listConnections','clearCache','list'];a61_0x73af=function(){return _0x2640c1;};return a61_0x73af();}import{loadCachedConnections,saveCachedConnections,clearConnectionCache}from'../core/connection-cache.js';export class ConnectionSDK{[a61_0x4aaf59(0x163)];[a61_0x4aaf59(0x165)];constructor(_0xa39650){const _0x1800ad=a61_0x4aaf59;this[_0x1800ad(0x163)]=new TDApiClient(_0xa39650,_0xa39650[_0x1800ad(0x169)]),this[_0x1800ad(0x165)]=_0xa39650['profile']||'default';}async[a61_0x4aaf59(0x174)](_0x7e3a08=![]){const _0x2230ae=a61_0x4aaf59;if(!_0x7e3a08){const _0x1471de=loadCachedConnections(this[_0x2230ae(0x165)]);if(_0x1471de)return _0x1471de;}const _0x1e6d53=await this[_0x2230ae(0x163)][_0x2230ae(0x172)]();return saveCachedConnections(this[_0x2230ae(0x165)],_0x1e6d53),_0x1e6d53;}[a61_0x4aaf59(0x173)](){const _0x388585=a61_0x4aaf59;clearConnectionCache(this[_0x388585(0x165)]);}async[a61_0x4aaf59(0x15b)](_0x2cd9a2){const _0x3feb94=a61_0x4aaf59;return this[_0x3feb94(0x163)][_0x3feb94(0x16d)](_0x2cd9a2);}async[a61_0x4aaf59(0x170)](_0x2b77eb){const _0x1734b8=a61_0x4aaf59,_0x1b1c64=await this[_0x1734b8(0x174)]();return _0x1b1c64['find'](_0x386155=>_0x386155['name']===_0x2b77eb);}async[a61_0x4aaf59(0x16b)](_0x105de4){const _0x15d963=a61_0x4aaf59,_0x60a848=await this[_0x15d963(0x174)]();return _0x60a848[_0x15d963(0x168)](_0x1731a6=>_0x1731a6['id']===_0x105de4);}async[a61_0x4aaf59(0x175)](_0x5bcf95){const _0xdae277=a61_0x4aaf59;let _0x51835d=await this[_0xdae277(0x170)](_0x5bcf95);if(!_0x51835d){const _0x353dd2=await this[_0xdae277(0x174)](!![]);_0x51835d=_0x353dd2[_0xdae277(0x168)](_0x40e9e5=>_0x40e9e5[_0xdae277(0x15f)]===_0x5bcf95);}if(!_0x51835d)throw new SDKError(ErrorCode[_0xdae277(0x16f)],_0xdae277(0x164)+_0x5bcf95,undefined,{'helpText':_0xdae277(0x178)});return _0x51835d;}async[a61_0x4aaf59(0x177)](){const _0x407e18=a61_0x4aaf59,_0x464b5f=await this[_0x407e18(0x174)]();return new Map(_0x464b5f[_0x407e18(0x161)](_0x2c437a=>[_0x2c437a['id'],_0x2c437a[_0x407e18(0x15f)]]));}async[a61_0x4aaf59(0x15e)](){const _0x39b314=a61_0x4aaf59,_0xb8a245=await this[_0x39b314(0x174)]();return new Map(_0xb8a245['map'](_0x541357=>[_0x541357[_0x39b314(0x15f)],parseInt(_0x541357['id'],0xa)]));}}
@@ -1 +1 @@
1
- const a62_0x3c9d69=a62_0x42e3;function a62_0x2bfc(){const _0x2648fb=['getTemplateFull','11583733gmGSNy','Use\x20--workspace-id\x20to\x20narrow\x20the\x20search,\x20or\x20use\x20the\x20campaign\x20UUID\x20directly.','1ztpGmD','isArray','INVALID_ARGUMENT','normalizeWorkspace','audienceName','Campaign\x20not\x20found:\x20','205844mIYugY','applicableParentSegments','name','getCampaign','updatedAt','11bpBuOH','getWorkspace','normalizeCampaign','Use\x20\x22tdx\x20engage\x20workspace\x20list\x22\x20to\x20see\x20available\x20workspaces.','segmentName','filter','Email\x20template\x20not\x20found\x20with\x20ID:\x20','type','Email\x20template\x20not\x20found:\x20','attributes','launchedAt','updateCampaign','normalizeTemplate','resumeCampaign','length','deleteWorkspace','subjectTemplate','join','getCampaignFull','\x22:\x20','isUUID','getWorkspaceFull','createdAt','getTemplate','resolveWorkspaceId','deleteCampaign','Use\x20the\x20workspace\x20UUID\x20directly\x20to\x20select\x20a\x20specific\x20workspace.','Use\x20\x22tdx\x20engage\x20campaign\x20list\x22\x20to\x20see\x20available\x20campaigns.','client','NOT_FOUND','pauseCampaign','resolveTemplateId','duplicateCampaign','listCampaigns','47122910aiyIbQ','createWorkspace','test','listWorkspaces','workspaceId','segmentId','resolveCampaignId','data','Use\x20\x22tdx\x20engage\x20template\x20list\x22\x20to\x20see\x20available\x20templates.','createTemplate','9GfBpOE','Multiple\x20templates\x20found\x20with\x20name\x20\x22','updateWorkspace','deleteTemplate','editorType','workspaceConfig','3468464dyIPPD','69eFiGZs','Multiple\x20workspaces\x20found\x20with\x20name\x20\x22','audienceId','listTemplates','5239475TdVNBW','8654586kkpbGU','code','1913092aExnbl','map','description','limit','status'];a62_0x2bfc=function(){return _0x2648fb;};return a62_0x2bfc();}(function(_0x24eb8f,_0x1ccb74){const _0x38cc30=a62_0x42e3,_0x595b01=_0x24eb8f();while(!![]){try{const _0x336cdb=parseInt(_0x38cc30(0x194))/0x1*(-parseInt(_0x38cc30(0x18c))/0x2)+-parseInt(_0x38cc30(0x185))/0x3*(parseInt(_0x38cc30(0x19a))/0x4)+-parseInt(_0x38cc30(0x189))/0x5+parseInt(_0x38cc30(0x18a))/0x6+-parseInt(_0x38cc30(0x192))/0x7+parseInt(_0x38cc30(0x184))/0x8*(-parseInt(_0x38cc30(0x1cb))/0x9)+-parseInt(_0x38cc30(0x1c1))/0xa*(-parseInt(_0x38cc30(0x19f))/0xb);if(_0x336cdb===_0x1ccb74)break;else _0x595b01['push'](_0x595b01['shift']());}catch(_0x59aff2){_0x595b01['push'](_0x595b01['shift']());}}}(a62_0x2bfc,0xd66dd));import{EngageApiClient}from'../client/engage-api-client.js';function a62_0x42e3(_0x4d6c73,_0x2d62ca){_0x4d6c73=_0x4d6c73-0x182;const _0x2bfcfe=a62_0x2bfc();let _0x42e3e6=_0x2bfcfe[_0x4d6c73];return _0x42e3e6;}import{SDKError,ErrorCode}from'./errors.js';export class EngageSDK{[a62_0x3c9d69(0x1bb)];constructor(_0x577d18){this['client']=new EngageApiClient(_0x577d18);}[a62_0x3c9d69(0x1b3)](_0x553a25){const _0x311e33=a62_0x3c9d69;return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i[_0x311e33(0x1c3)](_0x553a25);}[a62_0x3c9d69(0x1a1)](_0x3e05a6){const _0x31777e=a62_0x3c9d69;return{'id':_0x3e05a6['id'],'name':_0x3e05a6['attributes'][_0x31777e(0x19c)],'campaignType':_0x3e05a6[_0x31777e(0x1a8)]['campaignType'],'status':_0x3e05a6[_0x31777e(0x1a8)][_0x31777e(0x190)],'description':_0x3e05a6[_0x31777e(0x1a8)][_0x31777e(0x18e)],'workspaceId':_0x3e05a6[_0x31777e(0x1a8)][_0x31777e(0x1c5)],'audienceId':_0x3e05a6['attributes'][_0x31777e(0x187)],'audienceName':_0x3e05a6[_0x31777e(0x1a8)][_0x31777e(0x198)],'segmentId':_0x3e05a6[_0x31777e(0x1a8)][_0x31777e(0x1c6)],'segmentName':_0x3e05a6[_0x31777e(0x1a8)][_0x31777e(0x1a3)],'enableUtmTracking':_0x3e05a6[_0x31777e(0x1a8)]['enableUtmTracking'],'createdAt':_0x3e05a6[_0x31777e(0x1a8)][_0x31777e(0x1b5)],'updatedAt':_0x3e05a6[_0x31777e(0x1a8)][_0x31777e(0x19e)],'launchedAt':_0x3e05a6[_0x31777e(0x1a8)][_0x31777e(0x1a9)]};}[a62_0x3c9d69(0x1ab)](_0xe7e8f8){const _0x47d84c=a62_0x3c9d69;return{'id':_0xe7e8f8['id'],'name':_0xe7e8f8[_0x47d84c(0x1a8)][_0x47d84c(0x19c)],'subjectTemplate':_0xe7e8f8[_0x47d84c(0x1a8)][_0x47d84c(0x1af)],'workspaceId':_0xe7e8f8[_0x47d84c(0x1a8)][_0x47d84c(0x1c5)],'editorType':_0xe7e8f8[_0x47d84c(0x1a8)][_0x47d84c(0x182)],'createdAt':_0xe7e8f8[_0x47d84c(0x1a8)][_0x47d84c(0x1b5)],'updatedAt':_0xe7e8f8[_0x47d84c(0x1a8)][_0x47d84c(0x19e)]};}['normalizeWorkspace'](_0x55ab71){const _0x3e90ad=a62_0x3c9d69;return{'id':_0x55ab71['id'],'name':_0x55ab71[_0x3e90ad(0x1a8)][_0x3e90ad(0x19c)],'description':_0x55ab71[_0x3e90ad(0x1a8)]['description'],'ownerName':_0x55ab71[_0x3e90ad(0x1a8)]['ownerUser']['name'],'domainCount':_0x55ab71[_0x3e90ad(0x1a8)][_0x3e90ad(0x183)]['applicableDomains']['length'],'segmentCount':_0x55ab71[_0x3e90ad(0x1a8)]['workspaceConfig'][_0x3e90ad(0x19b)][_0x3e90ad(0x1ad)],'createdAt':_0x55ab71[_0x3e90ad(0x1a8)][_0x3e90ad(0x1b5)],'updatedAt':_0x55ab71[_0x3e90ad(0x1a8)][_0x3e90ad(0x19e)]};}async[a62_0x3c9d69(0x1c7)](_0x11b496,_0x1366e7){const _0x49b378=a62_0x3c9d69;if(this[_0x49b378(0x1b3)](_0x11b496))try{return await this['client'][_0x49b378(0x19d)](_0x11b496),_0x11b496;}catch(_0x47cc94){if(_0x47cc94 instanceof SDKError&&_0x47cc94['code']===ErrorCode['NOT_FOUND'])throw new SDKError(ErrorCode[_0x49b378(0x1bc)],'Campaign\x20not\x20found\x20with\x20ID:\x20'+_0x11b496,_0x47cc94,{'helpText':_0x49b378(0x1ba)});throw _0x47cc94;}const _0x58cd79=await this[_0x49b378(0x1bb)][_0x49b378(0x1c0)]({'workspaceId':_0x1366e7}),_0x4f4e99=Array[_0x49b378(0x195)](_0x58cd79['data'])?_0x58cd79['data']:[_0x58cd79[_0x49b378(0x1c8)]],_0x94f299=_0x4f4e99['filter'](_0x1d1467=>_0x1d1467[_0x49b378(0x1a8)][_0x49b378(0x19c)]===_0x11b496);if(_0x94f299['length']===0x0)throw new SDKError(ErrorCode[_0x49b378(0x1bc)],_0x49b378(0x199)+_0x11b496,undefined,{'helpText':_0x49b378(0x1ba)});if(_0x94f299['length']>0x1){const _0x237f5c=_0x94f299[_0x49b378(0x18d)](_0x37c540=>_0x37c540['id'])[_0x49b378(0x1b0)](',\x20');throw new SDKError(ErrorCode[_0x49b378(0x196)],'Multiple\x20campaigns\x20found\x20with\x20name\x20\x22'+_0x11b496+'\x22:\x20'+_0x237f5c,undefined,{'helpText':_0x49b378(0x193)});}return _0x94f299[0x0]['id'];}async['resolveTemplateId'](_0x35dd54,_0x454bf6){const _0x47f04b=a62_0x3c9d69;if(this[_0x47f04b(0x1b3)](_0x35dd54))try{return await this[_0x47f04b(0x1bb)][_0x47f04b(0x1b6)](_0x35dd54),_0x35dd54;}catch(_0x26d430){if(_0x26d430 instanceof SDKError&&_0x26d430[_0x47f04b(0x18b)]===ErrorCode[_0x47f04b(0x1bc)])throw new SDKError(ErrorCode[_0x47f04b(0x1bc)],_0x47f04b(0x1a5)+_0x35dd54,_0x26d430,{'helpText':_0x47f04b(0x1c9)});throw _0x26d430;}const _0x286c4a=await this[_0x47f04b(0x1bb)]['listTemplates']({'workspaceId':_0x454bf6}),_0x3256d5=Array[_0x47f04b(0x195)](_0x286c4a['data'])?_0x286c4a[_0x47f04b(0x1c8)]:[_0x286c4a['data']],_0x36a443=_0x3256d5[_0x47f04b(0x1a4)](_0x5208d0=>_0x5208d0[_0x47f04b(0x1a8)]['name']===_0x35dd54);if(_0x36a443[_0x47f04b(0x1ad)]===0x0)throw new SDKError(ErrorCode[_0x47f04b(0x1bc)],_0x47f04b(0x1a7)+_0x35dd54,undefined,{'helpText':_0x47f04b(0x1c9)});if(_0x36a443['length']>0x1){const _0xd96d87=_0x36a443[_0x47f04b(0x18d)](_0x4cf460=>_0x4cf460['id'])[_0x47f04b(0x1b0)](',\x20');throw new SDKError(ErrorCode[_0x47f04b(0x196)],_0x47f04b(0x1cc)+_0x35dd54+_0x47f04b(0x1b2)+_0xd96d87,undefined,{'helpText':'Use\x20--workspace-id\x20to\x20narrow\x20the\x20search,\x20or\x20use\x20the\x20template\x20UUID\x20directly.'});}return _0x36a443[0x0]['id'];}async[a62_0x3c9d69(0x1b7)](_0x43073f){const _0x21e7e4=a62_0x3c9d69;if(this[_0x21e7e4(0x1b3)](_0x43073f))try{return await this[_0x21e7e4(0x1bb)][_0x21e7e4(0x1a0)](_0x43073f),_0x43073f;}catch(_0x4e8295){if(_0x4e8295 instanceof SDKError&&_0x4e8295[_0x21e7e4(0x18b)]===ErrorCode[_0x21e7e4(0x1bc)])throw new SDKError(ErrorCode[_0x21e7e4(0x1bc)],'Workspace\x20not\x20found\x20with\x20ID:\x20'+_0x43073f,_0x4e8295,{'helpText':_0x21e7e4(0x1a2)});throw _0x4e8295;}const _0x44ecb2=await this[_0x21e7e4(0x1bb)][_0x21e7e4(0x1c4)]({'name':_0x43073f}),_0x107679=Array[_0x21e7e4(0x195)](_0x44ecb2[_0x21e7e4(0x1c8)])?_0x44ecb2[_0x21e7e4(0x1c8)]:[_0x44ecb2[_0x21e7e4(0x1c8)]],_0x383e09=_0x107679[_0x21e7e4(0x1a4)](_0x4baef1=>_0x4baef1[_0x21e7e4(0x1a8)][_0x21e7e4(0x19c)]===_0x43073f);if(_0x383e09['length']===0x0)throw new SDKError(ErrorCode[_0x21e7e4(0x1bc)],'Workspace\x20not\x20found:\x20'+_0x43073f,undefined,{'helpText':_0x21e7e4(0x1a2)});if(_0x383e09[_0x21e7e4(0x1ad)]>0x1){const _0x4b1b11=_0x383e09['map'](_0x50739b=>_0x50739b['id'])[_0x21e7e4(0x1b0)](',\x20');throw new SDKError(ErrorCode[_0x21e7e4(0x196)],_0x21e7e4(0x186)+_0x43073f+'\x22:\x20'+_0x4b1b11,undefined,{'helpText':_0x21e7e4(0x1b9)});}return _0x383e09[0x0]['id'];}async[a62_0x3c9d69(0x1c0)](_0x3e9153){const _0x1845c6=a62_0x3c9d69,_0x481a97=await this[_0x1845c6(0x1bb)][_0x1845c6(0x1c0)]({'campaignType':_0x3e9153?.[_0x1845c6(0x1a6)],'status':_0x3e9153?.['status'],'workspaceId':_0x3e9153?.[_0x1845c6(0x1c5)],'limit':_0x3e9153?.[_0x1845c6(0x18f)]}),_0x84402c=Array[_0x1845c6(0x195)](_0x481a97[_0x1845c6(0x1c8)])?_0x481a97[_0x1845c6(0x1c8)]:[_0x481a97[_0x1845c6(0x1c8)]];return _0x84402c[_0x1845c6(0x18d)](_0x125706=>this['normalizeCampaign'](_0x125706));}async[a62_0x3c9d69(0x19d)](_0x32a02b,_0x3ad7ab){const _0x1b7385=a62_0x3c9d69,_0x43ac7c=await this[_0x1b7385(0x1c7)](_0x32a02b,_0x3ad7ab),_0x3984fc=await this['client'][_0x1b7385(0x19d)](_0x43ac7c);return this[_0x1b7385(0x1a1)](_0x3984fc[_0x1b7385(0x1c8)]);}async[a62_0x3c9d69(0x1b1)](_0x4c7813,_0x5be770){const _0x2ac03e=a62_0x3c9d69,_0x1570b2=await this['resolveCampaignId'](_0x4c7813,_0x5be770),_0x2bdfc9=await this['client'][_0x2ac03e(0x19d)](_0x1570b2);return _0x2bdfc9[_0x2ac03e(0x1c8)];}async['createCampaign'](_0x157523){const _0x58b435=a62_0x3c9d69,_0xd355fc=await this[_0x58b435(0x1bb)]['createCampaign'](_0x157523);return this[_0x58b435(0x1a1)](_0xd355fc[_0x58b435(0x1c8)]);}async[a62_0x3c9d69(0x1aa)](_0x3c5222,_0x476ac8,_0x400e0a){const _0x38060d=a62_0x3c9d69,_0x489cca=await this[_0x38060d(0x1c7)](_0x3c5222,_0x400e0a),_0x2be46e=await this['client'][_0x38060d(0x1aa)](_0x489cca,_0x476ac8);return this[_0x38060d(0x1a1)](_0x2be46e[_0x38060d(0x1c8)]);}async[a62_0x3c9d69(0x1b8)](_0x3e8774,_0x2b9f97){const _0x10df3a=a62_0x3c9d69,_0x45c4c6=await this[_0x10df3a(0x1c7)](_0x3e8774,_0x2b9f97);await this[_0x10df3a(0x1bb)][_0x10df3a(0x1b8)](_0x45c4c6);}async['launchCampaign'](_0x260edf,_0x48a23b){const _0xfbf210=a62_0x3c9d69,_0x291936=await this['resolveCampaignId'](_0x260edf,_0x48a23b);await this[_0xfbf210(0x1bb)]['launchCampaign'](_0x291936);}async['pauseCampaign'](_0x36528e,_0x2e4454){const _0x106265=a62_0x3c9d69,_0x4a5094=await this['resolveCampaignId'](_0x36528e,_0x2e4454);await this[_0x106265(0x1bb)][_0x106265(0x1bd)](_0x4a5094);}async['resumeCampaign'](_0x157462,_0x1d2dc3){const _0x4c1c36=a62_0x3c9d69,_0x5ec127=await this['resolveCampaignId'](_0x157462,_0x1d2dc3);await this[_0x4c1c36(0x1bb)][_0x4c1c36(0x1ac)](_0x5ec127);}async[a62_0x3c9d69(0x1bf)](_0x56b8ef,_0x1b7905){const _0x2f1d51=a62_0x3c9d69,_0x34a3bb=await this[_0x2f1d51(0x1c7)](_0x56b8ef,_0x1b7905),_0x54d946=await this[_0x2f1d51(0x1bb)][_0x2f1d51(0x1bf)](_0x34a3bb);return this[_0x2f1d51(0x1a1)](_0x54d946[_0x2f1d51(0x1c8)]);}async[a62_0x3c9d69(0x188)](_0x378bbd){const _0x2fdee4=a62_0x3c9d69,_0x33e181=await this['client'][_0x2fdee4(0x188)]({'workspaceId':_0x378bbd?.[_0x2fdee4(0x1c5)],'limit':_0x378bbd?.[_0x2fdee4(0x18f)]}),_0xc49988=Array[_0x2fdee4(0x195)](_0x33e181[_0x2fdee4(0x1c8)])?_0x33e181[_0x2fdee4(0x1c8)]:[_0x33e181[_0x2fdee4(0x1c8)]];return _0xc49988[_0x2fdee4(0x18d)](_0x2de26e=>this[_0x2fdee4(0x1ab)](_0x2de26e));}async[a62_0x3c9d69(0x1b6)](_0xc843a6,_0x38ecab){const _0x10969b=a62_0x3c9d69,_0x44eac1=await this[_0x10969b(0x1be)](_0xc843a6,_0x38ecab),_0x5774d7=await this[_0x10969b(0x1bb)][_0x10969b(0x1b6)](_0x44eac1);return this[_0x10969b(0x1ab)](_0x5774d7[_0x10969b(0x1c8)]);}async[a62_0x3c9d69(0x191)](_0x2e1006,_0x373346){const _0x235298=a62_0x3c9d69,_0x4cf827=await this['resolveTemplateId'](_0x2e1006,_0x373346),_0x153c60=await this[_0x235298(0x1bb)][_0x235298(0x1b6)](_0x4cf827);return _0x153c60['data'];}async[a62_0x3c9d69(0x1ca)](_0x1641a2){const _0x3fa8a4=a62_0x3c9d69,_0x311380=await this[_0x3fa8a4(0x1bb)][_0x3fa8a4(0x1ca)](_0x1641a2);return this[_0x3fa8a4(0x1ab)](_0x311380[_0x3fa8a4(0x1c8)]);}async['updateTemplate'](_0x2f52e6,_0x263f8e,_0xa949cd){const _0xf9087d=a62_0x3c9d69,_0x20f183=await this[_0xf9087d(0x1be)](_0x2f52e6,_0xa949cd),_0xed0010=await this[_0xf9087d(0x1bb)]['updateTemplate'](_0x20f183,_0x263f8e);return this[_0xf9087d(0x1ab)](_0xed0010[_0xf9087d(0x1c8)]);}async[a62_0x3c9d69(0x1ce)](_0x4ee89a,_0x1e93ba){const _0x129f54=a62_0x3c9d69,_0x1814b3=await this['resolveTemplateId'](_0x4ee89a,_0x1e93ba);await this['client'][_0x129f54(0x1ce)](_0x1814b3);}async[a62_0x3c9d69(0x1c4)](_0x280203){const _0x58ac8d=a62_0x3c9d69,_0x38eb1a=await this['client'][_0x58ac8d(0x1c4)]({'name':_0x280203?.[_0x58ac8d(0x19c)],'limit':_0x280203?.[_0x58ac8d(0x18f)]}),_0x5c279c=Array[_0x58ac8d(0x195)](_0x38eb1a[_0x58ac8d(0x1c8)])?_0x38eb1a[_0x58ac8d(0x1c8)]:[_0x38eb1a[_0x58ac8d(0x1c8)]];return _0x5c279c[_0x58ac8d(0x18d)](_0x349860=>this[_0x58ac8d(0x197)](_0x349860));}async['getWorkspace'](_0x1135a6){const _0x250370=a62_0x3c9d69,_0x47fe29=await this[_0x250370(0x1b7)](_0x1135a6),_0x4178f9=await this['client'][_0x250370(0x1a0)](_0x47fe29);return this['normalizeWorkspace'](_0x4178f9['data']);}async[a62_0x3c9d69(0x1b4)](_0x2d9e4c){const _0x4b129b=a62_0x3c9d69,_0x25f69c=await this[_0x4b129b(0x1b7)](_0x2d9e4c),_0x2f5fa5=await this[_0x4b129b(0x1bb)]['getWorkspace'](_0x25f69c);return _0x2f5fa5[_0x4b129b(0x1c8)];}async[a62_0x3c9d69(0x1c2)](_0x49336b){const _0x4d48a1=a62_0x3c9d69,_0x2441a2=await this['client'][_0x4d48a1(0x1c2)](_0x49336b);return this[_0x4d48a1(0x197)](_0x2441a2['data']);}async['updateWorkspace'](_0x2bd73c,_0x5dc0b7){const _0x27191a=a62_0x3c9d69,_0x3f4549=await this[_0x27191a(0x1b7)](_0x2bd73c),_0x3393ff=await this[_0x27191a(0x1bb)][_0x27191a(0x1cd)](_0x3f4549,_0x5dc0b7);return this[_0x27191a(0x197)](_0x3393ff[_0x27191a(0x1c8)]);}async[a62_0x3c9d69(0x1ae)](_0x1096cb){const _0x7406f6=await this['resolveWorkspaceId'](_0x1096cb);await this['client']['deleteWorkspace'](_0x7406f6);}}
1
+ function a62_0x14e6(){const _0x3fe1a9=['Campaign\x20not\x20found\x20with\x20ID:\x20','INVALID_ARGUMENT','enableUtmTracking','filter','attributes','151832uuWZDt','applicableParentSegments','deleteCampaign','99gUBniQ','name','description','normalizeTemplate','61722KrgSSt','getCampaignFull','length','Email\x20template\x20not\x20found\x20with\x20ID:\x20','Multiple\x20campaigns\x20found\x20with\x20name\x20\x22','map','Use\x20\x22tdx\x20engage\x20workspace\x20list\x22\x20to\x20see\x20available\x20workspaces.','join','resolveCampaignId','type','code','1697310cZnSfD','listWorkspaces','Use\x20the\x20workspace\x20UUID\x20directly\x20to\x20select\x20a\x20specific\x20workspace.','normalizeCampaign','6662840sTllWz','data','createWorkspace','1SsGpVH','segmentId','createCampaign','launchCampaign','updatedAt','resumeCampaign','client','createTemplate','workspaceId','editorType','normalizeWorkspace','getTemplate','getWorkspaceFull','resolveTemplateId','pauseCampaign','campaignType','Workspace\x20not\x20found:\x20','deleteTemplate','isUUID','8598183NvZpVV','segmentName','553DeHvLk','subjectTemplate','applicableDomains','test','Use\x20\x22tdx\x20engage\x20template\x20list\x22\x20to\x20see\x20available\x20templates.','Use\x20\x22tdx\x20engage\x20campaign\x20list\x22\x20to\x20see\x20available\x20campaigns.','listTemplates','2334027SsgeNB','status','audienceId','Workspace\x20not\x20found\x20with\x20ID:\x20','1381342hNruwE','resolveWorkspaceId','limit','listCampaigns','getCampaign','updateTemplate','createdAt','audienceName','Use\x20--workspace-id\x20to\x20narrow\x20the\x20search,\x20or\x20use\x20the\x20template\x20UUID\x20directly.','ownerUser','\x22:\x20','getWorkspace','getTemplateFull','isArray','Campaign\x20not\x20found:\x20','updateWorkspace','duplicateCampaign','4UFswOD','Multiple\x20templates\x20found\x20with\x20name\x20\x22','updateCampaign','workspaceConfig','NOT_FOUND'];a62_0x14e6=function(){return _0x3fe1a9;};return a62_0x14e6();}const a62_0x29f822=a62_0x3968;(function(_0x528756,_0x59c8bb){const _0x21e0b7=a62_0x3968,_0x29efe9=_0x528756();while(!![]){try{const _0x5ca791=-parseInt(_0x21e0b7(0x167))/0x1*(-parseInt(_0x21e0b7(0x133))/0x2)+-parseInt(_0x21e0b7(0x183))/0x3*(-parseInt(_0x21e0b7(0x144))/0x4)+-parseInt(_0x21e0b7(0x160))/0x5+-parseInt(_0x21e0b7(0x155))/0x6*(parseInt(_0x21e0b7(0x17c))/0x7)+-parseInt(_0x21e0b7(0x14e))/0x8*(-parseInt(_0x21e0b7(0x151))/0x9)+parseInt(_0x21e0b7(0x164))/0xa+-parseInt(_0x21e0b7(0x17a))/0xb;if(_0x5ca791===_0x59c8bb)break;else _0x29efe9['push'](_0x29efe9['shift']());}catch(_0x91c81d){_0x29efe9['push'](_0x29efe9['shift']());}}}(a62_0x14e6,0x64159));import{EngageApiClient}from'../client/engage-api-client.js';function a62_0x3968(_0x1dd1b4,_0x1b4dfe){_0x1dd1b4=_0x1dd1b4-0x130;const _0x14e6f6=a62_0x14e6();let _0x396876=_0x14e6f6[_0x1dd1b4];return _0x396876;}import{SDKError,ErrorCode}from'./errors.js';export class EngageSDK{[a62_0x29f822(0x16d)];constructor(_0x26c412){const _0x14c565=a62_0x29f822;this[_0x14c565(0x16d)]=new EngageApiClient(_0x26c412);}[a62_0x29f822(0x179)](_0x12beae){const _0x52252e=a62_0x29f822;return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i[_0x52252e(0x17f)](_0x12beae);}[a62_0x29f822(0x163)](_0x1bf387){const _0x45a59=a62_0x29f822;return{'id':_0x1bf387['id'],'name':_0x1bf387[_0x45a59(0x14d)]['name'],'campaignType':_0x1bf387['attributes'][_0x45a59(0x176)],'status':_0x1bf387[_0x45a59(0x14d)][_0x45a59(0x130)],'description':_0x1bf387[_0x45a59(0x14d)]['description'],'workspaceId':_0x1bf387[_0x45a59(0x14d)][_0x45a59(0x16f)],'audienceId':_0x1bf387['attributes'][_0x45a59(0x131)],'audienceName':_0x1bf387['attributes'][_0x45a59(0x13a)],'segmentId':_0x1bf387[_0x45a59(0x14d)][_0x45a59(0x168)],'segmentName':_0x1bf387['attributes'][_0x45a59(0x17b)],'enableUtmTracking':_0x1bf387[_0x45a59(0x14d)][_0x45a59(0x14b)],'createdAt':_0x1bf387['attributes']['createdAt'],'updatedAt':_0x1bf387['attributes']['updatedAt'],'launchedAt':_0x1bf387['attributes']['launchedAt']};}[a62_0x29f822(0x154)](_0x318967){const _0x1205d7=a62_0x29f822;return{'id':_0x318967['id'],'name':_0x318967[_0x1205d7(0x14d)][_0x1205d7(0x152)],'subjectTemplate':_0x318967['attributes'][_0x1205d7(0x17d)],'workspaceId':_0x318967['attributes'][_0x1205d7(0x16f)],'editorType':_0x318967['attributes'][_0x1205d7(0x170)],'createdAt':_0x318967[_0x1205d7(0x14d)][_0x1205d7(0x139)],'updatedAt':_0x318967[_0x1205d7(0x14d)]['updatedAt']};}['normalizeWorkspace'](_0x17d1a4){const _0x150f31=a62_0x29f822;return{'id':_0x17d1a4['id'],'name':_0x17d1a4['attributes'][_0x150f31(0x152)],'description':_0x17d1a4['attributes'][_0x150f31(0x153)],'ownerName':_0x17d1a4[_0x150f31(0x14d)][_0x150f31(0x13c)][_0x150f31(0x152)],'domainCount':_0x17d1a4[_0x150f31(0x14d)][_0x150f31(0x147)][_0x150f31(0x17e)][_0x150f31(0x157)],'segmentCount':_0x17d1a4[_0x150f31(0x14d)][_0x150f31(0x147)][_0x150f31(0x14f)][_0x150f31(0x157)],'createdAt':_0x17d1a4[_0x150f31(0x14d)]['createdAt'],'updatedAt':_0x17d1a4[_0x150f31(0x14d)][_0x150f31(0x16b)]};}async[a62_0x29f822(0x15d)](_0x2c06ef,_0x2fdfa9){const _0x4d7e52=a62_0x29f822;if(this[_0x4d7e52(0x179)](_0x2c06ef))try{return await this['client']['getCampaign'](_0x2c06ef),_0x2c06ef;}catch(_0x1e3152){if(_0x1e3152 instanceof SDKError&&_0x1e3152['code']===ErrorCode['NOT_FOUND'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x4d7e52(0x149)+_0x2c06ef,_0x1e3152,{'helpText':_0x4d7e52(0x181)});throw _0x1e3152;}const _0x32013b=await this['client'][_0x4d7e52(0x136)]({'workspaceId':_0x2fdfa9}),_0x2aaaf6=Array[_0x4d7e52(0x140)](_0x32013b[_0x4d7e52(0x165)])?_0x32013b[_0x4d7e52(0x165)]:[_0x32013b[_0x4d7e52(0x165)]],_0x4ea18a=_0x2aaaf6[_0x4d7e52(0x14c)](_0x480209=>_0x480209[_0x4d7e52(0x14d)][_0x4d7e52(0x152)]===_0x2c06ef);if(_0x4ea18a[_0x4d7e52(0x157)]===0x0)throw new SDKError(ErrorCode[_0x4d7e52(0x148)],_0x4d7e52(0x141)+_0x2c06ef,undefined,{'helpText':_0x4d7e52(0x181)});if(_0x4ea18a[_0x4d7e52(0x157)]>0x1){const _0x4902c7=_0x4ea18a[_0x4d7e52(0x15a)](_0x5dd1b6=>_0x5dd1b6['id'])[_0x4d7e52(0x15c)](',\x20');throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4d7e52(0x159)+_0x2c06ef+_0x4d7e52(0x13d)+_0x4902c7,undefined,{'helpText':'Use\x20--workspace-id\x20to\x20narrow\x20the\x20search,\x20or\x20use\x20the\x20campaign\x20UUID\x20directly.'});}return _0x4ea18a[0x0]['id'];}async['resolveTemplateId'](_0x1d63c7,_0x8458a4){const _0x5aa4b1=a62_0x29f822;if(this[_0x5aa4b1(0x179)](_0x1d63c7))try{return await this[_0x5aa4b1(0x16d)][_0x5aa4b1(0x172)](_0x1d63c7),_0x1d63c7;}catch(_0x5c82cc){if(_0x5c82cc instanceof SDKError&&_0x5c82cc[_0x5aa4b1(0x15f)]===ErrorCode[_0x5aa4b1(0x148)])throw new SDKError(ErrorCode[_0x5aa4b1(0x148)],_0x5aa4b1(0x158)+_0x1d63c7,_0x5c82cc,{'helpText':_0x5aa4b1(0x180)});throw _0x5c82cc;}const _0x915196=await this['client'][_0x5aa4b1(0x182)]({'workspaceId':_0x8458a4}),_0x3e5971=Array[_0x5aa4b1(0x140)](_0x915196['data'])?_0x915196[_0x5aa4b1(0x165)]:[_0x915196[_0x5aa4b1(0x165)]],_0x1f0459=_0x3e5971[_0x5aa4b1(0x14c)](_0x590df1=>_0x590df1[_0x5aa4b1(0x14d)][_0x5aa4b1(0x152)]===_0x1d63c7);if(_0x1f0459[_0x5aa4b1(0x157)]===0x0)throw new SDKError(ErrorCode[_0x5aa4b1(0x148)],'Email\x20template\x20not\x20found:\x20'+_0x1d63c7,undefined,{'helpText':_0x5aa4b1(0x180)});if(_0x1f0459[_0x5aa4b1(0x157)]>0x1){const _0x45f67b=_0x1f0459[_0x5aa4b1(0x15a)](_0x433092=>_0x433092['id'])['join'](',\x20');throw new SDKError(ErrorCode[_0x5aa4b1(0x14a)],_0x5aa4b1(0x145)+_0x1d63c7+'\x22:\x20'+_0x45f67b,undefined,{'helpText':_0x5aa4b1(0x13b)});}return _0x1f0459[0x0]['id'];}async['resolveWorkspaceId'](_0x508806){const _0x48faee=a62_0x29f822;if(this[_0x48faee(0x179)](_0x508806))try{return await this[_0x48faee(0x16d)][_0x48faee(0x13e)](_0x508806),_0x508806;}catch(_0xd551a8){if(_0xd551a8 instanceof SDKError&&_0xd551a8[_0x48faee(0x15f)]===ErrorCode['NOT_FOUND'])throw new SDKError(ErrorCode[_0x48faee(0x148)],_0x48faee(0x132)+_0x508806,_0xd551a8,{'helpText':'Use\x20\x22tdx\x20engage\x20workspace\x20list\x22\x20to\x20see\x20available\x20workspaces.'});throw _0xd551a8;}const _0x10c254=await this[_0x48faee(0x16d)][_0x48faee(0x161)]({'name':_0x508806}),_0x74585a=Array['isArray'](_0x10c254[_0x48faee(0x165)])?_0x10c254[_0x48faee(0x165)]:[_0x10c254['data']],_0x425e04=_0x74585a[_0x48faee(0x14c)](_0x5c3991=>_0x5c3991[_0x48faee(0x14d)][_0x48faee(0x152)]===_0x508806);if(_0x425e04[_0x48faee(0x157)]===0x0)throw new SDKError(ErrorCode['NOT_FOUND'],_0x48faee(0x177)+_0x508806,undefined,{'helpText':_0x48faee(0x15b)});if(_0x425e04['length']>0x1){const _0x448d1a=_0x425e04[_0x48faee(0x15a)](_0x51cab3=>_0x51cab3['id'])['join'](',\x20');throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Multiple\x20workspaces\x20found\x20with\x20name\x20\x22'+_0x508806+_0x48faee(0x13d)+_0x448d1a,undefined,{'helpText':_0x48faee(0x162)});}return _0x425e04[0x0]['id'];}async[a62_0x29f822(0x136)](_0x4d43ab){const _0x190bb4=a62_0x29f822,_0x16f9ca=await this[_0x190bb4(0x16d)][_0x190bb4(0x136)]({'campaignType':_0x4d43ab?.[_0x190bb4(0x15e)],'status':_0x4d43ab?.[_0x190bb4(0x130)],'workspaceId':_0x4d43ab?.[_0x190bb4(0x16f)],'limit':_0x4d43ab?.[_0x190bb4(0x135)]}),_0x2a4209=Array[_0x190bb4(0x140)](_0x16f9ca['data'])?_0x16f9ca['data']:[_0x16f9ca[_0x190bb4(0x165)]];return _0x2a4209[_0x190bb4(0x15a)](_0x11f67f=>this[_0x190bb4(0x163)](_0x11f67f));}async[a62_0x29f822(0x137)](_0x3ee497,_0x3310e0){const _0x5f2ae3=a62_0x29f822,_0x560934=await this[_0x5f2ae3(0x15d)](_0x3ee497,_0x3310e0),_0x3b3f56=await this['client'][_0x5f2ae3(0x137)](_0x560934);return this[_0x5f2ae3(0x163)](_0x3b3f56['data']);}async[a62_0x29f822(0x156)](_0x50ad06,_0x23ca67){const _0x36cf55=a62_0x29f822,_0x4dff33=await this['resolveCampaignId'](_0x50ad06,_0x23ca67),_0x3e2cfb=await this['client'][_0x36cf55(0x137)](_0x4dff33);return _0x3e2cfb[_0x36cf55(0x165)];}async[a62_0x29f822(0x169)](_0x273323){const _0x2013fe=a62_0x29f822,_0x2c1608=await this['client'][_0x2013fe(0x169)](_0x273323);return this[_0x2013fe(0x163)](_0x2c1608['data']);}async[a62_0x29f822(0x146)](_0xf9a871,_0x550909,_0x2114f8){const _0x109ea0=a62_0x29f822,_0x454226=await this[_0x109ea0(0x15d)](_0xf9a871,_0x2114f8),_0x2aa7c1=await this[_0x109ea0(0x16d)]['updateCampaign'](_0x454226,_0x550909);return this[_0x109ea0(0x163)](_0x2aa7c1[_0x109ea0(0x165)]);}async['deleteCampaign'](_0x490846,_0x37d382){const _0x4a3862=a62_0x29f822,_0x47f25e=await this['resolveCampaignId'](_0x490846,_0x37d382);await this['client'][_0x4a3862(0x150)](_0x47f25e);}async[a62_0x29f822(0x16a)](_0x1fc961,_0xa150e5){const _0x32bbf7=a62_0x29f822,_0x21f5d2=await this[_0x32bbf7(0x15d)](_0x1fc961,_0xa150e5);await this[_0x32bbf7(0x16d)][_0x32bbf7(0x16a)](_0x21f5d2);}async[a62_0x29f822(0x175)](_0x593a4e,_0x11b6b6){const _0x55df91=a62_0x29f822,_0x3a0ac6=await this[_0x55df91(0x15d)](_0x593a4e,_0x11b6b6);await this[_0x55df91(0x16d)][_0x55df91(0x175)](_0x3a0ac6);}async[a62_0x29f822(0x16c)](_0x113575,_0x29c6c0){const _0xf7c639=a62_0x29f822,_0xf77b1f=await this[_0xf7c639(0x15d)](_0x113575,_0x29c6c0);await this[_0xf7c639(0x16d)][_0xf7c639(0x16c)](_0xf77b1f);}async[a62_0x29f822(0x143)](_0x5ec539,_0x116644){const _0x410865=a62_0x29f822,_0x1c270b=await this[_0x410865(0x15d)](_0x5ec539,_0x116644),_0x22d245=await this[_0x410865(0x16d)][_0x410865(0x143)](_0x1c270b);return this[_0x410865(0x163)](_0x22d245[_0x410865(0x165)]);}async['listTemplates'](_0x467bb2){const _0x4e9d88=a62_0x29f822,_0x3f6205=await this[_0x4e9d88(0x16d)][_0x4e9d88(0x182)]({'workspaceId':_0x467bb2?.[_0x4e9d88(0x16f)],'limit':_0x467bb2?.[_0x4e9d88(0x135)]}),_0x1d3f04=Array[_0x4e9d88(0x140)](_0x3f6205[_0x4e9d88(0x165)])?_0x3f6205[_0x4e9d88(0x165)]:[_0x3f6205[_0x4e9d88(0x165)]];return _0x1d3f04['map'](_0x3a3d01=>this[_0x4e9d88(0x154)](_0x3a3d01));}async[a62_0x29f822(0x172)](_0x4e235d,_0x15d62f){const _0x54b033=a62_0x29f822,_0x1ee327=await this[_0x54b033(0x174)](_0x4e235d,_0x15d62f),_0xf42175=await this[_0x54b033(0x16d)][_0x54b033(0x172)](_0x1ee327);return this[_0x54b033(0x154)](_0xf42175['data']);}async[a62_0x29f822(0x13f)](_0x2e35a6,_0x1950f2){const _0x51adb8=a62_0x29f822,_0x3557b8=await this[_0x51adb8(0x174)](_0x2e35a6,_0x1950f2),_0x4d2508=await this[_0x51adb8(0x16d)][_0x51adb8(0x172)](_0x3557b8);return _0x4d2508['data'];}async[a62_0x29f822(0x16e)](_0x2e2478){const _0x5c0342=a62_0x29f822,_0x3531c2=await this[_0x5c0342(0x16d)]['createTemplate'](_0x2e2478);return this[_0x5c0342(0x154)](_0x3531c2[_0x5c0342(0x165)]);}async['updateTemplate'](_0x33883c,_0x480a6f,_0x16732d){const _0x1b58db=a62_0x29f822,_0x579763=await this[_0x1b58db(0x174)](_0x33883c,_0x16732d),_0x386077=await this['client'][_0x1b58db(0x138)](_0x579763,_0x480a6f);return this['normalizeTemplate'](_0x386077[_0x1b58db(0x165)]);}async[a62_0x29f822(0x178)](_0x1241fd,_0x37a006){const _0x50a1e8=a62_0x29f822,_0x5d798e=await this[_0x50a1e8(0x174)](_0x1241fd,_0x37a006);await this[_0x50a1e8(0x16d)][_0x50a1e8(0x178)](_0x5d798e);}async[a62_0x29f822(0x161)](_0x2eb59b){const _0x1a9708=a62_0x29f822,_0x1f8d4b=await this[_0x1a9708(0x16d)][_0x1a9708(0x161)]({'name':_0x2eb59b?.[_0x1a9708(0x152)],'limit':_0x2eb59b?.[_0x1a9708(0x135)]}),_0x2107c5=Array['isArray'](_0x1f8d4b['data'])?_0x1f8d4b[_0x1a9708(0x165)]:[_0x1f8d4b[_0x1a9708(0x165)]];return _0x2107c5[_0x1a9708(0x15a)](_0x1c63ba=>this['normalizeWorkspace'](_0x1c63ba));}async[a62_0x29f822(0x13e)](_0x37d6eb){const _0x28ce72=a62_0x29f822,_0x5b8168=await this[_0x28ce72(0x134)](_0x37d6eb),_0x25ef6d=await this[_0x28ce72(0x16d)][_0x28ce72(0x13e)](_0x5b8168);return this[_0x28ce72(0x171)](_0x25ef6d[_0x28ce72(0x165)]);}async[a62_0x29f822(0x173)](_0x3d48a1){const _0x3954f5=a62_0x29f822,_0x2f54cf=await this[_0x3954f5(0x134)](_0x3d48a1),_0x15bf55=await this[_0x3954f5(0x16d)][_0x3954f5(0x13e)](_0x2f54cf);return _0x15bf55[_0x3954f5(0x165)];}async[a62_0x29f822(0x166)](_0x5979d7){const _0x4cd820=a62_0x29f822,_0x13362d=await this['client'][_0x4cd820(0x166)](_0x5979d7);return this[_0x4cd820(0x171)](_0x13362d[_0x4cd820(0x165)]);}async[a62_0x29f822(0x142)](_0x2e02ae,_0x285b85){const _0x7b6145=a62_0x29f822,_0x54da3c=await this[_0x7b6145(0x134)](_0x2e02ae),_0x416b8b=await this[_0x7b6145(0x16d)][_0x7b6145(0x142)](_0x54da3c,_0x285b85);return this[_0x7b6145(0x171)](_0x416b8b[_0x7b6145(0x165)]);}async['deleteWorkspace'](_0x4221da){const _0x287431=a62_0x29f822,_0x431156=await this[_0x287431(0x134)](_0x4221da);await this['client']['deleteWorkspace'](_0x431156);}}
@@ -1 +1 @@
1
- const a63_0x5c5344=a63_0x584d;(function(_0x3b5589,_0x55a4aa){const _0x5e0928=a63_0x584d,_0x3e3613=_0x3b5589();while(!![]){try{const _0x59b6e4=-parseInt(_0x5e0928(0xc6))/0x1*(-parseInt(_0x5e0928(0xec))/0x2)+parseInt(_0x5e0928(0xda))/0x3+-parseInt(_0x5e0928(0xe4))/0x4*(parseInt(_0x5e0928(0xe6))/0x5)+parseInt(_0x5e0928(0xf6))/0x6+parseInt(_0x5e0928(0xf1))/0x7*(-parseInt(_0x5e0928(0xe5))/0x8)+parseInt(_0x5e0928(0xe8))/0x9*(-parseInt(_0x5e0928(0xd2))/0xa)+parseInt(_0x5e0928(0xee))/0xb;if(_0x59b6e4===_0x55a4aa)break;else _0x3e3613['push'](_0x3e3613['shift']());}catch(_0x25a164){_0x3e3613['push'](_0x3e3613['shift']());}}}(a63_0x5adc,0x96de6));export var ErrorCategory;function a63_0x584d(_0x37edfc,_0x137745){_0x37edfc=_0x37edfc-0xbb;const _0x5adc71=a63_0x5adc();let _0x584d13=_0x5adc71[_0x37edfc];return _0x584d13;}(function(_0x17b44c){const _0x242f9b=a63_0x584d;_0x17b44c['USER_ERROR']=_0x242f9b(0xbb),_0x17b44c[_0x242f9b(0xed)]=_0x242f9b(0xed);}(ErrorCategory||(ErrorCategory={})));export var ErrorCode;(function(_0x2c4827){const _0x423259=a63_0x584d;_0x2c4827[_0x423259(0xe2)]=_0x423259(0xe2),_0x2c4827['INVALID_ARGUMENT']=_0x423259(0xdd),_0x2c4827[_0x423259(0xeb)]='NOT_FOUND',_0x2c4827[_0x423259(0xc5)]=_0x423259(0xc5),_0x2c4827['TABLE_NOT_FOUND']=_0x423259(0xcd),_0x2c4827['LLM_PROJECT_NOT_FOUND']='LLM_PROJECT_NOT_FOUND',_0x2c4827['AGENT_NOT_FOUND']=_0x423259(0xe7),_0x2c4827['WORKFLOW_PROJECT_NOT_FOUND']=_0x423259(0xf2),_0x2c4827[_0x423259(0xce)]=_0x423259(0xce),_0x2c4827[_0x423259(0xdf)]=_0x423259(0xdf),_0x2c4827['SEGMENT_NOT_FOUND']='SEGMENT_NOT_FOUND',_0x2c4827[_0x423259(0xe3)]=_0x423259(0xe3),_0x2c4827['LLM_EMPTY_MESSAGE']=_0x423259(0xbc),_0x2c4827['COMMAND_NOT_FOUND']=_0x423259(0xd5),_0x2c4827[_0x423259(0xd9)]=_0x423259(0xd9),_0x2c4827['PERMISSION_DENIED']=_0x423259(0xbf),_0x2c4827[_0x423259(0xf0)]=_0x423259(0xf0),_0x2c4827['ALREADY_EXISTS']=_0x423259(0xf5),_0x2c4827[_0x423259(0xd8)]=_0x423259(0xd8),_0x2c4827['INVALID_REQUEST']='INVALID_REQUEST',_0x2c4827[_0x423259(0xc8)]=_0x423259(0xc8),_0x2c4827[_0x423259(0xde)]=_0x423259(0xde),_0x2c4827[_0x423259(0xdc)]=_0x423259(0xdc),_0x2c4827[_0x423259(0xc1)]=_0x423259(0xc1),_0x2c4827[_0x423259(0xbe)]=_0x423259(0xbe),_0x2c4827[_0x423259(0xe1)]=_0x423259(0xe1),_0x2c4827[_0x423259(0xd4)]=_0x423259(0xd4),_0x2c4827[_0x423259(0xe9)]=_0x423259(0xe9),_0x2c4827['RATE_LIMITED']='RATE_LIMITED',_0x2c4827['TRINO_INTERNAL_ERROR']=_0x423259(0xcf),_0x2c4827[_0x423259(0xe0)]=_0x423259(0xe0),_0x2c4827['LLM_MALFORMED_MESSAGE']='LLM_MALFORMED_MESSAGE',_0x2c4827[_0x423259(0xd6)]=_0x423259(0xd6),_0x2c4827[_0x423259(0xea)]=_0x423259(0xea);}(ErrorCode||(ErrorCode={})));const ERROR_CODE_CATEGORY={[ErrorCode[a63_0x5c5344(0xe2)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xdd)]]:ErrorCategory['USER_ERROR'],[ErrorCode['NOT_FOUND']]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode['DATABASE_NOT_FOUND']]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xcd)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xd0)]]:ErrorCategory['USER_ERROR'],[ErrorCode[a63_0x5c5344(0xe7)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xf2)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xce)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xdf)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xc2)]]:ErrorCategory['USER_ERROR'],[ErrorCode['SEGMENT_FOLDER_NOT_FOUND']]:ErrorCategory['USER_ERROR'],[ErrorCode[a63_0x5c5344(0xbc)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xd5)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xd9)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xbf)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xf0)]]:ErrorCategory['USER_ERROR'],[ErrorCode[a63_0x5c5344(0xf5)]]:ErrorCategory['USER_ERROR'],[ErrorCode[a63_0x5c5344(0xd8)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xc9)]]:ErrorCategory['USER_ERROR'],[ErrorCode[a63_0x5c5344(0xc8)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xde)]]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode['TRINO_INVALID_ARGUMENT']]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode['TRINO_USER_CANCELLED']]:ErrorCategory[a63_0x5c5344(0xbb)],[ErrorCode[a63_0x5c5344(0xbe)]]:ErrorCategory[a63_0x5c5344(0xed)],[ErrorCode['TIMEOUT']]:ErrorCategory['INTERNAL_ERROR'],[ErrorCode[a63_0x5c5344(0xd4)]]:ErrorCategory['INTERNAL_ERROR'],[ErrorCode[a63_0x5c5344(0xe9)]]:ErrorCategory[a63_0x5c5344(0xed)],[ErrorCode[a63_0x5c5344(0xbd)]]:ErrorCategory[a63_0x5c5344(0xed)],[ErrorCode[a63_0x5c5344(0xcf)]]:ErrorCategory[a63_0x5c5344(0xed)],[ErrorCode[a63_0x5c5344(0xe0)]]:ErrorCategory[a63_0x5c5344(0xed)],[ErrorCode[a63_0x5c5344(0xd3)]]:ErrorCategory['INTERNAL_ERROR'],[ErrorCode['LLM_STREAM_ERROR']]:ErrorCategory[a63_0x5c5344(0xed)],[ErrorCode[a63_0x5c5344(0xea)]]:ErrorCategory[a63_0x5c5344(0xed)]};export function getErrorCategory(_0x24bb87){return ERROR_CODE_CATEGORY[_0x24bb87];}function a63_0x5adc(){const _0x548d05=['MISSING_ARGUMENT','SEGMENT_FOLDER_NOT_FOUND','12Ebfdad','376XFwtcX','286290CmeMdK','AGENT_NOT_FOUND','207kZTdOI','INTERNAL','LLM_CHAT_CREATION_FAILURE','NOT_FOUND','842THaDGE','INTERNAL_ERROR','8931241reloeK','cause','UNAUTHENTICATED','143857GcsOod','WORKFLOW_PROJECT_NOT_FOUND','helpText','stack','ALREADY_EXISTS','395832WfEcPA','USER_ERROR','LLM_EMPTY_MESSAGE','RATE_LIMITED','UNAVAILABLE','PERMISSION_DENIED','message','TRINO_USER_CANCELLED','SEGMENT_NOT_FOUND','\x0aCaused\x20by:\x20','replace','DATABASE_NOT_FOUND','2293qmTlXi','category','TRINO_SYNTAX_ERROR','INVALID_REQUEST','originalMessage','SDKError','name','TABLE_NOT_FOUND','CHAT_NOT_FOUND','TRINO_INTERNAL_ERROR','LLM_PROJECT_NOT_FOUND','code','70130ajIKEZ','LLM_MALFORMED_MESSAGE','HTTP_REQUEST_FAILURE','COMMAND_NOT_FOUND','LLM_STREAM_ERROR','isRetryable','CANCELLED','INSTALLATION_FAILED','221016QDKRLT','includes','TRINO_INVALID_ARGUMENT','INVALID_ARGUMENT','TRINO_NOT_FOUND','CONNECTION_NOT_FOUND','TRINO_INSUFFICIENT_RESOURCES','TIMEOUT'];a63_0x5adc=function(){return _0x548d05;};return a63_0x5adc();}export function isRetryableError(_0x2d9ed9){return getErrorCategory(_0x2d9ed9)===ErrorCategory['INTERNAL_ERROR'];}export class SDKError extends Error{['code'];['helpText'];[a63_0x5c5344(0xef)];constructor(_0x58f899,_0x7146f8,_0x192698,_0x597608){const _0x5a457a=a63_0x5c5344;super('['+_0x58f899+']\x20'+_0x7146f8),this[_0x5a457a(0xcc)]=_0x5a457a(0xcb),this[_0x5a457a(0xd1)]=_0x58f899,this[_0x5a457a(0xf3)]=_0x597608?.[_0x5a457a(0xf3)],this[_0x5a457a(0xef)]=_0x192698,_0x192698 instanceof Error&&(this[_0x5a457a(0xf4)]=this[_0x5a457a(0xf4)]+_0x5a457a(0xc3)+_0x192698[_0x5a457a(0xf4)]);}get[a63_0x5c5344(0xc7)](){const _0x3b75c7=a63_0x5c5344;return getErrorCategory(this[_0x3b75c7(0xd1)]);}[a63_0x5c5344(0xd7)](){const _0x53fef5=a63_0x5c5344;return isRetryableError(this[_0x53fef5(0xd1)]);}['isUserError'](){const _0x48cfbb=a63_0x5c5344;return this['category']===ErrorCategory[_0x48cfbb(0xbb)];}['isInternalError'](){const _0x2d0f0e=a63_0x5c5344;return this[_0x2d0f0e(0xc7)]===ErrorCategory[_0x2d0f0e(0xed)];}get[a63_0x5c5344(0xca)](){const _0x5bd4f8=a63_0x5c5344;return this[_0x5bd4f8(0xc0)][_0x5bd4f8(0xc4)](/^\[.*?\]\s*/,'');}}export function errorContains(_0x58e8a0,..._0x113a76){const _0x4f2423=a63_0x5c5344,_0x2eb958=_0x58e8a0?.[_0x4f2423(0xc0)]||'',_0x420bcd=_0x58e8a0?.[_0x4f2423(0xef)],_0x3ceb6d=_0x420bcd?.[_0x4f2423(0xc0)]||'';return _0x113a76['some'](_0x1d8a83=>_0x2eb958[_0x4f2423(0xdb)](_0x1d8a83)||_0x3ceb6d[_0x4f2423(0xdb)](_0x1d8a83));}
1
+ const a63_0x4e68aa=a63_0xd670;(function(_0x35d7d2,_0x5bf2bc){const _0x1d9384=a63_0xd670,_0x5c017a=_0x35d7d2();while(!![]){try{const _0x3df744=parseInt(_0x1d9384(0x1d9))/0x1+-parseInt(_0x1d9384(0x1cd))/0x2*(parseInt(_0x1d9384(0x1cc))/0x3)+parseInt(_0x1d9384(0x1ee))/0x4+-parseInt(_0x1d9384(0x1bb))/0x5*(parseInt(_0x1d9384(0x1c0))/0x6)+-parseInt(_0x1d9384(0x1f6))/0x7*(-parseInt(_0x1d9384(0x1de))/0x8)+-parseInt(_0x1d9384(0x1f2))/0x9+parseInt(_0x1d9384(0x1d3))/0xa;if(_0x3df744===_0x5bf2bc)break;else _0x5c017a['push'](_0x5c017a['shift']());}catch(_0x165464){_0x5c017a['push'](_0x5c017a['shift']());}}}(a63_0x5c43,0xd64f1));export var ErrorCategory;(function(_0x3938e6){const _0x5cc608=a63_0xd670;_0x3938e6['USER_ERROR']=_0x5cc608(0x1d4),_0x3938e6[_0x5cc608(0x1c9)]=_0x5cc608(0x1c9);}(ErrorCategory||(ErrorCategory={})));export var ErrorCode;(function(_0x3ca212){const _0x317756=a63_0xd670;_0x3ca212[_0x317756(0x1f0)]=_0x317756(0x1f0),_0x3ca212[_0x317756(0x1e1)]='INVALID_ARGUMENT',_0x3ca212['NOT_FOUND']=_0x317756(0x1ea),_0x3ca212['DATABASE_NOT_FOUND']='DATABASE_NOT_FOUND',_0x3ca212[_0x317756(0x1bc)]='TABLE_NOT_FOUND',_0x3ca212['LLM_PROJECT_NOT_FOUND']=_0x317756(0x1d0),_0x3ca212[_0x317756(0x1e8)]=_0x317756(0x1e8),_0x3ca212[_0x317756(0x1c2)]='WORKFLOW_PROJECT_NOT_FOUND',_0x3ca212[_0x317756(0x1c6)]='CHAT_NOT_FOUND',_0x3ca212[_0x317756(0x1d2)]=_0x317756(0x1d2),_0x3ca212[_0x317756(0x1d5)]=_0x317756(0x1d5),_0x3ca212['SEGMENT_FOLDER_NOT_FOUND']=_0x317756(0x1e0),_0x3ca212[_0x317756(0x1d8)]=_0x317756(0x1d8),_0x3ca212[_0x317756(0x1eb)]=_0x317756(0x1eb),_0x3ca212[_0x317756(0x1c5)]=_0x317756(0x1c5),_0x3ca212['PERMISSION_DENIED']=_0x317756(0x1e5),_0x3ca212[_0x317756(0x1f3)]=_0x317756(0x1f3),_0x3ca212[_0x317756(0x1ec)]='ALREADY_EXISTS',_0x3ca212[_0x317756(0x1db)]=_0x317756(0x1db),_0x3ca212[_0x317756(0x1be)]=_0x317756(0x1be),_0x3ca212[_0x317756(0x1f5)]=_0x317756(0x1f5),_0x3ca212[_0x317756(0x1c3)]=_0x317756(0x1c3),_0x3ca212[_0x317756(0x1f4)]='TRINO_INVALID_ARGUMENT',_0x3ca212[_0x317756(0x1c8)]=_0x317756(0x1c8),_0x3ca212[_0x317756(0x1e6)]='UNAVAILABLE',_0x3ca212['TIMEOUT']=_0x317756(0x1e3),_0x3ca212[_0x317756(0x1dd)]=_0x317756(0x1dd),_0x3ca212[_0x317756(0x1d1)]=_0x317756(0x1d1),_0x3ca212[_0x317756(0x1e4)]=_0x317756(0x1e4),_0x3ca212[_0x317756(0x1d6)]=_0x317756(0x1d6),_0x3ca212['TRINO_INSUFFICIENT_RESOURCES']=_0x317756(0x1ce),_0x3ca212[_0x317756(0x1f1)]='LLM_MALFORMED_MESSAGE',_0x3ca212[_0x317756(0x1dc)]=_0x317756(0x1dc),_0x3ca212[_0x317756(0x1bf)]=_0x317756(0x1bf);}(ErrorCode||(ErrorCode={})));const ERROR_CODE_CATEGORY={[ErrorCode[a63_0x4e68aa(0x1f0)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1e1)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1ea)]]:ErrorCategory['USER_ERROR'],[ErrorCode[a63_0x4e68aa(0x1c7)]]:ErrorCategory['USER_ERROR'],[ErrorCode[a63_0x4e68aa(0x1bc)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode['LLM_PROJECT_NOT_FOUND']]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1e8)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1c2)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1c6)]]:ErrorCategory['USER_ERROR'],[ErrorCode[a63_0x4e68aa(0x1d2)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1d5)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1e0)]]:ErrorCategory['USER_ERROR'],[ErrorCode['LLM_EMPTY_MESSAGE']]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1eb)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1c5)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1e5)]]:ErrorCategory['USER_ERROR'],[ErrorCode[a63_0x4e68aa(0x1f3)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1ec)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode['CANCELLED']]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode['INVALID_REQUEST']]:ErrorCategory['USER_ERROR'],[ErrorCode[a63_0x4e68aa(0x1f5)]]:ErrorCategory['USER_ERROR'],[ErrorCode[a63_0x4e68aa(0x1c3)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1f4)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1c8)]]:ErrorCategory[a63_0x4e68aa(0x1d4)],[ErrorCode[a63_0x4e68aa(0x1e6)]]:ErrorCategory[a63_0x4e68aa(0x1c9)],[ErrorCode[a63_0x4e68aa(0x1e3)]]:ErrorCategory[a63_0x4e68aa(0x1c9)],[ErrorCode[a63_0x4e68aa(0x1dd)]]:ErrorCategory[a63_0x4e68aa(0x1c9)],[ErrorCode[a63_0x4e68aa(0x1d1)]]:ErrorCategory[a63_0x4e68aa(0x1c9)],[ErrorCode['RATE_LIMITED']]:ErrorCategory[a63_0x4e68aa(0x1c9)],[ErrorCode[a63_0x4e68aa(0x1d6)]]:ErrorCategory['INTERNAL_ERROR'],[ErrorCode['TRINO_INSUFFICIENT_RESOURCES']]:ErrorCategory[a63_0x4e68aa(0x1c9)],[ErrorCode[a63_0x4e68aa(0x1f1)]]:ErrorCategory[a63_0x4e68aa(0x1c9)],[ErrorCode['LLM_STREAM_ERROR']]:ErrorCategory[a63_0x4e68aa(0x1c9)],[ErrorCode['LLM_CHAT_CREATION_FAILURE']]:ErrorCategory[a63_0x4e68aa(0x1c9)]};function a63_0x5c43(){const _0x665324=['isInternalError','TIMEOUT','RATE_LIMITED','PERMISSION_DENIED','UNAVAILABLE','code','AGENT_NOT_FOUND','helpText','NOT_FOUND','COMMAND_NOT_FOUND','ALREADY_EXISTS','some','6319728BtNcBj','stack','MISSING_ARGUMENT','LLM_MALFORMED_MESSAGE','12096081tBppGW','UNAUTHENTICATED','TRINO_INVALID_ARGUMENT','TRINO_SYNTAX_ERROR','98ttRdvZ','isRetryable','234800YxSTwo','TABLE_NOT_FOUND','message','INVALID_REQUEST','LLM_CHAT_CREATION_FAILURE','66dUUMTI','name','WORKFLOW_PROJECT_NOT_FOUND','TRINO_NOT_FOUND','includes','INSTALLATION_FAILED','CHAT_NOT_FOUND','DATABASE_NOT_FOUND','TRINO_USER_CANCELLED','INTERNAL_ERROR','replace','category','42IaEsqv','73468phUhPh','TRINO_INSUFFICIENT_RESOURCES','isUserError','LLM_PROJECT_NOT_FOUND','INTERNAL','CONNECTION_NOT_FOUND','13164410StEJyp','USER_ERROR','SEGMENT_NOT_FOUND','TRINO_INTERNAL_ERROR','cause','LLM_EMPTY_MESSAGE','213747OvKRQw','originalMessage','CANCELLED','LLM_STREAM_ERROR','HTTP_REQUEST_FAILURE','81448RqqPSs','\x0aCaused\x20by:\x20','SEGMENT_FOLDER_NOT_FOUND','INVALID_ARGUMENT'];a63_0x5c43=function(){return _0x665324;};return a63_0x5c43();}function a63_0xd670(_0x54c8b6,_0x49438d){_0x54c8b6=_0x54c8b6-0x1bb;const _0x5c43ee=a63_0x5c43();let _0xd6708a=_0x5c43ee[_0x54c8b6];return _0xd6708a;}export function getErrorCategory(_0x15667f){return ERROR_CODE_CATEGORY[_0x15667f];}export function isRetryableError(_0x2a7b09){const _0x2fd90d=a63_0x4e68aa;return getErrorCategory(_0x2a7b09)===ErrorCategory[_0x2fd90d(0x1c9)];}export class SDKError extends Error{[a63_0x4e68aa(0x1e7)];[a63_0x4e68aa(0x1e9)];[a63_0x4e68aa(0x1d7)];constructor(_0x123e60,_0x4bcf99,_0x31aef7,_0x58e38e){const _0x218534=a63_0x4e68aa;super('['+_0x123e60+']\x20'+_0x4bcf99),this[_0x218534(0x1c1)]='SDKError',this[_0x218534(0x1e7)]=_0x123e60,this[_0x218534(0x1e9)]=_0x58e38e?.[_0x218534(0x1e9)],this[_0x218534(0x1d7)]=_0x31aef7,_0x31aef7 instanceof Error&&(this[_0x218534(0x1ef)]=this[_0x218534(0x1ef)]+_0x218534(0x1df)+_0x31aef7['stack']);}get[a63_0x4e68aa(0x1cb)](){const _0x1e7b7e=a63_0x4e68aa;return getErrorCategory(this[_0x1e7b7e(0x1e7)]);}[a63_0x4e68aa(0x1f7)](){const _0x43b24c=a63_0x4e68aa;return isRetryableError(this[_0x43b24c(0x1e7)]);}[a63_0x4e68aa(0x1cf)](){return this['category']===ErrorCategory['USER_ERROR'];}[a63_0x4e68aa(0x1e2)](){const _0x1090f4=a63_0x4e68aa;return this[_0x1090f4(0x1cb)]===ErrorCategory['INTERNAL_ERROR'];}get[a63_0x4e68aa(0x1da)](){const _0x1c0378=a63_0x4e68aa;return this[_0x1c0378(0x1bd)][_0x1c0378(0x1ca)](/^\[.*?\]\s*/,'');}}export function errorContains(_0x3c4571,..._0x582f56){const _0x1efac5=a63_0x4e68aa,_0x497934=_0x3c4571?.[_0x1efac5(0x1bd)]||'',_0x7e7639=_0x3c4571?.[_0x1efac5(0x1d7)],_0x52b53f=_0x7e7639?.[_0x1efac5(0x1bd)]||'';return _0x582f56[_0x1efac5(0x1ed)](_0x439e46=>_0x497934[_0x1efac5(0x1c4)](_0x439e46)||_0x52b53f['includes'](_0x439e46));}
package/dist/sdk/index.js CHANGED
@@ -1 +1 @@
1
- const a64_0x140d0c=a64_0x3558;(function(_0x43dd60,_0x12beb1){const _0x24ff59=a64_0x3558,_0x4453e9=_0x43dd60();while(!![]){try{const _0x15c740=parseInt(_0x24ff59(0xec))/0x1+parseInt(_0x24ff59(0xd2))/0x2*(parseInt(_0x24ff59(0xd8))/0x3)+parseInt(_0x24ff59(0xd5))/0x4+-parseInt(_0x24ff59(0xe0))/0x5*(parseInt(_0x24ff59(0xda))/0x6)+parseInt(_0x24ff59(0xd3))/0x7+parseInt(_0x24ff59(0xe7))/0x8*(parseInt(_0x24ff59(0xe5))/0x9)+-parseInt(_0x24ff59(0xd4))/0xa*(parseInt(_0x24ff59(0xeb))/0xb);if(_0x15c740===_0x12beb1)break;else _0x4453e9['push'](_0x4453e9['shift']());}catch(_0x271c72){_0x4453e9['push'](_0x4453e9['shift']());}}}(a64_0x39d6,0xd3b0e));import{loadUserConfigOnce,getAPIKey}from'../core/config.js';import{SegmentSDK}from'./segment.js';import{WorkflowSDK}from'./workflow.js';function a64_0x39d6(){const _0x31346e=['2MDqqWj','11850608iLBjrY','10DoZrmK','4518292DeTJSY','INFO','connection','4888146qpPjLH','logger','5262RFXPQX','user','site','catch','jobs','workflow','805iCFqBZ','create','segment','llm','api','9kufkCl','engage','1833928LqbZIO','context','init','query','43526769GnLTja','284122EmZygJ','us01'];a64_0x39d6=function(){return _0x31346e;};return a64_0x39d6();}import{LLMSDK}from'./llm.js';import{JobSDK}from'./job.js';import{UserSDK}from'./user.js';import{RawAPI}from'./api.js';import{QuerySDK}from'./query.js';import{EngageSDK}from'./engage.js';import{ConnectionSDK}from'./connection.js';import{LogLevel,TDXLogger}from'../utils/tdx-logger.js';export*from'./errors.js';function a64_0x3558(_0x40f07f,_0x5618ce){_0x40f07f=_0x40f07f-0xd2;const _0x39d65c=a64_0x39d6();let _0x35581d=_0x39d65c[_0x40f07f];return _0x35581d;}export*from'./segment.js';export*from'./segment/parent-segment-preview.js';export*from'./workflow.js';export*from'./llm.js';export*from'./job.js';export*from'./user.js';export*from'./api.js';export*from'./query.js';export*from'./engage.js';export*from'./connection.js';export{LogLevel}from'../utils/tdx-logger.js';export class TDX{[a64_0x140d0c(0xe8)];[a64_0x140d0c(0xea)];[a64_0x140d0c(0xe2)];['workflow'];[a64_0x140d0c(0xe3)];[a64_0x140d0c(0xde)];[a64_0x140d0c(0xdb)];[a64_0x140d0c(0xe6)];[a64_0x140d0c(0xd7)];['api'];static[a64_0x140d0c(0xe1)](_0x30f538={}){const _0x4ac493=a64_0x140d0c,_0x36b3e7=_0x30f538[_0x4ac493(0xdc)]||_0x4ac493(0xed),_0x56818b=_0x30f538['logLevel']??LogLevel[_0x4ac493(0xd6)],_0xfb3830=_0x30f538['profile'];let _0x1da4c3=_0x30f538['apiKey'];!_0x1da4c3&&(loadUserConfigOnce(),_0x1da4c3=getAPIKey(_0x36b3e7));const _0x5d6a01=new TDXLogger(_0x56818b,!![]);return _0x5d6a01[_0x4ac493(0xe9)]()[_0x4ac493(0xdd)](()=>{}),new TDX({'site':_0x36b3e7,'apiKey':_0x1da4c3,'logLevel':_0x56818b,'logger':_0x5d6a01,'profile':_0xfb3830});}constructor(_0x4065d5){const _0x51b347=a64_0x140d0c;this[_0x51b347(0xe8)]=_0x4065d5,this[_0x51b347(0xea)]=new QuerySDK(_0x4065d5),this['segment']=new SegmentSDK(_0x4065d5),this[_0x51b347(0xdf)]=new WorkflowSDK(_0x4065d5),this[_0x51b347(0xe3)]=new LLMSDK(_0x4065d5),this['jobs']=new JobSDK(_0x4065d5),this[_0x51b347(0xdb)]=new UserSDK(_0x4065d5),this[_0x51b347(0xe6)]=new EngageSDK(_0x4065d5),this[_0x51b347(0xd7)]=new ConnectionSDK(_0x4065d5),this[_0x51b347(0xe4)]=new RawAPI(_0x4065d5);}get[a64_0x140d0c(0xd9)](){const _0x35cd7d=a64_0x140d0c;return this['context'][_0x35cd7d(0xd9)];}}
1
+ const a64_0x56a6a7=a64_0x2366;(function(_0x439be4,_0x3a6d63){const _0x27a6c0=a64_0x2366,_0x29afaa=_0x439be4();while(!![]){try{const _0x232027=parseInt(_0x27a6c0(0xba))/0x1*(-parseInt(_0x27a6c0(0xc1))/0x2)+parseInt(_0x27a6c0(0xb2))/0x3+-parseInt(_0x27a6c0(0xb6))/0x4+-parseInt(_0x27a6c0(0xb3))/0x5*(parseInt(_0x27a6c0(0xbb))/0x6)+parseInt(_0x27a6c0(0xc2))/0x7+-parseInt(_0x27a6c0(0xbf))/0x8*(-parseInt(_0x27a6c0(0xb1))/0x9)+parseInt(_0x27a6c0(0xb4))/0xa;if(_0x232027===_0x3a6d63)break;else _0x29afaa['push'](_0x29afaa['shift']());}catch(_0x315c8e){_0x29afaa['push'](_0x29afaa['shift']());}}}(a64_0x2986,0x2c294));import{loadUserConfigOnce,getAPIKey}from'../core/config.js';import{SegmentSDK}from'./segment.js';import{WorkflowSDK}from'./workflow.js';import{LLMSDK}from'./llm.js';import{JobSDK}from'./job.js';import{UserSDK}from'./user.js';import{RawAPI}from'./api.js';import{QuerySDK}from'./query.js';import{EngageSDK}from'./engage.js';import{ConnectionSDK}from'./connection.js';import{LogLevel,TDXLogger}from'../utils/tdx-logger.js';export*from'./errors.js';export*from'./segment.js';export*from'./segment/parent-segment-preview.js';export*from'./workflow.js';export*from'./llm.js';export*from'./job.js';function a64_0x2366(_0x20b9dc,_0x431595){_0x20b9dc=_0x20b9dc-0xb1;const _0x29865b=a64_0x2986();let _0x2366d3=_0x29865b[_0x20b9dc];return _0x2366d3;}export*from'./user.js';export*from'./api.js';export*from'./query.js';export*from'./engage.js';export*from'./connection.js';function a64_0x2986(){const _0x1d1f09=['1746081KIHCXR','591864axKdem','350850kJFcvw','434290qniRAE','user','928324qJaWtG','site','logger','create','408KQoQCo','6dhTKMc','context','connection','us01','8rpqOtF','api','1282NKiVke','2169559rRZqhz','segment','profile','init','jobs','llm','query','apiKey','INFO','workflow','engage'];a64_0x2986=function(){return _0x1d1f09;};return a64_0x2986();}export{LogLevel}from'../utils/tdx-logger.js';export class TDX{[a64_0x56a6a7(0xbc)];['query'];[a64_0x56a6a7(0xc3)];[a64_0x56a6a7(0xcb)];[a64_0x56a6a7(0xc7)];[a64_0x56a6a7(0xc6)];[a64_0x56a6a7(0xb5)];['engage'];['connection'];[a64_0x56a6a7(0xc0)];static[a64_0x56a6a7(0xb9)](_0x1ce4a6={}){const _0x30e36d=a64_0x56a6a7,_0x580786=_0x1ce4a6[_0x30e36d(0xb7)]||_0x30e36d(0xbe),_0x43c8b7=_0x1ce4a6['logLevel']??LogLevel[_0x30e36d(0xca)],_0x4dd88f=_0x1ce4a6[_0x30e36d(0xc4)];let _0x3ccaae=_0x1ce4a6[_0x30e36d(0xc9)];!_0x3ccaae&&(loadUserConfigOnce(),_0x3ccaae=getAPIKey(_0x580786));const _0x4335cf=new TDXLogger(_0x43c8b7,!![]);return _0x4335cf[_0x30e36d(0xc5)]()['catch'](()=>{}),new TDX({'site':_0x580786,'apiKey':_0x3ccaae,'logLevel':_0x43c8b7,'logger':_0x4335cf,'profile':_0x4dd88f});}constructor(_0x2981ea){const _0x559a32=a64_0x56a6a7;this['context']=_0x2981ea,this[_0x559a32(0xc8)]=new QuerySDK(_0x2981ea),this[_0x559a32(0xc3)]=new SegmentSDK(_0x2981ea),this[_0x559a32(0xcb)]=new WorkflowSDK(_0x2981ea),this['llm']=new LLMSDK(_0x2981ea),this[_0x559a32(0xc6)]=new JobSDK(_0x2981ea),this['user']=new UserSDK(_0x2981ea),this[_0x559a32(0xcc)]=new EngageSDK(_0x2981ea),this[_0x559a32(0xbd)]=new ConnectionSDK(_0x2981ea),this[_0x559a32(0xc0)]=new RawAPI(_0x2981ea);}get[a64_0x56a6a7(0xb8)](){const _0x4f5287=a64_0x56a6a7;return this[_0x4f5287(0xbc)][_0x4f5287(0xb8)];}}
package/dist/sdk/job.js CHANGED
@@ -1 +1 @@
1
- const a65_0x4617e4=a65_0x22ae;(function(_0x587079,_0x3515c6){const _0x314401=a65_0x22ae,_0x1b2742=_0x587079();while(!![]){try{const _0x5db2c8=parseInt(_0x314401(0x153))/0x1*(-parseInt(_0x314401(0x136))/0x2)+-parseInt(_0x314401(0x137))/0x3*(-parseInt(_0x314401(0x13c))/0x4)+-parseInt(_0x314401(0x139))/0x5*(-parseInt(_0x314401(0x13b))/0x6)+parseInt(_0x314401(0x146))/0x7+-parseInt(_0x314401(0x14a))/0x8*(-parseInt(_0x314401(0x151))/0x9)+-parseInt(_0x314401(0x150))/0xa*(-parseInt(_0x314401(0x144))/0xb)+parseInt(_0x314401(0x148))/0xc*(-parseInt(_0x314401(0x13f))/0xd);if(_0x5db2c8===_0x3515c6)break;else _0x1b2742['push'](_0x1b2742['shift']());}catch(_0x2b5f48){_0x1b2742['push'](_0x1b2742['shift']());}}}(a65_0x425c,0x6a191));import{TDApiClient}from'../client/td-api-client.js';function a65_0x425c(){const _0xc73697=['submitPrestoJob','submit','cancelJob','logger','370qolvFW','1873188kyDMTf','start_at','21PaJwVp','show','map','client','17182QKZnIm','15xOEOXy','test','1471335uOQRCZ','created_at','12wmSdMJ','631700YyztkD','end_at','showJob','13VjWENC','trino','getJobResult','getUserInfo','replace','223256WXvnIZ','updated_at','1021174YbPodt','\x20UTC','29910396PnzWtt','list','32KMpBTp','kill'];a65_0x425c=function(){return _0xc73697;};return a65_0x425c();}function normalizeTimestamp(_0xab09cf){const _0x5efa9f=a65_0x22ae;if(!_0xab09cf)return undefined;if(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/[_0x5efa9f(0x138)](_0xab09cf))return _0xab09cf;return _0xab09cf[_0x5efa9f(0x143)](_0x5efa9f(0x147),'Z')[_0x5efa9f(0x143)]('\x20','T');}function a65_0x22ae(_0xf7096a,_0x228fff){_0xf7096a=_0xf7096a-0x133;const _0x425cba=a65_0x425c();let _0x22ae84=_0x425cba[_0xf7096a];return _0x22ae84;}export class JobSDK{['client'];constructor(_0x58d782){const _0x33dec4=a65_0x22ae;this[_0x33dec4(0x135)]=new TDApiClient(_0x58d782,_0x58d782[_0x33dec4(0x14f)]);}async[a65_0x4617e4(0x149)](_0x36fcae){const _0x36ee79=a65_0x4617e4,_0x3fcf52=await this[_0x36ee79(0x135)]['listJobs'](_0x36fcae);return _0x3fcf52[_0x36ee79(0x134)](_0x2b0202=>({..._0x2b0202,'created_at':normalizeTimestamp(_0x2b0202[_0x36ee79(0x13a)]),'updated_at':normalizeTimestamp(_0x2b0202[_0x36ee79(0x145)]),'start_at':normalizeTimestamp(_0x2b0202[_0x36ee79(0x152)]),'end_at':normalizeTimestamp(_0x2b0202[_0x36ee79(0x13d)])}));}async[a65_0x4617e4(0x133)](_0x394fc4){const _0x3f7c21=a65_0x4617e4,_0x1a546c=await this[_0x3f7c21(0x135)][_0x3f7c21(0x13e)](_0x394fc4);return{..._0x1a546c,'created_at':normalizeTimestamp(_0x1a546c[_0x3f7c21(0x13a)]),'updated_at':normalizeTimestamp(_0x1a546c[_0x3f7c21(0x145)]),'start_at':normalizeTimestamp(_0x1a546c['start_at']),'end_at':normalizeTimestamp(_0x1a546c['end_at'])};}async[a65_0x4617e4(0x14b)](_0x5f35fa){const _0x5a911b=a65_0x4617e4;await this['client'][_0x5a911b(0x14e)](_0x5f35fa);}async[a65_0x4617e4(0x14d)](_0x390057,_0x80edf1,_0x3dc701=a65_0x4617e4(0x140)){const _0x4c3027=a65_0x4617e4;return _0x3dc701==='hive'?await this[_0x4c3027(0x135)]['submitHiveJob'](_0x390057,_0x80edf1):await this[_0x4c3027(0x135)][_0x4c3027(0x14c)](_0x390057,_0x80edf1);}async['result'](_0x5352ee){const _0x459b87=a65_0x4617e4;return await this[_0x459b87(0x135)][_0x459b87(0x141)](_0x5352ee);}async[a65_0x4617e4(0x142)](){const _0x263834=a65_0x4617e4;return await this[_0x263834(0x135)][_0x263834(0x142)]();}}
1
+ const a65_0x249a55=a65_0x5eb3;(function(_0x13ec32,_0x16a1d6){const _0x51f209=a65_0x5eb3,_0x2c569b=_0x13ec32();while(!![]){try{const _0x138d77=-parseInt(_0x51f209(0x131))/0x1+parseInt(_0x51f209(0x13d))/0x2*(parseInt(_0x51f209(0x130))/0x3)+-parseInt(_0x51f209(0x141))/0x4+parseInt(_0x51f209(0x12e))/0x5*(parseInt(_0x51f209(0x134))/0x6)+parseInt(_0x51f209(0x148))/0x7*(-parseInt(_0x51f209(0x13b))/0x8)+-parseInt(_0x51f209(0x144))/0x9*(parseInt(_0x51f209(0x13e))/0xa)+parseInt(_0x51f209(0x14b))/0xb;if(_0x138d77===_0x16a1d6)break;else _0x2c569b['push'](_0x2c569b['shift']());}catch(_0x3f0fb1){_0x2c569b['push'](_0x2c569b['shift']());}}}(a65_0x541c,0x6c800));import{TDApiClient}from'../client/td-api-client.js';function a65_0x541c(){const _0x371d9d=['submitPrestoJob','replace','kill','182IewJAz','map','hive','3472315OrPcZY','logger','2263445RvHnJe','cancelJob','3fcrHVy','836012MtxzsB','showJob','listJobs','6UooPtu','start_at','updated_at','created_at','client','show','list','6632JdhLKO','trino','1747556KIWrHE','10IDWnuH','getUserInfo','submit','450816kZmoty','submitHiveJob','end_at','2047014pPygjY'];a65_0x541c=function(){return _0x371d9d;};return a65_0x541c();}function a65_0x5eb3(_0x2398c4,_0x4150eb){_0x2398c4=_0x2398c4-0x12d;const _0x541ce7=a65_0x541c();let _0x5eb3e4=_0x541ce7[_0x2398c4];return _0x5eb3e4;}function normalizeTimestamp(_0x17f473){const _0x41b912=a65_0x5eb3;if(!_0x17f473)return undefined;if(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/['test'](_0x17f473))return _0x17f473;return _0x17f473[_0x41b912(0x146)]('\x20UTC','Z')[_0x41b912(0x146)]('\x20','T');}export class JobSDK{[a65_0x249a55(0x138)];constructor(_0x59a436){const _0x10b105=a65_0x249a55;this[_0x10b105(0x138)]=new TDApiClient(_0x59a436,_0x59a436[_0x10b105(0x12d)]);}async[a65_0x249a55(0x13a)](_0x1c7274){const _0x157b1a=a65_0x249a55,_0xb5b168=await this[_0x157b1a(0x138)][_0x157b1a(0x133)](_0x1c7274);return _0xb5b168[_0x157b1a(0x149)](_0xeb5d8d=>({..._0xeb5d8d,'created_at':normalizeTimestamp(_0xeb5d8d[_0x157b1a(0x137)]),'updated_at':normalizeTimestamp(_0xeb5d8d[_0x157b1a(0x136)]),'start_at':normalizeTimestamp(_0xeb5d8d[_0x157b1a(0x135)]),'end_at':normalizeTimestamp(_0xeb5d8d[_0x157b1a(0x143)])}));}async[a65_0x249a55(0x139)](_0x404a80){const _0x29c60c=a65_0x249a55,_0x2722ac=await this[_0x29c60c(0x138)][_0x29c60c(0x132)](_0x404a80);return{..._0x2722ac,'created_at':normalizeTimestamp(_0x2722ac[_0x29c60c(0x137)]),'updated_at':normalizeTimestamp(_0x2722ac['updated_at']),'start_at':normalizeTimestamp(_0x2722ac[_0x29c60c(0x135)]),'end_at':normalizeTimestamp(_0x2722ac[_0x29c60c(0x143)])};}async[a65_0x249a55(0x147)](_0x32b018){const _0x1c0280=a65_0x249a55;await this['client'][_0x1c0280(0x12f)](_0x32b018);}async[a65_0x249a55(0x140)](_0x182757,_0x4809e4,_0x2b31c9=a65_0x249a55(0x13c)){const _0x1cfe53=a65_0x249a55;return _0x2b31c9===_0x1cfe53(0x14a)?await this[_0x1cfe53(0x138)][_0x1cfe53(0x142)](_0x182757,_0x4809e4):await this[_0x1cfe53(0x138)][_0x1cfe53(0x145)](_0x182757,_0x4809e4);}async['result'](_0x15f229){const _0x447514=a65_0x249a55;return await this[_0x447514(0x138)]['getJobResult'](_0x15f229);}async[a65_0x249a55(0x13f)](){return await this['client']['getUserInfo']();}}