lua-cli 3.28.0 → 3.29.0

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/README.md CHANGED
@@ -44,7 +44,7 @@ lua --version
44
44
 
45
45
  ## Authentication
46
46
 
47
- lua-cli authenticates using your API key. Get yours at [admin.heylua.ai](https://admin.heylua.ai).
47
+ lua-cli authenticates with a scoped personal credential or an existing API key. New email login limits the credential to the organization, agents, and role you select. Existing scoped and non-dotted legacy keys remain supported when you supply them directly.
48
48
 
49
49
  The key is resolved from the following sources in priority order:
50
50
 
@@ -60,21 +60,31 @@ The key is resolved from the following sources in priority order:
60
60
  lua auth configure
61
61
  ```
62
62
 
63
- Prompts you to choose between entering an API key directly or authenticating via email OTP. Credentials are saved to `~/.lua-cli/credentials`.
63
+ Choose **Email** to confirm an OTP. Select one organization, one or more agents, and an assignable role. Builder is the default role. The CLI stores the scoped credential in `~/.lua-cli/credentials` with mode `0600` on POSIX systems.
64
+
65
+ Choose **API Key** to validate and save an existing scoped or legacy key unchanged. The CLI does not rotate or revoke the supplied key.
64
66
 
65
67
  ```bash
66
68
  # Non-interactive variants:
67
- lua auth configure --api-key "lk_your_api_key_here"
68
- lua auth configure --email user@example.com # Step 1: sends OTP
69
- lua auth configure --email user@example.com --otp 123456 # Step 2: verifies OTP
69
+ lua auth configure --api-key "your-api-key"
70
+ lua auth configure --email user@example.com
71
+ lua auth configure \
72
+ --email user@example.com \
73
+ --otp 123456 \
74
+ --org-id org_123 \
75
+ --agent-id agent_123 \
76
+ --role builder \
77
+ --name "deployment laptop"
70
78
  ```
71
79
 
80
+ Repeat `--agent-id` to bind the credential to more than one agent. For a new local login, prefer the interactive command and keep the email, OTP, and secret out of AI conversations.
81
+
72
82
  ### Option B — Environment variable (CI/CD, Docker, servers)
73
83
 
74
84
  Set `LUA_API_KEY` in your environment. This takes priority over all other sources and requires no file on disk — ideal for headless servers, VMs, and containers.
75
85
 
76
86
  ```bash
77
- export LUA_API_KEY="lk_your_api_key_here"
87
+ export LUA_API_KEY="your-api-key"
78
88
  lua push all --force --auto-deploy
79
89
  ```
80
90
 
@@ -83,7 +93,7 @@ lua push all --force --auto-deploy
83
93
  Create a `.env` file in your project root:
84
94
 
85
95
  ```bash
86
- echo 'LUA_API_KEY=lk_your_api_key_here' >> .env
96
+ echo 'LUA_API_KEY=your-api-key' >> .env
87
97
  ```
88
98
 
89
99
  lua-cli automatically loads `.env` on startup. Add `.env` to your `.gitignore` to avoid committing credentials.
@@ -138,7 +148,7 @@ lua auth logout --force # No prompt
138
148
  lua auth configure
139
149
  ```
140
150
 
141
- Enter your API key when prompted (get one at [admin.heylua.ai](https://admin.heylua.ai)). For CI/CD or server environments, set `LUA_API_KEY` as an environment variable instead — see [Authentication](#authentication) above.
151
+ Choose **Email** and select the organization, agents, and role for the new scoped credential. If you already have a working key, choose **API Key** to keep using it unchanged. For CI or server environments, set `LUA_API_KEY` from a secret manager. See [Authentication](#authentication).
142
152
 
143
153
  ### 2. Initialize Project
144
154
 
@@ -1777,11 +1777,12 @@ declare type HeadersResolverFunction = () => Record<string, string>;
1777
1777
  */
1778
1778
  declare abstract class HttpClient {
1779
1779
  protected baseUrl: string;
1780
+ private readonly requestCredential?;
1780
1781
  /**
1781
1782
  * Creates an instance of HttpClient
1782
1783
  * @param baseUrl - The base URL for all API requests
1783
1784
  */
1784
- constructor(baseUrl: string);
1785
+ constructor(baseUrl: string, requestCredential?: RequestCredentialInput | undefined);
1785
1786
  /**
1786
1787
  * Makes an HTTP request with standardized error handling
1787
1788
  * @param url - The full URL to request
@@ -2078,15 +2079,15 @@ declare interface Job {
2078
2079
  * Handles all job-related API calls
2079
2080
  */
2080
2081
  declare class JobApi extends HttpClient {
2081
- apiKey: string;
2082
2082
  agentId: string;
2083
+ readonly credential: RequestCredentialInput;
2083
2084
  /**
2084
2085
  * Creates an instance of JobApi
2085
2086
  * @param baseUrl - The base URL for the API
2086
- * @param apiKey - The API key for authentication
2087
+ * @param credential - The API key for authentication
2087
2088
  * @param agentId - The unique identifier of the agent
2088
2089
  */
2089
- constructor(baseUrl: string, apiKey: string, agentId: string);
2090
+ constructor(baseUrl: string, credential: RequestCredentialInput, agentId: string);
2090
2091
  /**
2091
2092
  * Retrieves all jobs for the agent
2092
2093
  * @returns Promise resolving to an ApiResponse containing an array of jobs with their versions
@@ -4635,15 +4636,14 @@ declare interface OrderAPI {
4635
4636
  }
4636
4637
 
4637
4638
  declare class OrderApi extends HttpClient implements OrderAPI {
4638
- private apiKey;
4639
4639
  private agentId;
4640
4640
  /**
4641
4641
  * Creates an instance of OrderApi
4642
4642
  * @param baseUrl - The base URL for the API
4643
- * @param apiKey - The API key for authentication
4643
+ * @param credential - The API key for authentication
4644
4644
  * @param agentId - The unique identifier of the agent
4645
4645
  */
4646
- constructor(baseUrl: string, apiKey: string, agentId: string);
4646
+ constructor(baseUrl: string, credential: RequestCredentialInput, agentId: string);
4647
4647
  /**
4648
4648
  * Creates a new order from a basket
4649
4649
  * @param orderData - The order creation request data containing basketId and additional order information
@@ -5463,6 +5463,22 @@ declare const REASONING_EFFORT_VALUES: readonly ["off", "minimal", "low", "mediu
5463
5463
 
5464
5464
  declare type ReasoningEffort = (typeof REASONING_EFFORT_VALUES)[number];
5465
5465
 
5466
+ declare interface RequestCredential {
5467
+ readonly descriptor: RequestCredentialDescriptor;
5468
+ bearer(): Promise<string>;
5469
+ }
5470
+
5471
+ declare type RequestCredentialDescriptor = {
5472
+ kind: 'api-key';
5473
+ source: 'environment' | 'stored';
5474
+ } | {
5475
+ kind: 'first-party-session';
5476
+ source: 'stored';
5477
+ uid: string;
5478
+ };
5479
+
5480
+ declare type RequestCredentialInput = string | RequestCredential;
5481
+
5466
5482
  /**
5467
5483
  * Additive field on primitive publish responses. When the agent is under
5468
5484
  * versioning the server performs a scoped promote and returns the newly