@shin1ohno/sage 0.10.0 → 0.11.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.
- package/dist/cli/mcp-handler.d.ts.map +1 -1
- package/dist/cli/mcp-handler.js +154 -6
- package/dist/cli/mcp-handler.js.map +1 -1
- package/dist/cli/signal-handler.d.ts +23 -0
- package/dist/cli/signal-handler.d.ts.map +1 -0
- package/dist/cli/signal-handler.js +51 -0
- package/dist/cli/signal-handler.js.map +1 -0
- package/dist/config/config-differ.d.ts +21 -0
- package/dist/config/config-differ.d.ts.map +1 -0
- package/dist/config/config-differ.js +194 -0
- package/dist/config/config-differ.js.map +1 -0
- package/dist/config/config-reload-service.d.ts +84 -0
- package/dist/config/config-reload-service.d.ts.map +1 -0
- package/dist/config/config-reload-service.js +234 -0
- package/dist/config/config-reload-service.js.map +1 -0
- package/dist/config/config-watcher.d.ts +78 -0
- package/dist/config/config-watcher.d.ts.map +1 -0
- package/dist/config/config-watcher.js +244 -0
- package/dist/config/config-watcher.js.map +1 -0
- package/dist/config/hot-reload-config.d.ts +16 -0
- package/dist/config/hot-reload-config.d.ts.map +1 -0
- package/dist/config/hot-reload-config.js +61 -0
- package/dist/config/hot-reload-config.js.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -1
- package/dist/services/reloadable/calendar-source-manager-adapter.d.ts +45 -0
- package/dist/services/reloadable/calendar-source-manager-adapter.d.ts.map +1 -0
- package/dist/services/reloadable/calendar-source-manager-adapter.js +106 -0
- package/dist/services/reloadable/calendar-source-manager-adapter.js.map +1 -0
- package/dist/services/reloadable/index.d.ts +46 -0
- package/dist/services/reloadable/index.d.ts.map +1 -0
- package/dist/services/reloadable/index.js +88 -0
- package/dist/services/reloadable/index.js.map +1 -0
- package/dist/services/reloadable/notion-service-adapter.d.ts +45 -0
- package/dist/services/reloadable/notion-service-adapter.d.ts.map +1 -0
- package/dist/services/reloadable/notion-service-adapter.js +86 -0
- package/dist/services/reloadable/notion-service-adapter.js.map +1 -0
- package/dist/services/reloadable/priority-engine-adapter.d.ts +73 -0
- package/dist/services/reloadable/priority-engine-adapter.d.ts.map +1 -0
- package/dist/services/reloadable/priority-engine-adapter.js +105 -0
- package/dist/services/reloadable/priority-engine-adapter.js.map +1 -0
- package/dist/services/reloadable/reminder-manager-adapter.d.ts +45 -0
- package/dist/services/reloadable/reminder-manager-adapter.d.ts.map +1 -0
- package/dist/services/reloadable/reminder-manager-adapter.js +80 -0
- package/dist/services/reloadable/reminder-manager-adapter.js.map +1 -0
- package/dist/services/reloadable/todo-list-manager-adapter.d.ts +45 -0
- package/dist/services/reloadable/todo-list-manager-adapter.d.ts.map +1 -0
- package/dist/services/reloadable/todo-list-manager-adapter.js +80 -0
- package/dist/services/reloadable/todo-list-manager-adapter.js.map +1 -0
- package/dist/services/reloadable/working-cadence-adapter.d.ts +52 -0
- package/dist/services/reloadable/working-cadence-adapter.d.ts.map +1 -0
- package/dist/services/reloadable/working-cadence-adapter.js +77 -0
- package/dist/services/reloadable/working-cadence-adapter.js.map +1 -0
- package/dist/services/service-registry.d.ts +85 -0
- package/dist/services/service-registry.d.ts.map +1 -0
- package/dist/services/service-registry.js +166 -0
- package/dist/services/service-registry.js.map +1 -0
- package/dist/tools/config/index.d.ts +9 -0
- package/dist/tools/config/index.d.ts.map +1 -0
- package/dist/tools/config/index.js +8 -0
- package/dist/tools/config/index.js.map +1 -0
- package/dist/tools/config/reload-handler.d.ts +35 -0
- package/dist/tools/config/reload-handler.d.ts.map +1 -0
- package/dist/tools/config/reload-handler.js +63 -0
- package/dist/tools/config/reload-handler.js.map +1 -0
- package/dist/tools/integrations/handlers.d.ts +2 -0
- package/dist/tools/integrations/handlers.d.ts.map +1 -1
- package/dist/tools/integrations/handlers.js.map +1 -1
- package/dist/tools/setup/handlers.d.ts +2 -0
- package/dist/tools/setup/handlers.d.ts.map +1 -1
- package/dist/tools/setup/handlers.js +14 -0
- package/dist/tools/setup/handlers.js.map +1 -1
- package/dist/types/hot-reload.d.ts +131 -0
- package/dist/types/hot-reload.d.ts.map +1 -0
- package/dist/types/hot-reload.js +5 -0
- package/dist/types/hot-reload.js.map +1 -0
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reloadable Service Adapter for NotionMCPService
|
|
3
|
+
*
|
|
4
|
+
* Wraps NotionMCPService to support hot-reload functionality.
|
|
5
|
+
* Reinitializes the service when integrations config changes.
|
|
6
|
+
*/
|
|
7
|
+
import type { ReloadableService } from '../../types/hot-reload.js';
|
|
8
|
+
import type { UserConfig } from '../../types/config.js';
|
|
9
|
+
import { NotionMCPService } from '../../integrations/notion-mcp.js';
|
|
10
|
+
/**
|
|
11
|
+
* Factory function type for creating NotionMCPService
|
|
12
|
+
*/
|
|
13
|
+
export type NotionMCPServiceFactory = (config: UserConfig) => NotionMCPService;
|
|
14
|
+
/**
|
|
15
|
+
* Default factory that creates NotionMCPService from UserConfig
|
|
16
|
+
*/
|
|
17
|
+
export declare function createNotionMCPService(config: UserConfig): NotionMCPService;
|
|
18
|
+
/**
|
|
19
|
+
* Reloadable adapter for NotionMCPService
|
|
20
|
+
*/
|
|
21
|
+
export declare class NotionServiceAdapter implements ReloadableService {
|
|
22
|
+
readonly name = "NotionMCPService";
|
|
23
|
+
readonly dependsOnSections: readonly string[];
|
|
24
|
+
private instance;
|
|
25
|
+
private factory;
|
|
26
|
+
/**
|
|
27
|
+
* Constructor
|
|
28
|
+
* @param factoryOrInstance - Either a factory function or an existing instance
|
|
29
|
+
*/
|
|
30
|
+
constructor(factoryOrInstance: NotionMCPServiceFactory | NotionMCPService);
|
|
31
|
+
/**
|
|
32
|
+
* Get the current NotionMCPService instance
|
|
33
|
+
*/
|
|
34
|
+
getInstance(): NotionMCPService | null;
|
|
35
|
+
/**
|
|
36
|
+
* Shutdown the current instance
|
|
37
|
+
* Disconnects MCP client if connected
|
|
38
|
+
*/
|
|
39
|
+
shutdown(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Reinitialize with new configuration
|
|
42
|
+
*/
|
|
43
|
+
reinitialize(config: UserConfig): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=notion-service-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-service-adapter.d.ts","sourceRoot":"","sources":["../../../src/services/reloadable/notion-service-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,kCAAkC,CAAC;AAKrF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK,gBAAgB,CAAC;AAE/E;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,gBAAgB,CAY3E;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,iBAAiB;IAC5D,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAoB;IAEjE,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,OAAO,CAA0B;IAEzC;;;OAGG;gBACS,iBAAiB,EAAE,uBAAuB,GAAG,gBAAgB;IASzE;;OAEG;IACH,WAAW,IAAI,gBAAgB,GAAG,IAAI;IAItC;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB/B;;OAEG;IACG,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAWtD"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reloadable Service Adapter for NotionMCPService
|
|
3
|
+
*
|
|
4
|
+
* Wraps NotionMCPService to support hot-reload functionality.
|
|
5
|
+
* Reinitializes the service when integrations config changes.
|
|
6
|
+
*/
|
|
7
|
+
import { NotionMCPService, NotionMCPClient } from '../../integrations/notion-mcp.js';
|
|
8
|
+
import { createLogger } from '../../utils/logger.js';
|
|
9
|
+
const logger = createLogger('NotionServiceAdapter');
|
|
10
|
+
/**
|
|
11
|
+
* Default factory that creates NotionMCPService from UserConfig
|
|
12
|
+
*/
|
|
13
|
+
export function createNotionMCPService(config) {
|
|
14
|
+
const service = new NotionMCPService();
|
|
15
|
+
// Configure MCP client if Notion is enabled and database ID is set
|
|
16
|
+
if (config.integrations.notion.enabled && config.integrations.notion.databaseId) {
|
|
17
|
+
const client = new NotionMCPClient({
|
|
18
|
+
allowedDatabaseIds: [config.integrations.notion.databaseId],
|
|
19
|
+
});
|
|
20
|
+
service.setMCPClient(client);
|
|
21
|
+
}
|
|
22
|
+
return service;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Reloadable adapter for NotionMCPService
|
|
26
|
+
*/
|
|
27
|
+
export class NotionServiceAdapter {
|
|
28
|
+
name = 'NotionMCPService';
|
|
29
|
+
dependsOnSections = ['integrations'];
|
|
30
|
+
instance = null;
|
|
31
|
+
factory;
|
|
32
|
+
/**
|
|
33
|
+
* Constructor
|
|
34
|
+
* @param factoryOrInstance - Either a factory function or an existing instance
|
|
35
|
+
*/
|
|
36
|
+
constructor(factoryOrInstance) {
|
|
37
|
+
if (typeof factoryOrInstance === 'function') {
|
|
38
|
+
this.factory = factoryOrInstance;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this.instance = factoryOrInstance;
|
|
42
|
+
this.factory = createNotionMCPService;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get the current NotionMCPService instance
|
|
47
|
+
*/
|
|
48
|
+
getInstance() {
|
|
49
|
+
return this.instance;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Shutdown the current instance
|
|
53
|
+
* Disconnects MCP client if connected
|
|
54
|
+
*/
|
|
55
|
+
async shutdown() {
|
|
56
|
+
logger.debug('Shutting down NotionMCPService');
|
|
57
|
+
if (this.instance) {
|
|
58
|
+
const client = this.instance.getMCPClient();
|
|
59
|
+
if (client && client.isConnected()) {
|
|
60
|
+
try {
|
|
61
|
+
await client.disconnect();
|
|
62
|
+
logger.debug('NotionMCPClient disconnected');
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
logger.warn({ err: error }, 'Error disconnecting NotionMCPClient');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
this.instance = null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Reinitialize with new configuration
|
|
73
|
+
*/
|
|
74
|
+
async reinitialize(config) {
|
|
75
|
+
logger.info('Reinitializing NotionMCPService with new config');
|
|
76
|
+
try {
|
|
77
|
+
this.instance = this.factory(config);
|
|
78
|
+
logger.info('NotionMCPService reinitialized successfully');
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
logger.error({ err: error }, 'Failed to reinitialize NotionMCPService');
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=notion-service-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-service-adapter.js","sourceRoot":"","sources":["../../../src/services/reloadable/notion-service-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,MAAM,GAAG,YAAY,CAAC,sBAAsB,CAAC,CAAC;AAOpD;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAkB;IACvD,MAAM,OAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAEvC,mEAAmE;IACnE,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QAChF,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,kBAAkB,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;SAC5D,CAAC,CAAC;QACH,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACtB,IAAI,GAAG,kBAAkB,CAAC;IAC1B,iBAAiB,GAAsB,CAAC,cAAc,CAAC,CAAC;IAEzD,QAAQ,GAA4B,IAAI,CAAC;IACzC,OAAO,CAA0B;IAEzC;;;OAGG;IACH,YAAY,iBAA6D;QACvE,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;YAC5C,IAAI,CAAC,OAAO,GAAG,iBAAiB,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC;YAClC,IAAI,CAAC,OAAO,GAAG,sBAAsB,CAAC;QACxC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAE/C,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;YAC5C,IAAI,MAAM,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC;gBACnC,IAAI,CAAC;oBACH,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;oBAC1B,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;gBAC/C,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,qCAAqC,CAAC,CAAC;gBACrE,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,MAAkB;QACnC,MAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;QAE/D,IAAI,CAAC;YACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrC,MAAM,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,yCAAyC,CAAC,CAAC;YACxE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reloadable Service Adapter for PriorityEngine
|
|
3
|
+
*
|
|
4
|
+
* Wraps PriorityEngine to support hot-reload functionality.
|
|
5
|
+
* Reinitializes the service when priorityRules config changes.
|
|
6
|
+
*
|
|
7
|
+
* Note: PriorityEngine is a stateless class with static methods,
|
|
8
|
+
* so shutdown/reinitialize are essentially no-ops. The adapter
|
|
9
|
+
* maintains a config reference that can be updated.
|
|
10
|
+
*/
|
|
11
|
+
import type { ReloadableService } from '../../types/hot-reload.js';
|
|
12
|
+
import type { UserConfig, PriorityRules, TeamConfig } from '../../types/config.js';
|
|
13
|
+
import { PriorityEngine } from '../../utils/priority.js';
|
|
14
|
+
/**
|
|
15
|
+
* PriorityEngine wrapper that holds config reference
|
|
16
|
+
*
|
|
17
|
+
* Since PriorityEngine uses static methods, this wrapper provides
|
|
18
|
+
* instance methods that use the stored config.
|
|
19
|
+
*/
|
|
20
|
+
export declare class PriorityEngineWrapper {
|
|
21
|
+
private priorityRules;
|
|
22
|
+
private teamConfig?;
|
|
23
|
+
constructor(config: UserConfig);
|
|
24
|
+
/**
|
|
25
|
+
* Get the current priority rules
|
|
26
|
+
*/
|
|
27
|
+
getPriorityRules(): PriorityRules;
|
|
28
|
+
/**
|
|
29
|
+
* Get the team config
|
|
30
|
+
*/
|
|
31
|
+
getTeamConfig(): TeamConfig | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Access to the underlying static PriorityEngine class
|
|
34
|
+
*/
|
|
35
|
+
get engine(): typeof PriorityEngine;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Factory function type for creating PriorityEngineWrapper
|
|
39
|
+
*/
|
|
40
|
+
export type PriorityEngineFactory = (config: UserConfig) => PriorityEngineWrapper;
|
|
41
|
+
/**
|
|
42
|
+
* Default factory that creates PriorityEngineWrapper from UserConfig
|
|
43
|
+
*/
|
|
44
|
+
export declare function createPriorityEngine(config: UserConfig): PriorityEngineWrapper;
|
|
45
|
+
/**
|
|
46
|
+
* Reloadable adapter for PriorityEngine
|
|
47
|
+
*/
|
|
48
|
+
export declare class PriorityEngineAdapter implements ReloadableService {
|
|
49
|
+
readonly name = "PriorityEngine";
|
|
50
|
+
readonly dependsOnSections: readonly string[];
|
|
51
|
+
private instance;
|
|
52
|
+
private factory;
|
|
53
|
+
/**
|
|
54
|
+
* Constructor
|
|
55
|
+
* @param factoryOrInstance - Either a factory function or an existing instance
|
|
56
|
+
*/
|
|
57
|
+
constructor(factoryOrInstance: PriorityEngineFactory | PriorityEngineWrapper);
|
|
58
|
+
/**
|
|
59
|
+
* Get the current PriorityEngineWrapper instance
|
|
60
|
+
*/
|
|
61
|
+
getInstance(): PriorityEngineWrapper | null;
|
|
62
|
+
/**
|
|
63
|
+
* Shutdown the current instance
|
|
64
|
+
* PriorityEngine is stateless, so this is a no-op
|
|
65
|
+
*/
|
|
66
|
+
shutdown(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Reinitialize with new configuration
|
|
69
|
+
* Updates the config reference for the wrapper
|
|
70
|
+
*/
|
|
71
|
+
reinitialize(config: UserConfig): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=priority-engine-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"priority-engine-adapter.d.ts","sourceRoot":"","sources":["../../../src/services/reloadable/priority-engine-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAKzD;;;;;GAKG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,UAAU,CAAC,CAAa;gBAEpB,MAAM,EAAE,UAAU;IAK9B;;OAEG;IACH,gBAAgB,IAAI,aAAa;IAIjC;;OAEG;IACH,aAAa,IAAI,UAAU,GAAG,SAAS;IAIvC;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,cAAc,CAElC;CACF;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK,qBAAqB,CAAC;AAElF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,qBAAqB,CAE9E;AAED;;GAEG;AACH,qBAAa,qBAAsB,YAAW,iBAAiB;IAC7D,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAqB;IAElE,OAAO,CAAC,QAAQ,CAAsC;IACtD,OAAO,CAAC,OAAO,CAAwB;IAEvC;;;OAGG;gBACS,iBAAiB,EAAE,qBAAqB,GAAG,qBAAqB;IAS5E;;OAEG;IACH,WAAW,IAAI,qBAAqB,GAAG,IAAI;IAI3C;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/B;;;OAGG;IACG,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAWtD"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reloadable Service Adapter for PriorityEngine
|
|
3
|
+
*
|
|
4
|
+
* Wraps PriorityEngine to support hot-reload functionality.
|
|
5
|
+
* Reinitializes the service when priorityRules config changes.
|
|
6
|
+
*
|
|
7
|
+
* Note: PriorityEngine is a stateless class with static methods,
|
|
8
|
+
* so shutdown/reinitialize are essentially no-ops. The adapter
|
|
9
|
+
* maintains a config reference that can be updated.
|
|
10
|
+
*/
|
|
11
|
+
import { PriorityEngine } from '../../utils/priority.js';
|
|
12
|
+
import { createLogger } from '../../utils/logger.js';
|
|
13
|
+
const logger = createLogger('PriorityEngineAdapter');
|
|
14
|
+
/**
|
|
15
|
+
* PriorityEngine wrapper that holds config reference
|
|
16
|
+
*
|
|
17
|
+
* Since PriorityEngine uses static methods, this wrapper provides
|
|
18
|
+
* instance methods that use the stored config.
|
|
19
|
+
*/
|
|
20
|
+
export class PriorityEngineWrapper {
|
|
21
|
+
priorityRules;
|
|
22
|
+
teamConfig;
|
|
23
|
+
constructor(config) {
|
|
24
|
+
this.priorityRules = config.priorityRules;
|
|
25
|
+
this.teamConfig = config.team;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get the current priority rules
|
|
29
|
+
*/
|
|
30
|
+
getPriorityRules() {
|
|
31
|
+
return this.priorityRules;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get the team config
|
|
35
|
+
*/
|
|
36
|
+
getTeamConfig() {
|
|
37
|
+
return this.teamConfig;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Access to the underlying static PriorityEngine class
|
|
41
|
+
*/
|
|
42
|
+
get engine() {
|
|
43
|
+
return PriorityEngine;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Default factory that creates PriorityEngineWrapper from UserConfig
|
|
48
|
+
*/
|
|
49
|
+
export function createPriorityEngine(config) {
|
|
50
|
+
return new PriorityEngineWrapper(config);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Reloadable adapter for PriorityEngine
|
|
54
|
+
*/
|
|
55
|
+
export class PriorityEngineAdapter {
|
|
56
|
+
name = 'PriorityEngine';
|
|
57
|
+
dependsOnSections = ['priorityRules'];
|
|
58
|
+
instance = null;
|
|
59
|
+
factory;
|
|
60
|
+
/**
|
|
61
|
+
* Constructor
|
|
62
|
+
* @param factoryOrInstance - Either a factory function or an existing instance
|
|
63
|
+
*/
|
|
64
|
+
constructor(factoryOrInstance) {
|
|
65
|
+
if (typeof factoryOrInstance === 'function') {
|
|
66
|
+
this.factory = factoryOrInstance;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this.instance = factoryOrInstance;
|
|
70
|
+
this.factory = createPriorityEngine;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get the current PriorityEngineWrapper instance
|
|
75
|
+
*/
|
|
76
|
+
getInstance() {
|
|
77
|
+
return this.instance;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Shutdown the current instance
|
|
81
|
+
* PriorityEngine is stateless, so this is a no-op
|
|
82
|
+
*/
|
|
83
|
+
async shutdown() {
|
|
84
|
+
logger.debug('Shutting down PriorityEngine (no-op for stateless engine)');
|
|
85
|
+
// PriorityEngine is stateless, no cleanup needed
|
|
86
|
+
// Just clear the reference
|
|
87
|
+
this.instance = null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Reinitialize with new configuration
|
|
91
|
+
* Updates the config reference for the wrapper
|
|
92
|
+
*/
|
|
93
|
+
async reinitialize(config) {
|
|
94
|
+
logger.info('Reinitializing PriorityEngine with new config');
|
|
95
|
+
try {
|
|
96
|
+
this.instance = this.factory(config);
|
|
97
|
+
logger.info('PriorityEngine reinitialized successfully');
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
logger.error({ err: error }, 'Failed to reinitialize PriorityEngine');
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=priority-engine-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"priority-engine-adapter.js","sourceRoot":"","sources":["../../../src/services/reloadable/priority-engine-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,MAAM,GAAG,YAAY,CAAC,uBAAuB,CAAC,CAAC;AAErD;;;;;GAKG;AACH,MAAM,OAAO,qBAAqB;IACxB,aAAa,CAAgB;IAC7B,UAAU,CAAc;IAEhC,YAAY,MAAkB;QAC5B,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,cAAc,CAAC;IACxB,CAAC;CACF;AAOD;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAkB;IACrD,OAAO,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,qBAAqB;IACvB,IAAI,GAAG,gBAAgB,CAAC;IACxB,iBAAiB,GAAsB,CAAC,eAAe,CAAC,CAAC;IAE1D,QAAQ,GAAiC,IAAI,CAAC;IAC9C,OAAO,CAAwB;IAEvC;;;OAGG;IACH,YAAY,iBAAgE;QAC1E,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;YAC5C,IAAI,CAAC,OAAO,GAAG,iBAAiB,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC;YAClC,IAAI,CAAC,OAAO,GAAG,oBAAoB,CAAC;QACtC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAC;QAC1E,iDAAiD;QACjD,2BAA2B;QAC3B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAY,CAAC,MAAkB;QACnC,MAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;QAE7D,IAAI,CAAC;YACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrC,MAAM,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,uCAAuC,CAAC,CAAC;YACtE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reloadable Service Adapter for ReminderManager
|
|
3
|
+
*
|
|
4
|
+
* Wraps ReminderManager to support hot-reload functionality.
|
|
5
|
+
* Reinitializes the service when integrations or reminders config changes.
|
|
6
|
+
*/
|
|
7
|
+
import type { ReloadableService } from '../../types/hot-reload.js';
|
|
8
|
+
import type { UserConfig } from '../../types/config.js';
|
|
9
|
+
import { ReminderManager } from '../../integrations/reminder-manager.js';
|
|
10
|
+
/**
|
|
11
|
+
* Factory function type for creating ReminderManager
|
|
12
|
+
*/
|
|
13
|
+
export type ReminderManagerFactory = (config: UserConfig) => ReminderManager;
|
|
14
|
+
/**
|
|
15
|
+
* Default factory that creates ReminderManager from UserConfig
|
|
16
|
+
*/
|
|
17
|
+
export declare function createReminderManager(config: UserConfig): ReminderManager;
|
|
18
|
+
/**
|
|
19
|
+
* Reloadable adapter for ReminderManager
|
|
20
|
+
*/
|
|
21
|
+
export declare class ReminderManagerAdapter implements ReloadableService {
|
|
22
|
+
readonly name = "ReminderManager";
|
|
23
|
+
readonly dependsOnSections: readonly string[];
|
|
24
|
+
private instance;
|
|
25
|
+
private factory;
|
|
26
|
+
/**
|
|
27
|
+
* Constructor
|
|
28
|
+
* @param factoryOrInstance - Either a factory function or an existing instance
|
|
29
|
+
*/
|
|
30
|
+
constructor(factoryOrInstance: ReminderManagerFactory | ReminderManager);
|
|
31
|
+
/**
|
|
32
|
+
* Get the current ReminderManager instance
|
|
33
|
+
*/
|
|
34
|
+
getInstance(): ReminderManager | null;
|
|
35
|
+
/**
|
|
36
|
+
* Shutdown the current instance
|
|
37
|
+
* ReminderManager does not have explicit cleanup needs
|
|
38
|
+
*/
|
|
39
|
+
shutdown(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Reinitialize with new configuration
|
|
42
|
+
*/
|
|
43
|
+
reinitialize(config: UserConfig): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=reminder-manager-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reminder-manager-adapter.d.ts","sourceRoot":"","sources":["../../../src/services/reloadable/reminder-manager-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAkB,MAAM,wCAAwC,CAAC;AAKzF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK,eAAe,CAAC;AAc7E;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,eAAe,CAGzE;AAED;;GAEG;AACH,qBAAa,sBAAuB,YAAW,iBAAiB;IAC9D,QAAQ,CAAC,IAAI,qBAAqB;IAClC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAiC;IAE9E,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO,CAAC,OAAO,CAAyB;IAExC;;;OAGG;gBACS,iBAAiB,EAAE,sBAAsB,GAAG,eAAe;IASvE;;OAEG;IACH,WAAW,IAAI,eAAe,GAAG,IAAI;IAIrC;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/B;;OAEG;IACG,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAWtD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reloadable Service Adapter for ReminderManager
|
|
3
|
+
*
|
|
4
|
+
* Wraps ReminderManager to support hot-reload functionality.
|
|
5
|
+
* Reinitializes the service when integrations or reminders config changes.
|
|
6
|
+
*/
|
|
7
|
+
import { ReminderManager } from '../../integrations/reminder-manager.js';
|
|
8
|
+
import { createLogger } from '../../utils/logger.js';
|
|
9
|
+
const logger = createLogger('ReminderManagerAdapter');
|
|
10
|
+
/**
|
|
11
|
+
* Extract ReminderConfig from UserConfig
|
|
12
|
+
*/
|
|
13
|
+
function extractReminderConfig(config) {
|
|
14
|
+
return {
|
|
15
|
+
appleRemindersThreshold: config.integrations.appleReminders.threshold,
|
|
16
|
+
notionThreshold: config.integrations.notion.threshold,
|
|
17
|
+
defaultList: config.integrations.appleReminders.defaultList,
|
|
18
|
+
notionDatabaseId: config.integrations.notion.databaseId,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Default factory that creates ReminderManager from UserConfig
|
|
23
|
+
*/
|
|
24
|
+
export function createReminderManager(config) {
|
|
25
|
+
const reminderConfig = extractReminderConfig(config);
|
|
26
|
+
return new ReminderManager(reminderConfig);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Reloadable adapter for ReminderManager
|
|
30
|
+
*/
|
|
31
|
+
export class ReminderManagerAdapter {
|
|
32
|
+
name = 'ReminderManager';
|
|
33
|
+
dependsOnSections = ['integrations', 'reminders'];
|
|
34
|
+
instance = null;
|
|
35
|
+
factory;
|
|
36
|
+
/**
|
|
37
|
+
* Constructor
|
|
38
|
+
* @param factoryOrInstance - Either a factory function or an existing instance
|
|
39
|
+
*/
|
|
40
|
+
constructor(factoryOrInstance) {
|
|
41
|
+
if (typeof factoryOrInstance === 'function') {
|
|
42
|
+
this.factory = factoryOrInstance;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.instance = factoryOrInstance;
|
|
46
|
+
this.factory = createReminderManager;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get the current ReminderManager instance
|
|
51
|
+
*/
|
|
52
|
+
getInstance() {
|
|
53
|
+
return this.instance;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Shutdown the current instance
|
|
57
|
+
* ReminderManager does not have explicit cleanup needs
|
|
58
|
+
*/
|
|
59
|
+
async shutdown() {
|
|
60
|
+
logger.debug('Shutting down ReminderManager');
|
|
61
|
+
// ReminderManager has no explicit cleanup
|
|
62
|
+
// Just clear the reference
|
|
63
|
+
this.instance = null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Reinitialize with new configuration
|
|
67
|
+
*/
|
|
68
|
+
async reinitialize(config) {
|
|
69
|
+
logger.info('Reinitializing ReminderManager with new config');
|
|
70
|
+
try {
|
|
71
|
+
this.instance = this.factory(config);
|
|
72
|
+
logger.info('ReminderManager reinitialized successfully');
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
logger.error({ err: error }, 'Failed to reinitialize ReminderManager');
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=reminder-manager-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reminder-manager-adapter.js","sourceRoot":"","sources":["../../../src/services/reloadable/reminder-manager-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,eAAe,EAAkB,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,MAAM,GAAG,YAAY,CAAC,wBAAwB,CAAC,CAAC;AAOtD;;GAEG;AACH,SAAS,qBAAqB,CAAC,MAAkB;IAC/C,OAAO;QACL,uBAAuB,EAAE,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,SAAS;QACrE,eAAe,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS;QACrD,WAAW,EAAE,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,WAAW;QAC3D,gBAAgB,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU;KACxD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAkB;IACtD,MAAM,cAAc,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACrD,OAAO,IAAI,eAAe,CAAC,cAAc,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,sBAAsB;IACxB,IAAI,GAAG,iBAAiB,CAAC;IACzB,iBAAiB,GAAsB,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IAEtE,QAAQ,GAA2B,IAAI,CAAC;IACxC,OAAO,CAAyB;IAExC;;;OAGG;IACH,YAAY,iBAA2D;QACrE,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;YAC5C,IAAI,CAAC,OAAO,GAAG,iBAAiB,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC;YAClC,IAAI,CAAC,OAAO,GAAG,qBAAqB,CAAC;QACvC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC9C,0CAA0C;QAC1C,2BAA2B;QAC3B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,MAAkB;QACnC,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAE9D,IAAI,CAAC;YACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrC,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QAC5D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,wCAAwC,CAAC,CAAC;YACvE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reloadable Service Adapter for TodoListManager
|
|
3
|
+
*
|
|
4
|
+
* Wraps TodoListManager to support hot-reload functionality.
|
|
5
|
+
* Reinitializes the service when integrations config changes.
|
|
6
|
+
*/
|
|
7
|
+
import type { ReloadableService } from '../../types/hot-reload.js';
|
|
8
|
+
import type { UserConfig } from '../../types/config.js';
|
|
9
|
+
import { TodoListManager } from '../../integrations/todo-list-manager.js';
|
|
10
|
+
/**
|
|
11
|
+
* Factory function type for creating TodoListManager
|
|
12
|
+
*/
|
|
13
|
+
export type TodoListManagerFactory = (config: UserConfig) => TodoListManager;
|
|
14
|
+
/**
|
|
15
|
+
* Default factory that creates TodoListManager from UserConfig
|
|
16
|
+
*/
|
|
17
|
+
export declare function createTodoListManager(config: UserConfig): TodoListManager;
|
|
18
|
+
/**
|
|
19
|
+
* Reloadable adapter for TodoListManager
|
|
20
|
+
*/
|
|
21
|
+
export declare class TodoListManagerAdapter implements ReloadableService {
|
|
22
|
+
readonly name = "TodoListManager";
|
|
23
|
+
readonly dependsOnSections: readonly string[];
|
|
24
|
+
private instance;
|
|
25
|
+
private factory;
|
|
26
|
+
/**
|
|
27
|
+
* Constructor
|
|
28
|
+
* @param factoryOrInstance - Either a factory function or an existing instance
|
|
29
|
+
*/
|
|
30
|
+
constructor(factoryOrInstance: TodoListManagerFactory | TodoListManager);
|
|
31
|
+
/**
|
|
32
|
+
* Get the current TodoListManager instance
|
|
33
|
+
*/
|
|
34
|
+
getInstance(): TodoListManager | null;
|
|
35
|
+
/**
|
|
36
|
+
* Shutdown the current instance
|
|
37
|
+
* TodoListManager does not have explicit cleanup needs
|
|
38
|
+
*/
|
|
39
|
+
shutdown(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Reinitialize with new configuration
|
|
42
|
+
*/
|
|
43
|
+
reinitialize(config: UserConfig): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=todo-list-manager-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todo-list-manager-adapter.d.ts","sourceRoot":"","sources":["../../../src/services/reloadable/todo-list-manager-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAyB,MAAM,yCAAyC,CAAC;AAKjG;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK,eAAe,CAAC;AAc7E;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,eAAe,CAGzE;AAED;;GAEG;AACH,qBAAa,sBAAuB,YAAW,iBAAiB;IAC9D,QAAQ,CAAC,IAAI,qBAAqB;IAClC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAoB;IAEjE,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO,CAAC,OAAO,CAAyB;IAExC;;;OAGG;gBACS,iBAAiB,EAAE,sBAAsB,GAAG,eAAe;IASvE;;OAEG;IACH,WAAW,IAAI,eAAe,GAAG,IAAI;IAIrC;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/B;;OAEG;IACG,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAWtD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reloadable Service Adapter for TodoListManager
|
|
3
|
+
*
|
|
4
|
+
* Wraps TodoListManager to support hot-reload functionality.
|
|
5
|
+
* Reinitializes the service when integrations config changes.
|
|
6
|
+
*/
|
|
7
|
+
import { TodoListManager } from '../../integrations/todo-list-manager.js';
|
|
8
|
+
import { createLogger } from '../../utils/logger.js';
|
|
9
|
+
const logger = createLogger('TodoListManagerAdapter');
|
|
10
|
+
/**
|
|
11
|
+
* Extract TodoListManagerConfig from UserConfig
|
|
12
|
+
*/
|
|
13
|
+
function extractTodoListManagerConfig(config) {
|
|
14
|
+
return {
|
|
15
|
+
notionDatabaseId: config.integrations.notion.enabled
|
|
16
|
+
? config.integrations.notion.databaseId
|
|
17
|
+
: undefined,
|
|
18
|
+
appleRemindersDefaultList: config.integrations.appleReminders.defaultList,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Default factory that creates TodoListManager from UserConfig
|
|
23
|
+
*/
|
|
24
|
+
export function createTodoListManager(config) {
|
|
25
|
+
const todoConfig = extractTodoListManagerConfig(config);
|
|
26
|
+
return new TodoListManager(todoConfig);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Reloadable adapter for TodoListManager
|
|
30
|
+
*/
|
|
31
|
+
export class TodoListManagerAdapter {
|
|
32
|
+
name = 'TodoListManager';
|
|
33
|
+
dependsOnSections = ['integrations'];
|
|
34
|
+
instance = null;
|
|
35
|
+
factory;
|
|
36
|
+
/**
|
|
37
|
+
* Constructor
|
|
38
|
+
* @param factoryOrInstance - Either a factory function or an existing instance
|
|
39
|
+
*/
|
|
40
|
+
constructor(factoryOrInstance) {
|
|
41
|
+
if (typeof factoryOrInstance === 'function') {
|
|
42
|
+
this.factory = factoryOrInstance;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.instance = factoryOrInstance;
|
|
46
|
+
this.factory = createTodoListManager;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get the current TodoListManager instance
|
|
51
|
+
*/
|
|
52
|
+
getInstance() {
|
|
53
|
+
return this.instance;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Shutdown the current instance
|
|
57
|
+
* TodoListManager does not have explicit cleanup needs
|
|
58
|
+
*/
|
|
59
|
+
async shutdown() {
|
|
60
|
+
logger.debug('Shutting down TodoListManager');
|
|
61
|
+
// TodoListManager has no explicit cleanup (cache will be garbage collected)
|
|
62
|
+
// Just clear the reference
|
|
63
|
+
this.instance = null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Reinitialize with new configuration
|
|
67
|
+
*/
|
|
68
|
+
async reinitialize(config) {
|
|
69
|
+
logger.info('Reinitializing TodoListManager with new config');
|
|
70
|
+
try {
|
|
71
|
+
this.instance = this.factory(config);
|
|
72
|
+
logger.info('TodoListManager reinitialized successfully');
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
logger.error({ err: error }, 'Failed to reinitialize TodoListManager');
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=todo-list-manager-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todo-list-manager-adapter.js","sourceRoot":"","sources":["../../../src/services/reloadable/todo-list-manager-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,eAAe,EAAyB,MAAM,yCAAyC,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,MAAM,GAAG,YAAY,CAAC,wBAAwB,CAAC,CAAC;AAOtD;;GAEG;AACH,SAAS,4BAA4B,CAAC,MAAkB;IACtD,OAAO;QACL,gBAAgB,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO;YAClD,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU;YACvC,CAAC,CAAC,SAAS;QACb,yBAAyB,EAAE,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,WAAW;KAC1E,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAkB;IACtD,MAAM,UAAU,GAAG,4BAA4B,CAAC,MAAM,CAAC,CAAC;IACxD,OAAO,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,sBAAsB;IACxB,IAAI,GAAG,iBAAiB,CAAC;IACzB,iBAAiB,GAAsB,CAAC,cAAc,CAAC,CAAC;IAEzD,QAAQ,GAA2B,IAAI,CAAC;IACxC,OAAO,CAAyB;IAExC;;;OAGG;IACH,YAAY,iBAA2D;QACrE,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;YAC5C,IAAI,CAAC,OAAO,GAAG,iBAAiB,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC;YAClC,IAAI,CAAC,OAAO,GAAG,qBAAqB,CAAC;QACvC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC9C,4EAA4E;QAC5E,2BAA2B;QAC3B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,MAAkB;QACnC,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAE9D,IAAI,CAAC;YACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrC,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QAC5D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,wCAAwC,CAAC,CAAC;YACvE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reloadable Service Adapter for WorkingCadenceService
|
|
3
|
+
*
|
|
4
|
+
* Wraps WorkingCadenceService to support hot-reload functionality.
|
|
5
|
+
* Reinitializes the service when calendar config changes.
|
|
6
|
+
*/
|
|
7
|
+
import type { ReloadableService } from '../../types/hot-reload.js';
|
|
8
|
+
import type { UserConfig } from '../../types/config.js';
|
|
9
|
+
import { WorkingCadenceService } from '../working-cadence.js';
|
|
10
|
+
import type { CalendarSourceManager } from '../../integrations/calendar-source-manager.js';
|
|
11
|
+
/**
|
|
12
|
+
* Factory function type for creating WorkingCadenceService
|
|
13
|
+
*/
|
|
14
|
+
export type WorkingCadenceServiceFactory = (config: UserConfig, calendarSourceManager?: CalendarSourceManager) => WorkingCadenceService;
|
|
15
|
+
/**
|
|
16
|
+
* Default factory that creates WorkingCadenceService
|
|
17
|
+
*/
|
|
18
|
+
export declare function createWorkingCadenceService(_config: UserConfig, calendarSourceManager?: CalendarSourceManager): WorkingCadenceService;
|
|
19
|
+
/**
|
|
20
|
+
* Reloadable adapter for WorkingCadenceService
|
|
21
|
+
*/
|
|
22
|
+
export declare class WorkingCadenceAdapter implements ReloadableService {
|
|
23
|
+
readonly name = "WorkingCadenceService";
|
|
24
|
+
readonly dependsOnSections: readonly string[];
|
|
25
|
+
private instance;
|
|
26
|
+
private factory;
|
|
27
|
+
private calendarSourceManager?;
|
|
28
|
+
/**
|
|
29
|
+
* Constructor
|
|
30
|
+
* @param factoryOrInstance - Either a factory function or an existing instance
|
|
31
|
+
* @param calendarSourceManager - Optional CalendarSourceManager for focusTime analysis
|
|
32
|
+
*/
|
|
33
|
+
constructor(factoryOrInstance: WorkingCadenceServiceFactory | WorkingCadenceService, calendarSourceManager?: CalendarSourceManager);
|
|
34
|
+
/**
|
|
35
|
+
* Set the CalendarSourceManager for dependency injection
|
|
36
|
+
*/
|
|
37
|
+
setCalendarSourceManager(manager: CalendarSourceManager): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get the current WorkingCadenceService instance
|
|
40
|
+
*/
|
|
41
|
+
getInstance(): WorkingCadenceService | null;
|
|
42
|
+
/**
|
|
43
|
+
* Shutdown the current instance
|
|
44
|
+
* WorkingCadenceService does not have explicit cleanup needs
|
|
45
|
+
*/
|
|
46
|
+
shutdown(): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Reinitialize with new configuration
|
|
49
|
+
*/
|
|
50
|
+
reinitialize(config: UserConfig): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=working-cadence-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"working-cadence-adapter.d.ts","sourceRoot":"","sources":["../../../src/services/reloadable/working-cadence-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAK3F;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,CACzC,MAAM,EAAE,UAAU,EAClB,qBAAqB,CAAC,EAAE,qBAAqB,KAC1C,qBAAqB,CAAC;AAE3B;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,UAAU,EACnB,qBAAqB,CAAC,EAAE,qBAAqB,GAC5C,qBAAqB,CAEvB;AAED;;GAEG;AACH,qBAAa,qBAAsB,YAAW,iBAAiB;IAC7D,QAAQ,CAAC,IAAI,2BAA2B;IACxC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAgB;IAE7D,OAAO,CAAC,QAAQ,CAAsC;IACtD,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,qBAAqB,CAAC,CAAwB;IAEtD;;;;OAIG;gBAED,iBAAiB,EAAE,4BAA4B,GAAG,qBAAqB,EACvE,qBAAqB,CAAC,EAAE,qBAAqB;IAY/C;;OAEG;IACH,wBAAwB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI;IAI9D;;OAEG;IACH,WAAW,IAAI,qBAAqB,GAAG,IAAI;IAI3C;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/B;;OAEG;IACG,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAWtD"}
|