@dexto/agent-management 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/LICENSE +44 -0
  2. package/dist/AgentOrchestrator.cjs +263 -0
  3. package/dist/AgentOrchestrator.d.ts +191 -0
  4. package/dist/AgentOrchestrator.d.ts.map +1 -0
  5. package/dist/AgentOrchestrator.js +239 -0
  6. package/dist/config/config-enrichment.cjs +117 -0
  7. package/dist/config/config-enrichment.d.ts +31 -0
  8. package/dist/config/config-enrichment.d.ts.map +1 -0
  9. package/dist/config/config-enrichment.js +82 -0
  10. package/dist/config/config-manager.cjs +57 -0
  11. package/dist/config/config-manager.d.ts +51 -0
  12. package/dist/config/config-manager.d.ts.map +1 -0
  13. package/dist/config/config-manager.js +32 -0
  14. package/dist/config/error-codes.cjs +39 -0
  15. package/dist/config/error-codes.d.ts +16 -0
  16. package/dist/config/error-codes.d.ts.map +1 -0
  17. package/dist/config/error-codes.js +15 -0
  18. package/dist/config/errors.cjs +125 -0
  19. package/dist/config/errors.d.ts +34 -0
  20. package/dist/config/errors.d.ts.map +1 -0
  21. package/dist/config/errors.js +101 -0
  22. package/dist/config/index.cjs +44 -0
  23. package/dist/config/index.d.ts +6 -0
  24. package/dist/config/index.d.ts.map +1 -0
  25. package/dist/config/index.js +14 -0
  26. package/dist/config/loader.cjs +118 -0
  27. package/dist/config/loader.d.ts +18 -0
  28. package/dist/config/loader.d.ts.map +1 -0
  29. package/dist/config/loader.js +84 -0
  30. package/dist/index.cjs +132 -0
  31. package/dist/index.d.ts +20 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +104 -0
  34. package/dist/preferences/constants.cjs +28 -0
  35. package/dist/preferences/constants.d.ts +2 -0
  36. package/dist/preferences/constants.d.ts.map +1 -0
  37. package/dist/preferences/constants.js +4 -0
  38. package/dist/preferences/error-codes.cjs +35 -0
  39. package/dist/preferences/error-codes.d.ts +8 -0
  40. package/dist/preferences/error-codes.d.ts.map +1 -0
  41. package/dist/preferences/error-codes.js +11 -0
  42. package/dist/preferences/errors.cjs +74 -0
  43. package/dist/preferences/errors.d.ts +18 -0
  44. package/dist/preferences/errors.d.ts.map +1 -0
  45. package/dist/preferences/errors.js +49 -0
  46. package/dist/preferences/index.cjs +55 -0
  47. package/dist/preferences/index.d.ts +6 -0
  48. package/dist/preferences/index.d.ts.map +1 -0
  49. package/dist/preferences/index.js +31 -0
  50. package/dist/preferences/loader.cjs +138 -0
  51. package/dist/preferences/loader.d.ts +50 -0
  52. package/dist/preferences/loader.d.ts.map +1 -0
  53. package/dist/preferences/loader.js +109 -0
  54. package/dist/preferences/schemas.cjs +75 -0
  55. package/dist/preferences/schemas.d.ts +110 -0
  56. package/dist/preferences/schemas.d.ts.map +1 -0
  57. package/dist/preferences/schemas.js +48 -0
  58. package/dist/registry/error-codes.cjs +44 -0
  59. package/dist/registry/error-codes.d.ts +21 -0
  60. package/dist/registry/error-codes.d.ts.map +1 -0
  61. package/dist/registry/error-codes.js +20 -0
  62. package/dist/registry/errors.cjs +187 -0
  63. package/dist/registry/errors.d.ts +63 -0
  64. package/dist/registry/errors.d.ts.map +1 -0
  65. package/dist/registry/errors.js +163 -0
  66. package/dist/registry/registry.cjs +479 -0
  67. package/dist/registry/registry.d.ts +130 -0
  68. package/dist/registry/registry.d.ts.map +1 -0
  69. package/dist/registry/registry.js +452 -0
  70. package/dist/registry/types.cjs +74 -0
  71. package/dist/registry/types.d.ts +142 -0
  72. package/dist/registry/types.d.ts.map +1 -0
  73. package/dist/registry/types.js +47 -0
  74. package/dist/registry/user-registry.cjs +140 -0
  75. package/dist/registry/user-registry.d.ts +34 -0
  76. package/dist/registry/user-registry.d.ts.map +1 -0
  77. package/dist/registry/user-registry.js +104 -0
  78. package/dist/resolver.cjs +182 -0
  79. package/dist/resolver.d.ts +14 -0
  80. package/dist/resolver.d.ts.map +1 -0
  81. package/dist/resolver.js +151 -0
  82. package/dist/utils/api-key-resolver.cjs +62 -0
  83. package/dist/utils/api-key-resolver.d.ts +21 -0
  84. package/dist/utils/api-key-resolver.d.ts.map +1 -0
  85. package/dist/utils/api-key-resolver.js +36 -0
  86. package/dist/utils/api-key-store.cjs +56 -0
  87. package/dist/utils/api-key-store.d.ts +18 -0
  88. package/dist/utils/api-key-store.d.ts.map +1 -0
  89. package/dist/utils/api-key-store.js +30 -0
  90. package/dist/utils/env-file.cjs +118 -0
  91. package/dist/utils/env-file.d.ts +5 -0
  92. package/dist/utils/env-file.d.ts.map +1 -0
  93. package/dist/utils/env-file.js +84 -0
  94. package/dist/utils/execution-context.cjs +85 -0
  95. package/dist/utils/execution-context.d.ts +20 -0
  96. package/dist/utils/execution-context.d.ts.map +1 -0
  97. package/dist/utils/execution-context.js +49 -0
  98. package/dist/utils/fs-walk.cjs +52 -0
  99. package/dist/utils/fs-walk.d.ts +8 -0
  100. package/dist/utils/fs-walk.d.ts.map +1 -0
  101. package/dist/utils/fs-walk.js +18 -0
  102. package/dist/utils/path.cjs +205 -0
  103. package/dist/utils/path.d.ts +58 -0
  104. package/dist/utils/path.d.ts.map +1 -0
  105. package/dist/utils/path.js +167 -0
  106. package/dist/writer.cjs +182 -0
  107. package/dist/writer.d.ts +34 -0
  108. package/dist/writer.d.ts.map +1 -0
  109. package/dist/writer.js +146 -0
  110. package/package.json +41 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ __export(index_exports, {
21
+ AgentOrchestrator: () => import_AgentOrchestrator.AgentOrchestrator,
22
+ ConfigError: () => import_config.ConfigError,
23
+ ConfigErrorCode: () => import_config.ConfigErrorCode,
24
+ Dexto: () => import_AgentOrchestrator2.AgentOrchestrator,
25
+ PROVIDER_API_KEY_MAP: () => import_api_key_resolver.PROVIDER_API_KEY_MAP,
26
+ PreferenceError: () => import_errors2.PreferenceError,
27
+ PreferenceErrorCode: () => import_errors2.PreferenceErrorCode,
28
+ RegistryError: () => import_errors.RegistryError,
29
+ RegistryErrorCode: () => import_error_codes.RegistryErrorCode,
30
+ copyDirectory: () => import_path.copyDirectory,
31
+ createInitialPreferences: () => import_loader.createInitialPreferences,
32
+ deriveAgentId: () => import_config.deriveAgentId,
33
+ deriveDisplayName: () => import_types.deriveDisplayName,
34
+ enrichAgentConfig: () => import_config.enrichAgentConfig,
35
+ ensureDextoGlobalDirectory: () => import_path.ensureDextoGlobalDirectory,
36
+ findDextoProjectRoot: () => import_execution_context.findDextoProjectRoot,
37
+ findDextoSourceRoot: () => import_execution_context.findDextoSourceRoot,
38
+ findPackageRoot: () => import_path.findPackageRoot,
39
+ getAgentRegistry: () => import_registry.getAgentRegistry,
40
+ getDextoEnvPath: () => import_path.getDextoEnvPath,
41
+ getDextoGlobalPath: () => import_path.getDextoGlobalPath,
42
+ getDextoPath: () => import_path.getDextoPath,
43
+ getExecutionContext: () => import_execution_context.getExecutionContext,
44
+ getGlobalPreferencesPath: () => import_loader.getGlobalPreferencesPath,
45
+ getPrimaryApiKeyEnvVar: () => import_api_key_resolver.getPrimaryApiKeyEnvVar,
46
+ getProviderKeyStatus: () => import_api_key_store.getProviderKeyStatus,
47
+ globalPreferencesExist: () => import_loader.globalPreferencesExist,
48
+ isPath: () => import_path.isPath,
49
+ listProviderKeyStatus: () => import_api_key_store.listProviderKeyStatus,
50
+ loadAgentConfig: () => import_config.loadAgentConfig,
51
+ loadGlobalPreferences: () => import_loader.loadGlobalPreferences,
52
+ reloadAgentConfigFromFile: () => import_config.reloadAgentConfigFromFile,
53
+ resolveAgentPath: () => import_resolver.resolveAgentPath,
54
+ resolveApiKeyForProvider: () => import_api_key_resolver.resolveApiKeyForProvider,
55
+ resolveBundledScript: () => import_path.resolveBundledScript,
56
+ saveGlobalPreferences: () => import_loader.saveGlobalPreferences,
57
+ saveProviderApiKey: () => import_api_key_store.saveProviderApiKey,
58
+ updateAgentConfigFile: () => import_config.updateAgentConfigFile,
59
+ updateDefaultAgentPreference: () => import_resolver.updateDefaultAgentPreference,
60
+ updateEnvFile: () => import_env_file.updateEnvFile,
61
+ updateGlobalPreferences: () => import_loader.updateGlobalPreferences,
62
+ walkUpDirectories: () => import_fs_walk.walkUpDirectories,
63
+ writeConfigFile: () => import_writer.writeConfigFile,
64
+ writeLLMPreferences: () => import_writer.writeLLMPreferences,
65
+ writePreferencesToAgent: () => import_writer.writePreferencesToAgent
66
+ });
67
+ module.exports = __toCommonJS(index_exports);
68
+ var import_registry = require("./registry/registry.js");
69
+ var import_types = require("./registry/types.js");
70
+ var import_errors = require("./registry/errors.js");
71
+ var import_error_codes = require("./registry/error-codes.js");
72
+ var import_loader = require("./preferences/loader.js");
73
+ var import_errors2 = require("./preferences/errors.js");
74
+ var import_resolver = require("./resolver.js");
75
+ var import_writer = require("./writer.js");
76
+ var import_AgentOrchestrator = require("./AgentOrchestrator.js");
77
+ var import_AgentOrchestrator2 = require("./AgentOrchestrator.js");
78
+ var import_path = require("./utils/path.js");
79
+ var import_execution_context = require("./utils/execution-context.js");
80
+ var import_fs_walk = require("./utils/fs-walk.js");
81
+ var import_env_file = require("./utils/env-file.js");
82
+ var import_config = require("./config/index.js");
83
+ var import_api_key_store = require("./utils/api-key-store.js");
84
+ var import_api_key_resolver = require("./utils/api-key-resolver.js");
85
+ // Annotate the CommonJS export names for ESM import in node:
86
+ 0 && (module.exports = {
87
+ AgentOrchestrator,
88
+ ConfigError,
89
+ ConfigErrorCode,
90
+ Dexto,
91
+ PROVIDER_API_KEY_MAP,
92
+ PreferenceError,
93
+ PreferenceErrorCode,
94
+ RegistryError,
95
+ RegistryErrorCode,
96
+ copyDirectory,
97
+ createInitialPreferences,
98
+ deriveAgentId,
99
+ deriveDisplayName,
100
+ enrichAgentConfig,
101
+ ensureDextoGlobalDirectory,
102
+ findDextoProjectRoot,
103
+ findDextoSourceRoot,
104
+ findPackageRoot,
105
+ getAgentRegistry,
106
+ getDextoEnvPath,
107
+ getDextoGlobalPath,
108
+ getDextoPath,
109
+ getExecutionContext,
110
+ getGlobalPreferencesPath,
111
+ getPrimaryApiKeyEnvVar,
112
+ getProviderKeyStatus,
113
+ globalPreferencesExist,
114
+ isPath,
115
+ listProviderKeyStatus,
116
+ loadAgentConfig,
117
+ loadGlobalPreferences,
118
+ reloadAgentConfigFromFile,
119
+ resolveAgentPath,
120
+ resolveApiKeyForProvider,
121
+ resolveBundledScript,
122
+ saveGlobalPreferences,
123
+ saveProviderApiKey,
124
+ updateAgentConfigFile,
125
+ updateDefaultAgentPreference,
126
+ updateEnvFile,
127
+ updateGlobalPreferences,
128
+ walkUpDirectories,
129
+ writeConfigFile,
130
+ writeLLMPreferences,
131
+ writePreferencesToAgent
132
+ });
@@ -0,0 +1,20 @@
1
+ export { getAgentRegistry } from './registry/registry.js';
2
+ export type { AgentRegistry, AgentRegistryEntry, Registry } from './registry/types.js';
3
+ export { deriveDisplayName } from './registry/types.js';
4
+ export { RegistryError } from './registry/errors.js';
5
+ export { RegistryErrorCode } from './registry/error-codes.js';
6
+ export { loadGlobalPreferences, saveGlobalPreferences, globalPreferencesExist, getGlobalPreferencesPath, createInitialPreferences, updateGlobalPreferences, type GlobalPreferencesUpdates, } from './preferences/loader.js';
7
+ export type { GlobalPreferences } from './preferences/schemas.js';
8
+ export { PreferenceError, PreferenceErrorCode } from './preferences/errors.js';
9
+ export { resolveAgentPath, updateDefaultAgentPreference } from './resolver.js';
10
+ export { writeConfigFile, writeLLMPreferences, writePreferencesToAgent, type LLMOverrides, } from './writer.js';
11
+ export { AgentOrchestrator } from './AgentOrchestrator.js';
12
+ export { AgentOrchestrator as Dexto } from './AgentOrchestrator.js';
13
+ export { getDextoPath, getDextoGlobalPath, getDextoEnvPath, copyDirectory, isPath, findPackageRoot, resolveBundledScript, ensureDextoGlobalDirectory, } from './utils/path.js';
14
+ export { getExecutionContext, findDextoSourceRoot, findDextoProjectRoot, type ExecutionContext, } from './utils/execution-context.js';
15
+ export { walkUpDirectories } from './utils/fs-walk.js';
16
+ export { updateEnvFile } from './utils/env-file.js';
17
+ export { updateAgentConfigFile, reloadAgentConfigFromFile, loadAgentConfig, enrichAgentConfig, deriveAgentId, ConfigError, ConfigErrorCode, } from './config/index.js';
18
+ export { saveProviderApiKey, getProviderKeyStatus, listProviderKeyStatus, } from './utils/api-key-store.js';
19
+ export { resolveApiKeyForProvider, getPrimaryApiKeyEnvVar, PROVIDER_API_KEY_MAP, } from './utils/api-key-resolver.js';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,EACH,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,wBAAwB,GAChC,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG/E,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAG/E,OAAO,EACH,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,YAAY,GACpB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAE,iBAAiB,IAAI,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAGpE,OAAO,EACH,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,MAAM,EACN,eAAe,EACf,oBAAoB,EACpB,0BAA0B,GAC7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,gBAAgB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EACH,qBAAqB,EACrB,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,eAAe,GAClB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACH,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACH,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,GACvB,MAAM,6BAA6B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,104 @@
1
+ import { getAgentRegistry } from "./registry/registry.js";
2
+ import { deriveDisplayName } from "./registry/types.js";
3
+ import { RegistryError } from "./registry/errors.js";
4
+ import { RegistryErrorCode } from "./registry/error-codes.js";
5
+ import {
6
+ loadGlobalPreferences,
7
+ saveGlobalPreferences,
8
+ globalPreferencesExist,
9
+ getGlobalPreferencesPath,
10
+ createInitialPreferences,
11
+ updateGlobalPreferences
12
+ } from "./preferences/loader.js";
13
+ import { PreferenceError, PreferenceErrorCode } from "./preferences/errors.js";
14
+ import { resolveAgentPath, updateDefaultAgentPreference } from "./resolver.js";
15
+ import {
16
+ writeConfigFile,
17
+ writeLLMPreferences,
18
+ writePreferencesToAgent
19
+ } from "./writer.js";
20
+ import { AgentOrchestrator } from "./AgentOrchestrator.js";
21
+ import { AgentOrchestrator as AgentOrchestrator2 } from "./AgentOrchestrator.js";
22
+ import {
23
+ getDextoPath,
24
+ getDextoGlobalPath,
25
+ getDextoEnvPath,
26
+ copyDirectory,
27
+ isPath,
28
+ findPackageRoot,
29
+ resolveBundledScript,
30
+ ensureDextoGlobalDirectory
31
+ } from "./utils/path.js";
32
+ import {
33
+ getExecutionContext,
34
+ findDextoSourceRoot,
35
+ findDextoProjectRoot
36
+ } from "./utils/execution-context.js";
37
+ import { walkUpDirectories } from "./utils/fs-walk.js";
38
+ import { updateEnvFile } from "./utils/env-file.js";
39
+ import {
40
+ updateAgentConfigFile,
41
+ reloadAgentConfigFromFile,
42
+ loadAgentConfig,
43
+ enrichAgentConfig,
44
+ deriveAgentId,
45
+ ConfigError,
46
+ ConfigErrorCode
47
+ } from "./config/index.js";
48
+ import {
49
+ saveProviderApiKey,
50
+ getProviderKeyStatus,
51
+ listProviderKeyStatus
52
+ } from "./utils/api-key-store.js";
53
+ import {
54
+ resolveApiKeyForProvider,
55
+ getPrimaryApiKeyEnvVar,
56
+ PROVIDER_API_KEY_MAP
57
+ } from "./utils/api-key-resolver.js";
58
+ export {
59
+ AgentOrchestrator,
60
+ ConfigError,
61
+ ConfigErrorCode,
62
+ AgentOrchestrator2 as Dexto,
63
+ PROVIDER_API_KEY_MAP,
64
+ PreferenceError,
65
+ PreferenceErrorCode,
66
+ RegistryError,
67
+ RegistryErrorCode,
68
+ copyDirectory,
69
+ createInitialPreferences,
70
+ deriveAgentId,
71
+ deriveDisplayName,
72
+ enrichAgentConfig,
73
+ ensureDextoGlobalDirectory,
74
+ findDextoProjectRoot,
75
+ findDextoSourceRoot,
76
+ findPackageRoot,
77
+ getAgentRegistry,
78
+ getDextoEnvPath,
79
+ getDextoGlobalPath,
80
+ getDextoPath,
81
+ getExecutionContext,
82
+ getGlobalPreferencesPath,
83
+ getPrimaryApiKeyEnvVar,
84
+ getProviderKeyStatus,
85
+ globalPreferencesExist,
86
+ isPath,
87
+ listProviderKeyStatus,
88
+ loadAgentConfig,
89
+ loadGlobalPreferences,
90
+ reloadAgentConfigFromFile,
91
+ resolveAgentPath,
92
+ resolveApiKeyForProvider,
93
+ resolveBundledScript,
94
+ saveGlobalPreferences,
95
+ saveProviderApiKey,
96
+ updateAgentConfigFile,
97
+ updateDefaultAgentPreference,
98
+ updateEnvFile,
99
+ updateGlobalPreferences,
100
+ walkUpDirectories,
101
+ writeConfigFile,
102
+ writeLLMPreferences,
103
+ writePreferencesToAgent
104
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var constants_exports = {};
20
+ __export(constants_exports, {
21
+ PREFERENCES_FILE: () => PREFERENCES_FILE
22
+ });
23
+ module.exports = __toCommonJS(constants_exports);
24
+ const PREFERENCES_FILE = "preferences.yml";
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ PREFERENCES_FILE
28
+ });
@@ -0,0 +1,2 @@
1
+ export declare const PREFERENCES_FILE = "preferences.yml";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/preferences/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,oBAAoB,CAAC"}
@@ -0,0 +1,4 @@
1
+ const PREFERENCES_FILE = "preferences.yml";
2
+ export {
3
+ PREFERENCES_FILE
4
+ };
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var error_codes_exports = {};
20
+ __export(error_codes_exports, {
21
+ PreferenceErrorCode: () => PreferenceErrorCode
22
+ });
23
+ module.exports = __toCommonJS(error_codes_exports);
24
+ var PreferenceErrorCode = /* @__PURE__ */ ((PreferenceErrorCode2) => {
25
+ PreferenceErrorCode2["FILE_NOT_FOUND"] = "preference_file_not_found";
26
+ PreferenceErrorCode2["FILE_READ_ERROR"] = "preference_file_read_error";
27
+ PreferenceErrorCode2["FILE_WRITE_ERROR"] = "preference_file_write_error";
28
+ PreferenceErrorCode2["VALIDATION_ERROR"] = "preference_validation_error";
29
+ PreferenceErrorCode2["MODEL_INCOMPATIBLE"] = "preference_model_incompatible";
30
+ return PreferenceErrorCode2;
31
+ })(PreferenceErrorCode || {});
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ PreferenceErrorCode
35
+ });
@@ -0,0 +1,8 @@
1
+ export declare enum PreferenceErrorCode {
2
+ FILE_NOT_FOUND = "preference_file_not_found",
3
+ FILE_READ_ERROR = "preference_file_read_error",
4
+ FILE_WRITE_ERROR = "preference_file_write_error",
5
+ VALIDATION_ERROR = "preference_validation_error",
6
+ MODEL_INCOMPATIBLE = "preference_model_incompatible"
7
+ }
8
+ //# sourceMappingURL=error-codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../src/preferences/error-codes.ts"],"names":[],"mappings":"AAEA,oBAAY,mBAAmB;IAC3B,cAAc,8BAA8B;IAC5C,eAAe,+BAA+B;IAC9C,gBAAgB,gCAAgC;IAChD,gBAAgB,gCAAgC;IAChD,kBAAkB,kCAAkC;CACvD"}
@@ -0,0 +1,11 @@
1
+ var PreferenceErrorCode = /* @__PURE__ */ ((PreferenceErrorCode2) => {
2
+ PreferenceErrorCode2["FILE_NOT_FOUND"] = "preference_file_not_found";
3
+ PreferenceErrorCode2["FILE_READ_ERROR"] = "preference_file_read_error";
4
+ PreferenceErrorCode2["FILE_WRITE_ERROR"] = "preference_file_write_error";
5
+ PreferenceErrorCode2["VALIDATION_ERROR"] = "preference_validation_error";
6
+ PreferenceErrorCode2["MODEL_INCOMPATIBLE"] = "preference_model_incompatible";
7
+ return PreferenceErrorCode2;
8
+ })(PreferenceErrorCode || {});
9
+ export {
10
+ PreferenceErrorCode
11
+ };
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var errors_exports = {};
20
+ __export(errors_exports, {
21
+ PreferenceError: () => PreferenceError,
22
+ PreferenceErrorCode: () => import_error_codes2.PreferenceErrorCode
23
+ });
24
+ module.exports = __toCommonJS(errors_exports);
25
+ var import_core = require("@dexto/core");
26
+ var import_error_codes = require("./error-codes.js");
27
+ var import_error_codes2 = require("./error-codes.js");
28
+ class PreferenceError {
29
+ static fileNotFound(preferencesPath) {
30
+ return new import_core.DextoRuntimeError(
31
+ import_error_codes.PreferenceErrorCode.FILE_NOT_FOUND,
32
+ "preference",
33
+ import_core.ErrorType.USER,
34
+ `Preferences file not found: ${preferencesPath}`,
35
+ { preferencesPath },
36
+ "Run `dexto setup` to create preferences"
37
+ );
38
+ }
39
+ static fileReadError(preferencesPath, cause) {
40
+ return new import_core.DextoRuntimeError(
41
+ import_error_codes.PreferenceErrorCode.FILE_READ_ERROR,
42
+ "preference",
43
+ import_core.ErrorType.SYSTEM,
44
+ `Failed to read preferences: ${cause}`,
45
+ { preferencesPath, cause },
46
+ "Check file permissions and ensure the file is not corrupted"
47
+ );
48
+ }
49
+ static fileWriteError(preferencesPath, cause) {
50
+ return new import_core.DextoRuntimeError(
51
+ import_error_codes.PreferenceErrorCode.FILE_WRITE_ERROR,
52
+ "preference",
53
+ import_core.ErrorType.SYSTEM,
54
+ `Failed to save preferences: ${cause}`,
55
+ { preferencesPath, cause },
56
+ "Check file permissions and available disk space"
57
+ );
58
+ }
59
+ static validationFailed(zodError) {
60
+ const issues = zodError.issues.map((issue) => ({
61
+ code: import_error_codes.PreferenceErrorCode.VALIDATION_ERROR,
62
+ message: `${issue.path.join(".")}: ${issue.message}`,
63
+ scope: "preference",
64
+ type: import_core.ErrorType.USER,
65
+ severity: "error"
66
+ }));
67
+ return new import_core.DextoValidationError(issues);
68
+ }
69
+ }
70
+ // Annotate the CommonJS export names for ESM import in node:
71
+ 0 && (module.exports = {
72
+ PreferenceError,
73
+ PreferenceErrorCode
74
+ });
@@ -0,0 +1,18 @@
1
+ import { DextoRuntimeError, DextoValidationError } from '@dexto/core';
2
+ import { type ZodError } from 'zod';
3
+ export { PreferenceErrorCode } from './error-codes.js';
4
+ export declare class PreferenceError {
5
+ static fileNotFound(preferencesPath: string): DextoRuntimeError<{
6
+ preferencesPath: string;
7
+ }>;
8
+ static fileReadError(preferencesPath: string, cause: string): DextoRuntimeError<{
9
+ preferencesPath: string;
10
+ cause: string;
11
+ }>;
12
+ static fileWriteError(preferencesPath: string, cause: string): DextoRuntimeError<{
13
+ preferencesPath: string;
14
+ cause: string;
15
+ }>;
16
+ static validationFailed(zodError: ZodError): DextoValidationError;
17
+ }
18
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/preferences/errors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAa,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAGpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,qBAAa,eAAe;IACxB,MAAM,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM;;;IAW3C,MAAM,CAAC,aAAa,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;;IAW3D,MAAM,CAAC,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;;IAW5D,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ;CAW7C"}
@@ -0,0 +1,49 @@
1
+ import { DextoRuntimeError, DextoValidationError, ErrorType } from "@dexto/core";
2
+ import { PreferenceErrorCode } from "./error-codes.js";
3
+ import { PreferenceErrorCode as PreferenceErrorCode2 } from "./error-codes.js";
4
+ class PreferenceError {
5
+ static fileNotFound(preferencesPath) {
6
+ return new DextoRuntimeError(
7
+ PreferenceErrorCode.FILE_NOT_FOUND,
8
+ "preference",
9
+ ErrorType.USER,
10
+ `Preferences file not found: ${preferencesPath}`,
11
+ { preferencesPath },
12
+ "Run `dexto setup` to create preferences"
13
+ );
14
+ }
15
+ static fileReadError(preferencesPath, cause) {
16
+ return new DextoRuntimeError(
17
+ PreferenceErrorCode.FILE_READ_ERROR,
18
+ "preference",
19
+ ErrorType.SYSTEM,
20
+ `Failed to read preferences: ${cause}`,
21
+ { preferencesPath, cause },
22
+ "Check file permissions and ensure the file is not corrupted"
23
+ );
24
+ }
25
+ static fileWriteError(preferencesPath, cause) {
26
+ return new DextoRuntimeError(
27
+ PreferenceErrorCode.FILE_WRITE_ERROR,
28
+ "preference",
29
+ ErrorType.SYSTEM,
30
+ `Failed to save preferences: ${cause}`,
31
+ { preferencesPath, cause },
32
+ "Check file permissions and available disk space"
33
+ );
34
+ }
35
+ static validationFailed(zodError) {
36
+ const issues = zodError.issues.map((issue) => ({
37
+ code: PreferenceErrorCode.VALIDATION_ERROR,
38
+ message: `${issue.path.join(".")}: ${issue.message}`,
39
+ scope: "preference",
40
+ type: ErrorType.USER,
41
+ severity: "error"
42
+ }));
43
+ return new DextoValidationError(issues);
44
+ }
45
+ }
46
+ export {
47
+ PreferenceError,
48
+ PreferenceErrorCode2 as PreferenceErrorCode
49
+ };
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var preferences_exports = {};
20
+ __export(preferences_exports, {
21
+ GlobalPreferencesSchema: () => import_schemas.GlobalPreferencesSchema,
22
+ PREFERENCES_FILE: () => import_constants.PREFERENCES_FILE,
23
+ PreferenceDefaultsSchema: () => import_schemas.PreferenceDefaultsSchema,
24
+ PreferenceError: () => import_errors.PreferenceError,
25
+ PreferenceErrorCode: () => import_errors.PreferenceErrorCode,
26
+ PreferenceLLMSchema: () => import_schemas.PreferenceLLMSchema,
27
+ PreferenceSetupSchema: () => import_schemas.PreferenceSetupSchema,
28
+ createInitialPreferences: () => import_loader.createInitialPreferences,
29
+ getGlobalPreferencesPath: () => import_loader.getGlobalPreferencesPath,
30
+ globalPreferencesExist: () => import_loader.globalPreferencesExist,
31
+ loadGlobalPreferences: () => import_loader.loadGlobalPreferences,
32
+ saveGlobalPreferences: () => import_loader.saveGlobalPreferences,
33
+ updateGlobalPreferences: () => import_loader.updateGlobalPreferences
34
+ });
35
+ module.exports = __toCommonJS(preferences_exports);
36
+ var import_schemas = require("./schemas.js");
37
+ var import_constants = require("./constants.js");
38
+ var import_loader = require("./loader.js");
39
+ var import_errors = require("./errors.js");
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ GlobalPreferencesSchema,
43
+ PREFERENCES_FILE,
44
+ PreferenceDefaultsSchema,
45
+ PreferenceError,
46
+ PreferenceErrorCode,
47
+ PreferenceLLMSchema,
48
+ PreferenceSetupSchema,
49
+ createInitialPreferences,
50
+ getGlobalPreferencesPath,
51
+ globalPreferencesExist,
52
+ loadGlobalPreferences,
53
+ saveGlobalPreferences,
54
+ updateGlobalPreferences
55
+ });
@@ -0,0 +1,6 @@
1
+ export type { GlobalPreferences, PreferenceLLM, PreferenceDefaults, PreferenceSetup, } from './schemas.js';
2
+ export { GlobalPreferencesSchema, PreferenceLLMSchema, PreferenceDefaultsSchema, PreferenceSetupSchema, } from './schemas.js';
3
+ export { PREFERENCES_FILE } from './constants.js';
4
+ export { loadGlobalPreferences, saveGlobalPreferences, globalPreferencesExist, getGlobalPreferencesPath, createInitialPreferences, updateGlobalPreferences, } from './loader.js';
5
+ export { PreferenceError, PreferenceErrorCode } from './errors.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/preferences/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACR,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,eAAe,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,GACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EACH,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,GAC1B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,31 @@
1
+ import {
2
+ GlobalPreferencesSchema,
3
+ PreferenceLLMSchema,
4
+ PreferenceDefaultsSchema,
5
+ PreferenceSetupSchema
6
+ } from "./schemas.js";
7
+ import { PREFERENCES_FILE } from "./constants.js";
8
+ import {
9
+ loadGlobalPreferences,
10
+ saveGlobalPreferences,
11
+ globalPreferencesExist,
12
+ getGlobalPreferencesPath,
13
+ createInitialPreferences,
14
+ updateGlobalPreferences
15
+ } from "./loader.js";
16
+ import { PreferenceError, PreferenceErrorCode } from "./errors.js";
17
+ export {
18
+ GlobalPreferencesSchema,
19
+ PREFERENCES_FILE,
20
+ PreferenceDefaultsSchema,
21
+ PreferenceError,
22
+ PreferenceErrorCode,
23
+ PreferenceLLMSchema,
24
+ PreferenceSetupSchema,
25
+ createInitialPreferences,
26
+ getGlobalPreferencesPath,
27
+ globalPreferencesExist,
28
+ loadGlobalPreferences,
29
+ saveGlobalPreferences,
30
+ updateGlobalPreferences
31
+ };