@opentabs-dev/opentabs-plugin-onenote 0.0.74
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/README.md +159 -0
- package/dist/adapter.iife.js +14878 -0
- package/dist/adapter.iife.js.map +7 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/onenote-api.d.ts +13 -0
- package/dist/onenote-api.d.ts.map +1 -0
- package/dist/onenote-api.js +127 -0
- package/dist/onenote-api.js.map +1 -0
- package/dist/tools/create-notebook.d.ts +26 -0
- package/dist/tools/create-notebook.d.ts.map +1 -0
- package/dist/tools/create-notebook.js +26 -0
- package/dist/tools/create-notebook.js.map +1 -0
- package/dist/tools/create-page.d.ts +16 -0
- package/dist/tools/create-page.d.ts.map +1 -0
- package/dist/tools/create-page.js +35 -0
- package/dist/tools/create-page.js.map +1 -0
- package/dist/tools/create-section-group.d.ts +25 -0
- package/dist/tools/create-section-group.d.ts.map +1 -0
- package/dist/tools/create-section-group.js +27 -0
- package/dist/tools/create-section-group.js.map +1 -0
- package/dist/tools/create-section.d.ts +25 -0
- package/dist/tools/create-section.d.ts.map +1 -0
- package/dist/tools/create-section.js +27 -0
- package/dist/tools/create-section.js.map +1 -0
- package/dist/tools/get-current-user.d.ts +12 -0
- package/dist/tools/get-current-user.d.ts.map +1 -0
- package/dist/tools/get-current-user.js +21 -0
- package/dist/tools/get-current-user.js.map +1 -0
- package/dist/tools/get-notebook.d.ts +26 -0
- package/dist/tools/get-notebook.d.ts.map +1 -0
- package/dist/tools/get-notebook.js +23 -0
- package/dist/tools/get-notebook.js.map +1 -0
- package/dist/tools/get-recent-notebooks.d.ts +12 -0
- package/dist/tools/get-recent-notebooks.d.ts.map +1 -0
- package/dist/tools/get-recent-notebooks.js +27 -0
- package/dist/tools/get-recent-notebooks.js.map +1 -0
- package/dist/tools/get-section-group.d.ts +24 -0
- package/dist/tools/get-section-group.d.ts.map +1 -0
- package/dist/tools/get-section-group.js +23 -0
- package/dist/tools/get-section-group.js.map +1 -0
- package/dist/tools/get-section.d.ts +24 -0
- package/dist/tools/get-section.d.ts.map +1 -0
- package/dist/tools/get-section.js +23 -0
- package/dist/tools/get-section.js.map +1 -0
- package/dist/tools/list-notebooks.d.ts +27 -0
- package/dist/tools/list-notebooks.d.ts.map +1 -0
- package/dist/tools/list-notebooks.js +38 -0
- package/dist/tools/list-notebooks.js.map +1 -0
- package/dist/tools/list-section-groups.d.ts +25 -0
- package/dist/tools/list-section-groups.d.ts.map +1 -0
- package/dist/tools/list-section-groups.js +38 -0
- package/dist/tools/list-section-groups.js.map +1 -0
- package/dist/tools/list-sections.d.ts +25 -0
- package/dist/tools/list-sections.d.ts.map +1 -0
- package/dist/tools/list-sections.js +35 -0
- package/dist/tools/list-sections.js.map +1 -0
- package/dist/tools/schemas.d.ts +254 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +139 -0
- package/dist/tools/schemas.js.map +1 -0
- package/dist/tools.json +1347 -0
- package/package.json +55 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OpenTabsPlugin } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import type { ToolDefinition } from '@opentabs-dev/plugin-sdk';
|
|
3
|
+
declare class OneNotePlugin extends OpenTabsPlugin {
|
|
4
|
+
readonly name = "onenote";
|
|
5
|
+
readonly description = "OpenTabs plugin for Microsoft OneNote";
|
|
6
|
+
readonly displayName = "Microsoft OneNote";
|
|
7
|
+
readonly urlPatterns: string[];
|
|
8
|
+
readonly homepage = "https://onenote.cloud.microsoft/";
|
|
9
|
+
readonly tools: ToolDefinition[];
|
|
10
|
+
isReady(): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: OneNotePlugin;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAe/D,cAAM,aAAc,SAAQ,cAAc;IACxC,QAAQ,CAAC,IAAI,aAAa;IAC1B,QAAQ,CAAC,WAAW,2CAA2C;IAC/D,SAAkB,WAAW,uBAAuB;IACpD,QAAQ,CAAC,WAAW,WAAqC;IACzD,SAAkB,QAAQ,sCAAsC;IAChE,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,CAkB9B;IAEI,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;CAIlC;;AAED,wBAAmC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { OpenTabsPlugin } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { isAuthenticated, waitForAuth } from './onenote-api.js';
|
|
3
|
+
import { createNotebook } from './tools/create-notebook.js';
|
|
4
|
+
import { createPage } from './tools/create-page.js';
|
|
5
|
+
import { createSection } from './tools/create-section.js';
|
|
6
|
+
import { createSectionGroup } from './tools/create-section-group.js';
|
|
7
|
+
import { getCurrentUser } from './tools/get-current-user.js';
|
|
8
|
+
import { getNotebook } from './tools/get-notebook.js';
|
|
9
|
+
import { getRecentNotebooks } from './tools/get-recent-notebooks.js';
|
|
10
|
+
import { getSection } from './tools/get-section.js';
|
|
11
|
+
import { getSectionGroup } from './tools/get-section-group.js';
|
|
12
|
+
import { listNotebooks } from './tools/list-notebooks.js';
|
|
13
|
+
import { listSectionGroups } from './tools/list-section-groups.js';
|
|
14
|
+
import { listSections } from './tools/list-sections.js';
|
|
15
|
+
class OneNotePlugin extends OpenTabsPlugin {
|
|
16
|
+
name = 'onenote';
|
|
17
|
+
description = 'OpenTabs plugin for Microsoft OneNote';
|
|
18
|
+
displayName = 'Microsoft OneNote';
|
|
19
|
+
urlPatterns = ['*://onenote.cloud.microsoft/*'];
|
|
20
|
+
homepage = 'https://onenote.cloud.microsoft/';
|
|
21
|
+
tools = [
|
|
22
|
+
// Notebooks
|
|
23
|
+
listNotebooks,
|
|
24
|
+
getNotebook,
|
|
25
|
+
createNotebook,
|
|
26
|
+
getRecentNotebooks,
|
|
27
|
+
// Sections
|
|
28
|
+
listSections,
|
|
29
|
+
getSection,
|
|
30
|
+
createSection,
|
|
31
|
+
// Section Groups
|
|
32
|
+
listSectionGroups,
|
|
33
|
+
getSectionGroup,
|
|
34
|
+
createSectionGroup,
|
|
35
|
+
// Pages
|
|
36
|
+
createPage,
|
|
37
|
+
// Account
|
|
38
|
+
getCurrentUser,
|
|
39
|
+
];
|
|
40
|
+
async isReady() {
|
|
41
|
+
if (isAuthenticated())
|
|
42
|
+
return true;
|
|
43
|
+
return waitForAuth();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export default new OneNotePlugin();
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,aAAc,SAAQ,cAAc;IAC/B,IAAI,GAAG,SAAS,CAAC;IACjB,WAAW,GAAG,uCAAuC,CAAC;IAC7C,WAAW,GAAG,mBAAmB,CAAC;IAC3C,WAAW,GAAG,CAAC,+BAA+B,CAAC,CAAC;IACvC,QAAQ,GAAG,kCAAkC,CAAC;IACvD,KAAK,GAAqB;QACjC,YAAY;QACZ,aAAa;QACb,WAAW;QACX,cAAc;QACd,kBAAkB;QAClB,WAAW;QACX,YAAY;QACZ,UAAU;QACV,aAAa;QACb,iBAAiB;QACjB,iBAAiB;QACjB,eAAe;QACf,kBAAkB;QAClB,QAAQ;QACR,UAAU;QACV,UAAU;QACV,cAAc;KACf,CAAC;IAEF,KAAK,CAAC,OAAO;QACX,IAAI,eAAe,EAAE;YAAE,OAAO,IAAI,CAAC;QACnC,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC;CACF;AAED,eAAe,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const isAuthenticated: () => boolean;
|
|
2
|
+
export declare const waitForAuth: () => Promise<boolean>;
|
|
3
|
+
/**
|
|
4
|
+
* Calls the Microsoft Graph API for OneNote operations.
|
|
5
|
+
* Auth is via MSAL bearer tokens extracted from localStorage.
|
|
6
|
+
*/
|
|
7
|
+
export declare const api: <T>(endpoint: string, options?: {
|
|
8
|
+
method?: string;
|
|
9
|
+
body?: Record<string, unknown> | string;
|
|
10
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
11
|
+
contentType?: string;
|
|
12
|
+
}) => Promise<T>;
|
|
13
|
+
//# sourceMappingURL=onenote-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onenote-api.d.ts","sourceRoot":"","sources":["../src/onenote-api.ts"],"names":[],"mappings":"AA6EA,eAAO,MAAM,eAAe,QAAO,OAA6B,CAAC;AAEjE,eAAO,MAAM,WAAW,QAAO,OAAO,CAAC,OAAO,CAI3C,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,GAAG,GAAU,CAAC,EACzB,UAAU,MAAM,EAChB,UAAS;IACP,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;CACjB,KACL,OAAO,CAAC,CAAC,CA+DX,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { ToolError, findLocalStorageEntry, getAuthCache, setAuthCache, clearAuthCache, parseRetryAfterMs, waitUntil, buildQueryString, } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
const GRAPH_BASE = 'https://graph.microsoft.com/v1.0';
|
|
3
|
+
// MSAL client ID used by the OneNote web app
|
|
4
|
+
const MSAL_CLIENT_ID = '2821b473-fe24-4c86-ba16-62834d6e80c3';
|
|
5
|
+
/**
|
|
6
|
+
* Extracts the Microsoft Graph access token from MSAL localStorage entries.
|
|
7
|
+
* The OneNote web app stores MSAL tokens in localStorage with keys containing
|
|
8
|
+
* "accesstoken" and the target resource URL.
|
|
9
|
+
*/
|
|
10
|
+
const extractMsalToken = () => {
|
|
11
|
+
// Find the token keys entry for this MSAL client
|
|
12
|
+
const tokenKeysEntry = findLocalStorageEntry(key => key === `msal.token.keys.${MSAL_CLIENT_ID}`);
|
|
13
|
+
if (!tokenKeysEntry)
|
|
14
|
+
return null;
|
|
15
|
+
let tokenKeys;
|
|
16
|
+
try {
|
|
17
|
+
tokenKeys = JSON.parse(tokenKeysEntry.value);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
// Look for a Graph API access token
|
|
23
|
+
const graphKey = tokenKeys.accessToken?.find(k => k.includes('graph.microsoft.com') || k.includes('notes.create'));
|
|
24
|
+
if (!graphKey)
|
|
25
|
+
return null;
|
|
26
|
+
const entryStr = findLocalStorageEntry(key => key === graphKey);
|
|
27
|
+
if (!entryStr)
|
|
28
|
+
return null;
|
|
29
|
+
let entry;
|
|
30
|
+
try {
|
|
31
|
+
entry = JSON.parse(entryStr.value);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
if (!entry.secret)
|
|
37
|
+
return null;
|
|
38
|
+
// Check expiration
|
|
39
|
+
const expiresOn = Number(entry.expiresOn ?? 0);
|
|
40
|
+
const nowSeconds = Math.floor(Date.now() / 1000);
|
|
41
|
+
if (expiresOn > 0 && expiresOn < nowSeconds)
|
|
42
|
+
return null;
|
|
43
|
+
return entry.secret;
|
|
44
|
+
};
|
|
45
|
+
const getAuth = () => {
|
|
46
|
+
const cached = getAuthCache('onenote');
|
|
47
|
+
if (cached && cached.expiresOn > Math.floor(Date.now() / 1000))
|
|
48
|
+
return cached;
|
|
49
|
+
const token = extractMsalToken();
|
|
50
|
+
if (!token)
|
|
51
|
+
return null;
|
|
52
|
+
const auth = {
|
|
53
|
+
token,
|
|
54
|
+
expiresOn: Math.floor(Date.now() / 1000) + 3600,
|
|
55
|
+
};
|
|
56
|
+
setAuthCache('onenote', auth);
|
|
57
|
+
return auth;
|
|
58
|
+
};
|
|
59
|
+
export const isAuthenticated = () => getAuth() !== null;
|
|
60
|
+
export const waitForAuth = () => waitUntil(() => isAuthenticated(), { interval: 500, timeout: 5000 }).then(() => true, () => false);
|
|
61
|
+
/**
|
|
62
|
+
* Calls the Microsoft Graph API for OneNote operations.
|
|
63
|
+
* Auth is via MSAL bearer tokens extracted from localStorage.
|
|
64
|
+
*/
|
|
65
|
+
export const api = async (endpoint, options = {}) => {
|
|
66
|
+
const auth = getAuth();
|
|
67
|
+
if (!auth) {
|
|
68
|
+
clearAuthCache('onenote');
|
|
69
|
+
throw ToolError.auth('Not authenticated — please log in to Microsoft OneNote.');
|
|
70
|
+
}
|
|
71
|
+
const qs = options.query ? buildQueryString(options.query) : '';
|
|
72
|
+
const url = qs ? `${GRAPH_BASE}${endpoint}?${qs}` : `${GRAPH_BASE}${endpoint}`;
|
|
73
|
+
const headers = {
|
|
74
|
+
Authorization: `Bearer ${auth.token}`,
|
|
75
|
+
};
|
|
76
|
+
let fetchBody;
|
|
77
|
+
if (options.body) {
|
|
78
|
+
if (typeof options.body === 'string') {
|
|
79
|
+
headers['Content-Type'] = options.contentType ?? 'text/html';
|
|
80
|
+
fetchBody = options.body;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
headers['Content-Type'] = 'application/json';
|
|
84
|
+
fetchBody = JSON.stringify(options.body);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
let response;
|
|
88
|
+
try {
|
|
89
|
+
response = await fetch(url, {
|
|
90
|
+
method: options.method ?? 'GET',
|
|
91
|
+
headers,
|
|
92
|
+
body: fetchBody,
|
|
93
|
+
signal: AbortSignal.timeout(30_000),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
if (err instanceof DOMException && err.name === 'TimeoutError')
|
|
98
|
+
throw ToolError.timeout(`API request timed out: ${endpoint}`);
|
|
99
|
+
if (err instanceof DOMException && err.name === 'AbortError')
|
|
100
|
+
throw new ToolError('Request was aborted', 'aborted');
|
|
101
|
+
throw new ToolError(`Network error: ${err instanceof Error ? err.message : String(err)}`, 'network_error', {
|
|
102
|
+
category: 'internal',
|
|
103
|
+
retryable: true,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (!response.ok) {
|
|
107
|
+
const errorBody = (await response.text().catch(() => '')).substring(0, 512);
|
|
108
|
+
if (response.status === 429) {
|
|
109
|
+
const retryAfter = response.headers.get('Retry-After');
|
|
110
|
+
const retryMs = retryAfter !== null ? parseRetryAfterMs(retryAfter) : undefined;
|
|
111
|
+
throw ToolError.rateLimited(`Rate limited: ${endpoint} — ${errorBody}`, retryMs);
|
|
112
|
+
}
|
|
113
|
+
if (response.status === 401 || response.status === 403) {
|
|
114
|
+
clearAuthCache('onenote');
|
|
115
|
+
throw ToolError.auth(`Auth error (${response.status}): ${errorBody}`);
|
|
116
|
+
}
|
|
117
|
+
if (response.status === 404)
|
|
118
|
+
throw ToolError.notFound(`Not found: ${endpoint} — ${errorBody}`);
|
|
119
|
+
if (response.status === 400 || response.status === 422)
|
|
120
|
+
throw ToolError.validation(`Validation error: ${endpoint} — ${errorBody}`);
|
|
121
|
+
throw ToolError.internal(`API error (${response.status}): ${endpoint} — ${errorBody}`);
|
|
122
|
+
}
|
|
123
|
+
if (response.status === 204)
|
|
124
|
+
return {};
|
|
125
|
+
return (await response.json());
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=onenote-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onenote-api.js","sourceRoot":"","sources":["../src/onenote-api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,MAAM,UAAU,GAAG,kCAAkC,CAAC;AAEtD,6CAA6C;AAC7C,MAAM,cAAc,GAAG,sCAAsC,CAAC;AAO9D;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,GAAkB,EAAE;IAC3C,iDAAiD;IACjD,MAAM,cAAc,GAAG,qBAAqB,CAAC,GAAG,CAAC,EAAE,CAAC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AK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG;YACpD,MAAM,SAAS,CAAC,UAAU,CAAC,qBAAqB,QAAQ,MAAM,SAAS,EAAE,CAAC,CAAC;QAC7E,MAAM,SAAS,CAAC,QAAQ,CAAC,cAAc,QAAQ,CAAC,MAAM,MAAM,QAAQ,MAAM,SAAS,EAAE,CAAC,CAAC;IACzF,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,EAAO,CAAC;IAC5C,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAM,CAAC;AACtC,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createNotebook: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
display_name: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
notebook: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
display_name: z.ZodString;
|
|
8
|
+
created_at: z.ZodString;
|
|
9
|
+
last_modified_at: z.ZodString;
|
|
10
|
+
is_default: z.ZodBoolean;
|
|
11
|
+
is_shared: z.ZodBoolean;
|
|
12
|
+
user_role: z.ZodString;
|
|
13
|
+
sections_url: z.ZodString;
|
|
14
|
+
section_groups_url: z.ZodString;
|
|
15
|
+
created_by: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
display_name: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
last_modified_by: z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
display_name: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
web_url: z.ZodString;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
//# sourceMappingURL=create-notebook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-notebook.d.ts","sourceRoot":"","sources":["../../src/tools/create-notebook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;kBAqBzB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../onenote-api.js';
|
|
4
|
+
import { mapNotebook, notebookSchema } from './schemas.js';
|
|
5
|
+
export const createNotebook = defineTool({
|
|
6
|
+
name: 'create_notebook',
|
|
7
|
+
displayName: 'Create Notebook',
|
|
8
|
+
description: "Create a new OneNote notebook. The notebook name must be unique across the user's notebooks. Returns the created notebook with its ID and web URL.",
|
|
9
|
+
summary: 'Create a new notebook',
|
|
10
|
+
icon: 'book-plus',
|
|
11
|
+
group: 'Notebooks',
|
|
12
|
+
input: z.object({
|
|
13
|
+
display_name: z.string().min(1).describe('Name for the new notebook (must be unique)'),
|
|
14
|
+
}),
|
|
15
|
+
output: z.object({
|
|
16
|
+
notebook: notebookSchema.describe('Created notebook'),
|
|
17
|
+
}),
|
|
18
|
+
handle: async (params) => {
|
|
19
|
+
const data = await api('/me/onenote/notebooks', {
|
|
20
|
+
method: 'POST',
|
|
21
|
+
body: { displayName: params.display_name },
|
|
22
|
+
});
|
|
23
|
+
return { notebook: mapNotebook(data) };
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=create-notebook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-notebook.js","sourceRoot":"","sources":["../../src/tools/create-notebook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAoB,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE7E,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EACT,oJAAoJ;IACtJ,OAAO,EAAE,uBAAuB;IAChC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4CAA4C,CAAC;KACvF,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,kBAAkB,CAAC;KACtD,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAc,uBAAuB,EAAE;YAC3D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,YAAY,EAAE;SAC3C,CAAC,CAAC;QACH,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;IACzC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createPage: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
section_id: z.ZodString;
|
|
4
|
+
html: z.ZodString;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
page: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
title: z.ZodString;
|
|
9
|
+
created_at: z.ZodString;
|
|
10
|
+
last_modified_at: z.ZodString;
|
|
11
|
+
web_url: z.ZodString;
|
|
12
|
+
content_url: z.ZodString;
|
|
13
|
+
parent_section_id: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
//# sourceMappingURL=create-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-page.d.ts","sourceRoot":"","sources":["../../src/tools/create-page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;kBAgCrB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../onenote-api.js';
|
|
4
|
+
import { mapPage, pageSchema } from './schemas.js';
|
|
5
|
+
export const createPage = defineTool({
|
|
6
|
+
name: 'create_page',
|
|
7
|
+
displayName: 'Create Page',
|
|
8
|
+
description: 'Create a new page in a OneNote section. The page content is specified as HTML. ' +
|
|
9
|
+
'The HTML must include a <title> element inside <head> for the page title. ' +
|
|
10
|
+
'Supports standard HTML elements: headings (h1-h6), paragraphs (p), lists (ul/ol/li), ' +
|
|
11
|
+
'tables (table/tr/td), images (img with src), links (a), and text formatting (b, i, u, strike). ' +
|
|
12
|
+
'Example: <!DOCTYPE html><html><head><title>My Page</title></head><body><h1>Hello</h1><p>Content here</p></body></html>',
|
|
13
|
+
summary: 'Create a new page in a section with HTML content',
|
|
14
|
+
icon: 'file-plus',
|
|
15
|
+
group: 'Pages',
|
|
16
|
+
input: z.object({
|
|
17
|
+
section_id: z.string().min(1).describe('Section ID to create the page in'),
|
|
18
|
+
html: z
|
|
19
|
+
.string()
|
|
20
|
+
.min(1)
|
|
21
|
+
.describe('Page content as HTML. Must include <!DOCTYPE html><html><head><title>Page Title</title></head><body>...</body></html>'),
|
|
22
|
+
}),
|
|
23
|
+
output: z.object({
|
|
24
|
+
page: pageSchema.describe('Created page'),
|
|
25
|
+
}),
|
|
26
|
+
handle: async (params) => {
|
|
27
|
+
const data = await api(`/me/onenote/sections/${params.section_id}/pages`, {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
body: params.html,
|
|
30
|
+
contentType: 'text/html',
|
|
31
|
+
});
|
|
32
|
+
return { page: mapPage(data) };
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=create-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-page.js","sourceRoot":"","sources":["../../src/tools/create-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAgB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;IACnC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EACT,iFAAiF;QACjF,4EAA4E;QAC5E,uFAAuF;QACvF,iGAAiG;QACjG,wHAAwH;IAC1H,OAAO,EAAE,kDAAkD;IAC3D,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,kCAAkC,CAAC;QAC1E,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,uHAAuH,CACxH;KACJ,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC;KAC1C,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAU,wBAAwB,MAAM,CAAC,UAAU,QAAQ,EAAE;YACjF,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,WAAW,EAAE,WAAW;SACzB,CAAC,CAAC;QACH,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;IACjC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createSectionGroup: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
notebook_id: z.ZodString;
|
|
4
|
+
display_name: z.ZodString;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
section_group: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
display_name: z.ZodString;
|
|
9
|
+
created_at: z.ZodString;
|
|
10
|
+
last_modified_at: z.ZodString;
|
|
11
|
+
sections_url: z.ZodString;
|
|
12
|
+
section_groups_url: z.ZodString;
|
|
13
|
+
parent_notebook_id: z.ZodString;
|
|
14
|
+
parent_notebook_name: z.ZodString;
|
|
15
|
+
created_by: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
display_name: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
last_modified_by: z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
display_name: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
//# sourceMappingURL=create-section-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-section-group.d.ts","sourceRoot":"","sources":["../../src/tools/create-section-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;kBAsB7B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../onenote-api.js';
|
|
4
|
+
import { mapSectionGroup, sectionGroupSchema } from './schemas.js';
|
|
5
|
+
export const createSectionGroup = defineTool({
|
|
6
|
+
name: 'create_section_group',
|
|
7
|
+
displayName: 'Create Section Group',
|
|
8
|
+
description: 'Create a new section group in a OneNote notebook. Section groups act as folders to organize sections within a notebook.',
|
|
9
|
+
summary: 'Create a section group in a notebook',
|
|
10
|
+
icon: 'folder-plus',
|
|
11
|
+
group: 'Section Groups',
|
|
12
|
+
input: z.object({
|
|
13
|
+
notebook_id: z.string().min(1).describe('Notebook ID to create the section group in'),
|
|
14
|
+
display_name: z.string().min(1).describe('Name for the new section group'),
|
|
15
|
+
}),
|
|
16
|
+
output: z.object({
|
|
17
|
+
section_group: sectionGroupSchema.describe('Created section group'),
|
|
18
|
+
}),
|
|
19
|
+
handle: async (params) => {
|
|
20
|
+
const data = await api(`/me/onenote/notebooks/${params.notebook_id}/sectionGroups`, {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
body: { displayName: params.display_name },
|
|
23
|
+
});
|
|
24
|
+
return { section_group: mapSectionGroup(data) };
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=create-section-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-section-group.js","sourceRoot":"","sources":["../../src/tools/create-section-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAwB,eAAe,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEzF,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;IAC3C,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EACT,yHAAyH;IAC3H,OAAO,EAAE,sCAAsC;IAC/C,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,gBAAgB;IACvB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4CAA4C,CAAC;QACrF,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gCAAgC,CAAC;KAC3E,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,aAAa,EAAE,kBAAkB,CAAC,QAAQ,CAAC,uBAAuB,CAAC;KACpE,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAkB,yBAAyB,MAAM,CAAC,WAAW,gBAAgB,EAAE;YACnG,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,YAAY,EAAE;SAC3C,CAAC,CAAC;QACH,OAAO,EAAE,aAAa,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;IAClD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createSection: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
notebook_id: z.ZodString;
|
|
4
|
+
display_name: z.ZodString;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
section: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
display_name: z.ZodString;
|
|
9
|
+
created_at: z.ZodString;
|
|
10
|
+
last_modified_at: z.ZodString;
|
|
11
|
+
is_default: z.ZodBoolean;
|
|
12
|
+
pages_url: z.ZodString;
|
|
13
|
+
parent_notebook_id: z.ZodString;
|
|
14
|
+
parent_notebook_name: z.ZodString;
|
|
15
|
+
created_by: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
display_name: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
last_modified_by: z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
display_name: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
//# sourceMappingURL=create-section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-section.d.ts","sourceRoot":"","sources":["../../src/tools/create-section.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;kBAsBxB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../onenote-api.js';
|
|
4
|
+
import { mapSection, sectionSchema } from './schemas.js';
|
|
5
|
+
export const createSection = defineTool({
|
|
6
|
+
name: 'create_section',
|
|
7
|
+
displayName: 'Create Section',
|
|
8
|
+
description: 'Create a new section in a OneNote notebook. Sections contain pages and are the primary organizational unit within a notebook.',
|
|
9
|
+
summary: 'Create a new section in a notebook',
|
|
10
|
+
icon: 'layers-3',
|
|
11
|
+
group: 'Sections',
|
|
12
|
+
input: z.object({
|
|
13
|
+
notebook_id: z.string().min(1).describe('Notebook ID to create the section in'),
|
|
14
|
+
display_name: z.string().min(1).describe('Name for the new section'),
|
|
15
|
+
}),
|
|
16
|
+
output: z.object({
|
|
17
|
+
section: sectionSchema.describe('Created section'),
|
|
18
|
+
}),
|
|
19
|
+
handle: async (params) => {
|
|
20
|
+
const data = await api(`/me/onenote/notebooks/${params.notebook_id}/sections`, {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
body: { displayName: params.display_name },
|
|
23
|
+
});
|
|
24
|
+
return { section: mapSection(data) };
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=create-section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-section.js","sourceRoot":"","sources":["../../src/tools/create-section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAmB,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE1E,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EACT,+HAA+H;IACjI,OAAO,EAAE,oCAAoC;IAC7C,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,sCAAsC,CAAC;QAC/E,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC;KACrE,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC;KACnD,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAa,yBAAyB,MAAM,CAAC,WAAW,WAAW,EAAE;YACzF,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,YAAY,EAAE;SAC3C,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;IACvC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getCurrentUser: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
3
|
+
user: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
display_name: z.ZodString;
|
|
6
|
+
email: z.ZodString;
|
|
7
|
+
given_name: z.ZodString;
|
|
8
|
+
surname: z.ZodString;
|
|
9
|
+
preferred_language: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
//# sourceMappingURL=get-current-user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-current-user.d.ts","sourceRoot":"","sources":["../../src/tools/get-current-user.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,cAAc;;;;;;;;;kBAgBzB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../onenote-api.js';
|
|
4
|
+
import { mapUser, userSchema } from './schemas.js';
|
|
5
|
+
export const getCurrentUser = defineTool({
|
|
6
|
+
name: 'get_current_user',
|
|
7
|
+
displayName: 'Get Current User',
|
|
8
|
+
description: 'Get the profile of the currently authenticated Microsoft user including name, email, and language preference.',
|
|
9
|
+
summary: 'Get the current user profile',
|
|
10
|
+
icon: 'user',
|
|
11
|
+
group: 'Account',
|
|
12
|
+
input: z.object({}),
|
|
13
|
+
output: z.object({
|
|
14
|
+
user: userSchema.describe('Current user profile'),
|
|
15
|
+
}),
|
|
16
|
+
handle: async () => {
|
|
17
|
+
const data = await api('/me');
|
|
18
|
+
return { user: mapUser(data) };
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=get-current-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-current-user.js","sourceRoot":"","sources":["../../src/tools/get-current-user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAgB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,+GAA+G;IACjH,OAAO,EAAE,8BAA8B;IACvC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,sBAAsB,CAAC;KAClD,CAAC;IACF,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAU,KAAK,CAAC,CAAC;QACvC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;IACjC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getNotebook: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
notebook_id: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
notebook: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
display_name: z.ZodString;
|
|
8
|
+
created_at: z.ZodString;
|
|
9
|
+
last_modified_at: z.ZodString;
|
|
10
|
+
is_default: z.ZodBoolean;
|
|
11
|
+
is_shared: z.ZodBoolean;
|
|
12
|
+
user_role: z.ZodString;
|
|
13
|
+
sections_url: z.ZodString;
|
|
14
|
+
section_groups_url: z.ZodString;
|
|
15
|
+
created_by: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
display_name: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
last_modified_by: z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
display_name: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
web_url: z.ZodString;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
//# sourceMappingURL=get-notebook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-notebook.d.ts","sourceRoot":"","sources":["../../src/tools/get-notebook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;kBAkBtB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../onenote-api.js';
|
|
4
|
+
import { mapNotebook, notebookSchema } from './schemas.js';
|
|
5
|
+
export const getNotebook = defineTool({
|
|
6
|
+
name: 'get_notebook',
|
|
7
|
+
displayName: 'Get Notebook',
|
|
8
|
+
description: 'Get detailed information about a specific OneNote notebook by its ID. Returns notebook metadata including name, creation date, sharing status, and web URL.',
|
|
9
|
+
summary: 'Get a notebook by ID',
|
|
10
|
+
icon: 'book-open',
|
|
11
|
+
group: 'Notebooks',
|
|
12
|
+
input: z.object({
|
|
13
|
+
notebook_id: z.string().min(1).describe('Notebook ID'),
|
|
14
|
+
}),
|
|
15
|
+
output: z.object({
|
|
16
|
+
notebook: notebookSchema.describe('Notebook details'),
|
|
17
|
+
}),
|
|
18
|
+
handle: async (params) => {
|
|
19
|
+
const data = await api(`/me/onenote/notebooks/${params.notebook_id}`);
|
|
20
|
+
return { notebook: mapNotebook(data) };
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=get-notebook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-notebook.js","sourceRoot":"","sources":["../../src/tools/get-notebook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAoB,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE7E,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC;IACpC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EACT,6JAA6J;IAC/J,OAAO,EAAE,sBAAsB;IAC/B,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC;KACvD,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,kBAAkB,CAAC;KACtD,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAc,yBAAyB,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QACnF,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;IACzC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getRecentNotebooks: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
include_personal: z.ZodOptional<z.ZodBoolean>;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
notebooks: z.ZodArray<z.ZodObject<{
|
|
6
|
+
display_name: z.ZodString;
|
|
7
|
+
last_accessed_time: z.ZodString;
|
|
8
|
+
source_service: z.ZodString;
|
|
9
|
+
web_url: z.ZodString;
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
//# sourceMappingURL=get-recent-notebooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-recent-notebooks.d.ts","sourceRoot":"","sources":["../../src/tools/get-recent-notebooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,kBAAkB;;;;;;;;;kBAwB7B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../onenote-api.js';
|
|
4
|
+
import { mapRecentNotebook, recentNotebookSchema } from './schemas.js';
|
|
5
|
+
export const getRecentNotebooks = defineTool({
|
|
6
|
+
name: 'get_recent_notebooks',
|
|
7
|
+
displayName: 'Get Recent Notebooks',
|
|
8
|
+
description: 'Get recently accessed OneNote notebooks. Returns notebooks sorted by last access time, including notebooks from personal OneDrive and OneDrive for Business.',
|
|
9
|
+
summary: 'Get recently accessed notebooks',
|
|
10
|
+
icon: 'clock',
|
|
11
|
+
group: 'Notebooks',
|
|
12
|
+
input: z.object({
|
|
13
|
+
include_personal: z
|
|
14
|
+
.boolean()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Include personal (consumer) notebooks in addition to business notebooks (default true)'),
|
|
17
|
+
}),
|
|
18
|
+
output: z.object({
|
|
19
|
+
notebooks: z.array(recentNotebookSchema).describe('List of recently accessed notebooks'),
|
|
20
|
+
}),
|
|
21
|
+
handle: async (params) => {
|
|
22
|
+
const includePersonal = params.include_personal ?? true;
|
|
23
|
+
const data = await api(`/me/onenote/notebooks/getRecentNotebooks(includePersonalNotebooks=${includePersonal})`);
|
|
24
|
+
return { notebooks: (data.value ?? []).map(mapRecentNotebook) };
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=get-recent-notebooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-recent-notebooks.js","sourceRoot":"","sources":["../../src/tools/get-recent-notebooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAA0B,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAM/F,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;IAC3C,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EACT,8JAA8J;IAChK,OAAO,EAAE,iCAAiC;IAC1C,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,gBAAgB,EAAE,CAAC;aAChB,OAAO,EAAE;aACT,QAAQ,EAAE;aACV,QAAQ,CAAC,wFAAwF,CAAC;KACtG,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,qCAAqC,CAAC;KACzF,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,eAAe,GAAG,MAAM,CAAC,gBAAgB,IAAI,IAAI,CAAC;QACxD,MAAM,IAAI,GAAG,MAAM,GAAG,CACpB,qEAAqE,eAAe,GAAG,CACxF,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;IAClE,CAAC;CACF,CAAC,CAAC"}
|