@mikado-ai/cli 0.1.0 → 0.2.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
@@ -24,7 +24,7 @@ mikado auth
24
24
  mikado campaigns
25
25
 
26
26
  # 3. Submit a transcript
27
- mikado submit transcript.txt --campaign abcd1234
27
+ mikado submit transcript.txt --campaign 928721aa
28
28
  ```
29
29
 
30
30
  ## Authentication
@@ -64,16 +64,16 @@ Submit a conversation transcript for processing. By default, waits for results.
64
64
 
65
65
  ```bash
66
66
  # Submit and wait for results (default)
67
- mikado submit transcript.txt --campaign abcd1234
67
+ mikado submit transcript.txt --campaign 928721aa
68
68
 
69
69
  # Submit without waiting
70
- mikado submit transcript.txt --campaign abcd1234 --no-wait
70
+ mikado submit transcript.txt --campaign 928721aa --no-wait
71
71
 
72
72
  # Read from stdin
73
73
  cat transcript.txt | mikado submit -
74
74
 
75
75
  # JSON output for scripting
76
- mikado submit transcript.txt --campaign abcd1234 --json
76
+ mikado submit transcript.txt --campaign 928721aa --json
77
77
 
78
78
  # Custom timeout (default: 300s)
79
79
  mikado submit transcript.txt --timeout 60
@@ -83,7 +83,7 @@ mikado submit transcript.txt --timeout 60
83
83
 
84
84
  | Flag | Description |
85
85
  |------|-------------|
86
- | `-c, --campaign <id>` | Campaign short ID, UUID, or name |
86
+ | `-c, --campaign <id>` | Campaign UUID, UUID prefix, or name |
87
87
  | `--no-wait` | Return immediately with job ID |
88
88
  | `--timeout <seconds>` | Max wait time (default: 300) |
89
89
  | `--json` | Output JSON to stdout |
@@ -98,8 +98,8 @@ mikado campaigns
98
98
 
99
99
  ```
100
100
  ID Name Status Templates Conversations
101
- abcd1234 Sales Calls ACTIVE 2 142
102
- efgh5678 Support Tickets ACTIVE 1 89
101
+ 928721aa Sales Calls ACTIVE 2 142
102
+ 3f8a2b1c Support Tickets ACTIVE 1 89
103
103
  ```
104
104
 
105
105
  ### `mikado status <job-id>`
@@ -141,11 +141,11 @@ All commands support `--json` for machine-readable output. Errors go to stderr,
141
141
 
142
142
  ```bash
143
143
  # Pipe to jq
144
- mikado submit transcript.txt --campaign abcd1234 --json | jq '.insights[0]'
144
+ mikado submit transcript.txt --campaign 928721aa --json | jq '.insights[0]'
145
145
 
146
146
  # Batch processing
147
147
  for f in transcripts/*.txt; do
148
- mikado submit "$f" --campaign abcd1234 --json >> results.jsonl
148
+ mikado submit "$f" --campaign 928721aa --json >> results.jsonl
149
149
  done
150
150
  ```
151
151
 
