@2kw/ai 7.0.0-dev.8 → 7.0.0-dev.9

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.
@@ -8,19 +8,20 @@ import { formatPage, formatDetail, formatSuccess, withSpinner } from "../lib/out
8
8
  import { addPaginationOptions, paginationParams } from "../lib/pagination.js";
9
9
  import { fileToBlob } from "../lib/multipart.js";
10
10
  /**
11
- * Upload a single file with purpose=agent_input|knowledge. The generated type
12
- * describes the "file" part as a binary string, which FormData cannot match,
13
- * so the placeholder body satisfies the type and bodySerializer sends the
14
- * real part.
11
+ * Upload a single file with purpose=agent_input|knowledge. Both are multipart
12
+ * form parts. The generated type describes the "file" part as a binary string,
13
+ * which FormData cannot match, so the placeholder body satisfies the type and
14
+ * bodySerializer sends the real parts.
15
15
  */
16
16
  async function uploadFile(command, filePath, purpose) {
17
17
  const { blob, filename } = fileToBlob(filePath);
18
18
  const formData = new FormData();
19
19
  formData.append("file", blob, filename);
20
+ formData.append("purpose", purpose);
20
21
  const client = getClient(command);
21
22
  const { data } = await client.POST("/v1/files", {
22
- params: { query: { purpose } },
23
- body: { file: "" },
23
+ // The server validates the purpose and answers 400 for an unknown one, so the CLI does not narrow it.
24
+ body: { file: "", purpose: purpose },
24
25
  bodySerializer: () => formData,
25
26
  });
26
27
  return data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2kw/ai",
3
- "version": "7.0.0-dev.8",
3
+ "version": "7.0.0-dev.9",
4
4
  "description": "CLI for 2kw.ai — schema-driven document extraction, an OpenAI-compatible EU LLM gateway, transcription, prompts, datasets, and experiments from your terminal or agentic workflows. Ships as 2kw, backbone, and bb.",
5
5
  "keywords": [
6
6
  "cli",