claudish 7.5.0 → 7.6.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.
Files changed (2) hide show
  1. package/dist/index.js +3677 -572
  2. package/package.json +6 -5
package/dist/index.js CHANGED
@@ -460,6 +460,3239 @@ var require_main = __commonJS((exports, module) => {
460
460
  module.exports = DotenvModule;
461
461
  });
462
462
 
463
+ // src/profile-config.ts
464
+ var exports_profile_config = {};
465
+ __export(exports_profile_config, {
466
+ setProfile: () => setProfile,
467
+ setEndpoint: () => setEndpoint,
468
+ setDefaultProfile: () => setDefaultProfile,
469
+ setApiKey: () => setApiKey,
470
+ saveLocalConfig: () => saveLocalConfig,
471
+ saveConfig: () => saveConfig,
472
+ removeEndpoint: () => removeEndpoint,
473
+ removeApiKey: () => removeApiKey,
474
+ localConfigExists: () => localConfigExists,
475
+ loadLocalConfig: () => loadLocalConfig,
476
+ loadConfig: () => loadConfig,
477
+ listProfiles: () => listProfiles,
478
+ listAllProfiles: () => listAllProfiles,
479
+ isProjectDirectory: () => isProjectDirectory,
480
+ isLocalProviderEnabled: () => isLocalProviderEnabled,
481
+ getProfileNames: () => getProfileNames,
482
+ getProfile: () => getProfile,
483
+ getModelMapping: () => getModelMapping,
484
+ getLocalConfigPath: () => getLocalConfigPath,
485
+ getEndpoint: () => getEndpoint,
486
+ getDefaultProfile: () => getDefaultProfile,
487
+ getConfigPathForScope: () => getConfigPathForScope,
488
+ getConfigPath: () => getConfigPath,
489
+ getApiKey: () => getApiKey,
490
+ enableLocalProvider: () => enableLocalProvider,
491
+ disableLocalProvider: () => disableLocalProvider,
492
+ deleteProfile: () => deleteProfile,
493
+ createProfile: () => createProfile,
494
+ configExistsForScope: () => configExistsForScope,
495
+ configExists: () => configExists
496
+ });
497
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
498
+ import { homedir } from "os";
499
+ import { dirname, join, parse } from "path";
500
+ function ensureConfigDir() {
501
+ if (!existsSync(CONFIG_DIR)) {
502
+ mkdirSync(CONFIG_DIR, { recursive: true });
503
+ }
504
+ }
505
+ function loadConfig() {
506
+ ensureConfigDir();
507
+ if (!existsSync(CONFIG_FILE)) {
508
+ return { ...DEFAULT_CONFIG };
509
+ }
510
+ try {
511
+ const content = readFileSync(CONFIG_FILE, "utf-8");
512
+ const config = JSON.parse(content);
513
+ const merged = {
514
+ version: config.version || DEFAULT_CONFIG.version,
515
+ defaultProfile: config.defaultProfile || DEFAULT_CONFIG.defaultProfile,
516
+ profiles: config.profiles || DEFAULT_CONFIG.profiles
517
+ };
518
+ if (config.telemetry !== undefined) {
519
+ merged.telemetry = config.telemetry;
520
+ }
521
+ if (config.stats !== undefined) {
522
+ merged.stats = config.stats;
523
+ }
524
+ if (config.routing !== undefined) {
525
+ merged.routing = config.routing;
526
+ }
527
+ if (config.apiKeys !== undefined) {
528
+ merged.apiKeys = config.apiKeys;
529
+ }
530
+ if (config.endpoints !== undefined) {
531
+ merged.endpoints = config.endpoints;
532
+ }
533
+ if (config.onepassword !== undefined) {
534
+ merged.onepassword = config.onepassword;
535
+ }
536
+ if (config.onepasswordAccount !== undefined) {
537
+ merged.onepasswordAccount = config.onepasswordAccount;
538
+ }
539
+ if (config.localProviders !== undefined) {
540
+ merged.localProviders = Array.from(new Set(config.localProviders)).sort();
541
+ }
542
+ if (config.autoApproveConfirmedAt !== undefined) {
543
+ merged.autoApproveConfirmedAt = config.autoApproveConfirmedAt;
544
+ }
545
+ if (config.defaultProvider !== undefined) {
546
+ merged.defaultProvider = config.defaultProvider;
547
+ }
548
+ if (config.customEndpoints !== undefined) {
549
+ merged.customEndpoints = config.customEndpoints;
550
+ }
551
+ return merged;
552
+ } catch (error) {
553
+ console.error(`Warning: Failed to load config, using defaults: ${error}`);
554
+ return { ...DEFAULT_CONFIG };
555
+ }
556
+ }
557
+ function saveConfig(config) {
558
+ ensureConfigDir();
559
+ writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), "utf-8");
560
+ }
561
+ function configExists() {
562
+ return existsSync(CONFIG_FILE);
563
+ }
564
+ function getConfigPath() {
565
+ return CONFIG_FILE;
566
+ }
567
+ function getLocalConfigPath() {
568
+ const home = homedir();
569
+ let dir = process.cwd();
570
+ const root = parse(dir).root;
571
+ while (dir !== root && dir !== home) {
572
+ const candidate = join(dir, LOCAL_CONFIG_FILENAME);
573
+ if (existsSync(candidate))
574
+ return candidate;
575
+ if (existsSync(join(dir, ".git"))) {
576
+ return candidate;
577
+ }
578
+ dir = dirname(dir);
579
+ }
580
+ return join(process.cwd(), LOCAL_CONFIG_FILENAME);
581
+ }
582
+ function localConfigExists() {
583
+ return existsSync(getLocalConfigPath());
584
+ }
585
+ function isProjectDirectory() {
586
+ const cwd = process.cwd();
587
+ return [".git", "package.json", "Cargo.toml", "go.mod", "pyproject.toml", ".claudish.json"].some((f) => existsSync(join(cwd, f)));
588
+ }
589
+ function loadLocalConfig() {
590
+ const localPath = getLocalConfigPath();
591
+ if (!existsSync(localPath)) {
592
+ return null;
593
+ }
594
+ try {
595
+ const content = readFileSync(localPath, "utf-8");
596
+ const config = JSON.parse(content);
597
+ return {
598
+ ...config,
599
+ version: config.version || DEFAULT_CONFIG.version,
600
+ defaultProfile: config.defaultProfile ?? "",
601
+ profiles: config.profiles ?? {}
602
+ };
603
+ } catch (error) {
604
+ console.error(`Warning: Failed to load local config: ${error}`);
605
+ return null;
606
+ }
607
+ }
608
+ function saveLocalConfig(config) {
609
+ const toWrite = { ...config };
610
+ if (toWrite.routing !== undefined && Object.keys(toWrite.routing).length === 0) {
611
+ delete toWrite.routing;
612
+ }
613
+ writeFileSync(getLocalConfigPath(), JSON.stringify(toWrite, null, 2), "utf-8");
614
+ }
615
+ function loadConfigForScope(scope) {
616
+ if (scope === "local") {
617
+ return loadLocalConfig() || { version: "1.0.0", defaultProfile: "", profiles: {} };
618
+ }
619
+ return loadConfig();
620
+ }
621
+ function saveConfigForScope(config, scope) {
622
+ if (scope === "local") {
623
+ saveLocalConfig(config);
624
+ } else {
625
+ saveConfig(config);
626
+ }
627
+ }
628
+ function configExistsForScope(scope) {
629
+ if (scope === "local") {
630
+ return localConfigExists();
631
+ }
632
+ return configExists();
633
+ }
634
+ function getConfigPathForScope(scope) {
635
+ if (scope === "local") {
636
+ return getLocalConfigPath();
637
+ }
638
+ return getConfigPath();
639
+ }
640
+ function getProfile(name, scope) {
641
+ if (scope === "local") {
642
+ const local2 = loadLocalConfig();
643
+ return local2?.profiles[name];
644
+ }
645
+ if (scope === "global") {
646
+ const config2 = loadConfig();
647
+ return config2.profiles[name];
648
+ }
649
+ const local = loadLocalConfig();
650
+ if (local?.profiles[name]) {
651
+ return local.profiles[name];
652
+ }
653
+ const config = loadConfig();
654
+ return config.profiles[name];
655
+ }
656
+ function getDefaultProfile(scope) {
657
+ if (scope === "local") {
658
+ const local2 = loadLocalConfig();
659
+ if (local2 && local2.defaultProfile && local2.profiles[local2.defaultProfile]) {
660
+ return local2.profiles[local2.defaultProfile];
661
+ }
662
+ return DEFAULT_CONFIG.profiles.default;
663
+ }
664
+ if (scope === "global") {
665
+ const config2 = loadConfig();
666
+ const profile2 = config2.profiles[config2.defaultProfile];
667
+ if (profile2)
668
+ return profile2;
669
+ const firstProfile2 = Object.values(config2.profiles)[0];
670
+ if (firstProfile2)
671
+ return firstProfile2;
672
+ return DEFAULT_CONFIG.profiles.default;
673
+ }
674
+ const local = loadLocalConfig();
675
+ if (local && local.defaultProfile) {
676
+ const profile2 = getProfile(local.defaultProfile);
677
+ if (profile2)
678
+ return profile2;
679
+ }
680
+ const config = loadConfig();
681
+ const profile = config.profiles[config.defaultProfile];
682
+ if (profile)
683
+ return profile;
684
+ const firstProfile = Object.values(config.profiles)[0];
685
+ if (firstProfile)
686
+ return firstProfile;
687
+ return DEFAULT_CONFIG.profiles.default;
688
+ }
689
+ function getProfileNames(scope) {
690
+ if (scope === "local") {
691
+ const local2 = loadLocalConfig();
692
+ return local2 ? Object.keys(local2.profiles) : [];
693
+ }
694
+ if (scope === "global") {
695
+ const config2 = loadConfig();
696
+ return Object.keys(config2.profiles);
697
+ }
698
+ const local = loadLocalConfig();
699
+ const config = loadConfig();
700
+ const names = new Set([
701
+ ...local ? Object.keys(local.profiles) : [],
702
+ ...Object.keys(config.profiles)
703
+ ]);
704
+ return [...names];
705
+ }
706
+ function setProfile(profile, scope = "global") {
707
+ const config = loadConfigForScope(scope);
708
+ const existingProfile = config.profiles[profile.name];
709
+ if (existingProfile) {
710
+ profile.createdAt = existingProfile.createdAt;
711
+ } else {
712
+ profile.createdAt = new Date().toISOString();
713
+ }
714
+ profile.updatedAt = new Date().toISOString();
715
+ config.profiles[profile.name] = profile;
716
+ saveConfigForScope(config, scope);
717
+ }
718
+ function deleteProfile(name, scope = "global") {
719
+ const config = loadConfigForScope(scope);
720
+ if (!config.profiles[name]) {
721
+ return false;
722
+ }
723
+ if (scope === "global") {
724
+ const profileCount = Object.keys(config.profiles).length;
725
+ if (profileCount <= 1) {
726
+ throw new Error("Cannot delete the last global profile");
727
+ }
728
+ }
729
+ delete config.profiles[name];
730
+ if (config.defaultProfile === name) {
731
+ const remaining = Object.keys(config.profiles);
732
+ config.defaultProfile = remaining.length > 0 ? remaining[0] : "";
733
+ }
734
+ saveConfigForScope(config, scope);
735
+ return true;
736
+ }
737
+ function setDefaultProfile(name, scope = "global") {
738
+ const config = loadConfigForScope(scope);
739
+ if (!config.profiles[name]) {
740
+ throw new Error(`Profile "${name}" does not exist in ${scope} config`);
741
+ }
742
+ config.defaultProfile = name;
743
+ saveConfigForScope(config, scope);
744
+ }
745
+ function getModelMapping(profileName) {
746
+ const profile = profileName ? getProfile(profileName) : getDefaultProfile();
747
+ if (!profile) {
748
+ return {};
749
+ }
750
+ return profile.models;
751
+ }
752
+ function createProfile(name, models, description, scope = "global") {
753
+ const now = new Date().toISOString();
754
+ const profile = {
755
+ name,
756
+ description,
757
+ models,
758
+ createdAt: now,
759
+ updatedAt: now
760
+ };
761
+ setProfile(profile, scope);
762
+ return profile;
763
+ }
764
+ function listProfiles() {
765
+ const config = loadConfig();
766
+ return Object.values(config.profiles).map((profile) => ({
767
+ ...profile,
768
+ isDefault: profile.name === config.defaultProfile
769
+ }));
770
+ }
771
+ function listAllProfiles() {
772
+ const globalConfig = loadConfig();
773
+ const localConfig = loadLocalConfig();
774
+ const result = [];
775
+ if (localConfig) {
776
+ for (const profile of Object.values(localConfig.profiles)) {
777
+ result.push({
778
+ ...profile,
779
+ scope: "local",
780
+ isDefault: profile.name === localConfig.defaultProfile
781
+ });
782
+ }
783
+ }
784
+ const localNames = localConfig ? new Set(Object.keys(localConfig.profiles)) : new Set;
785
+ for (const profile of Object.values(globalConfig.profiles)) {
786
+ result.push({
787
+ ...profile,
788
+ scope: "global",
789
+ isDefault: profile.name === globalConfig.defaultProfile,
790
+ shadowed: localNames.has(profile.name)
791
+ });
792
+ }
793
+ return result;
794
+ }
795
+ function getApiKey(envVar) {
796
+ const config = loadConfig();
797
+ return config.apiKeys?.[envVar];
798
+ }
799
+ function setApiKey(envVar, value) {
800
+ const config = loadConfig();
801
+ if (!config.apiKeys)
802
+ config.apiKeys = {};
803
+ config.apiKeys[envVar] = value;
804
+ saveConfig(config);
805
+ }
806
+ function removeApiKey(envVar) {
807
+ const config = loadConfig();
808
+ if (config.apiKeys) {
809
+ delete config.apiKeys[envVar];
810
+ saveConfig(config);
811
+ }
812
+ }
813
+ function getEndpoint(name) {
814
+ const config = loadConfig();
815
+ return config.endpoints?.[name];
816
+ }
817
+ function setEndpoint(name, value) {
818
+ const config = loadConfig();
819
+ if (!config.endpoints)
820
+ config.endpoints = {};
821
+ config.endpoints[name] = value;
822
+ saveConfig(config);
823
+ }
824
+ function removeEndpoint(name) {
825
+ const config = loadConfig();
826
+ if (config.endpoints) {
827
+ delete config.endpoints[name];
828
+ saveConfig(config);
829
+ }
830
+ }
831
+ function isLocalProviderEnabled(providerName, config = loadConfig()) {
832
+ return (config.localProviders ?? []).includes(providerName);
833
+ }
834
+ function enableLocalProvider(providerName) {
835
+ const config = loadConfig();
836
+ const providers = new Set(config.localProviders ?? []);
837
+ providers.add(providerName);
838
+ config.localProviders = Array.from(providers).sort();
839
+ saveConfig(config);
840
+ }
841
+ function disableLocalProvider(providerName) {
842
+ const config = loadConfig();
843
+ const providers = new Set(config.localProviders ?? []);
844
+ providers.delete(providerName);
845
+ if (providers.size > 0) {
846
+ config.localProviders = Array.from(providers).sort();
847
+ } else {
848
+ delete config.localProviders;
849
+ }
850
+ saveConfig(config);
851
+ }
852
+ var CONFIG_DIR, CONFIG_FILE, LOCAL_CONFIG_FILENAME = ".claudish.json", DEFAULT_CONFIG;
853
+ var init_profile_config = __esm(() => {
854
+ CONFIG_DIR = join(homedir(), ".claudish");
855
+ CONFIG_FILE = join(CONFIG_DIR, "config.json");
856
+ DEFAULT_CONFIG = {
857
+ version: "1.0.0",
858
+ defaultProfile: "default",
859
+ profiles: {
860
+ default: {
861
+ name: "default",
862
+ description: "Default profile - shows model selector when no model specified",
863
+ models: {},
864
+ createdAt: new Date().toISOString(),
865
+ updatedAt: new Date().toISOString()
866
+ }
867
+ }
868
+ };
869
+ });
870
+
871
+ // src/version.ts
872
+ var VERSION = "7.6.0";
873
+
874
+ // ../../node_modules/.bun/@1password+sdk-core@0.4.1-beta.1/node_modules/@1password/sdk-core/nodejs/core.js
875
+ var require_core = __commonJS((exports, module) => {
876
+ var __dirname = "/home/runner/work/claudish/claudish/node_modules/.bun/@1password+sdk-core@0.4.1-beta.1/node_modules/@1password/sdk-core/nodejs";
877
+ var imports = {};
878
+ imports["__wbindgen_placeholder__"] = exports;
879
+ var wasm;
880
+ var { TextDecoder: TextDecoder2, TextEncoder: TextEncoder2 } = __require("util");
881
+ var cachedTextDecoder = new TextDecoder2("utf-8", { ignoreBOM: true, fatal: true });
882
+ cachedTextDecoder.decode();
883
+ var cachedUint8ArrayMemory0 = null;
884
+ function getUint8ArrayMemory0() {
885
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
886
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
887
+ }
888
+ return cachedUint8ArrayMemory0;
889
+ }
890
+ function getStringFromWasm0(ptr, len) {
891
+ ptr = ptr >>> 0;
892
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
893
+ }
894
+ function addToExternrefTable0(obj) {
895
+ const idx = wasm.__externref_table_alloc();
896
+ wasm.__wbindgen_export_2.set(idx, obj);
897
+ return idx;
898
+ }
899
+ function handleError(f, args) {
900
+ try {
901
+ return f.apply(this, args);
902
+ } catch (e) {
903
+ const idx = addToExternrefTable0(e);
904
+ wasm.__wbindgen_exn_store(idx);
905
+ }
906
+ }
907
+ function isLikeNone(x) {
908
+ return x === undefined || x === null;
909
+ }
910
+ var WASM_VECTOR_LEN = 0;
911
+ var cachedTextEncoder = new TextEncoder2("utf-8");
912
+ var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
913
+ return cachedTextEncoder.encodeInto(arg, view);
914
+ } : function(arg, view) {
915
+ const buf = cachedTextEncoder.encode(arg);
916
+ view.set(buf);
917
+ return {
918
+ read: arg.length,
919
+ written: buf.length
920
+ };
921
+ };
922
+ function passStringToWasm0(arg, malloc, realloc) {
923
+ if (realloc === undefined) {
924
+ const buf = cachedTextEncoder.encode(arg);
925
+ const ptr2 = malloc(buf.length, 1) >>> 0;
926
+ getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
927
+ WASM_VECTOR_LEN = buf.length;
928
+ return ptr2;
929
+ }
930
+ let len = arg.length;
931
+ let ptr = malloc(len, 1) >>> 0;
932
+ const mem = getUint8ArrayMemory0();
933
+ let offset = 0;
934
+ for (;offset < len; offset++) {
935
+ const code = arg.charCodeAt(offset);
936
+ if (code > 127)
937
+ break;
938
+ mem[ptr + offset] = code;
939
+ }
940
+ if (offset !== len) {
941
+ if (offset !== 0) {
942
+ arg = arg.slice(offset);
943
+ }
944
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
945
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
946
+ const ret = encodeString(arg, view);
947
+ offset += ret.written;
948
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
949
+ }
950
+ WASM_VECTOR_LEN = offset;
951
+ return ptr;
952
+ }
953
+ var cachedDataViewMemory0 = null;
954
+ function getDataViewMemory0() {
955
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
956
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
957
+ }
958
+ return cachedDataViewMemory0;
959
+ }
960
+ var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => {
961
+ wasm.__wbindgen_export_5.get(state.dtor)(state.a, state.b);
962
+ });
963
+ function makeMutClosure(arg0, arg1, dtor, f) {
964
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
965
+ const real = (...args) => {
966
+ state.cnt++;
967
+ const a = state.a;
968
+ state.a = 0;
969
+ try {
970
+ return f(a, state.b, ...args);
971
+ } finally {
972
+ if (--state.cnt === 0) {
973
+ wasm.__wbindgen_export_5.get(state.dtor)(a, state.b);
974
+ CLOSURE_DTORS.unregister(state);
975
+ } else {
976
+ state.a = a;
977
+ }
978
+ }
979
+ };
980
+ real.original = state;
981
+ CLOSURE_DTORS.register(real, state, state);
982
+ return real;
983
+ }
984
+ function debugString(val) {
985
+ const type = typeof val;
986
+ if (type == "number" || type == "boolean" || val == null) {
987
+ return `${val}`;
988
+ }
989
+ if (type == "string") {
990
+ return `"${val}"`;
991
+ }
992
+ if (type == "symbol") {
993
+ const description = val.description;
994
+ if (description == null) {
995
+ return "Symbol";
996
+ } else {
997
+ return `Symbol(${description})`;
998
+ }
999
+ }
1000
+ if (type == "function") {
1001
+ const name = val.name;
1002
+ if (typeof name == "string" && name.length > 0) {
1003
+ return `Function(${name})`;
1004
+ } else {
1005
+ return "Function";
1006
+ }
1007
+ }
1008
+ if (Array.isArray(val)) {
1009
+ const length = val.length;
1010
+ let debug = "[";
1011
+ if (length > 0) {
1012
+ debug += debugString(val[0]);
1013
+ }
1014
+ for (let i = 1;i < length; i++) {
1015
+ debug += ", " + debugString(val[i]);
1016
+ }
1017
+ debug += "]";
1018
+ return debug;
1019
+ }
1020
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1021
+ let className;
1022
+ if (builtInMatches && builtInMatches.length > 1) {
1023
+ className = builtInMatches[1];
1024
+ } else {
1025
+ return toString.call(val);
1026
+ }
1027
+ if (className == "Object") {
1028
+ try {
1029
+ return "Object(" + JSON.stringify(val) + ")";
1030
+ } catch (_) {
1031
+ return "Object";
1032
+ }
1033
+ }
1034
+ if (val instanceof Error) {
1035
+ return `${val.name}: ${val.message}
1036
+ ${val.stack}`;
1037
+ }
1038
+ return className;
1039
+ }
1040
+ exports.invoke = function(parameters) {
1041
+ const ptr0 = passStringToWasm0(parameters, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1042
+ const len0 = WASM_VECTOR_LEN;
1043
+ const ret = wasm.invoke(ptr0, len0);
1044
+ return ret;
1045
+ };
1046
+ exports.init_client = function(config) {
1047
+ const ptr0 = passStringToWasm0(config, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1048
+ const len0 = WASM_VECTOR_LEN;
1049
+ const ret = wasm.init_client(ptr0, len0);
1050
+ return ret;
1051
+ };
1052
+ function takeFromExternrefTable0(idx) {
1053
+ const value = wasm.__wbindgen_export_2.get(idx);
1054
+ wasm.__externref_table_dealloc(idx);
1055
+ return value;
1056
+ }
1057
+ exports.release_client = function(client_id) {
1058
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1059
+ const len0 = WASM_VECTOR_LEN;
1060
+ const ret = wasm.release_client(ptr0, len0);
1061
+ if (ret[1]) {
1062
+ throw takeFromExternrefTable0(ret[0]);
1063
+ }
1064
+ };
1065
+ exports.invoke_sync = function(parameters) {
1066
+ let deferred3_0;
1067
+ let deferred3_1;
1068
+ try {
1069
+ const ptr0 = passStringToWasm0(parameters, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1070
+ const len0 = WASM_VECTOR_LEN;
1071
+ const ret = wasm.invoke_sync(ptr0, len0);
1072
+ var ptr2 = ret[0];
1073
+ var len2 = ret[1];
1074
+ if (ret[3]) {
1075
+ ptr2 = 0;
1076
+ len2 = 0;
1077
+ throw takeFromExternrefTable0(ret[2]);
1078
+ }
1079
+ deferred3_0 = ptr2;
1080
+ deferred3_1 = len2;
1081
+ return getStringFromWasm0(ptr2, len2);
1082
+ } finally {
1083
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1084
+ }
1085
+ };
1086
+ function __wbg_adapter_30(arg0, arg1) {
1087
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb15e53e0e5133441(arg0, arg1);
1088
+ }
1089
+ function __wbg_adapter_33(arg0, arg1, arg2) {
1090
+ wasm.closure2417_externref_shim(arg0, arg1, arg2);
1091
+ }
1092
+ function __wbg_adapter_144(arg0, arg1, arg2, arg3) {
1093
+ wasm.closure2568_externref_shim(arg0, arg1, arg2, arg3);
1094
+ }
1095
+ var __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
1096
+ var __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
1097
+ var __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
1098
+ exports.__wbg_abort_410ec47a64ac6117 = function(arg0, arg1) {
1099
+ arg0.abort(arg1);
1100
+ };
1101
+ exports.__wbg_abort_775ef1d17fc65868 = function(arg0) {
1102
+ arg0.abort();
1103
+ };
1104
+ exports.__wbg_append_8c7dd8d641a5f01b = function() {
1105
+ return handleError(function(arg0, arg1, arg2, arg3, arg4) {
1106
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
1107
+ }, arguments);
1108
+ };
1109
+ exports.__wbg_arrayBuffer_d1b44c4390db422f = function() {
1110
+ return handleError(function(arg0) {
1111
+ const ret = arg0.arrayBuffer();
1112
+ return ret;
1113
+ }, arguments);
1114
+ };
1115
+ exports.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
1116
+ const ret = arg0.buffer;
1117
+ return ret;
1118
+ };
1119
+ exports.__wbg_call_672a4d21634d4a24 = function() {
1120
+ return handleError(function(arg0, arg1) {
1121
+ const ret = arg0.call(arg1);
1122
+ return ret;
1123
+ }, arguments);
1124
+ };
1125
+ exports.__wbg_call_7cccdd69e0791ae2 = function() {
1126
+ return handleError(function(arg0, arg1, arg2) {
1127
+ const ret = arg0.call(arg1, arg2);
1128
+ return ret;
1129
+ }, arguments);
1130
+ };
1131
+ exports.__wbg_clearTimeout_42d9ccd50822fd3a = function(arg0) {
1132
+ const ret = clearTimeout(arg0);
1133
+ return ret;
1134
+ };
1135
+ exports.__wbg_crypto_86f2631e91b51511 = function(arg0) {
1136
+ const ret = arg0.crypto;
1137
+ return ret;
1138
+ };
1139
+ exports.__wbg_done_769e5ede4b31c67b = function(arg0) {
1140
+ const ret = arg0.done;
1141
+ return ret;
1142
+ };
1143
+ exports.__wbg_fetch_509096533071c657 = function(arg0, arg1) {
1144
+ const ret = arg0.fetch(arg1);
1145
+ return ret;
1146
+ };
1147
+ exports.__wbg_fetch_6bbc32f991730587 = function(arg0) {
1148
+ const ret = fetch(arg0);
1149
+ return ret;
1150
+ };
1151
+ exports.__wbg_getFullYear_17d3c9e4db748eb7 = function(arg0) {
1152
+ const ret = arg0.getFullYear();
1153
+ return ret;
1154
+ };
1155
+ exports.__wbg_getRandomValues_b3f15fcbfabb0f8b = function() {
1156
+ return handleError(function(arg0, arg1) {
1157
+ arg0.getRandomValues(arg1);
1158
+ }, arguments);
1159
+ };
1160
+ exports.__wbg_getTimezoneOffset_6b5752021c499c47 = function(arg0) {
1161
+ const ret = arg0.getTimezoneOffset();
1162
+ return ret;
1163
+ };
1164
+ exports.__wbg_get_67b2ba62fc30de12 = function() {
1165
+ return handleError(function(arg0, arg1) {
1166
+ const ret = Reflect.get(arg0, arg1);
1167
+ return ret;
1168
+ }, arguments);
1169
+ };
1170
+ exports.__wbg_has_a5ea9117f258a0ec = function() {
1171
+ return handleError(function(arg0, arg1) {
1172
+ const ret = Reflect.has(arg0, arg1);
1173
+ return ret;
1174
+ }, arguments);
1175
+ };
1176
+ exports.__wbg_headers_9cb51cfd2ac780a4 = function(arg0) {
1177
+ const ret = arg0.headers;
1178
+ return ret;
1179
+ };
1180
+ exports.__wbg_instanceof_Response_f2cc20d9f7dfd644 = function(arg0) {
1181
+ let result;
1182
+ try {
1183
+ result = arg0 instanceof Response;
1184
+ } catch (_) {
1185
+ result = false;
1186
+ }
1187
+ const ret = result;
1188
+ return ret;
1189
+ };
1190
+ exports.__wbg_instanceof_Window_def73ea0955fc569 = function(arg0) {
1191
+ let result;
1192
+ try {
1193
+ result = arg0 instanceof Window;
1194
+ } catch (_) {
1195
+ result = false;
1196
+ }
1197
+ const ret = result;
1198
+ return ret;
1199
+ };
1200
+ exports.__wbg_instanceof_WorkerGlobalScope_dbdbdea7e3b56493 = function(arg0) {
1201
+ let result;
1202
+ try {
1203
+ result = arg0 instanceof WorkerGlobalScope;
1204
+ } catch (_) {
1205
+ result = false;
1206
+ }
1207
+ const ret = result;
1208
+ return ret;
1209
+ };
1210
+ exports.__wbg_iterator_9a24c88df860dc65 = function() {
1211
+ const ret = Symbol.iterator;
1212
+ return ret;
1213
+ };
1214
+ exports.__wbg_languages_2420955220685766 = function(arg0) {
1215
+ const ret = arg0.languages;
1216
+ return ret;
1217
+ };
1218
+ exports.__wbg_languages_d8dad509faf757df = function(arg0) {
1219
+ const ret = arg0.languages;
1220
+ return ret;
1221
+ };
1222
+ exports.__wbg_length_a446193dc22c12f8 = function(arg0) {
1223
+ const ret = arg0.length;
1224
+ return ret;
1225
+ };
1226
+ exports.__wbg_msCrypto_d562bbe83e0d4b91 = function(arg0) {
1227
+ const ret = arg0.msCrypto;
1228
+ return ret;
1229
+ };
1230
+ exports.__wbg_navigator_0a9bf1120e24fec2 = function(arg0) {
1231
+ const ret = arg0.navigator;
1232
+ return ret;
1233
+ };
1234
+ exports.__wbg_navigator_1577371c070c8947 = function(arg0) {
1235
+ const ret = arg0.navigator;
1236
+ return ret;
1237
+ };
1238
+ exports.__wbg_new0_f788a2397c7ca929 = function() {
1239
+ const ret = new Date;
1240
+ return ret;
1241
+ };
1242
+ exports.__wbg_new_018dcc2d6c8c2f6a = function() {
1243
+ return handleError(function() {
1244
+ const ret = new Headers;
1245
+ return ret;
1246
+ }, arguments);
1247
+ };
1248
+ exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
1249
+ try {
1250
+ var state0 = { a: arg0, b: arg1 };
1251
+ var cb0 = (arg02, arg12) => {
1252
+ const a = state0.a;
1253
+ state0.a = 0;
1254
+ try {
1255
+ return __wbg_adapter_144(a, state0.b, arg02, arg12);
1256
+ } finally {
1257
+ state0.a = a;
1258
+ }
1259
+ };
1260
+ const ret = new Promise(cb0);
1261
+ return ret;
1262
+ } finally {
1263
+ state0.a = state0.b = 0;
1264
+ }
1265
+ };
1266
+ exports.__wbg_new_31a97dac4f10fab7 = function(arg0) {
1267
+ const ret = new Date(arg0);
1268
+ return ret;
1269
+ };
1270
+ exports.__wbg_new_405e22f390576ce2 = function() {
1271
+ const ret = new Object;
1272
+ return ret;
1273
+ };
1274
+ exports.__wbg_new_a12002a7f91c75be = function(arg0) {
1275
+ const ret = new Uint8Array(arg0);
1276
+ return ret;
1277
+ };
1278
+ exports.__wbg_new_e25e5aab09ff45db = function() {
1279
+ return handleError(function() {
1280
+ const ret = new AbortController;
1281
+ return ret;
1282
+ }, arguments);
1283
+ };
1284
+ exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
1285
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
1286
+ return ret;
1287
+ };
1288
+ exports.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
1289
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
1290
+ return ret;
1291
+ };
1292
+ exports.__wbg_newwithlength_a381634e90c276d4 = function(arg0) {
1293
+ const ret = new Uint8Array(arg0 >>> 0);
1294
+ return ret;
1295
+ };
1296
+ exports.__wbg_newwithstrandinit_06c535e0a867c635 = function() {
1297
+ return handleError(function(arg0, arg1, arg2) {
1298
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
1299
+ return ret;
1300
+ }, arguments);
1301
+ };
1302
+ exports.__wbg_next_25feadfc0913fea9 = function(arg0) {
1303
+ const ret = arg0.next;
1304
+ return ret;
1305
+ };
1306
+ exports.__wbg_next_6574e1a8a62d1055 = function() {
1307
+ return handleError(function(arg0) {
1308
+ const ret = arg0.next();
1309
+ return ret;
1310
+ }, arguments);
1311
+ };
1312
+ exports.__wbg_node_e1f24f89a7336c2e = function(arg0) {
1313
+ const ret = arg0.node;
1314
+ return ret;
1315
+ };
1316
+ exports.__wbg_now_807e54c39636c349 = function() {
1317
+ const ret = Date.now();
1318
+ return ret;
1319
+ };
1320
+ exports.__wbg_now_d18023d54d4e5500 = function(arg0) {
1321
+ const ret = arg0.now();
1322
+ return ret;
1323
+ };
1324
+ exports.__wbg_parse_def2e24ef1252aff = function() {
1325
+ return handleError(function(arg0, arg1) {
1326
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
1327
+ return ret;
1328
+ }, arguments);
1329
+ };
1330
+ exports.__wbg_process_3975fd6c72f520aa = function(arg0) {
1331
+ const ret = arg0.process;
1332
+ return ret;
1333
+ };
1334
+ exports.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
1335
+ queueMicrotask(arg0);
1336
+ };
1337
+ exports.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
1338
+ const ret = arg0.queueMicrotask;
1339
+ return ret;
1340
+ };
1341
+ exports.__wbg_randomFillSync_f8c153b79f285817 = function() {
1342
+ return handleError(function(arg0, arg1) {
1343
+ arg0.randomFillSync(arg1);
1344
+ }, arguments);
1345
+ };
1346
+ exports.__wbg_require_b74f47fc2d022fd6 = function() {
1347
+ return handleError(function() {
1348
+ const ret = module.require;
1349
+ return ret;
1350
+ }, arguments);
1351
+ };
1352
+ exports.__wbg_resolve_4851785c9c5f573d = function(arg0) {
1353
+ const ret = Promise.resolve(arg0);
1354
+ return ret;
1355
+ };
1356
+ exports.__wbg_self_b29ea9f89ecb0567 = function() {
1357
+ return handleError(function() {
1358
+ const ret = self.self;
1359
+ return ret;
1360
+ }, arguments);
1361
+ };
1362
+ exports.__wbg_setTimeout_4ec014681668a581 = function(arg0, arg1) {
1363
+ const ret = setTimeout(arg0, arg1);
1364
+ return ret;
1365
+ };
1366
+ exports.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
1367
+ arg0.set(arg1, arg2 >>> 0);
1368
+ };
1369
+ exports.__wbg_setbody_5923b78a95eedf29 = function(arg0, arg1) {
1370
+ arg0.body = arg1;
1371
+ };
1372
+ exports.__wbg_setcache_12f17c3a980650e4 = function(arg0, arg1) {
1373
+ arg0.cache = __wbindgen_enum_RequestCache[arg1];
1374
+ };
1375
+ exports.__wbg_setcredentials_c3a22f1cd105a2c6 = function(arg0, arg1) {
1376
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
1377
+ };
1378
+ exports.__wbg_setheaders_834c0bdb6a8949ad = function(arg0, arg1) {
1379
+ arg0.headers = arg1;
1380
+ };
1381
+ exports.__wbg_setmethod_3c5280fe5d890842 = function(arg0, arg1, arg2) {
1382
+ arg0.method = getStringFromWasm0(arg1, arg2);
1383
+ };
1384
+ exports.__wbg_setmode_5dc300b865044b65 = function(arg0, arg1) {
1385
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
1386
+ };
1387
+ exports.__wbg_setsignal_75b21ef3a81de905 = function(arg0, arg1) {
1388
+ arg0.signal = arg1;
1389
+ };
1390
+ exports.__wbg_signal_aaf9ad74119f20a4 = function(arg0) {
1391
+ const ret = arg0.signal;
1392
+ return ret;
1393
+ };
1394
+ exports.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
1395
+ const ret = typeof global === "undefined" ? null : global;
1396
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1397
+ };
1398
+ exports.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
1399
+ const ret = typeof globalThis === "undefined" ? null : globalThis;
1400
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1401
+ };
1402
+ exports.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
1403
+ const ret = typeof self === "undefined" ? null : self;
1404
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1405
+ };
1406
+ exports.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
1407
+ const ret = typeof window === "undefined" ? null : window;
1408
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1409
+ };
1410
+ exports.__wbg_static_accessor_performance_da77b3a901a72934 = function() {
1411
+ const ret = performance;
1412
+ return ret;
1413
+ };
1414
+ exports.__wbg_status_f6360336ca686bf0 = function(arg0) {
1415
+ const ret = arg0.status;
1416
+ return ret;
1417
+ };
1418
+ exports.__wbg_stringify_f7ed6987935b4a24 = function() {
1419
+ return handleError(function(arg0) {
1420
+ const ret = JSON.stringify(arg0);
1421
+ return ret;
1422
+ }, arguments);
1423
+ };
1424
+ exports.__wbg_subarray_aa9065fa9dc5df96 = function(arg0, arg1, arg2) {
1425
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1426
+ return ret;
1427
+ };
1428
+ exports.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
1429
+ const ret = arg0.then(arg1);
1430
+ return ret;
1431
+ };
1432
+ exports.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) {
1433
+ const ret = arg0.then(arg1, arg2);
1434
+ return ret;
1435
+ };
1436
+ exports.__wbg_toLocaleDateString_e5424994746e8415 = function(arg0, arg1, arg2, arg3) {
1437
+ const ret = arg0.toLocaleDateString(getStringFromWasm0(arg1, arg2), arg3);
1438
+ return ret;
1439
+ };
1440
+ exports.__wbg_url_ae10c34ca209681d = function(arg0, arg1) {
1441
+ const ret = arg1.url;
1442
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1443
+ const len1 = WASM_VECTOR_LEN;
1444
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1445
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1446
+ };
1447
+ exports.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
1448
+ const ret = arg0.value;
1449
+ return ret;
1450
+ };
1451
+ exports.__wbg_values_99f7a68c7f313d66 = function(arg0) {
1452
+ const ret = arg0.values();
1453
+ return ret;
1454
+ };
1455
+ exports.__wbg_versions_4e31226f5e8dc909 = function(arg0) {
1456
+ const ret = arg0.versions;
1457
+ return ret;
1458
+ };
1459
+ exports.__wbg_window_aa5515e600e96252 = function() {
1460
+ return handleError(function() {
1461
+ const ret = window.window;
1462
+ return ret;
1463
+ }, arguments);
1464
+ };
1465
+ exports.__wbindgen_cb_drop = function(arg0) {
1466
+ const obj = arg0.original;
1467
+ if (obj.cnt-- == 1) {
1468
+ obj.a = 0;
1469
+ return true;
1470
+ }
1471
+ const ret = false;
1472
+ return ret;
1473
+ };
1474
+ exports.__wbindgen_closure_wrapper8973 = function(arg0, arg1, arg2) {
1475
+ const ret = makeMutClosure(arg0, arg1, 2401, __wbg_adapter_30);
1476
+ return ret;
1477
+ };
1478
+ exports.__wbindgen_closure_wrapper9014 = function(arg0, arg1, arg2) {
1479
+ const ret = makeMutClosure(arg0, arg1, 2418, __wbg_adapter_33);
1480
+ return ret;
1481
+ };
1482
+ exports.__wbindgen_debug_string = function(arg0, arg1) {
1483
+ const ret = debugString(arg1);
1484
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1485
+ const len1 = WASM_VECTOR_LEN;
1486
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1487
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1488
+ };
1489
+ exports.__wbindgen_init_externref_table = function() {
1490
+ const table = wasm.__wbindgen_export_2;
1491
+ const offset = table.grow(4);
1492
+ table.set(0, undefined);
1493
+ table.set(offset + 0, undefined);
1494
+ table.set(offset + 1, null);
1495
+ table.set(offset + 2, true);
1496
+ table.set(offset + 3, false);
1497
+ };
1498
+ exports.__wbindgen_is_function = function(arg0) {
1499
+ const ret = typeof arg0 === "function";
1500
+ return ret;
1501
+ };
1502
+ exports.__wbindgen_is_object = function(arg0) {
1503
+ const val = arg0;
1504
+ const ret = typeof val === "object" && val !== null;
1505
+ return ret;
1506
+ };
1507
+ exports.__wbindgen_is_string = function(arg0) {
1508
+ const ret = typeof arg0 === "string";
1509
+ return ret;
1510
+ };
1511
+ exports.__wbindgen_is_undefined = function(arg0) {
1512
+ const ret = arg0 === undefined;
1513
+ return ret;
1514
+ };
1515
+ exports.__wbindgen_memory = function() {
1516
+ const ret = wasm.memory;
1517
+ return ret;
1518
+ };
1519
+ exports.__wbindgen_number_new = function(arg0) {
1520
+ const ret = arg0;
1521
+ return ret;
1522
+ };
1523
+ exports.__wbindgen_string_get = function(arg0, arg1) {
1524
+ const obj = arg1;
1525
+ const ret = typeof obj === "string" ? obj : undefined;
1526
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1527
+ var len1 = WASM_VECTOR_LEN;
1528
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1529
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1530
+ };
1531
+ exports.__wbindgen_string_new = function(arg0, arg1) {
1532
+ const ret = getStringFromWasm0(arg0, arg1);
1533
+ return ret;
1534
+ };
1535
+ exports.__wbindgen_throw = function(arg0, arg1) {
1536
+ throw new Error(getStringFromWasm0(arg0, arg1));
1537
+ };
1538
+ var path = __require("path").join(__dirname, "core_bg.wasm");
1539
+ var bytes = __require("fs").readFileSync(path);
1540
+ var wasmModule = new WebAssembly.Module(bytes);
1541
+ var wasmInstance = new WebAssembly.Instance(wasmModule, imports);
1542
+ wasm = wasmInstance.exports;
1543
+ exports.__wasm = wasm;
1544
+ wasm.__wbindgen_start();
1545
+ });
1546
+
1547
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/types.js
1548
+ var require_types = __commonJS((exports) => {
1549
+ Object.defineProperty(exports, "__esModule", { value: true });
1550
+ exports.ReplacerFunc = exports.ReviverFunc = exports.UPDATE_ITEM_HISTORY = exports.UPDATE_ITEMS = exports.SEND_ITEMS = exports.REVEAL_ITEM_PASSWORD = exports.RECOVER_VAULT = exports.READ_ITEMS = exports.PRINT_ITEMS = exports.NO_ACCESS = exports.MANAGE_VAULT = exports.IMPORT_ITEMS = exports.EXPORT_ITEMS = exports.DELETE_ITEMS = exports.CREATE_ITEMS = exports.ARCHIVE_ITEMS = exports.WordListType = exports.SeparatorType = exports.VaultType = exports.AllowedRecipientType = exports.AllowedType = exports.ItemShareDuration = exports.ItemState = exports.AutofillBehavior = exports.ItemFieldType = exports.ItemCategory = exports.VaultAccessorType = exports.GroupState = exports.GroupType = undefined;
1551
+ var GroupType;
1552
+ (function(GroupType2) {
1553
+ GroupType2["Owners"] = "owners";
1554
+ GroupType2["Administrators"] = "administrators";
1555
+ GroupType2["Recovery"] = "recovery";
1556
+ GroupType2["ExternalAccountManagers"] = "externalAccountManagers";
1557
+ GroupType2["TeamMembers"] = "teamMembers";
1558
+ GroupType2["UserDefined"] = "userDefined";
1559
+ GroupType2["Unsupported"] = "unsupported";
1560
+ })(GroupType || (exports.GroupType = GroupType = {}));
1561
+ var GroupState;
1562
+ (function(GroupState2) {
1563
+ GroupState2["Active"] = "active";
1564
+ GroupState2["Deleted"] = "deleted";
1565
+ GroupState2["Unsupported"] = "unsupported";
1566
+ })(GroupState || (exports.GroupState = GroupState = {}));
1567
+ var VaultAccessorType;
1568
+ (function(VaultAccessorType2) {
1569
+ VaultAccessorType2["User"] = "user";
1570
+ VaultAccessorType2["Group"] = "group";
1571
+ })(VaultAccessorType || (exports.VaultAccessorType = VaultAccessorType = {}));
1572
+ var ItemCategory;
1573
+ (function(ItemCategory2) {
1574
+ ItemCategory2["Login"] = "Login";
1575
+ ItemCategory2["SecureNote"] = "SecureNote";
1576
+ ItemCategory2["CreditCard"] = "CreditCard";
1577
+ ItemCategory2["CryptoWallet"] = "CryptoWallet";
1578
+ ItemCategory2["Identity"] = "Identity";
1579
+ ItemCategory2["Password"] = "Password";
1580
+ ItemCategory2["Document"] = "Document";
1581
+ ItemCategory2["ApiCredentials"] = "ApiCredentials";
1582
+ ItemCategory2["BankAccount"] = "BankAccount";
1583
+ ItemCategory2["Database"] = "Database";
1584
+ ItemCategory2["DriverLicense"] = "DriverLicense";
1585
+ ItemCategory2["Email"] = "Email";
1586
+ ItemCategory2["MedicalRecord"] = "MedicalRecord";
1587
+ ItemCategory2["Membership"] = "Membership";
1588
+ ItemCategory2["OutdoorLicense"] = "OutdoorLicense";
1589
+ ItemCategory2["Passport"] = "Passport";
1590
+ ItemCategory2["Rewards"] = "Rewards";
1591
+ ItemCategory2["Router"] = "Router";
1592
+ ItemCategory2["Server"] = "Server";
1593
+ ItemCategory2["SshKey"] = "SshKey";
1594
+ ItemCategory2["SocialSecurityNumber"] = "SocialSecurityNumber";
1595
+ ItemCategory2["SoftwareLicense"] = "SoftwareLicense";
1596
+ ItemCategory2["Person"] = "Person";
1597
+ ItemCategory2["Unsupported"] = "Unsupported";
1598
+ })(ItemCategory || (exports.ItemCategory = ItemCategory = {}));
1599
+ var ItemFieldType;
1600
+ (function(ItemFieldType2) {
1601
+ ItemFieldType2["Text"] = "Text";
1602
+ ItemFieldType2["Concealed"] = "Concealed";
1603
+ ItemFieldType2["CreditCardType"] = "CreditCardType";
1604
+ ItemFieldType2["CreditCardNumber"] = "CreditCardNumber";
1605
+ ItemFieldType2["Phone"] = "Phone";
1606
+ ItemFieldType2["Url"] = "Url";
1607
+ ItemFieldType2["Totp"] = "Totp";
1608
+ ItemFieldType2["Email"] = "Email";
1609
+ ItemFieldType2["Reference"] = "Reference";
1610
+ ItemFieldType2["SshKey"] = "SshKey";
1611
+ ItemFieldType2["Menu"] = "Menu";
1612
+ ItemFieldType2["MonthYear"] = "MonthYear";
1613
+ ItemFieldType2["Address"] = "Address";
1614
+ ItemFieldType2["Date"] = "Date";
1615
+ ItemFieldType2["Unsupported"] = "Unsupported";
1616
+ })(ItemFieldType || (exports.ItemFieldType = ItemFieldType = {}));
1617
+ var AutofillBehavior;
1618
+ (function(AutofillBehavior2) {
1619
+ AutofillBehavior2["AnywhereOnWebsite"] = "AnywhereOnWebsite";
1620
+ AutofillBehavior2["ExactDomain"] = "ExactDomain";
1621
+ AutofillBehavior2["Never"] = "Never";
1622
+ })(AutofillBehavior || (exports.AutofillBehavior = AutofillBehavior = {}));
1623
+ var ItemState;
1624
+ (function(ItemState2) {
1625
+ ItemState2["Active"] = "active";
1626
+ ItemState2["Archived"] = "archived";
1627
+ })(ItemState || (exports.ItemState = ItemState = {}));
1628
+ var ItemShareDuration;
1629
+ (function(ItemShareDuration2) {
1630
+ ItemShareDuration2["OneHour"] = "OneHour";
1631
+ ItemShareDuration2["OneDay"] = "OneDay";
1632
+ ItemShareDuration2["SevenDays"] = "SevenDays";
1633
+ ItemShareDuration2["FourteenDays"] = "FourteenDays";
1634
+ ItemShareDuration2["ThirtyDays"] = "ThirtyDays";
1635
+ })(ItemShareDuration || (exports.ItemShareDuration = ItemShareDuration = {}));
1636
+ var AllowedType;
1637
+ (function(AllowedType2) {
1638
+ AllowedType2["Authenticated"] = "Authenticated";
1639
+ AllowedType2["Public"] = "Public";
1640
+ })(AllowedType || (exports.AllowedType = AllowedType = {}));
1641
+ var AllowedRecipientType;
1642
+ (function(AllowedRecipientType2) {
1643
+ AllowedRecipientType2["Email"] = "Email";
1644
+ AllowedRecipientType2["Domain"] = "Domain";
1645
+ })(AllowedRecipientType || (exports.AllowedRecipientType = AllowedRecipientType = {}));
1646
+ var VaultType;
1647
+ (function(VaultType2) {
1648
+ VaultType2["Personal"] = "personal";
1649
+ VaultType2["Everyone"] = "everyone";
1650
+ VaultType2["Transfer"] = "transfer";
1651
+ VaultType2["UserCreated"] = "userCreated";
1652
+ VaultType2["Unsupported"] = "unsupported";
1653
+ })(VaultType || (exports.VaultType = VaultType = {}));
1654
+ var SeparatorType;
1655
+ (function(SeparatorType2) {
1656
+ SeparatorType2["Digits"] = "digits";
1657
+ SeparatorType2["DigitsAndSymbols"] = "digitsAndSymbols";
1658
+ SeparatorType2["Spaces"] = "spaces";
1659
+ SeparatorType2["Hyphens"] = "hyphens";
1660
+ SeparatorType2["Underscores"] = "underscores";
1661
+ SeparatorType2["Periods"] = "periods";
1662
+ SeparatorType2["Commas"] = "commas";
1663
+ })(SeparatorType || (exports.SeparatorType = SeparatorType = {}));
1664
+ var WordListType;
1665
+ (function(WordListType2) {
1666
+ WordListType2["FullWords"] = "fullWords";
1667
+ WordListType2["Syllables"] = "syllables";
1668
+ WordListType2["ThreeLetters"] = "threeLetters";
1669
+ })(WordListType || (exports.WordListType = WordListType = {}));
1670
+ exports.ARCHIVE_ITEMS = 256;
1671
+ exports.CREATE_ITEMS = 128;
1672
+ exports.DELETE_ITEMS = 512;
1673
+ exports.EXPORT_ITEMS = 4194304;
1674
+ exports.IMPORT_ITEMS = 2097152;
1675
+ exports.MANAGE_VAULT = 2;
1676
+ exports.NO_ACCESS = 0;
1677
+ exports.PRINT_ITEMS = 8388608;
1678
+ exports.READ_ITEMS = 32;
1679
+ exports.RECOVER_VAULT = 1;
1680
+ exports.REVEAL_ITEM_PASSWORD = 16;
1681
+ exports.SEND_ITEMS = 1048576;
1682
+ exports.UPDATE_ITEMS = 64;
1683
+ exports.UPDATE_ITEM_HISTORY = 1024;
1684
+ var ReviverFunc = (key, value) => {
1685
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/.test(value) && (key === "createdAt" || key === "updatedAt")) {
1686
+ return new Date(value);
1687
+ }
1688
+ if (Array.isArray(value) && value.every((v) => Number.isInteger(v) && v >= 0 && v <= 255) && value.length > 0) {
1689
+ return new Uint8Array(value);
1690
+ }
1691
+ return value;
1692
+ };
1693
+ exports.ReviverFunc = ReviverFunc;
1694
+ var ReplacerFunc = (key, value) => {
1695
+ if (value instanceof Date) {
1696
+ return value.toISOString();
1697
+ }
1698
+ if (value instanceof Uint8Array) {
1699
+ return Array.from(value);
1700
+ }
1701
+ return value;
1702
+ };
1703
+ exports.ReplacerFunc = ReplacerFunc;
1704
+ });
1705
+
1706
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/errors.js
1707
+ var require_errors = __commonJS((exports) => {
1708
+ Object.defineProperty(exports, "__esModule", { value: true });
1709
+ exports.throwError = exports.RateLimitExceededError = exports.DesktopSessionExpiredError = undefined;
1710
+
1711
+ class DesktopSessionExpiredError extends Error {
1712
+ constructor(message) {
1713
+ super();
1714
+ this.message = message;
1715
+ }
1716
+ }
1717
+ exports.DesktopSessionExpiredError = DesktopSessionExpiredError;
1718
+
1719
+ class RateLimitExceededError extends Error {
1720
+ constructor(message) {
1721
+ super();
1722
+ this.message = message;
1723
+ }
1724
+ }
1725
+ exports.RateLimitExceededError = RateLimitExceededError;
1726
+ var throwError = (errString) => {
1727
+ let err;
1728
+ try {
1729
+ err = JSON.parse(errString);
1730
+ } catch (e) {
1731
+ throw new Error(errString);
1732
+ }
1733
+ switch (err.name) {
1734
+ case "DesktopSessionExpired":
1735
+ throw new DesktopSessionExpiredError(err.message);
1736
+ case "RateLimitExceeded":
1737
+ throw new RateLimitExceededError(err.message);
1738
+ default:
1739
+ throw new Error(err.message);
1740
+ }
1741
+ };
1742
+ exports.throwError = throwError;
1743
+ });
1744
+
1745
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/core.js
1746
+ var require_core2 = __commonJS((exports) => {
1747
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
1748
+ function adopt(value) {
1749
+ return value instanceof P ? value : new P(function(resolve) {
1750
+ resolve(value);
1751
+ });
1752
+ }
1753
+ return new (P || (P = Promise))(function(resolve, reject) {
1754
+ function fulfilled(value) {
1755
+ try {
1756
+ step(generator.next(value));
1757
+ } catch (e) {
1758
+ reject(e);
1759
+ }
1760
+ }
1761
+ function rejected(value) {
1762
+ try {
1763
+ step(generator["throw"](value));
1764
+ } catch (e) {
1765
+ reject(e);
1766
+ }
1767
+ }
1768
+ function step(result) {
1769
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1770
+ }
1771
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1772
+ });
1773
+ };
1774
+ Object.defineProperty(exports, "__esModule", { value: true });
1775
+ exports.InnerClient = exports.SharedCore = exports.WasmCore = undefined;
1776
+ var sdk_core_1 = require_core();
1777
+ var types_1 = require_types();
1778
+ var errors_1 = require_errors();
1779
+ var messageLimit = 50 * 1024 * 1024;
1780
+
1781
+ class WasmCore {
1782
+ initClient(config) {
1783
+ return __awaiter(this, undefined, undefined, function* () {
1784
+ try {
1785
+ return yield (0, sdk_core_1.init_client)(config);
1786
+ } catch (e) {
1787
+ (0, errors_1.throwError)(e);
1788
+ }
1789
+ });
1790
+ }
1791
+ invoke(config) {
1792
+ return __awaiter(this, undefined, undefined, function* () {
1793
+ try {
1794
+ return yield (0, sdk_core_1.invoke)(config);
1795
+ } catch (e) {
1796
+ (0, errors_1.throwError)(e);
1797
+ }
1798
+ });
1799
+ }
1800
+ releaseClient(clientId) {
1801
+ try {
1802
+ (0, sdk_core_1.release_client)(clientId);
1803
+ } catch (e) {
1804
+ console.warn("failed to release client:", e);
1805
+ }
1806
+ }
1807
+ }
1808
+ exports.WasmCore = WasmCore;
1809
+
1810
+ class SharedCore {
1811
+ constructor() {
1812
+ this.inner = new WasmCore;
1813
+ }
1814
+ setInner(core) {
1815
+ this.inner = core;
1816
+ }
1817
+ initClient(config) {
1818
+ return __awaiter(this, undefined, undefined, function* () {
1819
+ const serializedConfig = JSON.stringify(config);
1820
+ return this.inner.initClient(serializedConfig);
1821
+ });
1822
+ }
1823
+ invoke(config) {
1824
+ return __awaiter(this, undefined, undefined, function* () {
1825
+ const serializedConfig = JSON.stringify(config, types_1.ReplacerFunc);
1826
+ if (new TextEncoder().encode(serializedConfig).length > messageLimit) {
1827
+ (0, errors_1.throwError)(`message size exceeds the limit of ${messageLimit} bytes, please contact 1Password at support@1password.com or https://developer.1password.com/joinslack if you need help."`);
1828
+ }
1829
+ return this.inner.invoke(serializedConfig);
1830
+ });
1831
+ }
1832
+ invoke_sync(config) {
1833
+ const serializedConfig = JSON.stringify(config, types_1.ReplacerFunc);
1834
+ if (new TextEncoder().encode(serializedConfig).length > messageLimit) {
1835
+ (0, errors_1.throwError)(`message size exceeds the limit of ${messageLimit} bytes, please contact 1Password at support@1password.com or https://developer.1password.com/joinslack if you need help.`);
1836
+ }
1837
+ return (0, sdk_core_1.invoke_sync)(serializedConfig);
1838
+ }
1839
+ releaseClient(clientId) {
1840
+ const serializedId = JSON.stringify(clientId);
1841
+ this.inner.releaseClient(serializedId);
1842
+ }
1843
+ }
1844
+ exports.SharedCore = SharedCore;
1845
+
1846
+ class InnerClient {
1847
+ constructor(id, core, config) {
1848
+ this.id = id;
1849
+ this.core = core;
1850
+ this.config = config;
1851
+ }
1852
+ invoke(config) {
1853
+ return __awaiter(this, undefined, undefined, function* () {
1854
+ try {
1855
+ return yield this.core.invoke(config);
1856
+ } catch (err) {
1857
+ if (err instanceof errors_1.DesktopSessionExpiredError) {
1858
+ const newId = yield this.core.initClient(this.config);
1859
+ this.id = parseInt(newId, 10);
1860
+ config.invocation.clientId = this.id;
1861
+ return yield this.core.invoke(config);
1862
+ }
1863
+ throw err;
1864
+ }
1865
+ });
1866
+ }
1867
+ }
1868
+ exports.InnerClient = InnerClient;
1869
+ });
1870
+
1871
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/version.js
1872
+ var require_version = __commonJS((exports) => {
1873
+ Object.defineProperty(exports, "__esModule", { value: true });
1874
+ exports.SDK_BUILD_NUMBER = exports.SDK_VERSION = undefined;
1875
+ exports.SDK_VERSION = "0.4.1-beta.1";
1876
+ exports.SDK_BUILD_NUMBER = "0040101";
1877
+ });
1878
+
1879
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/configuration.js
1880
+ var require_configuration = __commonJS((exports) => {
1881
+ var __importDefault = exports && exports.__importDefault || function(mod) {
1882
+ return mod && mod.__esModule ? mod : { default: mod };
1883
+ };
1884
+ Object.defineProperty(exports, "__esModule", { value: true });
1885
+ exports.getOsName = exports.clientAuthConfig = exports.DesktopAuth = exports.VERSION = exports.LANGUAGE = undefined;
1886
+ var os_1 = __importDefault(__require("os"));
1887
+ var version_js_1 = require_version();
1888
+ exports.LANGUAGE = "JS";
1889
+ exports.VERSION = version_js_1.SDK_BUILD_NUMBER;
1890
+
1891
+ class DesktopAuth {
1892
+ constructor(accountName) {
1893
+ this.accountName = accountName;
1894
+ }
1895
+ }
1896
+ exports.DesktopAuth = DesktopAuth;
1897
+ var clientAuthConfig = (userConfig) => {
1898
+ const defaultOsVersion = "0.0.0";
1899
+ let serviceAccountToken;
1900
+ let accountName;
1901
+ if (typeof userConfig.auth === "string") {
1902
+ serviceAccountToken = userConfig.auth;
1903
+ } else if (userConfig.auth instanceof DesktopAuth) {
1904
+ accountName = userConfig.auth.accountName;
1905
+ }
1906
+ return {
1907
+ serviceAccountToken: serviceAccountToken !== null && serviceAccountToken !== undefined ? serviceAccountToken : "",
1908
+ accountName,
1909
+ programmingLanguage: exports.LANGUAGE,
1910
+ sdkVersion: exports.VERSION,
1911
+ integrationName: userConfig.integrationName,
1912
+ integrationVersion: userConfig.integrationVersion,
1913
+ requestLibraryName: "Fetch API",
1914
+ requestLibraryVersion: "Fetch API",
1915
+ os: (0, exports.getOsName)(),
1916
+ osVersion: defaultOsVersion,
1917
+ architecture: os_1.default.arch()
1918
+ };
1919
+ };
1920
+ exports.clientAuthConfig = clientAuthConfig;
1921
+ var getOsName = () => {
1922
+ const os_name = os_1.default.type().toLowerCase();
1923
+ if (os_name === "windows_nt") {
1924
+ return "windows";
1925
+ }
1926
+ return os_name;
1927
+ };
1928
+ exports.getOsName = getOsName;
1929
+ });
1930
+
1931
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/secrets.js
1932
+ var require_secrets = __commonJS((exports) => {
1933
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
1934
+ function adopt(value) {
1935
+ return value instanceof P ? value : new P(function(resolve) {
1936
+ resolve(value);
1937
+ });
1938
+ }
1939
+ return new (P || (P = Promise))(function(resolve, reject) {
1940
+ function fulfilled(value) {
1941
+ try {
1942
+ step(generator.next(value));
1943
+ } catch (e) {
1944
+ reject(e);
1945
+ }
1946
+ }
1947
+ function rejected(value) {
1948
+ try {
1949
+ step(generator["throw"](value));
1950
+ } catch (e) {
1951
+ reject(e);
1952
+ }
1953
+ }
1954
+ function step(result) {
1955
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1956
+ }
1957
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1958
+ });
1959
+ };
1960
+ var __classPrivateFieldSet = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
1961
+ if (kind === "m")
1962
+ throw new TypeError("Private method is not writable");
1963
+ if (kind === "a" && !f)
1964
+ throw new TypeError("Private accessor was defined without a setter");
1965
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1966
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
1967
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1968
+ };
1969
+ var __classPrivateFieldGet = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
1970
+ if (kind === "a" && !f)
1971
+ throw new TypeError("Private accessor was defined without a getter");
1972
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1973
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
1974
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1975
+ };
1976
+ var _Secrets_inner;
1977
+ Object.defineProperty(exports, "__esModule", { value: true });
1978
+ exports.Secrets = undefined;
1979
+ var core_js_1 = require_core2();
1980
+ var types_js_1 = require_types();
1981
+
1982
+ class Secrets {
1983
+ constructor(inner) {
1984
+ _Secrets_inner.set(this, undefined);
1985
+ __classPrivateFieldSet(this, _Secrets_inner, inner, "f");
1986
+ }
1987
+ resolve(secretReference) {
1988
+ return __awaiter(this, undefined, undefined, function* () {
1989
+ const invocationConfig = {
1990
+ invocation: {
1991
+ clientId: __classPrivateFieldGet(this, _Secrets_inner, "f").id,
1992
+ parameters: {
1993
+ name: "SecretsResolve",
1994
+ parameters: {
1995
+ secret_reference: secretReference
1996
+ }
1997
+ }
1998
+ }
1999
+ };
2000
+ return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2001
+ });
2002
+ }
2003
+ resolveAll(secretReferences) {
2004
+ return __awaiter(this, undefined, undefined, function* () {
2005
+ const invocationConfig = {
2006
+ invocation: {
2007
+ clientId: __classPrivateFieldGet(this, _Secrets_inner, "f").id,
2008
+ parameters: {
2009
+ name: "SecretsResolveAll",
2010
+ parameters: {
2011
+ secret_references: secretReferences
2012
+ }
2013
+ }
2014
+ }
2015
+ };
2016
+ return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2017
+ });
2018
+ }
2019
+ static validateSecretReference(secretReference) {
2020
+ const sharedCore = new core_js_1.SharedCore;
2021
+ const invocationConfig = {
2022
+ invocation: {
2023
+ parameters: {
2024
+ name: "ValidateSecretReference",
2025
+ parameters: {
2026
+ secret_reference: secretReference
2027
+ }
2028
+ }
2029
+ }
2030
+ };
2031
+ sharedCore.invoke_sync(invocationConfig);
2032
+ }
2033
+ static generatePassword(recipe) {
2034
+ const sharedCore = new core_js_1.SharedCore;
2035
+ const invocationConfig = {
2036
+ invocation: {
2037
+ parameters: {
2038
+ name: "GeneratePassword",
2039
+ parameters: {
2040
+ recipe
2041
+ }
2042
+ }
2043
+ }
2044
+ };
2045
+ return JSON.parse(sharedCore.invoke_sync(invocationConfig), types_js_1.ReviverFunc);
2046
+ }
2047
+ }
2048
+ exports.Secrets = Secrets;
2049
+ _Secrets_inner = new WeakMap;
2050
+ });
2051
+
2052
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/items_shares.js
2053
+ var require_items_shares = __commonJS((exports) => {
2054
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
2055
+ function adopt(value) {
2056
+ return value instanceof P ? value : new P(function(resolve) {
2057
+ resolve(value);
2058
+ });
2059
+ }
2060
+ return new (P || (P = Promise))(function(resolve, reject) {
2061
+ function fulfilled(value) {
2062
+ try {
2063
+ step(generator.next(value));
2064
+ } catch (e) {
2065
+ reject(e);
2066
+ }
2067
+ }
2068
+ function rejected(value) {
2069
+ try {
2070
+ step(generator["throw"](value));
2071
+ } catch (e) {
2072
+ reject(e);
2073
+ }
2074
+ }
2075
+ function step(result) {
2076
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2077
+ }
2078
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2079
+ });
2080
+ };
2081
+ var __classPrivateFieldSet = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2082
+ if (kind === "m")
2083
+ throw new TypeError("Private method is not writable");
2084
+ if (kind === "a" && !f)
2085
+ throw new TypeError("Private accessor was defined without a setter");
2086
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2087
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
2088
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
2089
+ };
2090
+ var __classPrivateFieldGet = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
2091
+ if (kind === "a" && !f)
2092
+ throw new TypeError("Private accessor was defined without a getter");
2093
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2094
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
2095
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2096
+ };
2097
+ var _ItemsShares_inner;
2098
+ Object.defineProperty(exports, "__esModule", { value: true });
2099
+ exports.ItemsShares = undefined;
2100
+ var types_js_1 = require_types();
2101
+
2102
+ class ItemsShares {
2103
+ constructor(inner) {
2104
+ _ItemsShares_inner.set(this, undefined);
2105
+ __classPrivateFieldSet(this, _ItemsShares_inner, inner, "f");
2106
+ }
2107
+ getAccountPolicy(vaultId, itemId) {
2108
+ return __awaiter(this, undefined, undefined, function* () {
2109
+ const invocationConfig = {
2110
+ invocation: {
2111
+ clientId: __classPrivateFieldGet(this, _ItemsShares_inner, "f").id,
2112
+ parameters: {
2113
+ name: "ItemsSharesGetAccountPolicy",
2114
+ parameters: {
2115
+ vault_id: vaultId,
2116
+ item_id: itemId
2117
+ }
2118
+ }
2119
+ }
2120
+ };
2121
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2122
+ });
2123
+ }
2124
+ validateRecipients(policy, recipients) {
2125
+ return __awaiter(this, undefined, undefined, function* () {
2126
+ const invocationConfig = {
2127
+ invocation: {
2128
+ clientId: __classPrivateFieldGet(this, _ItemsShares_inner, "f").id,
2129
+ parameters: {
2130
+ name: "ItemsSharesValidateRecipients",
2131
+ parameters: {
2132
+ policy,
2133
+ recipients
2134
+ }
2135
+ }
2136
+ }
2137
+ };
2138
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2139
+ });
2140
+ }
2141
+ create(item, policy, params) {
2142
+ return __awaiter(this, undefined, undefined, function* () {
2143
+ const invocationConfig = {
2144
+ invocation: {
2145
+ clientId: __classPrivateFieldGet(this, _ItemsShares_inner, "f").id,
2146
+ parameters: {
2147
+ name: "ItemsSharesCreate",
2148
+ parameters: {
2149
+ item,
2150
+ policy,
2151
+ params
2152
+ }
2153
+ }
2154
+ }
2155
+ };
2156
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2157
+ });
2158
+ }
2159
+ }
2160
+ exports.ItemsShares = ItemsShares;
2161
+ _ItemsShares_inner = new WeakMap;
2162
+ });
2163
+
2164
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/items_files.js
2165
+ var require_items_files = __commonJS((exports) => {
2166
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
2167
+ function adopt(value) {
2168
+ return value instanceof P ? value : new P(function(resolve) {
2169
+ resolve(value);
2170
+ });
2171
+ }
2172
+ return new (P || (P = Promise))(function(resolve, reject) {
2173
+ function fulfilled(value) {
2174
+ try {
2175
+ step(generator.next(value));
2176
+ } catch (e) {
2177
+ reject(e);
2178
+ }
2179
+ }
2180
+ function rejected(value) {
2181
+ try {
2182
+ step(generator["throw"](value));
2183
+ } catch (e) {
2184
+ reject(e);
2185
+ }
2186
+ }
2187
+ function step(result) {
2188
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2189
+ }
2190
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2191
+ });
2192
+ };
2193
+ var __classPrivateFieldSet = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2194
+ if (kind === "m")
2195
+ throw new TypeError("Private method is not writable");
2196
+ if (kind === "a" && !f)
2197
+ throw new TypeError("Private accessor was defined without a setter");
2198
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2199
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
2200
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
2201
+ };
2202
+ var __classPrivateFieldGet = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
2203
+ if (kind === "a" && !f)
2204
+ throw new TypeError("Private accessor was defined without a getter");
2205
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2206
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
2207
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2208
+ };
2209
+ var _ItemsFiles_inner;
2210
+ Object.defineProperty(exports, "__esModule", { value: true });
2211
+ exports.ItemsFiles = undefined;
2212
+ var types_js_1 = require_types();
2213
+
2214
+ class ItemsFiles {
2215
+ constructor(inner) {
2216
+ _ItemsFiles_inner.set(this, undefined);
2217
+ __classPrivateFieldSet(this, _ItemsFiles_inner, inner, "f");
2218
+ }
2219
+ attach(item, fileParams) {
2220
+ return __awaiter(this, undefined, undefined, function* () {
2221
+ const invocationConfig = {
2222
+ invocation: {
2223
+ clientId: __classPrivateFieldGet(this, _ItemsFiles_inner, "f").id,
2224
+ parameters: {
2225
+ name: "ItemsFilesAttach",
2226
+ parameters: {
2227
+ item,
2228
+ file_params: fileParams
2229
+ }
2230
+ }
2231
+ }
2232
+ };
2233
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2234
+ });
2235
+ }
2236
+ read(vaultId, itemId, attr) {
2237
+ return __awaiter(this, undefined, undefined, function* () {
2238
+ const invocationConfig = {
2239
+ invocation: {
2240
+ clientId: __classPrivateFieldGet(this, _ItemsFiles_inner, "f").id,
2241
+ parameters: {
2242
+ name: "ItemsFilesRead",
2243
+ parameters: {
2244
+ vault_id: vaultId,
2245
+ item_id: itemId,
2246
+ attr
2247
+ }
2248
+ }
2249
+ }
2250
+ };
2251
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2252
+ });
2253
+ }
2254
+ delete(item, sectionId, fieldId) {
2255
+ return __awaiter(this, undefined, undefined, function* () {
2256
+ const invocationConfig = {
2257
+ invocation: {
2258
+ clientId: __classPrivateFieldGet(this, _ItemsFiles_inner, "f").id,
2259
+ parameters: {
2260
+ name: "ItemsFilesDelete",
2261
+ parameters: {
2262
+ item,
2263
+ section_id: sectionId,
2264
+ field_id: fieldId
2265
+ }
2266
+ }
2267
+ }
2268
+ };
2269
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2270
+ });
2271
+ }
2272
+ replaceDocument(item, docParams) {
2273
+ return __awaiter(this, undefined, undefined, function* () {
2274
+ const invocationConfig = {
2275
+ invocation: {
2276
+ clientId: __classPrivateFieldGet(this, _ItemsFiles_inner, "f").id,
2277
+ parameters: {
2278
+ name: "ItemsFilesReplaceDocument",
2279
+ parameters: {
2280
+ item,
2281
+ doc_params: docParams
2282
+ }
2283
+ }
2284
+ }
2285
+ };
2286
+ return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2287
+ });
2288
+ }
2289
+ }
2290
+ exports.ItemsFiles = ItemsFiles;
2291
+ _ItemsFiles_inner = new WeakMap;
2292
+ });
2293
+
2294
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/items.js
2295
+ var require_items = __commonJS((exports) => {
2296
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
2297
+ function adopt(value) {
2298
+ return value instanceof P ? value : new P(function(resolve) {
2299
+ resolve(value);
2300
+ });
2301
+ }
2302
+ return new (P || (P = Promise))(function(resolve, reject) {
2303
+ function fulfilled(value) {
2304
+ try {
2305
+ step(generator.next(value));
2306
+ } catch (e) {
2307
+ reject(e);
2308
+ }
2309
+ }
2310
+ function rejected(value) {
2311
+ try {
2312
+ step(generator["throw"](value));
2313
+ } catch (e) {
2314
+ reject(e);
2315
+ }
2316
+ }
2317
+ function step(result) {
2318
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2319
+ }
2320
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2321
+ });
2322
+ };
2323
+ var __classPrivateFieldSet = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2324
+ if (kind === "m")
2325
+ throw new TypeError("Private method is not writable");
2326
+ if (kind === "a" && !f)
2327
+ throw new TypeError("Private accessor was defined without a setter");
2328
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2329
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
2330
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
2331
+ };
2332
+ var __classPrivateFieldGet = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
2333
+ if (kind === "a" && !f)
2334
+ throw new TypeError("Private accessor was defined without a getter");
2335
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2336
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
2337
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2338
+ };
2339
+ var _Items_inner;
2340
+ Object.defineProperty(exports, "__esModule", { value: true });
2341
+ exports.Items = undefined;
2342
+ var types_js_1 = require_types();
2343
+ var items_shares_js_1 = require_items_shares();
2344
+ var items_files_js_1 = require_items_files();
2345
+
2346
+ class Items {
2347
+ constructor(inner) {
2348
+ _Items_inner.set(this, undefined);
2349
+ __classPrivateFieldSet(this, _Items_inner, inner, "f");
2350
+ this.shares = new items_shares_js_1.ItemsShares(inner);
2351
+ this.files = new items_files_js_1.ItemsFiles(inner);
2352
+ }
2353
+ create(params) {
2354
+ return __awaiter(this, undefined, undefined, function* () {
2355
+ const invocationConfig = {
2356
+ invocation: {
2357
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
2358
+ parameters: {
2359
+ name: "ItemsCreate",
2360
+ parameters: {
2361
+ params
2362
+ }
2363
+ }
2364
+ }
2365
+ };
2366
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2367
+ });
2368
+ }
2369
+ createAll(vaultId, params) {
2370
+ return __awaiter(this, undefined, undefined, function* () {
2371
+ const invocationConfig = {
2372
+ invocation: {
2373
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
2374
+ parameters: {
2375
+ name: "ItemsCreateAll",
2376
+ parameters: {
2377
+ vault_id: vaultId,
2378
+ params
2379
+ }
2380
+ }
2381
+ }
2382
+ };
2383
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2384
+ });
2385
+ }
2386
+ get(vaultId, itemId) {
2387
+ return __awaiter(this, undefined, undefined, function* () {
2388
+ const invocationConfig = {
2389
+ invocation: {
2390
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
2391
+ parameters: {
2392
+ name: "ItemsGet",
2393
+ parameters: {
2394
+ vault_id: vaultId,
2395
+ item_id: itemId
2396
+ }
2397
+ }
2398
+ }
2399
+ };
2400
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2401
+ });
2402
+ }
2403
+ getAll(vaultId, itemIds) {
2404
+ return __awaiter(this, undefined, undefined, function* () {
2405
+ const invocationConfig = {
2406
+ invocation: {
2407
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
2408
+ parameters: {
2409
+ name: "ItemsGetAll",
2410
+ parameters: {
2411
+ vault_id: vaultId,
2412
+ item_ids: itemIds
2413
+ }
2414
+ }
2415
+ }
2416
+ };
2417
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2418
+ });
2419
+ }
2420
+ put(item) {
2421
+ return __awaiter(this, undefined, undefined, function* () {
2422
+ const invocationConfig = {
2423
+ invocation: {
2424
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
2425
+ parameters: {
2426
+ name: "ItemsPut",
2427
+ parameters: {
2428
+ item
2429
+ }
2430
+ }
2431
+ }
2432
+ };
2433
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2434
+ });
2435
+ }
2436
+ delete(vaultId, itemId) {
2437
+ return __awaiter(this, undefined, undefined, function* () {
2438
+ const invocationConfig = {
2439
+ invocation: {
2440
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
2441
+ parameters: {
2442
+ name: "ItemsDelete",
2443
+ parameters: {
2444
+ vault_id: vaultId,
2445
+ item_id: itemId
2446
+ }
2447
+ }
2448
+ }
2449
+ };
2450
+ yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig);
2451
+ });
2452
+ }
2453
+ deleteAll(vaultId, itemIds) {
2454
+ return __awaiter(this, undefined, undefined, function* () {
2455
+ const invocationConfig = {
2456
+ invocation: {
2457
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
2458
+ parameters: {
2459
+ name: "ItemsDeleteAll",
2460
+ parameters: {
2461
+ vault_id: vaultId,
2462
+ item_ids: itemIds
2463
+ }
2464
+ }
2465
+ }
2466
+ };
2467
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2468
+ });
2469
+ }
2470
+ archive(vaultId, itemId) {
2471
+ return __awaiter(this, undefined, undefined, function* () {
2472
+ const invocationConfig = {
2473
+ invocation: {
2474
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
2475
+ parameters: {
2476
+ name: "ItemsArchive",
2477
+ parameters: {
2478
+ vault_id: vaultId,
2479
+ item_id: itemId
2480
+ }
2481
+ }
2482
+ }
2483
+ };
2484
+ yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig);
2485
+ });
2486
+ }
2487
+ list(vaultId, ...filters) {
2488
+ return __awaiter(this, undefined, undefined, function* () {
2489
+ const invocationConfig = {
2490
+ invocation: {
2491
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
2492
+ parameters: {
2493
+ name: "ItemsList",
2494
+ parameters: {
2495
+ vault_id: vaultId,
2496
+ filters
2497
+ }
2498
+ }
2499
+ }
2500
+ };
2501
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2502
+ });
2503
+ }
2504
+ }
2505
+ exports.Items = Items;
2506
+ _Items_inner = new WeakMap;
2507
+ });
2508
+
2509
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/vaults.js
2510
+ var require_vaults = __commonJS((exports) => {
2511
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
2512
+ function adopt(value) {
2513
+ return value instanceof P ? value : new P(function(resolve) {
2514
+ resolve(value);
2515
+ });
2516
+ }
2517
+ return new (P || (P = Promise))(function(resolve, reject) {
2518
+ function fulfilled(value) {
2519
+ try {
2520
+ step(generator.next(value));
2521
+ } catch (e) {
2522
+ reject(e);
2523
+ }
2524
+ }
2525
+ function rejected(value) {
2526
+ try {
2527
+ step(generator["throw"](value));
2528
+ } catch (e) {
2529
+ reject(e);
2530
+ }
2531
+ }
2532
+ function step(result) {
2533
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2534
+ }
2535
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2536
+ });
2537
+ };
2538
+ var __classPrivateFieldSet = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2539
+ if (kind === "m")
2540
+ throw new TypeError("Private method is not writable");
2541
+ if (kind === "a" && !f)
2542
+ throw new TypeError("Private accessor was defined without a setter");
2543
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2544
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
2545
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
2546
+ };
2547
+ var __classPrivateFieldGet = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
2548
+ if (kind === "a" && !f)
2549
+ throw new TypeError("Private accessor was defined without a getter");
2550
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2551
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
2552
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2553
+ };
2554
+ var _Vaults_inner;
2555
+ Object.defineProperty(exports, "__esModule", { value: true });
2556
+ exports.Vaults = undefined;
2557
+ var types_js_1 = require_types();
2558
+
2559
+ class Vaults {
2560
+ constructor(inner) {
2561
+ _Vaults_inner.set(this, undefined);
2562
+ __classPrivateFieldSet(this, _Vaults_inner, inner, "f");
2563
+ }
2564
+ create(params) {
2565
+ return __awaiter(this, undefined, undefined, function* () {
2566
+ const invocationConfig = {
2567
+ invocation: {
2568
+ clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
2569
+ parameters: {
2570
+ name: "VaultsCreate",
2571
+ parameters: {
2572
+ params
2573
+ }
2574
+ }
2575
+ }
2576
+ };
2577
+ return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2578
+ });
2579
+ }
2580
+ list(params) {
2581
+ return __awaiter(this, undefined, undefined, function* () {
2582
+ const invocationConfig = {
2583
+ invocation: {
2584
+ clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
2585
+ parameters: {
2586
+ name: "VaultsList",
2587
+ parameters: {
2588
+ params
2589
+ }
2590
+ }
2591
+ }
2592
+ };
2593
+ return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2594
+ });
2595
+ }
2596
+ getOverview(vaultId) {
2597
+ return __awaiter(this, undefined, undefined, function* () {
2598
+ const invocationConfig = {
2599
+ invocation: {
2600
+ clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
2601
+ parameters: {
2602
+ name: "VaultsGetOverview",
2603
+ parameters: {
2604
+ vault_id: vaultId
2605
+ }
2606
+ }
2607
+ }
2608
+ };
2609
+ return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2610
+ });
2611
+ }
2612
+ get(vaultId, vaultParams) {
2613
+ return __awaiter(this, undefined, undefined, function* () {
2614
+ const invocationConfig = {
2615
+ invocation: {
2616
+ clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
2617
+ parameters: {
2618
+ name: "VaultsGet",
2619
+ parameters: {
2620
+ vault_id: vaultId,
2621
+ vault_params: vaultParams
2622
+ }
2623
+ }
2624
+ }
2625
+ };
2626
+ return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2627
+ });
2628
+ }
2629
+ update(vaultId, params) {
2630
+ return __awaiter(this, undefined, undefined, function* () {
2631
+ const invocationConfig = {
2632
+ invocation: {
2633
+ clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
2634
+ parameters: {
2635
+ name: "VaultsUpdate",
2636
+ parameters: {
2637
+ vault_id: vaultId,
2638
+ params
2639
+ }
2640
+ }
2641
+ }
2642
+ };
2643
+ return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2644
+ });
2645
+ }
2646
+ delete(vaultId) {
2647
+ return __awaiter(this, undefined, undefined, function* () {
2648
+ const invocationConfig = {
2649
+ invocation: {
2650
+ clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
2651
+ parameters: {
2652
+ name: "VaultsDelete",
2653
+ parameters: {
2654
+ vault_id: vaultId
2655
+ }
2656
+ }
2657
+ }
2658
+ };
2659
+ yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig);
2660
+ });
2661
+ }
2662
+ grantGroupPermissions(vaultId, groupPermissionsList) {
2663
+ return __awaiter(this, undefined, undefined, function* () {
2664
+ const invocationConfig = {
2665
+ invocation: {
2666
+ clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
2667
+ parameters: {
2668
+ name: "VaultsGrantGroupPermissions",
2669
+ parameters: {
2670
+ vault_id: vaultId,
2671
+ group_permissions_list: groupPermissionsList
2672
+ }
2673
+ }
2674
+ }
2675
+ };
2676
+ yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig);
2677
+ });
2678
+ }
2679
+ updateGroupPermissions(groupPermissionsList) {
2680
+ return __awaiter(this, undefined, undefined, function* () {
2681
+ const invocationConfig = {
2682
+ invocation: {
2683
+ clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
2684
+ parameters: {
2685
+ name: "VaultsUpdateGroupPermissions",
2686
+ parameters: {
2687
+ group_permissions_list: groupPermissionsList
2688
+ }
2689
+ }
2690
+ }
2691
+ };
2692
+ yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig);
2693
+ });
2694
+ }
2695
+ revokeGroupPermissions(vaultId, groupId) {
2696
+ return __awaiter(this, undefined, undefined, function* () {
2697
+ const invocationConfig = {
2698
+ invocation: {
2699
+ clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
2700
+ parameters: {
2701
+ name: "VaultsRevokeGroupPermissions",
2702
+ parameters: {
2703
+ vault_id: vaultId,
2704
+ group_id: groupId
2705
+ }
2706
+ }
2707
+ }
2708
+ };
2709
+ yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig);
2710
+ });
2711
+ }
2712
+ }
2713
+ exports.Vaults = Vaults;
2714
+ _Vaults_inner = new WeakMap;
2715
+ });
2716
+
2717
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/environments.js
2718
+ var require_environments = __commonJS((exports) => {
2719
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
2720
+ function adopt(value) {
2721
+ return value instanceof P ? value : new P(function(resolve) {
2722
+ resolve(value);
2723
+ });
2724
+ }
2725
+ return new (P || (P = Promise))(function(resolve, reject) {
2726
+ function fulfilled(value) {
2727
+ try {
2728
+ step(generator.next(value));
2729
+ } catch (e) {
2730
+ reject(e);
2731
+ }
2732
+ }
2733
+ function rejected(value) {
2734
+ try {
2735
+ step(generator["throw"](value));
2736
+ } catch (e) {
2737
+ reject(e);
2738
+ }
2739
+ }
2740
+ function step(result) {
2741
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2742
+ }
2743
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2744
+ });
2745
+ };
2746
+ var __classPrivateFieldSet = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2747
+ if (kind === "m")
2748
+ throw new TypeError("Private method is not writable");
2749
+ if (kind === "a" && !f)
2750
+ throw new TypeError("Private accessor was defined without a setter");
2751
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2752
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
2753
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
2754
+ };
2755
+ var __classPrivateFieldGet = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
2756
+ if (kind === "a" && !f)
2757
+ throw new TypeError("Private accessor was defined without a getter");
2758
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2759
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
2760
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2761
+ };
2762
+ var _Environments_inner;
2763
+ Object.defineProperty(exports, "__esModule", { value: true });
2764
+ exports.Environments = undefined;
2765
+ var types_js_1 = require_types();
2766
+
2767
+ class Environments {
2768
+ constructor(inner) {
2769
+ _Environments_inner.set(this, undefined);
2770
+ __classPrivateFieldSet(this, _Environments_inner, inner, "f");
2771
+ }
2772
+ getVariables(environmentId) {
2773
+ return __awaiter(this, undefined, undefined, function* () {
2774
+ const invocationConfig = {
2775
+ invocation: {
2776
+ clientId: __classPrivateFieldGet(this, _Environments_inner, "f").id,
2777
+ parameters: {
2778
+ name: "EnvironmentsGetVariables",
2779
+ parameters: {
2780
+ environment_id: environmentId
2781
+ }
2782
+ }
2783
+ }
2784
+ };
2785
+ return JSON.parse(yield __classPrivateFieldGet(this, _Environments_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2786
+ });
2787
+ }
2788
+ }
2789
+ exports.Environments = Environments;
2790
+ _Environments_inner = new WeakMap;
2791
+ });
2792
+
2793
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/groups.js
2794
+ var require_groups = __commonJS((exports) => {
2795
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
2796
+ function adopt(value) {
2797
+ return value instanceof P ? value : new P(function(resolve) {
2798
+ resolve(value);
2799
+ });
2800
+ }
2801
+ return new (P || (P = Promise))(function(resolve, reject) {
2802
+ function fulfilled(value) {
2803
+ try {
2804
+ step(generator.next(value));
2805
+ } catch (e) {
2806
+ reject(e);
2807
+ }
2808
+ }
2809
+ function rejected(value) {
2810
+ try {
2811
+ step(generator["throw"](value));
2812
+ } catch (e) {
2813
+ reject(e);
2814
+ }
2815
+ }
2816
+ function step(result) {
2817
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2818
+ }
2819
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2820
+ });
2821
+ };
2822
+ var __classPrivateFieldSet = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2823
+ if (kind === "m")
2824
+ throw new TypeError("Private method is not writable");
2825
+ if (kind === "a" && !f)
2826
+ throw new TypeError("Private accessor was defined without a setter");
2827
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2828
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
2829
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
2830
+ };
2831
+ var __classPrivateFieldGet = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
2832
+ if (kind === "a" && !f)
2833
+ throw new TypeError("Private accessor was defined without a getter");
2834
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
2835
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
2836
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2837
+ };
2838
+ var _Groups_inner;
2839
+ Object.defineProperty(exports, "__esModule", { value: true });
2840
+ exports.Groups = undefined;
2841
+ var types_js_1 = require_types();
2842
+
2843
+ class Groups {
2844
+ constructor(inner) {
2845
+ _Groups_inner.set(this, undefined);
2846
+ __classPrivateFieldSet(this, _Groups_inner, inner, "f");
2847
+ }
2848
+ get(groupId, groupParams) {
2849
+ return __awaiter(this, undefined, undefined, function* () {
2850
+ const invocationConfig = {
2851
+ invocation: {
2852
+ clientId: __classPrivateFieldGet(this, _Groups_inner, "f").id,
2853
+ parameters: {
2854
+ name: "GroupsGet",
2855
+ parameters: {
2856
+ group_id: groupId,
2857
+ group_params: groupParams
2858
+ }
2859
+ }
2860
+ }
2861
+ };
2862
+ return JSON.parse(yield __classPrivateFieldGet(this, _Groups_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
2863
+ });
2864
+ }
2865
+ }
2866
+ exports.Groups = Groups;
2867
+ _Groups_inner = new WeakMap;
2868
+ });
2869
+
2870
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/client.js
2871
+ var require_client = __commonJS((exports) => {
2872
+ Object.defineProperty(exports, "__esModule", { value: true });
2873
+ exports.Client = undefined;
2874
+ var secrets_js_1 = require_secrets();
2875
+ var items_js_1 = require_items();
2876
+ var vaults_js_1 = require_vaults();
2877
+ var environments_js_1 = require_environments();
2878
+ var groups_js_1 = require_groups();
2879
+
2880
+ class Client {
2881
+ constructor(innerClient) {
2882
+ this.secrets = new secrets_js_1.Secrets(innerClient);
2883
+ this.items = new items_js_1.Items(innerClient);
2884
+ this.vaults = new vaults_js_1.Vaults(innerClient);
2885
+ this.environments = new environments_js_1.Environments(innerClient);
2886
+ this.groups = new groups_js_1.Groups(innerClient);
2887
+ }
2888
+ }
2889
+ exports.Client = Client;
2890
+ });
2891
+
2892
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/shared_lib_core.js
2893
+ var require_shared_lib_core = __commonJS((exports) => {
2894
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
2895
+ if (k2 === undefined)
2896
+ k2 = k;
2897
+ var desc = Object.getOwnPropertyDescriptor(m, k);
2898
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2899
+ desc = { enumerable: true, get: function() {
2900
+ return m[k];
2901
+ } };
2902
+ }
2903
+ Object.defineProperty(o, k2, desc);
2904
+ } : function(o, m, k, k2) {
2905
+ if (k2 === undefined)
2906
+ k2 = k;
2907
+ o[k2] = m[k];
2908
+ });
2909
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
2910
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
2911
+ } : function(o, v) {
2912
+ o["default"] = v;
2913
+ });
2914
+ var __importStar = exports && exports.__importStar || function() {
2915
+ var ownKeys = function(o) {
2916
+ ownKeys = Object.getOwnPropertyNames || function(o2) {
2917
+ var ar = [];
2918
+ for (var k in o2)
2919
+ if (Object.prototype.hasOwnProperty.call(o2, k))
2920
+ ar[ar.length] = k;
2921
+ return ar;
2922
+ };
2923
+ return ownKeys(o);
2924
+ };
2925
+ return function(mod) {
2926
+ if (mod && mod.__esModule)
2927
+ return mod;
2928
+ var result = {};
2929
+ if (mod != null) {
2930
+ for (var k = ownKeys(mod), i = 0;i < k.length; i++)
2931
+ if (k[i] !== "default")
2932
+ __createBinding(result, mod, k[i]);
2933
+ }
2934
+ __setModuleDefault(result, mod);
2935
+ return result;
2936
+ };
2937
+ }();
2938
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
2939
+ function adopt(value) {
2940
+ return value instanceof P ? value : new P(function(resolve) {
2941
+ resolve(value);
2942
+ });
2943
+ }
2944
+ return new (P || (P = Promise))(function(resolve, reject) {
2945
+ function fulfilled(value) {
2946
+ try {
2947
+ step(generator.next(value));
2948
+ } catch (e) {
2949
+ reject(e);
2950
+ }
2951
+ }
2952
+ function rejected(value) {
2953
+ try {
2954
+ step(generator["throw"](value));
2955
+ } catch (e) {
2956
+ reject(e);
2957
+ }
2958
+ }
2959
+ function step(result) {
2960
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2961
+ }
2962
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2963
+ });
2964
+ };
2965
+ Object.defineProperty(exports, "__esModule", { value: true });
2966
+ exports.SharedLibCore = undefined;
2967
+ var fs = __importStar(__require("fs"));
2968
+ var os = __importStar(__require("os"));
2969
+ var path = __importStar(__require("path"));
2970
+ var errors_1 = require_errors();
2971
+ var find1PasswordLibPath = () => {
2972
+ const platform = os.platform();
2973
+ const appRoot = path.dirname(process.execPath);
2974
+ let searchPaths = [];
2975
+ switch (platform) {
2976
+ case "darwin":
2977
+ searchPaths = [
2978
+ "/Applications/1Password.app/Contents/Frameworks/libop_sdk_ipc_client.dylib",
2979
+ path.join(os.homedir(), "/Applications/1Password.app/Contents/Frameworks/libop_sdk_ipc_client.dylib")
2980
+ ];
2981
+ break;
2982
+ case "linux":
2983
+ searchPaths = [
2984
+ "/usr/bin/1password/libop_sdk_ipc_client.so",
2985
+ "/opt/1Password/libop_sdk_ipc_client.so",
2986
+ "/snap/bin/1password/libop_sdk_ipc_client.so"
2987
+ ];
2988
+ break;
2989
+ case "win32":
2990
+ searchPaths = [
2991
+ path.join(os.homedir(), "/AppData/Local/1Password/op_sdk_ipc_client.dll"),
2992
+ "C:/Program Files/1Password/app/8/op_sdk_ipc_client.dll",
2993
+ "C:/Program Files (x86)/1Password/app/8/op_sdk_ipc_client.dll",
2994
+ path.join(os.homedir(), "/AppData/Local/1Password/app/8/op_sdk_ipc_client.dll")
2995
+ ];
2996
+ break;
2997
+ default:
2998
+ throw new Error(`Unsupported platform: ${platform}`);
2999
+ }
3000
+ for (const addonPath of searchPaths) {
3001
+ if (fs.existsSync(addonPath)) {
3002
+ return addonPath;
3003
+ }
3004
+ }
3005
+ throw new Error("1Password desktop application not found");
3006
+ };
3007
+
3008
+ class SharedLibCore {
3009
+ constructor(accountName) {
3010
+ this.lib = null;
3011
+ try {
3012
+ const libPath = find1PasswordLibPath();
3013
+ const moduleStub = { exports: {} };
3014
+ process.dlopen(moduleStub, libPath);
3015
+ if (typeof moduleStub === "object" && moduleStub !== null && typeof moduleStub.exports === "object" && moduleStub.exports !== null && "sendMessage" in moduleStub.exports && typeof moduleStub.exports.sendMessage === "function") {
3016
+ this.lib = moduleStub.exports;
3017
+ } else {
3018
+ throw new Error("Failed to initialize native library: sendMessage function not found on module.");
3019
+ }
3020
+ } catch (e) {
3021
+ console.error("A critical error occurred while loading the native addon:", e);
3022
+ this.lib = null;
3023
+ }
3024
+ this.acccountName = accountName;
3025
+ }
3026
+ callSharedLibrary(input, operation_type) {
3027
+ return __awaiter(this, undefined, undefined, function* () {
3028
+ if (!this.lib) {
3029
+ throw new Error("Native library is not available.");
3030
+ }
3031
+ if (!input || input.length === 0) {
3032
+ throw new Error("internal: empty input");
3033
+ }
3034
+ const inputEncoded = Buffer.from(input, "utf8").toString("base64");
3035
+ const req = {
3036
+ account_name: this.acccountName,
3037
+ kind: operation_type,
3038
+ payload: inputEncoded
3039
+ };
3040
+ const inputBuf = Buffer.from(JSON.stringify(req), "utf8");
3041
+ const nativeResponse = yield this.lib.sendMessage(inputBuf);
3042
+ if (!(nativeResponse instanceof Uint8Array)) {
3043
+ throw new Error(`Native function returned an unexpected type. Expected Uint8Array, got ${typeof nativeResponse}`);
3044
+ }
3045
+ const respString = new TextDecoder().decode(nativeResponse);
3046
+ const response = JSON.parse(respString);
3047
+ if (response.success) {
3048
+ const decodedPayload = Buffer.from(response.payload).toString("utf8");
3049
+ return decodedPayload;
3050
+ } else {
3051
+ const errorMessage = Array.isArray(response.payload) ? String.fromCharCode(...response.payload) : JSON.stringify(response.payload);
3052
+ (0, errors_1.throwError)(errorMessage);
3053
+ }
3054
+ });
3055
+ }
3056
+ initClient(config) {
3057
+ return __awaiter(this, undefined, undefined, function* () {
3058
+ return this.callSharedLibrary(config, "init_client");
3059
+ });
3060
+ }
3061
+ invoke(invokeConfigBytes) {
3062
+ return __awaiter(this, undefined, undefined, function* () {
3063
+ return this.callSharedLibrary(invokeConfigBytes, "invoke");
3064
+ });
3065
+ }
3066
+ releaseClient(clientId) {
3067
+ this.callSharedLibrary(clientId, "release_client").catch((err) => {
3068
+ console.warn("failed to release client:", err);
3069
+ });
3070
+ }
3071
+ }
3072
+ exports.SharedLibCore = SharedLibCore;
3073
+ });
3074
+
3075
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/client_builder.js
3076
+ var require_client_builder = __commonJS((exports) => {
3077
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
3078
+ function adopt(value) {
3079
+ return value instanceof P ? value : new P(function(resolve) {
3080
+ resolve(value);
3081
+ });
3082
+ }
3083
+ return new (P || (P = Promise))(function(resolve, reject) {
3084
+ function fulfilled(value) {
3085
+ try {
3086
+ step(generator.next(value));
3087
+ } catch (e) {
3088
+ reject(e);
3089
+ }
3090
+ }
3091
+ function rejected(value) {
3092
+ try {
3093
+ step(generator["throw"](value));
3094
+ } catch (e) {
3095
+ reject(e);
3096
+ }
3097
+ }
3098
+ function step(result) {
3099
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
3100
+ }
3101
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
3102
+ });
3103
+ };
3104
+ Object.defineProperty(exports, "__esModule", { value: true });
3105
+ exports.createClientWithCore = undefined;
3106
+ var core_js_1 = require_core2();
3107
+ var configuration_js_1 = require_configuration();
3108
+ var client_js_1 = require_client();
3109
+ var shared_lib_core_js_1 = require_shared_lib_core();
3110
+ var finalizationRegistry = new FinalizationRegistry((heldClient) => {
3111
+ heldClient.core.releaseClient(heldClient.id);
3112
+ });
3113
+ var createClientWithCore = (config, core) => __awaiter(undefined, undefined, undefined, function* () {
3114
+ const authConfig = (0, configuration_js_1.clientAuthConfig)(config);
3115
+ if (authConfig.accountName) {
3116
+ core.setInner(new shared_lib_core_js_1.SharedLibCore(authConfig.accountName));
3117
+ }
3118
+ const clientId = yield core.initClient(authConfig);
3119
+ const inner = new core_js_1.InnerClient(parseInt(clientId, 10), core, authConfig);
3120
+ const client = new client_js_1.Client(inner);
3121
+ finalizationRegistry.register(client, inner);
3122
+ return client;
3123
+ });
3124
+ exports.createClientWithCore = createClientWithCore;
3125
+ });
3126
+
3127
+ // ../../node_modules/.bun/@1password+sdk@0.4.1-beta.1/node_modules/@1password/sdk/dist/sdk.js
3128
+ var require_sdk = __commonJS((exports) => {
3129
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
3130
+ if (k2 === undefined)
3131
+ k2 = k;
3132
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3133
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3134
+ desc = { enumerable: true, get: function() {
3135
+ return m[k];
3136
+ } };
3137
+ }
3138
+ Object.defineProperty(o, k2, desc);
3139
+ } : function(o, m, k, k2) {
3140
+ if (k2 === undefined)
3141
+ k2 = k;
3142
+ o[k2] = m[k];
3143
+ });
3144
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
3145
+ for (var p in m)
3146
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
3147
+ __createBinding(exports2, m, p);
3148
+ };
3149
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
3150
+ function adopt(value) {
3151
+ return value instanceof P ? value : new P(function(resolve) {
3152
+ resolve(value);
3153
+ });
3154
+ }
3155
+ return new (P || (P = Promise))(function(resolve, reject) {
3156
+ function fulfilled(value) {
3157
+ try {
3158
+ step(generator.next(value));
3159
+ } catch (e) {
3160
+ reject(e);
3161
+ }
3162
+ }
3163
+ function rejected(value) {
3164
+ try {
3165
+ step(generator["throw"](value));
3166
+ } catch (e) {
3167
+ reject(e);
3168
+ }
3169
+ }
3170
+ function step(result) {
3171
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
3172
+ }
3173
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
3174
+ });
3175
+ };
3176
+ Object.defineProperty(exports, "__esModule", { value: true });
3177
+ exports.createClient = exports.DesktopAuth = exports.Secrets = exports.DEFAULT_INTEGRATION_VERSION = exports.DEFAULT_INTEGRATION_NAME = undefined;
3178
+ var core_js_1 = require_core2();
3179
+ var client_builder_js_1 = require_client_builder();
3180
+ exports.DEFAULT_INTEGRATION_NAME = "Unknown";
3181
+ exports.DEFAULT_INTEGRATION_VERSION = "Unknown";
3182
+ var secrets_js_1 = require_secrets();
3183
+ Object.defineProperty(exports, "Secrets", { enumerable: true, get: function() {
3184
+ return secrets_js_1.Secrets;
3185
+ } });
3186
+ var configuration_js_1 = require_configuration();
3187
+ Object.defineProperty(exports, "DesktopAuth", { enumerable: true, get: function() {
3188
+ return configuration_js_1.DesktopAuth;
3189
+ } });
3190
+ __exportStar(require_client(), exports);
3191
+ __exportStar(require_errors(), exports);
3192
+ __exportStar(require_types(), exports);
3193
+ var createClient = (config) => __awaiter(undefined, undefined, undefined, function* () {
3194
+ return (0, client_builder_js_1.createClientWithCore)(config, new core_js_1.SharedCore);
3195
+ });
3196
+ exports.createClient = createClient;
3197
+ });
3198
+
3199
+ // src/providers/onepassword.ts
3200
+ var exports_onepassword = {};
3201
+ __export(exports_onepassword, {
3202
+ resolveSecrets: () => resolveSecrets,
3203
+ resolveSdkAuth: () => resolveSdkAuth,
3204
+ resolveGlobImport: () => resolveGlobImport,
3205
+ resolveDesktopAccount: () => resolveDesktopAccount,
3206
+ readEnvironment: () => readEnvironment,
3207
+ parseOpFlag: () => parseOpFlag,
3208
+ parseGlobImport: () => parseGlobImport,
3209
+ maskSecret: () => maskSecret,
3210
+ isOpReference: () => isOpReference,
3211
+ isGlobImport: () => isGlobImport,
3212
+ globToRegExp: () => globToRegExp,
3213
+ filterGlobFields: () => filterGlobFields,
3214
+ envNameFromOpRef: () => envNameFromOpRef,
3215
+ discoverItemFields: () => discoverItemFields,
3216
+ detectSdkAuth: () => detectSdkAuth,
3217
+ defaultSdkClientFactory: () => defaultSdkClientFactory,
3218
+ defaultOpAccountLister: () => defaultOpAccountLister,
3219
+ collectConfigImports: () => collectConfigImports,
3220
+ buildAuthError: () => buildAuthError,
3221
+ acquireSdkClient: () => acquireSdkClient,
3222
+ OP_REF_RE: () => OP_REF_RE
3223
+ });
3224
+ import { spawnSync } from "child_process";
3225
+ function isOpReference(v) {
3226
+ return typeof v === "string" && OP_REF_RE.test(v);
3227
+ }
3228
+ function buildAuthError(detail) {
3229
+ return new Error(`${detail}
3230
+ ` + "Set OP_SERVICE_ACCOUNT_TOKEN (service account, headless) or OP_ACCOUNT " + "(your 1Password account URL, e.g. my-team.1password.com) for the desktop " + "app \u2014 or set `onepasswordAccount` in ~/.claudish/config.json.");
3231
+ }
3232
+ function maskSecret(v) {
3233
+ if (!v)
3234
+ return "";
3235
+ return `${v.slice(0, 4)}\u2026`;
3236
+ }
3237
+ function isGlobImport(opPath) {
3238
+ if (typeof opPath !== "string" || !opPath.startsWith("op://"))
3239
+ return false;
3240
+ const rest = opPath.slice("op://".length).split("/");
3241
+ if (rest.length < 3)
3242
+ return false;
3243
+ const post = rest.slice(2);
3244
+ if (post.length < 1 || post.length > 2)
3245
+ return false;
3246
+ return post.some((seg) => seg.includes("*"));
3247
+ }
3248
+ function parseGlobImport(opPath) {
3249
+ const rest = opPath.slice("op://".length).split("/");
3250
+ const [vault, item, ...post] = rest;
3251
+ if (post.length === 1) {
3252
+ return { vault, item, sectionGlob: null, fieldGlob: post[0] };
3253
+ }
3254
+ return { vault, item, sectionGlob: post[0], fieldGlob: post[1] };
3255
+ }
3256
+ function globToRegExp(glob) {
3257
+ let out = "";
3258
+ for (const ch of glob) {
3259
+ if (ch === "*") {
3260
+ out += ".*";
3261
+ } else if (/[.+?^${}()|[\]\\]/.test(ch)) {
3262
+ out += `\\${ch}`;
3263
+ } else {
3264
+ out += ch;
3265
+ }
3266
+ }
3267
+ return new RegExp(`^${out}$`);
3268
+ }
3269
+ async function discoverItemFields(vault, item, opts = {}) {
3270
+ const warn = opts.warn ?? ((m) => console.error(m));
3271
+ const client = await acquireSdkClient(opts, `1Password item discovery for '${item}'`);
3272
+ const vaults = await client.vaults.list();
3273
+ const vaultMatches = vaults.filter((v) => v.title === vault);
3274
+ if (vaultMatches.length === 0) {
3275
+ throw new Error(`1Password vault '${vault}' not found. ` + `Available vaults: ${vaults.map((v) => v.title).join(", ") || "(none)"}.`);
3276
+ }
3277
+ if (vaultMatches.length > 1) {
3278
+ warn(`[claudish] multiple 1Password vaults titled '${vault}'; using the first ` + `(id ${vaultMatches[0].id}).`);
3279
+ }
3280
+ const vaultId = vaultMatches[0].id;
3281
+ const items = await client.items.list(vaultId);
3282
+ const itemMatches = items.filter((i) => i.title === item);
3283
+ if (itemMatches.length === 0) {
3284
+ throw new Error(`1Password item '${item}' not found in vault '${vault}'. ` + `Available items: ${items.map((i) => i.title).slice(0, 12).join(", ") || "(none)"}.`);
3285
+ }
3286
+ if (itemMatches.length > 1) {
3287
+ warn(`[claudish] multiple 1Password items titled '${item}' in vault '${vault}'; ` + `using the first (id ${itemMatches[0].id}).`);
3288
+ }
3289
+ const itemId = itemMatches[0].id;
3290
+ const full = await client.items.get(vaultId, itemId);
3291
+ const out = [];
3292
+ for (const field of full.fields) {
3293
+ if (typeof field.title !== "string")
3294
+ continue;
3295
+ const section = sectionLabel(full, field.sectionId);
3296
+ const reference = `op://${vault}/${item}/${section ? `${section}/` : ""}${field.title}`;
3297
+ out.push({
3298
+ label: field.title,
3299
+ section,
3300
+ reference,
3301
+ type: typeof field.fieldType === "string" ? field.fieldType : String(field.fieldType ?? ""),
3302
+ hasValue: !!field.value
3303
+ });
3304
+ }
3305
+ return out;
3306
+ }
3307
+ function sectionLabel(item, sectionId) {
3308
+ if (!sectionId)
3309
+ return null;
3310
+ const match = item.sections.find((s) => s.id === sectionId);
3311
+ return match ? match.title : null;
3312
+ }
3313
+ function filterGlobFields(fields, glob) {
3314
+ const sectionRegex = glob.sectionGlob === null ? null : globToRegExp(glob.sectionGlob);
3315
+ const fieldRegex = globToRegExp(glob.fieldGlob);
3316
+ const matches = [];
3317
+ for (const field of fields) {
3318
+ if (glob.sectionGlob === null) {
3319
+ if (field.section !== null)
3320
+ continue;
3321
+ } else {
3322
+ if (field.section === null)
3323
+ continue;
3324
+ if (!sectionRegex.test(field.section))
3325
+ continue;
3326
+ }
3327
+ const envName = field.label.trim();
3328
+ if (!fieldRegex.test(envName))
3329
+ continue;
3330
+ matches.push({ field, envName, valid: ENV_VAR_NAME_RE.test(envName) });
3331
+ }
3332
+ return matches;
3333
+ }
3334
+ async function resolveGlobImport(opPath, opts = {}) {
3335
+ const warn = opts.warn ?? ((m) => console.error(m));
3336
+ const glob = parseGlobImport(opPath);
3337
+ const fields = await discoverItemFields(glob.vault, glob.item, {
3338
+ sdkFactory: opts.sdkFactory,
3339
+ auth: opts.auth,
3340
+ env: opts.env,
3341
+ warn
3342
+ });
3343
+ const matches = filterGlobFields(fields, glob);
3344
+ const refMap = {};
3345
+ for (const m of matches) {
3346
+ if (!m.valid) {
3347
+ warn(`[claudish] skipped 1Password field '${m.field.label}' (not a valid env var name)`);
3348
+ continue;
3349
+ }
3350
+ refMap[m.envName] = m.field.reference;
3351
+ }
3352
+ if (Object.keys(refMap).length === 0) {
3353
+ const available = fields.map((f) => f.label.trim()).filter((l) => l !== "").slice(0, 8);
3354
+ throw new Error(`1Password glob '${opPath}' matched no importable fields in '${glob.item}'. ` + `Available field labels include: ${available.join(", ") || "(none)"}.`);
3355
+ }
3356
+ return resolveSecrets(refMap, {
3357
+ sdkFactory: opts.sdkFactory,
3358
+ auth: opts.auth,
3359
+ env: opts.env
3360
+ });
3361
+ }
3362
+ function envNameFromOpRef(opRef) {
3363
+ if (typeof opRef !== "string" || !opRef.startsWith("op://"))
3364
+ return null;
3365
+ const segments = opRef.slice("op://".length).split("/");
3366
+ const last = segments[segments.length - 1] ?? "";
3367
+ const name = last.trim();
3368
+ if (name === "" || !ENV_VAR_NAME_RE.test(name))
3369
+ return null;
3370
+ return name;
3371
+ }
3372
+ function collectConfigImports(cfg, env = process.env) {
3373
+ const opRefs = {};
3374
+ const globImports = [];
3375
+ const warnings = [];
3376
+ collectApiKeyRefs(cfg.apiKeys, env, opRefs);
3377
+ if (Array.isArray(cfg.onepassword)) {
3378
+ for (const entry of cfg.onepassword) {
3379
+ collectOnepasswordEntry(entry, env, opRefs, globImports, warnings);
3380
+ }
3381
+ }
3382
+ return { opRefs, globImports, warnings };
3383
+ }
3384
+ function collectApiKeyRefs(apiKeys, env, opRefs) {
3385
+ if (!apiKeys)
3386
+ return;
3387
+ for (const [envVar, value] of Object.entries(apiKeys)) {
3388
+ if (typeof value !== "string")
3389
+ continue;
3390
+ const current = env[envVar] ?? value;
3391
+ if (isOpReference(current)) {
3392
+ opRefs[envVar] = current;
3393
+ }
3394
+ }
3395
+ }
3396
+ function collectOnepasswordEntry(entry, env, opRefs, globImports, warnings) {
3397
+ if (typeof entry !== "string")
3398
+ return;
3399
+ const trimmed = entry.trim();
3400
+ if (trimmed === "")
3401
+ return;
3402
+ if (isGlobImport(trimmed)) {
3403
+ globImports.push(trimmed);
3404
+ return;
3405
+ }
3406
+ if (trimmed.startsWith("op://")) {
3407
+ const name = envNameFromOpRef(trimmed);
3408
+ if (name === null) {
3409
+ warnings.push(`[claudish] skipped 1Password ref '${trimmed}' from onepassword[] ` + "(its trailing field label is not a valid env var name)");
3410
+ return;
3411
+ }
3412
+ if (!env[name]) {
3413
+ opRefs[name] = trimmed;
3414
+ }
3415
+ return;
3416
+ }
3417
+ warnings.push(`[claudish] skipped 1Password entry '${trimmed}' from onepassword[] ` + "(not a glob import or op:// reference)");
3418
+ }
3419
+ function parseOpFlag(argv) {
3420
+ let glob;
3421
+ let present = false;
3422
+ for (let i = 0;i < argv.length; i++) {
3423
+ const a = argv[i];
3424
+ if (a === "--op") {
3425
+ present = true;
3426
+ const next = argv[i + 1];
3427
+ if (next !== undefined && next !== "" && !next.startsWith("-")) {
3428
+ glob = next;
3429
+ }
3430
+ break;
3431
+ }
3432
+ if (a.startsWith("--op=")) {
3433
+ present = true;
3434
+ const v = a.slice("--op=".length);
3435
+ if (v !== "")
3436
+ glob = v;
3437
+ break;
3438
+ }
3439
+ }
3440
+ const list = argv.includes("--list");
3441
+ return { glob, list, present };
3442
+ }
3443
+ function detectSdkAuth(env = process.env) {
3444
+ const token = env.OP_SERVICE_ACCOUNT_TOKEN?.trim();
3445
+ if (token)
3446
+ return { kind: "token", token };
3447
+ const account = env.OP_ACCOUNT?.trim();
3448
+ if (account)
3449
+ return { kind: "desktop", accountName: account };
3450
+ return;
3451
+ }
3452
+ function resolveDesktopAccount(opts = {}) {
3453
+ const env = opts.env ?? process.env;
3454
+ const envAccount = env.OP_ACCOUNT?.trim();
3455
+ if (envAccount)
3456
+ return { accountName: envAccount };
3457
+ const configAccount = opts.configAccount?.trim();
3458
+ if (configAccount)
3459
+ return { accountName: configAccount };
3460
+ const lister = opts.opAccountLister ?? defaultOpAccountLister;
3461
+ const accounts = lister();
3462
+ const remediation = "Set OP_ACCOUNT to your account URL (e.g. my-team.1password.com) or `onepasswordAccount` in ~/.claudish/config.json.";
3463
+ if (!accounts || accounts.length === 0) {
3464
+ return {
3465
+ error: `Could not determine which 1Password account to use (no service-account token, and \`op account list\` is unavailable). ${remediation}`
3466
+ };
3467
+ }
3468
+ if (accounts.length === 1) {
3469
+ return { accountName: accounts[0].url };
3470
+ }
3471
+ if (opts.interactive) {
3472
+ return { needsPicker: accounts };
3473
+ }
3474
+ const listing = accounts.map((a) => ` - ${a.url}${a.email ? ` (${a.email})` : ""}`).join(`
3475
+ `);
3476
+ return {
3477
+ error: `Multiple 1Password accounts are available and this is a non-interactive session, so claudish can't prompt you to pick one. ${remediation}
3478
+ Accounts:
3479
+ ${listing}`
3480
+ };
3481
+ }
3482
+ async function resolveSdkAuth(opts = {}) {
3483
+ const env = opts.env ?? process.env;
3484
+ const token = env.OP_SERVICE_ACCOUNT_TOKEN?.trim();
3485
+ if (token)
3486
+ return { kind: "token", token };
3487
+ const result = resolveDesktopAccount({
3488
+ env,
3489
+ configAccount: opts.configAccount,
3490
+ interactive: opts.interactive,
3491
+ opAccountLister: opts.opAccountLister
3492
+ });
3493
+ if ("accountName" in result) {
3494
+ return { kind: "desktop", accountName: result.accountName };
3495
+ }
3496
+ if ("needsPicker" in result) {
3497
+ if (opts.onNeedsPicker) {
3498
+ const chosen = await opts.onNeedsPicker(result.needsPicker);
3499
+ if (chosen && chosen.trim()) {
3500
+ return { kind: "desktop", accountName: chosen.trim() };
3501
+ }
3502
+ }
3503
+ const listing = result.needsPicker.map((a) => ` - ${a.url}${a.email ? ` (${a.email})` : ""}`).join(`
3504
+ `);
3505
+ throw buildAuthError(`Multiple 1Password accounts are available but none was selected.
3506
+ Accounts:
3507
+ ${listing}`);
3508
+ }
3509
+ throw buildAuthError(result.error);
3510
+ }
3511
+ async function acquireSdkClient(opts, context) {
3512
+ const auth = opts.auth ?? detectSdkAuth(opts.env ?? process.env);
3513
+ if (!auth) {
3514
+ throw buildAuthError(`1Password SDK auth is required for ${context}, but neither OP_SERVICE_ACCOUNT_TOKEN nor a 1Password account (OP_ACCOUNT / onepasswordAccount config) is available.`);
3515
+ }
3516
+ const sdkFactory = opts.sdkFactory ?? defaultSdkClientFactory;
3517
+ return sdkFactory(auth);
3518
+ }
3519
+ function mapSdkResolveAll(refs, response) {
3520
+ const responses = response.individualResponses ?? {};
3521
+ const out = {};
3522
+ const failures = [];
3523
+ for (const [envVar, ref] of Object.entries(refs)) {
3524
+ const entry = responses[ref];
3525
+ if (entry?.content && typeof entry.content.secret === "string") {
3526
+ out[envVar] = entry.content.secret;
3527
+ continue;
3528
+ }
3529
+ if (entry?.error !== undefined) {
3530
+ failures.push(`${envVar} (${ref}): ${describeSdkError(entry.error)}`);
3531
+ continue;
3532
+ }
3533
+ failures.push(`${envVar} (${ref}): no value returned`);
3534
+ }
3535
+ if (failures.length > 0) {
3536
+ throw new Error(`1Password SDK could not resolve secret reference(s):
3537
+ ${failures.join(`
3538
+ `)}`);
3539
+ }
3540
+ return out;
3541
+ }
3542
+ function describeSdkError(error) {
3543
+ if (error && typeof error === "object") {
3544
+ const e = error;
3545
+ const type = typeof e.type === "string" ? e.type : undefined;
3546
+ const message = typeof e.message === "string" ? e.message : undefined;
3547
+ if (type && message)
3548
+ return `${type}: ${message}`;
3549
+ if (type)
3550
+ return type;
3551
+ if (message)
3552
+ return message;
3553
+ }
3554
+ return String(error);
3555
+ }
3556
+ async function resolveSecrets(refs, opts = {}) {
3557
+ const keys = Object.keys(refs);
3558
+ if (keys.length === 0)
3559
+ return {};
3560
+ const client = await acquireSdkClient(opts, "resolving 1Password secret reference(s)");
3561
+ const response = await client.secrets.resolveAll(keys.map((k) => refs[k]));
3562
+ return mapSdkResolveAll(refs, response);
3563
+ }
3564
+ async function readEnvironment(environmentId, opts = {}) {
3565
+ const id = (environmentId ?? "").trim();
3566
+ if (id === "") {
3567
+ throw new Error("1Password Environment ID is empty. Usage: --op-env <environmentID>");
3568
+ }
3569
+ const client = await acquireSdkClient(opts, `1Password Environment '${id}'`);
3570
+ if (!client.environments || typeof client.environments.getVariables !== "function") {
3571
+ throw new Error("1Password Environments require @1password/sdk 0.4.1-beta.1 or later (the stable 0.4.0 has no environments API). Install: `bun add @1password/sdk@0.4.1-beta.1`.");
3572
+ }
3573
+ const { variables } = await client.environments.getVariables(id);
3574
+ if (!Array.isArray(variables) || variables.length === 0) {
3575
+ throw new Error(`1Password Environment '${id}' resolved to no variables. Check that the Environment ID is correct and contains entries.`);
3576
+ }
3577
+ const out = {};
3578
+ for (const v of variables) {
3579
+ if (v && typeof v.name === "string")
3580
+ out[v.name] = typeof v.value === "string" ? v.value : "";
3581
+ }
3582
+ return out;
3583
+ }
3584
+ var OP_REF_RE, ENV_VAR_NAME_RE, defaultSdkClientFactory = async (auth) => {
3585
+ const { createClient, DesktopAuth } = await Promise.resolve().then(() => __toESM(require_sdk(), 1));
3586
+ const client = await createClient({
3587
+ auth: auth.kind === "token" ? auth.token : new DesktopAuth(auth.accountName),
3588
+ integrationName: "claudish",
3589
+ integrationVersion: VERSION || "1.0.0"
3590
+ });
3591
+ return client;
3592
+ }, defaultOpAccountLister = () => {
3593
+ try {
3594
+ const res = spawnSync("op", ["account", "list", "--format=json"], { encoding: "utf-8" });
3595
+ if (res.error || res.status !== 0)
3596
+ return null;
3597
+ const parsed = JSON.parse(res.stdout ?? "");
3598
+ if (!Array.isArray(parsed))
3599
+ return null;
3600
+ const accounts = [];
3601
+ for (const raw of parsed) {
3602
+ if (!raw || typeof raw !== "object")
3603
+ continue;
3604
+ const a = raw;
3605
+ if (typeof a.url !== "string")
3606
+ continue;
3607
+ accounts.push({
3608
+ url: a.url,
3609
+ email: typeof a.email === "string" ? a.email : "",
3610
+ account_uuid: typeof a.account_uuid === "string" ? a.account_uuid : "",
3611
+ user_id: typeof a.user_id === "string" ? a.user_id : ""
3612
+ });
3613
+ }
3614
+ return accounts;
3615
+ } catch {
3616
+ return null;
3617
+ }
3618
+ };
3619
+ var init_onepassword = __esm(() => {
3620
+ OP_REF_RE = /^op:\/\/[^\s]+$/;
3621
+ ENV_VAR_NAME_RE = /^[A-Z_][A-Z0-9_]*$/;
3622
+ });
3623
+
3624
+ // src/onepassword-command.ts
3625
+ var exports_onepassword_command = {};
3626
+ __export(exports_onepassword_command, {
3627
+ opPreviewCommand: () => opPreviewCommand
3628
+ });
3629
+ async function opPreviewCommand(globPath, opts = {}) {
3630
+ const path = (globPath ?? "").trim();
3631
+ if (path === "") {
3632
+ console.error("[claudish] `--op ... --list` requires an op:// path.\n");
3633
+ console.error(USAGE);
3634
+ process.exit(1);
3635
+ }
3636
+ if (!path.startsWith("op://")) {
3637
+ console.error(`[claudish] '${path}' is not an op:// path.
3638
+ `);
3639
+ console.error(USAGE);
3640
+ process.exit(1);
3641
+ }
3642
+ if (!isGlobImport(path)) {
3643
+ console.error(`[claudish] '${path}' is not a glob import (no '*' in the field/section ` + "segment). This command previews glob imports; a single op:// reference " + `resolves directly when used as a config value.
3644
+ `);
3645
+ console.error(USAGE);
3646
+ process.exit(1);
3647
+ }
3648
+ const glob = parseGlobImport(path);
3649
+ let fields;
3650
+ try {
3651
+ fields = await discoverItemFields(glob.vault, glob.item, { auth: opts.auth });
3652
+ } catch (err) {
3653
+ const message = err instanceof Error ? err.message : String(err);
3654
+ console.error(`[claudish] 1Password discovery failed: ${message}`);
3655
+ process.exit(1);
3656
+ }
3657
+ const matches = filterGlobFields(fields, glob);
3658
+ console.log(`Preview: ${path}`);
3659
+ if (matches.length === 0) {
3660
+ console.log(" (no fields match this glob)");
3661
+ const available = fields.map((f) => f.label.trim()).filter((l) => l !== "").slice(0, 8);
3662
+ console.log(` Available field labels include: ${available.join(", ") || "(none)"}`);
3663
+ console.log("0 importable, 0 skipped");
3664
+ return;
3665
+ }
3666
+ const NAME_COL = Math.min(30, Math.max(...matches.map((m) => m.envName.length), 0));
3667
+ let importable = 0;
3668
+ let skipped = 0;
3669
+ for (const m of matches) {
3670
+ const name = m.envName.padEnd(NAME_COL);
3671
+ if (!m.valid) {
3672
+ skipped++;
3673
+ console.log(` ${name} \u2717 skipped (not a valid env var name)`);
3674
+ continue;
3675
+ }
3676
+ importable++;
3677
+ const trimmed = m.field.label !== m.envName;
3678
+ const detail = trimmed ? `(trimmed from '${m.field.label}')` : m.field.section ? `(section: ${m.field.section})` : "(top-level field)";
3679
+ console.log(` ${name} \u2713 ${detail}`);
3680
+ }
3681
+ console.log(`${importable} importable, ${skipped} skipped`);
3682
+ }
3683
+ var USAGE;
3684
+ var init_onepassword_command = __esm(() => {
3685
+ init_onepassword();
3686
+ USAGE = `Usage:
3687
+ ` + ` claudish --op <op://vault/item/[section]/field-glob>
3688
+ ` + ` Load API keys from a 1Password item glob, then run normally.
3689
+ ` + ` claudish --op <op://vault/item/[section]/field-glob> --list
3690
+ ` + ` Preview which fields the glob would import (names only, no values).
3691
+ ` + ` Examples:
3692
+ ` + ` claudish --op 'op://Jack/My Item/*/*_API_KEY' --list
3693
+ ` + " claudish --op 'op://Jack/My Item/*/*_API_KEY' --model gpt-4o 'task'";
3694
+ });
3695
+
463
3696
  // ../../node_modules/.bun/zod@4.1.13/node_modules/zod/v4/core/core.js