@@ -0,0 +1,96 @@
1
+ // src/core/client.ts
2
+ import fetch from "node-fetch";
3
+ var MikadoClient = class {
4
+ apiKey;
5
+ baseUrl;
6
+ constructor(config) {
7
+ this.apiKey = config.apiKey;
8
+ this.baseUrl = config.baseUrl.replace(/\/$/, "");
9
+ }
10
+ async request(path, options = {}) {
11
+ const url = `${this.baseUrl}${path}`;
12
+ const headers = {
13
+ "Authorization": `Bearer ${this.apiKey}`,
14
+ "Content-Type": "application/json",
15
+ ...options.headers
16
+ };
17
+ const response = await fetch(url, {
18
+ ...options,
19
+ headers
20
+ });
21
+ if (!response.ok) {
22
+ let errorMessage = `HTTP ${response.status}: ${response.statusText}`;
23
+ try {
24
+ const errorBody = await response.json();
25
+ if (errorBody.message) {
26
+ errorMessage = errorBody.message;
27
+ } else if (errorBody.detail) {
28
+ errorMessage = errorBody.detail;
29
+ }
30
+ } catch {
31
+ }
32
+ throw new Error(errorMessage);
33
+ }
34
+ return response.json();
35
+ }
36
+ // All /api/v1/* routes go via nginx directly to FastAPI (see nginx/nginx.conf)
37
+ async whoami() {
38
+ return this.request("/api/v1/cli/whoami");
39
+ }
40
+ async submit(content, options) {
41
+ const body = { content };
42
+ if (options?.campaign) {
43
+ body.campaign = options.campaign;
44
+ }
45
+ if (options?.filename) {
46
+ body.filename = options.filename;
47
+ }
48
+ return this.request("/api/v1/cli/submit", {
49
+ method: "POST",
50
+ body: JSON.stringify(body)
51
+ });
52
+ }
53
+ async getJobStatus(jobId) {
54
+ return this.request(`/api/v1/cli/jobs/${jobId}`);
55
+ }
56
+ async getConversation(conversationId) {
57
+ return this.request(
58
+ `/api/v1/cli/conversations/${conversationId}`
59
+ );
60
+ }
61
+ async listCampaigns() {
62
+ return this.request("/api/v1/cli/campaigns");
63
+ }
64
+ };
65
+
66
+ // src/core/poller.ts
67
+ async function pollJob(client, jobId, options = {}) {
68
+ const {
69
+ interval = 1e3,
70
+ timeout = 3e5,
71
+ onUpdate
72
+ } = options;
73
+ const startTime = Date.now();
74
+ let currentInterval = interval;
75
+ const maxInterval = 5e3;
76
+ while (true) {
77
+ const elapsed = Date.now() - startTime;
78
+ if (elapsed > timeout) {
79
+ throw new Error(`Job polling timed out after ${timeout}ms`);
80
+ }
81
+ const status = await client.getJobStatus(jobId);
82
+ if (onUpdate) {
83
+ onUpdate(status);
84
+ }
85
+ if (status.status === "SUCCESS" || status.status === "FAILED") {
86
+ return status;
87
+ }
88
+ await new Promise((resolve) => setTimeout(resolve, currentInterval));
89
+ currentInterval = Math.min(currentInterval * 2, maxInterval);
90
+ }
91
+ }
92
+
93
+ export {
94
+ MikadoClient,
95
+ pollJob
96
+ };
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  MikadoClient,
4
4
  pollJob
5
- } from "./chunk-L27HHHAB.js";
5
+ } from "./chunk-R3SRVR4Z.js";
6
6
 
7
7
  // src/index.ts
8
8
  import { Command } from "commander";
