@treasuredata/tdx 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/README.md +196 -107
  2. package/dist/cli.js +1 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/client/cdp-client.d.ts +1 -1
  5. package/dist/client/cdp-client.js +1 -1
  6. package/dist/client/cdp-client.js.map +1 -1
  7. package/dist/client/http-client.d.ts +22 -2
  8. package/dist/client/http-client.d.ts.map +1 -1
  9. package/dist/client/http-client.js +1 -1
  10. package/dist/client/http-client.js.map +1 -1
  11. package/dist/client/llm-client.d.ts +7 -1
  12. package/dist/client/llm-client.d.ts.map +1 -1
  13. package/dist/client/llm-client.js +1 -1
  14. package/dist/client/llm-client.js.map +1 -1
  15. package/dist/client/rate-limiter.js +1 -1
  16. package/dist/client/td-client.js +1 -1
  17. package/dist/client/td-client.js.map +1 -1
  18. package/dist/client/trino-client.d.ts +2 -11
  19. package/dist/client/trino-client.d.ts.map +1 -1
  20. package/dist/client/trino-client.js +1 -1
  21. package/dist/client/trino-client.js.map +1 -1
  22. package/dist/client/workflow-client.d.ts +44 -1
  23. package/dist/client/workflow-client.d.ts.map +1 -1
  24. package/dist/client/workflow-client.js +1 -1
  25. package/dist/client/workflow-client.js.map +1 -1
  26. package/dist/commands/activations.d.ts +1 -1
  27. package/dist/commands/activations.js +1 -1
  28. package/dist/commands/api-command.js +1 -1
  29. package/dist/commands/chat-command.d.ts +8 -0
  30. package/dist/commands/chat-command.d.ts.map +1 -1
  31. package/dist/commands/chat-command.js +1 -1
  32. package/dist/commands/chat-command.js.map +1 -1
  33. package/dist/commands/command.d.ts.map +1 -1
  34. package/dist/commands/command.js +1 -1
  35. package/dist/commands/command.js.map +1 -1
  36. package/dist/commands/context-command.d.ts +1 -0
  37. package/dist/commands/context-command.d.ts.map +1 -1
  38. package/dist/commands/context-command.js +1 -1
  39. package/dist/commands/context-command.js.map +1 -1
  40. package/dist/commands/databases.js +1 -1
  41. package/dist/commands/describe.js +1 -1
  42. package/dist/commands/llm-command.d.ts +59 -30
  43. package/dist/commands/llm-command.d.ts.map +1 -1
  44. package/dist/commands/llm-command.js +1 -1
  45. package/dist/commands/llm-command.js.map +1 -1
  46. package/dist/commands/profiles-command.d.ts.map +1 -1
  47. package/dist/commands/profiles-command.js +1 -1
  48. package/dist/commands/profiles-command.js.map +1 -1
  49. package/dist/commands/query-command.d.ts.map +1 -1
  50. package/dist/commands/query-command.js +1 -1
  51. package/dist/commands/query-command.js.map +1 -1
  52. package/dist/commands/segment-command.d.ts +4 -4
  53. package/dist/commands/segment-command.d.ts.map +1 -1
  54. package/dist/commands/segment-command.js +1 -1
  55. package/dist/commands/segment-command.js.map +1 -1
  56. package/dist/commands/segments.js +1 -1
  57. package/dist/commands/show.js +1 -1
  58. package/dist/commands/tables.js +1 -1
  59. package/dist/commands/use-command.d.ts +0 -1
  60. package/dist/commands/use-command.d.ts.map +1 -1
  61. package/dist/commands/use-command.js +1 -1
  62. package/dist/commands/use-command.js.map +1 -1
  63. package/dist/commands/workflow-command.d.ts +24 -0
  64. package/dist/commands/workflow-command.d.ts.map +1 -1
  65. package/dist/commands/workflow-command.js +1 -1
  66. package/dist/commands/workflow-command.js.map +1 -1
  67. package/dist/core/auth.d.ts +21 -6
  68. package/dist/core/auth.d.ts.map +1 -1
  69. package/dist/core/auth.js +1 -1
  70. package/dist/core/auth.js.map +1 -1
  71. package/dist/core/config.d.ts +19 -0
  72. package/dist/core/config.d.ts.map +1 -1
  73. package/dist/core/config.js +1 -1
  74. package/dist/core/config.js.map +1 -1
  75. package/dist/core/global-context.js +1 -1
  76. package/dist/core/profile.d.ts +27 -17
  77. package/dist/core/profile.d.ts.map +1 -1
  78. package/dist/core/profile.js +1 -1
  79. package/dist/core/profile.js.map +1 -1
  80. package/dist/core/project-config.js +1 -1
  81. package/dist/core/session.js +1 -1
  82. package/dist/index.d.ts +1 -1
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +1 -1
  85. package/dist/index.js.map +1 -1
  86. package/dist/sdk/api.d.ts.map +1 -1
  87. package/dist/sdk/api.js +1 -1
  88. package/dist/sdk/api.js.map +1 -1
  89. package/dist/sdk/database.d.ts.map +1 -1
  90. package/dist/sdk/database.js +1 -1
  91. package/dist/sdk/database.js.map +1 -1
  92. package/dist/sdk/errors.d.ts +107 -3
  93. package/dist/sdk/errors.d.ts.map +1 -1
  94. package/dist/sdk/errors.js +1 -1
  95. package/dist/sdk/errors.js.map +1 -1
  96. package/dist/sdk/index.d.ts +12 -5
  97. package/dist/sdk/index.d.ts.map +1 -1
  98. package/dist/sdk/index.js +1 -1
  99. package/dist/sdk/index.js.map +1 -1
  100. package/dist/sdk/llm.d.ts +91 -8
  101. package/dist/sdk/llm.d.ts.map +1 -1
  102. package/dist/sdk/llm.js +1 -1
  103. package/dist/sdk/llm.js.map +1 -1
  104. package/dist/sdk/query.d.ts.map +1 -1
  105. package/dist/sdk/query.js +1 -1
  106. package/dist/sdk/query.js.map +1 -1
  107. package/dist/sdk/segment.d.ts.map +1 -1
  108. package/dist/sdk/segment.js +1 -1
  109. package/dist/sdk/segment.js.map +1 -1
  110. package/dist/sdk/table.d.ts.map +1 -1
  111. package/dist/sdk/table.js +1 -1
  112. package/dist/sdk/table.js.map +1 -1
  113. package/dist/sdk/workflow.d.ts +103 -0
  114. package/dist/sdk/workflow.d.ts.map +1 -1
  115. package/dist/sdk/workflow.js +1 -1
  116. package/dist/sdk/workflow.js.map +1 -1
  117. package/dist/types/endpoints.d.ts +14 -14
  118. package/dist/types/endpoints.d.ts.map +1 -1
  119. package/dist/types/endpoints.js +1 -1
  120. package/dist/types/endpoints.js.map +1 -1
  121. package/dist/types/index.d.ts +5 -1
  122. package/dist/types/index.d.ts.map +1 -1
  123. package/dist/types/index.js +1 -1
  124. package/dist/types/index.js.map +1 -1
  125. package/dist/utils/agent-ref-parser.js +1 -1
  126. package/dist/utils/chat-cache.js +1 -1
  127. package/dist/utils/colors.js +1 -1
  128. package/dist/utils/command-output.js +1 -1
  129. package/dist/utils/file-permissions.js +1 -1
  130. package/dist/utils/format-detector.js +1 -1
  131. package/dist/utils/formatters.js +1 -1
  132. package/dist/utils/option-validation.js +1 -1
  133. package/dist/utils/process.js +1 -1
  134. package/dist/utils/segment-ref-parser.d.ts +9 -8
  135. package/dist/utils/segment-ref-parser.d.ts.map +1 -1
  136. package/dist/utils/segment-ref-parser.js +1 -1
  137. package/dist/utils/segment-ref-parser.js.map +1 -1
  138. package/dist/utils/spinner.js +1 -1
  139. package/dist/utils/sql-parser.js +1 -1
  140. package/dist/utils/sse-parser.js +1 -1
  141. package/dist/utils/string-utils.d.ts +22 -0
  142. package/dist/utils/string-utils.d.ts.map +1 -1
  143. package/dist/utils/string-utils.js +1 -1
  144. package/dist/utils/string-utils.js.map +1 -1
  145. package/dist/utils/table-ref-parser.js +1 -1
  146. package/dist/utils/workflow-utils.d.ts +25 -0
  147. package/dist/utils/workflow-utils.d.ts.map +1 -0
  148. package/dist/utils/workflow-utils.js +1 -0
  149. package/dist/utils/workflow-utils.js.map +1 -0
  150. package/package.json +5 -2