464
3697
  function $constructor(name, initializer, params) {
465
3698
  function init(inst, def) {
@@ -1329,7 +4562,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
1329
4562
  throw e;
1330
4563
  }
1331
4564
  return result.value;
1332
- }, parse, _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
4565
+ }, parse2, _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
1333
4566
  const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
1334
4567
  let result = schema._zod.run({ value, issues: [] }, ctx);
1335
4568
  if (result instanceof Promise)
@@ -1384,7 +4617,7 @@ var init_parse = __esm(() => {
1384
4617
  init_core();
1385
4618
  init_errors();
1386
4619
  init_util();
1387
- parse = /* @__PURE__ */ _parse($ZodRealError);
4620
+ parse2 = /* @__PURE__ */ _parse($ZodRealError);
1388
4621
  parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
1389
4622
  safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
1390
4623
  safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
@@ -3891,10 +7124,10 @@ var init_schemas = __esm(() => {
3891
7124
  throw new Error("implement() must be called with a function");
3892
7125
  }
3893
7126
  return function(...args) {
3894
- const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
7127
+ const parsedArgs = inst._def.input ? parse2(inst._def.input, args) : args;
3895
7128
  const result = Reflect.apply(func, this, parsedArgs);
3896
7129
  if (inst._def.output) {
3897
- return parse(inst._def.output, result);
7130
+ return parse2(inst._def.output, result);
3898
7131
  }
3899
7132
  return result;
3900
7133
  };
@@ -11686,7 +14919,7 @@ __export(exports_core2, {
11686
14919
  regexes: () => exports_regexes,
11687
14920
  prettifyError: () => prettifyError,
11688
14921
  parseAsync: () => parseAsync,
11689
- parse: () => parse,
14922
+ parse: () => parse2,
11690
14923
  meta: () => meta,
11691
14924
  locales: () => exports_locales,
11692
14925
  isValidJWT: () => isValidJWT,
@@ -12148,11 +15381,11 @@ var init_errors2 = __esm(() => {
12148
15381
  });
12149
15382
 
12150
15383
  // ../../node_modules/.bun/zod@4.1.13/node_modules/zod/v4/classic/parse.js
12151
- var parse4, parseAsync2, safeParse3, safeParseAsync2, encode2, decode2, encodeAsync2, decodeAsync2, safeEncode2, safeDecode2, safeEncodeAsync2, safeDecodeAsync2;
15384
+ var parse5, parseAsync2, safeParse3, safeParseAsync2, encode2, decode2, encodeAsync2, decodeAsync2, safeEncode2, safeDecode2, safeEncodeAsync2, safeDecodeAsync2;
12152
15385
  var init_parse3 = __esm(() => {
12153
15386
  init_core2();
12154
15387
  init_errors2();
12155
- parse4 = /* @__PURE__ */ _parse(ZodRealError);
15388
+ parse5 = /* @__PURE__ */ _parse(ZodRealError);
12156
15389
  parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
12157
15390
  safeParse3 = /* @__PURE__ */ _safeParse(ZodRealError);
12158
15391
  safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
@@ -12617,7 +15850,7 @@ var init_schemas3 = __esm(() => {
12617
15850
  reg.add(inst, meta2);
12618
15851
  return inst;
12619
15852
  };
12620
- inst.parse = (data, params) => parse4(inst, data, params, { callee: inst.parse });
15853
+ inst.parse = (data, params) => parse5(inst, data, params, { callee: inst.parse });
12621
15854
  inst.safeParse = (data, params) => safeParse3(inst, data, params);
12622
15855
  inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
12623
15856
  inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
@@ -13267,7 +16500,7 @@ __export(exports_external, {
13267
16500
  pipe: () => pipe,
13268
16501
  partialRecord: () => partialRecord,
13269
16502
  parseAsync: () => parseAsync2,
13270
- parse: () => parse4,
16503
+ parse: () => parse5,
13271
16504
  overwrite: () => _overwrite,
13272
16505
  optional: () => optional,
13273
16506
  object: () => object2,
@@ -16409,12 +19642,12 @@ var require_util = __commonJS((exports) => {
16409
19642
  }
16410
19643
  exports.alwaysValidSchema = alwaysValidSchema;
16411
19644
  function checkUnknownRules(it, schema = it.schema) {
16412
- const { opts, self } = it;
19645
+ const { opts, self: self2 } = it;
16413
19646
  if (!opts.strictSchema)
16414
19647
  return;
16415
19648
  if (typeof schema === "boolean")
16416
19649
  return;
16417
- const rules = self.RULES.keywords;
19650
+ const rules = self2.RULES.keywords;
16418
19651
  for (const key in schema) {
16419
19652
  if (!rules[key])
16420
19653
  checkStrictMode(it, `unknown keyword: "${key}"`);
@@ -16576,7 +19809,7 @@ var require_names = __commonJS((exports) => {
16576
19809
  });
16577
19810
 
16578
19811
  // ../../node_modules/.bun/ajv@8.17.1/node_modules/ajv/dist/compile/errors.js
16579
- var require_errors = __commonJS((exports) => {
19812
+ var require_errors2 = __commonJS((exports) => {
16580
19813
  Object.defineProperty(exports, "__esModule", { value: true });
16581
19814
  exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = undefined;
16582
19815
  var codegen_1 = require_codegen();
@@ -16697,7 +19930,7 @@ var require_errors = __commonJS((exports) => {
16697
19930
  var require_boolSchema = __commonJS((exports) => {
16698
19931
  Object.defineProperty(exports, "__esModule", { value: true });
16699
19932
  exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = undefined;
16700
- var errors_1 = require_errors();
19933
+ var errors_1 = require_errors2();
16701
19934
  var codegen_1 = require_codegen();
16702
19935
  var names_1 = require_names();
16703
19936
  var boolError = {
@@ -16773,8 +20006,8 @@ var require_rules = __commonJS((exports) => {
16773
20006
  var require_applicability = __commonJS((exports) => {
16774
20007
  Object.defineProperty(exports, "__esModule", { value: true });
16775
20008
  exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = undefined;
16776
- function schemaHasRulesForType({ schema, self }, type) {
16777
- const group = self.RULES.types[type];
20009
+ function schemaHasRulesForType({ schema, self: self2 }, type) {
20010
+ const group = self2.RULES.types[type];
16778
20011
  return group && group !== true && shouldUseGroup(schema, group);
16779
20012
  }
16780
20013
  exports.schemaHasRulesForType = schemaHasRulesForType;
@@ -16795,7 +20028,7 @@ var require_dataType = __commonJS((exports) => {
16795
20028
  exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = undefined;
16796
20029
  var rules_1 = require_rules();
16797
20030
  var applicability_1 = require_applicability();
16798
- var errors_1 = require_errors();
20031
+ var errors_1 = require_errors2();
16799
20032
  var codegen_1 = require_codegen();
16800
20033
  var util_1 = require_util();
16801
20034
  var DataType;
@@ -17140,7 +20373,7 @@ var require_keyword = __commonJS((exports) => {
17140
20373
  var codegen_1 = require_codegen();
17141
20374
  var names_1 = require_names();
17142
20375
  var code_1 = require_code2();
17143
- var errors_1 = require_errors();
20376
+ var errors_1 = require_errors2();
17144
20377
  function macroKeywordCode(cxt, def) {
17145
20378
  const { gen, keyword, schema, parentSchema, it } = cxt;
17146
20379
  const macroSchema = def.macro.call(it.self, schema, parentSchema, it);
@@ -17226,7 +20459,7 @@ var require_keyword = __commonJS((exports) => {
17226
20459
  return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema) : st === "object" ? schema && typeof schema == "object" && !Array.isArray(schema) : typeof schema == st || allowUndefined && typeof schema == "undefined");
17227
20460
  }
17228
20461
  exports.validSchemaType = validSchemaType;
17229
- function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def, keyword) {
20462
+ function validateKeywordUsage({ schema, opts, self: self2, errSchemaPath }, def, keyword) {
17230
20463
  if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) {
17231
20464
  throw new Error("ajv implementation error");
17232
20465
  }
@@ -17237,9 +20470,9 @@ var require_keyword = __commonJS((exports) => {
17237
20470
  if (def.validateSchema) {
17238
20471
  const valid = def.validateSchema(schema[keyword]);
17239
20472
  if (!valid) {
17240
- const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def.validateSchema.errors);
20473
+ const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + self2.errorsText(def.validateSchema.errors);
17241
20474
  if (opts.validateSchema === "log")
17242
- self.logger.error(msg);
20475
+ self2.logger.error(msg);
17243
20476
  else
17244
20477
  throw new Error(msg);
17245
20478
  }
@@ -17621,7 +20854,7 @@ var require_validate = __commonJS((exports) => {
17621
20854
  var names_1 = require_names();
17622
20855
  var resolve_1 = require_resolve();
17623
20856
  var util_1 = require_util();
17624
- var errors_1 = require_errors();
20857
+ var errors_1 = require_errors2();
17625
20858
  function validateFunctionCode(it) {
17626
20859
  if (isSchemaObj(it)) {
17627
20860
  checkKeywords(it);
@@ -17699,11 +20932,11 @@ var require_validate = __commonJS((exports) => {
17699
20932
  }
17700
20933
  (0, boolSchema_1.boolOrEmptySchema)(it, valid);
17701
20934
  }
17702
- function schemaCxtHasRules({ schema, self }) {
20935
+ function schemaCxtHasRules({ schema, self: self2 }) {
17703
20936
  if (typeof schema == "boolean")
17704
20937
  return !schema;
17705
20938
  for (const key in schema)
17706
- if (self.RULES.all[key])
20939
+ if (self2.RULES.all[key])
17707
20940
  return true;
17708
20941
  return false;
17709
20942
  }
@@ -17732,9 +20965,9 @@ var require_validate = __commonJS((exports) => {
17732
20965
  schemaKeywords(it, types, !checkedTypes, errsCount);
17733
20966
  }
17734
20967
  function checkRefsAndKeywords(it) {
17735
- const { schema, errSchemaPath, opts, self } = it;
17736
- if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema, self.RULES)) {
17737
- self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
20968
+ const { schema, errSchemaPath, opts, self: self2 } = it;
20969
+ if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema, self2.RULES)) {
20970
+ self2.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
17738
20971
  }
17739
20972
  }
17740
20973
  function checkNoDefault(it) {
@@ -17780,8 +21013,8 @@ var require_validate = __commonJS((exports) => {
17780
21013
  gen.assign((0, codegen_1._)`${evaluated}.items`, items);
17781
21014
  }
17782
21015
  function schemaKeywords(it, types, typeErrors, errsCount) {
17783
- const { gen, schema, data, allErrors, opts, self } = it;
17784
- const { RULES } = self;
21016
+ const { gen, schema, data, allErrors, opts, self: self2 } = it;
21017
+ const { RULES } = self2;
17785
21018
  if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) {
17786
21019
  gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
17787
21020
  return;
@@ -18813,23 +22046,23 @@ var require_fast_uri = __commonJS((exports, module) => {
18813
22046
  var { SCHEMES, getSchemeHandler } = require_schemes();
18814
22047
  function normalize(uri, options) {
18815
22048
  if (typeof uri === "string") {
18816
- uri = serialize(parse6(uri, options), options);
22049
+ uri = serialize(parse7(uri, options), options);
18817
22050
  } else if (typeof uri === "object") {
18818
- uri = parse6(serialize(uri, options), options);
22051
+ uri = parse7(serialize(uri, options), options);
18819
22052
  }
18820
22053
  return uri;
18821
22054
  }
18822
22055
  function resolve(baseURI, relativeURI, options) {
18823
22056
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
18824
- const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
22057
+ const resolved = resolveComponent(parse7(baseURI, schemelessOptions), parse7(relativeURI, schemelessOptions), schemelessOptions, true);
18825
22058
  schemelessOptions.skipEscape = true;
18826
22059
  return serialize(resolved, schemelessOptions);
18827
22060
  }
18828
22061
  function resolveComponent(base, relative, options, skipNormalization) {
18829
22062
  const target = {};
18830
22063
  if (!skipNormalization) {
18831
- base = parse6(serialize(base, options), options);
18832
- relative = parse6(serialize(relative, options), options);
22064
+ base = parse7(serialize(base, options), options);
22065
+ relative = parse7(serialize(relative, options), options);
18833
22066
  }
18834
22067
  options = options || {};
18835
22068
  if (!options.tolerant && relative.scheme) {
@@ -18881,13 +22114,13 @@ var require_fast_uri = __commonJS((exports, module) => {
18881
22114
  function equal(uriA, uriB, options) {
18882
22115
  if (typeof uriA === "string") {
18883
22116
  uriA = unescape(uriA);
18884
- uriA = serialize(normalizeComponentEncoding(parse6(uriA, options), true), { ...options, skipEscape: true });
22117
+ uriA = serialize(normalizeComponentEncoding(parse7(uriA, options), true), { ...options, skipEscape: true });
18885
22118
  } else if (typeof uriA === "object") {
18886
22119
  uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
18887
22120
  }
18888
22121
  if (typeof uriB === "string") {
18889
22122
  uriB = unescape(uriB);
18890
- uriB = serialize(normalizeComponentEncoding(parse6(uriB, options), true), { ...options, skipEscape: true });
22123
+ uriB = serialize(normalizeComponentEncoding(parse7(uriB, options), true), { ...options, skipEscape: true });
18891
22124
  } else if (typeof uriB === "object") {
18892
22125
  uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
18893
22126
  }
@@ -18957,7 +22190,7 @@ var require_fast_uri = __commonJS((exports, module) => {
18957
22190
  return uriTokens.join("");
18958
22191
  }
18959
22192
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
18960
- function parse6(uri, opts) {
22193
+ function parse7(uri, opts) {
18961
22194
  const options = Object.assign({}, opts);
18962
22195
  const parsed = {
18963
22196
  scheme: undefined,
@@ -19051,7 +22284,7 @@ var require_fast_uri = __commonJS((exports, module) => {
19051
22284
  resolveComponent,
19052
22285
  equal,
19053
22286
  serialize,
19054
- parse: parse6
22287
+ parse: parse7
19055
22288
  };
19056
22289
  module.exports = fastUri;
19057
22290
  module.exports.default = fastUri;
@@ -19067,7 +22300,7 @@ var require_uri = __commonJS((exports) => {
19067
22300
  });
19068
22301
 
19069
22302
  // ../../node_modules/.bun/ajv@8.17.1/node_modules/ajv/dist/core.js
19070
- var require_core = __commonJS((exports) => {
22303
+ var require_core3 = __commonJS((exports) => {
19071
22304
  Object.defineProperty(exports, "__esModule", { value: true });
19072
22305
  exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = undefined;
19073
22306
  var validate_1 = require_validate();
@@ -19686,11 +22919,11 @@ var require_ref = __commonJS((exports) => {
19686
22919
  schemaType: "string",
19687
22920
  code(cxt) {
19688
22921
  const { gen, schema: $ref, it } = cxt;
19689
- const { baseId, schemaEnv: env, validateName, opts, self } = it;
22922
+ const { baseId, schemaEnv: env, validateName, opts, self: self2 } = it;
19690
22923
  const { root } = env;
19691
22924
  if (($ref === "#" || $ref === "#/") && baseId === root.baseId)
19692
22925
  return callRootRef();
19693
- const schOrEnv = compile_1.resolveRef.call(self, root, baseId, $ref);
22926
+ const schOrEnv = compile_1.resolveRef.call(self2, root, baseId, $ref);
19694
22927
  if (schOrEnv === undefined)
19695
22928
  throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref);
19696
22929
  if (schOrEnv instanceof compile_1.SchemaEnv)
@@ -19791,7 +23024,7 @@ var require_ref = __commonJS((exports) => {
19791
23024
  });
19792
23025
 
19793
23026
  // ../../node_modules/.bun/ajv@8.17.1/node_modules/ajv/dist/vocabularies/core/index.js
19794
- var require_core2 = __commonJS((exports) => {
23027
+ var require_core4 = __commonJS((exports) => {
19795
23028
  Object.defineProperty(exports, "__esModule", { value: true });
19796
23029
  var id_1 = require_id();
19797
23030
  var ref_1 = require_ref();
@@ -20295,7 +23528,7 @@ var require_additionalItems = __commonJS((exports) => {
20295
23528
  });
20296
23529
 
20297
23530
  // ../../node_modules/.bun/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/items.js
20298
- var require_items = __commonJS((exports) => {
23531
+ var require_items2 = __commonJS((exports) => {
20299
23532
  Object.defineProperty(exports, "__esModule", { value: true });
20300
23533
  exports.validateTuple = undefined;
20301
23534
  var codegen_1 = require_codegen();
@@ -20351,7 +23584,7 @@ var require_items = __commonJS((exports) => {
20351
23584
  // ../../node_modules/.bun/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js
20352
23585
  var require_prefixItems = __commonJS((exports) => {
20353
23586
  Object.defineProperty(exports, "__esModule", { value: true });
20354
- var items_1 = require_items();
23587
+ var items_1 = require_items2();
20355
23588
  var def = {
20356
23589
  keyword: "prefixItems",
20357
23590
  type: "array",
@@ -21046,7 +24279,7 @@ var require_applicator = __commonJS((exports) => {
21046
24279
  Object.defineProperty(exports, "__esModule", { value: true });
21047
24280
  var additionalItems_1 = require_additionalItems();
21048
24281
  var prefixItems_1 = require_prefixItems();
21049
- var items_1 = require_items();
24282
+ var items_1 = require_items2();
21050
24283
  var items2020_1 = require_items2020();
21051
24284
  var contains_1 = require_contains();
21052
24285
  var dependencies_1 = require_dependencies();
@@ -21100,7 +24333,7 @@ var require_format = __commonJS((exports) => {
21100
24333
  error: error46,
21101
24334
  code(cxt, ruleType) {
21102
24335
  const { gen, data, $data, schema, schemaCode, it } = cxt;
21103
- const { opts, errSchemaPath, schemaEnv, self } = it;
24336
+ const { opts, errSchemaPath, schemaEnv, self: self2 } = it;
21104
24337
  if (!opts.validateFormats)
21105
24338
  return;
21106
24339
  if ($data)
@@ -21109,7 +24342,7 @@ var require_format = __commonJS((exports) => {
21109
24342
  validateFormat();
21110
24343
  function validate$DataFormat() {
21111
24344
  const fmts = gen.scopeValue("formats", {
21112
- ref: self.formats,
24345
+ ref: self2.formats,
21113
24346
  code: opts.code.formats
21114
24347
  });
21115
24348
  const fDef = gen.const("fDef", (0, codegen_1._)`${fmts}[${schemaCode}]`);
@@ -21129,7 +24362,7 @@ var require_format = __commonJS((exports) => {
21129
24362
  }
21130
24363
  }
21131
24364
  function validateFormat() {
21132
- const formatDef = self.formats[schema];
24365
+ const formatDef = self2.formats[schema];
21133
24366
  if (!formatDef) {
21134
24367
  unknownFormat();
21135
24368
  return;
@@ -21141,7 +24374,7 @@ var require_format = __commonJS((exports) => {
21141
24374
  cxt.pass(validCondition());
21142
24375
  function unknownFormat() {
21143
24376
  if (opts.strictSchema === false) {
21144
- self.logger.warn(unknownMsg());
24377
+ self2.logger.warn(unknownMsg());
21145
24378
  return;
21146
24379
  }
21147
24380
  throw new Error(unknownMsg());
@@ -21202,7 +24435,7 @@ var require_metadata = __commonJS((exports) => {
21202
24435
  // ../../node_modules/.bun/ajv@8.17.1/node_modules/ajv/dist/vocabularies/draft7.js
21203
24436
  var require_draft7 = __commonJS((exports) => {
21204
24437
  Object.defineProperty(exports, "__esModule", { value: true });
21205
- var core_1 = require_core2();
24438
+ var core_1 = require_core4();
21206
24439
  var validation_1 = require_validation();
21207
24440
  var applicator_1 = require_applicator();
21208
24441
  var format_1 = require_format2();
@@ -21219,7 +24452,7 @@ var require_draft7 = __commonJS((exports) => {
21219
24452
  });
21220
24453
 
21221
24454
  // ../../node_modules/.bun/ajv@8.17.1/node_modules/ajv/dist/vocabularies/discriminator/types.js
21222
- var require_types = __commonJS((exports) => {
24455
+ var require_types2 = __commonJS((exports) => {
21223
24456
  Object.defineProperty(exports, "__esModule", { value: true });
21224
24457
  exports.DiscrError = undefined;
21225
24458
  var DiscrError;
@@ -21233,7 +24466,7 @@ var require_types = __commonJS((exports) => {
21233
24466
  var require_discriminator = __commonJS((exports) => {
21234
24467
  Object.defineProperty(exports, "__esModule", { value: true });
21235
24468
  var codegen_1 = require_codegen();
21236
- var types_1 = require_types();
24469
+ var types_1 = require_types2();
21237
24470
  var compile_1 = require_compile();
21238
24471
  var ref_error_1 = require_ref_error();
21239
24472
  var util_1 = require_util();
@@ -21490,7 +24723,7 @@ var require_json_schema_draft_07 = __commonJS((exports, module) => {
21490
24723
  var require_ajv = __commonJS((exports, module) => {
21491
24724
  Object.defineProperty(exports, "__esModule", { value: true });
21492
24725
  exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = undefined;
21493
- var core_1 = require_core();
24726
+ var core_1 = require_core3();
21494
24727
  var draft7_1 = require_draft7();
21495
24728
  var discriminator_1 = require_discriminator();
21496
24729
  var draft7MetaSchema = require_json_schema_draft_07();
@@ -21756,17 +24989,17 @@ var require_limit = __commonJS((exports) => {
21756
24989
  error: error46,
21757
24990
  code(cxt) {
21758
24991
  const { gen, data, schemaCode, keyword, it } = cxt;
21759
- const { opts, self } = it;
24992
+ const { opts, self: self2 } = it;
21760
24993
  if (!opts.validateFormats)
21761
24994
  return;
21762
- const fCxt = new ajv_1.KeywordCxt(it, self.RULES.all.format.definition, "format");
24995
+ const fCxt = new ajv_1.KeywordCxt(it, self2.RULES.all.format.definition, "format");
21763
24996
  if (fCxt.$data)
21764
24997
  validate$DataFormat();
21765
24998
  else
21766
24999
  validateFormat();
21767
25000
  function validate$DataFormat() {
21768
25001
  const fmts = gen.scopeValue("formats", {
21769
- ref: self.formats,
25002
+ ref: self2.formats,
21770
25003
  code: opts.code.formats
21771
25004
  });
21772
25005
  const fmt = gen.const("fmt", (0, codegen_1._)`${fmts}[${fCxt.schemaCode}]`);
@@ -21774,7 +25007,7 @@ var require_limit = __commonJS((exports) => {
21774
25007
  }
21775
25008
  function validateFormat() {
21776
25009
  const format = fCxt.schema;
21777
- const fmtDef = self.formats[format];
25010
+ const fmtDef = self2.formats[format];
21778
25011
  if (!fmtDef || fmtDef === true)
21779
25012
  return;
21780
25013
  if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") {
@@ -22450,14 +25683,14 @@ __export(exports_team_orchestrator, {
22450
25683
  });
22451
25684
  import { spawn } from "child_process";
22452
25685
  import {
22453
- mkdirSync,
22454
- writeFileSync,
22455
- readFileSync,
22456
- existsSync,
25686
+ mkdirSync as mkdirSync2,
25687
+ writeFileSync as writeFileSync2,
25688
+ readFileSync as readFileSync2,
25689
+ existsSync as existsSync2,
22457
25690
  readdirSync,
22458
25691
  createWriteStream
22459
25692
  } from "fs";
22460
- import { join, resolve } from "path";
25693
+ import { join as join2, resolve } from "path";
22461
25694
  function validateSessionPath(sessionPath) {
22462
25695
  const resolved = resolve(sessionPath);
22463
25696
  const cwd = process.cwd();
@@ -22478,18 +25711,18 @@ function setupSession(sessionPath, models, input) {
22478
25711
  if (models.length === 0) {
22479
25712
  throw new Error("At least one model is required");
22480
25713
  }
22481
- if (existsSync(join(sessionPath, "manifest.json"))) {
25714
+ if (existsSync2(join2(sessionPath, "manifest.json"))) {
22482
25715
  throw new Error(`Session already exists at ${sessionPath}. ` + `Use a new directory path or delete the existing session first.`);
22483
25716
  }
22484
25717
  const sentinels = models.filter(isSentinelModel);
22485
25718
  if (sentinels.length > 0) {
22486
25719
  throw new Error(`Invalid model(s) for team run: ${sentinels.join(", ")}. ` + `These are Claude Code agent selectors, not external model IDs. ` + `Use real external models (e.g., "gemini-2.0-flash", "gpt-4o", "or@deepseek/deepseek-r1"). ` + `For Claude models, use a Task agent instead of the team tool.`);
22487
25720
  }
22488
- mkdirSync(join(sessionPath, "work"), { recursive: true });
22489
- mkdirSync(join(sessionPath, "errors"), { recursive: true });
25721
+ mkdirSync2(join2(sessionPath, "work"), { recursive: true });
25722
+ mkdirSync2(join2(sessionPath, "errors"), { recursive: true });
22490
25723
  if (input !== undefined) {
22491
- writeFileSync(join(sessionPath, "input.md"), input, "utf-8");
22492
- } else if (!existsSync(join(sessionPath, "input.md"))) {
25724
+ writeFileSync2(join2(sessionPath, "input.md"), input, "utf-8");
25725
+ } else if (!existsSync2(join2(sessionPath, "input.md"))) {
22493
25726
  throw new Error(`No input.md found at ${sessionPath} and no input provided`);
22494
25727
  }
22495
25728
  const ids = models.map((_, i) => String(i + 1).padStart(2, "0"));
@@ -22506,9 +25739,9 @@ function setupSession(sessionPath, models, input) {
22506
25739
  model: models[i],
22507
25740
  assignedAt: now
22508
25741
  };
22509
- mkdirSync(join(sessionPath, "work", anonId), { recursive: true });
25742
+ mkdirSync2(join2(sessionPath, "work", anonId), { recursive: true });
22510
25743
  }
22511
- writeFileSync(join(sessionPath, "manifest.json"), JSON.stringify(manifest, null, 2), "utf-8");
25744
+ writeFileSync2(join2(sessionPath, "manifest.json"), JSON.stringify(manifest, null, 2), "utf-8");
22512
25745
  const status = {
22513
25746
  startedAt: now,
22514
25747
  models: Object.fromEntries(Object.keys(manifest.models).map((id) => [
@@ -22522,19 +25755,19 @@ function setupSession(sessionPath, models, input) {
22522
25755
  }
22523
25756
  ]))
22524
25757
  };
22525
- writeFileSync(join(sessionPath, "status.json"), JSON.stringify(status, null, 2), "utf-8");
25758
+ writeFileSync2(join2(sessionPath, "status.json"), JSON.stringify(status, null, 2), "utf-8");
22526
25759
  return manifest;
22527
25760
  }
22528
25761
  async function runModels(sessionPath, opts = {}) {
22529
25762
  const timeoutMs = (opts.timeout ?? 300) * 1000;
22530
- const manifest = JSON.parse(readFileSync(join(sessionPath, "manifest.json"), "utf-8"));
22531
- const statusPath = join(sessionPath, "status.json");
22532
- const inputPath = join(sessionPath, "input.md");
22533
- const inputContent = readFileSync(inputPath, "utf-8");
22534
- const statusCache = JSON.parse(readFileSync(statusPath, "utf-8"));
25763
+ const manifest = JSON.parse(readFileSync2(join2(sessionPath, "manifest.json"), "utf-8"));
25764
+ const statusPath = join2(sessionPath, "status.json");
25765
+ const inputPath = join2(sessionPath, "input.md");
25766
+ const inputContent = readFileSync2(inputPath, "utf-8");
25767
+ const statusCache = JSON.parse(readFileSync2(statusPath, "utf-8"));
22535
25768
  function updateModelStatus(id, update) {
22536
25769
  statusCache.models[id] = { ...statusCache.models[id], ...update };
22537
- writeFileSync(statusPath, JSON.stringify(statusCache, null, 2), "utf-8");
25770
+ writeFileSync2(statusPath, JSON.stringify(statusCache, null, 2), "utf-8");
22538
25771
  }
22539
25772
  const processes = new Map;
22540
25773
  const sigintHandler = () => {
@@ -22547,8 +25780,8 @@ async function runModels(sessionPath, opts = {}) {
22547
25780
  process.on("SIGINT", sigintHandler);
22548
25781
  const completionPromises = [];
22549
25782
  for (const [anonId, entry] of Object.entries(manifest.models)) {
22550
- const outputPath = join(sessionPath, `response-${anonId}.md`);
22551
- const errorLogPath = join(sessionPath, "errors", `${anonId}.log`);
25783
+ const outputPath = join2(sessionPath, `response-${anonId}.md`);
25784
+ const errorLogPath = join2(sessionPath, "errors", `${anonId}.log`);
22552
25785
  const args = ["--model", entry.model, "-y", "--stdin", "--quiet", ...opts.claudeFlags ?? []];
22553
25786
  updateModelStatus(anonId, {
22554
25787
  state: "RUNNING",
@@ -22601,7 +25834,7 @@ async function runModels(sessionPath, opts = {}) {
22601
25834
  return;
22602
25835
  }
22603
25836
  if (stderr) {
22604
- writeFileSync(errorLogPath, stderr, "utf-8");
25837
+ writeFileSync2(errorLogPath, stderr, "utf-8");
22605
25838
  }
22606
25839
  exitCode = code;
22607
25840
  if (outputStream.destroyed) {
@@ -22646,23 +25879,23 @@ async function judgeResponses(sessionPath, opts = {}) {
22646
25879
  const responses = {};
22647
25880
  for (const file2 of responseFiles) {
22648
25881
  const id = file2.replace(/^response-/, "").replace(/\.md$/, "");
22649
- responses[id] = readFileSync(join(sessionPath, file2), "utf-8");
25882
+ responses[id] = readFileSync2(join2(sessionPath, file2), "utf-8");
22650
25883
  }
22651
- const input = readFileSync(join(sessionPath, "input.md"), "utf-8");
25884
+ const input = readFileSync2(join2(sessionPath, "input.md"), "utf-8");
22652
25885
  const judgePrompt = buildJudgePrompt(input, responses);
22653
- writeFileSync(join(sessionPath, "judge-prompt.md"), judgePrompt, "utf-8");
25886
+ writeFileSync2(join2(sessionPath, "judge-prompt.md"), judgePrompt, "utf-8");
22654
25887
  const judgeModels = opts.judges ?? getDefaultJudgeModels(sessionPath);
22655
- const judgePath = join(sessionPath, "judging");
22656
- mkdirSync(judgePath, { recursive: true });
25888
+ const judgePath = join2(sessionPath, "judging");
25889
+ mkdirSync2(judgePath, { recursive: true });
22657
25890
  setupSession(judgePath, judgeModels, judgePrompt);
22658
25891
  await runModels(judgePath, { claudeFlags: opts.claudeFlags });
22659
25892
  const votes = parseJudgeVotes(judgePath, Object.keys(responses));
22660
25893
  const verdict = aggregateVerdict(votes, Object.keys(responses));
22661
- writeFileSync(join(sessionPath, "verdict.md"), formatVerdict(verdict, sessionPath), "utf-8");
25894
+ writeFileSync2(join2(sessionPath, "verdict.md"), formatVerdict(verdict, sessionPath), "utf-8");
22662
25895
  return verdict;
22663
25896
  }
22664
25897
  function getStatus(sessionPath) {
22665
- return JSON.parse(readFileSync(join(sessionPath, "status.json"), "utf-8"));
25898
+ return JSON.parse(readFileSync2(join2(sessionPath, "status.json"), "utf-8"));
22666
25899
  }
22667
25900
  function fisherYatesShuffle(arr) {
22668
25901
  for (let i = arr.length - 1;i > 0; i--) {
@@ -22672,7 +25905,7 @@ function fisherYatesShuffle(arr) {
22672
25905
  return arr;
22673
25906
  }
22674
25907
  function getDefaultJudgeModels(sessionPath) {
22675
- const manifest = JSON.parse(readFileSync(join(sessionPath, "manifest.json"), "utf-8"));
25908
+ const manifest = JSON.parse(readFileSync2(join2(sessionPath, "manifest.json"), "utf-8"));
22676
25909
  return Object.values(manifest.models).map((e) => e.model);
22677
25910
  }
22678
25911
  function buildJudgePrompt(input, responses) {
@@ -22735,7 +25968,7 @@ function parseJudgeVotes(judgePath, responseIds) {
22735
25968
  const judgeId = file2.replace(/^response-/, "").replace(/\.md$/, "");
22736
25969
  let content;
22737
25970
  try {
22738
- content = readFileSync(join(judgePath, file2), "utf-8");
25971
+ content = readFileSync2(join2(judgePath, file2), "utf-8");
22739
25972
  } catch {
22740
25973
  continue;
22741
25974
  }
@@ -22787,7 +26020,7 @@ function aggregateVerdict(votes, responseIds) {
22787
26020
  function formatVerdict(verdict, sessionPath) {
22788
26021
  let manifest = null;
22789
26022
  try {
22790
- manifest = JSON.parse(readFileSync(join(sessionPath, "manifest.json"), "utf-8"));
26023
+ manifest = JSON.parse(readFileSync2(join2(sessionPath, "manifest.json"), "utf-8"));
22791
26024
  } catch {}
22792
26025
  let output = `# Team Verdict
22793
26026
 
@@ -23020,9 +26253,9 @@ var init_signal_watcher = __esm(() => {
23020
26253
 
23021
26254
  // src/channel/session-manager.ts
23022
26255
  import { spawn as spawn2 } from "child_process";
23023
- import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2, createWriteStream as createWriteStream2 } from "fs";
23024
- import { join as join2 } from "path";
23025
- import { homedir } from "os";
26256
+ import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3, createWriteStream as createWriteStream2 } from "fs";
26257
+ import { join as join3 } from "path";
26258
+ import { homedir as homedir2 } from "os";
23026
26259
  import { randomUUID } from "crypto";
23027
26260
 
23028
26261
  class SessionManager {
@@ -23043,10 +26276,10 @@ class SessionManager {
23043
26276
  const sessionId = randomUUID().slice(0, 8);
23044
26277
  const timeout = Math.min(opts.timeoutSeconds ?? DEFAULT_TIMEOUT, MAX_TIMEOUT);
23045
26278
  const startedAt = new Date().toISOString();
23046
- const sessionDir = join2(homedir(), ".claudish", "sessions", sessionId);
23047
- mkdirSync2(sessionDir, { recursive: true });
26279
+ const sessionDir = join3(homedir2(), ".claudish", "sessions", sessionId);
26280
+ mkdirSync3(sessionDir, { recursive: true });
23048
26281
  if (opts.prompt) {
23049
- writeFileSync2(join2(sessionDir, "prompt.md"), opts.prompt, "utf-8");
26282
+ writeFileSync3(join3(sessionDir, "prompt.md"), opts.prompt, "utf-8");
23050
26283
  }
23051
26284
  const args = ["--model", opts.model, "-y", "--stdin", "--quiet", ...opts.claudishFlags ?? []];
23052
26285
  const proc = spawn2("claudish", args, {
@@ -23073,7 +26306,7 @@ class SessionManager {
23073
26306
  });
23074
26307
  }
23075
26308
  });
23076
- const outputLogStream = createWriteStream2(join2(sessionDir, "output.log"));
26309
+ const outputLogStream = createWriteStream2(join3(sessionDir, "output.log"));
23077
26310
  const entry = {
23078
26311
  info: {
23079
26312
  sessionId,
@@ -23120,9 +26353,9 @@ class SessionManager {
23120
26353
  watcher.processExited(code);
23121
26354
  outputLogStream.end();
23122
26355
  if (entry.stderr) {
23123
- writeFileSync2(join2(sessionDir, "stderr.log"), entry.stderr, "utf-8");
26356
+ writeFileSync3(join3(sessionDir, "stderr.log"), entry.stderr, "utf-8");
23124
26357
  }
23125
- writeFileSync2(join2(sessionDir, "meta.json"), JSON.stringify(entry.info, null, 2), "utf-8");
26358
+ writeFileSync3(join3(sessionDir, "meta.json"), JSON.stringify(entry.info, null, 2), "utf-8");
23126
26359
  this.cleanupSigint();
23127
26360
  });
23128
26361
  proc.on("error", (err) => {
@@ -25567,9 +28800,9 @@ __export(exports_logger, {
25567
28800
  getLogFilePath: () => getLogFilePath,
25568
28801
  getAlwaysOnLogPath: () => getAlwaysOnLogPath
25569
28802
  });
25570
- import { writeFileSync as writeFileSync3, appendFile, existsSync as existsSync2, mkdirSync as mkdirSync3, readdirSync as readdirSync2, unlinkSync } from "fs";
25571
- import { join as join3 } from "path";
25572
- import { homedir as homedir2 } from "os";
28803
+ import { writeFileSync as writeFileSync4, appendFile, existsSync as existsSync3, mkdirSync as mkdirSync4, readdirSync as readdirSync2, unlinkSync } from "fs";
28804
+ import { join as join4 } from "path";
28805
+ import { homedir as homedir3 } from "os";
25573
28806
  function flushLogBuffer() {
25574
28807
  if (!logFilePath || logBuffer.length === 0)
25575
28808
  return;
@@ -25601,11 +28834,11 @@ function scheduleFlush() {
25601
28834
  flushTimer = null;
25602
28835
  }
25603
28836
  if (logFilePath && logBuffer.length > 0) {
25604
- writeFileSync3(logFilePath, logBuffer.join(""), { flag: "a" });
28837
+ writeFileSync4(logFilePath, logBuffer.join(""), { flag: "a" });
25605
28838
  logBuffer = [];
25606
28839
  }
25607
28840
  if (alwaysOnLogPath && alwaysOnBuffer.length > 0) {
25608
- writeFileSync3(alwaysOnLogPath, alwaysOnBuffer.join(""), { flag: "a" });
28841
+ writeFileSync4(alwaysOnLogPath, alwaysOnBuffer.join(""), { flag: "a" });
25609
28842
  alwaysOnBuffer = [];
25610
28843
  }
25611
28844
  });
@@ -25615,7 +28848,7 @@ function rotateOldLogs(dir, keep) {
25615
28848
  const files = readdirSync2(dir).filter((f) => f.startsWith("claudish_") && f.endsWith(".log")).sort().reverse();
25616
28849
  for (const file2 of files.slice(keep)) {
25617
28850
  try {
25618
- unlinkSync(join3(dir, file2));
28851
+ unlinkSync(join4(dir, file2));
25619
28852
  } catch {}
25620
28853
  }
25621
28854
  } catch {}
@@ -25666,13 +28899,13 @@ function redactLogLine(message, timestamp) {
25666
28899
  }
25667
28900
  function initLogger(debugMode, level = "info", noLogs = false) {
25668
28901
  if (!noLogs) {
25669
- const logsDir = join3(homedir2(), ".claudish", "logs");
25670
- if (!existsSync2(logsDir)) {
25671
- mkdirSync3(logsDir, { recursive: true });
28902
+ const logsDir = join4(homedir3(), ".claudish", "logs");
28903
+ if (!existsSync3(logsDir)) {
28904
+ mkdirSync4(logsDir, { recursive: true });
25672
28905
  }
25673
28906
  const timestamp = new Date().toISOString().replace(/[:.]/g, "-").split("T").join("_").slice(0, -5);
25674
- alwaysOnLogPath = join3(logsDir, `claudish_${timestamp}.log`);
25675
- writeFileSync3(alwaysOnLogPath, `Claudish Session Log - ${new Date().toISOString()}
28907
+ alwaysOnLogPath = join4(logsDir, `claudish_${timestamp}.log`);
28908
+ writeFileSync4(alwaysOnLogPath, `Claudish Session Log - ${new Date().toISOString()}
25676
28909
  Mode: structural (content redacted)
25677
28910
  ${"=".repeat(60)}
25678
28911
 
@@ -25682,13 +28915,13 @@ ${"=".repeat(60)}
25682
28915
  }
25683
28916
  if (debugMode) {
25684
28917
  logLevel = level;
25685
- const logsDir = join3(process.cwd(), "logs");
25686
- if (!existsSync2(logsDir)) {
25687
- mkdirSync3(logsDir, { recursive: true });
28918
+ const logsDir = join4(process.cwd(), "logs");
28919
+ if (!existsSync3(logsDir)) {
28920
+ mkdirSync4(logsDir, { recursive: true });
25688
28921
  }
25689
28922
  const timestamp = new Date().toISOString().replace(/[:.]/g, "-").split("T").join("_").slice(0, -5);
25690
- logFilePath = join3(logsDir, `claudish_${timestamp}.log`);
25691
- writeFileSync3(logFilePath, `Claudish Debug Log - ${new Date().toISOString()}
28923
+ logFilePath = join4(logsDir, `claudish_${timestamp}.log`);
28924
+ writeFileSync4(logFilePath, `Claudish Debug Log - ${new Date().toISOString()}
25692
28925
  Log Level: ${level}
25693
28926
  ${"=".repeat(80)}
25694
28927
 
@@ -25865,424 +29098,6 @@ var init_runtime_providers = __esm(() => {
25865
29098
  _runtimeProfiles = new Map;
25866
29099
  });
25867
29100
 
25868
- // src/profile-config.ts
25869
- var exports_profile_config = {};
25870
- __export(exports_profile_config, {
25871
- setProfile: () => setProfile,
25872
- setEndpoint: () => setEndpoint,
25873
- setDefaultProfile: () => setDefaultProfile,
25874
- setApiKey: () => setApiKey,
25875
- saveLocalConfig: () => saveLocalConfig,
25876
- saveConfig: () => saveConfig,
25877
- removeEndpoint: () => removeEndpoint,
25878
- removeApiKey: () => removeApiKey,
25879
- localConfigExists: () => localConfigExists,
25880
- loadLocalConfig: () => loadLocalConfig,
25881
- loadConfig: () => loadConfig,
25882
- listProfiles: () => listProfiles,
25883
- listAllProfiles: () => listAllProfiles,
25884
- isProjectDirectory: () => isProjectDirectory,
25885
- isLocalProviderEnabled: () => isLocalProviderEnabled,
25886
- getProfileNames: () => getProfileNames,
25887
- getProfile: () => getProfile,
25888
- getModelMapping: () => getModelMapping,
25889
- getLocalConfigPath: () => getLocalConfigPath,
25890
- getEndpoint: () => getEndpoint,
25891
- getDefaultProfile: () => getDefaultProfile,
25892
- getConfigPathForScope: () => getConfigPathForScope,
25893
- getConfigPath: () => getConfigPath,
25894
- getApiKey: () => getApiKey,
25895
- enableLocalProvider: () => enableLocalProvider,
25896
- disableLocalProvider: () => disableLocalProvider,
25897
- deleteProfile: () => deleteProfile,
25898
- createProfile: () => createProfile,
25899
- configExistsForScope: () => configExistsForScope,
25900
- configExists: () => configExists
25901
- });
25902
- import { existsSync as existsSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync4 } from "fs";
25903
- import { homedir as homedir3 } from "os";
25904
- import { dirname, join as join4, parse as parse6 } from "path";
25905
- function ensureConfigDir() {
25906
- if (!existsSync3(CONFIG_DIR)) {
25907
- mkdirSync4(CONFIG_DIR, { recursive: true });
25908
- }
25909
- }
25910
- function loadConfig() {
25911
- ensureConfigDir();
25912
- if (!existsSync3(CONFIG_FILE)) {
25913
- return { ...DEFAULT_CONFIG };
25914
- }
25915
- try {
25916
- const content = readFileSync2(CONFIG_FILE, "utf-8");
25917
- const config2 = JSON.parse(content);
25918
- const merged = {
25919
- version: config2.version || DEFAULT_CONFIG.version,
25920
- defaultProfile: config2.defaultProfile || DEFAULT_CONFIG.defaultProfile,
25921
- profiles: config2.profiles || DEFAULT_CONFIG.profiles
25922
- };
25923
- if (config2.telemetry !== undefined) {
25924
- merged.telemetry = config2.telemetry;
25925
- }
25926
- if (config2.stats !== undefined) {
25927
- merged.stats = config2.stats;
25928
- }
25929
- if (config2.routing !== undefined) {
25930
- merged.routing = config2.routing;
25931
- }
25932
- if (config2.apiKeys !== undefined) {
25933
- merged.apiKeys = config2.apiKeys;
25934
- }
25935
- if (config2.endpoints !== undefined) {
25936
- merged.endpoints = config2.endpoints;
25937
- }
25938
- if (config2.localProviders !== undefined) {
25939
- merged.localProviders = Array.from(new Set(config2.localProviders)).sort();
25940
- }
25941
- if (config2.autoApproveConfirmedAt !== undefined) {
25942
- merged.autoApproveConfirmedAt = config2.autoApproveConfirmedAt;
25943
- }
25944
- if (config2.defaultProvider !== undefined) {
25945
- merged.defaultProvider = config2.defaultProvider;
25946
- }
25947
- if (config2.customEndpoints !== undefined) {
25948
- merged.customEndpoints = config2.customEndpoints;
25949
- }
25950
- return merged;
25951
- } catch (error46) {
25952
- console.error(`Warning: Failed to load config, using defaults: ${error46}`);
25953
- return { ...DEFAULT_CONFIG };
25954
- }
25955
- }
25956
- function saveConfig(config2) {
25957
- ensureConfigDir();
25958
- writeFileSync4(CONFIG_FILE, JSON.stringify(config2, null, 2), "utf-8");
25959
- }
25960
- function configExists() {
25961
- return existsSync3(CONFIG_FILE);
25962
- }
25963
- function getConfigPath() {
25964
- return CONFIG_FILE;
25965
- }
25966
- function getLocalConfigPath() {
25967
- const home = homedir3();
25968
- let dir = process.cwd();
25969
- const root = parse6(dir).root;
25970
- while (dir !== root && dir !== home) {
25971
- const candidate = join4(dir, LOCAL_CONFIG_FILENAME);
25972
- if (existsSync3(candidate))
25973
- return candidate;
25974
- if (existsSync3(join4(dir, ".git"))) {
25975
- return candidate;
25976
- }
25977
- dir = dirname(dir);
25978
- }
25979
- return join4(process.cwd(), LOCAL_CONFIG_FILENAME);
25980
- }
25981
- function localConfigExists() {
25982
- return existsSync3(getLocalConfigPath());
25983
- }
25984
- function isProjectDirectory() {
25985
- const cwd = process.cwd();
25986
- return [".git", "package.json", "Cargo.toml", "go.mod", "pyproject.toml", ".claudish.json"].some((f) => existsSync3(join4(cwd, f)));
25987
- }
25988
- function loadLocalConfig() {
25989
- const localPath = getLocalConfigPath();
25990
- if (!existsSync3(localPath)) {
25991
- return null;
25992
- }
25993
- try {
25994
- const content = readFileSync2(localPath, "utf-8");
25995
- const config2 = JSON.parse(content);
25996
- const local = {
25997
- version: config2.version || DEFAULT_CONFIG.version,
25998
- defaultProfile: config2.defaultProfile || "",
25999
- profiles: config2.profiles || {}
26000
- };
26001
- if (config2.routing !== undefined) {
26002
- local.routing = config2.routing;
26003
- }
26004
- return local;
26005
- } catch (error46) {
26006
- console.error(`Warning: Failed to load local config: ${error46}`);
26007
- return null;
26008
- }
26009
- }
26010
- function saveLocalConfig(config2) {
26011
- const toWrite = { ...config2 };
26012
- if (toWrite.routing !== undefined && Object.keys(toWrite.routing).length === 0) {
26013
- delete toWrite.routing;
26014
- }
26015
- const profileCount = Object.keys(toWrite.profiles ?? {}).length;
26016
- const routingCount = toWrite.routing ? Object.keys(toWrite.routing).length : 0;
26017
- const path = getLocalConfigPath();
26018
- if (profileCount === 0 && routingCount === 0) {
26019
- if (existsSync3(path)) {
26020
- try {
26021
- unlinkSync2(path);
26022
- } catch {
26023
- writeFileSync4(path, JSON.stringify(toWrite, null, 2), "utf-8");
26024
- }
26025
- }
26026
- return;
26027
- }
26028
- writeFileSync4(path, JSON.stringify(toWrite, null, 2), "utf-8");
26029
- }
26030
- function loadConfigForScope(scope) {
26031
- if (scope === "local") {
26032
- return loadLocalConfig() || { version: "1.0.0", defaultProfile: "", profiles: {} };
26033
- }
26034
- return loadConfig();
26035
- }
26036
- function saveConfigForScope(config2, scope) {
26037
- if (scope === "local") {
26038
- saveLocalConfig(config2);
26039
- } else {
26040
- saveConfig(config2);
26041
- }
26042
- }
26043
- function configExistsForScope(scope) {
26044
- if (scope === "local") {
26045
- return localConfigExists();
26046
- }
26047
- return configExists();
26048
- }
26049
- function getConfigPathForScope(scope) {
26050
- if (scope === "local") {
26051
- return getLocalConfigPath();
26052
- }
26053
- return getConfigPath();
26054
- }
26055
- function getProfile(name, scope) {
26056
- if (scope === "local") {
26057
- const local2 = loadLocalConfig();
26058
- return local2?.profiles[name];
26059
- }
26060
- if (scope === "global") {
26061
- const config3 = loadConfig();
26062
- return config3.profiles[name];
26063
- }
26064
- const local = loadLocalConfig();
26065
- if (local?.profiles[name]) {
26066
- return local.profiles[name];
26067
- }
26068
- const config2 = loadConfig();
26069
- return config2.profiles[name];
26070
- }
26071
- function getDefaultProfile(scope) {
26072
- if (scope === "local") {
26073
- const local2 = loadLocalConfig();
26074
- if (local2 && local2.defaultProfile && local2.profiles[local2.defaultProfile]) {
26075
- return local2.profiles[local2.defaultProfile];
26076
- }
26077
- return DEFAULT_CONFIG.profiles.default;
26078
- }
26079
- if (scope === "global") {
26080
- const config3 = loadConfig();
26081
- const profile2 = config3.profiles[config3.defaultProfile];
26082
- if (profile2)
26083
- return profile2;
26084
- const firstProfile2 = Object.values(config3.profiles)[0];
26085
- if (firstProfile2)
26086
- return firstProfile2;
26087
- return DEFAULT_CONFIG.profiles.default;
26088
- }
26089
- const local = loadLocalConfig();
26090
- if (local && local.defaultProfile) {
26091
- const profile2 = getProfile(local.defaultProfile);
26092
- if (profile2)
26093
- return profile2;
26094
- }
26095
- const config2 = loadConfig();
26096
- const profile = config2.profiles[config2.defaultProfile];
26097
- if (profile)
26098
- return profile;
26099
- const firstProfile = Object.values(config2.profiles)[0];
26100
- if (firstProfile)
26101
- return firstProfile;
26102
- return DEFAULT_CONFIG.profiles.default;
26103
- }
26104
- function getProfileNames(scope) {
26105
- if (scope === "local") {
26106
- const local2 = loadLocalConfig();
26107
- return local2 ? Object.keys(local2.profiles) : [];
26108
- }
26109
- if (scope === "global") {
26110
- const config3 = loadConfig();
26111
- return Object.keys(config3.profiles);
26112
- }
26113
- const local = loadLocalConfig();
26114
- const config2 = loadConfig();
26115
- const names = new Set([
26116
- ...local ? Object.keys(local.profiles) : [],
26117
- ...Object.keys(config2.profiles)
26118
- ]);
26119
- return [...names];
26120
- }
26121
- function setProfile(profile, scope = "global") {
26122
- const config2 = loadConfigForScope(scope);
26123
- const existingProfile = config2.profiles[profile.name];
26124
- if (existingProfile) {
26125
- profile.createdAt = existingProfile.createdAt;
26126
- } else {
26127
- profile.createdAt = new Date().toISOString();
26128
- }
26129
- profile.updatedAt = new Date().toISOString();
26130
- config2.profiles[profile.name] = profile;
26131
- saveConfigForScope(config2, scope);
26132
- }
26133
- function deleteProfile(name, scope = "global") {
26134
- const config2 = loadConfigForScope(scope);
26135
- if (!config2.profiles[name]) {
26136
- return false;
26137
- }
26138
- if (scope === "global") {
26139
- const profileCount = Object.keys(config2.profiles).length;
26140
- if (profileCount <= 1) {
26141
- throw new Error("Cannot delete the last global profile");
26142
- }
26143
- }
26144
- delete config2.profiles[name];
26145
- if (config2.defaultProfile === name) {
26146
- const remaining = Object.keys(config2.profiles);
26147
- config2.defaultProfile = remaining.length > 0 ? remaining[0] : "";
26148
- }
26149
- saveConfigForScope(config2, scope);
26150
- return true;
26151
- }
26152
- function setDefaultProfile(name, scope = "global") {
26153
- const config2 = loadConfigForScope(scope);
26154
- if (!config2.profiles[name]) {
26155
- throw new Error(`Profile "${name}" does not exist in ${scope} config`);
26156
- }
26157
- config2.defaultProfile = name;
26158
- saveConfigForScope(config2, scope);
26159
- }
26160
- function getModelMapping(profileName) {
26161
- const profile = profileName ? getProfile(profileName) : getDefaultProfile();
26162
- if (!profile) {
26163
- return {};
26164
- }
26165
- return profile.models;
26166
- }
26167
- function createProfile(name, models, description, scope = "global") {
26168
- const now = new Date().toISOString();
26169
- const profile = {
26170
- name,
26171
- description,
26172
- models,
26173
- createdAt: now,
26174
- updatedAt: now
26175
- };
26176
- setProfile(profile, scope);
26177
- return profile;
26178
- }
26179
- function listProfiles() {
26180
- const config2 = loadConfig();
26181
- return Object.values(config2.profiles).map((profile) => ({
26182
- ...profile,
26183
- isDefault: profile.name === config2.defaultProfile
26184
- }));
26185
- }
26186
- function listAllProfiles() {
26187
- const globalConfig2 = loadConfig();
26188
- const localConfig = loadLocalConfig();
26189
- const result = [];
26190
- if (localConfig) {
26191
- for (const profile of Object.values(localConfig.profiles)) {
26192
- result.push({
26193
- ...profile,
26194
- scope: "local",
26195
- isDefault: profile.name === localConfig.defaultProfile
26196
- });
26197
- }
26198
- }
26199
- const localNames = localConfig ? new Set(Object.keys(localConfig.profiles)) : new Set;
26200
- for (const profile of Object.values(globalConfig2.profiles)) {
26201
- result.push({
26202
- ...profile,
26203
- scope: "global",
26204
- isDefault: profile.name === globalConfig2.defaultProfile,
26205
- shadowed: localNames.has(profile.name)
26206
- });
26207
- }
26208
- return result;
26209
- }
26210
- function getApiKey(envVar) {
26211
- const config2 = loadConfig();
26212
- return config2.apiKeys?.[envVar];
26213
- }
26214
- function setApiKey(envVar, value) {
26215
- const config2 = loadConfig();
26216
- if (!config2.apiKeys)
26217
- config2.apiKeys = {};
26218
- config2.apiKeys[envVar] = value;
26219
- saveConfig(config2);
26220
- }
26221
- function removeApiKey(envVar) {
26222
- const config2 = loadConfig();
26223
- if (config2.apiKeys) {
26224
- delete config2.apiKeys[envVar];
26225
- saveConfig(config2);
26226
- }
26227
- }
26228
- function getEndpoint(name) {
26229
- const config2 = loadConfig();
26230
- return config2.endpoints?.[name];
26231
- }
26232
- function setEndpoint(name, value) {
26233
- const config2 = loadConfig();
26234
- if (!config2.endpoints)
26235
- config2.endpoints = {};
26236
- config2.endpoints[name] = value;
26237
- saveConfig(config2);
26238
- }
26239
- function removeEndpoint(name) {
26240
- const config2 = loadConfig();
26241
- if (config2.endpoints) {
26242
- delete config2.endpoints[name];
26243
- saveConfig(config2);
26244
- }
26245
- }
26246
- function isLocalProviderEnabled(providerName, config2 = loadConfig()) {
26247
- return (config2.localProviders ?? []).includes(providerName);
26248
- }
26249
- function enableLocalProvider(providerName) {
26250
- const config2 = loadConfig();
26251
- const providers = new Set(config2.localProviders ?? []);
26252
- providers.add(providerName);
26253
- config2.localProviders = Array.from(providers).sort();
26254
- saveConfig(config2);
26255
- }
26256
- function disableLocalProvider(providerName) {
26257
- const config2 = loadConfig();
26258
- const providers = new Set(config2.localProviders ?? []);
26259
- providers.delete(providerName);
26260
- if (providers.size > 0) {
26261
- config2.localProviders = Array.from(providers).sort();
26262
- } else {
26263
- delete config2.localProviders;
26264
- }
26265
- saveConfig(config2);
26266
- }
26267
- var CONFIG_DIR, CONFIG_FILE, LOCAL_CONFIG_FILENAME = ".claudish.json", DEFAULT_CONFIG;
26268
- var init_profile_config = __esm(() => {
26269
- CONFIG_DIR = join4(homedir3(), ".claudish");
26270
- CONFIG_FILE = join4(CONFIG_DIR, "config.json");
26271
- DEFAULT_CONFIG = {
26272
- version: "1.0.0",
26273
- defaultProfile: "default",
26274
- profiles: {
26275
- default: {
26276
- name: "default",
26277
- description: "Default profile - shows model selector when no model specified",
26278
- models: {},
26279
- createdAt: new Date().toISOString(),
26280
- updatedAt: new Date().toISOString()
26281
- }
26282
- }
26283
- };
26284
- });
26285
-
26286
29101
  // src/providers/provider-definitions.ts
26287
29102
  import { existsSync as existsSync4 } from "fs";
26288
29103
  import { join as join5 } from "path";
@@ -33159,9 +35974,6 @@ var init_vision_proxy = __esm(() => {
33159
35974
  init_catalog_query();
33160
35975
  });
33161
35976
 
33162
- // src/version.ts
33163
- var VERSION = "7.5.0";
33164
-
33165
35977
  // src/telemetry.ts
33166
35978
  var exports_telemetry = {};
33167
35979
  __export(exports_telemetry, {
@@ -33596,7 +36408,7 @@ import {
33596
36408
  mkdirSync as mkdirSync7,
33597
36409
  readFileSync as readFileSync4,
33598
36410
  renameSync,
33599
- unlinkSync as unlinkSync3,
36411
+ unlinkSync as unlinkSync2,
33600
36412
  writeFileSync as writeFileSync7
33601
36413
  } from "fs";
33602
36414
  import { homedir as homedir7 } from "os";
@@ -33680,7 +36492,7 @@ function clearBuffer() {
33680
36492
  memoryCache = [];
33681
36493
  eventsSinceLastFlush = 0;
33682
36494
  if (existsSync6(BUFFER_FILE)) {
33683
- unlinkSync3(BUFFER_FILE);
36495
+ unlinkSync2(BUFFER_FILE);
33684
36496
  }
33685
36497
  } catch {}
33686
36498
  }
@@ -36236,7 +39048,7 @@ var init_gemini_apikey = __esm(() => {
36236
39048
  // src/auth/gemini-oauth.ts
36237
39049
  import { createServer } from "http";
36238
39050
  import { randomBytes as randomBytes2, createHash } from "crypto";
36239
- import { readFileSync as readFileSync8, existsSync as existsSync11, unlinkSync as unlinkSync4, openSync, writeSync, closeSync } from "fs";
39051
+ import { readFileSync as readFileSync8, existsSync as existsSync11, unlinkSync as unlinkSync3, openSync, writeSync, closeSync } from "fs";
36240
39052
  import { homedir as homedir12 } from "os";
36241
39053
  import { join as join13 } from "path";
36242
39054
  import { exec } from "child_process";
@@ -36284,7 +39096,7 @@ class GeminiOAuth {
36284
39096
  async logout() {
36285
39097
  const credPath = this.getCredentialsPath();
36286
39098
  if (existsSync11(credPath)) {
36287
- unlinkSync4(credPath);
39099
+ unlinkSync3(credPath);
36288
39100
  log("[GeminiOAuth] Credentials deleted");
36289
39101
  }
36290
39102
  this.credentials = null;
@@ -37088,7 +39900,7 @@ var init_openai = __esm(() => {
37088
39900
  // src/auth/codex-oauth.ts
37089
39901
  import { exec as exec2 } from "child_process";
37090
39902
  import { createHash as createHash2, randomBytes as randomBytes3 } from "crypto";
37091
- import { closeSync as closeSync2, existsSync as existsSync12, openSync as openSync2, readFileSync as readFileSync9, unlinkSync as unlinkSync5, writeSync as writeSync2 } from "fs";
39903
+ import { closeSync as closeSync2, existsSync as existsSync12, openSync as openSync2, readFileSync as readFileSync9, unlinkSync as unlinkSync4, writeSync as writeSync2 } from "fs";
37092
39904
  import { createServer as createServer2 } from "http";
37093
39905
  import { homedir as homedir13 } from "os";
37094
39906
  import { join as join14 } from "path";
@@ -37141,7 +39953,7 @@ class CodexOAuth {
37141
39953
  async logout() {
37142
39954
  const credPath = this.getCredentialsPath();
37143
39955
  if (existsSync12(credPath)) {
37144
- unlinkSync5(credPath);
39956
+ unlinkSync4(credPath);
37145
39957
  log("[CodexOAuth] Credentials deleted");
37146
39958
  }
37147
39959
  this.credentials = null;
@@ -37537,7 +40349,7 @@ var init_openai_codex = __esm(() => {
37537
40349
 
37538
40350
  // src/auth/kimi-oauth.ts
37539
40351
  import { randomBytes as randomBytes4 } from "crypto";
37540
- import { readFileSync as readFileSync11, existsSync as existsSync14, unlinkSync as unlinkSync6, openSync as openSync3, writeSync as writeSync3, closeSync as closeSync3 } from "fs";
40352
+ import { readFileSync as readFileSync11, existsSync as existsSync14, unlinkSync as unlinkSync5, openSync as openSync3, writeSync as writeSync3, closeSync as closeSync3 } from "fs";
37541
40353
  import { homedir as homedir15, hostname as hostname3, platform, release } from "os";
37542
40354
  import { join as join16 } from "path";
37543
40355
  import { exec as exec3 } from "child_process";
@@ -37750,7 +40562,7 @@ Waiting for authorization...`);
37750
40562
  async logout() {
37751
40563
  const credPath = this.getCredentialsPath();
37752
40564
  if (existsSync14(credPath)) {
37753
- unlinkSync6(credPath);
40565
+ unlinkSync5(credPath);
37754
40566
  log("[KimiOAuth] Credentials deleted");
37755
40567
  }
37756
40568
  this.credentials = null;
@@ -37817,7 +40629,7 @@ Waiting for authorization...`);
37817
40629
  log(`[KimiOAuth] Refresh failed: ${e.message}`);
37818
40630
  const credPath = this.getCredentialsPath();
37819
40631
  if (existsSync14(credPath)) {
37820
- unlinkSync6(credPath);
40632
+ unlinkSync5(credPath);
37821
40633
  }
37822
40634
  this.credentials = null;
37823
40635
  if (process.env.MOONSHOT_API_KEY || process.env.KIMI_API_KEY) {
@@ -39030,7 +41842,7 @@ function buildProviderDefinition(name, ep) {
39030
41842
  function buildProviderProfile(ep) {
39031
41843
  return {
39032
41844
  createHandler(ctx) {
39033
- const apiKey = resolveCustomEndpointApiKey(ep);
41845
+ const apiKey = process.env[ctx.provider.apiKeyEnvVar] || resolveCustomEndpointApiKey(ep);
39034
41846
  if (ep.kind === "simple") {
39035
41847
  return buildSimpleHandler(ep, ctx, apiKey);
39036
41848
  }
@@ -39133,9 +41945,10 @@ function buildComplexHandler(ep, ctx, apiKey) {
39133
41945
  function resolveCustomEndpointApiKey(ep) {
39134
41946
  const literal3 = ep.apiKey;
39135
41947
  const match2 = literal3.match(/^\$\{([A-Z_][A-Z0-9_]*)\}$/i);
39136
- if (!match2)
39137
- return literal3;
39138
- return process.env[match2[1]] ?? "";
41948
+ if (match2) {
41949
+ return process.env[match2[1]] ?? "";
41950
+ }
41951
+ return literal3;
39139
41952
  }
39140
41953
  function stripTrailingSlash(url2) {
39141
41954
  return url2.replace(/\/+$/, "");
@@ -52074,8 +54887,8 @@ var init_RemoveFileError = __esm(() => {
52074
54887
  });
52075
54888
 
52076
54889
  // ../../node_modules/.bun/@inquirer+external-editor@2.0.1+04f2146be16c61ef/node_modules/@inquirer/external-editor/dist/index.js
52077
- import { spawn as spawn3, spawnSync } from "child_process";
52078
- import { readFileSync as readFileSync17, unlinkSync as unlinkSync7, writeFileSync as writeFileSync10 } from "fs";
54890
+ import { spawn as spawn3, spawnSync as spawnSync2 } from "child_process";
54891
+ import { readFileSync as readFileSync17, unlinkSync as unlinkSync6, writeFileSync as writeFileSync10 } from "fs";
52079
54892
  import path from "path";
52080
54893
  import os from "os";
52081
54894
  import { randomUUID as randomUUID3 } from "crypto";
@@ -52207,14 +55020,14 @@ class ExternalEditor {
52207
55020
  }
52208
55021
  removeTemporaryFile() {
52209
55022
  try {
52210
- unlinkSync7(this.tempFile);
55023
+ unlinkSync6(this.tempFile);
52211
55024
  } catch (removeFileError) {
52212
55025
  throw new RemoveFileError(removeFileError);
52213
55026
  }
52214
55027
  }
52215
55028
  launchEditor() {
52216
55029
  try {
52217
- const editorProcess = spawnSync(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
55030
+ const editorProcess = spawnSync2(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
52218
55031
  this.lastExitStatus = editorProcess.status ?? 0;
52219
55032
  } catch (launchError) {
52220
55033
  throw new LaunchEditorError(launchError);
@@ -57139,7 +59952,7 @@ import {
57139
59952
  mkdirSync as mkdirSync10,
57140
59953
  copyFileSync,
57141
59954
  readdirSync as readdirSync4,
57142
- unlinkSync as unlinkSync8,
59955
+ unlinkSync as unlinkSync7,
57143
59956
  writeFileSync as writeFileSync11
57144
59957
  } from "fs";
57145
59958
  import { fileURLToPath as fileURLToPath2 } from "url";
@@ -57158,7 +59971,7 @@ function clearAllModelCaches() {
57158
59971
  const files = readdirSync4(cacheDir);
57159
59972
  for (const file2 of files) {
57160
59973
  if (cachePatterns.includes(file2)) {
57161
- unlinkSync8(join21(cacheDir, file2));
59974
+ unlinkSync7(join21(cacheDir, file2));
57162
59975
  cleared++;
57163
59976
  }
57164
59977
  }
@@ -57341,6 +60154,20 @@ async function parseArgs(args) {
57341
60154
  process.exit(1);
57342
60155
  }
57343
60156
  config3.defaultProvider = dpArg;
60157
+ } else if (arg === "--op-env" || arg.startsWith("--op-env=")) {
60158
+ const v = arg.startsWith("--op-env=") ? arg.slice("--op-env=".length) : args[++i];
60159
+ if (!v) {
60160
+ console.error("--op-env requires a 1Password Environment ID");
60161
+ process.exit(1);
60162
+ }
60163
+ config3.opEnv = v;
60164
+ } else if (arg === "--op" || arg.startsWith("--op=")) {
60165
+ const v = arg.startsWith("--op=") ? arg.slice("--op=".length) : args[++i];
60166
+ if (!v) {
60167
+ console.error("--op requires an op:// glob path");
60168
+ process.exit(1);
60169
+ }
60170
+ config3.opImport = v;
57344
60171
  } else if (arg === "--cost-tracker") {
57345
60172
  config3.costTracking = true;
57346
60173
  if (!config3.monitor) {
@@ -58403,6 +61230,10 @@ OPTIONS:
58403
61230
  -p, --profile <name> Use named profile for model mapping (default: uses default profile)
58404
61231
  --default-provider <name> Default provider for bare model names (builtin or customEndpoints key)
58405
61232
  Precedence: this flag > CLAUDISH_DEFAULT_PROVIDER env > config.json
61233
+ --op-env <id> Load env vars from a 1Password Environment (highest priority)
61234
+ Requires op CLI >= 2.35 (beta). Resolves op:// refs in config/env too.
61235
+ --op <glob> Load API keys from a 1Password item glob (e.g. op://Vault/Item/*/*_API_KEY)
61236
+ --op <glob> --list Preview which fields the glob would import (names only, no values)
58406
61237
  --port <port> Proxy server port (default: random)
58407
61238
  -d, --debug Enable debug logging to file (logs/claudish_*.log)
58408
61239
  --no-logs Disable always-on structural logging (~/.claudish/logs/)
@@ -58485,6 +61316,12 @@ AUTHENTICATION:
58485
61316
  claudish logout [provider] Clear OAuth credentials (interactive if no provider given)
58486
61317
  Providers: gemini, kimi
58487
61318
 
61319
+ 1PASSWORD:
61320
+ claudish op --list <op://glob> Preview which fields a glob imports (names only)
61321
+ claudish op <op://glob> [...claudish args] Resolve glob into env vars, then run a session
61322
+ Inline run requires a GLOB (self-names via field labels)
61323
+ Example: claudish op 'op://Jack/Keys/*/*_API_KEY' --model gpt-4o "task"
61324
+
58488
61325
  MODEL MAPPING (per-role override):
58489
61326
  --model-opus <model> Model for Opus role (planning, complex tasks)
58490
61327
  --model-sonnet <model> Model for Sonnet role (default coding)
@@ -58806,7 +61643,7 @@ __export(exports_update_checker, {
58806
61643
  clearCache: () => clearCache,
58807
61644
  checkForUpdates: () => checkForUpdates
58808
61645
  });
58809
- import { existsSync as existsSync21, mkdirSync as mkdirSync11, readFileSync as readFileSync19, unlinkSync as unlinkSync9, writeFileSync as writeFileSync12 } from "fs";
61646
+ import { existsSync as existsSync21, mkdirSync as mkdirSync11, readFileSync as readFileSync19, unlinkSync as unlinkSync8, writeFileSync as writeFileSync12 } from "fs";
58810
61647
  import { homedir as homedir21, platform as platform2, tmpdir } from "os";
58811
61648
  import { join as join22 } from "path";
58812
61649
  function getCacheFilePath() {
@@ -58856,7 +61693,7 @@ function clearCache() {
58856
61693
  try {
58857
61694
  const cachePath = getCacheFilePath();
58858
61695
  if (existsSync21(cachePath)) {
58859
- unlinkSync9(cachePath);
61696
+ unlinkSync8(cachePath);
58860
61697
  }
58861
61698
  } catch {}
58862
61699
  }
@@ -63918,7 +66755,7 @@ var exports_tui = {};
63918
66755
  __export(exports_tui, {
63919
66756
  startConfigTui: () => startConfigTui
63920
66757
  });
63921
- import { spawnSync as spawnSync2 } from "child_process";
66758
+ import { spawnSync as spawnSync3 } from "child_process";
63922
66759
  import { createCliRenderer as createCliRenderer2 } from "@opentui/core";
63923
66760
  import { createRoot as createRoot2 } from "@opentui/react";
63924
66761
  import { jsxDEV as jsxDEV14 } from "@opentui/react/jsx-dev-runtime";
@@ -63944,7 +66781,7 @@ async function startConfigTui() {
63944
66781
  console.log(`
63945
66782
  Launching: claudish login ${slug}
63946
66783
  `);
63947
- const result = spawnSync2(process.argv[0], [process.argv[1], "login", slug], {
66784
+ const result = spawnSync3(process.argv[0], [process.argv[1], "login", slug], {
63948
66785
  stdio: "inherit"
63949
66786
  });
63950
66787
  if (result.error) {
@@ -63981,7 +66818,7 @@ __export(exports_claude_runner, {
63981
66818
  checkClaudeInstalled: () => checkClaudeInstalled
63982
66819
  });
63983
66820
  import { spawn as spawn4 } from "child_process";
63984
- import { writeFileSync as writeFileSync14, unlinkSync as unlinkSync10, mkdirSync as mkdirSync13, existsSync as existsSync23, readFileSync as readFileSync21 } from "fs";
66821
+ import { writeFileSync as writeFileSync14, unlinkSync as unlinkSync9, mkdirSync as mkdirSync13, existsSync as existsSync23, readFileSync as readFileSync21 } from "fs";
63985
66822
  import { tmpdir as tmpdir2, homedir as homedir23 } from "os";
63986
66823
  import { join as join24 } from "path";
63987
66824
  function hasNativeAnthropicMapping(config3) {
@@ -64253,7 +67090,7 @@ Or set CLAUDE_PATH to your custom installation:`);
64253
67090
  });
64254
67091
  });
64255
67092
  try {
64256
- unlinkSync10(tempSettingsPath);
67093
+ unlinkSync9(tempSettingsPath);
64257
67094
  } catch {}
64258
67095
  return exitCode;
64259
67096
  }
@@ -64272,7 +67109,7 @@ function setupSignalHandlers(proc, tempSettingsPath, quiet, onCleanup) {
64272
67109
  } catch {}
64273
67110
  }
64274
67111
  try {
64275
- unlinkSync10(tempSettingsPath);
67112
+ unlinkSync9(tempSettingsPath);
64276
67113
  } catch {}
64277
67114
  process.exit(0);
64278
67115
  });
@@ -64362,7 +67199,7 @@ __export(exports_diag_output, {
64362
67199
  NullDiagOutput: () => NullDiagOutput,
64363
67200
  LogFileDiagOutput: () => LogFileDiagOutput
64364
67201
  });
64365
- import { createWriteStream as createWriteStream3, mkdirSync as mkdirSync14, writeFileSync as writeFileSync15, unlinkSync as unlinkSync11 } from "fs";
67202
+ import { createWriteStream as createWriteStream3, mkdirSync as mkdirSync14, writeFileSync as writeFileSync15, unlinkSync as unlinkSync10 } from "fs";
64366
67203
  import { homedir as homedir24 } from "os";
64367
67204
  import { join as join25 } from "path";
64368
67205
  function getClaudishDir() {
@@ -64401,7 +67238,7 @@ class LogFileDiagOutput {
64401
67238
  this.stream.end();
64402
67239
  } catch {}
64403
67240
  try {
64404
- unlinkSync11(this.logPath);
67241
+ unlinkSync10(this.logPath);
64405
67242
  } catch {}
64406
67243
  }
64407
67244
  getLogPath() {
@@ -64856,34 +67693,302 @@ var init_team_grid = __esm(() => {
64856
67693
 
64857
67694
  // src/index.ts
64858
67695
  var import_dotenv3 = __toESM(require_main(), 1);
64859
- import { existsSync as existsSync25, readFileSync as readFileSync23 } from "fs";
67696
+ import { existsSync as existsSync25, readFileSync as readFileSync23, writeFileSync as writeFileSync17 } from "fs";
64860
67697
  import { homedir as homedir25 } from "os";
64861
67698
  import { join as join27 } from "path";
64862
67699
  import_dotenv3.config({ quiet: true });
64863
- function loadStoredApiKeys() {
67700
+ function readConfiguredOnepasswordAccount() {
67701
+ for (const path2 of [
67702
+ join27(process.cwd(), ".claudish.json"),
67703
+ join27(homedir25(), ".claudish", "config.json")
67704
+ ]) {
67705
+ try {
67706
+ if (!existsSync25(path2))
67707
+ continue;
67708
+ const cfg = JSON.parse(readFileSync23(path2, "utf-8"));
67709
+ if (typeof cfg.onepasswordAccount === "string" && cfg.onepasswordAccount.trim()) {
67710
+ return cfg.onepasswordAccount.trim();
67711
+ }
67712
+ } catch {}
67713
+ }
67714
+ return;
67715
+ }
67716
+ async function saveOnepasswordAccount(accountUrl, scope) {
67717
+ try {
67718
+ if (scope === "project") {
67719
+ const path2 = join27(process.cwd(), ".claudish.json");
67720
+ let existing = {};
67721
+ if (existsSync25(path2)) {
67722
+ try {
67723
+ existing = JSON.parse(readFileSync23(path2, "utf-8"));
67724
+ } catch {
67725
+ existing = {};
67726
+ }
67727
+ }
67728
+ existing.onepasswordAccount = accountUrl;
67729
+ writeFileSync17(path2, `${JSON.stringify(existing, null, 2)}
67730
+ `, "utf-8");
67731
+ } else {
67732
+ const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_profile_config(), exports_profile_config));
67733
+ const cfg = loadConfig2();
67734
+ cfg.onepasswordAccount = accountUrl;
67735
+ saveConfig2(cfg);
67736
+ }
67737
+ } catch {}
67738
+ }
67739
+ async function pickSaveScope() {
67740
+ const { createInterface: createInterface2 } = await import("readline");
67741
+ process.stderr.write(`
67742
+ [claudish] Remember this account for:
67743
+ 1) all projects (global ~/.claudish/config.json) [default]
67744
+ 2) this project only (./.claudish.json)
67745
+ `);
67746
+ const answer = await new Promise((resolve3) => {
67747
+ const rl = createInterface2({ input: process.stdin, output: process.stderr });
67748
+ rl.question("Scope [1-2]: ", (ans) => {
67749
+ rl.close();
67750
+ resolve3(ans.trim());
67751
+ });
67752
+ });
67753
+ return answer === "2" ? "project" : "global";
67754
+ }
67755
+ async function pickOnepasswordAccount(accounts) {
67756
+ const { createInterface: createInterface2 } = await import("readline");
67757
+ process.stderr.write(`
67758
+ [claudish] Multiple 1Password accounts found. Choose one:
67759
+ `);
67760
+ accounts.forEach((a, i) => {
67761
+ process.stderr.write(` ${i + 1}) ${a.url}${a.email ? ` (${a.email})` : ""}
67762
+ `);
67763
+ });
67764
+ const answer = await new Promise((resolve3) => {
67765
+ const rl = createInterface2({ input: process.stdin, output: process.stderr });
67766
+ rl.question(`Account [1-${accounts.length}]: `, (ans) => {
67767
+ rl.close();
67768
+ resolve3(ans.trim());
67769
+ });
67770
+ });
67771
+ const idx = Number.parseInt(answer, 10);
67772
+ if (Number.isNaN(idx) || idx < 1 || idx > accounts.length) {
67773
+ process.stderr.write(`[claudish] No valid selection \u2014 aborting 1Password account picker.
67774
+ `);
67775
+ return;
67776
+ }
67777
+ return accounts[idx - 1].url;
67778
+ }
67779
+ var cachedSdkAuth;
67780
+ var sdkAuthResolved = false;
67781
+ async function getSdkAuth() {
67782
+ if (sdkAuthResolved)
67783
+ return cachedSdkAuth;
67784
+ sdkAuthResolved = true;
67785
+ const { resolveSdkAuth: resolveSdkAuth2 } = await Promise.resolve().then(() => (init_onepassword(), exports_onepassword));
67786
+ const interactive = Boolean(process.stdout.isTTY) && !process.argv.includes("--stdin");
67787
+ try {
67788
+ cachedSdkAuth = await resolveSdkAuth2({
67789
+ configAccount: readConfiguredOnepasswordAccount(),
67790
+ interactive,
67791
+ onNeedsPicker: async (accounts) => {
67792
+ const chosen = await pickOnepasswordAccount(accounts);
67793
+ if (chosen) {
67794
+ const scope = await pickSaveScope();
67795
+ await saveOnepasswordAccount(chosen, scope);
67796
+ }
67797
+ return chosen;
67798
+ }
67799
+ });
67800
+ } catch (err) {
67801
+ const message = err instanceof Error ? err.message : String(err);
67802
+ console.error(`[claudish] 1Password authentication failed: ${message}`);
67803
+ process.exit(1);
67804
+ }
67805
+ return cachedSdkAuth;
67806
+ }
67807
+ async function applyOpEnvironment() {
67808
+ const argv = process.argv.slice(2);
67809
+ let envId;
67810
+ for (let i = 0;i < argv.length; i++) {
67811
+ const a = argv[i];
67812
+ if (a === "--op-env") {
67813
+ envId = argv[i + 1];
67814
+ break;
67815
+ }
67816
+ if (a.startsWith("--op-env=")) {
67817
+ envId = a.slice("--op-env=".length);
67818
+ break;
67819
+ }
67820
+ }
67821
+ if (envId === undefined)
67822
+ return;
67823
+ if (envId === "" || envId.startsWith("-")) {
67824
+ console.error("[claudish] --op-env requires a 1Password Environment ID");
67825
+ process.exit(1);
67826
+ }
67827
+ try {
67828
+ const { readEnvironment: readEnvironment2 } = await Promise.resolve().then(() => (init_onepassword(), exports_onepassword));
67829
+ const auth = await getSdkAuth();
67830
+ const vars = await readEnvironment2(envId, { auth });
67831
+ for (const [key, value] of Object.entries(vars)) {
67832
+ process.env[key] = value;
67833
+ }
67834
+ } catch (err) {
67835
+ const message = err instanceof Error ? err.message : String(err);
67836
+ console.error(`[claudish] 1Password Environment load failed: ${message}`);
67837
+ process.exit(1);
67838
+ }
67839
+ }
67840
+ async function applyOpImport() {
67841
+ const argv = process.argv.slice(2);
67842
+ const { parseOpFlag: parseOpFlag2 } = await Promise.resolve().then(() => (init_onepassword(), exports_onepassword));
67843
+ const parsed = parseOpFlag2(argv);
67844
+ if (!parsed.present)
67845
+ return;
67846
+ if (parsed.glob === undefined) {
67847
+ console.error("[claudish] --op requires an op:// glob path");
67848
+ process.exit(1);
67849
+ }
67850
+ const glob = parsed.glob;
67851
+ if (parsed.list) {
67852
+ try {
67853
+ const { opPreviewCommand: opPreviewCommand2 } = await Promise.resolve().then(() => (init_onepassword_command(), exports_onepassword_command));
67854
+ const auth = await getSdkAuth();
67855
+ await opPreviewCommand2(glob, { auth });
67856
+ } catch (err) {
67857
+ const message = err instanceof Error ? err.message : String(err);
67858
+ console.error(`[claudish] 1Password --op preview failed: ${message}`);
67859
+ process.exit(1);
67860
+ }
67861
+ process.exit(0);
67862
+ }
67863
+ try {
67864
+ const { resolveGlobImport: resolveGlobImport2 } = await Promise.resolve().then(() => (init_onepassword(), exports_onepassword));
67865
+ const auth = await getSdkAuth();
67866
+ const resolved = await resolveGlobImport2(glob, { auth });
67867
+ for (const [key, value] of Object.entries(resolved)) {
67868
+ process.env[key] = value;
67869
+ }
67870
+ } catch (err) {
67871
+ const message = err instanceof Error ? err.message : String(err);
67872
+ console.error(`[claudish] 1Password --op import failed: ${message}`);
67873
+ process.exit(1);
67874
+ }
67875
+ const head = process.argv.slice(0, 2);
67876
+ const rebuilt = [];
67877
+ for (let i = 0;i < argv.length; i++) {
67878
+ const a = argv[i];
67879
+ if (a === "--op") {
67880
+ i++;
67881
+ continue;
67882
+ }
67883
+ if (a.startsWith("--op=")) {
67884
+ continue;
67885
+ }
67886
+ rebuilt.push(a);
67887
+ }
67888
+ process.argv = [...head, ...rebuilt];
67889
+ }
67890
+ async function loadStoredApiKeys() {
67891
+ let opRefs = {};
67892
+ let globImports = [];
67893
+ let apiKeysForSeed;
64864
67894
  try {
64865
67895
  const configPath = join27(homedir25(), ".claudish", "config.json");
64866
67896
  if (!existsSync25(configPath))
64867
67897
  return;
64868
67898
  const raw2 = readFileSync23(configPath, "utf-8");
64869
67899
  const cfg = JSON.parse(raw2);
64870
- if (cfg.apiKeys) {
64871
- for (const [envVar, value] of Object.entries(cfg.apiKeys)) {
64872
- if (!process.env[envVar] && typeof value === "string") {
67900
+ const seedSources = [cfg.apiKeys, cfg.endpoints];
67901
+ const mergedApiKeys = {};
67902
+ for (const source of seedSources) {
67903
+ if (!source)
67904
+ continue;
67905
+ for (const [envVar, value] of Object.entries(source)) {
67906
+ if (typeof value !== "string")
67907
+ continue;
67908
+ if (!process.env[envVar]) {
64873
67909
  process.env[envVar] = value;
64874
67910
  }
67911
+ mergedApiKeys[envVar] = value;
64875
67912
  }
64876
67913
  }
64877
- if (cfg.endpoints) {
64878
- for (const [envVar, value] of Object.entries(cfg.endpoints)) {
64879
- if (!process.env[envVar] && typeof value === "string") {
67914
+ apiKeysForSeed = mergedApiKeys;
67915
+ const { collectConfigImports: collectConfigImports2 } = await Promise.resolve().then(() => (init_onepassword(), exports_onepassword));
67916
+ const collected = collectConfigImports2({ apiKeys: apiKeysForSeed, onepassword: cfg.onepassword }, process.env);
67917
+ opRefs = collected.opRefs;
67918
+ globImports = collected.globImports;
67919
+ for (const w of collected.warnings)
67920
+ console.error(w);
67921
+ } catch {}
67922
+ const refKeys = Object.keys(opRefs);
67923
+ if (refKeys.length === 0 && globImports.length === 0)
67924
+ return;
67925
+ try {
67926
+ const { resolveSecrets: resolveSecrets2, resolveGlobImport: resolveGlobImport2 } = await Promise.resolve().then(() => (init_onepassword(), exports_onepassword));
67927
+ const auth = await getSdkAuth();
67928
+ if (refKeys.length > 0) {
67929
+ const resolved = await resolveSecrets2(opRefs, { auth });
67930
+ for (const [envVar, value] of Object.entries(resolved)) {
67931
+ process.env[envVar] = value;
67932
+ }
67933
+ }
67934
+ for (const globPath of globImports) {
67935
+ const resolved = await resolveGlobImport2(globPath, { auth });
67936
+ for (const [envVar, value] of Object.entries(resolved)) {
67937
+ if (!process.env[envVar]) {
64880
67938
  process.env[envVar] = value;
64881
67939
  }
64882
67940
  }
64883
67941
  }
64884
- } catch {}
67942
+ } catch (err) {
67943
+ const message = err instanceof Error ? err.message : String(err);
67944
+ console.error(`[claudish] 1Password secret resolution failed: ${message}`);
67945
+ process.exit(1);
67946
+ }
67947
+ }
67948
+ async function applyCustomEndpointOpKeys() {
67949
+ let refs = {};
67950
+ try {
67951
+ const configPath = join27(homedir25(), ".claudish", "config.json");
67952
+ if (!existsSync25(configPath))
67953
+ return;
67954
+ const cfg = JSON.parse(readFileSync23(configPath, "utf-8"));
67955
+ const endpoints = cfg.customEndpoints;
67956
+ if (!endpoints || typeof endpoints !== "object")
67957
+ return;
67958
+ const { isOpReference: isOpReference2 } = await Promise.resolve().then(() => (init_onepassword(), exports_onepassword));
67959
+ for (const [name, raw2] of Object.entries(endpoints)) {
67960
+ if (!raw2 || typeof raw2 !== "object")
67961
+ continue;
67962
+ const apiKey = raw2.apiKey;
67963
+ if (typeof apiKey !== "string" || !isOpReference2(apiKey))
67964
+ continue;
67965
+ const envVar = `CUSTOM_${name.toUpperCase().replace(/[^A-Z0-9]/g, "_")}_KEY`;
67966
+ if (process.env[envVar])
67967
+ continue;
67968
+ refs[envVar] = apiKey;
67969
+ }
67970
+ } catch {
67971
+ refs = {};
67972
+ }
67973
+ if (Object.keys(refs).length === 0)
67974
+ return;
67975
+ try {
67976
+ const { resolveSecrets: resolveSecrets2 } = await Promise.resolve().then(() => (init_onepassword(), exports_onepassword));
67977
+ const auth = await getSdkAuth();
67978
+ const resolved = await resolveSecrets2(refs, { auth });
67979
+ for (const [envVar, value] of Object.entries(resolved)) {
67980
+ process.env[envVar] = value;
67981
+ }
67982
+ } catch (err) {
67983
+ const message = err instanceof Error ? err.message : String(err);
67984
+ console.error(`[claudish] 1Password custom-endpoint key resolution failed: ${message}`);
67985
+ process.exit(1);
67986
+ }
64885
67987
  }
64886
- loadStoredApiKeys();
67988
+ await applyOpEnvironment();
67989
+ await applyOpImport();
67990
+ await loadStoredApiKeys();
67991
+ await applyCustomEndpointOpKeys();
64887
67992
  var isMcpMode = process.argv.includes("--mcp");
64888
67993
  function handlePromptExit(err) {
64889
67994
  if (err && typeof err === "object" && "name" in err && err.name === "ExitPromptError") {