mcoda 0.1.29 → 0.1.30

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.
@@ -1 +1 @@
1
- {"version":3,"file":"AgentsCommands.d.ts","sourceRoot":"","sources":["../../../src/commands/agents/AgentsCommands.ts"],"names":[],"mappings":"AA6TA,qBAAa,cAAc;WACZ,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAqVhD"}
1
+ {"version":3,"file":"AgentsCommands.d.ts","sourceRoot":"","sources":["../../../src/commands/agents/AgentsCommands.ts"],"names":[],"mappings":"AA0WA,qBAAa,cAAc;WACZ,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAqWhD"}
@@ -302,6 +302,50 @@ const formatLatency = (value) => {
302
302
  return "-";
303
303
  return `${Math.round(value)}ms`;
304
304
  };
305
+ const LIMIT_WINDOW_ORDER = {
306
+ rolling_5h: 0,
307
+ daily: 1,
308
+ weekly: 2,
309
+ other: 3,
310
+ };
311
+ const LIMIT_WINDOW_LABEL = {
312
+ rolling_5h: "5h",
313
+ daily: "daily",
314
+ weekly: "weekly",
315
+ other: "other",
316
+ };
317
+ const summarizeUsageLimits = (entries) => {
318
+ if (!entries || entries.length === 0)
319
+ return "-";
320
+ const latestByWindow = new Map();
321
+ const sortedByObserved = [...entries].sort((left, right) => {
322
+ const leftMs = Date.parse(left.observedAt ?? "");
323
+ const rightMs = Date.parse(right.observedAt ?? "");
324
+ return (Number.isFinite(rightMs) ? rightMs : 0) - (Number.isFinite(leftMs) ? leftMs : 0);
325
+ });
326
+ for (const entry of sortedByObserved) {
327
+ if (!latestByWindow.has(entry.windowType)) {
328
+ latestByWindow.set(entry.windowType, entry);
329
+ }
330
+ }
331
+ const windows = Array.from(latestByWindow.values()).sort((left, right) => {
332
+ const leftOrder = LIMIT_WINDOW_ORDER[left.windowType] ?? Number.MAX_SAFE_INTEGER;
333
+ const rightOrder = LIMIT_WINDOW_ORDER[right.windowType] ?? Number.MAX_SAFE_INTEGER;
334
+ if (leftOrder !== rightOrder)
335
+ return leftOrder - rightOrder;
336
+ return left.windowType.localeCompare(right.windowType);
337
+ });
338
+ const parts = windows.map((entry) => {
339
+ const label = LIMIT_WINDOW_LABEL[entry.windowType] ?? entry.windowType;
340
+ const status = entry.status === "exhausted" ? "exh" : entry.status === "available" ? "ok" : entry.status ?? "?";
341
+ const resetAt = entry.effectiveResetAt ?? entry.resetAt;
342
+ if (!resetAt)
343
+ return `${label}:${status}`;
344
+ const approx = entry.resetAtExact ? "" : "~";
345
+ return `${label}:${status}@${approx}${formatDate(resetAt)}`;
346
+ });
347
+ return parts.join("; ");
348
+ };
305
349
  const renderKeyValues = (entries) => {
306
350
  const width = entries.reduce((max, [label]) => Math.max(max, label.length), 0);
307
351
  const lines = entries.map(([label, value]) => `${pad(label, width)} : ${value}`);
@@ -342,6 +386,18 @@ export class AgentsCommands {
342
386
  console.log("No agents found.");
343
387
  }
344
388
  else {
389
+ const usageLimits = await api.listAgentUsageLimits();
390
+ const limitsByAgent = new Map();
391
+ for (const entry of usageLimits) {
392
+ const key = entry.agentSlug ?? entry.agentId;
393
+ const group = limitsByAgent.get(key);
394
+ if (group) {
395
+ group.push(entry);
396
+ }
397
+ else {
398
+ limitsByAgent.set(key, [entry]);
399
+ }
400
+ }
345
401
  const headers = [
346
402
  "SLUG",
347
403
  "ADAPTER",
@@ -355,6 +411,7 @@ export class AgentsCommands {
355
411
  "TOOLS",
356
412
  "USAGE",
357
413
  "COST/1M",
414
+ "LIMITS",
358
415
  "HEALTH",
359
416
  "LAST CHECK",
360
417
  "CAPABILITIES",
@@ -372,6 +429,7 @@ export class AgentsCommands {
372
429
  6,
373
430
  10,
374
431
  12,
432
+ 64,
375
433
  10,
376
434
  16,
377
435
  36,
@@ -389,6 +447,7 @@ export class AgentsCommands {
389
447
  agent.supportsTools === undefined ? "-" : agent.supportsTools ? "yes" : "no",
390
448
  agent.bestUsage ?? "-",
391
449
  formatCost(agent.costPerMillion),
450
+ summarizeUsageLimits(limitsByAgent.get(agent.slug) ?? (agent.id ? limitsByAgent.get(agent.id) : undefined)),
392
451
  agent.health?.status ?? "unknown",
393
452
  formatDate(agent.health?.lastCheckedAt),
394
453
  formatCapabilities(agent.capabilities),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcoda",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "description": "Local-first CLI for planning, documentation, and execution workflows with agent assistance.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,12 +45,12 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "yaml": "^2.4.2",
48
- "@mcoda/core": "0.1.29",
49
- "@mcoda/shared": "0.1.29"
48
+ "@mcoda/core": "0.1.30",
49
+ "@mcoda/shared": "0.1.30"
50
50
  },
51
51
  "devDependencies": {
52
- "@mcoda/db": "0.1.29",
53
- "@mcoda/integrations": "0.1.29"
52
+ "@mcoda/integrations": "0.1.30",
53
+ "@mcoda/db": "0.1.30"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsc -p tsconfig.json",