@outputai/cli 0.10.1-next.09ed166.0 → 0.10.1-next.2cbd0a2.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.
@@ -3,6 +3,7 @@ import { fetchWorkflowHistory } from '#services/workflow_history.js';
3
3
  import buildSpanLabels from '#utils/span_labels.js';
4
4
  import { isTerminalRunStatus } from '#views/dev/hooks/use_run_detail.js';
5
5
  import { usePoll, POLL_INTERVAL_MS } from '#views/dev/hooks/use_poll.js';
6
+ import { createBoundedCache } from '#views/dev/utils/bounded_cache.js';
6
7
  const EMPTY_GRAPH = {
7
8
  spans: [],
8
9
  totalDurationMs: 0,
@@ -11,7 +12,8 @@ const EMPTY_GRAPH = {
11
12
  loading: false,
12
13
  error: null
13
14
  };
14
- const stepGraphCache = new Map();
15
+ const STEP_GRAPH_CACHE_MAX = 50;
16
+ const stepGraphCache = createBoundedCache(STEP_GRAPH_CACHE_MAX);
15
17
  /**
16
18
  * Fetches a run's correlated step spans for the dev TUI's waterfall overlay,
17
19
  * reusing the same `fetchWorkflowHistory` path as the `workflow history` CLI
@@ -0,0 +1,14 @@
1
+ export interface BoundedCache<K, V extends {}> {
2
+ get(key: K): V | undefined;
3
+ set(key: K, value: V): void;
4
+ has(key: K): boolean;
5
+ clear(): void;
6
+ size(): number;
7
+ }
8
+ /**
9
+ * A small LRU cache backed by an insertion-ordered `Map`, capped at `maxSize`
10
+ * entries. Reading a key refreshes its recency; once the cap is exceeded the
11
+ * least-recently-used entries are evicted. Drop-in compatible with the
12
+ * `Map.get` / `Map.set` calls it replaces.
13
+ */
14
+ export declare const createBoundedCache: <K, V extends {}>(maxSize: number) => BoundedCache<K, V>;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * A small LRU cache backed by an insertion-ordered `Map`, capped at `maxSize`
3
+ * entries. Reading a key refreshes its recency; once the cap is exceeded the
4
+ * least-recently-used entries are evicted. Drop-in compatible with the
5
+ * `Map.get` / `Map.set` calls it replaces.
6
+ */
7
+ export const createBoundedCache = (maxSize) => {
8
+ if (maxSize < 1) {
9
+ throw new Error('createBoundedCache: maxSize must be >= 1');
10
+ }
11
+ const entries = new Map();
12
+ return {
13
+ get(key) {
14
+ const value = entries.get(key);
15
+ if (value === undefined) {
16
+ return value;
17
+ }
18
+ entries.delete(key);
19
+ entries.set(key, value);
20
+ return value;
21
+ },
22
+ set(key, value) {
23
+ entries.delete(key);
24
+ entries.set(key, value);
25
+ if (entries.size > maxSize) {
26
+ const oldest = entries.keys().next();
27
+ if (!oldest.done) {
28
+ entries.delete(oldest.value);
29
+ }
30
+ }
31
+ },
32
+ has(key) {
33
+ return entries.has(key);
34
+ },
35
+ clear() {
36
+ entries.clear();
37
+ },
38
+ size() {
39
+ return entries.size;
40
+ }
41
+ };
42
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,53 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { createBoundedCache } from './bounded_cache.js';
3
+ describe('createBoundedCache', () => {
4
+ it('round-trips set and get', () => {
5
+ const cache = createBoundedCache(3);
6
+ cache.set('a', 1);
7
+ expect(cache.get('a')).toBe(1);
8
+ expect(cache.get('missing')).toBeUndefined();
9
+ });
10
+ it('evicts the oldest entry once maxSize is exceeded', () => {
11
+ const cache = createBoundedCache(2);
12
+ cache.set('a', 1);
13
+ cache.set('b', 2);
14
+ cache.set('c', 3);
15
+ expect(cache.has('a')).toBe(false);
16
+ expect(cache.get('b')).toBe(2);
17
+ expect(cache.get('c')).toBe(3);
18
+ });
19
+ it('refreshes recency on get so the touched entry survives eviction', () => {
20
+ const cache = createBoundedCache(2);
21
+ cache.set('a', 1);
22
+ cache.set('b', 2);
23
+ // Touch 'a' so 'b' becomes the least-recently-used entry.
24
+ expect(cache.get('a')).toBe(1);
25
+ cache.set('c', 3);
26
+ expect(cache.has('a')).toBe(true);
27
+ expect(cache.has('b')).toBe(false);
28
+ expect(cache.has('c')).toBe(true);
29
+ });
30
+ it('updates an existing key in place without growing', () => {
31
+ const cache = createBoundedCache(2);
32
+ cache.set('a', 1);
33
+ cache.set('a', 2);
34
+ expect(cache.get('a')).toBe(2);
35
+ expect(cache.size()).toBe(1);
36
+ });
37
+ it('supports has and clear', () => {
38
+ const cache = createBoundedCache(2);
39
+ cache.set('a', 1);
40
+ expect(cache.has('a')).toBe(true);
41
+ cache.clear();
42
+ expect(cache.has('a')).toBe(false);
43
+ expect(cache.size()).toBe(0);
44
+ });
45
+ it('never exceeds maxSize', () => {
46
+ const cache = createBoundedCache(3);
47
+ Array.from({ length: 100 }, (_, i) => i).forEach(i => {
48
+ cache.set(`key-${i}`, i);
49
+ expect(cache.size()).toBeLessThanOrEqual(3);
50
+ });
51
+ expect(cache.size()).toBe(3);
52
+ });
53
+ });
@@ -416,6 +416,41 @@
416
416
  "show.js"
417
417
  ]
418
418
  },