@@ -172,7 +172,7 @@ function renderCampaigns(response) {
172
172
  response.campaigns.forEach((c) => {
173
173
  const statusColor = c.status === "ACTIVE" ? chalk.green : chalk.gray;
174
174
  console.log(
175
- ` ${c.short_id.padEnd(idWidth)}${chalk.cyan(c.name.padEnd(nameWidth))}${statusColor(c.status.padEnd(statusWidth))}${String(c.template_count).padEnd(templatesWidth)}${c.conversation_count}`
175
+ ` ${c.id.slice(0, 8).padEnd(idWidth)}${chalk.cyan(c.name.padEnd(nameWidth))}${statusColor(c.status.padEnd(statusWidth))}${String(c.template_count).padEnd(templatesWidth)}${c.conversation_count}`
176
176
  );
177
177
  });
178
178
  console.log();
@@ -558,16 +558,16 @@ async function campaignsCommand(options) {
558
558
 
559
559
  // src/index.ts
560
560
  var program = new Command();
561
- program.name("mikado").description("Mikado CLI - conversation data extraction").version("0.1.0");
561
+ program.name("mikado").description("Mikado AI CLI - conversation data extraction").version("0.1.0");
562
562
  program.option("--json", "Output results in JSON format");
563
- program.command("auth").description("Authenticate with Mikado API").option("--key <api-key>", "API key (or use MIKADO_API_KEY env var)").option("--url <base-url>", "Base URL (default: https://mikadoai.app)").action(async (options) => {
563
+ program.command("auth").description("Authenticate with Mikado AI API").option("--key <api-key>", "API key (or use MIKADO_API_KEY env var)").option("--url <base-url>", "Base URL (default: https://mikadoai.app)").action(async (options) => {
564
564
  await authCommand({
565
565
  key: options.key,
566
566
  url: options.url,
567
567
  json: program.opts().json
568
568
  });
569
569
  });
570
- program.command("submit <file>").description('Submit a transcript file for processing (use "-" to read from stdin)').option("-c, --campaign <id>", "Target campaign (short_id, UUID, or name)").option("--no-wait", "Do not wait for processing to complete").option("--timeout <seconds>", "Polling timeout in seconds (default: 300)", parseInt).action(async (file, options) => {
570
+ program.command("submit <file>").description('Submit a transcript file for processing (use "-" to read from stdin)').option("-c, --campaign <id>", "Target campaign (UUID, UUID prefix, or name)").option("--no-wait", "Do not wait for processing to complete").option("--timeout <seconds>", "Polling timeout in seconds (default: 300)", parseInt).action(async (file, options) => {
571
571
  await submitCommand(file, {
572
572
  campaign: options.campaign,
573
573
  wait: options.wait,
package/dist/mcp.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  MikadoClient,
4
4
  pollJob
5
- } from "./chunk-L27HHHAB.js";
5
+ } from "./chunk-R3SRVR4Z.js";
6
6
 
7
7
  // src/mcp.ts
8
8
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
@@ -16,7 +16,7 @@ import {
16
16
  var TOOLS = [
17
17
  {
18
18
  name: "mikado_submit",
19
- description: "Submit a conversation transcript to Mikado for processing. Returns immediately with job_id and conversation_id. Use mikado_submit_and_wait if you want to wait for results.",
19
+ description: "Submit a conversation transcript to Mikado AI for processing. Returns immediately with job_id and conversation_id. Use mikado_submit_and_wait if you want to wait for results.",
20
20
  inputSchema: {
21
21
  type: "object",
22
22
  properties: {
@@ -26,7 +26,7 @@ var TOOLS = [
26
26
  },
27
27
  campaign: {
28
28
  type: "string",
29
- description: "Campaign short_id, UUID, or name to target"
29
+ description: "Campaign UUID, UUID prefix, or name to target"
30
30
  },
31
31
  filename: {
32
32
  type: "string",
@@ -48,7 +48,7 @@ var TOOLS = [
48
48
  },
49
49
  campaign: {
50
50
  type: "string",
51
- description: "Campaign short_id, UUID, or name to target"
51
+ description: "Campaign UUID, UUID prefix, or name to target"
52
52
  },
53
53
  timeout_seconds: {
54
54
  type: "number",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikado-ai/cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Mikado AI CLI and MCP server — submit transcripts, extract insights, integrate with AI agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,6 +22,7 @@
22
22
  "conversational-ai"
23
23
  ],
24
24
  "bin": {
25
+ "mikado-ai": "./dist/index.js",
25
26
  "mikado": "./dist/index.js"
26
27
  },
27
28
  "exports": {
@@ -38,15 +39,16 @@
38
39
  "prepublishOnly": "npm run build"
39
40
  },
40
41
  "dependencies": {
41
- "commander": "^12.0.0",
42
42
  "@modelcontextprotocol/sdk": "^1.0.0",
43
- "ora": "^8.0.0",
44
- "chalk": "^5.0.0"
43
+ "chalk": "^5.0.0",
44
+ "commander": "^12.0.0",
45
+ "node-fetch": "^3.3.2",
46
+ "ora": "^8.0.0"
45
47
  },
46
48
  "devDependencies": {
49
+ "@types/node": "^20.0.0",
47
50
  "tsup": "^8.0.0",
48
- "typescript": "^5.5.0",
49
- "@types/node": "^20.0.0"
51
+ "typescript": "^5.5.0"
50
52
  },
51
53
  "engines": {
52
54
  "node": ">=18.0.0"