@hasna/conversations 0.1.3 → 0.1.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/index.js CHANGED
@@ -2661,6 +2661,381 @@ function useSpaceMessages(spaceName) {
2661
2661
  return messages;
2662
2662
  }
2663
2663
  // src/lib/identity.ts
2664
+ import { readFileSync, writeFileSync, mkdirSync as mkdirSync2 } from "fs";
2665
+ import { join as join2, dirname as dirname2 } from "path";
2666
+ import { homedir as homedir2 } from "os";
2667
+
2668
+ // src/lib/names.ts
2669
+ var AGENT_NAMES = [
2670
+ "amber-fox",
2671
+ "arctic-wolf",
2672
+ "ashen-crow",
2673
+ "azure-hawk",
2674
+ "astral-lynx",
2675
+ "autumn-bear",
2676
+ "agile-puma",
2677
+ "alpine-ibex",
2678
+ "ancient-owl",
2679
+ "aqua-otter",
2680
+ "arid-viper",
2681
+ "atom-finch",
2682
+ "auburn-deer",
2683
+ "aurora-seal",
2684
+ "avid-mink",
2685
+ "blaze-tiger",
2686
+ "bright-heron",
2687
+ "bronze-eagle",
2688
+ "brisk-hare",
2689
+ "burnt-moth",
2690
+ "bold-raven",
2691
+ "blue-whale",
2692
+ "boreal-fox",
2693
+ "brass-cobra",
2694
+ "brave-ram",
2695
+ "brick-crane",
2696
+ "brief-newt",
2697
+ "briny-crab",
2698
+ "broad-elk",
2699
+ "brook-dove",
2700
+ "calm-panda",
2701
+ "cedar-jay",
2702
+ "chief-lion",
2703
+ "chrome-bat",
2704
+ "civic-wren",
2705
+ "clear-swan",
2706
+ "cliff-goat",
2707
+ "coal-shark",
2708
+ "cold-crane",
2709
+ "copper-jay",
2710
+ "coral-fish",
2711
+ "crisp-lark",
2712
+ "cross-mole",
2713
+ "cubic-wasp",
2714
+ "cyan-toad",
2715
+ "dark-stag",
2716
+ "dawn-robin",
2717
+ "deep-squid",
2718
+ "delta-fox",
2719
+ "dense-boar",
2720
+ "dew-spider",
2721
+ "dim-gecko",
2722
+ "draft-bear",
2723
+ "drift-gull",
2724
+ "dry-newt",
2725
+ "dual-crane",
2726
+ "dune-mouse",
2727
+ "dusk-moth",
2728
+ "dusty-mule",
2729
+ "dwarf-carp",
2730
+ "east-falcon",
2731
+ "echo-parrot",
2732
+ "edge-shark",
2733
+ "elm-beetle",
2734
+ "ember-lynx",
2735
+ "epoch-crane",
2736
+ "even-pike",
2737
+ "extra-ant",
2738
+ "elder-stork",
2739
+ "ebon-crow",
2740
+ "ever-finch",
2741
+ "exact-moth",
2742
+ "exile-wren",
2743
+ "equal-dove",
2744
+ "etch-hare",
2745
+ "faint-orca",
2746
+ "far-condor",
2747
+ "fern-mouse",
2748
+ "fierce-yak",
2749
+ "first-kite",
2750
+ "fjord-seal",
2751
+ "flint-wolf",
2752
+ "fog-parrot",
2753
+ "forge-bull",
2754
+ "fossil-ray",
2755
+ "frank-mink",
2756
+ "free-eagle",
2757
+ "fresh-colt",
2758
+ "frost-bear",
2759
+ "fuse-wasp",
2760
+ "gale-hawk",
2761
+ "gem-turtle",
2762
+ "ghost-lynx",
2763
+ "gilt-robin",
2764
+ "glad-moose",
2765
+ "glass-eel",
2766
+ "gleam-puma",
2767
+ "glyph-owl",
2768
+ "gold-crane",
2769
+ "gorge-lion",
2770
+ "grain-duck",
2771
+ "grand-wolf",
2772
+ "gray-fox",
2773
+ "green-hare",
2774
+ "grit-shark",
2775
+ "half-stork",
2776
+ "haze-panther",
2777
+ "heart-dove",
2778
+ "helm-eagle",
2779
+ "herb-toad",
2780
+ "hex-spider",
2781
+ "high-falcon",
2782
+ "hive-hornet",
2783
+ "holo-swan",
2784
+ "hood-cobra",
2785
+ "horn-bison",
2786
+ "huge-squid",
2787
+ "hull-crab",
2788
+ "hunt-marten",
2789
+ "husk-moth",
2790
+ "ice-leopard",
2791
+ "idle-crane",
2792
+ "inch-beetle",
2793
+ "indigo-jay",
2794
+ "inner-fox",
2795
+ "ion-parrot",
2796
+ "iron-bull",
2797
+ "isle-pelican",
2798
+ "ivory-hawk",
2799
+ "ivy-snake",
2800
+ "iota-wren",
2801
+ "ink-raven",
2802
+ "ignite-ram",
2803
+ "inert-slug",
2804
+ "infra-mole",
2805
+ "jade-tiger",
2806
+ "jest-magpie",
2807
+ "jewel-crane",
2808
+ "joint-boar",
2809
+ "jovial-elk",
2810
+ "jump-frog",
2811
+ "jungle-cat",
2812
+ "jury-dove",
2813
+ "just-heron",
2814
+ "jolt-wasp",
2815
+ "keen-osprey",
2816
+ "kelp-seal",
2817
+ "key-falcon",
2818
+ "kind-panda",
2819
+ "knot-viper",
2820
+ "kraft-bear",
2821
+ "kite-mouse",
2822
+ "knoll-deer",
2823
+ "know-crane",
2824
+ "karma-wolf",
2825
+ "lake-otter",
2826
+ "lapis-jay",
2827
+ "last-condor",
2828
+ "leaf-gecko",
2829
+ "lean-coyote",
2830
+ "light-lynx",
2831
+ "lime-parrot",
2832
+ "live-eagle",
2833
+ "long-crane",
2834
+ "lost-fox",
2835
+ "loud-finch",
2836
+ "low-shark",
2837
+ "luck-rabbit",
2838
+ "lunar-owl",
2839
+ "lush-ibis",
2840
+ "malt-badger",
2841
+ "maple-wren",
2842
+ "mars-falcon",
2843
+ "matte-crow",
2844
+ "mesa-hawk",
2845
+ "mild-orca",
2846
+ "mint-dove",
2847
+ "mist-puma",
2848
+ "mock-robin",
2849
+ "mono-wolf",
2850
+ "moon-bear",
2851
+ "moss-turtle",
2852
+ "mud-heron",
2853
+ "mute-swan",
2854
+ "myth-lynx",
2855
+ "navy-eagle",
2856
+ "near-mink",
2857
+ "neon-parrot",
2858
+ "nest-crane",
2859
+ "next-fox",
2860
+ "nimble-ram",
2861
+ "node-spider",
2862
+ "noon-hawk",
2863
+ "north-seal",
2864
+ "nova-owl",
2865
+ "null-moth",
2866
+ "numb-carp",
2867
+ "nutmeg-jay",
2868
+ "neat-cobra",
2869
+ "nomad-elk",
2870
+ "oak-badger",
2871
+ "oat-finch",
2872
+ "odd-pelican",
2873
+ "olive-bear",
2874
+ "onyx-raven",
2875
+ "opal-crane",
2876
+ "open-wolf",
2877
+ "orbit-lynx",
2878
+ "ore-shark",
2879
+ "outer-dove",
2880
+ "pale-tiger",
2881
+ "park-heron",
2882
+ "peak-eagle",
2883
+ "pine-fox",
2884
+ "pixel-owl",
2885
+ "plain-goat",
2886
+ "plum-crane",
2887
+ "polar-ray",
2888
+ "port-falcon",
2889
+ "prime-wolf",
2890
+ "prism-jay",
2891
+ "proud-lion",
2892
+ "pulse-bat",
2893
+ "pure-swan",
2894
+ "pyro-hawk",
2895
+ "quake-bear",
2896
+ "quartz-jay",
2897
+ "quest-falcon",
2898
+ "quick-otter",
2899
+ "quiet-crane",
2900
+ "rain-leopard",
2901
+ "rapid-hare",
2902
+ "raw-condor",
2903
+ "reef-dolphin",
2904
+ "regal-stag",
2905
+ "ridge-fox",
2906
+ "rift-cobra",
2907
+ "rigid-crane",
2908
+ "river-otter",
2909
+ "rock-eagle",
2910
+ "root-mole",
2911
+ "rose-finch",
2912
+ "rough-boar",
2913
+ "ruby-hawk",
2914
+ "rust-wolf",
2915
+ "sage-owl",
2916
+ "salt-crane",
2917
+ "sand-viper",
2918
+ "satin-dove",
2919
+ "scale-dragon",
2920
+ "scarlet-ibis",
2921
+ "sea-falcon",
2922
+ "shade-lynx",
2923
+ "sharp-eagle",
2924
+ "shell-crab",
2925
+ "short-fox",
2926
+ "sigma-jay",
2927
+ "silk-moth",
2928
+ "silver-wolf",
2929
+ "slate-bear",
2930
+ "slim-heron",
2931
+ "smoke-puma",
2932
+ "snap-turtle",
2933
+ "snow-leopard",
2934
+ "solar-crane",
2935
+ "solid-ram",
2936
+ "sonic-bat",
2937
+ "south-seal",
2938
+ "spark-robin",
2939
+ "spice-wren",
2940
+ "split-mink",
2941
+ "spring-elk",
2942
+ "squid-ink",
2943
+ "stark-crow",
2944
+ "steel-hawk",
2945
+ "stern-bull",
2946
+ "still-swan",
2947
+ "stone-fox",
2948
+ "storm-eagle",
2949
+ "stout-boar",
2950
+ "stray-cat",
2951
+ "strong-lion",
2952
+ "sun-parrot",
2953
+ "surf-dolphin",
2954
+ "swift-deer",
2955
+ "teal-crane",
2956
+ "terra-wolf",
2957
+ "thick-bear",
2958
+ "thin-spider",
2959
+ "third-owl",
2960
+ "thorn-fox",
2961
+ "tide-seal",
2962
+ "timber-jay",
2963
+ "tiny-wren",
2964
+ "toast-mole",
2965
+ "topaz-hawk",
2966
+ "torch-lynx",
2967
+ "trace-falcon",
2968
+ "true-eagle",
2969
+ "tusk-walrus",
2970
+ "ultra-crane",
2971
+ "umbra-wolf",
2972
+ "unit-fox",
2973
+ "upper-hawk",
2974
+ "urban-jay",
2975
+ "vale-deer",
2976
+ "vast-eagle",
2977
+ "vault-bear",
2978
+ "velvet-owl",
2979
+ "vent-crane",
2980
+ "verse-fox",
2981
+ "vigor-lynx",
2982
+ "vine-parrot",
2983
+ "vivid-swan",
2984
+ "void-raven",
2985
+ "volt-hawk",
2986
+ "vow-falcon",
2987
+ "vintage-jay",
2988
+ "vista-wolf",
2989
+ "vital-hare",
2990
+ "warm-otter",
2991
+ "wave-dolphin",
2992
+ "wax-crane",
2993
+ "west-falcon",
2994
+ "wheat-mouse",
2995
+ "white-tiger",
2996
+ "wide-eagle",
2997
+ "wild-fox",
2998
+ "wind-hawk",
2999
+ "wire-spider",
3000
+ "wise-owl",
3001
+ "wood-thrush",
3002
+ "wool-ram",
3003
+ "wren-song",
3004
+ "wry-crow",
3005
+ "xeno-crane",
3006
+ "xerus-fox",
3007
+ "yarn-robin",
3008
+ "yew-falcon",
3009
+ "young-wolf",
3010
+ "zeal-hawk",
3011
+ "zen-panda",
3012
+ "zero-crane",
3013
+ "zinc-eagle",
3014
+ "zone-fox"
3015
+ ];
3016
+
3017
+ // src/lib/identity.ts
3018
+ var AGENT_ID_FILE = join2(homedir2(), ".conversations", "agent-id");
3019
+ var cachedAutoName = null;
3020
+ function getAutoName() {
3021
+ if (cachedAutoName)
3022
+ return cachedAutoName;
3023
+ try {
3024
+ const name2 = readFileSync(AGENT_ID_FILE, "utf-8").trim();
3025
+ if (name2) {
3026
+ cachedAutoName = name2;
3027
+ return name2;
3028
+ }
3029
+ } catch {}
3030
+ const name = AGENT_NAMES[Math.floor(Math.random() * AGENT_NAMES.length)];
3031
+ cachedAutoName = name;
3032
+ try {
3033
+ mkdirSync2(dirname2(AGENT_ID_FILE), { recursive: true });
3034
+ writeFileSync(AGENT_ID_FILE, name + `
3035
+ `, "utf-8");
3036
+ } catch {}
3037
+ return name;
3038
+ }
2664
3039
  function resolveIdentity(explicit) {
2665
3040
  const explicitValue = explicit?.trim();
2666
3041
  if (explicitValue)
@@ -2668,7 +3043,7 @@ function resolveIdentity(explicit) {
2668
3043
  const envValue = process.env.CONVERSATIONS_AGENT_ID?.trim();
2669
3044
  if (envValue)
2670
3045
  return envValue;
2671
- return "user";
3046
+ return getAutoName();
2672
3047
  }
2673
3048
  function requireIdentity(explicit) {
2674
3049
  const explicitValue = explicit?.trim();
@@ -1,6 +1,12 @@
1
+ /**
2
+ * Get or create a persistent auto-generated agent name.
3
+ * Stored in ~/.conversations/agent-id so the same installation
4
+ * always gets the same name.
5
+ */
6
+ export declare function getAutoName(): string;
1
7
  /**
2
8
  * Resolve agent identity.
3
- * Priority: explicit flag → CONVERSATIONS_AGENT_ID env → "user" fallback
9
+ * Priority: explicit flag → CONVERSATIONS_AGENT_ID env → auto-generated persistent name
4
10
  */
5
11
  export declare function resolveIdentity(explicit?: string): string;
6
12
  /**
@@ -8,3 +14,7 @@ export declare function resolveIdentity(explicit?: string): string;
8
14
  * Throws if no identity is set via flag or env.
9
15
  */
10
16
  export declare function requireIdentity(explicit?: string): string;
17
+ /**
18
+ * Reset the cached auto name (for testing).
19
+ */
20
+ export declare function _resetAutoName(): void;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Pool of unique agent names for auto-assignment.
3
+ * Format: adjective-animal, keeping them short, memorable, and fun.
4
+ */
5
+ export declare const AGENT_NAMES: readonly ["amber-fox", "arctic-wolf", "ashen-crow", "azure-hawk", "astral-lynx", "autumn-bear", "agile-puma", "alpine-ibex", "ancient-owl", "aqua-otter", "arid-viper", "atom-finch", "auburn-deer", "aurora-seal", "avid-mink", "blaze-tiger", "bright-heron", "bronze-eagle", "brisk-hare", "burnt-moth", "bold-raven", "blue-whale", "boreal-fox", "brass-cobra", "brave-ram", "brick-crane", "brief-newt", "briny-crab", "broad-elk", "brook-dove", "calm-panda", "cedar-jay", "chief-lion", "chrome-bat", "civic-wren", "clear-swan", "cliff-goat", "coal-shark", "cold-crane", "copper-jay", "coral-fish", "crisp-lark", "cross-mole", "cubic-wasp", "cyan-toad", "dark-stag", "dawn-robin", "deep-squid", "delta-fox", "dense-boar", "dew-spider", "dim-gecko", "draft-bear", "drift-gull", "dry-newt", "dual-crane", "dune-mouse", "dusk-moth", "dusty-mule", "dwarf-carp", "east-falcon", "echo-parrot", "edge-shark", "elm-beetle", "ember-lynx", "epoch-crane", "even-pike", "extra-ant", "elder-stork", "ebon-crow", "ever-finch", "exact-moth", "exile-wren", "equal-dove", "etch-hare", "faint-orca", "far-condor", "fern-mouse", "fierce-yak", "first-kite", "fjord-seal", "flint-wolf", "fog-parrot", "forge-bull", "fossil-ray", "frank-mink", "free-eagle", "fresh-colt", "frost-bear", "fuse-wasp", "gale-hawk", "gem-turtle", "ghost-lynx", "gilt-robin", "glad-moose", "glass-eel", "gleam-puma", "glyph-owl", "gold-crane", "gorge-lion", "grain-duck", "grand-wolf", "gray-fox", "green-hare", "grit-shark", "half-stork", "haze-panther", "heart-dove", "helm-eagle", "herb-toad", "hex-spider", "high-falcon", "hive-hornet", "holo-swan", "hood-cobra", "horn-bison", "huge-squid", "hull-crab", "hunt-marten", "husk-moth", "ice-leopard", "idle-crane", "inch-beetle", "indigo-jay", "inner-fox", "ion-parrot", "iron-bull", "isle-pelican", "ivory-hawk", "ivy-snake", "iota-wren", "ink-raven", "ignite-ram", "inert-slug", "infra-mole", "jade-tiger", "jest-magpie", "jewel-crane", "joint-boar", "jovial-elk", "jump-frog", "jungle-cat", "jury-dove", "just-heron", "jolt-wasp", "keen-osprey", "kelp-seal", "key-falcon", "kind-panda", "knot-viper", "kraft-bear", "kite-mouse", "knoll-deer", "know-crane", "karma-wolf", "lake-otter", "lapis-jay", "last-condor", "leaf-gecko", "lean-coyote", "light-lynx", "lime-parrot", "live-eagle", "long-crane", "lost-fox", "loud-finch", "low-shark", "luck-rabbit", "lunar-owl", "lush-ibis", "malt-badger", "maple-wren", "mars-falcon", "matte-crow", "mesa-hawk", "mild-orca", "mint-dove", "mist-puma", "mock-robin", "mono-wolf", "moon-bear", "moss-turtle", "mud-heron", "mute-swan", "myth-lynx", "navy-eagle", "near-mink", "neon-parrot", "nest-crane", "next-fox", "nimble-ram", "node-spider", "noon-hawk", "north-seal", "nova-owl", "null-moth", "numb-carp", "nutmeg-jay", "neat-cobra", "nomad-elk", "oak-badger", "oat-finch", "odd-pelican", "olive-bear", "onyx-raven", "opal-crane", "open-wolf", "orbit-lynx", "ore-shark", "outer-dove", "pale-tiger", "park-heron", "peak-eagle", "pine-fox", "pixel-owl", "plain-goat", "plum-crane", "polar-ray", "port-falcon", "prime-wolf", "prism-jay", "proud-lion", "pulse-bat", "pure-swan", "pyro-hawk", "quake-bear", "quartz-jay", "quest-falcon", "quick-otter", "quiet-crane", "rain-leopard", "rapid-hare", "raw-condor", "reef-dolphin", "regal-stag", "ridge-fox", "rift-cobra", "rigid-crane", "river-otter", "rock-eagle", "root-mole", "rose-finch", "rough-boar", "ruby-hawk", "rust-wolf", "sage-owl", "salt-crane", "sand-viper", "satin-dove", "scale-dragon", "scarlet-ibis", "sea-falcon", "shade-lynx", "sharp-eagle", "shell-crab", "short-fox", "sigma-jay", "silk-moth", "silver-wolf", "slate-bear", "slim-heron", "smoke-puma", "snap-turtle", "snow-leopard", "solar-crane", "solid-ram", "sonic-bat", "south-seal", "spark-robin", "spice-wren", "split-mink", "spring-elk", "squid-ink", "stark-crow", "steel-hawk", "stern-bull", "still-swan", "stone-fox", "storm-eagle", "stout-boar", "stray-cat", "strong-lion", "sun-parrot", "surf-dolphin", "swift-deer", "teal-crane", "terra-wolf", "thick-bear", "thin-spider", "third-owl", "thorn-fox", "tide-seal", "timber-jay", "tiny-wren", "toast-mole", "topaz-hawk", "torch-lynx", "trace-falcon", "true-eagle", "tusk-walrus", "ultra-crane", "umbra-wolf", "unit-fox", "upper-hawk", "urban-jay", "vale-deer", "vast-eagle", "vault-bear", "velvet-owl", "vent-crane", "verse-fox", "vigor-lynx", "vine-parrot", "vivid-swan", "void-raven", "volt-hawk", "vow-falcon", "vintage-jay", "vista-wolf", "vital-hare", "warm-otter", "wave-dolphin", "wax-crane", "west-falcon", "wheat-mouse", "white-tiger", "wide-eagle", "wild-fox", "wind-hawk", "wire-spider", "wise-owl", "wood-thrush", "wool-ram", "wren-song", "wry-crow", "xeno-crane", "xerus-fox", "yarn-robin", "yew-falcon", "young-wolf", "zeal-hawk", "zen-panda", "zero-crane", "zinc-eagle", "zone-fox"];
6
+ export type AgentName = typeof AGENT_NAMES[number];
@@ -5,3 +5,4 @@ export declare function listAgents(opts?: {
5
5
  online_only?: boolean;
6
6
  }): AgentPresence[];
7
7
  export declare function removePresence(agent: string): boolean;
8
+ export declare function renameAgent(oldName: string, newName: string): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/conversations",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Real-time CLI messaging for AI agents",
5
5
  "type": "module",
6
6
  "bin": {