package/README.md CHANGED
@@ -93,7 +93,7 @@ tdx chat --new "Tell me about data pipelines"
93
93
  1. **CLI flags** (highest priority) - `--database`, `--site`, etc.
94
94
  2. **Session context** - Shell-scoped overrides set with `tdx use`
95
95
  3. **Project config** - Per-project defaults in `tdx.json`
96
- 4. **Profile config** - Account-specific settings in `~/.config/tdx/profiles/<name>/tdx.json`
96
+ 4. **Profile config** - Account-specific settings in `~/.config/tdx/tdx.json` or project `tdx.json`
97
97
  5. **Global config** - Fallback defaults in `~/.config/tdx/tdx.json`
98
98
 
99
99
  ### Profiles
@@ -104,41 +104,55 @@ Profiles store long-lived account configurations for easy switching between envi
104
104
  # List all profiles with details
105
105
  tdx profiles
106
106
 
107
- # Switch active profile
107
+ # Set session profile (shell-scoped)
108
108
  tdx use profile production
109
109
  ```
110
110
 
111
111
  **Profile Structure:**
112
112
 
113
- ```
114
- ~/.config/tdx/profiles/
115
- ├── production/
116
- │ ├── tdx.json # Configuration (site, database, llm_project, etc.)
117
- │ └── .env # Credentials (TD_API_KEY)
118
- └── dev/
119
- ├── tdx.json # Development environment config
120
- └── .env # Development credentials
121
- ```
113
+ Profiles are defined in `tdx.json` files with a `profiles` object:
122
114
 
123
- **Example Production Profile** (`~/.config/tdx/profiles/production/tdx.json`):
124
115
  ```json
