@frostbridge/imdl 0.1.1 → 0.1.3

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1285,6 +1285,8 @@ async function initCommand(options) {
1285
1285
  const joinData = await joinRes.json();
1286
1286
  config.teamId = joinData.teamId;
1287
1287
  if (joinData.teamName) config.teamName = joinData.teamName;
1288
+ if (joinData.apiKey) config.authToken = joinData.apiKey;
1289
+ if (joinData.developerId) config.developerId = joinData.developerId;
1288
1290
  console.log(pc2.green(` \u2713 Joined team: ${config.teamName || config.teamId}`));
1289
1291
  } else {
1290
1292
  console.log(pc2.yellow(` \u26A0 Could not validate team token (API returned ${joinRes.status})`));
@@ -1506,7 +1508,8 @@ import pc3 from "picocolors";
1506
1508
  import { createServer } from "http";
1507
1509
  import { URL as URL2 } from "url";
1508
1510
  import { randomBytes } from "crypto";
1509
- var DASHBOARD_URL = process.env.IMDL_DASHBOARD_URL || "http://localhost:5173";
1511
+ var DEFAULT_DASHBOARD_URL = "https://imdl-dashboard-1028078600113.us-central1.run.app";
1512
+ var DASHBOARD_URL = process.env.IMDL_DASHBOARD_URL || DEFAULT_DASHBOARD_URL;
1510
1513
  async function loginCommand() {
1511
1514
  console.log("");
1512
1515
  console.log(pc3.bold(pc3.cyan("IMDL Login")));
@@ -1540,6 +1543,7 @@ async function loginCommand() {
1540
1543
  config.authToken = result.token;
1541
1544
  config.teamId = result.teamId;
1542
1545
  if (result.teamName) config.teamName = result.teamName;
1546
+ if (result.developerId) config.developerId = result.developerId;
1543
1547
  saveConfig(config);
1544
1548
  console.log(pc3.green(" \u2713 Authenticated successfully!"));
1545
1549
  console.log("");
@@ -1571,6 +1575,7 @@ function waitForCallback(port, expectedState) {
1571
1575
  const token = url.searchParams.get("token");
1572
1576
  const teamId = url.searchParams.get("teamId");
1573
1577
  const teamName = url.searchParams.get("teamName");
1578
+ const developerId = url.searchParams.get("developerId");
1574
1579
  const returnedState = url.searchParams.get("state");
1575
1580
  const error = url.searchParams.get("error");
1576
1581
  res.setHeader("Access-Control-Allow-Origin", DASHBOARD_URL);
@@ -1596,7 +1601,7 @@ function waitForCallback(port, expectedState) {
1596
1601
  res.end("<html><body><h2>Authenticated!</h2><p>You can close this tab and return to your terminal.</p></body></html>");
1597
1602
  clearTimeout(timeout);
1598
1603
  server.close();
1599
- resolve4({ token, teamId, teamName: teamName || void 0 });
1604
+ resolve4({ token, teamId, teamName: teamName || void 0, developerId: developerId || void 0 });
1600
1605
  });
1601
1606
  server.listen(port);
1602
1607
  });
@@ -2722,7 +2727,7 @@ async function sendBatch(apiUrl, sessionId, events, developerId) {
2722
2727
  const config = loadConfig();
2723
2728
  const headers = { "Content-Type": "application/json" };
2724
2729
  if (config.authToken) {
2725
- headers["Authorization"] = `Bearer ${config.authToken}`;
2730
+ headers["X-IMDL-Key"] = config.authToken;
2726
2731
  }
2727
2732
  try {
2728
2733
  const res = await fetch(`${apiUrl}/api/sessions/${sessionId}/events`, {
@@ -3535,7 +3540,7 @@ async function collectPrompts() {
3535
3540
  collected++;
3536
3541
  }
3537
3542
  const usageHeaders = { "Content-Type": "application/json" };
3538
- if (config.authToken) usageHeaders["Authorization"] = `Bearer ${config.authToken}`;
3543
+ if (config.authToken) usageHeaders["X-IMDL-Key"] = config.authToken;
3539
3544
  for (const [sessionId, usage] of usageBySession) {
3540
3545
  try {
3541
3546
  await fetch(`${config.apiUrl}/api/sessions/${sessionId}/usage`, {
@@ -3614,7 +3619,7 @@ async function requestCommand(options) {
3614
3619
  method: "POST",
3615
3620
  headers: {
3616
3621
  "Content-Type": "application/json",
3617
- ...config.authToken ? { "Authorization": `Bearer ${config.authToken}` } : {}
3622
+ ...config.authToken ? { "X-IMDL-Key": config.authToken } : {}
3618
3623
  },
3619
3624
  body: JSON.stringify({
3620
3625
  serverName: options.server,
@@ -4131,7 +4136,7 @@ async function reportPermissions(report) {
4131
4136
  method: "POST",
4132
4137
  headers: {
4133
4138
  "Content-Type": "application/json",
4134
- "Authorization": `Bearer ${config.authToken}`
4139
+ "X-IMDL-Key": config.authToken
4135
4140
  },
4136
4141
  body: JSON.stringify(report)
4137
4142
  });
@@ -4149,7 +4154,7 @@ async function checkCompliance(developerId) {
4149
4154
  try {
4150
4155
  const res = await fetch(`${config.apiUrl}/api/permissions/check?developerId=${encodeURIComponent(developerId)}`, {
4151
4156
  headers: {
4152
- "Authorization": `Bearer ${config.authToken}`
4157
+ "X-IMDL-Key": config.authToken
4153
4158
  }
4154
4159
  });
4155
4160
  if (!res.ok) return { ok: false };
@@ -4440,7 +4445,7 @@ async function permissionsToggleCommand(enable) {
4440
4445
  method: "POST",
4441
4446
  headers: {
4442
4447
  "Content-Type": "application/json",
4443
- "Authorization": `Bearer ${config.authToken}`
4448
+ "X-IMDL-Key": config.authToken
4444
4449
  },
4445
4450
  body: JSON.stringify({
4446
4451
  developerId: config.developerId,
@@ -5252,7 +5257,7 @@ async function trySyncPolicies() {
5252
5257
  const config = loadConfig();
5253
5258
  const authHeaders = {};
5254
5259
  if (config.authToken) {
5255
- authHeaders["Authorization"] = `Bearer ${config.authToken}`;
5260
+ authHeaders["X-IMDL-Key"] = config.authToken;
5256
5261
  }
5257
5262
  try {
5258
5263
  const controller = new AbortController();
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "restricted"
5
5
  },
6
- "version": "0.1.1",
6
+ "version": "0.1.3",
7
7
  "description": "IMDL — Intelligent Mediation & Detection Layer. AI agent security CLI.",
8
8
  "files": [
9
9
  "dist"