@treasuredata/tdx 0.1.5 → 0.1.7

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