125
116
  {
126
- "description": "Production environment for US region",
127
- "site": "us01",
128
- "database": "analytics",
129
- "llm_project": "DataAnalytics"
117
+ "profiles": {
118
+ "production": {
119
+ "description": "Production environment for US region",
120
+ "site": "us01",
121
+ "database": "analytics",
122
+ "llm_project": "DataAnalytics"
123
+ },
124
+ "dev": {
125
+ "description": "Development and testing environment",
126
+ "site": "jp01",
127
+ "database": "dev_db"
128
+ }
129
+ }
130
130
  }
131
131
  ```
132
132
 
133
- **Example Development Profile** (`~/.config/tdx/profiles/dev/tdx.json`):
134
- ```json
135
- {
136
- "description": "Development and testing environment",
137
- "site": "jp01",
138
- "database": "dev_db"
139
- }
133
+ **Profile Locations:**
134
+ - **User-level**: `~/.config/tdx/tdx.json` - Shared across all projects
135
+ - **Project-level**: `(project folder)/tdx.json` - Project-specific profiles
136
+
137
+ **Credentials:**
138
+ Store API keys separately from profiles:
139
+ ```
140
+ ~/.config/tdx/
141
+ ├── tdx.json # User-level profiles
142
+ ├── .env.production # Production credentials
143
+ └── .env.dev # Development credentials
144
+ ```
145
+
146
+ **Example credential file** (`~/.config/tdx/.env.production`):
147
+ ```
148
+ TD_API_KEY=1234/abcdefg...
140
149
  ```
141
150
 
151
+ **Profile Precedence:**
152
+ 1. Project `tdx.json` profiles (local)
153
+ 2. User `~/.config/tdx/tdx.json` profiles (user-level)
154
+ 3. Directory-based profiles (deprecated)
155
+
142
156
  **Note:** The `description` field is optional but recommended for documenting what each profile is for.
143
157
 
144
158
  ### Session Context
@@ -152,8 +166,11 @@ tdx use database mydb
152
166
  # Set session LLM project
153
167
  tdx use llm_project Analytics
154
168
 
169
+ # View current context
170
+ tdx context
171
+
155
172
  # Clear session context
