@talocode/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/agent-browser.d.ts +11 -0
- package/dist/agent-browser.js +40 -0
- package/dist/agent-browser.js.map +1 -0
- package/dist/cliploop.d.ts +17 -0
- package/dist/cliploop.js +56 -0
- package/dist/cliploop.js.map +1 -0
- package/dist/codra.d.ts +12 -0
- package/dist/codra.js +47 -0
- package/dist/codra.js.map +1 -0
- package/dist/crawlerlane.d.ts +115 -0
- package/dist/crawlerlane.js +93 -0
- package/dist/crawlerlane.js.map +1 -0
- package/dist/errors.d.ts +24 -0
- package/dist/errors.js +58 -0
- package/dist/errors.js.map +1 -0
- package/dist/forgecad.d.ts +139 -0
- package/dist/forgecad.js +49 -0
- package/dist/forgecad.js.map +1 -0
- package/dist/index.d.ts +170 -0
- package/dist/index.js +178 -0
- package/dist/index.js.map +1 -0
- package/dist/invoicelane.d.ts +53 -0
- package/dist/invoicelane.js +45 -0
- package/dist/invoicelane.js.map +1 -0
- package/dist/opensourcelane.d.ts +135 -0
- package/dist/opensourcelane.js +101 -0
- package/dist/opensourcelane.js.map +1 -0
- package/dist/placeholders.d.ts +9 -0
- package/dist/placeholders.js +23 -0
- package/dist/placeholders.js.map +1 -0
- package/dist/replylane.d.ts +113 -0
- package/dist/replylane.js +83 -0
- package/dist/replylane.js.map +1 -0
- package/dist/request.d.ts +7 -0
- package/dist/request.js +77 -0
- package/dist/request.js.map +1 -0
- package/dist/router.d.ts +12 -0
- package/dist/router.js +44 -0
- package/dist/router.js.map +1 -0
- package/dist/signallane.d.ts +76 -0
- package/dist/signallane.js +45 -0
- package/dist/signallane.js.map +1 -0
- package/dist/skills.d.ts +19 -0
- package/dist/skills.js +48 -0
- package/dist/skills.js.map +1 -0
- package/dist/talocode.d.ts +51 -0
- package/dist/talocode.js +82 -0
- package/dist/talocode.js.map +1 -0
- package/dist/tera.d.ts +15 -0
- package/dist/tera.js +65 -0
- package/dist/tera.js.map +1 -0
- package/dist/types.d.ts +398 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/ugclane.d.ts +105 -0
- package/dist/ugclane.js +93 -0
- package/dist/ugclane.js.map +1 -0
- package/dist/webdatalane.d.ts +74 -0
- package/dist/webdatalane.js +63 -0
- package/dist/webdatalane.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { TalocodeApiClient } from './talocode.js';
|
|
2
|
+
export interface OpenSourceLaneRepoMetadata {
|
|
3
|
+
stars?: number;
|
|
4
|
+
forks?: number;
|
|
5
|
+
issues?: number;
|
|
6
|
+
contributors?: number;
|
|
7
|
+
lastReleaseDaysAgo?: number;
|
|
8
|
+
lastCommitDaysAgo?: number;
|
|
9
|
+
hasDocker?: boolean;
|
|
10
|
+
hasSecurityPolicy?: boolean;
|
|
11
|
+
license?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface OpenSourceLaneAnalyzeInput {
|
|
14
|
+
repo?: string;
|
|
15
|
+
repoUrl?: string;
|
|
16
|
+
category?: string;
|
|
17
|
+
metadata?: OpenSourceLaneRepoMetadata;
|
|
18
|
+
readme?: string;
|
|
19
|
+
requirements?: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface OpenSourceLaneFindAlternativesInput {
|
|
22
|
+
replace: string;
|
|
23
|
+
teamSize?: number;
|
|
24
|
+
budget?: string;
|
|
25
|
+
deployment?: string;
|
|
26
|
+
requiredFeatures?: string[];
|
|
27
|
+
riskTolerance?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface OpenSourceLanePlanMigrationInput {
|
|
30
|
+
from: string;
|
|
31
|
+
to: string;
|
|
32
|
+
teamSize?: number;
|
|
33
|
+
currentWorkflow?: string[];
|
|
34
|
+
constraints?: {
|
|
35
|
+
downtime?: string;
|
|
36
|
+
hosting?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface OpenSourceLaneCostEstimateInput {
|
|
40
|
+
currentTool: string;
|
|
41
|
+
teamSize?: number;
|
|
42
|
+
currentMonthlyCost: number;
|
|
43
|
+
hostingCost?: number;
|
|
44
|
+
maintenanceHoursPerMonth?: number;
|
|
45
|
+
hourlyRate?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface OpenSourceLaneScoreRiskInput {
|
|
48
|
+
repo: string;
|
|
49
|
+
metadata?: OpenSourceLaneRepoMetadata;
|
|
50
|
+
requirements?: string[];
|
|
51
|
+
readme?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface OpenSourceLaneBriefInput {
|
|
54
|
+
tool: string;
|
|
55
|
+
repo: string;
|
|
56
|
+
replace: string;
|
|
57
|
+
teamSize?: number;
|
|
58
|
+
analysis?: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
export interface OpenSourceLaneCompareInput {
|
|
61
|
+
tools: Array<{
|
|
62
|
+
name: string;
|
|
63
|
+
repo: string;
|
|
64
|
+
metadata?: OpenSourceLaneRepoMetadata;
|
|
65
|
+
}>;
|
|
66
|
+
criteria?: string[];
|
|
67
|
+
}
|
|
68
|
+
export interface OpenSourceLaneDeploymentInput {
|
|
69
|
+
tool: string;
|
|
70
|
+
deployment?: string;
|
|
71
|
+
teamSize?: number;
|
|
72
|
+
environment?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface OpenSourceLaneLicenseInput {
|
|
75
|
+
repo: string;
|
|
76
|
+
license?: string;
|
|
77
|
+
intendedUse?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface OpenSourceLaneExportInput {
|
|
80
|
+
data?: Record<string, unknown>;
|
|
81
|
+
report?: Record<string, unknown>;
|
|
82
|
+
title?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface OpenSourceLaneResponse<T> {
|
|
85
|
+
result?: T;
|
|
86
|
+
data?: T;
|
|
87
|
+
usage: {
|
|
88
|
+
action: string;
|
|
89
|
+
credits: number;
|
|
90
|
+
remaining?: number;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export declare class OpenSourceLaneClient {
|
|
94
|
+
private api;
|
|
95
|
+
constructor(api: TalocodeApiClient);
|
|
96
|
+
health(): Promise<{
|
|
97
|
+
ok: boolean;
|
|
98
|
+
service: string;
|
|
99
|
+
version: string;
|
|
100
|
+
timestamp: string;
|
|
101
|
+
product: string;
|
|
102
|
+
status: string;
|
|
103
|
+
}>;
|
|
104
|
+
repo: {
|
|
105
|
+
analyze: (input: OpenSourceLaneAnalyzeInput) => Promise<OpenSourceLaneResponse<Record<string, unknown>>>;
|
|
106
|
+
};
|
|
107
|
+
alternatives: {
|
|
108
|
+
find: (input: OpenSourceLaneFindAlternativesInput) => Promise<OpenSourceLaneResponse<Record<string, unknown>>>;
|
|
109
|
+
};
|
|
110
|
+
migration: {
|
|
111
|
+
plan: (input: OpenSourceLanePlanMigrationInput) => Promise<OpenSourceLaneResponse<Record<string, unknown>>>;
|
|
112
|
+
};
|
|
113
|
+
cost: {
|
|
114
|
+
estimate: (input: OpenSourceLaneCostEstimateInput) => Promise<OpenSourceLaneResponse<Record<string, unknown>>>;
|
|
115
|
+
};
|
|
116
|
+
risk: {
|
|
117
|
+
score: (input: OpenSourceLaneScoreRiskInput) => Promise<OpenSourceLaneResponse<Record<string, unknown>>>;
|
|
118
|
+
};
|
|
119
|
+
brief: {
|
|
120
|
+
generate: (input: OpenSourceLaneBriefInput) => Promise<OpenSourceLaneResponse<Record<string, unknown>>>;
|
|
121
|
+
};
|
|
122
|
+
tools: {
|
|
123
|
+
compare: (input: OpenSourceLaneCompareInput) => Promise<OpenSourceLaneResponse<Record<string, unknown>>>;
|
|
124
|
+
};
|
|
125
|
+
deployment: {
|
|
126
|
+
plan: (input: OpenSourceLaneDeploymentInput) => Promise<OpenSourceLaneResponse<Record<string, unknown>>>;
|
|
127
|
+
};
|
|
128
|
+
license: {
|
|
129
|
+
audit: (input: OpenSourceLaneLicenseInput) => Promise<OpenSourceLaneResponse<Record<string, unknown>>>;
|
|
130
|
+
};
|
|
131
|
+
export: {
|
|
132
|
+
markdown: (input: OpenSourceLaneExportInput) => Promise<OpenSourceLaneResponse<Record<string, unknown>>>;
|
|
133
|
+
json: (input: OpenSourceLaneExportInput) => Promise<OpenSourceLaneResponse<Record<string, unknown>>>;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenSourceLaneClient = void 0;
|
|
4
|
+
class OpenSourceLaneClient {
|
|
5
|
+
api;
|
|
6
|
+
constructor(api) {
|
|
7
|
+
this.api = api;
|
|
8
|
+
}
|
|
9
|
+
async health() {
|
|
10
|
+
const res = await this.api.request('/v1/opensourcelane/health');
|
|
11
|
+
return res;
|
|
12
|
+
}
|
|
13
|
+
repo = {
|
|
14
|
+
analyze: async (input) => {
|
|
15
|
+
return this.api.request('/v1/opensourcelane/repo/analyze', {
|
|
16
|
+
method: 'POST',
|
|
17
|
+
body: input,
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
alternatives = {
|
|
22
|
+
find: async (input) => {
|
|
23
|
+
return this.api.request('/v1/opensourcelane/alternatives/find', {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
body: input,
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
migration = {
|
|
30
|
+
plan: async (input) => {
|
|
31
|
+
return this.api.request('/v1/opensourcelane/migration/plan', {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
body: input,
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
cost = {
|
|
38
|
+
estimate: async (input) => {
|
|
39
|
+
return this.api.request('/v1/opensourcelane/cost/estimate', {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
body: input,
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
risk = {
|
|
46
|
+
score: async (input) => {
|
|
47
|
+
return this.api.request('/v1/opensourcelane/risk/score', {
|
|
48
|
+
method: 'POST',
|
|
49
|
+
body: input,
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
brief = {
|
|
54
|
+
generate: async (input) => {
|
|
55
|
+
return this.api.request('/v1/opensourcelane/brief/generate', {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
body: input,
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
tools = {
|
|
62
|
+
compare: async (input) => {
|
|
63
|
+
return this.api.request('/v1/opensourcelane/tools/compare', {
|
|
64
|
+
method: 'POST',
|
|
65
|
+
body: input,
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
deployment = {
|
|
70
|
+
plan: async (input) => {
|
|
71
|
+
return this.api.request('/v1/opensourcelane/deployment/plan', {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
body: input,
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
license = {
|
|
78
|
+
audit: async (input) => {
|
|
79
|
+
return this.api.request('/v1/opensourcelane/license/audit', {
|
|
80
|
+
method: 'POST',
|
|
81
|
+
body: input,
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
export = {
|
|
86
|
+
markdown: async (input) => {
|
|
87
|
+
return this.api.request('/v1/opensourcelane/export/markdown', {
|
|
88
|
+
method: 'POST',
|
|
89
|
+
body: input,
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
json: async (input) => {
|
|
93
|
+
return this.api.request('/v1/opensourcelane/export/json', {
|
|
94
|
+
method: 'POST',
|
|
95
|
+
body: input,
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
exports.OpenSourceLaneClient = OpenSourceLaneClient;
|
|
101
|
+
//# sourceMappingURL=opensourcelane.js.map
|
|
@@ -0,0 +1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AC,OAAO,CAAC,oCAAoC,EAAE;gBAC5D,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,KAA2C;aAClD,CAA6D,CAAA;QAChE,CAAC;QACD,IAAI,EAAE,KAAK,EAAE,KAAgC,EAA4D,EAAE;YACzG,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,gCAAgC,EAAE;gBACxD,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,KAA2C;aAClD,CAA6D,CAAA;QAChE,CAAC;KACF,CAAA;CACF;AA3GD,oDA2GC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkLaneClientPlaceholder = exports.TradiaClientPlaceholder = exports.CodraClientPlaceholder = void 0;
|
|
4
|
+
const errors_1 = require("./errors");
|
|
5
|
+
class CodraClientPlaceholder {
|
|
6
|
+
async execute() {
|
|
7
|
+
throw new errors_1.TalocodeNotImplementedError('codra', 'execute');
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.CodraClientPlaceholder = CodraClientPlaceholder;
|
|
11
|
+
class TradiaClientPlaceholder {
|
|
12
|
+
async analyze() {
|
|
13
|
+
throw new errors_1.TalocodeNotImplementedError('tradia', 'analyze');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.TradiaClientPlaceholder = TradiaClientPlaceholder;
|
|
17
|
+
class WorkLaneClientPlaceholder {
|
|
18
|
+
async run() {
|
|
19
|
+
throw new errors_1.TalocodeNotImplementedError('worklane', 'run');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.WorkLaneClientPlaceholder = WorkLaneClientPlaceholder;
|
|
23
|
+
//# sourceMappingURL=placeholders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeholders.js","sourceRoot":"","sources":["../src/placeholders.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AAEtD,MAAa,sBAAsB;IACjC,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,oCAA2B,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAC3D,CAAC;CACF;AAJD,wDAIC;AAED,MAAa,uBAAuB;IAClC,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,oCAA2B,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;IAC5D,CAAC;CACF;AAJD,0DAIC;AAED,MAAa,yBAAyB;IACpC,KAAK,CAAC,GAAG;QACP,MAAM,IAAI,oCAA2B,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAC1D,CAAC;CACF;AAJD,8DAIC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { TalocodeApiClient } from './talocode.js';
|
|
2
|
+
export interface ReplyLaneScoreOpportunityInput {
|
|
3
|
+
tweetText: string;
|
|
4
|
+
authorHandle: string;
|
|
5
|
+
authorFollowers: number;
|
|
6
|
+
replyCount?: number;
|
|
7
|
+
likeCount?: number;
|
|
8
|
+
ageMinutes?: number;
|
|
9
|
+
yourFollowers?: number;
|
|
10
|
+
yourNiche?: string;
|
|
11
|
+
topicTags?: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface ReplyLaneTargetAccount {
|
|
14
|
+
handle: string;
|
|
15
|
+
followers: number;
|
|
16
|
+
niche?: string;
|
|
17
|
+
avgRepliesPerPost?: number;
|
|
18
|
+
postsPerWeek?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ReplyLaneRankTargetsInput {
|
|
21
|
+
yourFollowers: number;
|
|
22
|
+
yourNiche?: string;
|
|
23
|
+
accounts: ReplyLaneTargetAccount[];
|
|
24
|
+
}
|
|
25
|
+
export interface ReplyLaneDraftRepliesInput {
|
|
26
|
+
tweetText: string;
|
|
27
|
+
authorHandle?: string;
|
|
28
|
+
yourNiche?: string;
|
|
29
|
+
yourExperience?: string;
|
|
30
|
+
replyTypes?: string[];
|
|
31
|
+
count?: number;
|
|
32
|
+
maxLength?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface ReplyLaneScoreReplyRiskInput {
|
|
35
|
+
replyText: string;
|
|
36
|
+
targetHandle?: string;
|
|
37
|
+
repliesLastHour?: number;
|
|
38
|
+
repliesToSameAccountToday?: number;
|
|
39
|
+
similarRepliesToday?: number;
|
|
40
|
+
containsLink?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface ReplyLaneGrokCheckInput {
|
|
43
|
+
postText: string;
|
|
44
|
+
isReply?: boolean;
|
|
45
|
+
goal?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ReplyLaneActivityEntry {
|
|
48
|
+
type: 'post' | 'reply';
|
|
49
|
+
handle?: string;
|
|
50
|
+
timestamp?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ReplyLaneAuditActivityInput {
|
|
53
|
+
entries: ReplyLaneActivityEntry[];
|
|
54
|
+
periodDays?: number;
|
|
55
|
+
targetRepliesPerDay?: number;
|
|
56
|
+
targetPostsPerDay?: number;
|
|
57
|
+
}
|
|
58
|
+
export interface ReplyLaneFeedMigrateInput {
|
|
59
|
+
communityName?: string;
|
|
60
|
+
niche?: string;
|
|
61
|
+
memberCount?: number;
|
|
62
|
+
currentTopics?: string[];
|
|
63
|
+
goal?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface ReplyLaneExportInput {
|
|
66
|
+
data?: Record<string, unknown>;
|
|
67
|
+
report?: Record<string, unknown>;
|
|
68
|
+
title?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface ReplyLaneResponse<T> {
|
|
71
|
+
result?: T;
|
|
72
|
+
data?: T;
|
|
73
|
+
usage: {
|
|
74
|
+
action: string;
|
|
75
|
+
credits: number;
|
|
76
|
+
remaining?: number;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export declare class ReplyLaneClient {
|
|
80
|
+
private api;
|
|
81
|
+
constructor(api: TalocodeApiClient);
|
|
82
|
+
health(): Promise<{
|
|
83
|
+
ok: boolean;
|
|
84
|
+
service: string;
|
|
85
|
+
version: string;
|
|
86
|
+
timestamp: string;
|
|
87
|
+
product: string;
|
|
88
|
+
status: string;
|
|
89
|
+
}>;
|
|
90
|
+
opportunity: {
|
|
91
|
+
score: (input: ReplyLaneScoreOpportunityInput) => Promise<ReplyLaneResponse<Record<string, unknown>>>;
|
|
92
|
+
};
|
|
93
|
+
targets: {
|
|
94
|
+
rank: (input: ReplyLaneRankTargetsInput) => Promise<ReplyLaneResponse<Record<string, unknown>>>;
|
|
95
|
+
};
|
|
96
|
+
replies: {
|
|
97
|
+
draft: (input: ReplyLaneDraftRepliesInput) => Promise<ReplyLaneResponse<Record<string, unknown>>>;
|
|
98
|
+
risk: (input: ReplyLaneScoreReplyRiskInput) => Promise<ReplyLaneResponse<Record<string, unknown>>>;
|
|
99
|
+
};
|
|
100
|
+
posts: {
|
|
101
|
+
grokCheck: (input: ReplyLaneGrokCheckInput) => Promise<ReplyLaneResponse<Record<string, unknown>>>;
|
|
102
|
+
};
|
|
103
|
+
activity: {
|
|
104
|
+
audit: (input: ReplyLaneAuditActivityInput) => Promise<ReplyLaneResponse<Record<string, unknown>>>;
|
|
105
|
+
};
|
|
106
|
+
feeds: {
|
|
107
|
+
migrate: (input: ReplyLaneFeedMigrateInput) => Promise<ReplyLaneResponse<Record<string, unknown>>>;
|
|
108
|
+
};
|
|
109
|
+
export: {
|
|
110
|
+
markdown: (input: ReplyLaneExportInput) => Promise<ReplyLaneResponse<Record<string, unknown>>>;
|
|
111
|
+
json: (input: ReplyLaneExportInput) => Promise<ReplyLaneResponse<Record<string, unknown>>>;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReplyLaneClient = void 0;
|
|
4
|
+
class ReplyLaneClient {
|
|
5
|
+
api;
|
|
6
|
+
constructor(api) {
|
|
7
|
+
this.api = api;
|
|
8
|
+
}
|
|
9
|
+
async health() {
|
|
10
|
+
const res = await this.api.request('/v1/replylane/health');
|
|
11
|
+
return res;
|
|
12
|
+
}
|
|
13
|
+
opportunity = {
|
|
14
|
+
score: async (input) => {
|
|
15
|
+
return this.api.request('/v1/replylane/opportunity/score', {
|
|
16
|
+
method: 'POST',
|
|
17
|
+
body: input,
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
targets = {
|
|
22
|
+
rank: async (input) => {
|
|
23
|
+
return this.api.request('/v1/replylane/targets/rank', {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
body: input,
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
replies = {
|
|
30
|
+
draft: async (input) => {
|
|
31
|
+
return this.api.request('/v1/replylane/replies/draft', {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
body: input,
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
risk: async (input) => {
|
|
37
|
+
return this.api.request('/v1/replylane/replies/risk', {
|
|
38
|
+
method: 'POST',
|
|
39
|
+
body: input,
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
posts = {
|
|
44
|
+
grokCheck: async (input) => {
|
|
45
|
+
return this.api.request('/v1/replylane/posts/grok-check', {
|
|
46
|
+
method: 'POST',
|
|
47
|
+
body: input,
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
activity = {
|
|
52
|
+
audit: async (input) => {
|
|
53
|
+
return this.api.request('/v1/replylane/activity/audit', {
|
|
54
|
+
method: 'POST',
|
|
55
|
+
body: input,
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
feeds = {
|
|
60
|
+
migrate: async (input) => {
|
|
61
|
+
return this.api.request('/v1/replylane/feeds/migrate', {
|
|
62
|
+
method: 'POST',
|
|
63
|
+
body: input,
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
export = {
|
|
68
|
+
markdown: async (input) => {
|
|
69
|
+
return this.api.request('/v1/replylane/export/markdown', {
|
|
70
|
+
method: 'POST',
|
|
71
|
+
body: input,
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
json: async (input) => {
|
|
75
|
+
return this.api.request('/v1/replylane/export/json', {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
body: input,
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
exports.ReplyLaneClient = ReplyLaneClient;
|
|
83
|
+
//# sourceMappingURL=replylane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replylane.js","sourceRoot":"","sources":["../src/replylane.ts"],"names":[],"mappings":";;;AA0FA,MAAa,eAAe;IAClB,GAAG,CAAmB;IAE9B,YAAY,GAAsB;QAChC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAA;QAC1D,OAAO,GAA4G,CAAA;IACrH,CAAC;IAED,WAAW,GAAG;QACZ,KAAK,EAAE,KAAK,EAAE,KAAqC,EAAuD,EAAE;YAC1G,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,iCAAiC,EAAE;gBACzD,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,KAA2C;aAClD,CAAwD,CAAA;QAC3D,CAAC;KACF,CAAA;IAED,OAAO,GAAG;QACR,IAAI,EAAE,KAAK,EAAE,KAAgC,EAAuD,EAAE;YACpG,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,4BAA4B,EAAE;gBACpD,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,KAA2C;aAClD,CAAwD,CAAA;QAC3D,CAAC;KACF,CAAA;IAED,OAAO,GAAG;QACR,KAAK,EAAE,KAAK,EAAE,KAAiC,EAAuD,EAAE;YACtG,OAA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I,EAAE,KAAK,EAAE,KAA2B,EAAuD,EAAE;YAC/F,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,2BAA2B,EAAE;gBACnD,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,KAA2C;aAClD,CAAwD,CAAA;QAC3D,CAAC;KACF,CAAA;CACF;AAtFD,0CAsFC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface RequestOptions {
|
|
2
|
+
method?: string;
|
|
3
|
+
body?: unknown;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
timeoutMs?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function request(baseUrl: string, path: string, apiKey: string | undefined, options?: RequestOptions): Promise<unknown>;
|
package/dist/request.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.request = request;
|
|
4
|
+
const errors_1 = require("./errors");
|
|
5
|
+
async function request(baseUrl, path, apiKey, options = {}) {
|
|
6
|
+
const url = `${baseUrl.replace(/\/+$/, '')}${path}`;
|
|
7
|
+
const method = options.method ?? 'POST';
|
|
8
|
+
const timeoutMs = options.timeoutMs ?? 30000;
|
|
9
|
+
const headers = {
|
|
10
|
+
'Content-Type': 'application/json',
|
|
11
|
+
...(options.headers ?? {}),
|
|
12
|
+
};
|
|
13
|
+
if (apiKey) {
|
|
14
|
+
headers['Authorization'] = `Bearer ${apiKey}`;
|
|
15
|
+
}
|
|
16
|
+
const controller = new AbortController();
|
|
17
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
18
|
+
try {
|
|
19
|
+
const res = await fetch(url, {
|
|
20
|
+
method,
|
|
21
|
+
headers,
|
|
22
|
+
body: options.body !== undefined ? JSON.stringify(options.body) : undefined,
|
|
23
|
+
signal: controller.signal,
|
|
24
|
+
});
|
|
25
|
+
clearTimeout(timer);
|
|
26
|
+
const contentType = res.headers.get('content-type') ?? '';
|
|
27
|
+
let body = undefined;
|
|
28
|
+
if (contentType.includes('json')) {
|
|
29
|
+
body = await res.json();
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const text = await res.text();
|
|
33
|
+
body = { message: text };
|
|
34
|
+
}
|
|
35
|
+
const requestId = (res.headers.get('x-talocode-request-id') ??
|
|
36
|
+
res.headers.get('x-tera-request-id') ??
|
|
37
|
+
res.headers.get('x-request-id')) ??
|
|
38
|
+
undefined;
|
|
39
|
+
if (!res.ok) {
|
|
40
|
+
const errBody = body;
|
|
41
|
+
const errData = errBody?.error;
|
|
42
|
+
const message = errData?.message ??
|
|
43
|
+
errBody?.message ??
|
|
44
|
+
`HTTP ${res.status}`;
|
|
45
|
+
const code = errData?.code ?? 'unknown';
|
|
46
|
+
switch (res.status) {
|
|
47
|
+
case 400:
|
|
48
|
+
throw new errors_1.TalocodeValidationError(message, (errData?.details ?? errBody?.details), requestId);
|
|
49
|
+
case 401:
|
|
50
|
+
throw new errors_1.TalocodeAuthError(message, requestId);
|
|
51
|
+
case 402: {
|
|
52
|
+
const required = errData?.required ?? errBody?.required;
|
|
53
|
+
const available = errData?.available ?? errBody?.available;
|
|
54
|
+
throw new errors_1.TalocodeInsufficientCreditsError(message, required, available, requestId);
|
|
55
|
+
}
|
|
56
|
+
case 429:
|
|
57
|
+
throw new errors_1.TalocodeRateLimitError(message, requestId);
|
|
58
|
+
default:
|
|
59
|
+
throw new errors_1.TalocodeError(message, res.status, code, requestId);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (body && typeof body === 'object' && 'data' in body) {
|
|
63
|
+
return body.data;
|
|
64
|
+
}
|
|
65
|
+
return body;
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
clearTimeout(timer);
|
|
69
|
+
if (err instanceof errors_1.TalocodeError)
|
|
70
|
+
throw err;
|
|
71
|
+
if (err instanceof DOMException && err.name === 'AbortError') {
|
|
72
|
+
throw new errors_1.TalocodeError('Request timed out', 0, 'timeout');
|
|
73
|
+
}
|
|
74
|
+
throw new errors_1.TalocodeError(err instanceof Error ? err.message : 'Network error', 0, 'network_error');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":";;AAeA,0BAsGC;AArHD,qCAMiB;AASV,KAAK,UAAU,OAAO,CAC3B,OAAe,EACf,IAAY,EACZ,MAA0B,EAC1B,UAA0B,EAAE;IAE5B,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAA;IACnD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM,CAAA;IACvC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAA;IAE5C,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,kBAAkB;QAClC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;KAC3B,CAAA;IAED,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,MAAM,EAAE,CAAA;IAC/C,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAA;IACxC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,SAAS,CAAC,CAAA;IAE7D,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAC3B,MAAM;YACN,OAAO;YACP,IAAI,EAAE,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;YAC3E,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC,C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RouterProvidersResponse } from './types';
|
|
2
|
+
export declare class RouterClient {
|
|
3
|
+
private baseUrl;
|
|
4
|
+
private apiKey;
|
|
5
|
+
private timeoutMs;
|
|
6
|
+
constructor(baseUrl: string, apiKey: string | undefined, timeoutMs: number);
|
|
7
|
+
private getNamespacePath;
|
|
8
|
+
chat(input: RouterChatInput): Promise<RouterChatResponse>;
|
|
9
|
+
models(): Promise<RouterModelsResponse>;
|
|
10
|
+
providers(): Promise<RouterProvidersResponse>;
|
|
11
|
+
health(): Promise<RouterHealthResponse>;
|
|
12
|
+
}
|
package/dist/router.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RouterClient = void 0;
|
|
4
|
+
const request_1 = require("./request");
|
|
5
|
+
class RouterClient {
|
|
6
|
+
baseUrl;
|
|
7
|
+
apiKey;
|
|
8
|
+
timeoutMs;
|
|
9
|
+
constructor(baseUrl, apiKey, timeoutMs) {
|
|
10
|
+
this.baseUrl = baseUrl;
|
|
11
|
+
this.apiKey = apiKey;
|
|
12
|
+
this.timeoutMs = timeoutMs;
|
|
13
|
+
}
|
|
14
|
+
getNamespacePath(path) {
|
|
15
|
+
return `/v1/router${path}`;
|
|
16
|
+
}
|
|
17
|
+
async chat(input) {
|
|
18
|
+
return (0, request_1.request)(this.baseUrl, this.getNamespacePath('/chat/completions'), this.apiKey, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
body: input,
|
|
21
|
+
timeoutMs: this.timeoutMs,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
async models() {
|
|
25
|
+
return (0, request_1.request)(this.baseUrl, this.getNamespacePath('/models'), this.apiKey, {
|
|
26
|
+
method: 'GET',
|
|
27
|
+
timeoutMs: this.timeoutMs,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async providers() {
|
|
31
|
+
return (0, request_1.request)(this.baseUrl, this.getNamespacePath('/providers'), this.apiKey, {
|
|
32
|
+
method: 'GET',
|
|
33
|
+
timeoutMs: this.timeoutMs,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async health() {
|
|
37
|
+
return (0, request_1.request)(this.baseUrl, this.getNamespacePath('/health'), this.apiKey, {
|
|
38
|
+
method: 'GET',
|
|
39
|
+
timeoutMs: this.timeoutMs,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.RouterClient = RouterClient;
|
|
44
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AASnC,MAAa,YAAY;IACf,OAAO,CAAQ;IACf,MAAM,CAAoB;IAC1B,SAAS,CAAQ;IAEzB,YAAY,OAAe,EAAE,MAA0B,EAAE,SAAiB;QACxE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAEO,gBAAgB,CAAC,IAAY;QACnC,OAAO,aAAa,IAAI,EAAE,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAsB;QAC/B,OAAO,IAAA,iBAAO,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE;YACpF,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAgC,CAAA;IACnC,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,IAAA,iBAAO,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE;YAC1E,MAAM,EAAE,KAAK;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