@opentabs-dev/opentabs-plugin-hack2hire 0.0.109
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 +64 -0
- package/dist/adapter.iife.js +15864 -0
- package/dist/adapter.iife.js.map +7 -0
- package/dist/hack2hire-api.d.ts +18 -0
- package/dist/hack2hire-api.d.ts.map +1 -0
- package/dist/hack2hire-api.js +72 -0
- package/dist/hack2hire-api.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/get-comment.d.ts +31 -0
- package/dist/tools/get-comment.d.ts.map +1 -0
- package/dist/tools/get-comment.js +21 -0
- package/dist/tools/get-comment.js.map +1 -0
- package/dist/tools/get-company-question-stats.d.ts +16 -0
- package/dist/tools/get-company-question-stats.d.ts.map +1 -0
- package/dist/tools/get-company-question-stats.js +34 -0
- package/dist/tools/get-company-question-stats.js.map +1 -0
- package/dist/tools/get-completed-question-count.d.ts +14 -0
- package/dist/tools/get-completed-question-count.d.ts.map +1 -0
- package/dist/tools/get-completed-question-count.js +35 -0
- package/dist/tools/get-completed-question-count.js.map +1 -0
- package/dist/tools/get-current-user.d.ts +15 -0
- package/dist/tools/get-current-user.d.ts.map +1 -0
- package/dist/tools/get-current-user.js +19 -0
- package/dist/tools/get-current-user.js.map +1 -0
- package/dist/tools/get-question-neighbors.d.ts +55 -0
- package/dist/tools/get-question-neighbors.d.ts.map +1 -0
- package/dist/tools/get-question-neighbors.js +42 -0
- package/dist/tools/get-question-neighbors.js.map +1 -0
- package/dist/tools/get-question.d.ts +27 -0
- package/dist/tools/get-question.d.ts.map +1 -0
- package/dist/tools/get-question.js +21 -0
- package/dist/tools/get-question.js.map +1 -0
- package/dist/tools/get-subscription.d.ts +14 -0
- package/dist/tools/get-subscription.d.ts.map +1 -0
- package/dist/tools/get-subscription.js +19 -0
- package/dist/tools/get-subscription.js.map +1 -0
- package/dist/tools/list-comment-replies.d.ts +32 -0
- package/dist/tools/list-comment-replies.d.ts.map +1 -0
- package/dist/tools/list-comment-replies.js +33 -0
- package/dist/tools/list-comment-replies.js.map +1 -0
- package/dist/tools/list-companies.d.ts +11 -0
- package/dist/tools/list-companies.d.ts.map +1 -0
- package/dist/tools/list-companies.js +21 -0
- package/dist/tools/list-companies.js.map +1 -0
- package/dist/tools/list-my-bookmarks.d.ts +24 -0
- package/dist/tools/list-my-bookmarks.d.ts.map +1 -0
- package/dist/tools/list-my-bookmarks.js +40 -0
- package/dist/tools/list-my-bookmarks.js.map +1 -0
- package/dist/tools/list-my-visits.d.ts +26 -0
- package/dist/tools/list-my-visits.d.ts.map +1 -0
- package/dist/tools/list-my-visits.js +40 -0
- package/dist/tools/list-my-visits.js.map +1 -0
- package/dist/tools/list-question-coding-problems.d.ts +10 -0
- package/dist/tools/list-question-coding-problems.d.ts.map +1 -0
- package/dist/tools/list-question-coding-problems.js +25 -0
- package/dist/tools/list-question-coding-problems.js.map +1 -0
- package/dist/tools/list-question-comments.d.ts +33 -0
- package/dist/tools/list-question-comments.d.ts.map +1 -0
- package/dist/tools/list-question-comments.js +45 -0
- package/dist/tools/list-question-comments.js.map +1 -0
- package/dist/tools/list-questions.d.ts +50 -0
- package/dist/tools/list-questions.d.ts.map +1 -0
- package/dist/tools/list-questions.js +71 -0
- package/dist/tools/list-questions.js.map +1 -0
- package/dist/tools/schemas.d.ts +438 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +282 -0
- package/dist/tools/schemas.js.map +1 -0
- package/dist/tools.json +1823 -0
- package/package.json +68 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const isAuthenticated: () => boolean;
|
|
2
|
+
export declare const waitForAuth: () => Promise<boolean>;
|
|
3
|
+
export interface Hack2HireList<T> {
|
|
4
|
+
data: T[];
|
|
5
|
+
total: number;
|
|
6
|
+
page: number;
|
|
7
|
+
perPage: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Calls a Hack2Hire endpoint and returns the unwrapped `data` payload.
|
|
11
|
+
*
|
|
12
|
+
* The API is cross-origin from `*.hack2hire.com` and uses bearer tokens, so
|
|
13
|
+
* `credentials: 'omit'` is required — the response sets a specific
|
|
14
|
+
* `access-control-allow-origin` value without `access-control-allow-credentials`,
|
|
15
|
+
* which the browser would otherwise reject when sending cookies.
|
|
16
|
+
*/
|
|
17
|
+
export declare const api: <T>(endpoint: string, query?: Record<string, string | number | boolean | undefined>) => Promise<T>;
|
|
18
|
+
//# sourceMappingURL=hack2hire-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hack2hire-api.d.ts","sourceRoot":"","sources":["../src/hack2hire-api.ts"],"names":[],"mappings":"AAiDA,eAAO,MAAM,eAAe,QAAO,OAA6B,CAAC;AAEjE,eAAO,MAAM,WAAW,QAAO,OAAO,CAAC,OAAO,CAI3C,CAAC;AAaJ,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,GAAU,CAAC,EACzB,UAAU,MAAM,EAChB,QAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,KAC5D,OAAO,CAAC,CAAC,CA6BX,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ToolError, buildQueryString, clearAuthCache, fetchFromPage, getAuthCache, getLocalStorage, setAuthCache, waitUntil, } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
const API_BASE = 'https://api.hack2hire.com/algro/v1';
|
|
3
|
+
/**
|
|
4
|
+
* Hack2Hire stores the bearer token in localStorage at `ALGRO_TOKEN` as a
|
|
5
|
+
* JSON-encoded string (so it has surrounding quotes that must be parsed away).
|
|
6
|
+
* The user ID is stored in `USER_ID` the same way.
|
|
7
|
+
*/
|
|
8
|
+
const readJsonString = (key) => {
|
|
9
|
+
const raw = getLocalStorage(key);
|
|
10
|
+
if (!raw)
|
|
11
|
+
return null;
|
|
12
|
+
try {
|
|
13
|
+
const parsed = JSON.parse(raw);
|
|
14
|
+
return typeof parsed === 'string' && parsed.length > 0 ? parsed : null;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const getAuth = () => {
|
|
21
|
+
const cached = getAuthCache('hack2hire');
|
|
22
|
+
if (cached?.token && cached?.userId)
|
|
23
|
+
return cached;
|
|
24
|
+
const token = readJsonString('ALGRO_TOKEN');
|
|
25
|
+
const userId = readJsonString('USER_ID');
|
|
26
|
+
if (!token || !userId)
|
|
27
|
+
return null;
|
|
28
|
+
const auth = { token, userId };
|
|
29
|
+
setAuthCache('hack2hire', auth);
|
|
30
|
+
return auth;
|
|
31
|
+
};
|
|
32
|
+
export const isAuthenticated = () => getAuth() !== null;
|
|
33
|
+
export const waitForAuth = () => waitUntil(() => isAuthenticated(), { interval: 500, timeout: 5000 }).then(() => true, () => false);
|
|
34
|
+
/**
|
|
35
|
+
* Calls a Hack2Hire endpoint and returns the unwrapped `data` payload.
|
|
36
|
+
*
|
|
37
|
+
* The API is cross-origin from `*.hack2hire.com` and uses bearer tokens, so
|
|
38
|
+
* `credentials: 'omit'` is required — the response sets a specific
|
|
39
|
+
* `access-control-allow-origin` value without `access-control-allow-credentials`,
|
|
40
|
+
* which the browser would otherwise reject when sending cookies.
|
|
41
|
+
*/
|
|
42
|
+
export const api = async (endpoint, query) => {
|
|
43
|
+
const auth = getAuth();
|
|
44
|
+
if (!auth)
|
|
45
|
+
throw ToolError.auth('Not authenticated — please log in to Hack2Hire.');
|
|
46
|
+
const qs = query ? buildQueryString(query) : '';
|
|
47
|
+
const url = qs ? `${API_BASE}${endpoint}?${qs}` : `${API_BASE}${endpoint}`;
|
|
48
|
+
let response;
|
|
49
|
+
try {
|
|
50
|
+
response = await fetchFromPage(url, {
|
|
51
|
+
method: 'GET',
|
|
52
|
+
headers: {
|
|
53
|
+
Authorization: `Bearer ${auth.token}`,
|
|
54
|
+
'x-user-id': auth.userId,
|
|
55
|
+
Accept: 'application/json',
|
|
56
|
+
},
|
|
57
|
+
credentials: 'omit',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
if (err instanceof ToolError) {
|
|
62
|
+
// 401/403 — drop the cached auth so the next call re-reads localStorage.
|
|
63
|
+
if (err.category === 'auth')
|
|
64
|
+
clearAuthCache('hack2hire');
|
|
65
|
+
throw err;
|
|
66
|
+
}
|
|
67
|
+
throw ToolError.internal(`Network error: ${err instanceof Error ? err.message : String(err)}`);
|
|
68
|
+
}
|
|
69
|
+
const envelope = (await response.json());
|
|
70
|
+
return envelope.data;
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=hack2hire-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hack2hire-api.js","sourceRoot":"","sources":["../src/hack2hire-api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,SAAS,GACV,MAAM,0BAA0B,CAAC;AAElC,MAAM,QAAQ,GAAG,oCAAoC,CAAC;AAStD;;;;GAIG;AACH,MAAM,cAAc,GAAG,CAAC,GAAW,EAAiB,EAAE;IACpD,MAAM,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAY,CAAC;QAC1C,OAAO,OAAO,MAAM,KAAK,QAAQ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ack2HirePlugin extends OpenTabsPlugin {
|
|
4
|
+
readonly name = "hack2hire";
|
|
5
|
+
readonly description = "OpenTabs plugin for Hack2Hire";
|
|
6
|
+
readonly displayName = "Hack2Hire";
|
|
7
|
+
readonly urlPatterns: string[];
|
|
8
|
+
readonly homepage = "https://www.hack2hire.com";
|
|
9
|
+
readonly tools: ToolDefinition[];
|
|
10
|
+
isReady(): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: Hack2HirePlugin;
|
|
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;AAyB/D,cAAM,eAAgB,SAAQ,cAAc;IAC1C,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,WAAW,mCAAmC;IACvD,SAAkB,WAAW,eAAe;IAC5C,QAAQ,CAAC,WAAW,WAA6B;IACjD,SAAkB,QAAQ,+BAA+B;IACzD,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,CAsB9B;IAEI,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;CAIlC;;AAED,wBAAqC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { OpenTabsPlugin } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { isAuthenticated, waitForAuth } from './hack2hire-api.js';
|
|
3
|
+
// Account
|
|
4
|
+
import { getCompletedQuestionCount } from './tools/get-completed-question-count.js';
|
|
5
|
+
import { getCurrentUser } from './tools/get-current-user.js';
|
|
6
|
+
import { getSubscription } from './tools/get-subscription.js';
|
|
7
|
+
import { listMyBookmarks } from './tools/list-my-bookmarks.js';
|
|
8
|
+
import { listMyVisits } from './tools/list-my-visits.js';
|
|
9
|
+
// Companies
|
|
10
|
+
import { getCompanyQuestionStats } from './tools/get-company-question-stats.js';
|
|
11
|
+
import { listCompanies } from './tools/list-companies.js';
|
|
12
|
+
// Comments
|
|
13
|
+
import { getComment } from './tools/get-comment.js';
|
|
14
|
+
import { listCommentReplies } from './tools/list-comment-replies.js';
|
|
15
|
+
import { listQuestionComments } from './tools/list-question-comments.js';
|
|
16
|
+
// Questions
|
|
17
|
+
import { getQuestion } from './tools/get-question.js';
|
|
18
|
+
import { getQuestionNeighbors } from './tools/get-question-neighbors.js';
|
|
19
|
+
import { listQuestionCodingProblems } from './tools/list-question-coding-problems.js';
|
|
20
|
+
import { listQuestions } from './tools/list-questions.js';
|
|
21
|
+
class Hack2HirePlugin extends OpenTabsPlugin {
|
|
22
|
+
name = 'hack2hire';
|
|
23
|
+
description = 'OpenTabs plugin for Hack2Hire';
|
|
24
|
+
displayName = 'Hack2Hire';
|
|
25
|
+
urlPatterns = ['*://*.hack2hire.com/*'];
|
|
26
|
+
homepage = 'https://www.hack2hire.com';
|
|
27
|
+
tools = [
|
|
28
|
+
// Companies
|
|
29
|
+
listCompanies,
|
|
30
|
+
getCompanyQuestionStats,
|
|
31
|
+
// Questions
|
|
32
|
+
listQuestions,
|
|
33
|
+
getQuestion,
|
|
34
|
+
getQuestionNeighbors,
|
|
35
|
+
listQuestionCodingProblems,
|
|
36
|
+
// Comments
|
|
37
|
+
listQuestionComments,
|
|
38
|
+
listCommentReplies,
|
|
39
|
+
getComment,
|
|
40
|
+
// Account
|
|
41
|
+
getCurrentUser,
|
|
42
|
+
getSubscription,
|
|
43
|
+
listMyBookmarks,
|
|
44
|
+
listMyVisits,
|
|
45
|
+
getCompletedQuestionCount,
|
|
46
|
+
];
|
|
47
|
+
async isReady() {
|
|
48
|
+
if (isAuthenticated())
|
|
49
|
+
return true;
|
|
50
|
+
return waitForAuth();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export default new Hack2HirePlug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AK,GAAqB;QACjC,YAAY;QACZ,aAAa;QACb,uBAAuB;QAEvB,YAAY;QACZ,aAAa;QACb,WAAW;QACX,oBAAoB;QACpB,0BAA0B;QAE1B,WAAW;QACX,oBAAoB;QACpB,kBAAkB;QAClB,UAAU;QAEV,UAAU;QACV,cAAc;QACd,eAAe;QACf,eAAe;QACf,YAAY;QACZ,yBAAyB;KAC1B,CAAC;IAEF,KAAK,CAAC,OAAO;QACX,IAAI,eAAe,EAAE;YAAE,OAAO,IAAI,CAAC;QACnC,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC;CACF;AAED,eAAe,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getComment: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
commentId: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
comment: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
8
|
+
title: z.ZodString;
|
|
9
|
+
language: z.ZodString;
|
|
10
|
+
upvoteCount: z.ZodNumber;
|
|
11
|
+
downvoteCount: z.ZodNumber;
|
|
12
|
+
voteScore: z.ZodNumber;
|
|
13
|
+
viewCount: z.ZodNumber;
|
|
14
|
+
replyCount: z.ZodNumber;
|
|
15
|
+
isAnonymous: z.ZodBoolean;
|
|
16
|
+
postId: z.ZodString;
|
|
17
|
+
codingQuestionId: z.ZodString;
|
|
18
|
+
user: z.ZodObject<{
|
|
19
|
+
alias: z.ZodString;
|
|
20
|
+
avatar: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
displayName: z.ZodString;
|
|
23
|
+
hasUserUpvoted: z.ZodBoolean;
|
|
24
|
+
hasUserDownvoted: z.ZodBoolean;
|
|
25
|
+
createdDate: z.ZodString;
|
|
26
|
+
updatedDate: z.ZodString;
|
|
27
|
+
code: z.ZodString;
|
|
28
|
+
content: z.ZodString;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
//# sourceMappingURL=get-comment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-comment.d.ts","sourceRoot":"","sources":["../../src/tools/get-comment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgBrB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../hack2hire-api.js';
|
|
4
|
+
import { commentDetailSchema, mapCommentDetail } from './schemas.js';
|
|
5
|
+
export const getComment = defineTool({
|
|
6
|
+
name: 'get_comment',
|
|
7
|
+
displayName: 'Get Comment',
|
|
8
|
+
description: 'Get the full content of a single comment by ID, including its source code body (for code-snippet comments) or markdown text body (for prose comments). The list endpoints (`list_question_comments`, `list_comment_replies`) only return metadata — call this to read the actual content.',
|
|
9
|
+
summary: 'Get the full content of a comment',
|
|
10
|
+
icon: 'message-square',
|
|
11
|
+
group: 'Comments',
|
|
12
|
+
input: z.object({
|
|
13
|
+
commentId: z.string().describe('Comment ID — get this from list_question_comments or list_comment_replies.'),
|
|
14
|
+
}),
|
|
15
|
+
output: z.object({ comment: commentDetailSchema }),
|
|
16
|
+
handle: async (params) => {
|
|
17
|
+
const data = await api(`/comment/${params.commentId}`);
|
|
18
|
+
return { comment: mapCommentDetail(data) };
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=get-comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-comment.js","sourceRoot":"","sources":["../../src/tools/get-comment.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,qBAAqB,CAAC;AAC1C,OAAO,EAAmB,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEtF,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;IACnC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EACT,2RAA2R;IAC7R,OAAO,EAAE,mCAAmC;IAC5C,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4EAA4E,CAAC;KAC7G,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAClD,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAa,YAAY,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QACnE,OAAO,EAAE,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC7C,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getCompanyQuestionStats: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
company: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
stats: z.ZodObject<{
|
|
6
|
+
company: z.ZodString;
|
|
7
|
+
total: z.ZodNumber;
|
|
8
|
+
postTypeRecords: z.ZodArray<z.ZodObject<{
|
|
9
|
+
postType: z.ZodString;
|
|
10
|
+
count: z.ZodNumber;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
updatedDate: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
selectedCollectionCounts: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
//# sourceMappingURL=get-company-question-stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-company-question-stats.d.ts","sourceRoot":"","sources":["../../src/tools/get-company-question-stats.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;kBA6BlC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../hack2hire-api.js';
|
|
4
|
+
import { companyStatsSchema, mapCompanyStats } from './schemas.js';
|
|
5
|
+
export const getCompanyQuestionStats = defineTool({
|
|
6
|
+
name: 'get_company_question_stats',
|
|
7
|
+
displayName: 'Get Company Question Stats',
|
|
8
|
+
description: 'Get the breakdown of tracked questions for a specific company — the total count plus a count per question type (ALGORITHM, SD, ML_SD, BLOG). Also returns the count for every curated collection. Useful for showing how many questions are available before drilling into a list.',
|
|
9
|
+
summary: 'Question count breakdown for a company',
|
|
10
|
+
icon: 'chart-bar',
|
|
11
|
+
group: 'Companies',
|
|
12
|
+
input: z.object({
|
|
13
|
+
company: z
|
|
14
|
+
.string()
|
|
15
|
+
.describe('Company key in uppercase (e.g. "PINTEREST", "AMAZON"). Use list_companies to discover keys.'),
|
|
16
|
+
}),
|
|
17
|
+
output: z.object({
|
|
18
|
+
stats: companyStatsSchema,
|
|
19
|
+
selectedCollectionCounts: z
|
|
20
|
+
.record(z.string(), z.number().int())
|
|
21
|
+
.describe('Number of questions in each curated collection (e.g. "hack2hire-50-picks").'),
|
|
22
|
+
}),
|
|
23
|
+
handle: async (params) => {
|
|
24
|
+
const data = await api('/post/company-statistics', {
|
|
25
|
+
company: params.company,
|
|
26
|
+
});
|
|
27
|
+
const entry = (data.data ?? [])[0] ?? {};
|
|
28
|
+
return {
|
|
29
|
+
stats: mapCompanyStats(entry),
|
|
30
|
+
selectedCollectionCounts: data.selectedCollectionCounts ?? {},
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=get-company-question-stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-company-question-stats.js","sourceRoot":"","sources":["../../src/tools/get-company-question-stats.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,qBAAqB,CAAC;AAC1C,OAAO,EAA6B,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO9F,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;IAChD,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,4BAA4B;IACzC,WAAW,EACT,oRAAoR;IACtR,OAAO,EAAE,wCAAwC;IACjD,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,OAAO,EAAE,CAAC;aACP,MAAM,EAAE;aACR,QAAQ,CAAC,6FAA6F,CAAC;KAC3G,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,KAAK,EAAE,kBAAkB;QACzB,wBAAwB,EAAE,CAAC;aACxB,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC;aACpC,QAAQ,CAAC,6EAA6E,CAAC;KAC3F,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAW,0BAA0B,EAAE;YAC3D,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAC;QACH,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACzC,OAAO;YACL,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC;YAC7B,wBAAwB,EAAE,IAAI,CAAC,wBAAwB,IAAI,EAAE;SAC9D,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getCompletedQuestionCount: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
company: z.ZodOptional<z.ZodString>;
|
|
4
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
5
|
+
ALGORITHM: "ALGORITHM";
|
|
6
|
+
SD: "SD";
|
|
7
|
+
ML_SD: "ML_SD";
|
|
8
|
+
BLOG: "BLOG";
|
|
9
|
+
}>>;
|
|
10
|
+
selectedCollectionKey: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
12
|
+
total: z.ZodNumber;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
//# sourceMappingURL=get-completed-question-count.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-completed-question-count.d.ts","sourceRoot":"","sources":["../../src/tools/get-completed-question-count.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;kBA+BpC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../hack2hire-api.js';
|
|
4
|
+
export const getCompletedQuestionCount = defineTool({
|
|
5
|
+
name: 'get_completed_question_count',
|
|
6
|
+
displayName: 'Get Completed Question Count',
|
|
7
|
+
description: 'Get how many questions the authenticated user has marked as COMPLETED, scoped to a single dimension. Provide exactly one of `company` (uppercase company key), `type` (ALGORITHM, SD, ML_SD, BLOG), or `selectedCollectionKey` (e.g. "hack2hire-50-picks"). Useful for showing study progress against a goal.',
|
|
8
|
+
summary: 'Count completed questions in a scope',
|
|
9
|
+
icon: 'check-circle',
|
|
10
|
+
group: 'Account',
|
|
11
|
+
input: z
|
|
12
|
+
.object({
|
|
13
|
+
company: z.string().optional().describe('Company key in uppercase (e.g. "PINTEREST", "AMAZON").'),
|
|
14
|
+
type: z
|
|
15
|
+
.enum(['ALGORITHM', 'SD', 'ML_SD', 'BLOG'])
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('Post type to count completed questions for.'),
|
|
18
|
+
selectedCollectionKey: z.string().optional().describe('Curated collection key (e.g. "hack2hire-50-picks").'),
|
|
19
|
+
})
|
|
20
|
+
.refine(p => Boolean(p.company) || Boolean(p.type) || Boolean(p.selectedCollectionKey), {
|
|
21
|
+
message: 'Provide one of company, type, or selectedCollectionKey.',
|
|
22
|
+
}),
|
|
23
|
+
output: z.object({
|
|
24
|
+
total: z.number().int().describe('Number of questions marked COMPLETED in the requested scope.'),
|
|
25
|
+
}),
|
|
26
|
+
handle: async (params) => {
|
|
27
|
+
const data = await api('/user/completed-post-count', {
|
|
28
|
+
company: params.company,
|
|
29
|
+
type: params.type,
|
|
30
|
+
selectedCollectionKey: params.selectedCollectionKey,
|
|
31
|
+
});
|
|
32
|
+
return { total: data.total ?? 0 };
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=get-completed-question-count.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-completed-question-count.js","sourceRoot":"","sources":["../../src/tools/get-completed-question-count.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,E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B,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,qBAAqB,EAAE,MAAM,CAAC,qBAAqB;SACpD,CAAC,CAAC;QACH,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;IACpC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
email: z.ZodString;
|
|
6
|
+
alias: z.ZodString;
|
|
7
|
+
avatar: z.ZodString;
|
|
8
|
+
accountType: z.ZodString;
|
|
9
|
+
premiumExpiredDate: z.ZodString;
|
|
10
|
+
balance: z.ZodNumber;
|
|
11
|
+
createdDate: z.ZodString;
|
|
12
|
+
lastLoginDate: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
//# 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;;;;;;;;;;;;kBAczB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../hack2hire-api.js';
|
|
4
|
+
import { mapUserProfile, userProfileSchema } from './schemas.js';
|
|
5
|
+
export const getCurrentUser = defineTool({
|
|
6
|
+
name: 'get_current_user',
|
|
7
|
+
displayName: 'Get Current User',
|
|
8
|
+
description: 'Get the authenticated Hack2Hire user profile, including the user ID, email, public alias, avatar URL, account type, premium expiration date, account credit balance, account creation date, and last login timestamp.',
|
|
9
|
+
summary: 'Get the authenticated user profile',
|
|
10
|
+
icon: 'user',
|
|
11
|
+
group: 'Account',
|
|
12
|
+
input: z.object({}),
|
|
13
|
+
output: z.object({ user: userProfileSchema }),
|
|
14
|
+
handle: async () => {
|
|
15
|
+
const data = await api('/user/profile');
|
|
16
|
+
return { user: mapUserProfile(data) };
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
//# 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,qBAAqB,CAAC;AAC1C,OAAO,EAAuB,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtF,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,uNAAuN;IACzN,OAAO,EAAE,oCAAoC;IAC7C,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAC7C,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAiB,eAAe,CAAC,CAAC;QACxD,OAAO,EAAE,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;IACxC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getQuestionNeighbors: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
postId: z.ZodString;
|
|
4
|
+
company: z.ZodOptional<z.ZodString>;
|
|
5
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
ALGORITHM: "ALGORITHM";
|
|
7
|
+
SD: "SD";
|
|
8
|
+
ML_SD: "ML_SD";
|
|
9
|
+
BLOG: "BLOG";
|
|
10
|
+
}>>;
|
|
11
|
+
sortedBy: z.ZodOptional<z.ZodEnum<{
|
|
12
|
+
frequency: "frequency";
|
|
13
|
+
difficulty: "difficulty";
|
|
14
|
+
isLocked: "isLocked";
|
|
15
|
+
createdDate: "createdDate";
|
|
16
|
+
}>>;
|
|
17
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
18
|
+
previous: z.ZodObject<{
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
type: z.ZodString;
|
|
21
|
+
title: z.ZodString;
|
|
22
|
+
subtitle: z.ZodString;
|
|
23
|
+
company: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
24
|
+
frequency: z.ZodNumber;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
algorithmTags: z.ZodArray<z.ZodString>;
|
|
27
|
+
stages: z.ZodArray<z.ZodString>;
|
|
28
|
+
difficulty: z.ZodNumber;
|
|
29
|
+
frequency: z.ZodNumber;
|
|
30
|
+
isLocked: z.ZodBoolean;
|
|
31
|
+
createdDate: z.ZodString;
|
|
32
|
+
firstPublishedDate: z.ZodString;
|
|
33
|
+
lastReportSeenDate: z.ZodString;
|
|
34
|
+
codingQuestionIds: z.ZodArray<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
next: z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
type: z.ZodString;
|
|
39
|
+
title: z.ZodString;
|
|
40
|
+
subtitle: z.ZodString;
|
|
41
|
+
company: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
42
|
+
frequency: z.ZodNumber;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
algorithmTags: z.ZodArray<z.ZodString>;
|
|
45
|
+
stages: z.ZodArray<z.ZodString>;
|
|
46
|
+
difficulty: z.ZodNumber;
|
|
47
|
+
frequency: z.ZodNumber;
|
|
48
|
+
isLocked: z.ZodBoolean;
|
|
49
|
+
createdDate: z.ZodString;
|
|
50
|
+
firstPublishedDate: z.ZodString;
|
|
51
|
+
lastReportSeenDate: z.ZodString;
|
|
52
|
+
codingQuestionIds: z.ZodArray<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
//# sourceMappingURL=get-question-neighbors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-question-neighbors.d.ts","sourceRoot":"","sources":["../../src/tools/get-question-neighbors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmC/B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../hack2hire-api.js';
|
|
4
|
+
import { POST_TYPES, mapPostSummary, postSummarySchema } from './schemas.js';
|
|
5
|
+
const sortedByOptions = ['isLocked', 'frequency', 'difficulty', 'createdDate'];
|
|
6
|
+
const emptyPost = () => ({});
|
|
7
|
+
export const getQuestionNeighbors = defineTool({
|
|
8
|
+
name: 'get_question_neighbors',
|
|
9
|
+
displayName: 'Get Question Neighbors',
|
|
10
|
+
description: 'Get the previous and next questions relative to a given post within a filtered, sorted list. Pass the same `company`, `type`, and `sortedBy` you would use in `list_questions` so the navigation matches the UI ordering. The previous or next field has empty values when the post is at the start or end of the list.',
|
|
11
|
+
summary: 'Get prev/next questions in a list',
|
|
12
|
+
icon: 'arrow-right-left',
|
|
13
|
+
group: 'Questions',
|
|
14
|
+
input: z.object({
|
|
15
|
+
postId: z.string().describe('Post ID to anchor navigation around.'),
|
|
16
|
+
company: z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Company key in uppercase (e.g. "PINTEREST"). Match the list_questions call you used.'),
|
|
20
|
+
type: z.enum(POST_TYPES).optional().describe('Post type filter.'),
|
|
21
|
+
sortedBy: z
|
|
22
|
+
.enum(sortedByOptions)
|
|
23
|
+
.optional()
|
|
24
|
+
.describe('Sort order. Defaults to "isLocked" — match the list_questions sortBy you used.'),
|
|
25
|
+
}),
|
|
26
|
+
output: z.object({
|
|
27
|
+
previous: postSummarySchema.describe('The previous question summary, or all-empty fields when none.'),
|
|
28
|
+
next: postSummarySchema.describe('The next question summary, or all-empty fields when none.'),
|
|
29
|
+
}),
|
|
30
|
+
handle: async (params) => {
|
|
31
|
+
const data = await api(`/post/${params.postId}/previous-next`, {
|
|
32
|
+
company: params.company,
|
|
33
|
+
type: params.type,
|
|
34
|
+
sortedBy: params.sortedBy ?? 'isLocked',
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
previous: mapPostSummary(data.previousPost ?? emptyPost()),
|
|
38
|
+
next: mapPostSummary(data.nextPost ?? emptyPost()),
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=get-question-neighbors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-question-neighbors.js","sourceRoot":"","sources":["../../src/tools/get-question-neighbors.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,qBAAqB,CAAC;AAC1C,OAAO,EAAE,UAA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,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,UAAU;SACxC,CAAC,CAAC;QACH,OAAO;YACL,QAAQ,EAAE,cAAc,CAAC,IAAI,CAAC,YAAY,IAAI,SAAS,EAAE,CAAC;YAC1D,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,EAAE,CAAC;SACnD,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getQuestion: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
postId: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
question: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
8
|
+
title: z.ZodString;
|
|
9
|
+
subtitle: z.ZodString;
|
|
10
|
+
company: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
11
|
+
frequency: z.ZodNumber;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
algorithmTags: z.ZodArray<z.ZodString>;
|
|
14
|
+
stages: z.ZodArray<z.ZodString>;
|
|
15
|
+
difficulty: z.ZodNumber;
|
|
16
|
+
frequency: z.ZodNumber;
|
|
17
|
+
isLocked: z.ZodBoolean;
|
|
18
|
+
createdDate: z.ZodString;
|
|
19
|
+
firstPublishedDate: z.ZodString;
|
|
20
|
+
lastReportSeenDate: z.ZodString;
|
|
21
|
+
codingQuestionIds: z.ZodArray<z.ZodString>;
|
|
22
|
+
contentPreview: z.ZodString;
|
|
23
|
+
topic: z.ZodString;
|
|
24
|
+
estimatedReadingTimeInMinutes: z.ZodNumber;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
//# sourceMappingURL=get-question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-question.d.ts","sourceRoot":"","sources":["../../src/tools/get-question.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;kBAgBtB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../hack2hire-api.js';
|
|
4
|
+
import { mapPostDetail, postDetailSchema } from './schemas.js';
|
|
5
|
+
export const getQuestion = defineTool({
|
|
6
|
+
name: 'get_question',
|
|
7
|
+
displayName: 'Get Question',
|
|
8
|
+
description: 'Get the full detail of a single Hack2Hire interview question by its post ID, including the markdown content preview, company frequencies, algorithm tags, interview stages, difficulty, and the IDs of any associated coding questions (use those IDs with list_question_comments). For paid (locked) questions the contentPreview field returns a teaser only — full content requires a Hack2Hire premium subscription.',
|
|
9
|
+
summary: 'Get full detail of one question',
|
|
10
|
+
icon: 'file-text',
|
|
11
|
+
group: 'Questions',
|
|
12
|
+
input: z.object({
|
|
13
|
+
postId: z.string().describe('Post ID — get this from list_questions.'),
|
|
14
|
+
}),
|
|
15
|
+
output: z.object({ question: postDetailSchema }),
|
|
16
|
+
handle: async (params) => {
|
|
17
|
+
const data = await api(`/post/${params.postId}`);
|
|
18
|
+
return { question: mapPostDetail(data) };
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=get-question.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-question.js","sourceRoot":"","sources":["../../src/tools/get-question.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,qBAAqB,CAAC;AAC1C,OAAO,EAAgB,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE7E,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC;IACpC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EACT,0ZAA0Z;IAC5Z,OAAO,EAAE,iCAAiC;IAC1C,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;KACvE,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAChD,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAU,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;IAC3C,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getSubscription: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
3
|
+
subscription: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
userId: z.ZodString;
|
|
6
|
+
status: z.ZodString;
|
|
7
|
+
paymentType: z.ZodString;
|
|
8
|
+
planType: z.ZodString;
|
|
9
|
+
currentPeriodStart: z.ZodString;
|
|
10
|
+
currentPeriodEnd: z.ZodString;
|
|
11
|
+
price: z.ZodNumber;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
//# sourceMappingURL=get-subscription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-subscription.d.ts","sourceRoot":"","sources":["../../src/tools/get-subscription.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;;;kBAc1B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../hack2hire-api.js';
|
|
4
|
+
import { mapSubscription, subscriptionSchema } from './schemas.js';
|
|
5
|
+
export const getSubscription = defineTool({
|
|
6
|
+
name: 'get_subscription',
|
|
7
|
+
displayName: 'Get Subscription',
|
|
8
|
+
description: "Get the authenticated user's subscription details — status (ACTIVE, CANCELED, EXPIRED, PENDING, TRIALING), payment method, plan duration code, current billing period start/end, and price.",
|
|
9
|
+
summary: 'Get the current subscription details',
|
|
10
|
+
icon: 'credit-card',
|
|
11
|
+
group: 'Account',
|
|
12
|
+
input: z.object({}),
|
|
13
|
+
output: z.object({ subscription: subscriptionSchema }),
|
|
14
|
+
handle: async () => {
|
|
15
|
+
const data = await api('/user/subscription-detail');
|
|
16
|
+
return { subscription: mapSubscription(data) };
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=get-subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-subscription.js","sourceRoot":"","sources":["../../src/tools/get-subscription.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,qBAAqB,CAAC;AAC1C,OAAO,EAAwB,eAAe,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEzF,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,6LAA6L;IAC/L,OAAO,EAAE,sCAAsC;IAC/C,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAC;IACtD,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAkB,2BAA2B,CAAC,CAAC;QACrE,OAAO,EAAE,YAAY,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;IACjD,CAAC;CACF,CAAC,CAAC"}
|