419
+ "dev:down": {
420
+ "aliases": [],
421
+ "args": {},
422
+ "description": "Stop Output development services started by `output dev`\n\nUseful after `output dev -d`, or when an attached `output dev` session\nleft the services running on quit.",
423
+ "examples": [
424
+ "<%= config.bin %> <%= command.id %>",
425
+ "<%= config.bin %> <%= command.id %> --compose-file ./custom-docker-compose.yml"
426
+ ],
427
+ "flags": {
428
+ "compose-file": {
429
+ "char": "f",
430
+ "description": "Path to a custom docker-compose file",
431
+ "name": "compose-file",
432
+ "required": false,
433
+ "hasDynamicHelp": false,
434
+ "multiple": false,
435
+ "type": "option"
436
+ }
437
+ },
438
+ "hasDynamicHelp": false,
439
+ "hiddenAliases": [],
440
+ "id": "dev:down",
441
+ "pluginAlias": "@outputai/cli",
442
+ "pluginName": "@outputai/cli",
443
+ "pluginType": "core",
444
+ "strict": true,
445
+ "enableJsonFlag": false,
446
+ "isESM": true,
447
+ "relativePath": [
448
+ "dist",
449
+ "commands",
450
+ "dev",
451
+ "down.js"
452
+ ]
453
+ },
419
454
  "dev:eject": {
420
455
  "aliases": [],
421
456
  "args": {},
@@ -463,9 +498,10 @@
463
498
  "dev": {
464
499
  "aliases": [],
465
500
  "args": {},
466
- "description": "Start Output development services (auto-restarts worker on file changes)\n\nTo run a second dev stack concurrently, override host ports in .env:\n\n OUTPUT_API_HOST_PORT=3002\n OUTPUT_TEMPORAL_UI_HOST_PORT=8081\n OUTPUT_TEMPORAL_HOST_PORT=7234",
501
+ "description": "Start Output development services (auto-restarts worker on file changes)\n\nIf services are already running (e.g. after `output dev -d`), this attaches\nto monitor them rather than treating our own containers as a port collision.\nQuitting an attached session leaves the services running — stop them with\n`output dev down`.\n\nTo run a second dev stack concurrently, give it its own compose project and\nhost ports in .env — without DOCKER_SERVICE_NAME both checkouts share one\nstack, and the second will attach to the first instead of starting:\n\n DOCKER_SERVICE_NAME=output-sdk-two\n OUTPUT_API_HOST_PORT=3002\n OUTPUT_TEMPORAL_UI_HOST_PORT=8081\n OUTPUT_TEMPORAL_HOST_PORT=7234",
467
502
  "examples": [
468
503
  "<%= config.bin %> <%= command.id %>",
504
+ "<%= config.bin %> <%= command.id %> --detached",
469
505
  "<%= config.bin %> <%= command.id %> --compose-file ./custom-docker-compose.yml",
470
506
  "<%= config.bin %> <%= command.id %> --image-pull-policy missing"
471
507
  ],
@@ -1671,5 +1707,5 @@
1671
1707
  ]
1672
1708
  }
1673
1709
  },
1674
- "version": "0.10.1-next.09ed166.0"
1710
+ "version": "0.10.1-next.2cbd0a2.0"
1675
1711
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outputai/cli",
3
- "version": "0.10.1-next.09ed166.0",
3
+ "version": "0.10.1-next.2cbd0a2.0",
4
4
  "description": "CLI for Output.ai workflow generation",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -38,9 +38,9 @@
38
38
  "semver": "7.7.4",
39
39
  "undici": "8.5.0",
40
40
  "yaml": "^2.8.3",
41
- "@outputai/credentials": "0.10.1-next.09ed166.0",
42
- "@outputai/llm": "0.10.1-next.09ed166.0",
43
- "@outputai/evals": "0.10.1-next.09ed166.0"
41
+ "@outputai/evals": "0.10.1-next.2cbd0a2.0",
42
+ "@outputai/llm": "0.10.1-next.2cbd0a2.0",
43
+ "@outputai/credentials": "0.10.1-next.2cbd0a2.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/cli-progress": "3.11.6",