notebooklm-mcp-ultimate 2.2.1
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/LICENSE +21 -0
- package/README.md +420 -0
- package/dist/api/batch-execute-client.d.ts +232 -0
- package/dist/api/batch-execute-client.d.ts.map +1 -0
- package/dist/api/batch-execute-client.js +672 -0
- package/dist/api/batch-execute-client.js.map +1 -0
- package/dist/api/content-types.d.ts +44 -0
- package/dist/api/content-types.d.ts.map +1 -0
- package/dist/api/content-types.js +89 -0
- package/dist/api/content-types.js.map +1 -0
- package/dist/api/csrf-manager.d.ts +94 -0
- package/dist/api/csrf-manager.d.ts.map +1 -0
- package/dist/api/csrf-manager.js +178 -0
- package/dist/api/csrf-manager.js.map +1 -0
- package/dist/api/index.d.ts +27 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +56 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/operation-poller.d.ts +67 -0
- package/dist/api/operation-poller.d.ts.map +1 -0
- package/dist/api/operation-poller.js +132 -0
- package/dist/api/operation-poller.js.map +1 -0
- package/dist/api/request-builder.d.ts +196 -0
- package/dist/api/request-builder.d.ts.map +1 -0
- package/dist/api/request-builder.js +371 -0
- package/dist/api/request-builder.js.map +1 -0
- package/dist/api/response-parser.d.ts +124 -0
- package/dist/api/response-parser.d.ts.map +1 -0
- package/dist/api/response-parser.js +595 -0
- package/dist/api/response-parser.js.map +1 -0
- package/dist/api/rpc-ids.d.ts +92 -0
- package/dist/api/rpc-ids.d.ts.map +1 -0
- package/dist/api/rpc-ids.js +138 -0
- package/dist/api/rpc-ids.js.map +1 -0
- package/dist/api/streaming-chat-client.d.ts +50 -0
- package/dist/api/streaming-chat-client.d.ts.map +1 -0
- package/dist/api/streaming-chat-client.js +198 -0
- package/dist/api/streaming-chat-client.js.map +1 -0
- package/dist/api/types.d.ts +318 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +22 -0
- package/dist/api/types.js.map +1 -0
- package/dist/auth/auth-manager.d.ts +163 -0
- package/dist/auth/auth-manager.d.ts.map +1 -0
- package/dist/auth/auth-manager.js +1055 -0
- package/dist/auth/auth-manager.js.map +1 -0
- package/dist/auth/cookie-store.d.ts +121 -0
- package/dist/auth/cookie-store.d.ts.map +1 -0
- package/dist/auth/cookie-store.js +283 -0
- package/dist/auth/cookie-store.js.map +1 -0
- package/dist/config.d.ts +89 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +217 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +41 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +439 -0
- package/dist/index.js.map +1 -0
- package/dist/library/notebook-library.d.ts +79 -0
- package/dist/library/notebook-library.d.ts.map +1 -0
- package/dist/library/notebook-library.js +296 -0
- package/dist/library/notebook-library.js.map +1 -0
- package/dist/library/types.d.ts +67 -0
- package/dist/library/types.d.ts.map +1 -0
- package/dist/library/types.js +8 -0
- package/dist/library/types.js.map +1 -0
- package/dist/operations/content-operations.d.ts +78 -0
- package/dist/operations/content-operations.d.ts.map +1 -0
- package/dist/operations/content-operations.js +162 -0
- package/dist/operations/content-operations.js.map +1 -0
- package/dist/operations/hybrid-executor.d.ts +47 -0
- package/dist/operations/hybrid-executor.d.ts.map +1 -0
- package/dist/operations/hybrid-executor.js +114 -0
- package/dist/operations/hybrid-executor.js.map +1 -0
- package/dist/operations/notebook-crud-operations.d.ts +52 -0
- package/dist/operations/notebook-crud-operations.d.ts.map +1 -0
- package/dist/operations/notebook-crud-operations.js +248 -0
- package/dist/operations/notebook-crud-operations.js.map +1 -0
- package/dist/operations/research-operations.d.ts +42 -0
- package/dist/operations/research-operations.d.ts.map +1 -0
- package/dist/operations/research-operations.js +189 -0
- package/dist/operations/research-operations.js.map +1 -0
- package/dist/operations/source-operations.d.ts +59 -0
- package/dist/operations/source-operations.d.ts.map +1 -0
- package/dist/operations/source-operations.js +280 -0
- package/dist/operations/source-operations.js.map +1 -0
- package/dist/operations/studio-operations.d.ts +98 -0
- package/dist/operations/studio-operations.d.ts.map +1 -0
- package/dist/operations/studio-operations.js +309 -0
- package/dist/operations/studio-operations.js.map +1 -0
- package/dist/resources/resource-handlers.d.ts +22 -0
- package/dist/resources/resource-handlers.d.ts.map +1 -0
- package/dist/resources/resource-handlers.js +216 -0
- package/dist/resources/resource-handlers.js.map +1 -0
- package/dist/session/browser-session.d.ts +113 -0
- package/dist/session/browser-session.d.ts.map +1 -0
- package/dist/session/browser-session.js +670 -0
- package/dist/session/browser-session.js.map +1 -0
- package/dist/session/session-manager.d.ts +88 -0
- package/dist/session/session-manager.d.ts.map +1 -0
- package/dist/session/session-manager.js +314 -0
- package/dist/session/session-manager.js.map +1 -0
- package/dist/session/shared-context-manager.d.ts +107 -0
- package/dist/session/shared-context-manager.d.ts.map +1 -0
- package/dist/session/shared-context-manager.js +447 -0
- package/dist/session/shared-context-manager.js.map +1 -0
- package/dist/tools/definitions/ask-question.d.ts +8 -0
- package/dist/tools/definitions/ask-question.d.ts.map +1 -0
- package/dist/tools/definitions/ask-question.js +213 -0
- package/dist/tools/definitions/ask-question.js.map +1 -0
- package/dist/tools/definitions/content-generation.d.ts +52 -0
- package/dist/tools/definitions/content-generation.d.ts.map +1 -0
- package/dist/tools/definitions/content-generation.js +236 -0
- package/dist/tools/definitions/content-generation.js.map +1 -0
- package/dist/tools/definitions/notebook-crud.d.ts +9 -0
- package/dist/tools/definitions/notebook-crud.d.ts.map +1 -0
- package/dist/tools/definitions/notebook-crud.js +156 -0
- package/dist/tools/definitions/notebook-crud.js.map +1 -0
- package/dist/tools/definitions/notebook-management.d.ts +3 -0
- package/dist/tools/definitions/notebook-management.d.ts.map +1 -0
- package/dist/tools/definitions/notebook-management.js +243 -0
- package/dist/tools/definitions/notebook-management.js.map +1 -0
- package/dist/tools/definitions/research.d.ts +23 -0
- package/dist/tools/definitions/research.d.ts.map +1 -0
- package/dist/tools/definitions/research.js +108 -0
- package/dist/tools/definitions/research.js.map +1 -0
- package/dist/tools/definitions/session-management.d.ts +3 -0
- package/dist/tools/definitions/session-management.d.ts.map +1 -0
- package/dist/tools/definitions/session-management.js +41 -0
- package/dist/tools/definitions/session-management.js.map +1 -0
- package/dist/tools/definitions/source-management.d.ts +39 -0
- package/dist/tools/definitions/source-management.d.ts.map +1 -0
- package/dist/tools/definitions/source-management.js +224 -0
- package/dist/tools/definitions/source-management.js.map +1 -0
- package/dist/tools/definitions/studio.d.ts +36 -0
- package/dist/tools/definitions/studio.d.ts.map +1 -0
- package/dist/tools/definitions/studio.js +153 -0
- package/dist/tools/definitions/studio.js.map +1 -0
- package/dist/tools/definitions/system.d.ts +3 -0
- package/dist/tools/definitions/system.d.ts.map +1 -0
- package/dist/tools/definitions/system.js +143 -0
- package/dist/tools/definitions/system.js.map +1 -0
- package/dist/tools/definitions.d.ts +12 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +36 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/tools/handlers/content-handlers.d.ts +287 -0
- package/dist/tools/handlers/content-handlers.d.ts.map +1 -0
- package/dist/tools/handlers/content-handlers.js +244 -0
- package/dist/tools/handlers/content-handlers.js.map +1 -0
- package/dist/tools/handlers/notebook-crud-handlers.d.ts +69 -0
- package/dist/tools/handlers/notebook-crud-handlers.d.ts.map +1 -0
- package/dist/tools/handlers/notebook-crud-handlers.js +117 -0
- package/dist/tools/handlers/notebook-crud-handlers.js.map +1 -0
- package/dist/tools/handlers/research-handlers.d.ts +37 -0
- package/dist/tools/handlers/research-handlers.d.ts.map +1 -0
- package/dist/tools/handlers/research-handlers.js +87 -0
- package/dist/tools/handlers/research-handlers.js.map +1 -0
- package/dist/tools/handlers/source-handlers.d.ts +52 -0
- package/dist/tools/handlers/source-handlers.d.ts.map +1 -0
- package/dist/tools/handlers/source-handlers.js +177 -0
- package/dist/tools/handlers/source-handlers.js.map +1 -0
- package/dist/tools/handlers/studio-handlers.d.ts +125 -0
- package/dist/tools/handlers/studio-handlers.d.ts.map +1 -0
- package/dist/tools/handlers/studio-handlers.js +183 -0
- package/dist/tools/handlers/studio-handlers.js.map +1 -0
- package/dist/tools/handlers.d.ts +629 -0
- package/dist/tools/handlers.d.ts.map +1 -0
- package/dist/tools/handlers.js +833 -0
- package/dist/tools/handlers.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types.d.ts +82 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/cleanup-manager.d.ts +133 -0
- package/dist/utils/cleanup-manager.d.ts.map +1 -0
- package/dist/utils/cleanup-manager.js +673 -0
- package/dist/utils/cleanup-manager.js.map +1 -0
- package/dist/utils/cli-handler.d.ts +16 -0
- package/dist/utils/cli-handler.d.ts.map +1 -0
- package/dist/utils/cli-handler.js +102 -0
- package/dist/utils/cli-handler.js.map +1 -0
- package/dist/utils/logger.d.ts +61 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +92 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/page-utils.d.ts +54 -0
- package/dist/utils/page-utils.d.ts.map +1 -0
- package/dist/utils/page-utils.js +405 -0
- package/dist/utils/page-utils.js.map +1 -0
- package/dist/utils/settings-manager.d.ts +37 -0
- package/dist/utils/settings-manager.d.ts.map +1 -0
- package/dist/utils/settings-manager.js +120 -0
- package/dist/utils/settings-manager.js.map +1 -0
- package/dist/utils/stealth-utils.d.ts +135 -0
- package/dist/utils/stealth-utils.d.ts.map +1 -0
- package/dist/utils/stealth-utils.js +398 -0
- package/dist/utils/stealth-utils.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notebook CRUD Tool Handlers
|
|
3
|
+
*
|
|
4
|
+
* Implements handlers for notebook create/rename/delete tools.
|
|
5
|
+
*/
|
|
6
|
+
import { log } from '../../utils/logger.js';
|
|
7
|
+
import * as notebookOps from '../../operations/notebook-crud-operations.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create notebook CRUD handlers
|
|
10
|
+
*/
|
|
11
|
+
export function createNotebookCRUDHandlers(deps) {
|
|
12
|
+
const { library } = deps;
|
|
13
|
+
/**
|
|
14
|
+
* Handle create_notebook_remote tool
|
|
15
|
+
*/
|
|
16
|
+
async function handleCreateNotebookRemote(args, sendProgress) {
|
|
17
|
+
if (sendProgress) {
|
|
18
|
+
await sendProgress('Creating notebook in NotebookLM...');
|
|
19
|
+
}
|
|
20
|
+
const result = await notebookOps.createNotebook(args.title);
|
|
21
|
+
if (result.success && sendProgress) {
|
|
22
|
+
await sendProgress(`Notebook created: ${result.title}`);
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
success: result.success,
|
|
26
|
+
data: result.success ? {
|
|
27
|
+
notebook_id: result.notebookId,
|
|
28
|
+
title: result.title,
|
|
29
|
+
url: result.url,
|
|
30
|
+
message: `Notebook "${result.title}" created successfully`,
|
|
31
|
+
} : undefined,
|
|
32
|
+
error: result.error,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Handle rename_notebook_remote tool
|
|
37
|
+
*/
|
|
38
|
+
async function handleRenameNotebookRemote(args, sendProgress) {
|
|
39
|
+
if (sendProgress) {
|
|
40
|
+
await sendProgress(`Renaming notebook to "${args.new_title}"...`);
|
|
41
|
+
}
|
|
42
|
+
const result = await notebookOps.renameNotebook(args.notebook_id, args.new_title);
|
|
43
|
+
if (result.success && sendProgress) {
|
|
44
|
+
await sendProgress(`Notebook renamed to: ${args.new_title}`);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
success: result.success,
|
|
48
|
+
data: result.success ? {
|
|
49
|
+
notebook_id: result.notebookId,
|
|
50
|
+
title: result.title,
|
|
51
|
+
message: `Notebook renamed to "${result.title}"`,
|
|
52
|
+
} : undefined,
|
|
53
|
+
error: result.error,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Handle delete_notebook_remote tool
|
|
58
|
+
*/
|
|
59
|
+
async function handleDeleteNotebookRemote(args, sendProgress) {
|
|
60
|
+
if (sendProgress) {
|
|
61
|
+
await sendProgress('Deleting notebook from NotebookLM...');
|
|
62
|
+
}
|
|
63
|
+
const result = await notebookOps.deleteNotebookRemote(args.notebook_id);
|
|
64
|
+
if (result.success) {
|
|
65
|
+
// Also remove from local library if it exists
|
|
66
|
+
try {
|
|
67
|
+
const removed = library.removeNotebook(args.notebook_id);
|
|
68
|
+
if (removed) {
|
|
69
|
+
log.info(`Also removed notebook from local library`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (libraryError) {
|
|
73
|
+
log.warning(`Failed to remove from local library: ${libraryError}`);
|
|
74
|
+
// Don't fail the operation - remote delete succeeded
|
|
75
|
+
}
|
|
76
|
+
if (sendProgress) {
|
|
77
|
+
await sendProgress('Notebook deleted permanently');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
success: result.success,
|
|
82
|
+
data: result.success ? {
|
|
83
|
+
notebook_id: result.notebookId,
|
|
84
|
+
message: 'Notebook deleted permanently from NotebookLM',
|
|
85
|
+
} : undefined,
|
|
86
|
+
error: result.error,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Handle add_file_source tool
|
|
91
|
+
*/
|
|
92
|
+
async function handleAddFileSource(args, sendProgress) {
|
|
93
|
+
if (sendProgress) {
|
|
94
|
+
await sendProgress(`Uploading file: ${args.file_path}...`);
|
|
95
|
+
}
|
|
96
|
+
const result = await notebookOps.addFileSource(args.notebook_id, args.file_path);
|
|
97
|
+
if (result.success && sendProgress) {
|
|
98
|
+
await sendProgress(`File uploaded: ${result.title}`);
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
success: result.success,
|
|
102
|
+
data: result.success ? {
|
|
103
|
+
notebook_id: result.notebookId,
|
|
104
|
+
file_name: result.title,
|
|
105
|
+
message: `File "${result.title}" uploaded successfully`,
|
|
106
|
+
} : undefined,
|
|
107
|
+
error: result.error,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
handleCreateNotebookRemote,
|
|
112
|
+
handleRenameNotebookRemote,
|
|
113
|
+
handleDeleteNotebookRemote,
|
|
114
|
+
handleAddFileSource,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=notebook-crud-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notebook-crud-handlers.js","sourceRoot":"","sources":["../../../src/tools/handlers/notebook-crud-handlers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,WAAW,MAAM,8CAA8C,CAAC;AAc5E;;GAEG;AACH,MAAM,UAAU,0BAA0B,CAAC,IAAqC;IAC5E,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,KAAK,UAAU,0BAA0B,CACrC,IAAwB,EACxB,YAA+B;QAE/B,IAAI,YAAY,EAAE,CAAC;YACf,MAAM,YAAY,CAAC,oCAAoC,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE5D,IAAI,MAAM,CAAC,OAAO,IAAI,YAAY,EAAE,CAAC;YACjC,MAAM,YAAY,CAAC,qBAAqB,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC5D,CAAC;QAED,OAAO;YACH,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,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AAO;YACvB,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBACnB,WAAW,EAAE,MAAM,CAAC,UAAU;gBAC9B,SAAS,EAAE,MAAM,CAAC,KAAK;gBACvB,OAAO,EAAE,SAAS,MAAM,CAAC,KAAK,yBAAyB;aAC1D,CAAC,CAAC,CAAC,SAAS;YACb,KAAK,EAAE,MAAM,CAAC,KAAK;SACtB,CAAC;IACN,CAAC;IAED,OAAO;QACH,0BAA0B;QAC1B,0BAA0B;QAC1B,0BAA0B;QAC1B,mBAAmB;KACtB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Research Tool Handlers
|
|
3
|
+
*
|
|
4
|
+
* Implements handlers for research and source discovery tools.
|
|
5
|
+
*/
|
|
6
|
+
import type { NotebookLibrary } from '../../library/notebook-library.js';
|
|
7
|
+
import type { ProgressCallback } from '../../types.js';
|
|
8
|
+
import * as researchOps from '../../operations/research-operations.js';
|
|
9
|
+
/**
|
|
10
|
+
* Dependencies for research handlers
|
|
11
|
+
*/
|
|
12
|
+
export interface ResearchHandlerDependencies {
|
|
13
|
+
library: NotebookLibrary;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Research handlers type
|
|
17
|
+
*/
|
|
18
|
+
export type ResearchHandlers = ReturnType<typeof createResearchHandlers>;
|
|
19
|
+
/**
|
|
20
|
+
* Create research handlers
|
|
21
|
+
*/
|
|
22
|
+
export declare function createResearchHandlers(deps: ResearchHandlerDependencies): {
|
|
23
|
+
handleDiscoverSources: (args: {
|
|
24
|
+
topic: string;
|
|
25
|
+
notebook_id?: string;
|
|
26
|
+
}, sendProgress?: ProgressCallback) => Promise<researchOps.ResearchOperationResult>;
|
|
27
|
+
handleImportSource: (args: {
|
|
28
|
+
url: string;
|
|
29
|
+
notebook_id?: string;
|
|
30
|
+
}, sendProgress?: ProgressCallback) => Promise<researchOps.ResearchOperationResult>;
|
|
31
|
+
handleResearchTopic: (args: {
|
|
32
|
+
topic: string;
|
|
33
|
+
notebook_id?: string;
|
|
34
|
+
auto_import?: boolean;
|
|
35
|
+
}, sendProgress?: ProgressCallback) => Promise<researchOps.ResearchOperationResult>;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=research-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"research-handlers.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/research-handlers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,WAAW,MAAM,yCAAyC,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC,OAAO,EAAE,eAAe,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEzE;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,2BAA2B;kCAwB1D;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,iBAC9B,gBAAgB;+BAoBzB;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,iBAC5B,gBAAgB;gCA2BzB;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,iBACrD,gBAAgB;EAgCtC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Research Tool Handlers
|
|
3
|
+
*
|
|
4
|
+
* Implements handlers for research and source discovery tools.
|
|
5
|
+
*/
|
|
6
|
+
import { log } from '../../utils/logger.js';
|
|
7
|
+
import * as researchOps from '../../operations/research-operations.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create research handlers
|
|
10
|
+
*/
|
|
11
|
+
export function createResearchHandlers(deps) {
|
|
12
|
+
const { library } = deps;
|
|
13
|
+
/**
|
|
14
|
+
* Get notebook ID, using active notebook if not specified
|
|
15
|
+
*/
|
|
16
|
+
function resolveNotebookId(notebookId) {
|
|
17
|
+
if (notebookId) {
|
|
18
|
+
return notebookId;
|
|
19
|
+
}
|
|
20
|
+
const activeNotebook = library.getActiveNotebook();
|
|
21
|
+
if (!activeNotebook) {
|
|
22
|
+
log.warning('⚠️ No notebook specified and no active notebook selected');
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return activeNotebook.id;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Handle discover_sources tool
|
|
29
|
+
*/
|
|
30
|
+
async function handleDiscoverSources(args, sendProgress) {
|
|
31
|
+
if (sendProgress) {
|
|
32
|
+
await sendProgress(`🔍 Discovering sources for: ${args.topic}`);
|
|
33
|
+
}
|
|
34
|
+
const notebookId = resolveNotebookId(args.notebook_id);
|
|
35
|
+
const result = await researchOps.discoverSources(args.topic, notebookId || undefined);
|
|
36
|
+
if (result.success && sendProgress) {
|
|
37
|
+
await sendProgress(`✅ Found ${result.suggestions?.length || 0} search queries`);
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Handle import_source tool
|
|
43
|
+
*/
|
|
44
|
+
async function handleImportSource(args, sendProgress) {
|
|
45
|
+
const notebookId = resolveNotebookId(args.notebook_id);
|
|
46
|
+
if (!notebookId) {
|
|
47
|
+
return {
|
|
48
|
+
success: false,
|
|
49
|
+
error: 'No notebook specified and no active notebook selected',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (sendProgress) {
|
|
53
|
+
await sendProgress(`📥 Importing source: ${args.url}`);
|
|
54
|
+
}
|
|
55
|
+
const result = await researchOps.importSource(args.url, notebookId);
|
|
56
|
+
if (result.success && sendProgress) {
|
|
57
|
+
await sendProgress('✅ Source imported successfully');
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Handle research_topic tool
|
|
63
|
+
*/
|
|
64
|
+
async function handleResearchTopic(args, sendProgress) {
|
|
65
|
+
const notebookId = resolveNotebookId(args.notebook_id);
|
|
66
|
+
if (!notebookId) {
|
|
67
|
+
return {
|
|
68
|
+
success: false,
|
|
69
|
+
error: 'No notebook specified and no active notebook selected',
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (sendProgress) {
|
|
73
|
+
await sendProgress(`📚 Researching topic: ${args.topic}`);
|
|
74
|
+
}
|
|
75
|
+
const result = await researchOps.researchTopic(args.topic, notebookId, args.auto_import || false);
|
|
76
|
+
if (result.success && sendProgress) {
|
|
77
|
+
await sendProgress('✅ Research complete');
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
handleDiscoverSources,
|
|
83
|
+
handleImportSource,
|
|
84
|
+
handleResearchTopic,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=research-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"research-handlers.js","sourceRoot":"","sources":["../../../src/tools/handlers/research-handlers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,WAAW,MAAM,yCAAyC,CAAC;AAcvE;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAiC;IACpE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,SAAS,iBAAiB,CAAC,UAAmB;QAC1C,IAAI,UAAU,EAAE,CAAC;YACb,OAAO,UAAU,CAAC;QACtB,CAAC;QAED,MAAM,cAAc,GAAG,O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C,OAAO,IAAI,YAAY,EAAE,CAAC;YACjC,MAAM,YAAY,CAAC,gCAAgC,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,KAAK,UAAU,mBAAmB,CAC9B,IAAoE,EACpE,YAA+B;QAE/B,MAAM,UAAU,GAAG,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACvD,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,uDAAuD;aACjE,CAAC;QACN,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACf,MAAM,YAAY,CAAC,yBAAyB,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,aAAa,CAC1C,IAAI,CAAC,KAAK,EACV,UAAU,EACV,IAAI,CAAC,WAAW,IAAI,KAAK,CAC5B,CAAC;QAEF,IAAI,MAAM,CAAC,OAAO,IAAI,YAAY,EAAE,CAAC;YACjC,MAAM,YAAY,CAAC,qBAAqB,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,OAAO;QACH,qBAAqB;QACrB,kBAAkB;QAClB,mBAAmB;KACtB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source Management Tool Handlers
|
|
3
|
+
*
|
|
4
|
+
* Implements handlers for source management tools.
|
|
5
|
+
*/
|
|
6
|
+
import type { NotebookLibrary } from '../../library/notebook-library.js';
|
|
7
|
+
import type { ProgressCallback } from '../../types.js';
|
|
8
|
+
import * as sourceOps from '../../operations/source-operations.js';
|
|
9
|
+
/**
|
|
10
|
+
* Dependencies for source handlers
|
|
11
|
+
*/
|
|
12
|
+
export interface SourceHandlerDependencies {
|
|
13
|
+
library: NotebookLibrary;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Source handlers type
|
|
17
|
+
*/
|
|
18
|
+
export type SourceHandlers = ReturnType<typeof createSourceHandlers>;
|
|
19
|
+
/**
|
|
20
|
+
* Create source management handlers
|
|
21
|
+
*/
|
|
22
|
+
export declare function createSourceHandlers(deps: SourceHandlerDependencies): {
|
|
23
|
+
handleListSources: (args: {
|
|
24
|
+
notebook_id?: string;
|
|
25
|
+
}, sendProgress?: ProgressCallback) => Promise<sourceOps.SourceOperationResult>;
|
|
26
|
+
handleAddURLSource: (args: {
|
|
27
|
+
notebook_id?: string;
|
|
28
|
+
url: string;
|
|
29
|
+
}, sendProgress?: ProgressCallback) => Promise<sourceOps.SourceOperationResult>;
|
|
30
|
+
handleAddTextSource: (args: {
|
|
31
|
+
notebook_id?: string;
|
|
32
|
+
title: string;
|
|
33
|
+
content: string;
|
|
34
|
+
}, sendProgress?: ProgressCallback) => Promise<sourceOps.SourceOperationResult>;
|
|
35
|
+
handleAddYouTubeSource: (args: {
|
|
36
|
+
notebook_id?: string;
|
|
37
|
+
youtube_url: string;
|
|
38
|
+
}, sendProgress?: ProgressCallback) => Promise<sourceOps.SourceOperationResult>;
|
|
39
|
+
handleAddDriveSource: (args: {
|
|
40
|
+
notebook_id?: string;
|
|
41
|
+
file_id: string;
|
|
42
|
+
}, sendProgress?: ProgressCallback) => Promise<sourceOps.SourceOperationResult>;
|
|
43
|
+
handleDeleteSource: (args: {
|
|
44
|
+
notebook_id?: string;
|
|
45
|
+
source_id: string;
|
|
46
|
+
}, sendProgress?: ProgressCallback) => Promise<sourceOps.SourceOperationResult>;
|
|
47
|
+
handleSummarizeSource: (args: {
|
|
48
|
+
notebook_id?: string;
|
|
49
|
+
source_id: string;
|
|
50
|
+
}, sendProgress?: ProgressCallback) => Promise<sourceOps.SourceOperationResult>;
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=source-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-handlers.d.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|
|
4
|
+
* Implements handlers for source management tools.
|
|
5
|
+
*/
|
|
6
|
+
import { log } from '../../utils/logger.js';
|
|
7
|
+
import * as sourceOps from '../../operations/source-operations.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create source management handlers
|
|
10
|
+
*/
|
|
11
|
+
export function createSourceHandlers(deps) {
|
|
12
|
+
const { library } = deps;
|
|
13
|
+
/**
|
|
14
|
+
* Get notebook ID, using active notebook if not specified
|
|
15
|
+
*/
|
|
16
|
+
function resolveNotebookId(notebookId) {
|
|
17
|
+
if (notebookId) {
|
|
18
|
+
return notebookId;
|
|
19
|
+
}
|
|
20
|
+
const activeNotebook = library.getActiveNotebook();
|
|
21
|
+
if (!activeNotebook) {
|
|
22
|
+
log.warning('⚠️ No notebook specified and no active notebook selected');
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return activeNotebook.id;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Handle list_sources tool
|
|
29
|
+
*/
|
|
30
|
+
async function handleListSources(args, sendProgress) {
|
|
31
|
+
const notebookId = resolveNotebookId(args.notebook_id);
|
|
32
|
+
if (!notebookId) {
|
|
33
|
+
return {
|
|
34
|
+
success: false,
|
|
35
|
+
error: 'No notebook specified and no active notebook selected',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (sendProgress) {
|
|
39
|
+
await sendProgress('📚 Listing sources...');
|
|
40
|
+
}
|
|
41
|
+
const result = await sourceOps.listSources(notebookId);
|
|
42
|
+
if (result.success && sendProgress) {
|
|
43
|
+
await sendProgress(`✅ Found ${result.sources?.length || 0} sources`);
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Handle add_url_source tool
|
|
49
|
+
*/
|
|
50
|
+
async function handleAddURLSource(args, sendProgress) {
|
|
51
|
+
const notebookId = resolveNotebookId(args.notebook_id);
|
|
52
|
+
if (!notebookId) {
|
|
53
|
+
return {
|
|
54
|
+
success: false,
|
|
55
|
+
error: 'No notebook specified and no active notebook selected',
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (sendProgress) {
|
|
59
|
+
await sendProgress(`🔗 Adding URL source: ${args.url}`);
|
|
60
|
+
}
|
|
61
|
+
const result = await sourceOps.addURLSource(notebookId, args.url);
|
|
62
|
+
if (result.success && sendProgress) {
|
|
63
|
+
await sendProgress('✅ URL source added successfully');
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Handle add_text_source tool
|
|
69
|
+
*/
|
|
70
|
+
async function handleAddTextSource(args, sendProgress) {
|
|
71
|
+
const notebookId = resolveNotebookId(args.notebook_id);
|
|
72
|
+
if (!notebookId) {
|
|
73
|
+
return {
|
|
74
|
+
success: false,
|
|
75
|
+
error: 'No notebook specified and no active notebook selected',
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (sendProgress) {
|
|
79
|
+
await sendProgress(`📝 Adding text source: ${args.title}`);
|
|
80
|
+
}
|
|
81
|
+
const result = await sourceOps.addTextSource(notebookId, args.title, args.content);
|
|
82
|
+
if (result.success && sendProgress) {
|
|
83
|
+
await sendProgress('✅ Text source added successfully');
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Handle add_youtube_source tool
|
|
89
|
+
*/
|
|
90
|
+
async function handleAddYouTubeSource(args, sendProgress) {
|
|
91
|
+
const notebookId = resolveNotebookId(args.notebook_id);
|
|
92
|
+
if (!notebookId) {
|
|
93
|
+
return {
|
|
94
|
+
success: false,
|
|
95
|
+
error: 'No notebook specified and no active notebook selected',
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (sendProgress) {
|
|
99
|
+
await sendProgress(`🎥 Adding YouTube source: ${args.youtube_url}`);
|
|
100
|
+
}
|
|
101
|
+
const result = await sourceOps.addYouTubeSource(notebookId, args.youtube_url);
|
|
102
|
+
if (result.success && sendProgress) {
|
|
103
|
+
await sendProgress('✅ YouTube source added successfully');
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Handle add_drive_source tool
|
|
109
|
+
*/
|
|
110
|
+
async function handleAddDriveSource(args, sendProgress) {
|
|
111
|
+
const notebookId = resolveNotebookId(args.notebook_id);
|
|
112
|
+
if (!notebookId) {
|
|
113
|
+
return {
|
|
114
|
+
success: false,
|
|
115
|
+
error: 'No notebook specified and no active notebook selected',
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (sendProgress) {
|
|
119
|
+
await sendProgress(`📁 Adding Google Drive source: ${args.file_id}`);
|
|
120
|
+
}
|
|
121
|
+
const result = await sourceOps.addDriveSource(notebookId, args.file_id);
|
|
122
|
+
if (result.success && sendProgress) {
|
|
123
|
+
await sendProgress('✅ Google Drive source added successfully');
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Handle delete_source tool
|
|
129
|
+
*/
|
|
130
|
+
async function handleDeleteSource(args, sendProgress) {
|
|
131
|
+
const notebookId = resolveNotebookId(args.notebook_id);
|
|
132
|
+
if (!notebookId) {
|
|
133
|
+
return {
|
|
134
|
+
success: false,
|
|
135
|
+
error: 'No notebook specified and no active notebook selected',
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (sendProgress) {
|
|
139
|
+
await sendProgress(`🗑️ Deleting source: ${args.source_id}`);
|
|
140
|
+
}
|
|
141
|
+
const result = await sourceOps.deleteSource(notebookId, args.source_id);
|
|
142
|
+
if (result.success && sendProgress) {
|
|
143
|
+
await sendProgress('✅ Source deleted successfully');
|
|
144
|
+
}
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Handle summarize_source tool
|
|
149
|
+
*/
|
|
150
|
+
async function handleSummarizeSource(args, sendProgress) {
|
|
151
|
+
const notebookId = resolveNotebookId(args.notebook_id);
|
|
152
|
+
if (!notebookId) {
|
|
153
|
+
return {
|
|
154
|
+
success: false,
|
|
155
|
+
error: 'No notebook specified and no active notebook selected',
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (sendProgress) {
|
|
159
|
+
await sendProgress(`📄 Getting source summary: ${args.source_id}`);
|
|
160
|
+
}
|
|
161
|
+
const result = await sourceOps.summarizeSource(notebookId, args.source_id);
|
|
162
|
+
if (result.success && sendProgress) {
|
|
163
|
+
await sendProgress('✅ Source summary retrieved');
|
|
164
|
+
}
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
handleListSources,
|
|
169
|
+
handleAddURLSource,
|
|
170
|
+
handleAddTextSource,
|
|
171
|
+
handleAddYouTubeSource,
|
|
172
|
+
handleAddDriveSource,
|
|
173
|
+
handleDeleteSource,
|
|
174
|
+
handleSummarizeSource,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=source-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-handlers.js","sourceRoot":"","sources":["../../../src/tools/handlers/source-handlers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,uCAAuC,CAAC;AAcnE;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAA+B;IAChE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,SAAS,iBAAiB,CAAC,UAAmB;QAC1C,IAAI,UAAU,EAAE,CAAC;YACb,OAAO,UAAU,CAAC;QACtB,CAAC;QAED,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;QACnD,IAAI,CAAC,cAAc,EAAE,CAAC;YAClB,GAAG,CAAC,OAAO,CAAC,2DAA2D,CAAC,CAAC;YACzE,OAAO,IAAI,CAAC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AM,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,KAAK,UAAU,qBAAqB,CAChC,IAAiD,EACjD,YAA+B;QAE/B,MAAM,UAAU,GAAG,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACvD,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,uDAAuD;aACjE,CAAC;QACN,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACf,MAAM,YAAY,CAAC,8BAA8B,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAE3E,IAAI,MAAM,CAAC,OAAO,IAAI,YAAY,EAAE,CAAC;YACjC,MAAM,YAAY,CAAC,4BAA4B,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,OAAO;QACH,iBAAiB;QACjB,kBAAkB;QAClB,mBAAmB;QACnB,sBAAsB;QACtB,oBAAoB;QACpB,kBAAkB;QAClB,qBAAqB;KACxB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audio Studio Tool Handlers
|
|
3
|
+
*
|
|
4
|
+
* Implements the handler logic for audio studio tools.
|
|
5
|
+
*/
|
|
6
|
+
import type { NotebookLibrary } from '../../library/notebook-library.js';
|
|
7
|
+
import type { ProgressCallback } from '../../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Studio handler dependencies
|
|
10
|
+
*/
|
|
11
|
+
export interface StudioHandlerDependencies {
|
|
12
|
+
library: NotebookLibrary;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create studio handlers with dependencies
|
|
16
|
+
*/
|
|
17
|
+
export declare function createStudioHandlers(deps: StudioHandlerDependencies): {
|
|
18
|
+
/**
|
|
19
|
+
* Handle get_audio_status tool call
|
|
20
|
+
*/
|
|
21
|
+
handleGetAudioStatus(args: {
|
|
22
|
+
notebook_id?: string;
|
|
23
|
+
}, sendProgress?: ProgressCallback): Promise<{
|
|
24
|
+
success: boolean;
|
|
25
|
+
error: string;
|
|
26
|
+
status?: undefined;
|
|
27
|
+
audio_url?: undefined;
|
|
28
|
+
duration_seconds?: undefined;
|
|
29
|
+
transcript?: undefined;
|
|
30
|
+
progress?: undefined;
|
|
31
|
+
notebook_id?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
success: boolean;
|
|
34
|
+
status: import("../../api/types.js").AudioStatus | undefined;
|
|
35
|
+
audio_url: string | undefined;
|
|
36
|
+
duration_seconds: number | undefined;
|
|
37
|
+
transcript: string | undefined;
|
|
38
|
+
progress: number | undefined;
|
|
39
|
+
notebook_id: string;
|
|
40
|
+
error?: undefined;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* Handle create_audio tool call
|
|
44
|
+
*/
|
|
45
|
+
handleCreateAudio(args: {
|
|
46
|
+
notebook_id?: string;
|
|
47
|
+
custom_instructions?: string;
|
|
48
|
+
focus_topics?: string[];
|
|
49
|
+
target_audience?: "general" | "expert" | "student";
|
|
50
|
+
}, sendProgress?: ProgressCallback): Promise<{
|
|
51
|
+
success: boolean;
|
|
52
|
+
error: string;
|
|
53
|
+
status?: undefined;
|
|
54
|
+
notebook_id?: undefined;
|
|
55
|
+
message?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
success: boolean;
|
|
58
|
+
status: import("../../api/types.js").AudioStatus | undefined;
|
|
59
|
+
notebook_id: string;
|
|
60
|
+
message: string;
|
|
61
|
+
error?: undefined;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Handle update_audio tool call
|
|
65
|
+
*/
|
|
66
|
+
handleUpdateAudio(args: {
|
|
67
|
+
notebook_id?: string;
|
|
68
|
+
custom_instructions?: string;
|
|
69
|
+
focus_topics?: string[];
|
|
70
|
+
target_audience?: "general" | "expert" | "student";
|
|
71
|
+
}, sendProgress?: ProgressCallback): Promise<{
|
|
72
|
+
success: boolean;
|
|
73
|
+
error: string;
|
|
74
|
+
status?: undefined;
|
|
75
|
+
notebook_id?: undefined;
|
|
76
|
+
message?: undefined;
|
|
77
|
+
} | {
|
|
78
|
+
success: boolean;
|
|
79
|
+
status: import("../../api/types.js").AudioStatus | undefined;
|
|
80
|
+
notebook_id: string;
|
|
81
|
+
message: string;
|
|
82
|
+
error?: undefined;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Handle delete_audio tool call
|
|
86
|
+
*/
|
|
87
|
+
handleDeleteAudio(args: {
|
|
88
|
+
notebook_id?: string;
|
|
89
|
+
}, sendProgress?: ProgressCallback): Promise<{
|
|
90
|
+
success: boolean;
|
|
91
|
+
error: string;
|
|
92
|
+
status?: undefined;
|
|
93
|
+
notebook_id?: undefined;
|
|
94
|
+
message?: undefined;
|
|
95
|
+
} | {
|
|
96
|
+
success: boolean;
|
|
97
|
+
status: import("../../api/types.js").AudioStatus | undefined;
|
|
98
|
+
notebook_id: string;
|
|
99
|
+
message: string;
|
|
100
|
+
error?: undefined;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Handle download_audio tool call
|
|
104
|
+
*/
|
|
105
|
+
handleDownloadAudio(args: {
|
|
106
|
+
notebook_id?: string;
|
|
107
|
+
}, sendProgress?: ProgressCallback): Promise<{
|
|
108
|
+
success: boolean;
|
|
109
|
+
error: string;
|
|
110
|
+
download_url?: undefined;
|
|
111
|
+
notebook_id?: undefined;
|
|
112
|
+
message?: undefined;
|
|
113
|
+
} | {
|
|
114
|
+
success: boolean;
|
|
115
|
+
download_url: string | undefined;
|
|
116
|
+
notebook_id: string;
|
|
117
|
+
message: string;
|
|
118
|
+
error?: undefined;
|
|
119
|
+
}>;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Type for the studio handlers object
|
|
123
|
+
*/
|
|
124
|
+
export type StudioHandlers = ReturnType<typeof createStudioHandlers>;
|
|
125
|
+
//# sourceMappingURL=studio-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studio-handlers.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/studio-handlers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAUvD;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC,OAAO,EAAE,eAAe,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,yBAAyB;IAqB5D;;OAEG;+BAEO;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,iBACf,gBAAgB;;;;;;;;;;;;;;;;;;;IAoCnC;;OAEG;4BAEO;QACF,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,eAAe,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;KACtD,iBACc,gBAAgB;;;;;;;;;;;;;IAsCnC;;OAEG;4BAEO;QACF,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,eAAe,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;KACtD,iBACc,gBAAgB;;;;;;;;;;;;;IAsCnC;;OAEG;4BAEO;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,iBACf,gBAAgB;;;;;;;;;;;;;IAiCnC;;OAEG;8BAEO;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,iBACf,gBAAgB;;;;;;;;;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