@mynitorai/sdk 0.2.3 → 0.2.5

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/dist/cli.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * MyNitor CLI - Quick Verification Utility
4
+ */
5
+ declare const init: any;
6
+ declare function run(): Promise<void>;
package/dist/cli.js ADDED
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * MyNitor CLI - Quick Verification Utility
5
+ */
6
+ const { init } = require('./index');
7
+ async function run() {
8
+ const apiKey = process.env.MYNITOR_API_KEY;
9
+ if (!apiKey) {
10
+ console.error('❌ Error: MYNITOR_API_KEY environment variable is not set.');
11
+ process.exit(1);
12
+ }
13
+ const command = process.argv[2];
14
+ if (command === 'ping') {
15
+ console.log('🚀 MyNitor: Sending verification signal to Cloud API...');
16
+ try {
17
+ const mn = init({
18
+ apiKey,
19
+ environment: 'onboarding-test'
20
+ });
21
+ // Trigger a manual event to verify connection
22
+ // We use a custom internal method or just a standard track if available
23
+ // In the current SDK, we can use the private sendEvent if it were public,
24
+ // or just trigger instrument() and a small log.
25
+ // For now, let's just use a fetch directly to verify connectivity
26
+ // and trigger the onboarding checkmark.
27
+ const endpoint = 'https://app.mynitor.ai/api/v1/events';
28
+ const response = await fetch(endpoint, {
29
+ method: 'POST',
30
+ headers: {
31
+ 'Content-Type': 'application/json',
32
+ 'Authorization': `Bearer ${apiKey}`
33
+ },
34
+ body: JSON.stringify({
35
+ event_version: '1.0',
36
+ timestamp: new Date().toISOString(),
37
+ agent: 'mynitor-cli',
38
+ workflow: 'onboarding-ping',
39
+ model: 'ping-test',
40
+ input_tokens: 0,
41
+ output_tokens: 0,
42
+ status: 'success',
43
+ metadata: { source: 'cli-ping' }
44
+ })
45
+ });
46
+ if (response.ok) {
47
+ console.log('✅ Connection verified! Event sent to MyNitor Cloud.');
48
+ console.log('✨ Check your onboarding dashboard for the green checkmark.');
49
+ }
50
+ else {
51
+ const text = await response.text();
52
+ console.error(`❌ Failed to send event: ${response.status} ${response.statusText}`);
53
+ console.error(`Response: ${text}`);
54
+ process.exit(1);
55
+ }
56
+ }
57
+ catch (error) {
58
+ console.error('❌ Network Error: Could not reach MyNitor Cloud.');
59
+ console.error(error);
60
+ process.exit(1);
61
+ }
62
+ }
63
+ else {
64
+ console.log('Usage: npx @mynitorai/sdk ping');
65
+ }
66
+ }
67
+ run();
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@mynitorai/sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Production safety and observability for AI systems.",
5
5
  "main": "dist/index.js",
6
+ "bin": {
7
+ "mynitor": "dist/cli.js"
8
+ },
6
9
  "types": "dist/index.d.ts",
7
10
  "files": [
8
11
  "dist"