156
- tdx use --clear
173
+ tdx context --clear
157
174
  ```
158
175
 
159
176
  **How Session Scope Works:**
@@ -175,7 +192,7 @@ tdx tables # Uses database: analytics
175
192
  tdx tables # Uses default database (separate session)
176
193
  ```
177
194
 
178
- Session context persists until the shell is closed or explicitly cleared with `tdx use --clear`.
195
+ Session context persists until the shell is closed or explicitly cleared with `tdx context --clear`.
179
196
 
180
197
  **Note:** For advanced session sharing across multiple processes or shells, see [Session ID Option](#session-id-option) in the Advanced Options section.
181
198
 
@@ -221,12 +238,12 @@ Example output:
221
238
  site: us01 (global: ~/.config/tdx/tdx.json)
222
239
  database: analytics (session)
223
240
  llm_project: DataAnalytics (profile: production)
224
- profile: production (active)
241
+ profile: production (session)
225
242
 
226
243
  Configuration Files:
227
244
  Session: /Users/user/.config/tdx/sessions/12345.json ✓
228
- Profile: /Users/user/.config/tdx/profiles/production/tdx.json ✓
229
245
  Global: /Users/user/.config/tdx/tdx.json ✓
246
+ Project: /Users/user/projects/myproject/tdx.json ✓
230
247
  ```
231
248
 
232
249
  ## Available Commands
@@ -292,7 +309,7 @@ Simplified top-level command for chatting with LLM agents.
292
309
  | Command | Description | Example |
293
310
  |---------|-------------|---------|
294
311
  | `chat <message>` | Chat (continues last session by default) | `tdx chat "Analyze my data"` |
295
- | `chat <message> --agent <ref>` | Chat with specific agent | `tdx chat "Hello" --agent "Project/Agent"` |
312
+ | `chat <message> --agent <name>` | Chat with specific agent | `tdx chat "Hello" --agent "Data Analyst"` |
296
313
  | `chat <message> --model <name>` | Chat using specific model | `tdx chat "Help" --model "gpt-5"` |
297
314
  | `chat <message> --temperature <n>` | Set temperature (0.0-2.0, default: 0.7) | `tdx chat "Be creative" --temperature 1.2` |
298
315
  | `chat <message> --new` | Start a new chat session | `tdx chat --new "Fresh conversation"` |
@@ -304,33 +321,33 @@ tdx chat "Show me the top customers by revenue"
304
321
 
305
322
  # Continue previous conversation (default behavior)
306
323
  tdx chat "What about last quarter?"
307
- tdx chat "And the quarter before that?"
308
324
 
309
325
  # Start a new conversation
310
326
  tdx chat --new "Tell me about data modeling best practices"
311
327
 
312
- # Use specific agent
313
- tdx chat "Analyze churn" --agent "MyProject/Data Analyst"
314
-
315
- # Use specific model (reuses agent per model)
328
+ # Use specific model (auto-creates/reuses agent)
316
329
  tdx chat "Help me write SQL" --model "gpt-5"
317
330
 
318
- # Adjust temperature for more creative responses
319
- tdx chat "Write a poem" --temperature 1.5
331
+ # Use specific agent by name (uses current project context)
332
+ tdx llm use "MyProject"
333
+ tdx chat "Analyze churn" --agent "Data Analyst"
320
334
 
321
- # Combine options
322
- tdx chat "Be precise" --model "claude-4-sonnet" --temperature 0.3
335
+ # Override project for agent lookup
336
+ tdx chat "Hello" --agent "Analyst" --llm-project "OtherProject"
337
+
338
+ # Adjust temperature
339
+ tdx chat "Write a poem" --temperature 1.5
323
340
 
324
341
  # Verbose mode shows chat session ID
325
342
  tdx chat "Hello" --verbose
326
343
  ```
327
344
 
328
345
  **How it works**:
329
- - **Default behavior**: Continues last chat session automatically (or creates new if none exists)
346
+ - **Default behavior**: Continues last chat session automatically
330
347
  - **Session persistence**: Last chat ID saved to `.cache/tdx/last_chat_id`
331
348
  - **--new flag**: Starts a fresh chat session
332
- - **--agent**: Use specific agent (requires `"project/agent"` format)
333
- - **--model**: Reuses or creates agent per model (e.g., `tdx_gpt-5`)
349
+ - **--agent**: Use specific agent by name (resolves using project context)
350
+ - **--model**: Auto-creates/reuses agent per model (e.g., `tdx_gpt-5`)
334
351
  - **--temperature**: Controls randomness (0.7 default, lower=focused, higher=creative)
335
352
 
336
353
  ### Database Commands
@@ -446,20 +463,20 @@ CDP (Customer Data Platform) segment management for audiences and activations.
446
463
 
447
464
  **Name Format Conventions:**
448
465
  - Parent segment: `parent_name` (e.g., `"My Audience"`)
449
- - Child segment: `parent_name.child_name` (e.g., `"My Audience.High Value Users"`) - uses dot notation
450
- - Folder: `parent_name.folder_name` (e.g., `"My Audience.Marketing"`)
451
- - Pattern: Commands accept `(parent_name)(.child_name)?` format
466
+ - Child segment: `parent_name/child_name` (e.g., `"My Audience/High Value Users"`) - uses slash notation
467
+ - Folder: `parent_name/folder_name` (e.g., `"My Audience/Marketing"`)
468
+ - Pattern: Commands accept `(parent_name)(/child_name)?` format
452
469
  - **Note**: Names are case-sensitive
453
470
 
454
471
  | Command | Description | Example |
455
472
  |---------|-------------|---------|
456
473
  | `segments` | List all parent segments | `tdx segments` |
457
474
  | `segments <parent_name>` | List child segments under parent | `tdx segments "My Audience"` |
458
- | `segment describe <name>` (alias: `desc`) | Show parent or child segment details | `tdx segment describe "My Audience"` or `tdx segment desc "My Audience.Premium Users"` |
459
- | `segment show <name>` | Execute segment SQL query and show results | `tdx segment show "My Audience"` or `tdx segment show "My Audience.Premium Users" --limit 100` |
460
- | `segment sql <name>` | Get SQL query for segment | `tdx segment sql "My Audience"` or `tdx segment sql "My Audience.Premium Users"` |
475
+ | `segment describe <name>` (alias: `desc`) | Show parent or child segment details | `tdx segment describe "My Audience"` or `tdx segment desc "My Audience/Premium Users"` |
476
+ | `segment show <name>` | Execute segment SQL query and show results | `tdx segment show "My Audience"` or `tdx segment show "My Audience/Premium Users" --limit 100` |
477
+ | `segment sql <name>` | Get SQL query for segment | `tdx segment sql "My Audience"` or `tdx segment sql "My Audience/Premium Users"` |
461
478
  | `segment folders <parent_name>` | List folders under parent | `tdx segment folders "My Audience"` |
462
- | `segment folder show <parent_name.folder_name>` | Show folder details | `tdx segment folder show "My Audience.Marketing"` |
479
+ | `segment folder show <parent_name/folder_name>` | Show folder details | `tdx segment folder show "My Audience/Marketing"` |
463
480
 
464
481
  **Examples**:
465
482
  ```bash
@@ -474,14 +491,14 @@ tdx segment describe "My Audience"
474
491
  # or use the alias
475
492
  tdx segment desc "My Audience"
476
493
 
477
- # Show child segment metadata (dot notation)
478
- tdx segment describe "My Audience.High Value Users"
494
+ # Show child segment metadata (slash notation)
495
+ tdx segment describe "My Audience/High Value Users"
479
496
 
480
497
  # Execute parent segment query and show results (default: 40 rows)
481
498
  tdx segment show "My Audience"
482
499
 
483
- # Execute child segment query with custom limit (dot notation)
484
- tdx segment show "My Audience.Premium Users" --limit 100
500
+ # Execute child segment query with custom limit (slash notation)
501
+ tdx segment show "My Audience/Premium Users" --limit 100
485
502
 
486
503
  # Execute segment query and save as JSON
487
504
  tdx segment show "My Audience" --format json --output results.json
@@ -489,14 +506,14 @@ tdx segment show "My Audience" --format json --output results.json
489
506
  # Get SQL for parent segment
490
507
  tdx segment sql "My Audience" > parent-query.sql
491
508
 
492
- # Get SQL for child segment with filtering (dot notation)
493
- tdx segment sql "My Audience.High Value Users" > child-query.sql
509
+ # Get SQL for child segment with filtering (slash notation)
510
+ tdx segment sql "My Audience/High Value Users" > child-query.sql
494
511
 
495
512
  # List folders under parent
496
513
  tdx segment folders "My Audience"
497
514
 
498
- # Show folder details (parent.folder notation)
499
- tdx segment folder show "My Audience.Marketing"
515
+ # Show folder details (parent/folder notation)
516
+ tdx segment folder show "My Audience/Marketing"
500
517
  ```
501
518
 
502
519
  ### Activation Commands (CDP)
@@ -505,18 +522,18 @@ Manage CDP activations (syndications) for segments.
505
522
 
506
523
  | Command | Description | Example |
507
524
  |---------|-------------|---------|
508
- | `activations <parent_name.child_name>` | List activations for a child segment | `tdx activations "My Audience.Premium Users"` |
525
+ | `activations <parent_name/child_name>` | List activations for a child segment | `tdx activations "My Audience/Premium Users"` |
509
526
 
510
527
  **Examples**:
511
528
  ```bash
512
- # List activations for a child segment (dot notation with names)
513
- tdx activations "My Audience.Premium Users"
529
+ # List activations for a child segment (slash notation with names)
530
+ tdx activations "My Audience/Premium Users"
514
531
 
515
532
  # Get activations as JSON
516
- tdx activations "My Audience.High Value Users" --format json
533
+ tdx activations "My Audience/High Value Users" --format json
517
534
 
518
535
  # Using Tokyo region
519
- tdx activations "My Audience.Premium Users" --site jp01
536
+ tdx activations "My Audience/Premium Users" --site jp01
520
537
  ```
521
538
 
522
539
  ### Workflow Commands
@@ -536,6 +553,9 @@ Manage Treasure Data workflows powered by Digdag. Monitor execution sessions, vi
536
553
  | `logs <attempt-id> <task-name>` | Show logs for a specific task | `tdx wf logs 67890 +step1` |
537
554
  | `kill <attempt-id>` | Kill a running attempt | `tdx wf kill 67890` |
538
555
  | `retry <session-id\|attempt-id>` | Retry a session or attempt | `tdx wf retry session:12345` or `tdx wf retry attempt:67890` |
556
+ | `download <project-name> [output-dir]` | Download workflow project from TD console | `tdx wf download myproject` or `tdx wf download myproject ./workflows` |
557
+ | `push [project-name-or-dir]` | Push workflow project to TD console (digdag-style) | `cd myproject && tdx wf push myproject` or `tdx wf push ./myproject` |
558
+ | `delete <project-name-or-id>` | Delete workflow project from TD console | `tdx wf delete myproject` or `tdx wf delete 12345` |
539
559
 
540
560
  **Workflow-specific options:**
541
561
 
@@ -553,6 +573,14 @@ For `tasks` command:
553
573
  For `logs` command:
554
574
  - `--offset <number>`: Starting offset for logs (default: 0)
555
575
 
576
+ For `download` command:
577
+ - `--revision <revision>`: Download specific revision (default: latest)
578
+
579
+ For `push` command:
580
+ - `--name <name>`: Project name (default: directory name)
581
+ - `--revision <revision>`: Revision name (default: timestamp)
582
+ - `--skip-validation`: Skip validation of .dig files
583
+
556
584
  For `kill` command:
557
585
  - `--reason <text>`: Reason for killing the attempt
558
586
  - `-y, --yes`: Skip confirmation prompt
@@ -650,88 +678,149 @@ tdx wf retry attempt:67890 --params @params.json
650
678
  # Force retry without confirmation
651
679
  tdx wf retry attempt:67890 --force -y
652
680
 
681
+ # Download workflow project
682
+ tdx wf download myproject
683
+
684
+ # Download to specific directory
685
+ tdx wf download myproject ./workflows
686
+
687
+ # Download specific revision
688
+ tdx wf download myproject --revision v1.0.0
689
+
690
+ # Push workflow project (digdag-style: cd into project directory first)
691
+ cd myproject
692
+ tdx wf push myproject
693
+
694
+ # Push with custom revision
695
+ cd myproject
696
+ tdx wf push myproject --revision v1.0.0
697
+
698
+ # Push from parent directory with path
699
+ tdx wf push ./myproject
700
+
701
+ # Push with --name override
702
+ cd myproject
703
+ tdx wf push myproject --name production_workflow
704
+
705
+ # Push from current directory without specifying name
706
+ cd myproject
707
+ tdx wf push
708
+
709
+ # Push without validation
710
+ cd myproject
711
+ tdx wf push myproject --skip-validation
712
+
713
+ # Delete workflow project (with confirmation)
714
+ tdx wf delete myproject
715
+
716
+ # Delete by project ID
717
+ tdx wf delete 12345
718
+
719
+ # Delete without confirmation
720
+ tdx wf delete myproject -y
721
+
653
722
  # Get workflow data as JSON
654
723
  tdx wf sessions --format json --output sessions.json
655
724
  ```
656
725
 
657
- ### Agent Commands (LLM API)
726
+ ### LLM Commands
658
727
 
659
- Usage: `tdx agent <subcommand>` | `tdx agents`
728
+ Usage: `tdx llm <subcommand>`
660
729
 
661
- Manage LLM agents and chat sessions with streaming support.
730
+ Manage LLM projects, agents, and chat sessions with streaming support.
662
731
 
663
732
  | Command | Description | Example |
664
733
  |---------|-------------|---------|
665
- | `agent models` | List available LLM models | `tdx agent models` |
666
- | `agent projects` | List all projects | `tdx agent projects` |
667
- | `agents [project-name]` | List all agents (or filter by project) | `tdx agents` or `tdx agents "MyProject"` |
668
- | `agent get <project/agent>` | Get agent details | `tdx agent get "MyProject/Data Analyst"` |
669
- | `agent create <name>` | Create a new agent | `tdx agent create "My Agent" --project-id <id> --model <model>` |
670
- | `agent update <project/agent>` | Update an agent | `tdx agent update "MyProject/Agent" --name "New Name"` |
671
- | `agent remove <project/agent>` | Delete an agent | `tdx agent remove "MyProject/Agent"` |
672
- | `agent history [chat-id]` | List chat sessions or show messages | `tdx agent history` or `tdx agent history chat456` |
673
-
674
- **Agent Reference Format:**
675
-
676
- Agent commands require the full project-scoped format (since agent names are only unique within a project):
677
- - `"project-name/agent-name"` - Required format for agent operations
678
-
679
- **Agent Command Options:**
680
-
681
- For `create` command:
682
- - `--project-id <id>`: Project ID (required)
734
+ | `llm use <project>` | Set current project context | `tdx llm use "MyProject"` |
735
+ | `llm models` | List available LLM models | `tdx llm models` |
736
+ | `llm projects [pattern]` | List all projects (with wildcard support) | `tdx llm projects` or `tdx llm projects "data*"` |
737
+ | `llm project create <name>` | Create a new project | `tdx llm project create "MyProject"` |
738
+ | `llm project delete <name>` | Delete a project | `tdx llm project delete "MyProject"` |
739
+ | `llm agents [pattern]` | List agents in current project (with wildcard support) | `tdx llm agents` or `tdx llm agents "test*"` |
740
+ | `llm agent show <name>` | Show agent details | `tdx llm agent show "Data Analyst"` |
741
+ | `llm agent create <name>` | Create a new agent in current project | `tdx llm agent create "My Agent" --model <model>` |
742
+ | `llm agent update <name>` | Update an agent | `tdx llm agent update "Agent" --name "New Name"` |
743
+ | `llm agent delete <name>` | Delete an agent | `tdx llm agent delete "Agent"` |
744
+ | `llm history [chat-id]` | List chat sessions or show messages | `tdx llm history` or `tdx llm history chat456` |
745
+
746
+ **Project Resolution (Precedence Order):**
747
+
748
+ Agent commands resolve projects in this order:
749
+ 1. `--llm-project` global option (highest priority)
750
+ 2. `tdx llm use <project>` context (session-only)
751
+ 3. Default project `tdx_default_<username>` (auto-created)
752
+
753
+ **Command Options:**
754
+
755
+ For `project create`:
756
+ - `--description <text>`: Project description
757
+
758
+ For `agent create`:
683
759
  - `--system-prompt <text>`: System prompt/instructions (default: empty)
684
760
  - `--model <name>`: Model type (default: claude-4.5-sonnet)
685
761
  - `--starter-message <text>`: Starter message for the agent
686
762
  - `--max-tool-iterations <n>`: Maximum tool iterations (default: 4)
687
763
  - `--temperature <n>`: Temperature 0.0-2.0 (default: 0.7)
688
764
 
689
- For `update` command:
765
+ For `agent update`:
690
766
  - `--name <text>`: New agent name
691
767
  - `--prompt <text>`: New prompt/instructions
692
768
  - `--description <text>`: New description
693
769
  - `--starter-message <text>`: New starter message
694
770
 
695
-
696
771
  **Examples**:
697
772
  ```bash
698
773
  # List available models
699
- tdx agent models
774
+ tdx llm models
700
775
 
701
776
  # List all projects
702
- tdx agent projects
777
+ tdx llm projects
778
+
779
+ # List projects matching pattern (wildcards: * = any chars, ? = single char)
780
+ tdx llm projects "data*" # Projects starting with 'data'
781
+ tdx llm projects "*_prod" # Projects ending with '_prod'
703
782
 
704
- # List all agents
705
- tdx agents
783
+ # Create a new project
784
+ tdx llm project create "MyProject" --description "My data analysis project"
706
785
 
707
- # List agents for a specific project (by project name)
708
- tdx agents "MyProject"
786
+ # Set current project context (session-only)
787
+ tdx llm use "MyProject"
709
788
 
710
- # Get agent details (requires project/agent format)
711
- tdx agent get "MyProject/Data Analyst"
789
+ # Now all agent commands use "MyProject" by default:
790
+ tdx llm agents # List agents in MyProject
791
+ tdx llm agents "test*" # Filter agents by pattern
792
+ tdx llm agent show "Data Analyst" # Show agent from MyProject
793
+ tdx llm agent create "Analyst" --model gpt-5 # Create in MyProject
794
+ tdx llm agent update "Analyst" --name "Senior Analyst"
795
+ tdx llm agent delete "Analyst"
712
796
 
713
- # Create a new agent
714
- tdx agent create "Data Analyst" \
715
- --prompt "You are a helpful data analyst specialized in SQL and data visualization" \
716
- --starter-message "Hello! I can help you analyze your data."
797
+ # Override project with --llm-project option (highest priority)
798
+ tdx llm agents --llm-project "OtherProject"
799
+ tdx llm agent show "Agent" --llm-project "OtherProject"
717
800
 
718
- # Update agent (requires project/agent format)
719
- tdx agent update "MyProject/Data Analyst" --name "Senior Data Analyst"
801
+ # Use default project (tdx_default_<username>) - no setup needed
802
+ tdx llm agents # Uses tdx_default_leo if no context set
803
+ tdx llm agent create "Bot" # Creates in default project
720
804
 
721
- # Update agent prompt
722
- tdx agent update "MyProject/Data Analyst" --prompt "New instructions"
805
+ # Complete workflow: Create custom agent and chat with it
806
+ tdx llm use "MyProject"
807
+ tdx llm agent create "SQL Expert" \
808
+ --system-prompt "You are an expert in SQL and data analysis. Help users write efficient queries." \
809
+ --model "claude-4.5-sonnet"
723
810
 
724
- # Delete agent (requires project/agent format)
725
- tdx agent remove "MyProject/Data Analyst"
811
+ # Now chat with your custom agent
812
+ tdx chat "Help me analyze customer churn" --agent "SQL Expert"
813
+ tdx chat "Show me the query for that" # Continues conversation
726
814
 
727
- # List recent chat sessions
728
- tdx agent history
815
+ # Delete project
816
+ tdx llm project delete "OldProject"
729
817
 
730
- # Show specific chat message history
731
- tdx agent history chat456
818
+ # Chat history
819
+ tdx llm history # List recent chat sessions
820
+ tdx llm history chat456 # Show specific chat messages
732
821
 
733
- # Get agents as JSON
734
- tdx agents --format json --output agents.json
822
+ # JSON output
823
+ tdx llm agents --format json --output agents.json
735
824
  ```
736
825
 
737
826
  ## Advanced Query Features