@nextxai/cli 0.3.7 → 0.3.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.8
4
+
5
+ - A workspace without an AI plan can still ask how-to questions in chat and with `-p`, up to the free daily limit.
6
+
3
7
  ## 0.3.7
4
8
 
5
9
  - `-p` on a terminal now renders the answer: headings, bold, lists and tables. Piped or redirected output stays the raw text.
package/dist/ai/client.js CHANGED
@@ -105,12 +105,21 @@ export function composeText(question, attachments, projectNotes) {
105
105
  parts.push(`\n\n--- ${tr(`Chỉ dẫn của dự án (${brand().bin.toUpperCase()}.md)`, `Project instructions (${brand().bin.toUpperCase()}.md)`)} ---\n${projectNotes}\n---`);
106
106
  return parts.join("");
107
107
  }
108
+ /** A workspace without an AI plan still gets how-to answers: the server's guidance door, same as the web app. */
109
+ export const modeForPlan = (planCode) => (planCode ? undefined : "guidance");
110
+ let cachedMode;
111
+ const askMode = () => {
112
+ // A failed plan lookup keeps the normal path: the server still decides what this workspace may do.
113
+ cachedMode ??= usage().then((u) => modeForPlan(u.planCode), () => undefined);
114
+ return cachedMode;
115
+ };
108
116
  /**
109
117
  * Sends one question and streams the answer. If the connection drops, the same Idempotency-Key is resent,
110
118
  * so the server replays the stored answer instead of answering (and charging) twice.
111
119
  */
112
120
  export async function ask(input) {
113
121
  const key = randomUUID();
122
+ const mode = await askMode();
114
123
  const body = {
115
124
  sessionId: input.sessionId,
116
125
  text: input.text,
@@ -118,6 +127,7 @@ export async function ask(input) {
118
127
  fileKeys: input.attachments?.filter((a) => a.fileKey).map((a) => a.fileKey) ?? undefined,
119
128
  agentCode: input.agent,
120
129
  clientPlatform: "cli",
130
+ ...(mode ? { mode } : {}),
121
131
  };
122
132
  let lastErr;
123
133
  for (let attempt = 0; attempt < 3; attempt++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextxai/cli",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "NextX in your terminal: chat with NextX AI on your workspace data, call the API, manage keys and webhooks",
5
5
  "keywords": [
6
6
  "nextx",