@treasuredata/tdx 2026.3.2 → 2026.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a3_0x2b96f3=a3_0x1159;(function(_0x1f3d58,_0x1d3005){const _0x15926e=a3_0x1159,_0xd3f17e=_0x1f3d58();while(!![]){try{const _0xbf04c4=parseInt(_0x15926e(0x112))/0x1*(parseInt(_0x15926e(0x10a))/0x2)+-parseInt(_0x15926e(0x117))/0x3*(-parseInt(_0x15926e(0x11e))/0x4)+-parseInt(_0x15926e(0x11b))/0x5+parseInt(_0x15926e(0x11c))/0x6+-parseInt(_0x15926e(0x120))/0x7*(-parseInt(_0x15926e(0x116))/0x8)+-parseInt(_0x15926e(0x115))/0x9+parseInt(_0x15926e(0x11a))/0xa;if(_0xbf04c4===_0x1d3005)break;else _0xd3f17e['push'](_0xd3f17e['shift']());}catch(_0x51915e){_0xd3f17e['push'](_0xd3f17e['shift']());}}}(a3_0x1e5b,0x50191));function a3_0x1e5b(){const _0x190a86=['4470903sxraTo','19160VmcYPz','1054209ocpbdU','site','resolveParentId','2654470eEojIZ','745445IjdhQe','337722wbsTMX','Child\x20name:\x20','4VGjhqN','name','630fCSrUB','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','segment','\x27...','listActivations','verbose','error','✔\x20Found\x20','Listing\x20activations\x20for\x20segment\x20\x27','data','\x20\x20Cause:\x20','6820MLPKDj','Error:\x20','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','List\x20activations\x20for\x20a\x20segment','Resolved\x20parent\x20ID:\x20','\x20activation','Parent\x20name:\x20','cause','25KPEnKs','Site:\x20','length'];a3_0x1e5b=function(){return _0x190a86;};return a3_0x1e5b();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';function a3_0x1159(_0x2fb7a7,_0x5ae43d){_0x2fb7a7=_0x2fb7a7-0x10a;const _0x1e5b5a=a3_0x1e5b();let _0x115931=_0x1e5b5a[_0x2fb7a7];return _0x115931;}export class ActivationsCommand extends BaseCommand{[a3_0x2b96f3(0x11f)]='activations';['description']=a3_0x2b96f3(0x10d);async['execute'](_0x13fe1c){const _0x5bc649=a3_0x2b96f3,{options:_0x25dc62,args:_0x11c056,tdx:_0x2c7623}=_0x13fe1c;if(_0x11c056[_0x5bc649(0x114)]===0x0)return console[_0x5bc649(0x126)]('Error:\x20Segment\x20name\x20is\x20required'),console[_0x5bc649(0x126)]('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;try{const {parentId:_0x1ed33b,childId:_0x408847}=parseSegmentRef(_0x11c056[0x0]);if(!_0x408847)return console[_0x5bc649(0x126)](_0x5bc649(0x10c)),console[_0x5bc649(0x126)](_0x5bc649(0x121)),0x1;_0x25dc62[_0x5bc649(0x125)]&&(console[_0x5bc649(0x126)](_0x5bc649(0x113)+_0x25dc62[_0x5bc649(0x118)]),console['error'](_0x5bc649(0x110)+_0x1ed33b),console[_0x5bc649(0x126)](_0x5bc649(0x11d)+_0x408847));const _0x1fa993=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1ed33b+_0x5bc649(0x123),()=>_0x2c7623[_0x5bc649(0x122)][_0x5bc649(0x119)](_0x1ed33b),{'verbose':_0x25dc62[_0x5bc649(0x125)]}),_0x6b43fd=_0x1fa993[_0x5bc649(0x129)];_0x25dc62[_0x5bc649(0x125)]&&console[_0x5bc649(0x126)](_0x5bc649(0x10e)+_0x6b43fd);const _0x19bf3c=await withSpinner('Resolving\x20child\x20segment\x20\x27'+_0x408847+_0x5bc649(0x123),()=>_0x2c7623[_0x5bc649(0x122)]['resolveSegmentId'](_0x6b43fd,_0x408847),{'verbose':_0x25dc62['verbose']}),_0x2e74da=_0x19bf3c[_0x5bc649(0x129)];_0x25dc62[_0x5bc649(0x125)]&&console[_0x5bc649(0x126)]('Resolved\x20child\x20ID:\x20'+_0x2e74da);const _0x371c97=await withSpinner(_0x5bc649(0x128)+_0x408847+_0x5bc649(0x123),()=>_0x2c7623[_0x5bc649(0x122)][_0x5bc649(0x124)](_0x6b43fd,_0x2e74da),{'verbose':_0x25dc62['verbose']}),_0x3ef594=_0x371c97[_0x5bc649(0x129)];return console[_0x5bc649(0x126)](_0x5bc649(0x127)+_0x3ef594[_0x5bc649(0x114)]+_0x5bc649(0x10f)+(_0x3ef594[_0x5bc649(0x114)]!==0x1?'s':'')),await handleSDKOutput(_0x3ef594,_0x25dc62),0x0;}catch(_0x54384d){if(_0x54384d instanceof SDKError)return console[_0x5bc649(0x126)](_0x5bc649(0x10b)+_0x54384d['message']),_0x54384d[_0x5bc649(0x111)]&&console['error'](_0x5bc649(0x12a)+_0x54384d[_0x5bc649(0x111)]),0x1;throw _0x54384d;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a4_0x3fcc(_0x17ffb8,_0x458e1e){_0x17ffb8=_0x17ffb8-0x115;const _0x31fa7d=a4_0x31fa();let _0x3fcce5=_0x31fa7d[_0x17ffb8];return _0x3fcce5;}const a4_0x3ce141=a4_0x3fcc;(function(_0x5f22c8,_0x23edae){const _0x4fb90e=a4_0x3fcc,_0x7740ab=_0x5f22c8();while(!![]){try{const _0x38b6db=parseInt(_0x4fb90e(0x1b8))/0x1+-parseInt(_0x4fb90e(0x133))/0x2+-parseInt(_0x4fb90e(0x14d))/0x3+parseInt(_0x4fb90e(0x17e))/0x4*(-parseInt(_0x4fb90e(0x1c0))/0x5)+-parseInt(_0x4fb90e(0x1c9))/0x6*(-parseInt(_0x4fb90e(0x141))/0x7)+-parseInt(_0x4fb90e(0x121))/0x8*(-parseInt(_0x4fb90e(0x152))/0x9)+parseInt(_0x4fb90e(0x18a))/0xa;if(_0x38b6db===_0x23edae)break;else _0x7740ab['push'](_0x7740ab['shift']());}catch(_0x1ec2a5){_0x7740ab['push'](_0x7740ab['shift']());}}}(a4_0x31fa,0x94075));function a4_0x31fa(){const _0x453bbe=['✔\x20Context\x20set:\x20','\x20\x20Experimental\x20Artifacts:\x20','llm_project','\x22\x20to\x20a\x20different\x20profile','\x0aError:','agents','<new-name>','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','yellow','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','unchanged','\x20\x20Agent\x20\x22','Errors:','repeat','cyan','\x0aChanges:','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','Cloning\x20\x22','Project\x20cloned\x20with\x20errors','push','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date','\x0aChanges\x20to\x20agent\x20\x27','isNew','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','dryRun','red','Or\x20specify:\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20--agent\x20<name>','prompts','llmProject','1664508NviNmZ','agent:clone','Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','Chat:\x20','\x0aChanges\x20to\x20experimental\x20knowledge\x20base\x20\x27','Pushing\x20agent\x20from\x20\x22','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','\x20changed','\x20\x20tdx\x20agent\x20pull\x20','\x0a✔\x20Pulled\x20','15257770qkUzjA','INVALID_ARGUMENT','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','description','agent','\x20\x20Source:\x20','Status:\x20','join','\x20\x20Prompt\x20\x22','\x20new','\x20\x20Target:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory','\x20=\x20','dim','no_context','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Agent:\x20','\x0aChanges\x20to\x20prompt\x20\x27','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','\x20|\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','pullProject','outputDir','\x0aChanges\x20to\x20integration\x20\x27','cwd','\x0aPull\x20summary\x20for\x20\x27','Would\x20clone:','created','Would\x20pull\x20agent:\x20','Using\x20context\x20project:\x20','agent.yml','\x20\x20Knowledge\x20Bases:\x20','Using\x20current\x20project:\x20','\x22\x20from\x20project\x20\x22','\x20\x20Integration\x20\x22','Analyzing\x20changes\x20to\x20push...','message','force','outputPath','Using\x20project\x20from\x20context:\x20','Pulling\x20agent\x20\x22','output','diff','-\x20nothing\x20pushed','projectName','integrations','210342VeHKkm','Would\x20push\x20agent:\x20','agentId','execute','\x22:\x20','Agent\x20','\x20--profile\x20','pushAgent','10NMQIbA','name','arg-dir','Project:\x20','Using\x20local\x20project:\x20','parse','Dry\x20run\x20-\x20no\x20files\x20written','New\x20project\x20ID:\x20','projectId','66zKlzBk','Using\x20project:\x20','Analyzing\x20project\x20\x22','Cancelled','found','errors','Output\x20path:\x20','context','newProjectName','dirname','Source:\x20','\x27\x20to\x20create\x20the\x20folder\x20structure.','cloneProject','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project','8nRzXED','profile','\x22...','\x20\x20Experimental\x20Knowledge\x20Bases:\x20','Project\x20cloned\x20successfully','agent:pull','\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project','utf-8','tdx.json','new','Pushing\x20to\x20project...','agent:push','\x20--name\x20','\x22\x20to\x20\x22','reason','experimentalArtifacts','agentName','sourceProjectName','767490CuEknX','Using\x20project\x20from\x20','error','\x20\x20Text\x20Knowledge\x20Base\x20\x22','\x0aPush\x20summary\x20for\x20\x27','\x20\x20Text\x20Knowledge\x20Bases:\x20','pushProject','Failed\x20to\x20push\x20agent:\x20','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','counts','\x20\x20Prompts:\x20','-\x20no\x20files\x20written','textKnowledgeBases','New\x20project\x20name\x20is\x20required','219394vSKNID','pullAgent','llm','\x0aPush\x20','\x20\x20Experimental\x20Artifact\x20\x22','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','\x20\x20Knowledge\x20Base\x20\x22','green','\x0aChanges\x20to\x20experimental\x20artifact\x20\x27','\x20\x20Agents:\x20','experimentalKnowledgeBases','\x20total','1088133oubYFg','Dry\x20run\x20-\x20no\x20changes\x20made','MISSING_ARGUMENT','Clone\x20\x22','\x20\x20tdx\x20agent\x20clone\x20agents/','937386yaZLEc','\x20updated','total','updated','no_local_folder','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20--agent\x20<name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20agent\x20from\x20context\x20project','log','knowledgeBases','\x20\x20Integrations:\x20','newProjectId','\x20unchanged','Agent\x20pulled\x20successfully','\x0aRun\x20\x27tdx\x20agent\x20pull\x20','action'];a4_0x31fa=function(){return _0x453bbe;};return a4_0x31fa();}import a4_0x4bdcf5 from'chalk';import a4_0x15b778 from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{findAgentConfigPath,resolveProjectFromContext,resolveAgentPullArgs}from'../sdk/agent/agent-config.js';import{saveSessionContext}from'../core/session.js';import{sanitizeForFilesystem,normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x4e66c0){const _0x356105=a4_0x3fcc,_0x987452=[];if(_0x4e66c0[_0x356105(0x154)]!==undefined)_0x987452[_0x356105(0x173)](_0x4e66c0['total']+_0x356105(0x14c));if(_0x4e66c0['new']!==undefined&&_0x4e66c0[_0x356105(0x12a)]>0x0)_0x987452[_0x356105(0x173)](a4_0x4bdcf5[_0x356105(0x148)](_0x4e66c0[_0x356105(0x12a)]+'\x20new'));if(_0x4e66c0[_0x356105(0x1a5)]!==undefined&&_0x4e66c0[_0x356105(0x1a5)]>0x0)_0x987452[_0x356105(0x173)](a4_0x4bdcf5[_0x356105(0x148)](_0x4e66c0['created']+'\x20created'));if(_0x4e66c0[_0x356105(0x155)]!==undefined&&_0x4e66c0[_0x356105(0x155)]>0x0)_0x987452[_0x356105(0x173)](a4_0x4bdcf5[_0x356105(0x168)](_0x4e66c0[_0x356105(0x155)]+_0x356105(0x153)));if(_0x4e66c0['unchanged']!==undefined&&_0x4e66c0[_0x356105(0x16a)]>0x0)_0x987452[_0x356105(0x173)](a4_0x4bdcf5['gray'](_0x4e66c0['unchanged']+_0x356105(0x15c)));if(_0x4e66c0[_0x356105(0x118)]!==undefined&&_0x4e66c0[_0x356105(0x118)]>0x0)_0x987452[_0x356105(0x173)](a4_0x4bdcf5[_0x356105(0x17a)](_0x4e66c0[_0x356105(0x118)]+'\x20errors'));return _0x987452[_0x356105(0x191)](',\x20');}function displayDiffs(_0x2b1891,_0x116213,_0x5a52b6,_0x29c43b,_0x3137a2,_0x590438,_0x357267){const _0x46149c=a4_0x3fcc;for(const _0x193eeb of _0x2b1891){if(_0x193eeb[_0x46149c(0x1b4)]){const _0x4e08eb=_0x193eeb['agentName']||_0x193eeb['name'];console['log'](_0x46149c(0x176)+_0x4e08eb+'\x27:'),console[_0x46149c(0x158)]('─'[_0x46149c(0x16d)](0x3c)),console[_0x46149c(0x158)](_0x193eeb['diff']),console[_0x46149c(0x158)]('─'[_0x46149c(0x16d)](0x3c));}}for(const _0x575eba of _0x116213){_0x575eba[_0x46149c(0x1b4)]&&(console[_0x46149c(0x158)](_0x46149c(0x170)+_0x575eba[_0x46149c(0x1c1)]+'\x27:'),console['log']('─'['repeat'](0x3c)),console['log'](_0x575eba[_0x46149c(0x1b4)]),console[_0x46149c(0x158)]('─'[_0x46149c(0x16d)](0x3c)));}for(const _0x774a95 of _0x5a52b6){_0x774a95[_0x46149c(0x1b4)]&&(console['log'](_0x46149c(0x167)+_0x774a95['name']+'\x27:'),console[_0x46149c(0x158)]('─'[_0x46149c(0x16d)](0x3c)),console[_0x46149c(0x158)](_0x774a95[_0x46149c(0x1b4)]),console['log']('─'[_0x46149c(0x16d)](0x3c)));}for(const _0x449eb5 of _0x29c43b){_0x449eb5['diff']&&(console[_0x46149c(0x158)](_0x46149c(0x19b)+_0x449eb5[_0x46149c(0x1c1)]+'\x27:'),console[_0x46149c(0x158)]('─'[_0x46149c(0x16d)](0x3c)),console[_0x46149c(0x158)](_0x449eb5[_0x46149c(0x1b4)]),console[_0x46149c(0x158)]('─'[_0x46149c(0x16d)](0x3c)));}for(const _0x3e2ed7 of _0x3137a2){_0x3e2ed7[_0x46149c(0x1b4)]&&(console[_0x46149c(0x158)](_0x46149c(0x1a1)+_0x3e2ed7[_0x46149c(0x1c1)]+'\x27:'),console[_0x46149c(0x158)]('─'[_0x46149c(0x16d)](0x3c)),console['log'](_0x3e2ed7[_0x46149c(0x1b4)]),console['log']('─'['repeat'](0x3c)));}for(const _0x1e5d8d of _0x590438){_0x1e5d8d[_0x46149c(0x1b4)]&&(console['log'](_0x46149c(0x184)+_0x1e5d8d[_0x46149c(0x1c1)]+'\x27:'),console[_0x46149c(0x158)]('─'[_0x46149c(0x16d)](0x3c)),console[_0x46149c(0x158)](_0x1e5d8d['diff']),console[_0x46149c(0x158)]('─'['repeat'](0x3c)));}for(const _0x3e8fb5 of _0x357267){_0x3e8fb5[_0x46149c(0x1b4)]&&(console['log'](_0x46149c(0x149)+_0x3e8fb5[_0x46149c(0x1c1)]+'\x27:'),console[_0x46149c(0x158)]('─'[_0x46149c(0x16d)](0x3c)),console['log'](_0x3e8fb5[_0x46149c(0x1b4)]),console[_0x46149c(0x158)]('─'[_0x46149c(0x16d)](0x3c)));}}export class AgentPullCommand extends BaseCommand{[a4_0x3ce141(0x1c1)]=a4_0x3ce141(0x126);[a4_0x3ce141(0x18d)]='Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files';async[a4_0x3ce141(0x1bb)](_0x323d73){const _0xb3791f=a4_0x3ce141,{options:_0x4fc120,args:_0x328620,tdx:_0x4150ee}=_0x323d73,_0x5f0885=_0x328620[0x0],_0xb8a077=_0x328620[0x1],_0x1d44a0=_0x4fc120[_0xb3791f(0x1b3)],_0x5d8cc4=_0x4fc120[_0xb3791f(0x179)],_0x1e0dfb=_0x4fc120[_0xb3791f(0x1af)],_0xcf91ca=_0x4fc120['yes'],_0x4c9704=_0x4fc120[_0xb3791f(0x17d)],_0x42ffd2=_0x4fc120[_0xb3791f(0x18e)];let _0x3f51a9;if(_0x5f0885){const _0x3ae90f=a4_0x15b778[_0xb3791f(0x191)](_0x5f0885,_0xb3791f(0x129));if(existsSync(_0x3ae90f))try{const _0xb21cc5=JSON['parse'](readFileSync(_0x3ae90f,_0xb3791f(0x128)));_0xb21cc5[_0xb3791f(0x162)]&&(_0x3f51a9={'llm_project':_0xb21cc5[_0xb3791f(0x162)]});}catch{}}const _0x22b210=findAgentConfigPath(process[_0xb3791f(0x1a2)]());let _0x47955a;if(_0x22b210)try{const _0x4e4f50=JSON[_0xb3791f(0x1c5)](readFileSync(_0x22b210,_0xb3791f(0x128)));_0x4e4f50[_0xb3791f(0x162)]&&(_0x47955a={'llm_project':_0x4e4f50['llm_project']});}catch{}const _0x18ee21=resolveAgentPullArgs({'arg':_0x5f0885,'agentNameArg':_0xb8a077,'agentFlag':_0x42ffd2,'contextProject':_0x4c9704,'argDirConfig':_0x3f51a9,'cwdConfigPath':_0x22b210||undefined,'cwdConfig':_0x47955a}),{projectNameOrId:_0x57090a,targetAgentName:_0xa53137,existingOutputDir:_0x390f2d,source:_0x327761}=_0x18ee21;if(_0x327761===_0xb3791f(0x1c2))console[_0xb3791f(0x158)](a4_0x4bdcf5[_0xb3791f(0x197)](_0xb3791f(0x134)+a4_0x15b778[_0xb3791f(0x191)](_0x5f0885,'tdx.json')+':\x20'+_0x57090a));else{if(_0x327761==='cwd-config')console[_0xb3791f(0x158)](a4_0x4bdcf5[_0xb3791f(0x197)]('Using\x20project:\x20'+_0x57090a));else _0x327761===_0xb3791f(0x11a)&&console[_0xb3791f(0x158)](a4_0x4bdcf5[_0xb3791f(0x197)](_0xb3791f(0x1b1)+_0x57090a));}if(!_0x57090a)return _0x42ffd2?(console[_0xb3791f(0x158)](a4_0x4bdcf5[_0xb3791f(0x168)]('The\x20--agent\x20flag\x20requires\x20llm_project\x20context\x20or\x20a\x20project\x20argument.\x0a')),console[_0xb3791f(0x158)]('Set\x20context:\x20\x20tdx\x20use\x20llm_project\x20<name>'),console['log'](_0xb3791f(0x17b))):(console[_0xb3791f(0x158)](a4_0x4bdcf5['yellow'](_0xb3791f(0x182))),console['log']('Usage:\x20tdx\x20agent\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)'),console['log'](_0xb3791f(0x120)),console[_0xb3791f(0x158)](_0xb3791f(0x195)),console[_0xb3791f(0x158)](_0xb3791f(0x157)),console['log']('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20agent\x20from\x20project')),0x1;if(_0xa53137){const {data:_0x18bb04}=await withSpinner(_0xb3791f(0x1b2)+_0xa53137+_0xb3791f(0x1ab)+_0x57090a+_0xb3791f(0x123),()=>_0x4150ee[_0xb3791f(0x143)][_0xb3791f(0x142)](_0x57090a,_0xa53137,_0x1d44a0,{'dryRun':_0x5d8cc4,'force':_0x1e0dfb}));if(_0x5d8cc4)return console[_0xb3791f(0x158)](a4_0x4bdcf5[_0xb3791f(0x168)](_0xb3791f(0x1c6))),console[_0xb3791f(0x158)](_0xb3791f(0x1a6)+_0x18bb04[_0xb3791f(0x131)]),console[_0xb3791f(0x158)](_0xb3791f(0x119)+_0x18bb04['outputPath']),_0x18bb04[_0xb3791f(0x1b4)]&&(console[_0xb3791f(0x158)](_0xb3791f(0x16f)),console['log']('─'['repeat'](0x3c)),console[_0xb3791f(0x158)](_0x18bb04['diff']),console['log']('─'[_0xb3791f(0x16d)](0x3c))),0x0;return console[_0xb3791f(0x158)](a4_0x4bdcf5['green'](_0xb3791f(0x15d))),console[_0xb3791f(0x158)](_0xb3791f(0x19a)+_0x18bb04[_0xb3791f(0x131)]),console['log']('Output:\x20'+_0x18bb04[_0xb3791f(0x1b0)]),console[_0xb3791f(0x158)](_0xb3791f(0x190)+(_0x18bb04[_0xb3791f(0x177)]?a4_0x4bdcf5[_0xb3791f(0x148)]('new'):_0x18bb04['hasChanges']?a4_0x4bdcf5[_0xb3791f(0x168)](_0xb3791f(0x155)):a4_0x4bdcf5['gray'](_0xb3791f(0x16a)))),0x0;}const _0xac8a21=_0x390f2d||_0x1d44a0,{data:_0x22d663}=await withSpinner(_0xb3791f(0x115)+_0x57090a+'\x22...',()=>_0x4150ee[_0xb3791f(0x143)][_0xb3791f(0x19f)](_0x57090a,_0xac8a21,{'dryRun':!![]})),_0x33c738=_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x165)]['new']+_0x22d663['counts'][_0xb3791f(0x159)][_0xb3791f(0x12a)]+_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x13f)][_0xb3791f(0x12a)]+_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x17c)][_0xb3791f(0x12a)]+_0x22d663[_0xb3791f(0x13c)]['integrations'][_0xb3791f(0x12a)]+_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x14b)]['new']+_0x22d663['counts'][_0xb3791f(0x130)][_0xb3791f(0x12a)],_0x8dd55=_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x165)][_0xb3791f(0x155)]+_0x22d663['counts'][_0xb3791f(0x159)][_0xb3791f(0x155)]+_0x22d663[_0xb3791f(0x13c)]['textKnowledgeBases'][_0xb3791f(0x155)]+_0x22d663[_0xb3791f(0x13c)]['prompts'][_0xb3791f(0x155)]+_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x1b7)][_0xb3791f(0x155)]+_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x14b)][_0xb3791f(0x155)]+_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x130)][_0xb3791f(0x155)],_0x3ddf7c=_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x165)][_0xb3791f(0x16a)]+_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x159)][_0xb3791f(0x16a)]+_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x13f)][_0xb3791f(0x16a)]+_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x17c)][_0xb3791f(0x16a)]+_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x1b7)][_0xb3791f(0x16a)]+_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x14b)][_0xb3791f(0x16a)]+_0x22d663['counts']['experimentalArtifacts'][_0xb3791f(0x16a)];console[_0xb3791f(0x158)](_0xb3791f(0x1a3)+_0x22d663['projectName']+'\x27:'),console[_0xb3791f(0x158)]('\x20\x20'+a4_0x4bdcf5['green']('+\x20'+_0x33c738+'\x20new')+_0xb3791f(0x19d)+a4_0x4bdcf5[_0xb3791f(0x168)]('~\x20'+_0x8dd55+_0xb3791f(0x187))+_0xb3791f(0x19d)+a4_0x4bdcf5['dim']('=\x20'+_0x3ddf7c+_0xb3791f(0x15c))),console[_0xb3791f(0x158)]('\x20\x20Agents:\x20'+formatCountSummary(_0x22d663['counts']['agents'])),console['log'](_0xb3791f(0x1a9)+formatCountSummary(_0x22d663[_0xb3791f(0x13c)]['knowledgeBases'])),console['log'](_0xb3791f(0x138)+formatCountSummary(_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x13f)])),console[_0xb3791f(0x158)](_0xb3791f(0x13d)+formatCountSummary(_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x17c)])),console['log'](_0xb3791f(0x15a)+formatCountSummary(_0x22d663[_0xb3791f(0x13c)]['integrations']));const _0x2d397e=_0x22d663['counts'][_0xb3791f(0x14b)][_0xb3791f(0x154)]>0x0||_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x130)][_0xb3791f(0x154)]>0x0;_0x2d397e&&(console[_0xb3791f(0x158)]('\x20\x20Experimental\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x14b)])),console[_0xb3791f(0x158)](_0xb3791f(0x161)+formatCountSummary(_0x22d663[_0xb3791f(0x13c)][_0xb3791f(0x130)])));console[_0xb3791f(0x158)](_0xb3791f(0x194)+a4_0x4bdcf5['cyan'](_0x22d663[_0xb3791f(0x1a0)])),displayDiffs(_0x22d663[_0xb3791f(0x165)],_0x22d663['knowledgeBases'],_0x22d663[_0xb3791f(0x13f)],_0x22d663[_0xb3791f(0x17c)],_0x22d663[_0xb3791f(0x1b7)],_0x22d663[_0xb3791f(0x14b)],_0x22d663[_0xb3791f(0x130)]);if(_0x5d8cc4)return console[_0xb3791f(0x158)](a4_0x4bdcf5[_0xb3791f(0x168)](_0xb3791f(0x19c))),0x0;if(_0x33c738===0x0&&_0x8dd55===0x0)return console[_0xb3791f(0x158)](a4_0x4bdcf5[_0xb3791f(0x148)](_0xb3791f(0x175))),saveSessionContext({'llm_project':_0x22d663['projectName']},_0x4fc120['session']),console[_0xb3791f(0x158)](a4_0x4bdcf5[_0xb3791f(0x148)]('✔\x20Context\x20set:\x20'+a4_0x4bdcf5['dim'](_0xb3791f(0x162))+_0xb3791f(0x196)+a4_0x4bdcf5[_0xb3791f(0x16e)](_0x22d663[_0xb3791f(0x1b6)]))),0x0;if(!_0xcf91ca&&!_0x1e0dfb){if(!isInteractive())return console['error'](a4_0x4bdcf5[_0xb3791f(0x17a)](_0xb3791f(0x164)),_0xb3791f(0x19e)),console[_0xb3791f(0x135)](a4_0x4bdcf5[_0xb3791f(0x197)](_0xb3791f(0x199))),0x1;const _0x34a86c=await confirmKey('\x0aWrite\x20'+(_0x33c738+_0x8dd55)+'\x20files?');if(!_0x34a86c)return console[_0xb3791f(0x158)](a4_0x4bdcf5[_0xb3791f(0x168)]('Cancelled'),_0xb3791f(0x13e)),0x1;}const {data:_0x2bf7de}=await withSpinner('Writing\x20files...',()=>_0x4150ee[_0xb3791f(0x143)][_0xb3791f(0x19f)](_0x57090a,_0xac8a21,{'force':_0x1e0dfb}));return console[_0xb3791f(0x158)](a4_0x4bdcf5['green'](_0xb3791f(0x189)+(_0x33c738+_0x8dd55)+'\x20files\x20to\x20'+_0x2bf7de[_0xb3791f(0x1a0)])),saveSessionContext({'llm_project':_0x2bf7de[_0xb3791f(0x1b6)]},_0x4fc120['session']),console[_0xb3791f(0x158)](a4_0x4bdcf5[_0xb3791f(0x148)](_0xb3791f(0x160)+a4_0x4bdcf5[_0xb3791f(0x197)]('llm_project')+_0xb3791f(0x196)+a4_0x4bdcf5[_0xb3791f(0x16e)](_0x2bf7de[_0xb3791f(0x1b6)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x3ce141(0x1c1)]=a4_0x3ce141(0x17f);[a4_0x3ce141(0x18d)]=a4_0x3ce141(0x180);async[a4_0x3ce141(0x1bb)](_0x1355a8){const _0x5a25e7=a4_0x3ce141,{options:_0xd98d0d,args:_0x2e9405,tdx:_0xdba7ef}=_0x1355a8,_0x4c4108=_0x2e9405[0x0],_0x3aa822=_0xd98d0d[_0x5a25e7(0x1c1)],_0x21588d=_0xd98d0d[_0x5a25e7(0x179)],_0x2070d4=_0xd98d0d['yes'],_0x57b3e3=_0xd98d0d['site'],_0x448a24=_0xd98d0d[_0x5a25e7(0x17d)];let _0x1a2604;const _0x4d10c7=findAgentConfigPath(process[_0x5a25e7(0x1a2)]());if(_0x4c4108){const _0x1fa1f3=a4_0x15b778[_0x5a25e7(0x191)](_0x4c4108,_0x5a25e7(0x129));existsSync(_0x1fa1f3)?(_0x1a2604=_0x4c4108,console[_0x5a25e7(0x158)](a4_0x4bdcf5[_0x5a25e7(0x197)]('Using\x20local\x20project:\x20'+_0x4c4108))):_0x1a2604=_0x4c4108;}else{if(_0x4d10c7)_0x1a2604=a4_0x15b778[_0x5a25e7(0x11c)](_0x4d10c7),console[_0x5a25e7(0x158)](a4_0x4bdcf5['dim'](_0x5a25e7(0x1aa)+_0x1a2604));else{if(_0x448a24){const _0x522a26=sanitizeForFilesystem(_0x448a24);let _0x77b3df=_0x522a26,_0x251344=a4_0x15b778[_0x5a25e7(0x191)](process['cwd'](),_0x5a25e7(0x165),_0x522a26,'tdx.json');if(!existsSync(_0x251344)){const _0x4d601c=normalizeName(_0x448a24),_0x4d02f5=a4_0x15b778['join'](process[_0x5a25e7(0x1a2)](),_0x5a25e7(0x165),_0x4d601c,'tdx.json');existsSync(_0x4d02f5)&&(_0x77b3df=_0x4d601c,_0x251344=_0x4d02f5);}if(existsSync(_0x251344))_0x1a2604=a4_0x15b778[_0x5a25e7(0x11c)](_0x251344),console[_0x5a25e7(0x158)](a4_0x4bdcf5[_0x5a25e7(0x197)](_0x5a25e7(0x1c4)+_0x1a2604));else{const _0x2ff2bd=_0xd98d0d[_0x5a25e7(0x122)];if(_0x2ff2bd)throw new SDKError(ErrorCode[_0x5a25e7(0x18b)],'Cannot\x20clone\x20from\x20context\x20project\x20\x22'+_0x448a24+_0x5a25e7(0x163),undefined,{'helpText':_0x5a25e7(0x178)+_0x5a25e7(0x13b)+(_0x5a25e7(0x188)+_0x448a24+'\x0a')+(_0x5a25e7(0x151)+_0x77b3df+_0x5a25e7(0x12d)+(_0x3aa822||_0x5a25e7(0x166))+_0x5a25e7(0x1be)+_0x2ff2bd)});_0x1a2604=_0x448a24,console[_0x5a25e7(0x158)](a4_0x4bdcf5[_0x5a25e7(0x197)](_0x5a25e7(0x1a7)+_0x448a24));}}}}if(!_0x1a2604)return console[_0x5a25e7(0x158)](a4_0x4bdcf5[_0x5a25e7(0x168)](_0x5a25e7(0x181))),console[_0x5a25e7(0x158)](_0x5a25e7(0x127)),console[_0x5a25e7(0x158)](_0x5a25e7(0x186)),console[_0x5a25e7(0x158)]('\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)'),console['log'](_0x5a25e7(0x169)),0x1;if(!_0x3aa822)throw new SDKError(ErrorCode[_0x5a25e7(0x14f)],_0x5a25e7(0x140),undefined,{'helpText':'Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>'});if(!_0x2070d4&&!_0x21588d){if(!isInteractive())return console[_0x5a25e7(0x135)](a4_0x4bdcf5['red']('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x5a25e7(0x135)](a4_0x4bdcf5['dim'](_0x5a25e7(0x199))),0x1;const _0x46ff24=await confirmKey(_0x5a25e7(0x150)+_0x1a2604+'\x22\x20to\x20new\x20project\x20\x22'+_0x3aa822+'\x22?');if(!_0x46ff24)return console[_0x5a25e7(0x158)](a4_0x4bdcf5[_0x5a25e7(0x168)](_0x5a25e7(0x116))),0x1;}const {data:_0xd3bf47}=await withSpinner(_0x5a25e7(0x171)+_0x1a2604+_0x5a25e7(0x12e)+_0x3aa822+_0x5a25e7(0x123),()=>_0xdba7ef['llm'][_0x5a25e7(0x11f)](_0x1a2604,_0x3aa822,{'dryRun':_0x21588d}));if(_0x21588d){console[_0x5a25e7(0x158)](a4_0x4bdcf5[_0x5a25e7(0x168)](_0x5a25e7(0x14e))),console['log'](_0x5a25e7(0x11d)+_0xd3bf47[_0x5a25e7(0x132)]),console[_0x5a25e7(0x158)]('New\x20project:\x20'+_0x3aa822),console['log'](_0x5a25e7(0x1a4)),console[_0x5a25e7(0x158)](_0x5a25e7(0x14a)+_0xd3bf47[_0x5a25e7(0x13c)][_0x5a25e7(0x165)][_0x5a25e7(0x1a5)]),console['log'](_0x5a25e7(0x1a9)+_0xd3bf47[_0x5a25e7(0x13c)]['knowledgeBases'][_0x5a25e7(0x1a5)]),console['log'](_0x5a25e7(0x13d)+_0xd3bf47[_0x5a25e7(0x13c)][_0x5a25e7(0x17c)][_0x5a25e7(0x1a5)]);const _0x5a9437=_0xd3bf47[_0x5a25e7(0x13c)]['experimentalKnowledgeBases'][_0x5a25e7(0x1a5)]>0x0||_0xd3bf47[_0x5a25e7(0x13c)][_0x5a25e7(0x130)][_0x5a25e7(0x1a5)]>0x0;return _0x5a9437&&(console['log'](_0x5a25e7(0x124)+_0xd3bf47[_0x5a25e7(0x13c)][_0x5a25e7(0x14b)][_0x5a25e7(0x1a5)]),console['log'](_0x5a25e7(0x161)+_0xd3bf47['counts'][_0x5a25e7(0x130)]['created'])),0x0;}const _0x25d962=_0xd3bf47[_0x5a25e7(0x13c)][_0x5a25e7(0x165)]['errors']>0x0||_0xd3bf47[_0x5a25e7(0x13c)][_0x5a25e7(0x159)]['errors']>0x0||_0xd3bf47[_0x5a25e7(0x13c)]['prompts'][_0x5a25e7(0x118)]>0x0||_0xd3bf47[_0x5a25e7(0x13c)][_0x5a25e7(0x14b)][_0x5a25e7(0x118)]>0x0||_0xd3bf47[_0x5a25e7(0x13c)]['experimentalArtifacts'][_0x5a25e7(0x118)]>0x0;_0x25d962?console['log'](a4_0x4bdcf5[_0x5a25e7(0x168)](_0x5a25e7(0x172))):console[_0x5a25e7(0x158)](a4_0x4bdcf5[_0x5a25e7(0x148)](_0x5a25e7(0x125)));console[_0x5a25e7(0x158)](_0x5a25e7(0x11d)+_0xd3bf47['sourceProjectName']),console[_0x5a25e7(0x158)]('New\x20project:\x20'+_0xd3bf47[_0x5a25e7(0x11b)]),console['log'](_0x5a25e7(0x1c7)+_0xd3bf47[_0x5a25e7(0x15b)]),console[_0x5a25e7(0x158)](),console[_0x5a25e7(0x158)]('Summary:'),console['log'](_0x5a25e7(0x14a)+formatCountSummary(_0xd3bf47['counts'][_0x5a25e7(0x165)])),console[_0x5a25e7(0x158)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0xd3bf47[_0x5a25e7(0x13c)]['knowledgeBases'])),console['log'](_0x5a25e7(0x13d)+formatCountSummary(_0xd3bf47[_0x5a25e7(0x13c)]['prompts'])),console['log'](_0x5a25e7(0x15a)+formatCountSummary(_0xd3bf47['counts'][_0x5a25e7(0x1b7)]));const _0x4be5c3=_0xd3bf47[_0x5a25e7(0x13c)]['experimentalKnowledgeBases'][_0x5a25e7(0x1a5)]>0x0||_0xd3bf47['counts'][_0x5a25e7(0x14b)][_0x5a25e7(0x155)]>0x0||_0xd3bf47[_0x5a25e7(0x13c)][_0x5a25e7(0x14b)]['unchanged']>0x0||_0xd3bf47[_0x5a25e7(0x13c)][_0x5a25e7(0x130)][_0x5a25e7(0x1a5)]>0x0||_0xd3bf47[_0x5a25e7(0x13c)][_0x5a25e7(0x130)][_0x5a25e7(0x155)]>0x0||_0xd3bf47[_0x5a25e7(0x13c)]['experimentalArtifacts'][_0x5a25e7(0x16a)]>0x0;_0x4be5c3&&(console[_0x5a25e7(0x158)](_0x5a25e7(0x124)+formatCountSummary(_0xd3bf47[_0x5a25e7(0x13c)][_0x5a25e7(0x14b)])),console[_0x5a25e7(0x158)](_0x5a25e7(0x161)+formatCountSummary(_0xd3bf47[_0x5a25e7(0x13c)][_0x5a25e7(0x130)])));if(_0x25d962){console[_0x5a25e7(0x158)](),console[_0x5a25e7(0x158)](a4_0x4bdcf5['red'](_0x5a25e7(0x16c)));for(const _0x49a003 of _0xd3bf47[_0x5a25e7(0x165)]){_0x49a003['action']===_0x5a25e7(0x135)&&console[_0x5a25e7(0x158)](a4_0x4bdcf5[_0x5a25e7(0x17a)]('\x20\x20Agent\x20\x22'+_0x49a003[_0x5a25e7(0x131)]+'\x22:\x20'+_0x49a003['error']));}for(const _0x24c9d5 of _0xd3bf47[_0x5a25e7(0x159)]){_0x24c9d5['action']===_0x5a25e7(0x135)&&console['log'](a4_0x4bdcf5['red'](_0x5a25e7(0x147)+_0x24c9d5[_0x5a25e7(0x1c1)]+_0x5a25e7(0x1bc)+_0x24c9d5['error']));}for(const _0x1ff7e8 of _0xd3bf47[_0x5a25e7(0x17c)]){_0x1ff7e8[_0x5a25e7(0x15f)]===_0x5a25e7(0x135)&&console[_0x5a25e7(0x158)](a4_0x4bdcf5[_0x5a25e7(0x17a)]('\x20\x20Prompt\x20\x22'+_0x1ff7e8['name']+'\x22:\x20'+_0x1ff7e8[_0x5a25e7(0x135)]));}for(const _0x26cea0 of _0xd3bf47[_0x5a25e7(0x1b7)]){_0x26cea0['action']==='error'&&console['log'](a4_0x4bdcf5['red'](_0x5a25e7(0x1ac)+_0x26cea0[_0x5a25e7(0x1c1)]+_0x5a25e7(0x1bc)+_0x26cea0[_0x5a25e7(0x135)]));}for(const _0x447f0d of _0xd3bf47[_0x5a25e7(0x14b)]){_0x447f0d[_0x5a25e7(0x15f)]===_0x5a25e7(0x135)&&console['log'](a4_0x4bdcf5[_0x5a25e7(0x17a)]('\x20\x20Experimental\x20Knowledge\x20Base\x20\x22'+_0x447f0d['name']+_0x5a25e7(0x1bc)+_0x447f0d[_0x5a25e7(0x135)]));}for(const _0x8bf051 of _0xd3bf47['experimentalArtifacts']){_0x8bf051[_0x5a25e7(0x15f)]==='error'&&console[_0x5a25e7(0x158)](a4_0x4bdcf5[_0x5a25e7(0x17a)](_0x5a25e7(0x145)+_0x8bf051[_0x5a25e7(0x1c1)]+_0x5a25e7(0x1bc)+_0x8bf051[_0x5a25e7(0x135)]));}return 0x1;}console[_0x5a25e7(0x158)]();const _0xa4b09f=getLLMProjectUrl(_0x57b3e3,_0xd3bf47[_0x5a25e7(0x15b)]);return console[_0x5a25e7(0x158)]('Project:\x20'+a4_0x4bdcf5[_0x5a25e7(0x16e)](_0xa4b09f)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x3ce141(0x1c1)]=a4_0x3ce141(0x12c);[a4_0x3ce141(0x18d)]='Push\x20local\x20agent\x20files\x20to\x20LLM\x20project';async[a4_0x3ce141(0x1bb)](_0x31a703){const _0x24bff4=a4_0x3ce141,{options:_0x4d1647,args:_0x4e65ea,tdx:_0x5afb9e}=_0x31a703;let _0x12f1dd=_0x4e65ea[0x0]||process['cwd']();const _0x5b2b2a=_0x4d1647['dryRun'],_0x1f5d11=_0x4d1647[_0x24bff4(0x1af)],_0x245ff8=_0x4d1647['yes'],_0x54dcab=_0x4d1647['site'],_0x5799b0=a4_0x15b778[_0x24bff4(0x191)](_0x12f1dd,_0x24bff4(0x1a8)),_0x15c195=existsSync(_0x5799b0);if(_0x15c195){const {data:_0x48e151}=await withSpinner(_0x24bff4(0x185)+_0x12f1dd+_0x24bff4(0x123),()=>_0x5afb9e[_0x24bff4(0x143)][_0x24bff4(0x1bf)](_0x12f1dd,{'dryRun':_0x5b2b2a,'force':_0x1f5d11}));if(_0x5b2b2a)return console[_0x24bff4(0x158)](a4_0x4bdcf5[_0x24bff4(0x168)](_0x24bff4(0x14e))),console[_0x24bff4(0x158)](_0x24bff4(0x1b9)+_0x48e151[_0x24bff4(0x131)]),0x0;if(_0x48e151[_0x24bff4(0x15f)]===_0x24bff4(0x135))return console[_0x24bff4(0x158)](a4_0x4bdcf5[_0x24bff4(0x17a)](_0x24bff4(0x13a)+_0x48e151[_0x24bff4(0x135)])),0x1;console[_0x24bff4(0x158)](a4_0x4bdcf5[_0x24bff4(0x148)](_0x24bff4(0x1bd)+_0x48e151['action']+'\x20successfully')),console[_0x24bff4(0x158)](_0x24bff4(0x19a)+_0x48e151['agentName']);if(_0x48e151[_0x24bff4(0x1ba)]&&_0x48e151[_0x24bff4(0x1c8)]){const _0x70b037=getLLMAgentChatUrl(_0x54dcab,_0x48e151[_0x24bff4(0x1c8)],_0x48e151['agentId']);console[_0x24bff4(0x158)](_0x24bff4(0x183)+a4_0x4bdcf5[_0x24bff4(0x16e)](_0x70b037));}return 0x0;}const _0x41b0d5=_0x4d1647['llmProject'],_0x425047=resolveProjectFromContext(_0x12f1dd,_0x41b0d5);if(_0x425047[_0x24bff4(0x117)])_0x12f1dd=_0x425047['projectDir'],_0x425047['source']===_0x24bff4(0x11a)&&console['log'](a4_0x4bdcf5['dim'](_0x24bff4(0x1ca)+_0x12f1dd));else{let _0xec09f1=_0x24bff4(0x18c);_0x425047[_0x24bff4(0x12f)]===_0x24bff4(0x156)&&(_0xec09f1=_0x425047['message']+_0x24bff4(0x15e)+_0x425047[_0x24bff4(0x17d)]+_0x24bff4(0x11e));throw new SDKError(ErrorCode[_0x24bff4(0x18b)],_0x425047[_0x24bff4(0x12f)]===_0x24bff4(0x198)?_0x425047[_0x24bff4(0x1ae)]:'No\x20tdx.json\x20found\x20in\x20'+_0x12f1dd,undefined,{'helpText':_0xec09f1});}const {data:_0x173d27}=await withSpinner(_0x24bff4(0x1ad),()=>_0x5afb9e[_0x24bff4(0x143)]['pushProject'](_0x12f1dd,{'dryRun':!![]})),_0x5f1b2d=_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x165)][_0x24bff4(0x118)]>0x0;if(_0x5f1b2d){console['log'](a4_0x4bdcf5[_0x24bff4(0x17a)]('\x0aErrors\x20found:'));for(const _0x309c77 of _0x173d27['agents']){_0x309c77[_0x24bff4(0x15f)]===_0x24bff4(0x135)&&console[_0x24bff4(0x158)](a4_0x4bdcf5[_0x24bff4(0x17a)](_0x24bff4(0x16b)+_0x309c77[_0x24bff4(0x131)]+'\x22:\x20'+_0x309c77['error']));}return 0x1;}const _0x158a6d=_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x165)]['created']+_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x159)][_0x24bff4(0x1a5)]+_0x173d27['counts'][_0x24bff4(0x13f)]['created']+_0x173d27['counts'][_0x24bff4(0x17c)][_0x24bff4(0x1a5)]+_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x1b7)][_0x24bff4(0x1a5)]+_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x14b)][_0x24bff4(0x1a5)]+_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x130)][_0x24bff4(0x1a5)],_0x336368=_0x173d27['counts'][_0x24bff4(0x165)]['updated']+_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x159)]['updated']+_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x13f)][_0x24bff4(0x155)]+_0x173d27[_0x24bff4(0x13c)]['prompts']['updated']+_0x173d27['counts'][_0x24bff4(0x1b7)][_0x24bff4(0x155)]+_0x173d27[_0x24bff4(0x13c)]['experimentalKnowledgeBases'][_0x24bff4(0x155)]+_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x130)][_0x24bff4(0x155)],_0x77a37c=_0x173d27['counts'][_0x24bff4(0x165)][_0x24bff4(0x16a)]+_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x159)][_0x24bff4(0x16a)]+_0x173d27['counts'][_0x24bff4(0x13f)][_0x24bff4(0x16a)]+_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x17c)]['unchanged']+_0x173d27['counts'][_0x24bff4(0x1b7)][_0x24bff4(0x16a)]+_0x173d27['counts'][_0x24bff4(0x14b)][_0x24bff4(0x16a)]+_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x130)]['unchanged'];console[_0x24bff4(0x158)](_0x24bff4(0x137)+_0x173d27[_0x24bff4(0x1b6)]+'\x27:'),console['log']('\x20\x20'+a4_0x4bdcf5['green']('+\x20'+_0x158a6d+_0x24bff4(0x193))+_0x24bff4(0x19d)+a4_0x4bdcf5[_0x24bff4(0x168)]('~\x20'+_0x336368+_0x24bff4(0x187))+_0x24bff4(0x19d)+a4_0x4bdcf5[_0x24bff4(0x197)]('=\x20'+_0x77a37c+'\x20unchanged')),console[_0x24bff4(0x158)](_0x24bff4(0x14a)+formatCountSummary(_0x173d27['counts'][_0x24bff4(0x165)])),console[_0x24bff4(0x158)]('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x159)])),console[_0x24bff4(0x158)]('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x173d27['counts'][_0x24bff4(0x13f)])),console[_0x24bff4(0x158)](_0x24bff4(0x13d)+formatCountSummary(_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x17c)])),console[_0x24bff4(0x158)](_0x24bff4(0x15a)+formatCountSummary(_0x173d27[_0x24bff4(0x13c)]['integrations']));const _0x152968=_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x14b)][_0x24bff4(0x1a5)]>0x0||_0x173d27['counts'][_0x24bff4(0x14b)][_0x24bff4(0x155)]>0x0||_0x173d27['counts'][_0x24bff4(0x14b)][_0x24bff4(0x16a)]>0x0||_0x173d27[_0x24bff4(0x13c)]['experimentalArtifacts'][_0x24bff4(0x1a5)]>0x0||_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x130)][_0x24bff4(0x155)]>0x0||_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x130)][_0x24bff4(0x16a)]>0x0;_0x152968&&(console[_0x24bff4(0x158)](_0x24bff4(0x124)+formatCountSummary(_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x14b)])),console[_0x24bff4(0x158)]('\x20\x20Experimental\x20Artifacts:\x20'+formatCountSummary(_0x173d27[_0x24bff4(0x13c)][_0x24bff4(0x130)])));console[_0x24bff4(0x158)](_0x24bff4(0x18f)+a4_0x4bdcf5[_0x24bff4(0x16e)](_0x12f1dd)),displayDiffs(_0x173d27[_0x24bff4(0x165)],_0x173d27[_0x24bff4(0x159)],_0x173d27[_0x24bff4(0x13f)],_0x173d27['prompts'],_0x173d27[_0x24bff4(0x1b7)],_0x173d27['experimentalKnowledgeBases'],_0x173d27[_0x24bff4(0x130)]);if(_0x5b2b2a)return console[_0x24bff4(0x158)](a4_0x4bdcf5[_0x24bff4(0x168)](_0x24bff4(0x146))),0x0;if(_0x158a6d===0x0&&_0x336368===0x0){console[_0x24bff4(0x158)](a4_0x4bdcf5[_0x24bff4(0x148)](_0x24bff4(0x174)));const _0x24e7fa=getLLMProjectUrl(_0x54dcab,_0x173d27[_0x24bff4(0x1c8)]);return console['log'](_0x24bff4(0x1c3)+a4_0x4bdcf5['cyan'](_0x24e7fa)),0x0;}if(!_0x245ff8&&!_0x1f5d11){if(!isInteractive())return console[_0x24bff4(0x135)](a4_0x4bdcf5[_0x24bff4(0x17a)](_0x24bff4(0x164)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x24bff4(0x135)](a4_0x4bdcf5['dim'](_0x24bff4(0x199))),0x1;const _0x58af63=await confirmKey(_0x24bff4(0x144)+(_0x158a6d+_0x336368)+'\x20resources?');if(!_0x58af63)return console[_0x24bff4(0x158)](a4_0x4bdcf5[_0x24bff4(0x168)](_0x24bff4(0x116)),_0x24bff4(0x1b5)),0x1;}const {data:_0x5b8f45}=await withSpinner(_0x24bff4(0x12b),()=>_0x5afb9e[_0x24bff4(0x143)][_0x24bff4(0x139)](_0x12f1dd,{'force':_0x1f5d11})),_0x1ac613=_0x5b8f45[_0x24bff4(0x13c)]['agents'][_0x24bff4(0x118)]>0x0||_0x5b8f45['counts'][_0x24bff4(0x159)]['errors']>0x0||_0x5b8f45['counts'][_0x24bff4(0x13f)][_0x24bff4(0x118)]>0x0||_0x5b8f45[_0x24bff4(0x13c)][_0x24bff4(0x17c)][_0x24bff4(0x118)]>0x0;if(_0x1ac613){console[_0x24bff4(0x158)](a4_0x4bdcf5[_0x24bff4(0x168)]('\x0aProject\x20pushed\x20with\x20errors')),console[_0x24bff4(0x158)](),console[_0x24bff4(0x158)](a4_0x4bdcf5[_0x24bff4(0x17a)](_0x24bff4(0x16c)));for(const _0x34bda5 of _0x5b8f45[_0x24bff4(0x165)]){_0x34bda5[_0x24bff4(0x15f)]==='error'&&console['log'](a4_0x4bdcf5[_0x24bff4(0x17a)]('\x20\x20Agent\x20\x22'+_0x34bda5['agentName']+_0x24bff4(0x1bc)+_0x34bda5[_0x24bff4(0x135)]));}for(const _0x472168 of _0x5b8f45[_0x24bff4(0x159)]){_0x472168[_0x24bff4(0x15f)]===_0x24bff4(0x135)&&console['log'](a4_0x4bdcf5[_0x24bff4(0x17a)](_0x24bff4(0x147)+_0x472168[_0x24bff4(0x1c1)]+'\x22:\x20'+_0x472168['error']));}for(const _0x485543 of _0x5b8f45[_0x24bff4(0x13f)]){_0x485543['action']===_0x24bff4(0x135)&&console[_0x24bff4(0x158)](a4_0x4bdcf5['red'](_0x24bff4(0x136)+_0x485543['name']+'\x22:\x20'+_0x485543['error']));}for(const _0x33984e of _0x5b8f45['prompts']){_0x33984e['action']===_0x24bff4(0x135)&&console['log'](a4_0x4bdcf5[_0x24bff4(0x17a)](_0x24bff4(0x192)+_0x33984e[_0x24bff4(0x1c1)]+_0x24bff4(0x1bc)+_0x33984e[_0x24bff4(0x135)]));}for(const _0x89243f of _0x5b8f45['integrations']){_0x89243f['action']==='error'&&console[_0x24bff4(0x158)](a4_0x4bdcf5[_0x24bff4(0x17a)](_0x24bff4(0x1ac)+_0x89243f[_0x24bff4(0x1c1)]+'\x22:\x20'+_0x89243f[_0x24bff4(0x135)]));}return 0x1;}console[_0x24bff4(0x158)](a4_0x4bdcf5[_0x24bff4(0x148)]('\x0a✔\x20Pushed\x20'+(_0x158a6d+_0x336368)+'\x20resources\x20to\x20\x27'+_0x5b8f45[_0x24bff4(0x1b6)]+'\x27'));const _0x5a8a2a=getLLMProjectUrl(_0x54dcab,_0x5b8f45[_0x24bff4(0x1c8)]);return console[_0x24bff4(0x158)](_0x24bff4(0x1c3)+a4_0x4bdcf5[_0x24bff4(0x16e)](_0x5a8a2a)),0x0;}}
|
|
1
|
+
const a4_0x4c6313=a4_0x3fa1;(function(_0x38faf0,_0x2786f4){const _0x36f61a=a4_0x3fa1,_0x19eb22=_0x38faf0();while(!![]){try{const _0x415ce9=-parseInt(_0x36f61a(0x14d))/0x1+-parseInt(_0x36f61a(0x197))/0x2+parseInt(_0x36f61a(0x1a5))/0x3+-parseInt(_0x36f61a(0x17b))/0x4+-parseInt(_0x36f61a(0x161))/0x5+parseInt(_0x36f61a(0x14b))/0x6+parseInt(_0x36f61a(0x151))/0x7*(parseInt(_0x36f61a(0x134))/0x8);if(_0x415ce9===_0x2786f4)break;else _0x19eb22['push'](_0x19eb22['shift']());}catch(_0x4f8bc1){_0x19eb22['push'](_0x19eb22['shift']());}}}(a4_0x65f0,0xe4782));import a4_0x24f95e from'chalk';import a4_0x11987e from'path';import{existsSync,readFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{withSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{findAgentConfigPath,resolveProjectFromContext,resolveAgentPullArgs}from'../sdk/agent/agent-config.js';import{saveSessionContext}from'../core/session.js';import{sanitizeForFilesystem,normalizeName}from'../sdk/agent/agent-yaml.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';function formatCountSummary(_0x4cfa15){const _0x5123f6=a4_0x3fa1,_0x3a2fdb=[];if(_0x4cfa15[_0x5123f6(0x13b)]!==undefined)_0x3a2fdb[_0x5123f6(0x100)](_0x4cfa15[_0x5123f6(0x13b)]+_0x5123f6(0x10a));if(_0x4cfa15['new']!==undefined&&_0x4cfa15[_0x5123f6(0x15c)]>0x0)_0x3a2fdb[_0x5123f6(0x100)](a4_0x24f95e[_0x5123f6(0x199)](_0x4cfa15[_0x5123f6(0x15c)]+'\x20new'));if(_0x4cfa15['created']!==undefined&&_0x4cfa15['created']>0x0)_0x3a2fdb[_0x5123f6(0x100)](a4_0x24f95e[_0x5123f6(0x199)](_0x4cfa15[_0x5123f6(0x124)]+_0x5123f6(0x10b)));if(_0x4cfa15['updated']!==undefined&&_0x4cfa15['updated']>0x0)_0x3a2fdb[_0x5123f6(0x100)](a4_0x24f95e[_0x5123f6(0x143)](_0x4cfa15[_0x5123f6(0x179)]+'\x20updated'));if(_0x4cfa15['unchanged']!==undefined&&_0x4cfa15['unchanged']>0x0)_0x3a2fdb[_0x5123f6(0x100)](a4_0x24f95e[_0x5123f6(0x101)](_0x4cfa15[_0x5123f6(0x154)]+'\x20unchanged'));if(_0x4cfa15[_0x5123f6(0xfe)]!==undefined&&_0x4cfa15[_0x5123f6(0xfe)]>0x0)_0x3a2fdb[_0x5123f6(0x100)](a4_0x24f95e[_0x5123f6(0x186)](_0x4cfa15[_0x5123f6(0xfe)]+_0x5123f6(0x105)));return _0x3a2fdb['join'](',\x20');}function displayDiffs(_0x43e494,_0x1c0073,_0x1c902d,_0x27c63d,_0x1ac871,_0x44bff9,_0x309244){const _0x309efa=a4_0x3fa1;for(const _0x3ad4f6 of _0x43e494){if(_0x3ad4f6[_0x309efa(0x195)]){const _0x6eee96=_0x3ad4f6[_0x309efa(0x168)]||_0x3ad4f6[_0x309efa(0x104)];console[_0x309efa(0x17e)](_0x309efa(0x138)+_0x6eee96+'\x27:'),console[_0x309efa(0x17e)]('─'['repeat'](0x3c)),console[_0x309efa(0x17e)](_0x3ad4f6['diff']),console[_0x309efa(0x17e)]('─'['repeat'](0x3c));}}for(const _0xae3470 of _0x1c0073){_0xae3470['diff']&&(console[_0x309efa(0x17e)](_0x309efa(0x106)+_0xae3470[_0x309efa(0x104)]+'\x27:'),console[_0x309efa(0x17e)]('─'[_0x309efa(0x131)](0x3c)),console[_0x309efa(0x17e)](_0xae3470[_0x309efa(0x195)]),console[_0x309efa(0x17e)]('─'['repeat'](0x3c)));}for(const _0x278be9 of _0x1c902d){_0x278be9[_0x309efa(0x195)]&&(console['log'](_0x309efa(0x1a0)+_0x278be9['name']+'\x27:'),console['log']('─'['repeat'](0x3c)),console[_0x309efa(0x17e)](_0x278be9[_0x309efa(0x195)]),console['log']('─'[_0x309efa(0x131)](0x3c)));}for(const _0x55f037 of _0x27c63d){_0x55f037[_0x309efa(0x195)]&&(console['log'](_0x309efa(0x112)+_0x55f037[_0x309efa(0x104)]+'\x27:'),console[_0x309efa(0x17e)]('─'[_0x309efa(0x131)](0x3c)),console[_0x309efa(0x17e)](_0x55f037[_0x309efa(0x195)]),console[_0x309efa(0x17e)]('─'[_0x309efa(0x131)](0x3c)));}for(const _0x4372df of _0x1ac871){_0x4372df[_0x309efa(0x195)]&&(console[_0x309efa(0x17e)](_0x309efa(0x15b)+_0x4372df[_0x309efa(0x104)]+'\x27:'),console[_0x309efa(0x17e)]('─'[_0x309efa(0x131)](0x3c)),console['log'](_0x4372df['diff']),console['log']('─'[_0x309efa(0x131)](0x3c)));}for(const _0x36620c of _0x44bff9){_0x36620c[_0x309efa(0x195)]&&(console['log'](_0x309efa(0x137)+_0x36620c[_0x309efa(0x104)]+'\x27:'),console[_0x309efa(0x17e)]('─'[_0x309efa(0x131)](0x3c)),console[_0x309efa(0x17e)](_0x36620c['diff']),console['log']('─'[_0x309efa(0x131)](0x3c)));}for(const _0x198013 of _0x309244){_0x198013['diff']&&(console[_0x309efa(0x17e)]('\x0aChanges\x20to\x20experimental\x20artifact\x20\x27'+_0x198013['name']+'\x27:'),console[_0x309efa(0x17e)]('─'[_0x309efa(0x131)](0x3c)),console[_0x309efa(0x17e)](_0x198013['diff']),console[_0x309efa(0x17e)]('─'[_0x309efa(0x131)](0x3c)));}}function a4_0x65f0(){const _0x297ec5=['integrations','7EEzVfV','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Clone\x20\x22','unchanged','\x20\x20Text\x20Knowledge\x20Bases:\x20','utf-8','Agent\x20','experimentalArtifacts','\x20\x20Experimental\x20Artifacts:\x20','\x20files\x20to\x20','\x0aChanges\x20to\x20integration\x20\x27','new','\x20\x20Integrations:\x20','force','\x20--profile\x20','Or\x20specify:\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20--agent\x20<name>','3783060eOAHcF','-\x20no\x20files\x20written','dryRun','\x0a✔\x20Pushed\x20','Writing\x20files...','projectName','\x20changed','agentName','Agent:\x20','\x20resources\x20to\x20\x27','\x20\x20Agent\x20\x22','Pushing\x20agent\x20from\x20\x22','Dry\x20run\x20-\x20no\x20files\x20written','join','Using\x20current\x20project:\x20','llm_project','agent:push','Project\x20cloned\x20successfully','execute','Status:\x20','✔\x20Context\x20set:\x20','\x0aWrite\x20','\x22\x20to\x20a\x20different\x20profile','\x20\x20Knowledge\x20Base\x20\x22','updated','source','2260884OkKhkn','experimentalKnowledgeBases','New\x20project:\x20','log','First\x20pull\x20the\x20project\x20locally,\x20then\x20clone\x20from\x20the\x20local\x20files:\x0a','\x22\x20to\x20\x22','pushAgent','\x20\x20tdx\x20agent\x20clone\x20agents/','\x20|\x20','\x0aProject\x20pushed\x20with\x20errors','\x20\x20Prompt\x20\x22','red','agentId','no_context','parse','agents','Project\x20cloned\x20with\x20errors','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20agents\x20from\x20project','\x0a✔\x20All\x20resources\x20are\x20up\x20to\x20date','MISSING_ARGUMENT','\x20new','counts','newProjectId','projectId','New\x20project\x20name\x20is\x20required','\x20\x20tdx\x20agent\x20clone\x20<local-dir>\x20--name\x20<new-name>\x20\x20#\x20Clone\x20from\x20local\x20directory','diff','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20--agent\x20<name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20agent\x20from\x20context\x20project','631674aTDKwB','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20pushed','green','cloneProject','\x22\x20to\x20new\x20project\x20\x22','dirname','Output:\x20','Analyzing\x20changes\x20to\x20push...','\x0aError:','\x0aChanges\x20to\x20text\x20knowledge\x20base\x20\x27','outputPath','outputDir','\x0aSet\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','Chat:\x20','1024734zWrfaI','llmProject','\x20=\x20','sourceProjectName','dim','newProjectName','\x20\x20Text\x20Knowledge\x20Base\x20\x22','Dry\x20run\x20-\x20no\x20changes\x20made','found','textKnowledgeBases','\x0aChanges:','profile','errors','\x0aPush\x20','push','gray','pullProject','agent','name','\x20errors','\x0aChanges\x20to\x20knowledge\x20base\x20\x27','prompts','\x0aErrors\x20found:','llm','\x20total','\x20created','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure,\x20or\x20specify\x20an\x20agent\x20directory\x20with\x20agent.yml.','tdx.json','When\x20using\x20--profile,\x20you\x20must\x20specify\x20a\x20local\x20directory\x20as\x20source.\x0a','description','Usage:\x20tdx\x20agent\x20clone\x20[source]\x20--name\x20<new-name>','\x20\x20Knowledge\x20Bases:\x20','\x0aChanges\x20to\x20prompt\x20\x27','reason','\x20--name\x20','yes','\x20\x20Target:\x20','\x22...','\x20\x20Agents:\x20','No\x20source\x20project\x20specified.\x20Use\x20one\x20of:\x0a','Cannot\x20clone\x20from\x20context\x20project\x20\x22','cwd','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','pullAgent','agent:clone','\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<local-dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20to\x20existing\x20local\x20directory','\x20resources?','INVALID_ARGUMENT','Pushing\x20to\x20project...','cyan','created','New\x20project\x20ID:\x20','Usage:\x20tdx\x20agent\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20project\x20(requires\x20context\x20or\x20tdx.json)','error','arg-dir','action','Failed\x20to\x20push\x20agent:\x20','Summary:','\x20\x20Experimental\x20Knowledge\x20Bases:\x20','session','Using\x20local\x20project:\x20','\x20files?','Cancelled','repeat','\x0aPull\x20summary\x20for\x20\x27','Set\x20context:\x20\x20tdx\x20use\x20llm_project\x20<name>','11299048fersWU','context','cwd-config','\x0aChanges\x20to\x20experimental\x20knowledge\x20base\x20\x27','\x0aChanges\x20to\x20agent\x20\x27','Would\x20push\x20agent:\x20','hasChanges','total','\x20\x20Integration\x20\x22','Source:\x20','Pulling\x20agent\x20\x22','knowledgeBases','\x22:\x20','\x0a✔\x20Pulled\x20','\x22\x20from\x20project\x20\x22','yellow','llm_project\x20is\x20not\x20set.\x20Use\x20`tdx\x20use\x20llm_project\x20<name>`\x20to\x20set\x20it.\x0a','\x0aPush\x20summary\x20for\x20\x27','agent:pull','Output\x20path:\x20','projectDir','Project:\x20','pushProject','5709336umXezB','\x20unchanged','132035GLSsOd','No\x20tdx.json\x20found\x20in\x20','Errors:'];a4_0x65f0=function(){return _0x297ec5;};return a4_0x65f0();}function a4_0x3fa1(_0x72cc34,_0x466428){_0x72cc34=_0x72cc34-0xf9;const _0x65f0e1=a4_0x65f0();let _0x3fa116=_0x65f0e1[_0x72cc34];return _0x3fa116;}export class AgentPullCommand extends BaseCommand{[a4_0x4c6313(0x104)]=a4_0x4c6313(0x146);[a4_0x4c6313(0x10f)]='Pull\x20agents\x20from\x20LLM\x20project\x20to\x20local\x20files';async[a4_0x4c6313(0x173)](_0x515cb2){const _0xc829ce=a4_0x4c6313,{options:_0x3c7d06,args:_0x2b0882,tdx:_0x4301ea}=_0x515cb2,_0x2996e2=_0x2b0882[0x0],_0x9ef9ef=_0x2b0882[0x1],_0x54492a=_0x3c7d06['output'],_0x5e63bd=_0x3c7d06[_0xc829ce(0x163)],_0x53f331=_0x3c7d06[_0xc829ce(0x15e)],_0x54258d=_0x3c7d06['yes'],_0x34e892=_0x3c7d06[_0xc829ce(0x1a6)],_0x481ca2=_0x3c7d06[_0xc829ce(0x103)];let _0x5c9826;if(_0x2996e2){const _0x2c8c0e=a4_0x11987e[_0xc829ce(0x16e)](_0x2996e2,_0xc829ce(0x10d));if(existsSync(_0x2c8c0e))try{const _0x2adc6d=JSON['parse'](readFileSync(_0x2c8c0e,_0xc829ce(0x156)));_0x2adc6d[_0xc829ce(0x170)]&&(_0x5c9826={'llm_project':_0x2adc6d[_0xc829ce(0x170)]});}catch{}}const _0x3bc787=findAgentConfigPath(process[_0xc829ce(0x11b)]());let _0x3c5849;if(_0x3bc787)try{const _0x33a276=JSON[_0xc829ce(0x189)](readFileSync(_0x3bc787,_0xc829ce(0x156)));_0x33a276[_0xc829ce(0x170)]&&(_0x3c5849={'llm_project':_0x33a276[_0xc829ce(0x170)]});}catch{}const _0x5bec4a=resolveAgentPullArgs({'arg':_0x2996e2,'agentNameArg':_0x9ef9ef,'agentFlag':_0x481ca2,'contextProject':_0x34e892,'argDirConfig':_0x5c9826,'cwdConfigPath':_0x3bc787||undefined,'cwdConfig':_0x3c5849}),{projectNameOrId:_0x486258,targetAgentName:_0x481349,existingOutputDir:_0x5718b3,source:_0x20ef31}=_0x5bec4a;if(_0x20ef31===_0xc829ce(0x128))console[_0xc829ce(0x17e)](a4_0x24f95e[_0xc829ce(0x1a9)]('Using\x20project\x20from\x20'+a4_0x11987e[_0xc829ce(0x16e)](_0x2996e2,_0xc829ce(0x10d))+':\x20'+_0x486258));else{if(_0x20ef31===_0xc829ce(0x136))console[_0xc829ce(0x17e)](a4_0x24f95e['dim']('Using\x20project:\x20'+_0x486258));else _0x20ef31===_0xc829ce(0x135)&&console['log'](a4_0x24f95e[_0xc829ce(0x1a9)]('Using\x20project\x20from\x20context:\x20'+_0x486258));}if(!_0x486258)return _0x481ca2?(console[_0xc829ce(0x17e)](a4_0x24f95e['yellow']('The\x20--agent\x20flag\x20requires\x20llm_project\x20context\x20or\x20a\x20project\x20argument.\x0a')),console[_0xc829ce(0x17e)](_0xc829ce(0x133)),console[_0xc829ce(0x17e)](_0xc829ce(0x160))):(console[_0xc829ce(0x17e)](a4_0x24f95e['yellow'](_0xc829ce(0x144))),console[_0xc829ce(0x17e)](_0xc829ce(0x126)),console[_0xc829ce(0x17e)](_0xc829ce(0x18c)),console[_0xc829ce(0x17e)](_0xc829ce(0x11f)),console['log'](_0xc829ce(0x196)),console[_0xc829ce(0x17e)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20agent\x20pull\x20<project>\x20<agent>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20agent\x20from\x20project')),0x1;if(_0x481349){const {data:_0x173fd3}=await withSpinner(_0xc829ce(0x13e)+_0x481349+_0xc829ce(0x142)+_0x486258+'\x22...',()=>_0x4301ea['llm'][_0xc829ce(0x11d)](_0x486258,_0x481349,_0x54492a,{'dryRun':_0x5e63bd,'force':_0x53f331}));if(_0x5e63bd)return console['log'](a4_0x24f95e[_0xc829ce(0x143)](_0xc829ce(0x16d))),console['log']('Would\x20pull\x20agent:\x20'+_0x173fd3[_0xc829ce(0x168)]),console[_0xc829ce(0x17e)](_0xc829ce(0x147)+_0x173fd3[_0xc829ce(0x1a1)]),_0x173fd3[_0xc829ce(0x195)]&&(console[_0xc829ce(0x17e)](_0xc829ce(0xfc)),console[_0xc829ce(0x17e)]('─'[_0xc829ce(0x131)](0x3c)),console[_0xc829ce(0x17e)](_0x173fd3[_0xc829ce(0x195)]),console[_0xc829ce(0x17e)]('─'[_0xc829ce(0x131)](0x3c))),0x0;return console['log'](a4_0x24f95e[_0xc829ce(0x199)]('Agent\x20pulled\x20successfully')),console[_0xc829ce(0x17e)](_0xc829ce(0x169)+_0x173fd3[_0xc829ce(0x168)]),console[_0xc829ce(0x17e)](_0xc829ce(0x19d)+_0x173fd3[_0xc829ce(0x1a1)]),console[_0xc829ce(0x17e)](_0xc829ce(0x174)+(_0x173fd3['isNew']?a4_0x24f95e['green'](_0xc829ce(0x15c)):_0x173fd3[_0xc829ce(0x13a)]?a4_0x24f95e['yellow']('updated'):a4_0x24f95e['gray']('unchanged'))),0x0;}const _0x53919c=_0x5718b3||_0x54492a,{data:_0x19de28}=await withSpinner('Analyzing\x20project\x20\x22'+_0x486258+_0xc829ce(0x117),()=>_0x4301ea[_0xc829ce(0x109)][_0xc829ce(0x102)](_0x486258,_0x53919c,{'dryRun':!![]})),_0x9f59b1=_0x19de28['counts'][_0xc829ce(0x18a)][_0xc829ce(0x15c)]+_0x19de28[_0xc829ce(0x190)][_0xc829ce(0x13f)][_0xc829ce(0x15c)]+_0x19de28[_0xc829ce(0x190)]['textKnowledgeBases'][_0xc829ce(0x15c)]+_0x19de28['counts'][_0xc829ce(0x107)][_0xc829ce(0x15c)]+_0x19de28[_0xc829ce(0x190)][_0xc829ce(0x150)][_0xc829ce(0x15c)]+_0x19de28['counts'][_0xc829ce(0x17c)]['new']+_0x19de28['counts'][_0xc829ce(0x158)]['new'],_0x132218=_0x19de28[_0xc829ce(0x190)]['agents'][_0xc829ce(0x179)]+_0x19de28[_0xc829ce(0x190)][_0xc829ce(0x13f)]['updated']+_0x19de28['counts'][_0xc829ce(0xfb)][_0xc829ce(0x179)]+_0x19de28[_0xc829ce(0x190)][_0xc829ce(0x107)][_0xc829ce(0x179)]+_0x19de28[_0xc829ce(0x190)]['integrations'][_0xc829ce(0x179)]+_0x19de28[_0xc829ce(0x190)][_0xc829ce(0x17c)][_0xc829ce(0x179)]+_0x19de28[_0xc829ce(0x190)][_0xc829ce(0x158)][_0xc829ce(0x179)],_0x2be1ba=_0x19de28[_0xc829ce(0x190)]['agents'][_0xc829ce(0x154)]+_0x19de28['counts']['knowledgeBases'][_0xc829ce(0x154)]+_0x19de28['counts'][_0xc829ce(0xfb)][_0xc829ce(0x154)]+_0x19de28[_0xc829ce(0x190)]['prompts'][_0xc829ce(0x154)]+_0x19de28[_0xc829ce(0x190)]['integrations'][_0xc829ce(0x154)]+_0x19de28[_0xc829ce(0x190)][_0xc829ce(0x17c)][_0xc829ce(0x154)]+_0x19de28['counts']['experimentalArtifacts']['unchanged'];console[_0xc829ce(0x17e)](_0xc829ce(0x132)+_0x19de28[_0xc829ce(0x166)]+'\x27:'),console[_0xc829ce(0x17e)]('\x20\x20'+a4_0x24f95e[_0xc829ce(0x199)]('+\x20'+_0x9f59b1+_0xc829ce(0x18f))+_0xc829ce(0x183)+a4_0x24f95e[_0xc829ce(0x143)]('~\x20'+_0x132218+'\x20changed')+_0xc829ce(0x183)+a4_0x24f95e[_0xc829ce(0x1a9)]('=\x20'+_0x2be1ba+_0xc829ce(0x14c))),console[_0xc829ce(0x17e)](_0xc829ce(0x118)+formatCountSummary(_0x19de28[_0xc829ce(0x190)][_0xc829ce(0x18a)])),console['log']('\x20\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x19de28[_0xc829ce(0x190)]['knowledgeBases'])),console[_0xc829ce(0x17e)](_0xc829ce(0x155)+formatCountSummary(_0x19de28['counts']['textKnowledgeBases'])),console[_0xc829ce(0x17e)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x19de28['counts']['prompts'])),console[_0xc829ce(0x17e)](_0xc829ce(0x15d)+formatCountSummary(_0x19de28[_0xc829ce(0x190)]['integrations']));const _0x3728a0=_0x19de28[_0xc829ce(0x190)]['experimentalKnowledgeBases']['total']>0x0||_0x19de28[_0xc829ce(0x190)][_0xc829ce(0x158)][_0xc829ce(0x13b)]>0x0;_0x3728a0&&(console[_0xc829ce(0x17e)](_0xc829ce(0x12c)+formatCountSummary(_0x19de28[_0xc829ce(0x190)][_0xc829ce(0x17c)])),console[_0xc829ce(0x17e)](_0xc829ce(0x159)+formatCountSummary(_0x19de28[_0xc829ce(0x190)][_0xc829ce(0x158)])));console[_0xc829ce(0x17e)](_0xc829ce(0x116)+a4_0x24f95e[_0xc829ce(0x123)](_0x19de28[_0xc829ce(0x1a2)])),displayDiffs(_0x19de28[_0xc829ce(0x18a)],_0x19de28[_0xc829ce(0x13f)],_0x19de28[_0xc829ce(0xfb)],_0x19de28['prompts'],_0x19de28[_0xc829ce(0x150)],_0x19de28['experimentalKnowledgeBases'],_0x19de28['experimentalArtifacts']);if(_0x5e63bd)return console[_0xc829ce(0x17e)](a4_0x24f95e['yellow'](_0xc829ce(0x11c))),0x0;if(_0x9f59b1===0x0&&_0x132218===0x0)return console['log'](a4_0x24f95e[_0xc829ce(0x199)]('\x0a✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'llm_project':_0x19de28[_0xc829ce(0x166)]},_0x3c7d06[_0xc829ce(0x12d)]),console[_0xc829ce(0x17e)](a4_0x24f95e[_0xc829ce(0x199)](_0xc829ce(0x175)+a4_0x24f95e[_0xc829ce(0x1a9)](_0xc829ce(0x170))+_0xc829ce(0x1a7)+a4_0x24f95e[_0xc829ce(0x123)](_0x19de28['projectName']))),0x0;if(!_0x54258d&&!_0x53f331){if(!isInteractive())return console[_0xc829ce(0x127)](a4_0x24f95e['red']('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0xc829ce(0x127)](a4_0x24f95e[_0xc829ce(0x1a9)](_0xc829ce(0x152))),0x1;const _0x290359=await confirmKey(_0xc829ce(0x176)+(_0x9f59b1+_0x132218)+_0xc829ce(0x12f));if(!_0x290359)return console[_0xc829ce(0x17e)](a4_0x24f95e['yellow'](_0xc829ce(0x130)),_0xc829ce(0x162)),0x1;}const {data:_0x2764af}=await withSpinner(_0xc829ce(0x165),()=>_0x4301ea[_0xc829ce(0x109)]['pullProject'](_0x486258,_0x53919c,{'force':_0x53f331}));return console[_0xc829ce(0x17e)](a4_0x24f95e[_0xc829ce(0x199)](_0xc829ce(0x141)+(_0x9f59b1+_0x132218)+_0xc829ce(0x15a)+_0x2764af[_0xc829ce(0x1a2)])),saveSessionContext({'llm_project':_0x2764af['projectName']},_0x3c7d06['session']),console[_0xc829ce(0x17e)](a4_0x24f95e[_0xc829ce(0x199)](_0xc829ce(0x175)+a4_0x24f95e[_0xc829ce(0x1a9)](_0xc829ce(0x170))+'\x20=\x20'+a4_0x24f95e[_0xc829ce(0x123)](_0x2764af[_0xc829ce(0x166)]))),0x0;}}export class AgentCloneCommand extends BaseCommand{[a4_0x4c6313(0x104)]=a4_0x4c6313(0x11e);[a4_0x4c6313(0x10f)]='Clone\x20an\x20LLM\x20project\x20to\x20a\x20new\x20project';async[a4_0x4c6313(0x173)](_0x499614){const _0x17b47a=a4_0x4c6313,{options:_0x30e53d,args:_0x21649f,tdx:_0x36845f}=_0x499614,_0x7bf6ba=_0x21649f[0x0],_0x1d8f47=_0x30e53d[_0x17b47a(0x104)],_0x52c3c9=_0x30e53d[_0x17b47a(0x163)],_0xb7418e=_0x30e53d['yes'],_0x2f7e96=_0x30e53d['site'],_0x32187a=_0x30e53d['llmProject'];let _0x345517;const _0x1a4363=findAgentConfigPath(process[_0x17b47a(0x11b)]());if(_0x7bf6ba){const _0x4d836b=a4_0x11987e[_0x17b47a(0x16e)](_0x7bf6ba,_0x17b47a(0x10d));existsSync(_0x4d836b)?(_0x345517=_0x7bf6ba,console[_0x17b47a(0x17e)](a4_0x24f95e['dim'](_0x17b47a(0x12e)+_0x7bf6ba))):_0x345517=_0x7bf6ba;}else{if(_0x1a4363)_0x345517=a4_0x11987e[_0x17b47a(0x19c)](_0x1a4363),console['log'](a4_0x24f95e[_0x17b47a(0x1a9)](_0x17b47a(0x16f)+_0x345517));else{if(_0x32187a){const _0x3ede4a=sanitizeForFilesystem(_0x32187a);let _0x33ffac=_0x3ede4a,_0x5240fe=a4_0x11987e[_0x17b47a(0x16e)](process[_0x17b47a(0x11b)](),_0x17b47a(0x18a),_0x3ede4a,_0x17b47a(0x10d));if(!existsSync(_0x5240fe)){const _0x2ce657=normalizeName(_0x32187a),_0x427ac6=a4_0x11987e[_0x17b47a(0x16e)](process[_0x17b47a(0x11b)](),'agents',_0x2ce657,'tdx.json');existsSync(_0x427ac6)&&(_0x33ffac=_0x2ce657,_0x5240fe=_0x427ac6);}if(existsSync(_0x5240fe))_0x345517=a4_0x11987e[_0x17b47a(0x19c)](_0x5240fe),console[_0x17b47a(0x17e)](a4_0x24f95e[_0x17b47a(0x1a9)](_0x17b47a(0x12e)+_0x345517));else{const _0x142a69=_0x30e53d[_0x17b47a(0xfd)];if(_0x142a69)throw new SDKError(ErrorCode[_0x17b47a(0x121)],_0x17b47a(0x11a)+_0x32187a+_0x17b47a(0x177),undefined,{'helpText':_0x17b47a(0x10e)+_0x17b47a(0x17f)+('\x20\x20tdx\x20agent\x20pull\x20'+_0x32187a+'\x0a')+(_0x17b47a(0x182)+_0x33ffac+_0x17b47a(0x114)+(_0x1d8f47||'<new-name>')+_0x17b47a(0x15f)+_0x142a69)});_0x345517=_0x32187a,console[_0x17b47a(0x17e)](a4_0x24f95e['dim']('Using\x20context\x20project:\x20'+_0x32187a));}}}}if(!_0x345517)return console[_0x17b47a(0x17e)](a4_0x24f95e[_0x17b47a(0x143)](_0x17b47a(0x119))),console[_0x17b47a(0x17e)]('\x20\x20tdx\x20agent\x20clone\x20<project>\x20--name\x20<new-name>\x20\x20\x20\x20#\x20Clone\x20from\x20remote\x20project'),console[_0x17b47a(0x17e)](_0x17b47a(0x194)),console[_0x17b47a(0x17e)]('\x20\x20tdx\x20agent\x20clone\x20--name\x20<new-name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clone\x20from\x20context\x20(llm_project)'),console['log'](_0x17b47a(0x1a3)),0x1;if(!_0x1d8f47)throw new SDKError(ErrorCode[_0x17b47a(0x18e)],_0x17b47a(0x193),undefined,{'helpText':_0x17b47a(0x110)});if(!_0xb7418e&&!_0x52c3c9){if(!isInteractive())return console[_0x17b47a(0x127)](a4_0x24f95e['red'](_0x17b47a(0x19f)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a4_0x24f95e['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x372024=await confirmKey(_0x17b47a(0x153)+_0x345517+_0x17b47a(0x19b)+_0x1d8f47+'\x22?');if(!_0x372024)return console[_0x17b47a(0x17e)](a4_0x24f95e[_0x17b47a(0x143)]('Cancelled')),0x1;}const {data:_0x2cd52b}=await withSpinner('Cloning\x20\x22'+_0x345517+_0x17b47a(0x180)+_0x1d8f47+_0x17b47a(0x117),()=>_0x36845f['llm'][_0x17b47a(0x19a)](_0x345517,_0x1d8f47,{'dryRun':_0x52c3c9}));if(_0x52c3c9){console[_0x17b47a(0x17e)](a4_0x24f95e[_0x17b47a(0x143)](_0x17b47a(0xf9))),console[_0x17b47a(0x17e)](_0x17b47a(0x13d)+_0x2cd52b[_0x17b47a(0x1a8)]),console[_0x17b47a(0x17e)](_0x17b47a(0x17d)+_0x1d8f47),console[_0x17b47a(0x17e)]('Would\x20clone:'),console[_0x17b47a(0x17e)]('\x20\x20Agents:\x20'+_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x18a)]['created']),console[_0x17b47a(0x17e)](_0x17b47a(0x111)+_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x13f)][_0x17b47a(0x124)]),console['log']('\x20\x20Prompts:\x20'+_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x107)][_0x17b47a(0x124)]);const _0x48e93d=_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x17c)][_0x17b47a(0x124)]>0x0||_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x158)]['created']>0x0;return _0x48e93d&&(console['log'](_0x17b47a(0x12c)+_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x17c)]['created']),console[_0x17b47a(0x17e)](_0x17b47a(0x159)+_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x158)][_0x17b47a(0x124)])),0x0;}const _0x54f386=_0x2cd52b['counts'][_0x17b47a(0x18a)][_0x17b47a(0xfe)]>0x0||_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x13f)][_0x17b47a(0xfe)]>0x0||_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x107)][_0x17b47a(0xfe)]>0x0||_0x2cd52b['counts'][_0x17b47a(0x17c)][_0x17b47a(0xfe)]>0x0||_0x2cd52b[_0x17b47a(0x190)]['experimentalArtifacts'][_0x17b47a(0xfe)]>0x0;_0x54f386?console['log'](a4_0x24f95e['yellow'](_0x17b47a(0x18b))):console['log'](a4_0x24f95e[_0x17b47a(0x199)](_0x17b47a(0x172)));console[_0x17b47a(0x17e)](_0x17b47a(0x13d)+_0x2cd52b[_0x17b47a(0x1a8)]),console['log'](_0x17b47a(0x17d)+_0x2cd52b[_0x17b47a(0x1aa)]),console[_0x17b47a(0x17e)](_0x17b47a(0x125)+_0x2cd52b[_0x17b47a(0x191)]),console[_0x17b47a(0x17e)](),console['log'](_0x17b47a(0x12b)),console['log'](_0x17b47a(0x118)+formatCountSummary(_0x2cd52b[_0x17b47a(0x190)]['agents'])),console[_0x17b47a(0x17e)](_0x17b47a(0x111)+formatCountSummary(_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x13f)])),console[_0x17b47a(0x17e)]('\x20\x20Prompts:\x20'+formatCountSummary(_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x107)])),console['log']('\x20\x20Integrations:\x20'+formatCountSummary(_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x150)]));const _0x449829=_0x2cd52b[_0x17b47a(0x190)]['experimentalKnowledgeBases'][_0x17b47a(0x124)]>0x0||_0x2cd52b['counts'][_0x17b47a(0x17c)][_0x17b47a(0x179)]>0x0||_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x17c)]['unchanged']>0x0||_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x158)][_0x17b47a(0x124)]>0x0||_0x2cd52b[_0x17b47a(0x190)]['experimentalArtifacts'][_0x17b47a(0x179)]>0x0||_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x158)][_0x17b47a(0x154)]>0x0;_0x449829&&(console[_0x17b47a(0x17e)]('\x20\x20Experimental\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x2cd52b[_0x17b47a(0x190)]['experimentalKnowledgeBases'])),console[_0x17b47a(0x17e)](_0x17b47a(0x159)+formatCountSummary(_0x2cd52b[_0x17b47a(0x190)][_0x17b47a(0x158)])));if(_0x54f386){console['log'](),console[_0x17b47a(0x17e)](a4_0x24f95e[_0x17b47a(0x186)](_0x17b47a(0x14f)));for(const _0x2e2184 of _0x2cd52b['agents']){_0x2e2184[_0x17b47a(0x129)]===_0x17b47a(0x127)&&console[_0x17b47a(0x17e)](a4_0x24f95e['red']('\x20\x20Agent\x20\x22'+_0x2e2184[_0x17b47a(0x168)]+_0x17b47a(0x140)+_0x2e2184[_0x17b47a(0x127)]));}for(const _0x142fc8 of _0x2cd52b[_0x17b47a(0x13f)]){_0x142fc8[_0x17b47a(0x129)]===_0x17b47a(0x127)&&console[_0x17b47a(0x17e)](a4_0x24f95e[_0x17b47a(0x186)](_0x17b47a(0x178)+_0x142fc8[_0x17b47a(0x104)]+_0x17b47a(0x140)+_0x142fc8['error']));}for(const _0x2cdfc1 of _0x2cd52b[_0x17b47a(0x107)]){_0x2cdfc1['action']===_0x17b47a(0x127)&&console[_0x17b47a(0x17e)](a4_0x24f95e[_0x17b47a(0x186)](_0x17b47a(0x185)+_0x2cdfc1[_0x17b47a(0x104)]+_0x17b47a(0x140)+_0x2cdfc1[_0x17b47a(0x127)]));}for(const _0x590441 of _0x2cd52b[_0x17b47a(0x150)]){_0x590441[_0x17b47a(0x129)]===_0x17b47a(0x127)&&console['log'](a4_0x24f95e['red'](_0x17b47a(0x13c)+_0x590441['name']+'\x22:\x20'+_0x590441[_0x17b47a(0x127)]));}for(const _0xa7c8b9 of _0x2cd52b['experimentalKnowledgeBases']){_0xa7c8b9['action']==='error'&&console[_0x17b47a(0x17e)](a4_0x24f95e[_0x17b47a(0x186)]('\x20\x20Experimental\x20Knowledge\x20Base\x20\x22'+_0xa7c8b9[_0x17b47a(0x104)]+_0x17b47a(0x140)+_0xa7c8b9[_0x17b47a(0x127)]));}for(const _0x108ad4 of _0x2cd52b[_0x17b47a(0x158)]){_0x108ad4[_0x17b47a(0x129)]===_0x17b47a(0x127)&&console['log'](a4_0x24f95e[_0x17b47a(0x186)]('\x20\x20Experimental\x20Artifact\x20\x22'+_0x108ad4[_0x17b47a(0x104)]+_0x17b47a(0x140)+_0x108ad4[_0x17b47a(0x127)]));}return 0x1;}console[_0x17b47a(0x17e)]();const _0x41e44d=getLLMProjectUrl(_0x2f7e96,_0x2cd52b[_0x17b47a(0x191)]);return console[_0x17b47a(0x17e)](_0x17b47a(0x149)+a4_0x24f95e[_0x17b47a(0x123)](_0x41e44d)),0x0;}}export class AgentPushCommand extends BaseCommand{[a4_0x4c6313(0x104)]=a4_0x4c6313(0x171);[a4_0x4c6313(0x10f)]='Push\x20local\x20agent\x20files\x20to\x20LLM\x20project';async[a4_0x4c6313(0x173)](_0x1f4fc5){const _0x4f3501=a4_0x4c6313,{options:_0x2eedce,args:_0x5e75ec,tdx:_0x1cc923}=_0x1f4fc5;let _0x51ffcb=_0x5e75ec[0x0]||process['cwd']();const _0x12af4b=_0x2eedce[_0x4f3501(0x163)],_0x313f6a=_0x2eedce[_0x4f3501(0x15e)],_0x5f23f4=_0x2eedce[_0x4f3501(0x115)],_0x24fcdd=_0x2eedce['site'],_0x5ac792=a4_0x11987e[_0x4f3501(0x16e)](_0x51ffcb,'agent.yml'),_0x3d615b=existsSync(_0x5ac792);if(_0x3d615b){const {data:_0x44dd46}=await withSpinner(_0x4f3501(0x16c)+_0x51ffcb+_0x4f3501(0x117),()=>_0x1cc923['llm'][_0x4f3501(0x181)](_0x51ffcb,{'dryRun':_0x12af4b,'force':_0x313f6a}));if(_0x12af4b)return console['log'](a4_0x24f95e[_0x4f3501(0x143)](_0x4f3501(0xf9))),console[_0x4f3501(0x17e)](_0x4f3501(0x139)+_0x44dd46[_0x4f3501(0x168)]),0x0;if(_0x44dd46[_0x4f3501(0x129)]==='error')return console['log'](a4_0x24f95e['red'](_0x4f3501(0x12a)+_0x44dd46['error'])),0x1;console[_0x4f3501(0x17e)](a4_0x24f95e[_0x4f3501(0x199)](_0x4f3501(0x157)+_0x44dd46['action']+'\x20successfully')),console[_0x4f3501(0x17e)]('Agent:\x20'+_0x44dd46[_0x4f3501(0x168)]);if(_0x44dd46[_0x4f3501(0x187)]&&_0x44dd46['projectId']){const _0x2112af=getLLMAgentChatUrl(_0x24fcdd,_0x44dd46[_0x4f3501(0x192)],_0x44dd46['agentId']);console['log'](_0x4f3501(0x1a4)+a4_0x24f95e[_0x4f3501(0x123)](_0x2112af));}return 0x0;}const _0x5af246=_0x2eedce[_0x4f3501(0x1a6)],_0x23b29c=resolveProjectFromContext(_0x51ffcb,_0x5af246);if(_0x23b29c[_0x4f3501(0xfa)])_0x51ffcb=_0x23b29c[_0x4f3501(0x148)],_0x23b29c[_0x4f3501(0x17a)]===_0x4f3501(0x135)&&console[_0x4f3501(0x17e)](a4_0x24f95e[_0x4f3501(0x1a9)]('Using\x20project:\x20'+_0x51ffcb));else{let _0x392cbd=_0x4f3501(0x10c);_0x23b29c[_0x4f3501(0x113)]==='no_local_folder'&&(_0x392cbd=_0x23b29c['message']+'\x0aRun\x20\x27tdx\x20agent\x20pull\x20'+_0x23b29c[_0x4f3501(0x1a6)]+'\x27\x20to\x20create\x20the\x20folder\x20structure.');throw new SDKError(ErrorCode[_0x4f3501(0x121)],_0x23b29c[_0x4f3501(0x113)]===_0x4f3501(0x188)?_0x23b29c['message']:_0x4f3501(0x14e)+_0x51ffcb,undefined,{'helpText':_0x392cbd});}const {data:_0x1fb0a2}=await withSpinner(_0x4f3501(0x19e),()=>_0x1cc923['llm'][_0x4f3501(0x14a)](_0x51ffcb,{'dryRun':!![]})),_0x34977d=_0x1fb0a2[_0x4f3501(0x190)]['agents'][_0x4f3501(0xfe)]>0x0;if(_0x34977d){console[_0x4f3501(0x17e)](a4_0x24f95e[_0x4f3501(0x186)](_0x4f3501(0x108)));for(const _0x5c1ce4 of _0x1fb0a2[_0x4f3501(0x18a)]){_0x5c1ce4[_0x4f3501(0x129)]===_0x4f3501(0x127)&&console['log'](a4_0x24f95e[_0x4f3501(0x186)](_0x4f3501(0x16b)+_0x5c1ce4[_0x4f3501(0x168)]+_0x4f3501(0x140)+_0x5c1ce4[_0x4f3501(0x127)]));}return 0x1;}const _0x25bd9c=_0x1fb0a2['counts'][_0x4f3501(0x18a)][_0x4f3501(0x124)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x13f)][_0x4f3501(0x124)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0xfb)][_0x4f3501(0x124)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x107)][_0x4f3501(0x124)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x150)][_0x4f3501(0x124)]+_0x1fb0a2[_0x4f3501(0x190)]['experimentalKnowledgeBases'][_0x4f3501(0x124)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x158)][_0x4f3501(0x124)],_0x560932=_0x1fb0a2['counts'][_0x4f3501(0x18a)][_0x4f3501(0x179)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x13f)][_0x4f3501(0x179)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0xfb)][_0x4f3501(0x179)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x107)]['updated']+_0x1fb0a2[_0x4f3501(0x190)]['integrations'][_0x4f3501(0x179)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x17c)][_0x4f3501(0x179)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x158)][_0x4f3501(0x179)],_0x32db71=_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x18a)][_0x4f3501(0x154)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x13f)][_0x4f3501(0x154)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0xfb)][_0x4f3501(0x154)]+_0x1fb0a2['counts']['prompts'][_0x4f3501(0x154)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x150)][_0x4f3501(0x154)]+_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x17c)][_0x4f3501(0x154)]+_0x1fb0a2['counts']['experimentalArtifacts'][_0x4f3501(0x154)];console[_0x4f3501(0x17e)](_0x4f3501(0x145)+_0x1fb0a2['projectName']+'\x27:'),console[_0x4f3501(0x17e)]('\x20\x20'+a4_0x24f95e[_0x4f3501(0x199)]('+\x20'+_0x25bd9c+_0x4f3501(0x18f))+_0x4f3501(0x183)+a4_0x24f95e['yellow']('~\x20'+_0x560932+_0x4f3501(0x167))+'\x20|\x20'+a4_0x24f95e[_0x4f3501(0x1a9)]('=\x20'+_0x32db71+_0x4f3501(0x14c))),console['log']('\x20\x20Agents:\x20'+formatCountSummary(_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x18a)])),console[_0x4f3501(0x17e)](_0x4f3501(0x111)+formatCountSummary(_0x1fb0a2['counts']['knowledgeBases'])),console[_0x4f3501(0x17e)]('\x20\x20Text\x20Knowledge\x20Bases:\x20'+formatCountSummary(_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0xfb)])),console['log']('\x20\x20Prompts:\x20'+formatCountSummary(_0x1fb0a2[_0x4f3501(0x190)]['prompts'])),console['log'](_0x4f3501(0x15d)+formatCountSummary(_0x1fb0a2[_0x4f3501(0x190)]['integrations']));const _0x50cf74=_0x1fb0a2[_0x4f3501(0x190)]['experimentalKnowledgeBases'][_0x4f3501(0x124)]>0x0||_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x17c)][_0x4f3501(0x179)]>0x0||_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x17c)][_0x4f3501(0x154)]>0x0||_0x1fb0a2['counts'][_0x4f3501(0x158)]['created']>0x0||_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x158)][_0x4f3501(0x179)]>0x0||_0x1fb0a2[_0x4f3501(0x190)]['experimentalArtifacts']['unchanged']>0x0;_0x50cf74&&(console[_0x4f3501(0x17e)](_0x4f3501(0x12c)+formatCountSummary(_0x1fb0a2[_0x4f3501(0x190)][_0x4f3501(0x17c)])),console['log'](_0x4f3501(0x159)+formatCountSummary(_0x1fb0a2['counts']['experimentalArtifacts'])));console[_0x4f3501(0x17e)]('\x20\x20Source:\x20'+a4_0x24f95e[_0x4f3501(0x123)](_0x51ffcb)),displayDiffs(_0x1fb0a2[_0x4f3501(0x18a)],_0x1fb0a2[_0x4f3501(0x13f)],_0x1fb0a2[_0x4f3501(0xfb)],_0x1fb0a2[_0x4f3501(0x107)],_0x1fb0a2['integrations'],_0x1fb0a2[_0x4f3501(0x17c)],_0x1fb0a2[_0x4f3501(0x158)]);if(_0x12af4b)return console[_0x4f3501(0x17e)](a4_0x24f95e[_0x4f3501(0x143)](_0x4f3501(0x198))),0x0;if(_0x25bd9c===0x0&&_0x560932===0x0){console[_0x4f3501(0x17e)](a4_0x24f95e[_0x4f3501(0x199)](_0x4f3501(0x18d)));const _0x3c280d=getLLMProjectUrl(_0x24fcdd,_0x1fb0a2['projectId']);return console[_0x4f3501(0x17e)](_0x4f3501(0x149)+a4_0x24f95e[_0x4f3501(0x123)](_0x3c280d)),0x0;}if(!_0x5f23f4&&!_0x313f6a){if(!isInteractive())return console[_0x4f3501(0x127)](a4_0x24f95e[_0x4f3501(0x186)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a4_0x24f95e['dim'](_0x4f3501(0x152))),0x1;const _0x11ebb3=await confirmKey(_0x4f3501(0xff)+(_0x25bd9c+_0x560932)+_0x4f3501(0x120));if(!_0x11ebb3)return console[_0x4f3501(0x17e)](a4_0x24f95e[_0x4f3501(0x143)]('Cancelled'),'-\x20nothing\x20pushed'),0x1;}const {data:_0x5b6b66}=await withSpinner(_0x4f3501(0x122),()=>_0x1cc923[_0x4f3501(0x109)][_0x4f3501(0x14a)](_0x51ffcb,{'force':_0x313f6a})),_0x52d90a=_0x5b6b66[_0x4f3501(0x190)][_0x4f3501(0x18a)]['errors']>0x0||_0x5b6b66[_0x4f3501(0x190)][_0x4f3501(0x13f)]['errors']>0x0||_0x5b6b66['counts'][_0x4f3501(0xfb)][_0x4f3501(0xfe)]>0x0||_0x5b6b66[_0x4f3501(0x190)][_0x4f3501(0x107)][_0x4f3501(0xfe)]>0x0;if(_0x52d90a){console['log'](a4_0x24f95e[_0x4f3501(0x143)](_0x4f3501(0x184))),console['log'](),console[_0x4f3501(0x17e)](a4_0x24f95e[_0x4f3501(0x186)]('Errors:'));for(const _0x3f7c6d of _0x5b6b66[_0x4f3501(0x18a)]){_0x3f7c6d['action']==='error'&&console['log'](a4_0x24f95e['red'](_0x4f3501(0x16b)+_0x3f7c6d[_0x4f3501(0x168)]+'\x22:\x20'+_0x3f7c6d[_0x4f3501(0x127)]));}for(const _0x3eb218 of _0x5b6b66[_0x4f3501(0x13f)]){_0x3eb218[_0x4f3501(0x129)]===_0x4f3501(0x127)&&console[_0x4f3501(0x17e)](a4_0x24f95e[_0x4f3501(0x186)](_0x4f3501(0x178)+_0x3eb218[_0x4f3501(0x104)]+_0x4f3501(0x140)+_0x3eb218[_0x4f3501(0x127)]));}for(const _0x49285b of _0x5b6b66[_0x4f3501(0xfb)]){_0x49285b['action']===_0x4f3501(0x127)&&console[_0x4f3501(0x17e)](a4_0x24f95e['red'](_0x4f3501(0x1ab)+_0x49285b[_0x4f3501(0x104)]+_0x4f3501(0x140)+_0x49285b[_0x4f3501(0x127)]));}for(const _0x20d985 of _0x5b6b66[_0x4f3501(0x107)]){_0x20d985[_0x4f3501(0x129)]===_0x4f3501(0x127)&&console[_0x4f3501(0x17e)](a4_0x24f95e[_0x4f3501(0x186)]('\x20\x20Prompt\x20\x22'+_0x20d985[_0x4f3501(0x104)]+'\x22:\x20'+_0x20d985[_0x4f3501(0x127)]));}for(const _0x411456 of _0x5b6b66['integrations']){_0x411456[_0x4f3501(0x129)]===_0x4f3501(0x127)&&console[_0x4f3501(0x17e)](a4_0x24f95e[_0x4f3501(0x186)](_0x4f3501(0x13c)+_0x411456[_0x4f3501(0x104)]+_0x4f3501(0x140)+_0x411456[_0x4f3501(0x127)]));}return 0x1;}console[_0x4f3501(0x17e)](a4_0x24f95e[_0x4f3501(0x199)](_0x4f3501(0x164)+(_0x25bd9c+_0x560932)+_0x4f3501(0x16a)+_0x5b6b66[_0x4f3501(0x166)]+'\x27'));const _0x6706af=getLLMProjectUrl(_0x24fcdd,_0x5b6b66[_0x4f3501(0x192)]);return console[_0x4f3501(0x17e)](_0x4f3501(0x149)+a4_0x24f95e[_0x4f3501(0x123)](_0x6706af)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a5_0x13907e=a5_0x20b4;function a5_0x20b4(_0xe02e3a,_0x1dda44){_0xe02e3a=_0xe02e3a-0xea;const _0x5cab18=a5_0x5cab();let _0x20b497=_0x5cab18[_0xe02e3a];return _0x20b497;}(function(_0x5b7809,_0x18bca5){const _0x54239c=a5_0x20b4,_0x532c2e=_0x5b7809();while(!![]){try{const _0x2cf58e=-parseInt(_0x54239c(0xf7))/0x1+-parseInt(_0x54239c(0x12c))/0x2*(-parseInt(_0x54239c(0x15e))/0x3)+-parseInt(_0x54239c(0x155))/0x4+-parseInt(_0x54239c(0x15a))/0x5+-parseInt(_0x54239c(0x136))/0x6*(-parseInt(_0x54239c(0x121))/0x7)+parseInt(_0x54239c(0x14c))/0x8*(-parseInt(_0x54239c(0x126))/0x9)+parseInt(_0x54239c(0x173))/0xa*(parseInt(_0x54239c(0x140))/0xb);if(_0x2cf58e===_0x18bca5)break;else _0x532c2e['push'](_0x532c2e['shift']());}catch(_0x240f62){_0x532c2e['push'](_0x532c2e['shift']());}}}(a5_0x5cab,0x68ae6));import*as a5_0x2db304 from'node:fs';import*as a5_0x4f18ca from'node:path';import a5_0x553015 from'chalk';import{BaseCommand}from'./command.js';import{parseTestFile,runTest,formatResults,setupEvaluatorAgent,loadLastTestRun,saveLastTestRun,buildCachedTestRun,reevaluateFromCache}from'../sdk/agent/test/index.js';import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';function a5_0x5cab(){const _0x47f649=['FAIL','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','\x27\x20to\x20create\x20the\x20folder\x20structure.','Output\x20written\x20to:\x20','\x22:\x20','length','2989007rnsrhw','Executing\x20new\x20tests...','404','\x20\x20-\x20','...\x20','9tRWjaQ','trim','llm','Error:\x20No\x20previous\x20test\x20run\x20found.','Agent:\x20','\x20\x20Round\x20','1064878JoXVtM','map','dryRun','Round\x201/','✗\x20ERROR:\x20','resolve','projectDir','/<agent-name>','testName','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','6pDyRmJ','round','Conversation\x20URL:\x20','Run\x20tests\x20for\x20an\x20LLM\x20agent','Failed:\x20\x20\x20','agentName','has','Total:\x20\x20\x20\x20','cyan','resolveAgentId','11TQjlaz','Re-evaluating\x20','Re-evaluating...','\x20\x20Site:\x20','✓\x20PASS:\x20','Available\x20tags:\x20','Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/','log','timestamp','conversation_url','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','toISOString','6533032uHAoii','filter','Errors:\x20\x20\x20','includes','Round\x20','No\x20tests\x20found\x20matching:\x20','Duration:\x20','multiple_agents','description','2914448hPupuM',':\x20Sending\x20user\x20input...','some','output','Using\x20agent:\x20','3205880KYeahQ','table','✗\x20FAIL:\x20','Test\x20','3wRBXUd','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','existsSync','start','Project\x20path:\x20','\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22','\x20-\x20','stop','found','reeval','projectName','Failed\x20Tests:','dim','yellow','\x20\x20Agent:\x20','tags','size','tsv','Re-evaluating\x20cached\x20test\x20run...','now','reason','23160570wYeHtI','status','isSpinning','Available\x20tests:\x20','Re-evaluation\x20Summary','Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.','\x22,\x20but\x20current\x20site\x20is\x20\x22','⚠\x20SKIPPED:\x20','No\x20tests\x20have\x20tags\x20defined.','text','executeReeval','agent','\x20\x20Conversation:\x20','Running\x20agent\x20tests...','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','Running\x20test:\x20','repeat','Site:\x20','white','Run\x20\x27tdx\x20agent\x20pull\x20','tests','Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.','forEach','Tests\x20found:\x20','Test\x20Configuration:','name','no_context','660306adjRNz','ERROR','Usage:','Error\x20writing\x20output\x20file:\x20','resolveProjectId','execute','rounds','✗\x20ERROR:\x20Re-evaluation\x20failed:\x20','green','toLowerCase','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','llmProject','split','\x20\x20tdx\x20agent\x20test\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20(requires\x20context\x20or\x20tdx.json)','message','...','\x20\x20Project:\x20','\x20\x20Evaluating...\x20','\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.','Running:\x20','testYmlPath','push','not\x20found','PASS','agentDirs','Passed:\x20\x20\x20','Evaluating\x20response...','site','jsonl','red','writeFileSync','Cached\x20run\x20from:\x20','conversations','join','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','\x20(new)'];a5_0x5cab=function(){return _0x47f649;};return a5_0x5cab();}export class AgentTestCommand extends BaseCommand{[a5_0x13907e(0xf5)]='agent:test';[a5_0x13907e(0x154)]=a5_0x13907e(0x139);async[a5_0x13907e(0xfc)](_0x3b5cec){const _0x312eb1=a5_0x13907e,{options:_0x33ac82,args:_0x310b1c,tdx:_0x3a7849}=_0x3b5cec,_0x47eaa4=_0x310b1c[0x0]||'.',_0xaee0b7=_0x33ac82[_0x312eb1(0x12e)],_0x2efd79=_0x33ac82,_0xc18b60=_0x2efd79['eval']===![],_0xdec196=_0x2efd79[_0x312eb1(0x167)],_0x353f62=_0x2efd79['name'],_0x27041c=_0x2efd79[_0x312eb1(0x16d)],_0x18fc59=_0x33ac82[_0x312eb1(0x112)],_0x48919b=_0x2efd79[_0x312eb1(0x158)];if(_0xdec196&&_0xc18b60)return console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x114)]('Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval')),0x1;let _0x5d6bbc='table';if(_0x2efd79['json'])_0x5d6bbc='json';else{if(_0x2efd79[_0x312eb1(0x113)])_0x5d6bbc=_0x312eb1(0x113);else{if(_0x2efd79['tsv'])_0x5d6bbc=_0x312eb1(0x16f);else{if(_0x2efd79[_0x312eb1(0x15b)])_0x5d6bbc=_0x312eb1(0x15b);}}}const _0x236517=_0x2efd79[_0x312eb1(0x102)];let _0x2060be=_0x47eaa4;const _0x19f8fd=a5_0x2db304[_0x312eb1(0x160)](_0x47eaa4),_0x3b0524=_0x47eaa4==='.';if(!_0x19f8fd||_0x3b0524){const _0x3c06b3=resolveProjectFromContext(_0x47eaa4,_0x236517,{'requireFile':'test.yml'});if(_0x3c06b3[_0x312eb1(0x166)])_0x2060be=_0x3c06b3[_0x312eb1(0x132)],_0x3c06b3['source']==='context'&&console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x16a)](_0x312eb1(0x159)+_0x2060be));else switch(_0x3c06b3[_0x312eb1(0x172)]){case _0x312eb1(0xf6):console['log'](a5_0x553015[_0x312eb1(0x16b)](_0x3c06b3[_0x312eb1(0x105)])),console['log'](),console['log'](_0x312eb1(0xf9)),console[_0x312eb1(0x147)]('\x20\x20tdx\x20agent\x20test\x20<path>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20from\x20path'),console[_0x312eb1(0x147)](_0x312eb1(0x104)),console['log'](),console['log'](_0x312eb1(0x119));return 0x1;case'no_local_folder':console['log'](a5_0x553015[_0x312eb1(0x16b)](_0x3c06b3['message'])),console['log'](),console[_0x312eb1(0x147)](_0x312eb1(0xef)+_0x3c06b3[_0x312eb1(0x102)]+_0x312eb1(0x11d));return 0x1;case _0x312eb1(0x153):{const _0x87d74e=a5_0x4f18ca['basename'](_0x3c06b3[_0x312eb1(0x132)]);console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x16b)](_0x312eb1(0x14a)+_0x3c06b3[_0x312eb1(0x102)]+'\x22:'));for(const _0xcce6ae of _0x3c06b3[_0x312eb1(0x10f)]){console[_0x312eb1(0x147)](_0x312eb1(0x124)+_0xcce6ae);}return console['log'](),console[_0x312eb1(0x147)](_0x312eb1(0x146)+_0x87d74e+_0x312eb1(0x133)),0x1;}case'no_tests':console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x16b)](_0x312eb1(0x135)+_0x3c06b3[_0x312eb1(0x102)]+'\x22.')),console['log'](a5_0x553015['dim'](_0x312eb1(0x162)+_0x3c06b3[_0x312eb1(0x132)])),console['log'](),console[_0x312eb1(0x147)]('Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.');return 0x1;}}const {definition:_0x4cccdf,agentInfo:_0x32920d}=parseTestFile(_0x2060be);let _0x598e2a=_0x4cccdf[_0x312eb1(0xf0)];if(_0x353f62){const _0x173ad5=_0x353f62[_0x312eb1(0x103)](',')['map'](_0x27b8c4=>_0x27b8c4[_0x312eb1(0x127)]());_0x598e2a=_0x4cccdf[_0x312eb1(0xf0)][_0x312eb1(0x14d)](_0x4d8efd=>_0x173ad5['includes'](_0x4d8efd[_0x312eb1(0xf5)]));if(_0x598e2a[_0x312eb1(0x120)]===0x0)return console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x16b)](_0x312eb1(0x151)+_0x353f62)),console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x16a)](_0x312eb1(0x176)+_0x4cccdf[_0x312eb1(0xf0)][_0x312eb1(0x12d)](_0x577b1d=>_0x577b1d['name'])[_0x312eb1(0x118)](',\x20'))),0x1;}if(_0x27041c){const _0x47800e=_0x27041c[_0x312eb1(0x103)](',')[_0x312eb1(0x12d)](_0x1b8730=>_0x1b8730[_0x312eb1(0x127)]()[_0x312eb1(0x100)]());_0x598e2a=_0x598e2a[_0x312eb1(0x14d)](_0x5a1db6=>_0x5a1db6[_0x312eb1(0x16d)]?.[_0x312eb1(0x157)](_0x3c8826=>_0x47800e[_0x312eb1(0x14f)](_0x3c8826[_0x312eb1(0x100)]())));if(_0x598e2a[_0x312eb1(0x120)]===0x0){console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x16b)]('No\x20tests\x20found\x20with\x20tags:\x20'+_0x27041c));const _0x10e393=new Set();return _0x4cccdf['tests'][_0x312eb1(0xf2)](_0x1e8427=>_0x1e8427[_0x312eb1(0x16d)]?.[_0x312eb1(0xf2)](_0x21b5f1=>_0x10e393['add'](_0x21b5f1))),_0x10e393[_0x312eb1(0x16e)]>0x0?console['log'](a5_0x553015[_0x312eb1(0x16a)](_0x312eb1(0x145)+[..._0x10e393][_0x312eb1(0x118)](',\x20'))):console['log'](a5_0x553015[_0x312eb1(0x16a)](_0x312eb1(0x17b))),0x1;}}if(_0xdec196)return this[_0x312eb1(0x17d)](_0x3b5cec,{'definition':{'tests':_0x598e2a},'agentInfo':_0x32920d,'outputFormat':_0x5d6bbc,'outputFile':_0x48919b,'testNames':_0x353f62});if(_0xaee0b7){console['log'](a5_0x553015[_0x312eb1(0x13e)](_0x312eb1(0xf4))),console[_0x312eb1(0x147)](_0x312eb1(0x143)+a5_0x553015['white'](_0x18fc59)),console[_0x312eb1(0x147)](_0x312eb1(0x107)+a5_0x553015[_0x312eb1(0xee)](_0x32920d[_0x312eb1(0x168)])),console[_0x312eb1(0x147)](_0x312eb1(0x16c)+a5_0x553015[_0x312eb1(0xee)](_0x32920d['agentName'])),console[_0x312eb1(0x147)](),console[_0x312eb1(0x147)](_0x312eb1(0xf3)+a5_0x553015[_0x312eb1(0xee)](_0x598e2a['length']));for(let _0x16838e=0x0;_0x16838e<_0x598e2a[_0x312eb1(0x120)];_0x16838e++){const _0x47948d=_0x598e2a[_0x16838e],_0x27b039=_0x47948d[_0x312eb1(0xfd)][_0x312eb1(0x120)]===0x1?_0x312eb1(0x137):_0x312eb1(0xfd),_0xd0d7b8=_0x47948d[_0x312eb1(0x16d)]?.[_0x312eb1(0x120)]?'\x20['+_0x47948d[_0x312eb1(0x16d)][_0x312eb1(0x118)](',\x20')+']':'';console[_0x312eb1(0x147)]('\x20\x20'+(_0x16838e+0x1)+'.\x20'+a5_0x553015[_0x312eb1(0xee)](_0x47948d[_0x312eb1(0xf5)])+'\x20('+_0x47948d[_0x312eb1(0xfd)][_0x312eb1(0x120)]+'\x20'+_0x27b039+')'+a5_0x553015[_0x312eb1(0x16a)](_0xd0d7b8));}return 0x0;}let _0x4e2b6b,_0x7f566f;try{_0x4e2b6b=await _0x3a7849[_0x312eb1(0x128)][_0x312eb1(0xfb)](_0x32920d['projectName']);}catch(_0x17632b){const _0x12a957=_0x17632b instanceof Error?_0x17632b['message']:String(_0x17632b);return _0x12a957[_0x312eb1(0x14f)](_0x312eb1(0x123))||_0x12a957[_0x312eb1(0x100)]()['includes'](_0x312eb1(0x10d))?console[_0x312eb1(0x147)](a5_0x553015['red']('✗\x20ERROR:\x20Project\x20not\x20found:\x20'+_0x32920d[_0x312eb1(0x168)])):console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x114)](_0x312eb1(0xea)+_0x32920d[_0x312eb1(0x168)]+'\x22:\x20'+_0x12a957)),0x1;}try{_0x7f566f=await _0x3a7849[_0x312eb1(0x128)][_0x312eb1(0x13f)](_0x32920d[_0x312eb1(0x13b)],_0x4e2b6b);}catch(_0x1d5fa0){const _0x8d1c16=_0x1d5fa0 instanceof Error?_0x1d5fa0[_0x312eb1(0x105)]:String(_0x1d5fa0);return _0x8d1c16[_0x312eb1(0x14f)](_0x312eb1(0x123))||_0x8d1c16['toLowerCase']()[_0x312eb1(0x14f)]('not\x20found')?console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x114)](_0x312eb1(0x101)+_0x32920d['agentName'])):console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x114)](_0x312eb1(0x11c)+_0x32920d[_0x312eb1(0x13b)]+_0x312eb1(0x11f)+_0x8d1c16)),0x1;}let _0x593194;if(!_0xc18b60)try{_0x593194=await setupEvaluatorAgent(_0x3a7849['llm'],_0x33ac82['verbose']);}catch(_0x5da4e5){const _0x36dc4d=_0x5da4e5 instanceof Error?_0x5da4e5[_0x312eb1(0x105)]:String(_0x5da4e5);return console['log'](a5_0x553015[_0x312eb1(0x114)](_0x312eb1(0x15f)+_0x36dc4d)),0x1;}console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x13e)](_0x312eb1(0x180))),console[_0x312eb1(0x147)](_0x312eb1(0xed)+a5_0x553015[_0x312eb1(0xee)](_0x18fc59)),console[_0x312eb1(0x147)](_0x312eb1(0x12a)+a5_0x553015['white'](_0x32920d[_0x312eb1(0x168)]+'/'+_0x32920d[_0x312eb1(0x13b)])),console[_0x312eb1(0x147)]();const _0x26f5a9=[],_0x4fcfc1=[],_0x29b918=Date[_0x312eb1(0x171)]();for(let _0x3b51fd=0x0;_0x3b51fd<_0x598e2a['length'];_0x3b51fd++){const _0x12abe6=_0x598e2a[_0x3b51fd];_0x598e2a['length']>0x1?console[_0x312eb1(0x147)](_0x312eb1(0x15d)+(_0x3b51fd+0x1)+'/'+_0x598e2a['length']+':\x20'+a5_0x553015['white'](_0x12abe6[_0x312eb1(0xf5)])):console[_0x312eb1(0x147)](_0x312eb1(0xeb)+a5_0x553015[_0x312eb1(0xee)](_0x12abe6[_0x312eb1(0xf5)]));const _0x1a1adf=createCommandSpinner(_0x312eb1(0x12f)+_0x12abe6[_0x312eb1(0xfd)][_0x312eb1(0x120)]+_0x312eb1(0x156));_0x1a1adf['start']();try{const {result:_0x42aa24,conversation:_0x17800f}=await runTest(_0x3a7849[_0x312eb1(0x128)],_0x12abe6,{'agentId':_0x7f566f,'projectId':_0x4e2b6b,'site':_0x18fc59,'noEval':_0xc18b60,'evaluatorId':_0x593194,'onRoundStart':(_0x75ec5e,_0x5d46dc)=>{const _0x1cd138=_0x312eb1;_0x1a1adf[_0x1cd138(0x17c)]=_0x1cd138(0x150)+(_0x75ec5e+0x1)+'/'+_0x5d46dc+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x11584a,_0x284f7c,_0x294c8b)=>{const _0x2ba7c9=_0x312eb1,_0x580997=formatElapsed(_0x284f7c);_0x294c8b?console[_0x2ba7c9(0x147)]('\x20\x20Round\x20'+(_0x11584a+0x1)+'/'+_0x12abe6['rounds'][_0x2ba7c9(0x120)]+_0x2ba7c9(0x125)+a5_0x553015[_0x2ba7c9(0xff)]('✓')+'\x20('+_0x580997+')'):console[_0x2ba7c9(0x147)](_0x2ba7c9(0x12b)+(_0x11584a+0x1)+'/'+_0x12abe6[_0x2ba7c9(0xfd)][_0x2ba7c9(0x120)]+_0x2ba7c9(0x125)+a5_0x553015['red']('✗'));},'onEvaluationStart':()=>{const _0x2f2eb4=_0x312eb1;_0x1a1adf[_0x2f2eb4(0x17c)]='Evaluating\x20response...';},'onEvaluationComplete':_0x6f8e0c=>{const _0x3e8c87=_0x312eb1,_0x176445=formatElapsed(_0x6f8e0c);console[_0x3e8c87(0x147)](_0x3e8c87(0x108)+a5_0x553015[_0x3e8c87(0xff)]('✓')+'\x20('+_0x176445+')');}});_0x1a1adf[_0x312eb1(0x165)](),_0x26f5a9[_0x312eb1(0x10c)](_0x42aa24),_0x4fcfc1['push'](_0x17800f);if(_0x42aa24[_0x312eb1(0x174)]===_0x312eb1(0x10e))console['log'](a5_0x553015['green']('✓\x20PASS:\x20'+_0x42aa24[_0x312eb1(0x172)]));else _0x42aa24[_0x312eb1(0x174)]==='FAIL'?console['log'](a5_0x553015[_0x312eb1(0x114)](_0x312eb1(0x15c)+_0x42aa24[_0x312eb1(0x172)])):console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x114)](_0x312eb1(0x130)+_0x42aa24[_0x312eb1(0x172)]));_0x42aa24[_0x312eb1(0x149)]&&console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x16a)](_0x312eb1(0x138)+_0x42aa24[_0x312eb1(0x149)])),console[_0x312eb1(0x147)]();}catch(_0x5811eb){_0x1a1adf[_0x312eb1(0x165)]();const _0x3b13f9=_0x5811eb instanceof Error?_0x5811eb['message']:String(_0x5811eb);console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x114)]('✗\x20ERROR:\x20'+_0x3b13f9)),console['log'](),_0x26f5a9[_0x312eb1(0x10c)]({'name':_0x12abe6[_0x312eb1(0xf5)],'status':_0x312eb1(0xf8),'reason':_0x3b13f9,'timestamp':new Date()['toISOString'](),'duration_ms':0x0});}}const _0x418ceb=Date['now']()-_0x29b918,_0x3e43a=_0x26f5a9[_0x312eb1(0x14d)](_0x361f1d=>_0x361f1d[_0x312eb1(0x174)]===_0x312eb1(0x10e))[_0x312eb1(0x120)],_0x57f889=_0x26f5a9[_0x312eb1(0x14d)](_0x207459=>_0x207459[_0x312eb1(0x174)]==='FAIL')[_0x312eb1(0x120)],_0x44d911=_0x26f5a9['filter'](_0x37158f=>_0x37158f['status']==='ERROR')[_0x312eb1(0x120)];console[_0x312eb1(0x147)]('━'[_0x312eb1(0xec)](0x3c)),console[_0x312eb1(0x147)]('Test\x20Summary'),console[_0x312eb1(0x147)]('━'[_0x312eb1(0xec)](0x3c)),console[_0x312eb1(0x147)](_0x312eb1(0x13d)+_0x26f5a9[_0x312eb1(0x120)]),console[_0x312eb1(0x147)](_0x312eb1(0x110)+a5_0x553015[_0x312eb1(0xff)](_0x3e43a)),console['log'](_0x312eb1(0x13a)+a5_0x553015[_0x312eb1(0x114)](_0x57f889));_0x44d911>0x0&&console[_0x312eb1(0x147)](_0x312eb1(0x14e)+a5_0x553015[_0x312eb1(0x114)](_0x44d911));console[_0x312eb1(0x147)](_0x312eb1(0x152)+formatElapsed(_0x418ceb)),console['log']('━'[_0x312eb1(0xec)](0x3c));const _0x5a759d=_0x26f5a9[_0x312eb1(0x14d)](_0x41181e=>_0x41181e[_0x312eb1(0x174)]!==_0x312eb1(0x10e));if(_0x5a759d['length']>0x0){console['log'](),console[_0x312eb1(0x147)](_0x312eb1(0x169));for(const _0x84d30b of _0x5a759d){const _0xf8cffb=a5_0x553015[_0x312eb1(0x114)]('✗'),_0x4facd2=_0x84d30b[_0x312eb1(0x172)][_0x312eb1(0x120)]>0x32?_0x84d30b[_0x312eb1(0x172)]['substring'](0x0,0x32)+_0x312eb1(0x106):_0x84d30b[_0x312eb1(0x172)];console['log']('\x20\x20'+_0xf8cffb+'\x20'+_0x84d30b['name']+':\x20'+_0x4facd2);}}const _0x21e9bc={'summary':{'total':_0x26f5a9[_0x312eb1(0x120)],'passed':_0x3e43a,'failed':_0x57f889,'errors':_0x44d911>0x0?_0x44d911:undefined,'duration_ms':_0x418ceb},'tests':_0x26f5a9,'agent':{'project':_0x32920d[_0x312eb1(0x168)],'name':_0x32920d[_0x312eb1(0x13b)],'site':_0x18fc59},'timestamp':new Date(_0x29b918)[_0x312eb1(0x14b)]()};try{const _0x5702e5=buildCachedTestRun(_0x4fcfc1,{'site':_0x18fc59,'projectId':_0x4e2b6b,'projectName':_0x32920d[_0x312eb1(0x168)],'agentId':_0x7f566f,'agentName':_0x32920d['agentName'],'testYmlPath':a5_0x4f18ca[_0x312eb1(0x131)](_0x32920d[_0x312eb1(0x10b)])});saveLastTestRun(_0x5702e5);}catch{}if(_0x5d6bbc!=='table'||_0x48919b){const _0x3da3e1=formatResults(_0x21e9bc,_0x5d6bbc);if(_0x48919b)try{a5_0x2db304[_0x312eb1(0x115)](_0x48919b,_0x3da3e1,'utf-8'),console[_0x312eb1(0x147)](),console[_0x312eb1(0x147)](a5_0x553015['dim'](_0x312eb1(0x11e)+_0x48919b));}catch(_0x49eaf9){return console[_0x312eb1(0x147)](),console[_0x312eb1(0x147)](a5_0x553015[_0x312eb1(0x114)]('Error\x20writing\x20output\x20file:\x20'+_0x49eaf9)),0x1;}else console[_0x312eb1(0x147)](),console[_0x312eb1(0x147)](_0x3da3e1);}return _0x5a759d['length']>0x0?0x1:0x0;}async[a5_0x13907e(0x17d)](_0x2decf4,_0x550c25){const _0x4788ac=a5_0x13907e,{options:_0xb64271,tdx:_0x314c52}=_0x2decf4,{definition:_0x54483f,agentInfo:_0x2cbb63,outputFormat:_0x46ba92,outputFile:_0x29eb60}=_0x550c25,_0xd76e3a=_0xb64271[_0x4788ac(0x112)],_0x29970e=loadLastTestRun();if(!_0x29970e)return console[_0x4788ac(0x147)](a5_0x553015[_0x4788ac(0x114)](_0x4788ac(0x129))),console[_0x4788ac(0x147)](a5_0x553015[_0x4788ac(0x16a)](_0x4788ac(0x178))),0x1;if(_0x29970e[_0x4788ac(0x17e)][_0x4788ac(0x13b)]!==_0x2cbb63['agentName'])return console[_0x4788ac(0x147)](a5_0x553015['red']('Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22'+_0x29970e['agent'][_0x4788ac(0x13b)]+_0x4788ac(0x163)+_0x2cbb63[_0x4788ac(0x13b)]+'\x22.')),console[_0x4788ac(0x147)](a5_0x553015[_0x4788ac(0x16a)](_0x4788ac(0xf1))),0x1;const _0x4b7971=new Set(_0x29970e[_0x4788ac(0x117)][_0x4788ac(0x12d)](_0x32211f=>_0x32211f[_0x4788ac(0x134)])),_0x1f1051=_0x54483f['tests']['filter'](_0x311466=>!_0x4b7971[_0x4788ac(0x13c)](_0x311466[_0x4788ac(0xf5)]));if(_0x1f1051[_0x4788ac(0x120)]>0x0&&_0x29970e[_0x4788ac(0x112)]!==_0xd76e3a)return console[_0x4788ac(0x147)](a5_0x553015[_0x4788ac(0x114)]('Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.')),console['log'](a5_0x553015[_0x4788ac(0x16a)]('Cached\x20run\x20is\x20from\x20site\x20\x22'+_0x29970e[_0x4788ac(0x112)]+_0x4788ac(0x179)+_0xd76e3a+'\x22.')),console[_0x4788ac(0x147)](a5_0x553015[_0x4788ac(0x16a)]('Either\x20switch\x20to\x20the\x20\x22'+_0x29970e[_0x4788ac(0x112)]+_0x4788ac(0x109))),0x1;const _0xc8e21e=_0x54483f[_0x4788ac(0xf0)][_0x4788ac(0x14d)](_0x242cc7=>_0x4b7971[_0x4788ac(0x13c)](_0x242cc7['name'])),_0x11de51=_0x1f1051;let _0x5c8f34;try{_0x5c8f34=await setupEvaluatorAgent(_0x314c52['llm'],_0xb64271['verbose']);}catch(_0x763403){const _0x4cc9de=_0x763403 instanceof Error?_0x763403['message']:String(_0x763403);return console[_0x4788ac(0x147)](a5_0x553015['red'](_0x4788ac(0x15f)+_0x4cc9de)),0x1;}console['log'](a5_0x553015[_0x4788ac(0x13e)](_0x4788ac(0x170))),console[_0x4788ac(0x147)](_0x4788ac(0x116)+a5_0x553015[_0x4788ac(0xee)](_0x29970e[_0x4788ac(0x148)])),console['log'](_0x4788ac(0x12a)+a5_0x553015[_0x4788ac(0xee)](_0x29970e[_0x4788ac(0x17e)]['projectName']+'/'+_0x29970e[_0x4788ac(0x17e)][_0x4788ac(0x13b)]));_0x11de51[_0x4788ac(0x120)]>0x0&&console[_0x4788ac(0x147)]('New\x20tests\x20to\x20execute:\x20'+a5_0x553015[_0x4788ac(0x16b)](_0x11de51['length']));console[_0x4788ac(0x147)]();const _0x28c621=[],_0x335e02=Date[_0x4788ac(0x171)](),_0x316045=createCommandSpinner(_0x4788ac(0x142));if(_0xc8e21e[_0x4788ac(0x120)]>0x0)try{const _0x68516d=await reevaluateFromCache(_0x314c52['llm'],_0x29970e,{'tests':_0xc8e21e},{'evaluatorId':_0x5c8f34,'onTestStart':(_0x4769af,_0x25b35b,_0x17d6b8)=>{const _0x246b81=_0x4788ac;_0x316045['text']=_0x246b81(0x141)+(_0x25b35b+0x1)+'/'+_0x17d6b8+':\x20'+_0x4769af+'...';if(!_0x316045[_0x246b81(0x175)])_0x316045[_0x246b81(0x161)]();},'onTestComplete':(_0x1763cc,_0x276899)=>{const _0x5ccdca=_0x4788ac;_0x316045[_0x5ccdca(0x165)]();if(_0x276899[_0x5ccdca(0x174)]===_0x5ccdca(0x10e))console['log'](a5_0x553015[_0x5ccdca(0xff)](_0x5ccdca(0x144)+_0x1763cc)+a5_0x553015[_0x5ccdca(0x16a)]('\x20(cached)'));else _0x276899['status']==='FAIL'?console[_0x5ccdca(0x147)](a5_0x553015[_0x5ccdca(0x114)]('✗\x20FAIL:\x20'+_0x1763cc+_0x5ccdca(0x164)+_0x276899['reason'])+a5_0x553015[_0x5ccdca(0x16a)]('\x20(cached)')):console['log'](a5_0x553015[_0x5ccdca(0x114)](_0x5ccdca(0x130)+_0x1763cc+_0x5ccdca(0x164)+_0x276899['reason']));_0x276899['conversation_url']&&console[_0x5ccdca(0x147)](a5_0x553015[_0x5ccdca(0x16a)](_0x5ccdca(0x17f)+_0x276899[_0x5ccdca(0x149)])),_0x28c621[_0x5ccdca(0x10c)](_0x276899);},'onTestSkipped':(_0x3b47e3,_0x38957d)=>{const _0x3dc9ce=_0x4788ac;_0x316045[_0x3dc9ce(0x165)](),console[_0x3dc9ce(0x147)](a5_0x553015[_0x3dc9ce(0x16b)](_0x3dc9ce(0x17a)+_0x3b47e3+_0x3dc9ce(0x164)+_0x38957d));}});for(const _0x31a3b6 of _0x68516d){!_0x28c621['find'](_0x2485d9=>_0x2485d9[_0x4788ac(0xf5)]===_0x31a3b6[_0x4788ac(0xf5)])&&_0x28c621[_0x4788ac(0x10c)](_0x31a3b6);}}catch(_0xe74fab){_0x316045['stop']();const _0x4e7926=_0xe74fab instanceof Error?_0xe74fab['message']:String(_0xe74fab);return console[_0x4788ac(0x147)](a5_0x553015[_0x4788ac(0x114)](_0x4788ac(0xfe)+_0x4e7926)),0x1;}_0x316045[_0x4788ac(0x165)]();if(_0x11de51['length']>0x0){console[_0x4788ac(0x147)](),console[_0x4788ac(0x147)](a5_0x553015['cyan'](_0x4788ac(0x122)));const {projectId:_0x2f870c,agentId:_0x30564d}=_0x29970e[_0x4788ac(0x17e)];for(const _0x2535b2 of _0x11de51){console['log'](_0x4788ac(0x10a)+a5_0x553015[_0x4788ac(0xee)](_0x2535b2[_0x4788ac(0xf5)]));const _0xa27a23=createCommandSpinner(_0x4788ac(0x12f)+_0x2535b2[_0x4788ac(0xfd)][_0x4788ac(0x120)]+':\x20Sending\x20user\x20input...');_0xa27a23[_0x4788ac(0x161)]();try{const {result:_0x624ab}=await runTest(_0x314c52[_0x4788ac(0x128)],_0x2535b2,{'agentId':_0x30564d,'projectId':_0x2f870c,'site':_0x29970e[_0x4788ac(0x112)],'noEval':![],'evaluatorId':_0x5c8f34,'onRoundStart':(_0x154ce1,_0x4b6690)=>{const _0x332fcb=_0x4788ac;_0xa27a23[_0x332fcb(0x17c)]='Round\x20'+(_0x154ce1+0x1)+'/'+_0x4b6690+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x397114,_0x253f48,_0x2cd9be)=>{const _0x456e1d=_0x4788ac,_0x236b78=formatElapsed(_0x253f48);_0x2cd9be?console['log']('\x20\x20Round\x20'+(_0x397114+0x1)+'/'+_0x2535b2[_0x456e1d(0xfd)][_0x456e1d(0x120)]+_0x456e1d(0x125)+a5_0x553015[_0x456e1d(0xff)]('✓')+'\x20('+_0x236b78+')'):console[_0x456e1d(0x147)](_0x456e1d(0x12b)+(_0x397114+0x1)+'/'+_0x2535b2['rounds']['length']+_0x456e1d(0x125)+a5_0x553015[_0x456e1d(0x114)]('✗'));},'onEvaluationStart':()=>{const _0x926dac=_0x4788ac;_0xa27a23[_0x926dac(0x17c)]=_0x926dac(0x111);},'onEvaluationComplete':_0x434172=>{const _0x12cbb4=_0x4788ac,_0x4080be=formatElapsed(_0x434172);console['log'](_0x12cbb4(0x108)+a5_0x553015[_0x12cbb4(0xff)]('✓')+'\x20('+_0x4080be+')');}});_0xa27a23[_0x4788ac(0x165)](),_0x28c621[_0x4788ac(0x10c)](_0x624ab);if(_0x624ab['status']===_0x4788ac(0x10e))console['log'](a5_0x553015[_0x4788ac(0xff)]('✓\x20PASS:\x20'+_0x624ab['reason'])+a5_0x553015[_0x4788ac(0x16a)]('\x20(new)'));else _0x624ab['status']===_0x4788ac(0x11b)?console[_0x4788ac(0x147)](a5_0x553015[_0x4788ac(0x114)](_0x4788ac(0x15c)+_0x624ab[_0x4788ac(0x172)])+a5_0x553015['dim'](_0x4788ac(0x11a))):console[_0x4788ac(0x147)](a5_0x553015[_0x4788ac(0x114)]('✗\x20ERROR:\x20'+_0x624ab['reason']));_0x624ab[_0x4788ac(0x149)]&&console[_0x4788ac(0x147)](a5_0x553015[_0x4788ac(0x16a)](_0x4788ac(0x17f)+_0x624ab[_0x4788ac(0x149)]));}catch(_0x107fdd){_0xa27a23['stop']();const _0x37b21f=_0x107fdd instanceof Error?_0x107fdd[_0x4788ac(0x105)]:String(_0x107fdd);console[_0x4788ac(0x147)](a5_0x553015[_0x4788ac(0x114)](_0x4788ac(0x130)+_0x37b21f)),_0x28c621[_0x4788ac(0x10c)]({'name':_0x2535b2['name'],'status':_0x4788ac(0xf8),'reason':_0x37b21f,'timestamp':new Date()[_0x4788ac(0x14b)](),'duration_ms':0x0});}}}console[_0x4788ac(0x147)]();const _0x168b61=Date[_0x4788ac(0x171)]()-_0x335e02,_0x3f062a=_0x28c621[_0x4788ac(0x14d)](_0x4e008d=>_0x4e008d[_0x4788ac(0x174)]===_0x4788ac(0x10e))[_0x4788ac(0x120)],_0x4211e8=_0x28c621[_0x4788ac(0x14d)](_0x1a8e44=>_0x1a8e44['status']===_0x4788ac(0x11b))[_0x4788ac(0x120)],_0x284eaf=_0x28c621[_0x4788ac(0x14d)](_0x88caa0=>_0x88caa0['status']===_0x4788ac(0xf8))['length'];console['log']('━'[_0x4788ac(0xec)](0x3c)),console[_0x4788ac(0x147)](_0x4788ac(0x177)),console[_0x4788ac(0x147)]('━'['repeat'](0x3c)),console['log'](_0x4788ac(0x13d)+_0x28c621[_0x4788ac(0x120)]),console[_0x4788ac(0x147)](_0x4788ac(0x110)+a5_0x553015['green'](_0x3f062a)),console[_0x4788ac(0x147)](_0x4788ac(0x13a)+a5_0x553015[_0x4788ac(0x114)](_0x4211e8));_0x284eaf>0x0&&console['log'](_0x4788ac(0x14e)+a5_0x553015[_0x4788ac(0x114)](_0x284eaf));console[_0x4788ac(0x147)](_0x4788ac(0x152)+formatElapsed(_0x168b61)),console['log']('━'[_0x4788ac(0xec)](0x3c));const _0x42f6fc={'summary':{'total':_0x28c621[_0x4788ac(0x120)],'passed':_0x3f062a,'failed':_0x4211e8,'errors':_0x284eaf>0x0?_0x284eaf:undefined,'duration_ms':_0x168b61},'tests':_0x28c621,'agent':{'project':_0x2cbb63[_0x4788ac(0x168)],'name':_0x2cbb63[_0x4788ac(0x13b)],'site':_0xd76e3a},'timestamp':new Date(_0x335e02)[_0x4788ac(0x14b)]()};if(_0x46ba92!==_0x4788ac(0x15b)||_0x29eb60){const _0x3ec501=formatResults(_0x42f6fc,_0x46ba92);if(_0x29eb60)try{a5_0x2db304[_0x4788ac(0x115)](_0x29eb60,_0x3ec501,'utf-8'),console[_0x4788ac(0x147)](),console['log'](a5_0x553015[_0x4788ac(0x16a)]('Output\x20written\x20to:\x20'+_0x29eb60));}catch(_0x12490f){return console[_0x4788ac(0x147)](),console[_0x4788ac(0x147)](a5_0x553015['red'](_0x4788ac(0xfa)+_0x12490f)),0x1;}else console['log'](),console['log'](_0x3ec501);}const _0x5dbbe3=_0x28c621[_0x4788ac(0x14d)](_0x20b1a5=>_0x20b1a5['status']!==_0x4788ac(0x10e));return _0x5dbbe3[_0x4788ac(0x120)]>0x0?0x1:0x0;}}
|
|
1
|
+
const a5_0x39835e=a5_0x4d91;(function(_0x7df38e,_0x5ed4a1){const _0x36f21d=a5_0x4d91,_0x3c68f6=_0x7df38e();while(!![]){try{const _0x3d25b9=-parseInt(_0x36f21d(0xa1))/0x1*(parseInt(_0x36f21d(0x8e))/0x2)+parseInt(_0x36f21d(0x6a))/0x3*(parseInt(_0x36f21d(0x73))/0x4)+parseInt(_0x36f21d(0xee))/0x5*(-parseInt(_0x36f21d(0x8f))/0x6)+-parseInt(_0x36f21d(0x98))/0x7+-parseInt(_0x36f21d(0x99))/0x8+parseInt(_0x36f21d(0xd6))/0x9*(parseInt(_0x36f21d(0xbb))/0xa)+parseInt(_0x36f21d(0x72))/0xb;if(_0x3d25b9===_0x5ed4a1)break;else _0x3c68f6['push'](_0x3c68f6['shift']());}catch(_0x69865e){_0x3c68f6['push'](_0x3c68f6['shift']());}}}(a5_0x5454,0xd6cbc));import*as a5_0x21de67 from'node:fs';import*as a5_0x177f6e from'node:path';import a5_0x300f74 from'chalk';import{BaseCommand}from'./command.js';function a5_0x4d91(_0x5ed756,_0x51832e){_0x5ed756=_0x5ed756-0x65;const _0x545463=a5_0x5454();let _0x4d916d=_0x545463[_0x5ed756];return _0x4d916d;}import{parseTestFile,runTest,formatResults,setupEvaluatorAgent,loadLastTestRun,saveLastTestRun,buildCachedTestRun,reevaluateFromCache}from'../sdk/agent/test/index.js';import{resolveProjectFromContext}from'../sdk/agent/agent-config.js';import{createCommandSpinner,formatElapsed}from'../utils/spinner.js';export class AgentTestCommand extends BaseCommand{[a5_0x39835e(0xad)]=a5_0x39835e(0xd5);[a5_0x39835e(0x84)]=a5_0x39835e(0xbf);async[a5_0x39835e(0xb7)](_0x38246b){const _0x51c87c=a5_0x39835e,{options:_0x1b3925,args:_0x34e9f2,tdx:_0x4ade85}=_0x38246b,_0x3c329a=_0x34e9f2[0x0]||'.',_0x88a8cf=_0x1b3925[_0x51c87c(0x8c)],_0x36ec4e=_0x1b3925,_0x39c222=_0x36ec4e[_0x51c87c(0x9d)]===![],_0x572afe=_0x36ec4e[_0x51c87c(0x77)],_0x10a792=_0x36ec4e['name'],_0x3f8793=_0x36ec4e[_0x51c87c(0x86)],_0x5089cf=_0x1b3925['site'],_0x218eb0=_0x36ec4e['output'];if(_0x572afe&&_0x39c222)return console[_0x51c87c(0xc4)](a5_0x300f74['red'](_0x51c87c(0xf1))),0x1;let _0xd50ebe=_0x51c87c(0xe6);if(_0x36ec4e[_0x51c87c(0xc6)])_0xd50ebe=_0x51c87c(0xc6);else{if(_0x36ec4e[_0x51c87c(0x89)])_0xd50ebe=_0x51c87c(0x89);else{if(_0x36ec4e[_0x51c87c(0xb0)])_0xd50ebe=_0x51c87c(0xb0);else{if(_0x36ec4e['table'])_0xd50ebe=_0x51c87c(0xe6);}}}const _0x1eed49=_0x36ec4e[_0x51c87c(0xf8)];let _0xb06d39=_0x3c329a;const _0x40877f=a5_0x21de67[_0x51c87c(0x80)](_0x3c329a),_0x5a4b27=_0x3c329a==='.';if(!_0x40877f||_0x5a4b27){const _0x1c9552=resolveProjectFromContext(_0x3c329a,_0x1eed49,{'requireFile':_0x51c87c(0xb1)});if(_0x1c9552[_0x51c87c(0xe0)])_0xb06d39=_0x1c9552['projectDir'],_0x1c9552[_0x51c87c(0x7c)]===_0x51c87c(0x8b)&&console['log'](a5_0x300f74['dim'](_0x51c87c(0xab)+_0xb06d39));else switch(_0x1c9552[_0x51c87c(0xda)]){case'no_context':console['log'](a5_0x300f74[_0x51c87c(0x6c)](_0x1c9552[_0x51c87c(0xea)])),console[_0x51c87c(0xc4)](),console[_0x51c87c(0xc4)](_0x51c87c(0x8d)),console[_0x51c87c(0xc4)](_0x51c87c(0xbd)),console[_0x51c87c(0xc4)](_0x51c87c(0x83)),console['log'](),console['log'](_0x51c87c(0xb3));return 0x1;case _0x51c87c(0xa7):console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x6c)](_0x1c9552[_0x51c87c(0xea)])),console['log'](),console['log']('Run\x20\x27tdx\x20agent\x20pull\x20'+_0x1c9552[_0x51c87c(0xf8)]+_0x51c87c(0x75));return 0x1;case _0x51c87c(0x81):{const _0x2f4749=a5_0x177f6e['basename'](_0x1c9552['projectDir']);console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x6c)](_0x51c87c(0xd0)+_0x1c9552[_0x51c87c(0xf8)]+'\x22:'));for(const _0x3b7bea of _0x1c9552['agentDirs']){console[_0x51c87c(0xc4)](_0x51c87c(0xa8)+_0x3b7bea);}return console[_0x51c87c(0xc4)](),console[_0x51c87c(0xc4)]('Specify\x20an\x20agent:\x20tdx\x20agent\x20test\x20agents/'+_0x2f4749+_0x51c87c(0xdf)),0x1;}case'no_tests':console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x6c)](_0x51c87c(0xba)+_0x1c9552[_0x51c87c(0xf8)]+'\x22.')),console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x70)](_0x51c87c(0x6b)+_0x1c9552['projectDir'])),console['log'](),console[_0x51c87c(0xc4)](_0x51c87c(0xdd));return 0x1;}}const {definition:_0x138d45,agentInfo:_0x21dad2}=parseTestFile(_0xb06d39);let _0x952c6=_0x138d45[_0x51c87c(0xc7)];if(_0x10a792){const _0x42077f=_0x10a792[_0x51c87c(0xf3)](',')['map'](_0x2c8451=>_0x2c8451[_0x51c87c(0x79)]());_0x952c6=_0x138d45[_0x51c87c(0xc7)][_0x51c87c(0xce)](_0x68f804=>_0x42077f[_0x51c87c(0xe4)](_0x68f804[_0x51c87c(0xad)]));if(_0x952c6[_0x51c87c(0xb8)]===0x0)return console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x6c)](_0x51c87c(0xb9)+_0x10a792)),console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x70)](_0x51c87c(0x76)+_0x138d45[_0x51c87c(0xc7)][_0x51c87c(0xef)](_0x3b9f03=>_0x3b9f03[_0x51c87c(0xad)])[_0x51c87c(0xdb)](',\x20'))),0x1;}if(_0x3f8793){const _0x475094=_0x3f8793[_0x51c87c(0xf3)](',')['map'](_0x4733bd=>_0x4733bd[_0x51c87c(0x79)]()[_0x51c87c(0xb6)]());_0x952c6=_0x952c6[_0x51c87c(0xce)](_0x7ba073=>_0x7ba073['tags']?.['some'](_0x21cb18=>_0x475094[_0x51c87c(0xe4)](_0x21cb18[_0x51c87c(0xb6)]())));if(_0x952c6['length']===0x0){console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x6c)](_0x51c87c(0xde)+_0x3f8793));const _0x360fec=new Set();return _0x138d45[_0x51c87c(0xc7)][_0x51c87c(0xf9)](_0x473195=>_0x473195[_0x51c87c(0x86)]?.[_0x51c87c(0xf9)](_0x272909=>_0x360fec[_0x51c87c(0xc9)](_0x272909))),_0x360fec[_0x51c87c(0xec)]>0x0?console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x70)](_0x51c87c(0x91)+[..._0x360fec][_0x51c87c(0xdb)](',\x20'))):console['log'](a5_0x300f74['dim'](_0x51c87c(0x7e))),0x1;}}if(_0x572afe)return this[_0x51c87c(0xe8)](_0x38246b,{'definition':{'tests':_0x952c6},'agentInfo':_0x21dad2,'outputFormat':_0xd50ebe,'outputFile':_0x218eb0,'testNames':_0x10a792});if(_0x88a8cf){console[_0x51c87c(0xc4)](a5_0x300f74['cyan'](_0x51c87c(0xa2))),console[_0x51c87c(0xc4)](_0x51c87c(0x65)+a5_0x300f74[_0x51c87c(0xcb)](_0x5089cf)),console[_0x51c87c(0xc4)](_0x51c87c(0xc2)+a5_0x300f74['white'](_0x21dad2[_0x51c87c(0x94)])),console[_0x51c87c(0xc4)](_0x51c87c(0xe1)+a5_0x300f74[_0x51c87c(0xcb)](_0x21dad2['agentName'])),console[_0x51c87c(0xc4)](),console[_0x51c87c(0xc4)](_0x51c87c(0xfa)+a5_0x300f74[_0x51c87c(0xcb)](_0x952c6['length']));for(let _0x1d3115=0x0;_0x1d3115<_0x952c6[_0x51c87c(0xb8)];_0x1d3115++){const _0x45b204=_0x952c6[_0x1d3115],_0x214acf=_0x45b204[_0x51c87c(0xc5)][_0x51c87c(0xb8)]===0x1?_0x51c87c(0x82):_0x51c87c(0xc5),_0x30b0f8=_0x45b204[_0x51c87c(0x86)]?.['length']?'\x20['+_0x45b204['tags'][_0x51c87c(0xdb)](',\x20')+']':'';console[_0x51c87c(0xc4)]('\x20\x20'+(_0x1d3115+0x1)+'.\x20'+a5_0x300f74[_0x51c87c(0xcb)](_0x45b204[_0x51c87c(0xad)])+'\x20('+_0x45b204[_0x51c87c(0xc5)]['length']+'\x20'+_0x214acf+')'+a5_0x300f74[_0x51c87c(0x70)](_0x30b0f8));}return 0x0;}let _0x4f463c,_0x1cb256;try{_0x4f463c=await _0x4ade85['llm'][_0x51c87c(0x93)](_0x21dad2[_0x51c87c(0x94)]);}catch(_0x160d1c){const _0x1d6d71=_0x160d1c instanceof Error?_0x160d1c[_0x51c87c(0xea)]:String(_0x160d1c);return _0x1d6d71['includes'](_0x51c87c(0xc8))||_0x1d6d71[_0x51c87c(0xb6)]()[_0x51c87c(0xe4)](_0x51c87c(0xd9))?console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x7a)]('✗\x20ERROR:\x20Project\x20not\x20found:\x20'+_0x21dad2[_0x51c87c(0x94)])):console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x7a)](_0x51c87c(0x7b)+_0x21dad2[_0x51c87c(0x94)]+_0x51c87c(0xa9)+_0x1d6d71)),0x1;}try{_0x1cb256=await _0x4ade85[_0x51c87c(0x69)][_0x51c87c(0x7f)](_0x21dad2[_0x51c87c(0x87)],_0x4f463c);}catch(_0x8c6e62){const _0x27f740=_0x8c6e62 instanceof Error?_0x8c6e62[_0x51c87c(0xea)]:String(_0x8c6e62);return _0x27f740['includes']('404')||_0x27f740[_0x51c87c(0xb6)]()[_0x51c87c(0xe4)](_0x51c87c(0xd9))?console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x7a)](_0x51c87c(0xfb)+_0x21dad2[_0x51c87c(0x87)])):console['log'](a5_0x300f74[_0x51c87c(0x7a)](_0x51c87c(0xe2)+_0x21dad2[_0x51c87c(0x87)]+_0x51c87c(0xa9)+_0x27f740)),0x1;}let _0x368400;if(!_0x39c222)try{_0x368400=await setupEvaluatorAgent(_0x4ade85[_0x51c87c(0x69)],_0x1b3925[_0x51c87c(0x6d)]);}catch(_0x6029af){const _0x6c5040=_0x6029af instanceof Error?_0x6029af[_0x51c87c(0xea)]:String(_0x6029af);return console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x7a)](_0x51c87c(0xcd)+_0x6c5040)),0x1;}console[_0x51c87c(0xc4)](a5_0x300f74['cyan'](_0x51c87c(0xbe))),console[_0x51c87c(0xc4)]('Site:\x20'+a5_0x300f74[_0x51c87c(0xcb)](_0x5089cf)),console[_0x51c87c(0xc4)](_0x51c87c(0xed)+a5_0x300f74[_0x51c87c(0xcb)](_0x21dad2[_0x51c87c(0x94)]+'/'+_0x21dad2[_0x51c87c(0x87)])),console[_0x51c87c(0xc4)]();const _0x14cda8=[],_0x34c7e1=[],_0x5f69f8=Date[_0x51c87c(0xc1)]();for(let _0x48a7d0=0x0;_0x48a7d0<_0x952c6[_0x51c87c(0xb8)];_0x48a7d0++){const _0x2efa18=_0x952c6[_0x48a7d0];_0x952c6[_0x51c87c(0xb8)]>0x1?console[_0x51c87c(0xc4)](_0x51c87c(0xbc)+(_0x48a7d0+0x1)+'/'+_0x952c6[_0x51c87c(0xb8)]+':\x20'+a5_0x300f74[_0x51c87c(0xcb)](_0x2efa18[_0x51c87c(0xad)])):console['log']('Running\x20test:\x20'+a5_0x300f74[_0x51c87c(0xcb)](_0x2efa18[_0x51c87c(0xad)]));const _0x31f92a=createCommandSpinner(_0x51c87c(0xf0)+_0x2efa18[_0x51c87c(0xc5)]['length']+':\x20Sending\x20user\x20input...');_0x31f92a[_0x51c87c(0xb5)]();try{const {result:_0x2c8cb3,conversation:_0x1ae4ed}=await runTest(_0x4ade85[_0x51c87c(0x69)],_0x2efa18,{'agentId':_0x1cb256,'projectId':_0x4f463c,'site':_0x5089cf,'noEval':_0x39c222,'evaluatorId':_0x368400,'onRoundStart':(_0xa763fb,_0x537903)=>{const _0x3495c9=_0x51c87c;_0x31f92a[_0x3495c9(0x66)]='Round\x20'+(_0xa763fb+0x1)+'/'+_0x537903+':\x20Sending\x20user\x20input...';},'onRoundComplete':(_0x3469c3,_0xfe8b44,_0x4f1174)=>{const _0x16ec3c=_0x51c87c,_0x2b26c6=formatElapsed(_0xfe8b44);_0x4f1174?console[_0x16ec3c(0xc4)]('\x20\x20Round\x20'+(_0x3469c3+0x1)+'/'+_0x2efa18[_0x16ec3c(0xc5)][_0x16ec3c(0xb8)]+'...\x20'+a5_0x300f74['green']('✓')+'\x20('+_0x2b26c6+')'):console[_0x16ec3c(0xc4)](_0x16ec3c(0xd8)+(_0x3469c3+0x1)+'/'+_0x2efa18[_0x16ec3c(0xc5)]['length']+_0x16ec3c(0x7d)+a5_0x300f74['red']('✗'));},'onEvaluationStart':()=>{const _0x3b0f64=_0x51c87c;_0x31f92a[_0x3b0f64(0x66)]=_0x3b0f64(0x68);},'onEvaluationComplete':_0x2282f2=>{const _0x1876f6=_0x51c87c,_0x37143a=formatElapsed(_0x2282f2);console[_0x1876f6(0xc4)](_0x1876f6(0xd7)+a5_0x300f74[_0x1876f6(0xd2)]('✓')+'\x20('+_0x37143a+')');}});_0x31f92a['stop'](),_0x14cda8['push'](_0x2c8cb3),_0x34c7e1['push'](_0x1ae4ed);if(_0x2c8cb3['status']===_0x51c87c(0xac))console['log'](a5_0x300f74[_0x51c87c(0xd2)](_0x51c87c(0xe3)+_0x2c8cb3[_0x51c87c(0xda)]));else _0x2c8cb3[_0x51c87c(0xa3)]===_0x51c87c(0xca)?console[_0x51c87c(0xc4)](a5_0x300f74['red'](_0x51c87c(0xa4)+_0x2c8cb3[_0x51c87c(0xda)])):console['log'](a5_0x300f74[_0x51c87c(0x7a)](_0x51c87c(0xa5)+_0x2c8cb3[_0x51c87c(0xda)]));_0x2c8cb3['conversation_url']&&console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x70)]('Conversation\x20URL:\x20'+_0x2c8cb3['conversation_url'])),console[_0x51c87c(0xc4)]();}catch(_0x39f1f6){_0x31f92a['stop']();const _0x4a7af9=_0x39f1f6 instanceof Error?_0x39f1f6[_0x51c87c(0xea)]:String(_0x39f1f6);console[_0x51c87c(0xc4)](a5_0x300f74[_0x51c87c(0x7a)](_0x51c87c(0xa5)+_0x4a7af9)),console[_0x51c87c(0xc4)](),_0x14cda8[_0x51c87c(0xd4)]({'name':_0x2efa18[_0x51c87c(0xad)],'status':'ERROR','reason':_0x4a7af9,'timestamp':new Date()[_0x51c87c(0x95)](),'duration_ms':0x0});}}const _0xe41957=Date[_0x51c87c(0xc1)]()-_0x5f69f8,_0x51ba5f=_0x14cda8[_0x51c87c(0xce)](_0x468b8f=>_0x468b8f[_0x51c87c(0xa3)]===_0x51c87c(0xac))[_0x51c87c(0xb8)],_0x1ef35e=_0x14cda8[_0x51c87c(0xce)](_0x2a052a=>_0x2a052a[_0x51c87c(0xa3)]===_0x51c87c(0xca))[_0x51c87c(0xb8)],_0x3a2f0d=_0x14cda8[_0x51c87c(0xce)](_0x477413=>_0x477413[_0x51c87c(0xa3)]==='ERROR')[_0x51c87c(0xb8)];console[_0x51c87c(0xc4)]('━'[_0x51c87c(0x67)](0x3c)),console['log'](_0x51c87c(0xe5)),console['log']('━'['repeat'](0x3c)),console['log']('Total:\x20\x20\x20\x20'+_0x14cda8[_0x51c87c(0xb8)]),console['log']('Passed:\x20\x20\x20'+a5_0x300f74['green'](_0x51ba5f)),console[_0x51c87c(0xc4)]('Failed:\x20\x20\x20'+a5_0x300f74[_0x51c87c(0x7a)](_0x1ef35e));_0x3a2f0d>0x0&&console[_0x51c87c(0xc4)](_0x51c87c(0xd1)+a5_0x300f74[_0x51c87c(0x7a)](_0x3a2f0d));console['log'](_0x51c87c(0xcc)+formatElapsed(_0xe41957)),console[_0x51c87c(0xc4)]('━'[_0x51c87c(0x67)](0x3c));const _0xa2340a=_0x14cda8['filter'](_0x4488c8=>_0x4488c8[_0x51c87c(0xa3)]!=='PASS');if(_0xa2340a[_0x51c87c(0xb8)]>0x0){console[_0x51c87c(0xc4)](),console[_0x51c87c(0xc4)](_0x51c87c(0xdc));for(const _0xbb5874 of _0xa2340a){const _0xd1f8f2=a5_0x300f74['red']('✗'),_0x577700=_0xbb5874[_0x51c87c(0xda)]['length']>0x32?_0xbb5874[_0x51c87c(0xda)][_0x51c87c(0x74)](0x0,0x32)+'...':_0xbb5874[_0x51c87c(0xda)];console[_0x51c87c(0xc4)]('\x20\x20'+_0xd1f8f2+'\x20'+_0xbb5874['name']+':\x20'+_0x577700);}}const _0x1dba30={'summary':{'total':_0x14cda8['length'],'passed':_0x51ba5f,'failed':_0x1ef35e,'errors':_0x3a2f0d>0x0?_0x3a2f0d:undefined,'duration_ms':_0xe41957},'tests':_0x14cda8,'agent':{'project':_0x21dad2[_0x51c87c(0x94)],'name':_0x21dad2['agentName'],'site':_0x5089cf},'timestamp':new Date(_0x5f69f8)[_0x51c87c(0x95)]()};try{const _0x34069e=buildCachedTestRun(_0x34c7e1,{'site':_0x5089cf,'projectId':_0x4f463c,'projectName':_0x21dad2[_0x51c87c(0x94)],'agentId':_0x1cb256,'agentName':_0x21dad2[_0x51c87c(0x87)],'testYmlPath':a5_0x177f6e[_0x51c87c(0xf7)](_0x21dad2[_0x51c87c(0xf2)])});saveLastTestRun(_0x34069e);}catch{}if(_0xd50ebe!==_0x51c87c(0xe6)||_0x218eb0){const _0x2d0a7b=formatResults(_0x1dba30,_0xd50ebe);if(_0x218eb0)try{a5_0x21de67[_0x51c87c(0x8a)](_0x218eb0,_0x2d0a7b,'utf-8'),console['log'](),console[_0x51c87c(0xc4)](a5_0x300f74['dim'](_0x51c87c(0x9e)+_0x218eb0));}catch(_0x33f9e3){return console[_0x51c87c(0xc4)](),console[_0x51c87c(0xc4)](a5_0x300f74['red']('Error\x20writing\x20output\x20file:\x20'+_0x33f9e3)),0x1;}else console[_0x51c87c(0xc4)](),console[_0x51c87c(0xc4)](_0x2d0a7b);}return _0xa2340a[_0x51c87c(0xb8)]>0x0?0x1:0x0;}async[a5_0x39835e(0xe8)](_0x3a85b5,_0x3affae){const _0x27970e=a5_0x39835e,{options:_0x330512,tdx:_0x5d32e4}=_0x3a85b5,{definition:_0x409138,agentInfo:_0x203879,outputFormat:_0x7f4cfd,outputFile:_0x311f3c}=_0x3affae,_0x3bb1c0=_0x330512[_0x27970e(0xae)],_0x5612e8=loadLastTestRun();if(!_0x5612e8)return console['log'](a5_0x300f74[_0x27970e(0x7a)]('Error:\x20No\x20previous\x20test\x20run\x20found.')),console['log'](a5_0x300f74[_0x27970e(0x70)](_0x27970e(0xe9))),0x1;if(_0x5612e8['agent']['agentName']!==_0x203879[_0x27970e(0x87)])return console[_0x27970e(0xc4)](a5_0x300f74[_0x27970e(0x7a)](_0x27970e(0x88)+_0x5612e8[_0x27970e(0x92)]['agentName']+'\x22,\x20but\x20test.yml\x20is\x20for\x20agent\x20\x22'+_0x203879[_0x27970e(0x87)]+'\x22.')),console[_0x27970e(0xc4)](a5_0x300f74['dim'](_0x27970e(0xaa))),0x1;const _0x15396f=new Set(_0x5612e8[_0x27970e(0xc0)][_0x27970e(0xef)](_0x265b5d=>_0x265b5d['testName'])),_0x13fd15=_0x409138[_0x27970e(0xc7)]['filter'](_0xe5e64d=>!_0x15396f[_0x27970e(0xcf)](_0xe5e64d[_0x27970e(0xad)]));if(_0x13fd15['length']>0x0&&_0x5612e8[_0x27970e(0xae)]!==_0x3bb1c0)return console[_0x27970e(0xc4)](a5_0x300f74[_0x27970e(0x7a)]('Error:\x20Cannot\x20execute\x20new\x20tests\x20-\x20site\x20mismatch.')),console[_0x27970e(0xc4)](a5_0x300f74[_0x27970e(0x70)](_0x27970e(0xf4)+_0x5612e8[_0x27970e(0xae)]+_0x27970e(0xf6)+_0x3bb1c0+'\x22.')),console['log'](a5_0x300f74[_0x27970e(0x70)](_0x27970e(0x71)+_0x5612e8['site']+_0x27970e(0x9c))),0x1;const _0x3567e8=_0x409138[_0x27970e(0xc7)][_0x27970e(0xce)](_0x41712d=>_0x15396f['has'](_0x41712d[_0x27970e(0xad)])),_0x365de0=_0x13fd15;let _0x2a1648;try{_0x2a1648=await setupEvaluatorAgent(_0x5d32e4['llm'],_0x330512['verbose']);}catch(_0x47ece5){const _0x4efb86=_0x47ece5 instanceof Error?_0x47ece5[_0x27970e(0xea)]:String(_0x47ece5);return console[_0x27970e(0xc4)](a5_0x300f74[_0x27970e(0x7a)](_0x27970e(0xcd)+_0x4efb86)),0x1;}console[_0x27970e(0xc4)](a5_0x300f74['cyan']('Re-evaluating\x20cached\x20test\x20run...')),console[_0x27970e(0xc4)]('Cached\x20run\x20from:\x20'+a5_0x300f74[_0x27970e(0xcb)](_0x5612e8[_0x27970e(0xd3)])),console[_0x27970e(0xc4)](_0x27970e(0xed)+a5_0x300f74[_0x27970e(0xcb)](_0x5612e8['agent']['projectName']+'/'+_0x5612e8[_0x27970e(0x92)][_0x27970e(0x87)]));_0x365de0[_0x27970e(0xb8)]>0x0&&console[_0x27970e(0xc4)](_0x27970e(0x9b)+a5_0x300f74[_0x27970e(0x6c)](_0x365de0[_0x27970e(0xb8)]));console[_0x27970e(0xc4)]();const _0x375f3e=[],_0x402708=Date[_0x27970e(0xc1)](),_0xd2d5cb=createCommandSpinner('Re-evaluating...');if(_0x3567e8['length']>0x0)try{const _0x4814b7=await reevaluateFromCache(_0x5d32e4[_0x27970e(0x69)],_0x5612e8,{'tests':_0x3567e8},{'evaluatorId':_0x2a1648,'onTestStart':(_0x2b7d17,_0x24bab2,_0x32bc8b)=>{const _0x3569ac=_0x27970e;_0xd2d5cb['text']='Re-evaluating\x20'+(_0x24bab2+0x1)+'/'+_0x32bc8b+':\x20'+_0x2b7d17+'...';if(!_0xd2d5cb['isSpinning'])_0xd2d5cb[_0x3569ac(0xb5)]();},'onTestComplete':(_0x2dc9b3,_0x4b3b11)=>{const _0x3a5f97=_0x27970e;_0xd2d5cb[_0x3a5f97(0xf5)]();if(_0x4b3b11[_0x3a5f97(0xa3)]===_0x3a5f97(0xac))console[_0x3a5f97(0xc4)](a5_0x300f74['green']('✓\x20PASS:\x20'+_0x2dc9b3)+a5_0x300f74[_0x3a5f97(0x70)](_0x3a5f97(0x78)));else _0x4b3b11[_0x3a5f97(0xa3)]===_0x3a5f97(0xca)?console[_0x3a5f97(0xc4)](a5_0x300f74[_0x3a5f97(0x7a)]('✗\x20FAIL:\x20'+_0x2dc9b3+_0x3a5f97(0x97)+_0x4b3b11[_0x3a5f97(0xda)])+a5_0x300f74[_0x3a5f97(0x70)](_0x3a5f97(0x78))):console[_0x3a5f97(0xc4)](a5_0x300f74[_0x3a5f97(0x7a)](_0x3a5f97(0xa5)+_0x2dc9b3+_0x3a5f97(0x97)+_0x4b3b11[_0x3a5f97(0xda)]));_0x4b3b11['conversation_url']&&console[_0x3a5f97(0xc4)](a5_0x300f74[_0x3a5f97(0x70)](_0x3a5f97(0xa0)+_0x4b3b11[_0x3a5f97(0xa6)])),_0x375f3e[_0x3a5f97(0xd4)](_0x4b3b11);},'onTestSkipped':(_0xee9a14,_0x270655)=>{const _0x5b2d26=_0x27970e;_0xd2d5cb[_0x5b2d26(0xf5)](),console[_0x5b2d26(0xc4)](a5_0x300f74[_0x5b2d26(0x6c)](_0x5b2d26(0xeb)+_0xee9a14+'\x20-\x20'+_0x270655));}});for(const _0x33c9b3 of _0x4814b7){!_0x375f3e[_0x27970e(0xb2)](_0x2d4e34=>_0x2d4e34[_0x27970e(0xad)]===_0x33c9b3[_0x27970e(0xad)])&&_0x375f3e[_0x27970e(0xd4)](_0x33c9b3);}}catch(_0x117c2e){_0xd2d5cb['stop']();const _0x26a0fc=_0x117c2e instanceof Error?_0x117c2e[_0x27970e(0xea)]:String(_0x117c2e);return console[_0x27970e(0xc4)](a5_0x300f74[_0x27970e(0x7a)](_0x27970e(0x96)+_0x26a0fc)),0x1;}_0xd2d5cb[_0x27970e(0xf5)]();if(_0x365de0[_0x27970e(0xb8)]>0x0){console['log'](),console[_0x27970e(0xc4)](a5_0x300f74['cyan'](_0x27970e(0x6f)));const {projectId:_0x12b5f9,agentId:_0x24ba8c}=_0x5612e8[_0x27970e(0x92)];for(const _0x17f38c of _0x365de0){console[_0x27970e(0xc4)](_0x27970e(0x85)+a5_0x300f74[_0x27970e(0xcb)](_0x17f38c[_0x27970e(0xad)]));const _0xcb6fa2=createCommandSpinner('Round\x201/'+_0x17f38c[_0x27970e(0xc5)][_0x27970e(0xb8)]+':\x20Sending\x20user\x20input...');_0xcb6fa2['start']();try{const {result:_0x186753}=await runTest(_0x5d32e4[_0x27970e(0x69)],_0x17f38c,{'agentId':_0x24ba8c,'projectId':_0x12b5f9,'site':_0x5612e8[_0x27970e(0xae)],'noEval':![],'evaluatorId':_0x2a1648,'onRoundStart':(_0x1e0ce3,_0x24fd5a)=>{const _0x279f70=_0x27970e;_0xcb6fa2[_0x279f70(0x66)]=_0x279f70(0xe7)+(_0x1e0ce3+0x1)+'/'+_0x24fd5a+_0x279f70(0xc3);},'onRoundComplete':(_0x531547,_0x26ba7b,_0x3d5b09)=>{const _0xd926b0=_0x27970e,_0xbf9350=formatElapsed(_0x26ba7b);_0x3d5b09?console[_0xd926b0(0xc4)](_0xd926b0(0xd8)+(_0x531547+0x1)+'/'+_0x17f38c['rounds'][_0xd926b0(0xb8)]+'...\x20'+a5_0x300f74[_0xd926b0(0xd2)]('✓')+'\x20('+_0xbf9350+')'):console[_0xd926b0(0xc4)](_0xd926b0(0xd8)+(_0x531547+0x1)+'/'+_0x17f38c[_0xd926b0(0xc5)][_0xd926b0(0xb8)]+_0xd926b0(0x7d)+a5_0x300f74['red']('✗'));},'onEvaluationStart':()=>{_0xcb6fa2['text']='Evaluating\x20response...';},'onEvaluationComplete':_0x16faff=>{const _0x207bbe=formatElapsed(_0x16faff);console['log']('\x20\x20Evaluating...\x20'+a5_0x300f74['green']('✓')+'\x20('+_0x207bbe+')');}});_0xcb6fa2['stop'](),_0x375f3e['push'](_0x186753);if(_0x186753['status']===_0x27970e(0xac))console['log'](a5_0x300f74['green'](_0x27970e(0xe3)+_0x186753[_0x27970e(0xda)])+a5_0x300f74[_0x27970e(0x70)](_0x27970e(0xaf)));else _0x186753[_0x27970e(0xa3)]===_0x27970e(0xca)?console[_0x27970e(0xc4)](a5_0x300f74[_0x27970e(0x7a)]('✗\x20FAIL:\x20'+_0x186753[_0x27970e(0xda)])+a5_0x300f74[_0x27970e(0x70)](_0x27970e(0xaf))):console[_0x27970e(0xc4)](a5_0x300f74[_0x27970e(0x7a)]('✗\x20ERROR:\x20'+_0x186753[_0x27970e(0xda)]));_0x186753[_0x27970e(0xa6)]&&console['log'](a5_0x300f74[_0x27970e(0x70)](_0x27970e(0xa0)+_0x186753[_0x27970e(0xa6)]));}catch(_0x362710){_0xcb6fa2['stop']();const _0x4f9ee2=_0x362710 instanceof Error?_0x362710['message']:String(_0x362710);console[_0x27970e(0xc4)](a5_0x300f74[_0x27970e(0x7a)]('✗\x20ERROR:\x20'+_0x4f9ee2)),_0x375f3e[_0x27970e(0xd4)]({'name':_0x17f38c['name'],'status':'ERROR','reason':_0x4f9ee2,'timestamp':new Date()[_0x27970e(0x95)](),'duration_ms':0x0});}}}console['log']();const _0x2bc1cb=Date['now']()-_0x402708,_0x3d30ad=_0x375f3e[_0x27970e(0xce)](_0x58657e=>_0x58657e[_0x27970e(0xa3)]===_0x27970e(0xac))['length'],_0x412d80=_0x375f3e[_0x27970e(0xce)](_0x11f25a=>_0x11f25a[_0x27970e(0xa3)]===_0x27970e(0xca))[_0x27970e(0xb8)],_0x435193=_0x375f3e[_0x27970e(0xce)](_0x54bb53=>_0x54bb53[_0x27970e(0xa3)]==='ERROR')[_0x27970e(0xb8)];console[_0x27970e(0xc4)]('━'[_0x27970e(0x67)](0x3c)),console['log'](_0x27970e(0xb4)),console[_0x27970e(0xc4)]('━'['repeat'](0x3c)),console[_0x27970e(0xc4)](_0x27970e(0x9a)+_0x375f3e['length']),console[_0x27970e(0xc4)]('Passed:\x20\x20\x20'+a5_0x300f74[_0x27970e(0xd2)](_0x3d30ad)),console['log'](_0x27970e(0x9f)+a5_0x300f74[_0x27970e(0x7a)](_0x412d80));_0x435193>0x0&&console[_0x27970e(0xc4)](_0x27970e(0xd1)+a5_0x300f74['red'](_0x435193));console[_0x27970e(0xc4)]('Duration:\x20'+formatElapsed(_0x2bc1cb)),console[_0x27970e(0xc4)]('━'[_0x27970e(0x67)](0x3c));const _0x1ddb57={'summary':{'total':_0x375f3e[_0x27970e(0xb8)],'passed':_0x3d30ad,'failed':_0x412d80,'errors':_0x435193>0x0?_0x435193:undefined,'duration_ms':_0x2bc1cb},'tests':_0x375f3e,'agent':{'project':_0x203879['projectName'],'name':_0x203879[_0x27970e(0x87)],'site':_0x3bb1c0},'timestamp':new Date(_0x402708)[_0x27970e(0x95)]()};if(_0x7f4cfd!==_0x27970e(0xe6)||_0x311f3c){const _0x35d084=formatResults(_0x1ddb57,_0x7f4cfd);if(_0x311f3c)try{a5_0x21de67[_0x27970e(0x8a)](_0x311f3c,_0x35d084,_0x27970e(0x90)),console['log'](),console[_0x27970e(0xc4)](a5_0x300f74[_0x27970e(0x70)](_0x27970e(0x9e)+_0x311f3c));}catch(_0x53e21e){return console[_0x27970e(0xc4)](),console['log'](a5_0x300f74[_0x27970e(0x7a)](_0x27970e(0x6e)+_0x53e21e)),0x1;}else console[_0x27970e(0xc4)](),console[_0x27970e(0xc4)](_0x35d084);}const _0x4a8382=_0x375f3e['filter'](_0x30cc4b=>_0x30cc4b['status']!=='PASS');return _0x4a8382[_0x27970e(0xb8)]>0x0?0x1:0x0;}}function a5_0x5454(){const _0x133f51=['stop','\x22,\x20but\x20current\x20site\x20is\x20\x22','resolve','llmProject','forEach','Tests\x20found:\x20','✗\x20ERROR:\x20Agent\x20not\x20found:\x20','\x20\x20Site:\x20','text','repeat','Evaluating\x20response...','llm','29289rGAGOy','Project\x20path:\x20','yellow','verbose','Error\x20writing\x20output\x20file:\x20','Executing\x20new\x20tests...','dim','Either\x20switch\x20to\x20the\x20\x22','41039944GGKzrh','504hEyOFF','substring','\x27\x20to\x20create\x20the\x20folder\x20structure.','Available\x20tests:\x20','reeval','\x20(cached)','trim','red','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20project\x20\x22','source','...\x20','No\x20tests\x20have\x20tags\x20defined.','resolveAgentId','existsSync','multiple_agents','round','\x20\x20tdx\x20agent\x20test\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20(requires\x20context\x20or\x20tdx.json)','description','Running:\x20','tags','agentName','Error:\x20Cached\x20run\x20is\x20for\x20agent\x20\x22','jsonl','writeFileSync','context','dryRun','Usage:','478cVZJUX','6eDfiPc','utf-8','Available\x20tags:\x20','agent','resolveProjectId','projectName','toISOString','✗\x20ERROR:\x20Re-evaluation\x20failed:\x20','\x20-\x20','8102024tjlhjs','11861952CGWITy','Total:\x20\x20\x20\x20','New\x20tests\x20to\x20execute:\x20','\x22\x20site\x20or\x20run\x20a\x20fresh\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20cache.','eval','Output\x20written\x20to:\x20','Failed:\x20\x20\x20','\x20\x20Conversation:\x20','2693qLZMoG','Test\x20Configuration:','status','✗\x20FAIL:\x20','✗\x20ERROR:\x20','conversation_url','no_local_folder','\x20\x20-\x20','\x22:\x20','Run\x20`tdx\x20agent\x20test`\x20to\x20generate\x20new\x20conversations\x20for\x20this\x20agent.','Using\x20agent:\x20','PASS','name','site','\x20(new)','tsv','test.yml','find','Set\x20context\x20with:\x20tdx\x20use\x20llm_project\x20<name>','Re-evaluation\x20Summary','start','toLowerCase','execute','length','No\x20tests\x20found\x20matching:\x20','No\x20test.yml\x20found\x20in\x20any\x20agent\x20under\x20project\x20\x22','10730bHYppp','Test\x20','\x20\x20tdx\x20agent\x20test\x20<path>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20tests\x20from\x20path','Running\x20agent\x20tests...','Run\x20tests\x20for\x20an\x20LLM\x20agent','conversations','now','\x20\x20Project:\x20',':\x20Sending\x20user\x20input...','log','rounds','json','tests','404','add','FAIL','white','Duration:\x20','✗\x20ERROR:\x20Failed\x20to\x20set\x20up\x20evaluator:\x20','filter','has','Multiple\x20agents\x20with\x20tests\x20found\x20in\x20project\x20\x22','Errors:\x20\x20\x20','green','timestamp','push','agent:test','7623rizkAJ','\x20\x20Evaluating...\x20','\x20\x20Round\x20','not\x20found','reason','join','Failed\x20Tests:','Create\x20a\x20test.yml\x20in\x20an\x20agent\x20directory\x20to\x20run\x20evaluations.','No\x20tests\x20found\x20with\x20tags:\x20','/<agent-name>','found','\x20\x20Agent:\x20','✗\x20ERROR:\x20Failed\x20to\x20resolve\x20agent\x20\x22','✓\x20PASS:\x20','includes','Test\x20Summary','table','Round\x20','executeReeval','Run\x20`tdx\x20agent\x20test`\x20first\x20to\x20generate\x20conversations.','message','⚠\x20SKIPPED:\x20','size','Agent:\x20','8531330imWyDM','map','Round\x201/','Error:\x20Cannot\x20use\x20--reeval\x20with\x20--no-eval','testYmlPath','split','Cached\x20run\x20is\x20from\x20site\x20\x22'];a5_0x5454=function(){return _0x133f51;};return a5_0x5454();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a6_0x1028c2=a6_0x3445;(function(_0xa365ec,_0x3a766e){const _0x59acbf=a6_0x3445,_0x2a0831=_0xa365ec();while(!![]){try{const _0x549997=parseInt(_0x59acbf(0x9b))/0x1*(-parseInt(_0x59acbf(0x87))/0x2)+parseInt(_0x59acbf(0xaa))/0x3+-parseInt(_0x59acbf(0x73))/0x4*(-parseInt(_0x59acbf(0x9f))/0x5)+parseInt(_0x59acbf(0x8d))/0x6*(parseInt(_0x59acbf(0x97))/0x7)+-parseInt(_0x59acbf(0x91))/0x8*(-parseInt(_0x59acbf(0xa6))/0x9)+-parseInt(_0x59acbf(0x71))/0xa*(parseInt(_0x59acbf(0x81))/0xb)+-parseInt(_0x59acbf(0x7c))/0xc;if(_0x549997===_0x3a766e)break;else _0x2a0831['push'](_0x2a0831['shift']());}catch(_0x4ec64e){_0x2a0831['push'](_0x2a0831['shift']());}}}(a6_0x4027,0x5172c));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../sdk/types/index.js';import{resolveSite}from'../core/config.js';function a6_0x4027(){const _0x15b77a=['3889452sshWNu','type','body','authorization','GET','5313DvuZPC','data','toUpperCase','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','Results\x20saved\x20to\x20','workflow','93586DxCViS','method','headers','substring','output','llm-proxy','3159258PZiStC','Invalid\x20HTTP\x20method:\x20','POST','Invalid\x20header\x20format:\x20\x22','8SivYGd','error','DELETE','.\x20Valid\x20types:\x20','toLowerCase','x-auth-token','7RQcpjV','api','entries','name','11SaMdwJ','Endpoint\x20must\x20start\x20with\x20/:\x20','<\x20HTTP/1.1\x20','PUT','65FqcIVU','trino','length','trim','execute','cdp','header','3173535EdVyOZ','request','join','file','156342pJlEbA','x-trino-user','PATCH','includes','status','x-xsrf-token','Invalid\x20API\x20type:\x20','description','Error:\x20','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','keys','log','3340pDOXoI','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','123848vZwpeR','color','verbose','isArray','readBodyFromFile','\x0aStack\x20trace:\x0a','has','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','cookie'];a6_0x4027=function(){return _0x15b77a;};return a6_0x4027();}function a6_0x3445(_0x1e5122,_0x204b22){_0x1e5122=_0x1e5122-0x68;const _0x402764=a6_0x4027();let _0x344541=_0x402764[_0x1e5122];return _0x344541;}import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a6_0x1028c2(0x7f),'proxy-authorization',a6_0x1028c2(0x7b),'set-cookie','set-cookie2',a6_0x1028c2(0x6a),a6_0x1028c2(0x96),a6_0x1028c2(0xab)]);function isSensitiveHeader(_0x50044f){const _0x4ae771=a6_0x1028c2;return SENSITIVE_HEADERS[_0x4ae771(0x79)](_0x50044f[_0x4ae771(0x95)]());}function parseHeader(_0x19abc8){const _0x5247f8=a6_0x1028c2,_0x55a0f1=_0x19abc8['indexOf'](':');if(_0x55a0f1===-0x1)throw new Error(_0x5247f8(0x90)+_0x19abc8+'\x22.\x20'+'Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22');const _0x4a6f2d=_0x19abc8[_0x5247f8(0x8a)](0x0,_0x55a0f1)[_0x5247f8(0xa2)](),_0x28d6be=_0x19abc8[_0x5247f8(0x8a)](_0x55a0f1+0x1)['trim']();if(!_0x4a6f2d)throw new Error(_0x5247f8(0x84)+_0x19abc8+'\x22');return[_0x4a6f2d,_0x28d6be];}export class ApiCommand extends BaseCommand{[a6_0x1028c2(0x9a)]=a6_0x1028c2(0x98);[a6_0x1028c2(0x6c)]=a6_0x1028c2(0x6e);['validate'](_0x4cb529){const _0x467ba2=a6_0x1028c2,{args:_0x281244,options:_0x158b14}=_0x4cb529,_0x52f3b8=_0x158b14;if(_0x281244[_0x467ba2(0xa1)]===0x0)return _0x467ba2(0x72);const _0x142b69=_0x281244[0x0];if(!_0x142b69['startsWith']('/'))return _0x467ba2(0x9c)+_0x142b69;const _0x4dd955=_0x52f3b8['data'],_0x5dcb43=_0x52f3b8[_0x467ba2(0xa9)];if(_0x4dd955&&_0x5dcb43)return _0x467ba2(0x7a);const _0x90700e=_0x52f3b8['method']||_0x467ba2(0x80),_0x6a3f25=[_0x467ba2(0x80),_0x467ba2(0x8f),_0x467ba2(0x9e),_0x467ba2(0x93),_0x467ba2(0xac)];if(!_0x6a3f25[_0x467ba2(0x68)](_0x90700e[_0x467ba2(0x83)]()))return _0x467ba2(0x8e)+_0x90700e+'.\x20Valid\x20methods:\x20'+_0x6a3f25['join'](',\x20');const _0x30bd9e=_0x52f3b8[_0x467ba2(0x7d)]||'td',_0x5e79ea=['td',_0x467ba2(0xa4),_0x467ba2(0x86),_0x467ba2(0xa0),'llm',_0x467ba2(0x8c)];if(!_0x5e79ea[_0x467ba2(0x68)](_0x30bd9e))return _0x467ba2(0x6b)+_0x30bd9e+_0x467ba2(0x94)+_0x5e79ea[_0x467ba2(0xa8)](',\x20');return undefined;}async[a6_0x1028c2(0xa3)](_0x1a72ac){const _0x10cb31=a6_0x1028c2,{options:_0x494b0a,args:_0x362741,tdx:_0x23d7a8}=_0x1a72ac,_0x20bb03=_0x494b0a,_0x182c2c=_0x362741[0x0],_0x12b691=(_0x20bb03[_0x10cb31(0x88)]||_0x10cb31(0x80))[_0x10cb31(0x83)](),_0x361986=_0x20bb03[_0x10cb31(0x82)],_0x189d05=_0x20bb03[_0x10cb31(0xa9)],_0x3d8b9e=_0x20bb03[_0x10cb31(0xa5)],_0x1d1223=_0x20bb03[_0x10cb31(0x7d)]||'td';try{const _0x20cf72={};if(_0x3d8b9e){const _0x1645ff=Array[_0x10cb31(0x76)](_0x3d8b9e)?_0x3d8b9e:[_0x3d8b9e];for(const _0x2b2a45 of _0x1645ff){const [_0xe938be,_0x1a4cc4]=parseHeader(_0x2b2a45);_0x20cf72[_0xe938be]=_0x1a4cc4;}}let _0xbc22d4;if(_0x361986)_0xbc22d4=_0x361986;else{if(_0x189d05)try{_0xbc22d4=RawAPI[_0x10cb31(0x77)](_0x189d05);}catch(_0x2e791c){return console[_0x10cb31(0x92)]('Error:\x20'+(_0x2e791c instanceof Error?_0x2e791c['message']:String(_0x2e791c))),0x1;}}const _0x34b0eb={'method':_0x12b691,'apiType':_0x1d1223,'includeHeaders':_0x494b0a['verbose']};_0xbc22d4&&(_0x34b0eb[_0x10cb31(0x7e)]=_0xbc22d4);Object[_0x10cb31(0x6f)](_0x20cf72)[_0x10cb31(0xa1)]>0x0&&(_0x34b0eb['headers']=_0x20cf72);if(_0x494b0a[_0x10cb31(0x75)]){const _0x8bc111=resolveSite(_0x494b0a['site']),_0xc5a46a=getEndpoint(_0x8bc111,_0x1d1223),_0x1ef8ef=''+_0xc5a46a+_0x182c2c;console[_0x10cb31(0x92)]('>\x20'+_0x12b691+'\x20'+_0x1ef8ef);const _0x361277=getAuthHeaders(_0x8bc111),_0x3eae2f={..._0x361277,..._0x20cf72};for(const [_0x2943ee,_0x16bd73]of Object[_0x10cb31(0x99)](_0x3eae2f)){!isSensitiveHeader(_0x2943ee)&&console[_0x10cb31(0x92)]('>\x20'+_0x2943ee+':\x20'+_0x16bd73);}_0xbc22d4&&console['error']('>'),console['error']('');}const _0xa2fa55=await _0x23d7a8[_0x10cb31(0x98)][_0x10cb31(0xa7)](_0x182c2c,_0x34b0eb);if(_0x494b0a[_0x10cb31(0x75)]&&_0xa2fa55[_0x10cb31(0x89)]){console[_0x10cb31(0x92)](_0x10cb31(0x9d)+_0xa2fa55[_0x10cb31(0x69)]);for(const [_0x2feffb,_0x26eb11]of Object[_0x10cb31(0x99)](_0xa2fa55['headers'])){!isSensitiveHeader(_0x2feffb)&&console[_0x10cb31(0x92)]('<\x20'+_0x2feffb+':\x20'+_0x26eb11);}console[_0x10cb31(0x92)]('');}const _0x410d9c=Boolean(_0x494b0a[_0x10cb31(0x8b)]),_0x33b7f5={'color':_0x494b0a[_0x10cb31(0x74)],'noColor':_0x494b0a['noColor']||_0x410d9c&&!_0x494b0a[_0x10cb31(0x74)]},_0x303495=colorizeJSON(_0xa2fa55[_0x10cb31(0x82)],_0x33b7f5);return _0x494b0a[_0x10cb31(0x8b)]?(writeFileSync(_0x494b0a[_0x10cb31(0x8b)],_0x303495),console[_0x10cb31(0x92)](_0x10cb31(0x85)+_0x494b0a[_0x10cb31(0x8b)])):console[_0x10cb31(0x70)](_0x303495),0x0;}catch(_0x576b8c){return _0x576b8c instanceof Error?(console['error'](_0x10cb31(0x6d)+_0x576b8c['message']),_0x494b0a[_0x10cb31(0x75)]&&_0x576b8c['stack']&&console['error'](_0x10cb31(0x78)+_0x576b8c['stack'])):console[_0x10cb31(0x92)](_0x10cb31(0x6d)+String(_0x576b8c)),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a7_0x4c0923=a7_0x196d;(function(_0xa23a14,_0x1c1f23){const _0x1bbad3=a7_0x196d,_0x421c35=_0xa23a14();while(!![]){try{const _0x221a9b=parseInt(_0x1bbad3(0xa8))/0x1*(-parseInt(_0x1bbad3(0xa5))/0x2)+-parseInt(_0x1bbad3(0xbf))/0x3+parseInt(_0x1bbad3(0xaa))/0x4*(-parseInt(_0x1bbad3(0xc6))/0x5)+parseInt(_0x1bbad3(0xc0))/0x6*(-parseInt(_0x1bbad3(0xd7))/0x7)+parseInt(_0x1bbad3(0xa9))/0x8*(-parseInt(_0x1bbad3(0xa4))/0x9)+-parseInt(_0x1bbad3(0x9f))/0xa*(-parseInt(_0x1bbad3(0xd5))/0xb)+-parseInt(_0x1bbad3(0xdd))/0xc*(-parseInt(_0x1bbad3(0xea))/0xd);if(_0x221a9b===_0x1c1f23)break;else _0x421c35['push'](_0x421c35['shift']());}catch(_0x58b77f){_0x421c35['push'](_0x421c35['shift']());}}}(a7_0x3b89,0x3e4aa));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig,saveDefaultSiteToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import{buildSiteChoices}from'../core/constants.js';import a7_0x203b87 from'prompts';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';function a7_0x196d(_0xf29f1d,_0x57e2a1){_0xf29f1d=_0xf29f1d-0x9c;const _0x3b89ef=a7_0x3b89();let _0x196d8c=_0x3b89ef[_0xf29f1d];return _0x196d8c;}import{LogLevel}from'../utils/tdx-logger.js';import a7_0x423afa from'chalk';export class AuthSetupCommand extends BaseCommand{[a7_0x4c0923(0xcd)]=a7_0x4c0923(0xe7);['description']=a7_0x4c0923(0xbb);async[a7_0x4c0923(0xaf)](_0x2b894d){const _0x44a4b1=a7_0x4c0923,{options:_0x108023}=_0x2b894d,_0x5bd66e=_0x108023['profile'];console[_0x44a4b1(0xc5)](a7_0x423afa['bold'](_0x44a4b1(0xad)));const _0x5d4df8=_0x108023['site']||_0x44a4b1(0xa7),{choices:_0x3dd86d,initialIndex:_0x3ef9e1}=buildSiteChoices(_0x5d4df8),_0x29f756=_0x5bd66e?_0x44a4b1(0xdc)+_0x5bd66e+'):':_0x44a4b1(0xc3),_0x216f86=await a7_0x203b87({'type':_0x44a4b1(0xdb),'name':_0x44a4b1(0xb2),'message':_0x29f756,'choices':_0x3dd86d,'initial':_0x3ef9e1});if(!_0x216f86[_0x44a4b1(0xb2)])return console[_0x44a4b1(0xc5)]('\x0aSetup\x20cancelled'),0x1;let _0x4c65d4;if(_0x216f86['site']===_0x44a4b1(0xd3)){const _0x116601=await a7_0x203b87({'type':'text','name':'customSite','message':_0x44a4b1(0xc8),'initial':_0x44a4b1(0xa7),'validate':_0x88e058=>{const _0x225336=_0x44a4b1;if(!_0x88e058||!_0x88e058[_0x225336(0xa6)]())return _0x225336(0xe9);if(!/^[a-z0-9-]+$/[_0x225336(0xa2)](_0x88e058[_0x225336(0xa6)]()))return _0x225336(0xc1);return!![];}});if(!_0x116601['customSite'])return console[_0x44a4b1(0xc5)]('\x0aSetup\x20cancelled'),0x1;_0x4c65d4=_0x116601[_0x44a4b1(0xcf)];}else _0x4c65d4=_0x216f86[_0x44a4b1(0xb2)];const _0x12076e=resolveSite(_0x4c65d4);console['log']('Setting\x20up\x20authentication\x20for\x20site:\x20'+_0x12076e),console['log'](_0x44a4b1(0xe4)),console[_0x44a4b1(0xc5)]('\x20\x20'+getConsoleUrl(_0x12076e,_0x44a4b1(0xba)));const _0x385e39=await a7_0x203b87({'type':'password','name':_0x44a4b1(0xb4),'message':_0x44a4b1(0xb5),'validate':_0xe60f49=>{const _0x1dff75=_0x44a4b1;if(!_0xe60f49||!_0xe60f49['trim']())return _0x1dff75(0xc7);return!![];}});if(!_0x385e39[_0x44a4b1(0xb4)])return console[_0x44a4b1(0xc5)](_0x44a4b1(0xd1)),0x1;const _0x1ab50a=_0x385e39[_0x44a4b1(0xb4)];console[_0x44a4b1(0xc5)](_0x44a4b1(0xa3));try{const _0xa6eba4=TDX[_0x44a4b1(0xe5)]({'site':_0x12076e,'apiKey':_0x1ab50a[_0x44a4b1(0xa6)](),'logLevel':_0x108023[_0x44a4b1(0xb3)]??LogLevel[_0x44a4b1(0xbc)]}),_0x1c613c=await _0xa6eba4['jobs'][_0x44a4b1(0xb0)]();console[_0x44a4b1(0xc5)]('✓\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x1c613c[_0x44a4b1(0xcb)]+')');const _0x28f483=await isKeychainAvailable();_0x28f483?(await saveAPIKeyAsync(_0x1ab50a['trim'](),_0x12076e,_0x5bd66e),console['log'](_0x44a4b1(0xe1)+(_0x5bd66e?_0x44a4b1(0xd0)+_0x5bd66e+')':''))):(console[_0x44a4b1(0xdf)](a7_0x423afa[_0x44a4b1(0xd4)](_0x44a4b1(0xcc))),console['warn'](a7_0x423afa['yellow'](_0x44a4b1(0x9c))));if(_0x5bd66e){const _0x5ee3ee={'site':_0x12076e};saveProfileToUserConfig(_0x5bd66e,_0x5ee3ee),console[_0x44a4b1(0xc5)](_0x44a4b1(0xe0)+_0x5bd66e+_0x44a4b1(0xd9));}else saveDefaultSiteToUserConfig(_0x12076e),console[_0x44a4b1(0xc5)](_0x44a4b1(0xd2)+_0x12076e);const _0x1e799a=_0x5bd66e?_0x44a4b1(0xe2)+_0x5bd66e:'';return console[_0x44a4b1(0xc5)](),console[_0x44a4b1(0xc5)]('You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:'),console[_0x44a4b1(0xc5)](_0x44a4b1(0xe3)+_0x1e799a+_0x44a4b1(0xde)),console[_0x44a4b1(0xc5)](_0x44a4b1(0xe3)+_0x1e799a+_0x44a4b1(0xc4)),0x0;}catch(_0x360127){if(_0x360127 instanceof HTTPClientError&&_0x360127['status']===0x191)return printAuthError(_0x360127),0x1;return console[_0x44a4b1(0xb1)](a7_0x423afa[_0x44a4b1(0xb7)](_0x44a4b1(0x9d)+(_0x360127 instanceof Error?_0x360127[_0x44a4b1(0xd8)]:String(_0x360127)))),console['error'](_0x44a4b1(0xc9)),0x1;}}}function a7_0x3b89(){const _0x3dadc8=['apiKey','Enter\x20your\x20TD\x20API\x20key:','auth:clear','red','status','N/A','/app/mp/ak','Setup\x20API\x20key\x20authentication\x20interactively','ERROR','✓\x20API\x20key\x20removed\x20from\x20keychain','No\x20credential\x20found','878487eqimgZ','12AKKsWe','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','jobs','Select\x20your\x20Treasure\x20Data\x20site:','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','log','2020HasOlo','API\x20key\x20cannot\x20be\x20empty','Enter\x20site\x20name:','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','description','email','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','name','User:\x20','customSite','\x20(profile:\x20','\x0aSetup\x20cancelled','✓\x20Default\x20site\x20set\x20to\x20','other','yellow','12309VPYZct','System\x20keychain\x20is\x20not\x20available','74809QMIisd','message','\x27\x20registered','Name:\x20','select','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','708hzZXnH','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','warn','✓\x20Profile\x20\x27','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20--profile\x20','\x20\x20tdx','You\x20can\x20find\x20your\x20API\x20key\x20at:','create','first_name','auth:setup','auth','Site\x20name\x20cannot\x20be\x20empty','348582fMTJoY','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','✗\x20Validation\x20failed:\x20','Remove\x20API\x20key\x20from\x20system\x20keychain','1090BPFnkk','last_name','tdx:\x20auth\x20clear','test','Validating\x20API\x20key...','18CoEiwp','86FOlJWV','trim','us01','11034UvYZER','1509544aeYivq','2800AqiLRJ','No\x20API\x20key\x20found\x20in\x20keychain','bold','tdx:\x20auth\x20setup','\x20for\x20profile:\x20','execute','getUserInfo','error','site','logLevel'];a7_0x3b89=function(){return _0x3dadc8;};return a7_0x3b89();}export class AuthStatusCommand extends BaseCommand{['name']=a7_0x4c0923(0xe8);[a7_0x4c0923(0xca)]='Show\x20authentication\x20status\x20and\x20validate\x20API\x20key';async[a7_0x4c0923(0xaf)](_0x583898){const _0x289025=a7_0x4c0923,{options:_0x2d5fe5,tdx:_0xf954b5}=_0x583898,_0x508dfe=_0x2d5fe5[_0x289025(0xb2)],_0x1c74e8=_0x2d5fe5['profile'],_0x512f11=_0x1c74e8?_0x1c74e8:_0x289025(0xb9);console[_0x289025(0xc5)]('tdx\x20profile:\x20'+_0x512f11+'\x20(site:\x20'+_0x508dfe+')');const _0x267a25=await resolveAPIKeyAsync(_0x508dfe,_0x1c74e8);if(_0x267a25){const {source:_0xe8b8da,isDeprecated:_0x302dd0}=_0x267a25,_0x4f3de6='Read\x20credential\x20from\x20'+_0xe8b8da;console[_0x289025(0xc5)](_0x302dd0?a7_0x423afa['yellow'](_0x4f3de6):_0x4f3de6);}else console['log'](a7_0x423afa[_0x289025(0xd4)](_0x289025(0xbe)));try{const _0xcd5d64=await _0xf954b5[_0x289025(0xc2)][_0x289025(0xb0)]();return console[_0x289025(0xc5)](a7_0x423afa['green']('✓\x20Authentication\x20successful\x0a')),console[_0x289025(0xc5)](_0x289025(0xce)+_0xcd5d64[_0x289025(0xcb)]),(_0xcd5d64['first_name']||_0xcd5d64[_0x289025(0xa0)])&&console[_0x289025(0xc5)](_0x289025(0xda)+[_0xcd5d64[_0x289025(0xe6)],_0xcd5d64[_0x289025(0xa0)]]['filter'](Boolean)['join']('\x20')),0x0;}catch(_0x37141b){return _0x37141b instanceof HTTPClientError&&_0x37141b[_0x289025(0xb8)]===0x191?printAuthError(_0x37141b,!![],_0x1c74e8):console[_0x289025(0xb1)](a7_0x423afa['red'](_0x289025(0x9d)+(_0x37141b instanceof Error?_0x37141b[_0x289025(0xd8)]:String(_0x37141b)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a7_0x4c0923(0xcd)]=a7_0x4c0923(0xb6);[a7_0x4c0923(0xca)]=a7_0x4c0923(0x9e);async[a7_0x4c0923(0xaf)](_0xd1a833){const _0x7abd9b=a7_0x4c0923,{options:_0x132c01}=_0xd1a833,_0x182f47=_0x132c01['profile'];console[_0x7abd9b(0xc5)](a7_0x423afa[_0x7abd9b(0xac)](_0x7abd9b(0xa1)));const _0x421e24=await isKeychainAvailable();if(!_0x421e24)return console['error'](a7_0x423afa[_0x7abd9b(0xb7)](_0x7abd9b(0xd6))),0x1;const _0x15ecf5=await deleteKeychainAPIKey(_0x182f47);return _0x15ecf5?(clearCredentialCache(),console[_0x7abd9b(0xc5)](_0x7abd9b(0xbd)+(_0x182f47?_0x7abd9b(0xd0)+_0x182f47+')':'')),0x0):(console[_0x7abd9b(0xc5)](_0x7abd9b(0xab)+(_0x182f47?_0x7abd9b(0xae)+_0x182f47:'')),0x1);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a8_0x1cb6(){const _0x5b6d1a=['resolveAgentId','CHAT_NOT_FOUND','targetKnowledgeBase','done','args','startChat','chatId','type','4193IYtLLr','streamChat','10KyCwrz','new','stack','targetWebSearchTool','targetFunction','execute','content','validate','chat','Using\x20cached\x20default\x20agent:\x20','verbose','Agent\x20required.\x20Use\x20--agent\x20\x22Project/Agent\x22\x20or\x20set\x20agent\x20with\x20\x22tdx\x20use\x20agent\x22','cause','event','description','join','Resolving\x20project\x20\x27','functionName','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','Chat\x20session:\x20','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','5gnMCkQ','llm','13910268obHtKL','13GDEfjb','session\x20context','Create\x20a\x20new\x20chat\x20session','472dGFxxh','getOrCreateDefaultAgent','8424nUCIXQ','string','2401686ECjNAi','metadata','1548282SBUpFj','handleChatEvent','projectId','tool_result','404','claude-4.5-haiku','stdout','targetAgent','1644208kNZqIk','Error:\x20Cannot\x20use\x20--new\x20and\x20--chat-id\x20together','data','5421713dnugOs','includes','streamChatJsonl','stringify','name','llmProject','tool','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','3KeKhXX','options','chat-create','write','\x20\x20Cause:\x20','tool_call','agent','log','error','\x0aStack\x20trace:','\x27\x20not\x20found','--agent\x20flag','llmAgent','Using\x20agent\x20from\x20','12udLafb','site','agentId','Resolving\x20agent\x20\x27','message'];a8_0x1cb6=function(){return _0x5b6d1a;};return a8_0x1cb6();}const a8_0x17934f=a8_0x2e38;(function(_0x467656,_0x139819){const _0xf35dea=a8_0x2e38,_0xe68502=_0x467656();while(!![]){try{const _0x49eb57=-parseInt(_0xf35dea(0x127))/0x1*(parseInt(_0xf35dea(0x102))/0x2)+-parseInt(_0xf35dea(0x119))/0x3*(parseInt(_0xf35dea(0x10e))/0x4)+parseInt(_0xf35dea(0xfa))/0x5*(-parseInt(_0xf35dea(0x106))/0x6)+-parseInt(_0xf35dea(0xe3))/0x7*(-parseInt(_0xf35dea(0x100))/0x8)+parseInt(_0xf35dea(0x104))/0x9+parseInt(_0xf35dea(0xe5))/0xa*(-parseInt(_0xf35dea(0x111))/0xb)+parseInt(_0xf35dea(0xfc))/0xc*(parseInt(_0xf35dea(0xfd))/0xd);if(_0x49eb57===_0x139819)break;else _0xe68502['push'](_0xe68502['shift']());}catch(_0x33fcbc){_0xe68502['push'](_0xe68502['shift']());}}}(a8_0x1cb6,0x3cc1a));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';import{getLLMConversationUrl}from'../sdk/client/endpoints.js';function handleSDKError(_0x39ce94,_0x32cd55){const _0x52d65f=a8_0x2e38;if(_0x39ce94 instanceof SDKError)console['error']('Error:\x20'+_0x39ce94['message']),_0x32cd55[_0x52d65f(0xef)]&&(_0x39ce94[_0x52d65f(0xf1)]&&console[_0x52d65f(0x121)](_0x52d65f(0x11d)+_0x39ce94['cause']),_0x39ce94[_0x52d65f(0xe7)]&&(console[_0x52d65f(0x121)](_0x52d65f(0x122)),console[_0x52d65f(0x121)](_0x39ce94['stack'])));else throw _0x39ce94;}async function resolveAgentId(_0xbc62e7,_0x40f8b2,_0x4d6a15,_0x4011a1,_0x3c0f36){const _0x173a43=a8_0x2e38,_0x1be228=_0x40f8b2||_0x4d6a15;if(_0x1be228){const {projectName:_0x1f18d0,agentName:_0x81c12d}=parseAgentRef(_0x1be228),_0xc15212=_0x81c12d||_0x1be228,_0x16d03a=_0x81c12d?_0x1f18d0:_0x4011a1;if(!_0x16d03a)throw new Error('No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22');if(_0x3c0f36){const _0x358370=_0x40f8b2?_0x173a43(0x124):_0x173a43(0xfe);console['error'](_0x173a43(0x126)+_0x358370+':\x20'+_0x16d03a+'/'+_0xc15212);}const _0x375b7c=await withSpinner(_0x173a43(0xf5)+_0x16d03a+'\x27...',()=>_0xbc62e7[_0x173a43(0xfb)]['resolveProjectId'](_0x16d03a),{'verbose':_0x3c0f36}),_0x3b01ff=await withSpinner(_0x173a43(0x12a)+_0xc15212+'\x27...',()=>_0xbc62e7[_0x173a43(0xfb)][_0x173a43(0x12c)](_0xc15212,_0x375b7c[_0x173a43(0x110)]),{'verbose':_0x3c0f36});return _0x3b01ff[_0x173a43(0x110)];}else{const _0x4ad0d9=_0xbc62e7['llm']['getDefaultAgent']();if(_0x4ad0d9)return _0x3c0f36&&console[_0x173a43(0x121)](_0x173a43(0xee)+_0x4ad0d9[_0x173a43(0x115)]),_0x4ad0d9['id'];const _0x20319f=await withSpinner('Getting\x20default\x20agent...',()=>_0xbc62e7[_0x173a43(0xfb)][_0x173a43(0x101)](_0x173a43(0x10b),0x0),{'verbose':_0x3c0f36});return _0x20319f[_0x173a43(0x110)]['id'];}}export class ChatCommand extends BaseCommand{[a8_0x17934f(0x115)]=a8_0x17934f(0xed);[a8_0x17934f(0xf3)]=a8_0x17934f(0xf7);['validate'](_0x5a574e){const _0x34f00e=a8_0x17934f,_0x113264=_0x5a574e[_0x34f00e(0xdf)][_0x34f00e(0xf4)]('\x20');if(!_0x113264)return _0x34f00e(0x118);return undefined;}async['streamChat'](_0x564ffe,_0x18885f,_0x2a2df8,_0x255d3a,_0x6e0a13){const _0x5d79ef=a8_0x17934f;for await(const _0x4a9c80 of _0x564ffe['llm'][_0x5d79ef(0xed)](_0x18885f,{'agentId':_0x2a2df8,'chatId':_0x255d3a})){if(_0x4a9c80['type']===_0x5d79ef(0x105)){const _0x2e7169=_0x4a9c80[_0x5d79ef(0x110)]['chatId'];saveLastChatId(_0x2e7169),_0x6e0a13&&console[_0x5d79ef(0x121)](_0x5d79ef(0xf8)+_0x2e7169);}else _0x4a9c80[_0x5d79ef(0xe2)]===_0x5d79ef(0xf2)&&this[_0x5d79ef(0x107)](_0x4a9c80[_0x5d79ef(0x110)]);}}async[a8_0x17934f(0x113)](_0x5856d9,_0x5a33c1,_0x319e5c,_0x88a7a7){const _0x128d51=a8_0x17934f,_0x2e6a6c=_0x5856d9['context'][_0x128d51(0x128)];let _0x24819e=![];for await(const _0x1c6c21 of _0x5856d9[_0x128d51(0xfb)][_0x128d51(0xed)](_0x5a33c1,{'agentId':_0x319e5c,'chatId':_0x88a7a7})){if(_0x1c6c21['type']===_0x128d51(0x105)){const _0x6a0df3=_0x1c6c21[_0x128d51(0x110)];saveLastChatId(_0x6a0df3[_0x128d51(0xe1)]);const _0x3da3fb=_0x6a0df3[_0x128d51(0x108)]&&_0x6a0df3[_0x128d51(0x129)]?getLLMConversationUrl(_0x2e6a6c,_0x6a0df3['projectId'],_0x6a0df3['agentId'],_0x6a0df3[_0x128d51(0xe1)]):undefined;console[_0x128d51(0x120)](JSON[_0x128d51(0x114)]({'type':_0x128d51(0x105),'data':{'chatId':_0x6a0df3[_0x128d51(0xe1)],'agentId':_0x6a0df3['agentId'],'consoleUrl':_0x3da3fb}})),_0x24819e=!![];}else{if(_0x1c6c21['type']==='event'){!_0x24819e&&_0x88a7a7&&(console[_0x128d51(0x120)](JSON[_0x128d51(0x114)]({'type':_0x128d51(0x105),'data':{'chatId':_0x88a7a7}})),_0x24819e=!![]);const _0x12650f=_0x1c6c21[_0x128d51(0x110)];if('content'in _0x12650f)console[_0x128d51(0x120)](JSON[_0x128d51(0x114)]({'type':_0x128d51(0xeb),'data':{'content':_0x12650f[_0x128d51(0xeb)]}}));else{if(_0x128d51(0x11e)in _0x12650f){const _0x513091=_0x12650f[_0x128d51(0x11e)];console['log'](JSON[_0x128d51(0x114)]({'type':_0x128d51(0x11e),'data':{'id':_0x513091['id'],'name':_0x513091[_0x128d51(0xf6)],'target':_0x513091[_0x128d51(0xdd)]?.[_0x128d51(0x115)]||_0x513091[_0x128d51(0x10d)]?.[_0x128d51(0x115)]||_0x513091[_0x128d51(0xe8)]?.[_0x128d51(0x115)]||_0x513091[_0x128d51(0xe9)]}}));}else{if('tool'in _0x12650f)console['log'](JSON[_0x128d51(0x114)]({'type':_0x128d51(0x109),'data':{'id':_0x12650f['tool']['id'],'name':_0x12650f[_0x128d51(0x117)][_0x128d51(0xf6)],'result':typeof _0x12650f['tool'][_0x128d51(0xeb)]===_0x128d51(0x103)?_0x12650f[_0x128d51(0x117)]['content']['slice'](0x0,0x1f4):''}}));else _0x128d51(0x121)in _0x12650f&&console[_0x128d51(0x120)](JSON['stringify']({'type':'error','data':{'error':_0x12650f['error']}}));}}}}}console[_0x128d51(0x120)](JSON[_0x128d51(0x114)]({'type':_0x128d51(0xde)}));}async['execute'](_0x345523){const _0x2dfdae=a8_0x17934f,{options:_0x54a628,args:_0x525503,tdx:_0x60a863}=_0x345523,_0x1a6cb8=_0x525503[_0x2dfdae(0xf4)]('\x20'),_0x35b467=_0x54a628,_0x1152a4=_0x35b467[_0x2dfdae(0x11f)],_0x3d8b10=_0x35b467[_0x2dfdae(0x125)],_0x347d70=_0x35b467[_0x2dfdae(0x116)],_0x5d252c=_0x35b467[_0x2dfdae(0xe6)],_0x4bc0c6=_0x35b467['chatId'],_0x56a4b7=_0x35b467['stream'];if(_0x5d252c&&_0x4bc0c6)return console[_0x2dfdae(0x121)](_0x2dfdae(0x10f)),0x1;try{let _0x581eb6,_0x259e07;if(_0x4bc0c6)_0x259e07=_0x4bc0c6;else!_0x5d252c&&(_0x259e07=loadLastChatId(),_0x259e07&&_0x54a628[_0x2dfdae(0xef)]&&console['error']('Continuing\x20chat:\x20'+_0x259e07));!_0x4bc0c6&&(_0x5d252c||!_0x259e07)&&(_0x581eb6=await resolveAgentId(_0x60a863,_0x1152a4,_0x3d8b10,_0x347d70,_0x54a628[_0x2dfdae(0xef)]));const _0x27ffe5=_0x56a4b7?(_0x26abc9,_0x4f0e88,_0x28b4ba)=>this[_0x2dfdae(0x113)](_0x60a863,_0x26abc9,_0x4f0e88,_0x28b4ba):(_0x5e218b,_0xca4179,_0x51731e)=>this[_0x2dfdae(0xe4)](_0x60a863,_0x5e218b,_0xca4179,_0x51731e,_0x54a628['verbose']);try{await _0x27ffe5(_0x1a6cb8,_0x581eb6,_0x259e07);}catch(_0x2d67b4){const _0x122e4e=_0x2d67b4 instanceof SDKError&&_0x2d67b4['code']===ErrorCode[_0x2dfdae(0xdc)]||_0x2d67b4 instanceof Error&&_0x2d67b4[_0x2dfdae(0x12b)][_0x2dfdae(0x112)](_0x2dfdae(0x10a));if(_0x122e4e&&_0x4bc0c6)return console['error']('Error:\x20Chat\x20session\x20\x27'+_0x4bc0c6+_0x2dfdae(0x123)),0x1;if(_0x122e4e)_0x54a628[_0x2dfdae(0xef)]&&console[_0x2dfdae(0x121)](_0x2dfdae(0xf9)),!_0x581eb6&&(_0x581eb6=await resolveAgentId(_0x60a863,_0x1152a4,_0x3d8b10,_0x347d70,_0x54a628['verbose'])),await _0x27ffe5(_0x1a6cb8,_0x581eb6,undefined);else throw _0x2d67b4;}return!_0x56a4b7&&console[_0x2dfdae(0x120)](),0x0;}catch(_0x36a68b){return console[_0x2dfdae(0x121)](),handleSDKError(_0x36a68b,_0x54a628),0x1;}}['handleChatEvent'](_0x2aee3a){const _0x40caa9=a8_0x17934f;if(_0x40caa9(0xeb)in _0x2aee3a)process[_0x40caa9(0x10c)][_0x40caa9(0x11c)](_0x2aee3a[_0x40caa9(0xeb)]);else _0x40caa9(0x121)in _0x2aee3a&&console[_0x40caa9(0x121)]('\x0aError:\x20'+_0x2aee3a[_0x40caa9(0x121)]);}}function a8_0x2e38(_0x12605c,_0x2d1b6b){_0x12605c=_0x12605c-0xdc;const _0x1cb600=a8_0x1cb6();let _0x2e38e4=_0x1cb600[_0x12605c];return _0x2e38e4;}export class ChatCreateCommand extends BaseCommand{[a8_0x17934f(0x115)]=a8_0x17934f(0x11b);[a8_0x17934f(0xf3)]=a8_0x17934f(0xff);[a8_0x17934f(0xec)](_0x3c9d44){const _0x1d70b2=a8_0x17934f,_0x233c1c=_0x3c9d44[_0x1d70b2(0x11a)],_0xe81f49=_0x233c1c[_0x1d70b2(0x11f)],_0x490308=_0x233c1c[_0x1d70b2(0x125)];if(!_0xe81f49&&!_0x490308)return _0x1d70b2(0xf0);return undefined;}async[a8_0x17934f(0xea)](_0x4bf048){const _0x367301=a8_0x17934f,{options:_0x525e57,tdx:_0x344ec5}=_0x4bf048,_0x3d1ae0=_0x525e57,_0xb04143=_0x3d1ae0[_0x367301(0x11f)],_0x2d92df=_0x3d1ae0[_0x367301(0x125)],_0x263815=_0x3d1ae0['llmProject'];try{const _0x3ca58b=await resolveAgentId(_0x344ec5,_0xb04143,_0x2d92df,_0x263815,_0x525e57['verbose']),_0xc2866a=await _0x344ec5[_0x367301(0xfb)][_0x367301(0xe0)](_0x3ca58b);return saveLastChatId(_0xc2866a['id']),console[_0x367301(0x120)](JSON[_0x367301(0x114)]({'chatId':_0xc2866a['id'],'agentId':_0x3ca58b})),0x0;}catch(_0x587e03){return handleSDKError(_0x587e03,_0x525e57),0x1;}}}
|
|
1
|
+
const a8_0xdb5a19=a8_0xc593;(function(_0x4a40e6,_0x7eb159){const _0x4d3a3d=a8_0xc593,_0x3c1543=_0x4a40e6();while(!![]){try{const _0x412719=-parseInt(_0x4d3a3d(0x190))/0x1*(-parseInt(_0x4d3a3d(0x1b9))/0x2)+parseInt(_0x4d3a3d(0x1ac))/0x3*(-parseInt(_0x4d3a3d(0x1c2))/0x4)+parseInt(_0x4d3a3d(0x192))/0x5+-parseInt(_0x4d3a3d(0x183))/0x6+parseInt(_0x4d3a3d(0x197))/0x7+-parseInt(_0x4d3a3d(0x193))/0x8+-parseInt(_0x4d3a3d(0x19b))/0x9*(-parseInt(_0x4d3a3d(0x1ae))/0xa);if(_0x412719===_0x7eb159)break;else _0x3c1543['push'](_0x3c1543['shift']());}catch(_0x302bcb){_0x3c1543['push'](_0x3c1543['shift']());}}}(a8_0xdb14,0x99a6b));function a8_0xdb14(){const _0x26e65c=['claude-4.5-haiku','functionName','\x27\x20not\x20found','log','join','targetAgent','code','handleChatEvent','chatId','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','args','7227798gfSDGq','string','streamChatJsonl','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','tool_call','verbose','tool','event','agent','tool_result','error','done','\x0aStack\x20trace:','23yEJySq','Error:\x20Chat\x20session\x20\x27','5323665diEYuA','3145912yQaUqE','name','content','projectId','2505426DjfCOl','Agent\x20required.\x20Use\x20--agent\x20\x22Project/Agent\x22\x20or\x20set\x20agent\x20with\x20\x22tdx\x20use\x20agent\x22','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','execute','9wgxlhx','Error:\x20Cannot\x20use\x20--new\x20and\x20--chat-id\x20together','llmProject','message','Using\x20agent\x20from\x20','targetFunction','data','Resolving\x20agent\x20\x27','description','Chat\x20session:\x20','startChat','llm','metadata','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','validate','stringify','chat-create','113220eGuTRz','Continuing\x20chat:\x20','3440230hJZgJs','agentId','stack','Error:\x20','\x20\x20Cause:\x20','stdout','chat','cause','type','\x27...','Using\x20cached\x20default\x20agent:\x20','66302UOYdwB','llmAgent','Create\x20a\x20new\x20chat\x20session','site','targetKnowledgeBase','404','new','Resolving\x20project\x20\x27','streamChat','32GfGljV','\x0aError:\x20'];a8_0xdb14=function(){return _0x26e65c;};return a8_0xdb14();}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';function a8_0xc593(_0x25435f,_0x2746cf){_0x25435f=_0x25435f-0x17e;const _0xdb1470=a8_0xdb14();let _0xc59345=_0xdb1470[_0x25435f];return _0xc59345;}import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';import{getLLMConversationUrl}from'../sdk/client/endpoints.js';function handleSDKError(_0x2481b2,_0xb03f17){const _0x4902fa=a8_0xc593;if(_0x2481b2 instanceof SDKError)console['error'](_0x4902fa(0x1b1)+_0x2481b2[_0x4902fa(0x19e)]),_0xb03f17['verbose']&&(_0x2481b2[_0x4902fa(0x1b5)]&&console[_0x4902fa(0x18d)](_0x4902fa(0x1b2)+_0x2481b2[_0x4902fa(0x1b5)]),_0x2481b2['stack']&&(console['error'](_0x4902fa(0x18f)),console[_0x4902fa(0x18d)](_0x2481b2[_0x4902fa(0x1b0)])));else throw _0x2481b2;}async function resolveAgentId(_0x421a3d,_0x26d7bb,_0x35ebac,_0x45b2cc,_0x4eb360){const _0x2ffd3c=a8_0xc593,_0x32eeb9=_0x26d7bb||_0x35ebac;if(_0x32eeb9){const {projectName:_0x33df50,agentName:_0x57031e}=parseAgentRef(_0x32eeb9),_0x50ad60=_0x57031e||_0x32eeb9,_0x4bf5e6=_0x57031e?_0x33df50:_0x45b2cc;if(!_0x4bf5e6)throw new Error(_0x2ffd3c(0x181));if(_0x4eb360){const _0x5a2918=_0x26d7bb?'--agent\x20flag':'session\x20context';console['error'](_0x2ffd3c(0x19f)+_0x5a2918+':\x20'+_0x4bf5e6+'/'+_0x50ad60);}const _0x273878=await withSpinner(_0x2ffd3c(0x1c0)+_0x4bf5e6+_0x2ffd3c(0x1b7),()=>_0x421a3d['llm']['resolveProjectId'](_0x4bf5e6),{'verbose':_0x4eb360}),_0x3b5b62=await withSpinner(_0x2ffd3c(0x1a2)+_0x50ad60+_0x2ffd3c(0x1b7),()=>_0x421a3d['llm']['resolveAgentId'](_0x50ad60,_0x273878[_0x2ffd3c(0x1a1)]),{'verbose':_0x4eb360});return _0x3b5b62[_0x2ffd3c(0x1a1)];}else{const _0x2a23a2=_0x421a3d[_0x2ffd3c(0x1a6)]['getDefaultAgent']();if(_0x2a23a2)return _0x4eb360&&console[_0x2ffd3c(0x18d)](_0x2ffd3c(0x1b8)+_0x2a23a2[_0x2ffd3c(0x194)]),_0x2a23a2['id'];const _0x4e16f5=await withSpinner('Getting\x20default\x20agent...',()=>_0x421a3d[_0x2ffd3c(0x1a6)]['getOrCreateDefaultAgent'](_0x2ffd3c(0x1c4),0x0),{'verbose':_0x4eb360});return _0x4e16f5[_0x2ffd3c(0x1a1)]['id'];}}export class ChatCommand extends BaseCommand{[a8_0xdb5a19(0x194)]='chat';['description']=a8_0xdb5a19(0x199);[a8_0xdb5a19(0x1a9)](_0x1ae6d2){const _0x5ea12a=a8_0xdb5a19,_0x444b36=_0x1ae6d2[_0x5ea12a(0x182)][_0x5ea12a(0x1c8)]('\x20');if(!_0x444b36)return _0x5ea12a(0x186);return undefined;}async[a8_0xdb5a19(0x1c1)](_0x3f54eb,_0x459a84,_0x1f6aa5,_0x4b90ce,_0x48e986){const _0x48797b=a8_0xdb5a19;for await(const _0x10156d of _0x3f54eb[_0x48797b(0x1a6)][_0x48797b(0x1b4)](_0x459a84,{'agentId':_0x1f6aa5,'chatId':_0x4b90ce})){if(_0x10156d['type']===_0x48797b(0x1a7)){const _0x5b816f=_0x10156d['data']['chatId'];saveLastChatId(_0x5b816f),_0x48e986&&console[_0x48797b(0x18d)](_0x48797b(0x1a4)+_0x5b816f);}else _0x10156d[_0x48797b(0x1b6)]===_0x48797b(0x18a)&&this['handleChatEvent'](_0x10156d[_0x48797b(0x1a1)]);}}async[a8_0xdb5a19(0x185)](_0x2ba045,_0x1e5f33,_0x2965f8,_0x39e742){const _0x442205=a8_0xdb5a19,_0x4a6fcc=_0x2ba045['context'][_0x442205(0x1bc)];let _0x12c46b=![];for await(const _0x4063a9 of _0x2ba045[_0x442205(0x1a6)][_0x442205(0x1b4)](_0x1e5f33,{'agentId':_0x2965f8,'chatId':_0x39e742})){if(_0x4063a9[_0x442205(0x1b6)]==='metadata'){const _0x420ee5=_0x4063a9[_0x442205(0x1a1)];saveLastChatId(_0x420ee5[_0x442205(0x180)]);const _0x4ed872=_0x420ee5[_0x442205(0x196)]&&_0x420ee5[_0x442205(0x1af)]?getLLMConversationUrl(_0x4a6fcc,_0x420ee5[_0x442205(0x196)],_0x420ee5['agentId'],_0x420ee5[_0x442205(0x180)]):undefined;console['log'](JSON[_0x442205(0x1aa)]({'type':_0x442205(0x1a7),'data':{'chatId':_0x420ee5['chatId'],'agentId':_0x420ee5[_0x442205(0x1af)],'consoleUrl':_0x4ed872}})),_0x12c46b=!![];}else{if(_0x4063a9['type']==='event'){!_0x12c46b&&_0x39e742&&(console[_0x442205(0x1c7)](JSON[_0x442205(0x1aa)]({'type':_0x442205(0x1a7),'data':{'chatId':_0x39e742}})),_0x12c46b=!![]);const _0x31f183=_0x4063a9[_0x442205(0x1a1)];if(_0x442205(0x195)in _0x31f183)console[_0x442205(0x1c7)](JSON[_0x442205(0x1aa)]({'type':_0x442205(0x195),'data':{'content':_0x31f183[_0x442205(0x195)]}}));else{if(_0x442205(0x187)in _0x31f183){const _0x4357c5=_0x31f183[_0x442205(0x187)];console[_0x442205(0x1c7)](JSON['stringify']({'type':_0x442205(0x187),'data':{'id':_0x4357c5['id'],'name':_0x4357c5['functionName'],'target':_0x4357c5[_0x442205(0x1bd)]?.[_0x442205(0x194)]||_0x4357c5[_0x442205(0x1c9)]?.['name']||_0x4357c5['targetWebSearchTool']?.[_0x442205(0x194)]||_0x4357c5[_0x442205(0x1a0)]}}));}else{if(_0x442205(0x189)in _0x31f183)console[_0x442205(0x1c7)](JSON[_0x442205(0x1aa)]({'type':_0x442205(0x18c),'data':{'id':_0x31f183[_0x442205(0x189)]['id'],'name':_0x31f183[_0x442205(0x189)][_0x442205(0x1c5)],'result':typeof _0x31f183[_0x442205(0x189)][_0x442205(0x195)]===_0x442205(0x184)?_0x31f183['tool'][_0x442205(0x195)]['slice'](0x0,0x1f4):''}}));else _0x442205(0x18d)in _0x31f183&&console[_0x442205(0x1c7)](JSON[_0x442205(0x1aa)]({'type':_0x442205(0x18d),'data':{'error':_0x31f183[_0x442205(0x18d)]}}));}}}}}console[_0x442205(0x1c7)](JSON[_0x442205(0x1aa)]({'type':_0x442205(0x18e)}));}async[a8_0xdb5a19(0x19a)](_0x30e3ec){const _0x4ef88b=a8_0xdb5a19,{options:_0x4d73cd,args:_0x4506a7,tdx:_0xdefa5f}=_0x30e3ec,_0x40be28=_0x4506a7[_0x4ef88b(0x1c8)]('\x20'),_0x3e5574=_0x4d73cd,_0x36cf68=_0x3e5574[_0x4ef88b(0x18b)],_0x36ee88=_0x3e5574[_0x4ef88b(0x1ba)],_0x54298a=_0x3e5574[_0x4ef88b(0x19d)],_0x31e795=_0x3e5574[_0x4ef88b(0x1bf)],_0x4f7244=_0x3e5574['chatId'],_0x3ed714=_0x3e5574['stream'];if(_0x31e795&&_0x4f7244)return console[_0x4ef88b(0x18d)](_0x4ef88b(0x19c)),0x1;try{let _0x18eae7,_0x58d1a4;if(_0x4f7244)_0x58d1a4=_0x4f7244;else!_0x31e795&&(_0x58d1a4=loadLastChatId(),_0x58d1a4&&_0x4d73cd['verbose']&&console[_0x4ef88b(0x18d)](_0x4ef88b(0x1ad)+_0x58d1a4));!_0x4f7244&&(_0x31e795||!_0x58d1a4)&&(_0x18eae7=await resolveAgentId(_0xdefa5f,_0x36cf68,_0x36ee88,_0x54298a,_0x4d73cd['verbose']));const _0x1a0ea2=_0x3ed714?(_0x49ede1,_0x2fb92e,_0x5d9518)=>this[_0x4ef88b(0x185)](_0xdefa5f,_0x49ede1,_0x2fb92e,_0x5d9518):(_0x50679d,_0x13e8e0,_0x15c33d)=>this[_0x4ef88b(0x1c1)](_0xdefa5f,_0x50679d,_0x13e8e0,_0x15c33d,_0x4d73cd[_0x4ef88b(0x188)]);try{await _0x1a0ea2(_0x40be28,_0x18eae7,_0x58d1a4);}catch(_0x340e2c){const _0x5a149e=_0x340e2c instanceof SDKError&&_0x340e2c[_0x4ef88b(0x17e)]===ErrorCode['CHAT_NOT_FOUND']||_0x340e2c instanceof Error&&_0x340e2c[_0x4ef88b(0x19e)]['includes'](_0x4ef88b(0x1be));if(_0x5a149e&&_0x4f7244)return console[_0x4ef88b(0x18d)](_0x4ef88b(0x191)+_0x4f7244+_0x4ef88b(0x1c6)),0x1;if(_0x5a149e)_0x4d73cd[_0x4ef88b(0x188)]&&console[_0x4ef88b(0x18d)](_0x4ef88b(0x1a8)),!_0x18eae7&&(_0x18eae7=await resolveAgentId(_0xdefa5f,_0x36cf68,_0x36ee88,_0x54298a,_0x4d73cd[_0x4ef88b(0x188)])),await _0x1a0ea2(_0x40be28,_0x18eae7,undefined);else throw _0x340e2c;}return!_0x3ed714&&console[_0x4ef88b(0x1c7)](),0x0;}catch(_0x3dc935){return console[_0x4ef88b(0x18d)](),handleSDKError(_0x3dc935,_0x4d73cd),0x1;}}[a8_0xdb5a19(0x17f)](_0x58303f){const _0x4b6636=a8_0xdb5a19;if(_0x4b6636(0x195)in _0x58303f)process[_0x4b6636(0x1b3)]['write'](_0x58303f['content']);else _0x4b6636(0x18d)in _0x58303f&&console['error'](_0x4b6636(0x1c3)+_0x58303f[_0x4b6636(0x18d)]);}}export class ChatCreateCommand extends BaseCommand{['name']=a8_0xdb5a19(0x1ab);[a8_0xdb5a19(0x1a3)]=a8_0xdb5a19(0x1bb);[a8_0xdb5a19(0x1a9)](_0x2e0a6e){const _0xe9f6a8=a8_0xdb5a19,_0x147216=_0x2e0a6e['options'],_0x34187c=_0x147216[_0xe9f6a8(0x18b)],_0x2226c9=_0x147216[_0xe9f6a8(0x1ba)];if(!_0x34187c&&!_0x2226c9)return _0xe9f6a8(0x198);return undefined;}async[a8_0xdb5a19(0x19a)](_0x4eb020){const _0xe8b446=a8_0xdb5a19,{options:_0x319eb2,tdx:_0x4ba420}=_0x4eb020,_0x2d0a45=_0x319eb2,_0x1275e6=_0x2d0a45[_0xe8b446(0x18b)],_0x544ca0=_0x2d0a45['llmAgent'],_0x533559=_0x2d0a45[_0xe8b446(0x19d)];try{const _0x4e78a3=await resolveAgentId(_0x4ba420,_0x1275e6,_0x544ca0,_0x533559,_0x319eb2[_0xe8b446(0x188)]),_0x325128=await _0x4ba420[_0xe8b446(0x1a6)][_0xe8b446(0x1a5)](_0x4e78a3);return saveLastChatId(_0x325128['id']),console['log'](JSON[_0xe8b446(0x1aa)]({'chatId':_0x325128['id'],'agentId':_0x4e78a3})),0x0;}catch(_0xc94ff0){return handleSDKError(_0xc94ff0,_0x319eb2),0x1;}}}
|