runline 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/auth.d.ts +7 -0
- package/dist/commands/auth.js +96 -0
- package/dist/config/loader.d.ts +11 -0
- package/dist/config/loader.js +46 -0
- package/dist/core/engine.js +7 -1
- package/dist/core/oauth.d.ts +46 -0
- package/dist/core/oauth.js +145 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/dist/main.js +28 -0
- package/dist/plugin/api.d.ts +7 -1
- package/dist/plugin/api.js +7 -0
- package/dist/plugin/types.d.ts +47 -0
- package/dist/plugins/actionNetwork/src/index.js +118 -25
- package/dist/plugins/activeCampaign/src/index.js +184 -38
- package/dist/plugins/adalo/src/index.js +40 -8
- package/dist/plugins/affinity/src/index.js +100 -20
- package/dist/plugins/agileCrm/src/index.js +115 -27
- package/dist/plugins/airtable/src/index.js +94 -19
- package/dist/plugins/airtop/src/index.js +266 -62
- package/dist/plugins/apiTemplateIo/src/index.js +25 -5
- package/dist/plugins/asana/src/index.js +195 -41
- package/dist/plugins/autopilot/src/index.js +39 -8
- package/dist/plugins/bambooHr/src/index.js +109 -22
- package/dist/plugins/bannerbear/src/index.js +36 -8
- package/dist/plugins/baserow/src/index.js +35 -7
- package/dist/plugins/beeminder/src/index.js +198 -40
- package/dist/plugins/bitly/src/index.js +46 -10
- package/dist/plugins/bitwarden/src/index.js +167 -36
- package/dist/plugins/box/src/index.js +172 -37
- package/dist/plugins/brandfetch/src/index.js +5 -1
- package/dist/plugins/brevo/src/index.js +136 -29
- package/dist/plugins/bubble/src/index.js +76 -17
- package/dist/plugins/chargebee/src/index.js +35 -7
- package/dist/plugins/circleci/src/index.js +50 -10
- package/dist/plugins/ciscoWebex/src/index.js +131 -27
- package/dist/plugins/clearbit/src/index.js +76 -17
- package/dist/plugins/clickup/src/index.js +500 -107
- package/dist/plugins/clockify/src/index.js +229 -47
- package/dist/plugins/cloudflare/src/index.js +28 -6
- package/dist/plugins/cockpit/src/index.js +54 -12
- package/dist/plugins/coda/src/index.js +81 -19
- package/dist/plugins/coingecko/src/index.js +157 -33
- package/dist/plugins/contentful/src/index.js +85 -17
- package/dist/plugins/convertkit/src/index.js +74 -18
- package/dist/plugins/copper/src/index.js +59 -11
- package/dist/plugins/cortex/src/index.js +55 -13
- package/dist/plugins/currents/src/index.js +310 -71
- package/dist/plugins/customerIo/src/index.js +112 -23
- package/dist/plugins/databricks/src/index.js +549 -115
- package/dist/plugins/deepl/src/index.js +26 -6
- package/dist/plugins/demio/src/index.js +56 -11
- package/dist/plugins/dhl/src/index.js +16 -3
- package/dist/plugins/discord/src/index.js +141 -31
- package/dist/plugins/discourse/src/index.js +136 -31
- package/dist/plugins/disqus/src/index.js +96 -20
- package/dist/plugins/docker/src/index.js +20 -4
- package/dist/plugins/drift/src/index.js +19 -5
- package/dist/plugins/dropbox/src/index.js +139 -30
- package/dist/plugins/dropcontact/src/index.js +21 -4
- package/dist/plugins/egoi/src/index.js +61 -15
- package/dist/plugins/elasticsearch/src/index.js +59 -13
- package/dist/plugins/emelia/src/index.js +95 -19
- package/dist/plugins/erpnext/src/index.js +74 -15
- package/dist/plugins/facebookGraph/src/index.js +52 -11
- package/dist/plugins/freshdesk/src/index.js +220 -48
- package/dist/plugins/freshservice/src/index.js +39 -9
- package/dist/plugins/freshworksCrm/src/index.js +58 -12
- package/dist/plugins/getresponse/src/index.js +87 -18
- package/dist/plugins/ghost/src/index.js +114 -26
- package/dist/plugins/github/src/index.js +483 -109
- package/dist/plugins/gitlab/src/index.js +193 -45
- package/dist/plugins/gmail/src/index.js +1075 -0
- package/dist/plugins/gong/src/index.js +68 -14
- package/dist/plugins/gotify/src/index.js +43 -9
- package/dist/plugins/gotowebinar/src/index.js +233 -47
- package/dist/plugins/grafana/src/index.js +92 -21
- package/dist/plugins/graphql/src/index.js +38 -8
- package/dist/plugins/grist/src/index.js +52 -10
- package/dist/plugins/hackernews/src/index.js +32 -6
- package/dist/plugins/halopsa/src/index.js +131 -26
- package/dist/plugins/harvest/src/index.js +182 -42
- package/dist/plugins/helpscout/src/index.js +153 -31
- package/dist/plugins/highlevel/src/index.js +291 -58
- package/dist/plugins/homeAssistant/src/index.js +124 -26
- package/dist/plugins/hubspot/src/index.js +163 -29
- package/dist/plugins/humanticAi/src/index.js +54 -5
- package/dist/plugins/hunter/src/index.js +21 -4
- package/dist/plugins/intercom/src/index.js +95 -20
- package/dist/plugins/iterable/src/index.js +96 -20
- package/dist/plugins/jenkins/src/index.js +75 -17
- package/dist/plugins/jira/src/index.js +193 -43
- package/dist/plugins/keap/src/index.js +222 -56
- package/dist/plugins/kobotoolbox/src/index.js +113 -25
- package/dist/plugins/lemlist/src/index.js +79 -18
- package/dist/plugins/linear/src/index.js +86 -19
- package/dist/plugins/lingvanex/src/index.js +38 -8
- package/dist/plugins/linkedin/src/index.js +37 -8
- package/dist/plugins/lonescale/src/index.js +41 -9
- package/dist/plugins/magento/src/index.js +98 -27
- package/dist/plugins/mailcheck/src/index.js +11 -2
- package/dist/plugins/mailchimp/src/index.js +193 -42
- package/dist/plugins/mailerlite/src/index.js +61 -12
- package/dist/plugins/mailgun/src/index.js +39 -7
- package/dist/plugins/mailjet/src/index.js +141 -30
- package/dist/plugins/mandrill/src/index.js +67 -14
- package/dist/plugins/marketstack/src/index.js +56 -10
- package/dist/plugins/matrix/src/index.js +97 -20
- package/dist/plugins/mattermost/src/index.js +124 -26
- package/dist/plugins/mautic/src/index.js +129 -26
- package/dist/plugins/medium/src/index.js +64 -13
- package/dist/plugins/messagebird/src/index.js +80 -15
- package/dist/plugins/metabase/src/index.js +57 -12
- package/dist/plugins/misp/src/index.js +135 -33
- package/dist/plugins/mocean/src/index.js +33 -7
- package/dist/plugins/monday/src/index.js +97 -23
- package/dist/plugins/monicaCrm/src/index.js +112 -23
- package/dist/plugins/msg91/src/index.js +11 -2
- package/dist/plugins/nasa/src/index.js +108 -21
- package/dist/plugins/netlify/src/index.js +28 -6
- package/dist/plugins/netscalerAdc/src/index.js +144 -29
- package/dist/plugins/nextcloud/src/index.js +103 -20
- package/dist/plugins/nocodb/src/index.js +57 -11
- package/dist/plugins/notion/src/index.js +148 -37
- package/dist/plugins/npm/src/index.js +59 -12
- package/dist/plugins/odoo/src/index.js +102 -20
- package/dist/plugins/okta/src/index.js +50 -10
- package/dist/plugins/oneSimpleApi/src/index.js +84 -17
- package/dist/plugins/onfleet/src/index.js +139 -32
- package/dist/plugins/openThesaurus/src/index.js +46 -9
- package/dist/plugins/openweathermap/src/index.js +31 -6
- package/dist/plugins/oura/src/index.js +36 -7
- package/dist/plugins/paddle/src/index.js +80 -17
- package/dist/plugins/pagerduty/src/index.js +53 -12
- package/dist/plugins/paypal/src/index.js +51 -11
- package/dist/plugins/peekalink/src/index.js +12 -3
- package/dist/plugins/phantombuster/src/index.js +39 -8
- package/dist/plugins/philipsHue/src/index.js +64 -13
- package/dist/plugins/pipedrive/src/index.js +167 -45
- package/dist/plugins/plivo/src/index.js +43 -8
- package/dist/plugins/postbin/src/index.js +9 -2
- package/dist/plugins/posthog/src/index.js +50 -13
- package/dist/plugins/profitwell/src/index.js +24 -5
- package/dist/plugins/pushbullet/src/index.js +45 -9
- package/dist/plugins/pushcut/src/index.js +31 -6
- package/dist/plugins/pushover/src/index.js +51 -10
- package/dist/plugins/quickbase/src/index.js +66 -13
- package/dist/plugins/quickbooks/src/index.js +86 -19
- package/dist/plugins/quickchart/src/index.js +35 -7
- package/dist/plugins/raindrop/src/index.js +54 -13
- package/dist/plugins/reddit/src/index.js +73 -18
- package/dist/plugins/rocketchat/src/index.js +47 -9
- package/dist/plugins/rundeck/src/index.js +26 -5
- package/dist/plugins/salesforce/src/index.js +161 -31
- package/dist/plugins/salesmate/src/index.js +75 -16
- package/dist/plugins/securityScorecard/src/index.js +73 -15
- package/dist/plugins/segment/src/index.js +21 -4
- package/dist/plugins/sendgrid/src/index.js +102 -24
- package/dist/plugins/sendy/src/index.js +54 -11
- package/dist/plugins/sentry/src/index.js +174 -34
- package/dist/plugins/servicenow/src/index.js +120 -27
- package/dist/plugins/shopify/src/index.js +53 -12
- package/dist/plugins/signl4/src/index.js +16 -3
- package/dist/plugins/slack/src/index.js +407 -105
- package/dist/plugins/sms77/src/index.js +26 -5
- package/dist/plugins/splunk/src/index.js +186 -45
- package/dist/plugins/spotify/src/index.js +265 -66
- package/dist/plugins/stackby/src/index.js +18 -6
- package/dist/plugins/storyblok/src/index.js +57 -11
- package/dist/plugins/strapi/src/index.js +63 -12
- package/dist/plugins/strava/src/index.js +58 -13
- package/dist/plugins/stripe/src/index.js +143 -30
- package/dist/plugins/supabase/src/index.js +49 -10
- package/dist/plugins/syncromsp/src/index.js +245 -67
- package/dist/plugins/tapfiliate/src/index.js +57 -14
- package/dist/plugins/telegram/src/index.js +202 -39
- package/dist/plugins/thehive/src/index.js +271 -66
- package/dist/plugins/thehiveProject/src/index.js +457 -89
- package/dist/plugins/todoist/src/index.js +326 -77
- package/dist/plugins/travisci/src/index.js +35 -8
- package/dist/plugins/trello/src/index.js +204 -46
- package/dist/plugins/twake/src/index.js +10 -2
- package/dist/plugins/twilio/src/index.js +56 -11
- package/dist/plugins/twist/src/index.js +241 -48
- package/dist/plugins/twitter/src/index.js +128 -30
- package/dist/plugins/unleashedSoftware/src/index.js +30 -6
- package/dist/plugins/uplead/src/index.js +9 -2
- package/dist/plugins/uproc/src/index.js +31 -6
- package/dist/plugins/uptimerobot/src/index.js +119 -25
- package/dist/plugins/urlscanio/src/index.js +25 -6
- package/dist/plugins/vero/src/index.js +68 -13
- package/dist/plugins/vonage/src/index.js +32 -6
- package/dist/plugins/wekan/src/index.js +297 -52
- package/dist/plugins/woocommerce/src/index.js +57 -12
- package/dist/plugins/wordpress/src/index.js +94 -18
- package/dist/plugins/xero/src/index.js +79 -13
- package/dist/plugins/yourls/src/index.js +33 -6
- package/dist/plugins/zammad/src/index.js +139 -36
- package/dist/plugins/zendesk/src/index.js +201 -48
- package/dist/plugins/zoho/src/index.js +88 -21
- package/dist/plugins/zoom/src/index.js +41 -7
- package/dist/plugins/zulip/src/index.js +101 -20
- package/package.json +3 -1
|
@@ -11,7 +11,13 @@ async function api(host, token, method, path, body, qs) {
|
|
|
11
11
|
url.searchParams.set(k, v);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
const init = {
|
|
14
|
+
const init = {
|
|
15
|
+
method,
|
|
16
|
+
headers: {
|
|
17
|
+
Authorization: `Bearer ${token}`,
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
15
21
|
if (body && Object.keys(body).length > 0)
|
|
16
22
|
init.body = JSON.stringify(body);
|
|
17
23
|
const res = await fetch(url.toString(), init);
|
|
@@ -28,35 +34,64 @@ function volumeParts(volumePath) {
|
|
|
28
34
|
throw new Error("Volume path must be catalog.schema.volume");
|
|
29
35
|
return parts;
|
|
30
36
|
}
|
|
31
|
-
function sleep(ms) {
|
|
37
|
+
function sleep(ms) {
|
|
38
|
+
return new Promise((r) => setTimeout(r, ms));
|
|
39
|
+
}
|
|
32
40
|
export default function databricks(rl) {
|
|
33
41
|
rl.setName("databricks");
|
|
34
42
|
rl.setVersion("0.1.0");
|
|
35
43
|
rl.setConnectionSchema({
|
|
36
|
-
host: {
|
|
37
|
-
|
|
44
|
+
host: {
|
|
45
|
+
type: "string",
|
|
46
|
+
required: true,
|
|
47
|
+
description: "Databricks workspace URL, e.g. https://adb-12345.azuredatabricks.net",
|
|
48
|
+
env: "DATABRICKS_HOST",
|
|
49
|
+
},
|
|
50
|
+
accessToken: {
|
|
51
|
+
type: "string",
|
|
52
|
+
required: true,
|
|
53
|
+
description: "Personal access token or OAuth2 token",
|
|
54
|
+
env: "DATABRICKS_TOKEN",
|
|
55
|
+
},
|
|
38
56
|
});
|
|
39
57
|
// ── Databricks SQL ──────────────────────────────────
|
|
40
|
-
rl.registerAction("sql.executeQuery", {
|
|
58
|
+
rl.registerAction("sql.executeQuery", {
|
|
59
|
+
description: "Execute a SQL query on a warehouse and return results",
|
|
41
60
|
inputSchema: {
|
|
42
|
-
warehouseId: {
|
|
61
|
+
warehouseId: {
|
|
62
|
+
type: "string",
|
|
63
|
+
required: true,
|
|
64
|
+
description: "SQL warehouse ID",
|
|
65
|
+
},
|
|
43
66
|
query: { type: "string", required: true, description: "SQL statement" },
|
|
44
|
-
parameters: {
|
|
67
|
+
parameters: {
|
|
68
|
+
type: "object",
|
|
69
|
+
required: false,
|
|
70
|
+
description: "Array of {name, value, type?} query parameters",
|
|
71
|
+
},
|
|
45
72
|
},
|
|
46
73
|
async execute(input, ctx) {
|
|
47
74
|
const { host, token } = getConn(ctx);
|
|
48
75
|
const p = input;
|
|
49
76
|
const params = (p.parameters ?? []);
|
|
50
|
-
const body = {
|
|
77
|
+
const body = {
|
|
78
|
+
warehouse_id: p.warehouseId,
|
|
79
|
+
statement: p.query,
|
|
80
|
+
wait_timeout: "50s",
|
|
81
|
+
on_wait_timeout: "CONTINUE",
|
|
82
|
+
};
|
|
51
83
|
if (params.length > 0)
|
|
52
84
|
body.parameters = params.map(({ name, value, type }) => type ? { name, value, type } : { name, value });
|
|
53
|
-
let result = await api(host, token, "POST", "/api/2.0/sql/statements", body);
|
|
85
|
+
let result = (await api(host, token, "POST", "/api/2.0/sql/statements", body));
|
|
54
86
|
const statementId = result.statement_id;
|
|
55
87
|
let status = result.status.state;
|
|
56
88
|
let retries = 0;
|
|
57
|
-
while (status !== "SUCCEEDED" &&
|
|
89
|
+
while (status !== "SUCCEEDED" &&
|
|
90
|
+
status !== "FAILED" &&
|
|
91
|
+
status !== "CANCELED" &&
|
|
92
|
+
retries < 60) {
|
|
58
93
|
await sleep(5000);
|
|
59
|
-
result = await api(host, token, "GET", `/api/2.0/sql/statements/${statementId}`);
|
|
94
|
+
result = (await api(host, token, "GET", `/api/2.0/sql/statements/${statementId}`));
|
|
60
95
|
status = result.status.state;
|
|
61
96
|
retries++;
|
|
62
97
|
}
|
|
@@ -74,61 +109,119 @@ export default function databricks(rl) {
|
|
|
74
109
|
}
|
|
75
110
|
let chunkIdx = allRows.length > 0 ? 1 : 0;
|
|
76
111
|
while (chunkIdx < totalChunks) {
|
|
77
|
-
const chunk = await api(host, token, "GET", `/api/2.0/sql/statements/${statementId}/result/chunks/${chunkIdx}`);
|
|
112
|
+
const chunk = (await api(host, token, "GET", `/api/2.0/sql/statements/${statementId}/result/chunks/${chunkIdx}`));
|
|
78
113
|
if (chunk.data_array)
|
|
79
114
|
allRows.push(...chunk.data_array);
|
|
80
115
|
chunkIdx++;
|
|
81
116
|
}
|
|
82
117
|
// Transform to objects
|
|
83
|
-
const columns = (manifest?.schema?.columns ??
|
|
118
|
+
const columns = (manifest?.schema?.columns ??
|
|
119
|
+
[]);
|
|
84
120
|
return allRows.map((row) => {
|
|
85
121
|
const obj = {};
|
|
86
|
-
columns.forEach((col, idx) => {
|
|
122
|
+
columns.forEach((col, idx) => {
|
|
123
|
+
obj[col.name] = row[idx];
|
|
124
|
+
});
|
|
87
125
|
return obj;
|
|
88
126
|
});
|
|
89
|
-
}
|
|
127
|
+
},
|
|
128
|
+
});
|
|
90
129
|
// ── Files ───────────────────────────────────────────
|
|
91
|
-
rl.registerAction("files.createDirectory", {
|
|
92
|
-
|
|
130
|
+
rl.registerAction("files.createDirectory", {
|
|
131
|
+
description: "Create a directory in a Unity Catalog volume",
|
|
132
|
+
inputSchema: {
|
|
133
|
+
volumePath: {
|
|
134
|
+
type: "string",
|
|
135
|
+
required: true,
|
|
136
|
+
description: "catalog.schema.volume",
|
|
137
|
+
},
|
|
138
|
+
directoryPath: { type: "string", required: true },
|
|
139
|
+
},
|
|
93
140
|
async execute(input, ctx) {
|
|
94
141
|
const { host, token } = getConn(ctx);
|
|
95
142
|
const p = input;
|
|
96
143
|
const [cat, sch, vol] = volumeParts(p.volumePath);
|
|
97
144
|
await api(host, token, "PUT", `/api/2.0/fs/directories/Volumes/${cat}/${sch}/${vol}/${p.directoryPath}`);
|
|
98
145
|
return { success: true, directoryPath: p.directoryPath };
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
rl.registerAction("files.deleteDirectory", {
|
|
149
|
+
description: "Delete a directory in a volume",
|
|
150
|
+
inputSchema: {
|
|
151
|
+
volumePath: {
|
|
152
|
+
type: "string",
|
|
153
|
+
required: true,
|
|
154
|
+
description: "catalog.schema.volume",
|
|
155
|
+
},
|
|
156
|
+
directoryPath: { type: "string", required: true },
|
|
157
|
+
},
|
|
102
158
|
async execute(input, ctx) {
|
|
103
159
|
const { host, token } = getConn(ctx);
|
|
104
160
|
const p = input;
|
|
105
161
|
const [cat, sch, vol] = volumeParts(p.volumePath);
|
|
106
162
|
await api(host, token, "DELETE", `/api/2.0/fs/directories/Volumes/${cat}/${sch}/${vol}/${p.directoryPath}`);
|
|
107
163
|
return { success: true };
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
rl.registerAction("files.deleteFile", {
|
|
167
|
+
description: "Delete a file in a volume",
|
|
168
|
+
inputSchema: {
|
|
169
|
+
volumePath: {
|
|
170
|
+
type: "string",
|
|
171
|
+
required: true,
|
|
172
|
+
description: "catalog.schema.volume",
|
|
173
|
+
},
|
|
174
|
+
filePath: { type: "string", required: true },
|
|
175
|
+
},
|
|
111
176
|
async execute(input, ctx) {
|
|
112
177
|
const { host, token } = getConn(ctx);
|
|
113
178
|
const p = input;
|
|
114
179
|
const [cat, sch, vol] = volumeParts(p.volumePath);
|
|
115
180
|
await api(host, token, "DELETE", `/api/2.0/fs/files/Volumes/${cat}/${sch}/${vol}/${p.filePath}`);
|
|
116
181
|
return { success: true };
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
rl.registerAction("files.getFileInfo", {
|
|
185
|
+
description: "Get file metadata (content-length, type, last-modified)",
|
|
186
|
+
inputSchema: {
|
|
187
|
+
volumePath: {
|
|
188
|
+
type: "string",
|
|
189
|
+
required: true,
|
|
190
|
+
description: "catalog.schema.volume",
|
|
191
|
+
},
|
|
192
|
+
filePath: { type: "string", required: true },
|
|
193
|
+
},
|
|
120
194
|
async execute(input, ctx) {
|
|
121
195
|
const { host, token } = getConn(ctx);
|
|
122
196
|
const p = input;
|
|
123
197
|
const [cat, sch, vol] = volumeParts(p.volumePath);
|
|
124
198
|
const url = `${host}/api/2.0/fs/files/Volumes/${cat}/${sch}/${vol}/${p.filePath}`;
|
|
125
|
-
const res = await fetch(url, {
|
|
199
|
+
const res = await fetch(url, {
|
|
200
|
+
method: "HEAD",
|
|
201
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
202
|
+
});
|
|
126
203
|
if (!res.ok)
|
|
127
204
|
throw new Error(`Databricks error ${res.status}`);
|
|
128
|
-
return {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
205
|
+
return {
|
|
206
|
+
filePath: p.filePath,
|
|
207
|
+
contentLength: res.headers.get("content-length"),
|
|
208
|
+
contentType: res.headers.get("content-type"),
|
|
209
|
+
lastModified: res.headers.get("last-modified"),
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
rl.registerAction("files.listDirectory", {
|
|
214
|
+
description: "List files in a volume directory",
|
|
215
|
+
inputSchema: {
|
|
216
|
+
volumePath: {
|
|
217
|
+
type: "string",
|
|
218
|
+
required: true,
|
|
219
|
+
description: "catalog.schema.volume",
|
|
220
|
+
},
|
|
221
|
+
directoryPath: { type: "string", required: false },
|
|
222
|
+
pageSize: { type: "number", required: false },
|
|
223
|
+
pageToken: { type: "string", required: false },
|
|
224
|
+
},
|
|
132
225
|
async execute(input, ctx) {
|
|
133
226
|
const { host, token } = getConn(ctx);
|
|
134
227
|
const p = input;
|
|
@@ -140,61 +233,108 @@ export default function databricks(rl) {
|
|
|
140
233
|
if (p.pageToken)
|
|
141
234
|
qs.page_token = p.pageToken;
|
|
142
235
|
return api(host, token, "GET", `/api/2.0/fs/directories/Volumes/${cat}/${sch}/${vol}${dir}`, undefined, qs);
|
|
143
|
-
}
|
|
236
|
+
},
|
|
237
|
+
});
|
|
144
238
|
// ── Genie ───────────────────────────────────────────
|
|
145
|
-
rl.registerAction("genie.startConversation", {
|
|
146
|
-
|
|
239
|
+
rl.registerAction("genie.startConversation", {
|
|
240
|
+
description: "Start a new Genie conversation",
|
|
241
|
+
inputSchema: {
|
|
242
|
+
spaceId: { type: "string", required: true },
|
|
243
|
+
initialMessage: { type: "string", required: true },
|
|
244
|
+
},
|
|
147
245
|
async execute(input, ctx) {
|
|
148
246
|
const { host, token } = getConn(ctx);
|
|
149
247
|
const p = input;
|
|
150
248
|
return api(host, token, "POST", `/api/2.0/genie/spaces/${p.spaceId}/start-conversation`, { content: p.initialMessage });
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
rl.registerAction("genie.createMessage", {
|
|
252
|
+
description: "Send a message in an existing Genie conversation",
|
|
253
|
+
inputSchema: {
|
|
254
|
+
spaceId: { type: "string", required: true },
|
|
255
|
+
conversationId: { type: "string", required: true },
|
|
256
|
+
message: { type: "string", required: true },
|
|
257
|
+
},
|
|
154
258
|
async execute(input, ctx) {
|
|
155
259
|
const { host, token } = getConn(ctx);
|
|
156
260
|
const p = input;
|
|
157
261
|
return api(host, token, "POST", `/api/2.0/genie/spaces/${p.spaceId}/conversations/${p.conversationId}/messages`, { content: p.message });
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
rl.registerAction("genie.getMessage", {
|
|
265
|
+
description: "Get a specific message from a conversation",
|
|
266
|
+
inputSchema: {
|
|
267
|
+
spaceId: { type: "string", required: true },
|
|
268
|
+
conversationId: { type: "string", required: true },
|
|
269
|
+
messageId: { type: "string", required: true },
|
|
270
|
+
},
|
|
161
271
|
async execute(input, ctx) {
|
|
162
272
|
const { host, token } = getConn(ctx);
|
|
163
273
|
const p = input;
|
|
164
274
|
return api(host, token, "GET", `/api/2.0/genie/spaces/${p.spaceId}/conversations/${p.conversationId}/messages/${p.messageId}`);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
rl.registerAction("genie.getQueryResults", {
|
|
278
|
+
description: "Get query results from a message attachment",
|
|
279
|
+
inputSchema: {
|
|
280
|
+
spaceId: { type: "string", required: true },
|
|
281
|
+
conversationId: { type: "string", required: true },
|
|
282
|
+
messageId: { type: "string", required: true },
|
|
283
|
+
attachmentId: { type: "string", required: true },
|
|
284
|
+
},
|
|
168
285
|
async execute(input, ctx) {
|
|
169
286
|
const { host, token } = getConn(ctx);
|
|
170
287
|
const p = input;
|
|
171
288
|
return api(host, token, "GET", `/api/2.0/genie/spaces/${p.spaceId}/conversations/${p.conversationId}/messages/${p.messageId}/attachments/${p.attachmentId}/query-result`);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
289
|
+
},
|
|
290
|
+
});
|
|
291
|
+
rl.registerAction("genie.executeMessageQuery", {
|
|
292
|
+
description: "Execute a query from a message attachment",
|
|
293
|
+
inputSchema: {
|
|
294
|
+
spaceId: { type: "string", required: true },
|
|
295
|
+
conversationId: { type: "string", required: true },
|
|
296
|
+
messageId: { type: "string", required: true },
|
|
297
|
+
attachmentId: { type: "string", required: true },
|
|
298
|
+
},
|
|
175
299
|
async execute(input, ctx) {
|
|
176
300
|
const { host, token } = getConn(ctx);
|
|
177
301
|
const p = input;
|
|
178
302
|
return api(host, token, "POST", `/api/2.0/genie/spaces/${p.spaceId}/conversations/${p.conversationId}/messages/${p.messageId}/attachments/${p.attachmentId}/execute-query`);
|
|
179
|
-
}
|
|
180
|
-
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
rl.registerAction("genie.getSpace", {
|
|
306
|
+
description: "Get a Genie space",
|
|
181
307
|
inputSchema: { spaceId: { type: "string", required: true } },
|
|
182
308
|
async execute(input, ctx) {
|
|
183
309
|
const { host, token } = getConn(ctx);
|
|
184
310
|
return api(host, token, "GET", `/api/2.0/genie/spaces/${input.spaceId}`);
|
|
185
|
-
}
|
|
311
|
+
},
|
|
312
|
+
});
|
|
186
313
|
// ── Model Serving ───────────────────────────────────
|
|
187
|
-
rl.registerAction("modelServing.queryEndpoint", {
|
|
188
|
-
|
|
314
|
+
rl.registerAction("modelServing.queryEndpoint", {
|
|
315
|
+
description: "Query a model serving endpoint",
|
|
316
|
+
inputSchema: {
|
|
317
|
+
endpointName: { type: "string", required: true },
|
|
318
|
+
requestBody: {
|
|
319
|
+
type: "object",
|
|
320
|
+
required: true,
|
|
321
|
+
description: "JSON body matching the endpoint schema (chat, completions, embeddings, dataframe, etc.)",
|
|
322
|
+
},
|
|
323
|
+
},
|
|
189
324
|
async execute(input, ctx) {
|
|
190
325
|
const { host, token } = getConn(ctx);
|
|
191
326
|
const p = input;
|
|
192
327
|
const body = p.requestBody;
|
|
193
328
|
return api(host, token, "POST", `/serving-endpoints/${p.endpointName}/invocations`, body);
|
|
194
|
-
}
|
|
329
|
+
},
|
|
330
|
+
});
|
|
195
331
|
// ── Unity Catalog: Catalogs ─────────────────────────
|
|
196
|
-
rl.registerAction("catalog.create", {
|
|
197
|
-
|
|
332
|
+
rl.registerAction("catalog.create", {
|
|
333
|
+
description: "Create a Unity Catalog catalog",
|
|
334
|
+
inputSchema: {
|
|
335
|
+
name: { type: "string", required: true },
|
|
336
|
+
comment: { type: "string", required: false },
|
|
337
|
+
},
|
|
198
338
|
async execute(input, ctx) {
|
|
199
339
|
const { host, token } = getConn(ctx);
|
|
200
340
|
const p = input;
|
|
@@ -202,33 +342,98 @@ export default function databricks(rl) {
|
|
|
202
342
|
if (p.comment)
|
|
203
343
|
body.comment = p.comment;
|
|
204
344
|
return api(host, token, "POST", "/api/2.1/unity-catalog/catalogs", body);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
345
|
+
},
|
|
346
|
+
});
|
|
347
|
+
rl.registerAction("catalog.get", {
|
|
348
|
+
description: "Get a catalog",
|
|
349
|
+
inputSchema: { name: { type: "string", required: true } },
|
|
350
|
+
async execute(input, ctx) {
|
|
351
|
+
const { host, token } = getConn(ctx);
|
|
352
|
+
return api(host, token, "GET", `/api/2.1/unity-catalog/catalogs/${input.name}`);
|
|
353
|
+
},
|
|
354
|
+
});
|
|
355
|
+
rl.registerAction("catalog.list", {
|
|
356
|
+
description: "List all catalogs",
|
|
357
|
+
inputSchema: {},
|
|
358
|
+
async execute(_input, ctx) {
|
|
359
|
+
const { host, token } = getConn(ctx);
|
|
360
|
+
return api(host, token, "GET", "/api/2.1/unity-catalog/catalogs");
|
|
361
|
+
},
|
|
362
|
+
});
|
|
363
|
+
rl.registerAction("catalog.update", {
|
|
364
|
+
description: "Update a catalog's comment",
|
|
365
|
+
inputSchema: {
|
|
366
|
+
name: { type: "string", required: true },
|
|
367
|
+
comment: { type: "string", required: true },
|
|
368
|
+
},
|
|
369
|
+
async execute(input, ctx) {
|
|
370
|
+
const { host, token } = getConn(ctx);
|
|
371
|
+
const p = input;
|
|
372
|
+
return api(host, token, "PATCH", `/api/2.1/unity-catalog/catalogs/${p.name}`, { comment: p.comment });
|
|
373
|
+
},
|
|
374
|
+
});
|
|
375
|
+
rl.registerAction("catalog.delete", {
|
|
376
|
+
description: "Delete a catalog",
|
|
377
|
+
inputSchema: { name: { type: "string", required: true } },
|
|
378
|
+
async execute(input, ctx) {
|
|
379
|
+
const { host, token } = getConn(ctx);
|
|
380
|
+
await api(host, token, "DELETE", `/api/2.1/unity-catalog/catalogs/${input.name}`);
|
|
381
|
+
return { success: true };
|
|
382
|
+
},
|
|
383
|
+
});
|
|
215
384
|
// ── Unity Catalog: Tables ───────────────────────────
|
|
216
|
-
rl.registerAction("table.create", {
|
|
217
|
-
|
|
385
|
+
rl.registerAction("table.create", {
|
|
386
|
+
description: "Create an external Delta table",
|
|
387
|
+
inputSchema: {
|
|
388
|
+
catalogName: { type: "string", required: true },
|
|
389
|
+
schemaName: { type: "string", required: true },
|
|
390
|
+
tableName: { type: "string", required: true },
|
|
391
|
+
storageLocation: { type: "string", required: true },
|
|
392
|
+
columns: {
|
|
393
|
+
type: "object",
|
|
394
|
+
required: false,
|
|
395
|
+
description: "JSON array of column defs",
|
|
396
|
+
},
|
|
397
|
+
comment: { type: "string", required: false },
|
|
398
|
+
},
|
|
218
399
|
async execute(input, ctx) {
|
|
219
400
|
const { host, token } = getConn(ctx);
|
|
220
401
|
const p = input;
|
|
221
|
-
const body = {
|
|
402
|
+
const body = {
|
|
403
|
+
catalog_name: p.catalogName,
|
|
404
|
+
schema_name: p.schemaName,
|
|
405
|
+
name: p.tableName,
|
|
406
|
+
table_type: "EXTERNAL",
|
|
407
|
+
data_source_format: "DELTA",
|
|
408
|
+
storage_location: p.storageLocation,
|
|
409
|
+
};
|
|
222
410
|
if (p.columns)
|
|
223
411
|
body.columns = p.columns;
|
|
224
412
|
if (p.comment)
|
|
225
413
|
body.comment = p.comment;
|
|
226
414
|
return api(host, token, "POST", "/api/2.1/unity-catalog/tables", body);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
inputSchema: {
|
|
415
|
+
},
|
|
416
|
+
});
|
|
417
|
+
rl.registerAction("table.get", {
|
|
418
|
+
description: "Get table info",
|
|
419
|
+
inputSchema: {
|
|
420
|
+
fullName: {
|
|
421
|
+
type: "string",
|
|
422
|
+
required: true,
|
|
423
|
+
description: "catalog.schema.table",
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
async execute(input, ctx) {
|
|
427
|
+
const { host, token } = getConn(ctx);
|
|
428
|
+
return api(host, token, "GET", `/api/2.1/unity-catalog/tables/${input.fullName}`);
|
|
429
|
+
},
|
|
430
|
+
});
|
|
431
|
+
rl.registerAction("table.list", {
|
|
432
|
+
description: "List tables",
|
|
433
|
+
inputSchema: {
|
|
434
|
+
catalogName: { type: "string", required: false },
|
|
435
|
+
schemaName: { type: "string", required: false },
|
|
436
|
+
},
|
|
232
437
|
async execute(input, ctx) {
|
|
233
438
|
const { host, token } = getConn(ctx);
|
|
234
439
|
const p = (input ?? {});
|
|
@@ -238,29 +443,79 @@ export default function databricks(rl) {
|
|
|
238
443
|
if (p.schemaName)
|
|
239
444
|
qs.schema_name = p.schemaName;
|
|
240
445
|
return api(host, token, "GET", "/api/2.1/unity-catalog/tables", undefined, qs);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
|
|
446
|
+
},
|
|
447
|
+
});
|
|
448
|
+
rl.registerAction("table.delete", {
|
|
449
|
+
description: "Delete a table",
|
|
450
|
+
inputSchema: {
|
|
451
|
+
fullName: {
|
|
452
|
+
type: "string",
|
|
453
|
+
required: true,
|
|
454
|
+
description: "catalog.schema.table",
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
async execute(input, ctx) {
|
|
458
|
+
const { host, token } = getConn(ctx);
|
|
459
|
+
await api(host, token, "DELETE", `/api/2.1/unity-catalog/tables/${input.fullName}`);
|
|
460
|
+
return { success: true };
|
|
461
|
+
},
|
|
462
|
+
});
|
|
244
463
|
// ── Unity Catalog: Volumes ──────────────────────────
|
|
245
|
-
rl.registerAction("volume.create", {
|
|
246
|
-
|
|
464
|
+
rl.registerAction("volume.create", {
|
|
465
|
+
description: "Create a Unity Catalog volume",
|
|
466
|
+
inputSchema: {
|
|
467
|
+
catalogName: { type: "string", required: true },
|
|
468
|
+
schemaName: { type: "string", required: true },
|
|
469
|
+
volumeName: { type: "string", required: true },
|
|
470
|
+
volumeType: {
|
|
471
|
+
type: "string",
|
|
472
|
+
required: true,
|
|
473
|
+
description: "MANAGED or EXTERNAL",
|
|
474
|
+
},
|
|
475
|
+
storageLocation: {
|
|
476
|
+
type: "string",
|
|
477
|
+
required: false,
|
|
478
|
+
description: "Required for EXTERNAL volumes",
|
|
479
|
+
},
|
|
480
|
+
comment: { type: "string", required: false },
|
|
481
|
+
},
|
|
247
482
|
async execute(input, ctx) {
|
|
248
483
|
const { host, token } = getConn(ctx);
|
|
249
484
|
const p = input;
|
|
250
485
|
if (p.volumeType === "EXTERNAL" && !p.storageLocation)
|
|
251
486
|
throw new Error("storageLocation required for EXTERNAL volumes");
|
|
252
|
-
const body = {
|
|
487
|
+
const body = {
|
|
488
|
+
catalog_name: p.catalogName,
|
|
489
|
+
schema_name: p.schemaName,
|
|
490
|
+
name: p.volumeName,
|
|
491
|
+
volume_type: p.volumeType,
|
|
492
|
+
};
|
|
253
493
|
if (p.storageLocation)
|
|
254
494
|
body.storage_location = p.storageLocation;
|
|
255
495
|
if (p.comment)
|
|
256
496
|
body.comment = p.comment;
|
|
257
497
|
return api(host, token, "POST", "/api/2.1/unity-catalog/volumes", body);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
498
|
+
},
|
|
499
|
+
});
|
|
500
|
+
rl.registerAction("volume.get", {
|
|
501
|
+
description: "Get a volume",
|
|
502
|
+
inputSchema: {
|
|
503
|
+
catalogName: { type: "string", required: true },
|
|
504
|
+
schemaName: { type: "string", required: true },
|
|
505
|
+
volumeName: { type: "string", required: true },
|
|
506
|
+
},
|
|
507
|
+
async execute(input, ctx) {
|
|
508
|
+
const { host, token } = getConn(ctx);
|
|
509
|
+
const p = input;
|
|
510
|
+
return api(host, token, "GET", `/api/2.1/unity-catalog/volumes/${p.catalogName}.${p.schemaName}.${p.volumeName}`);
|
|
511
|
+
},
|
|
512
|
+
});
|
|
513
|
+
rl.registerAction("volume.list", {
|
|
514
|
+
description: "List volumes",
|
|
515
|
+
inputSchema: {
|
|
516
|
+
catalogName: { type: "string", required: false },
|
|
517
|
+
schemaName: { type: "string", required: false },
|
|
518
|
+
},
|
|
264
519
|
async execute(input, ctx) {
|
|
265
520
|
const { host, token } = getConn(ctx);
|
|
266
521
|
const p = (input ?? {});
|
|
@@ -270,26 +525,101 @@ export default function databricks(rl) {
|
|
|
270
525
|
if (p.schemaName)
|
|
271
526
|
qs.schema_name = p.schemaName;
|
|
272
527
|
return api(host, token, "GET", "/api/2.1/unity-catalog/volumes", undefined, qs);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
528
|
+
},
|
|
529
|
+
});
|
|
530
|
+
rl.registerAction("volume.delete", {
|
|
531
|
+
description: "Delete a volume",
|
|
532
|
+
inputSchema: {
|
|
533
|
+
catalogName: { type: "string", required: true },
|
|
534
|
+
schemaName: { type: "string", required: true },
|
|
535
|
+
volumeName: { type: "string", required: true },
|
|
536
|
+
},
|
|
537
|
+
async execute(input, ctx) {
|
|
538
|
+
const { host, token } = getConn(ctx);
|
|
539
|
+
const p = input;
|
|
540
|
+
await api(host, token, "DELETE", `/api/2.1/unity-catalog/volumes/${p.catalogName}.${p.schemaName}.${p.volumeName}`);
|
|
541
|
+
return { success: true };
|
|
542
|
+
},
|
|
543
|
+
});
|
|
277
544
|
// ── Unity Catalog: Functions ────────────────────────
|
|
278
|
-
rl.registerAction("function.create", {
|
|
279
|
-
|
|
545
|
+
rl.registerAction("function.create", {
|
|
546
|
+
description: "Create a Unity Catalog function",
|
|
547
|
+
inputSchema: {
|
|
548
|
+
catalogName: { type: "string", required: true },
|
|
549
|
+
schemaName: { type: "string", required: true },
|
|
550
|
+
functionName: { type: "string", required: true },
|
|
551
|
+
inputParams: {
|
|
552
|
+
type: "object",
|
|
553
|
+
required: true,
|
|
554
|
+
description: "Array of {name, type_name, type_text?} parameter definitions",
|
|
555
|
+
},
|
|
556
|
+
returnType: {
|
|
557
|
+
type: "string",
|
|
558
|
+
required: true,
|
|
559
|
+
description: "e.g. STRING, INT",
|
|
560
|
+
},
|
|
561
|
+
routineBody: {
|
|
562
|
+
type: "string",
|
|
563
|
+
required: true,
|
|
564
|
+
description: "SQL or EXTERNAL",
|
|
565
|
+
},
|
|
566
|
+
routineDefinition: {
|
|
567
|
+
type: "string",
|
|
568
|
+
required: true,
|
|
569
|
+
description: "The function body",
|
|
570
|
+
},
|
|
571
|
+
},
|
|
280
572
|
async execute(input, ctx) {
|
|
281
573
|
const { host, token } = getConn(ctx);
|
|
282
574
|
const p = input;
|
|
283
|
-
const params = (Array.isArray(p.inputParams)
|
|
284
|
-
|
|
575
|
+
const params = (Array.isArray(p.inputParams)
|
|
576
|
+
? p.inputParams
|
|
577
|
+
: (p.inputParams?.parameters ?? []));
|
|
578
|
+
const normalizedParams = params.map((param) => ({
|
|
579
|
+
...param,
|
|
580
|
+
type_text: param.type_text ?? param.type_name,
|
|
581
|
+
type_json: param.type_json ?? JSON.stringify({ name: param.type_name }),
|
|
582
|
+
}));
|
|
285
583
|
return api(host, token, "POST", "/api/2.1/unity-catalog/functions", {
|
|
286
|
-
function_info: {
|
|
584
|
+
function_info: {
|
|
585
|
+
name: p.functionName,
|
|
586
|
+
catalog_name: p.catalogName,
|
|
587
|
+
schema_name: p.schemaName,
|
|
588
|
+
input_params: { parameters: normalizedParams },
|
|
589
|
+
data_type: p.returnType,
|
|
590
|
+
full_data_type: p.returnType,
|
|
591
|
+
specific_name: p.functionName,
|
|
592
|
+
parameter_style: "S",
|
|
593
|
+
security_type: "DEFINER",
|
|
594
|
+
sql_data_access: "CONTAINS_SQL",
|
|
595
|
+
is_deterministic: false,
|
|
596
|
+
is_null_call: true,
|
|
597
|
+
routine_body: p.routineBody,
|
|
598
|
+
routine_definition: p.routineDefinition,
|
|
599
|
+
},
|
|
287
600
|
});
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
inputSchema: {
|
|
601
|
+
},
|
|
602
|
+
});
|
|
603
|
+
rl.registerAction("function.get", {
|
|
604
|
+
description: "Get a function",
|
|
605
|
+
inputSchema: {
|
|
606
|
+
fullName: {
|
|
607
|
+
type: "string",
|
|
608
|
+
required: true,
|
|
609
|
+
description: "catalog.schema.function_name",
|
|
610
|
+
},
|
|
611
|
+
},
|
|
612
|
+
async execute(input, ctx) {
|
|
613
|
+
const { host, token } = getConn(ctx);
|
|
614
|
+
return api(host, token, "GET", `/api/2.1/unity-catalog/functions/${input.fullName}`);
|
|
615
|
+
},
|
|
616
|
+
});
|
|
617
|
+
rl.registerAction("function.list", {
|
|
618
|
+
description: "List functions",
|
|
619
|
+
inputSchema: {
|
|
620
|
+
catalogName: { type: "string", required: false },
|
|
621
|
+
schemaName: { type: "string", required: false },
|
|
622
|
+
},
|
|
293
623
|
async execute(input, ctx) {
|
|
294
624
|
const { host, token } = getConn(ctx);
|
|
295
625
|
const p = (input ?? {});
|
|
@@ -299,44 +629,148 @@ export default function databricks(rl) {
|
|
|
299
629
|
if (p.schemaName)
|
|
300
630
|
qs.schema_name = p.schemaName;
|
|
301
631
|
return api(host, token, "GET", "/api/2.1/unity-catalog/functions", undefined, qs);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
632
|
+
},
|
|
633
|
+
});
|
|
634
|
+
rl.registerAction("function.delete", {
|
|
635
|
+
description: "Delete a function",
|
|
636
|
+
inputSchema: {
|
|
637
|
+
fullName: {
|
|
638
|
+
type: "string",
|
|
639
|
+
required: true,
|
|
640
|
+
description: "catalog.schema.function_name",
|
|
641
|
+
},
|
|
642
|
+
},
|
|
643
|
+
async execute(input, ctx) {
|
|
644
|
+
const { host, token } = getConn(ctx);
|
|
645
|
+
await api(host, token, "DELETE", `/api/2.1/unity-catalog/functions/${input.fullName}`);
|
|
646
|
+
return { success: true };
|
|
647
|
+
},
|
|
648
|
+
});
|
|
305
649
|
// ── Vector Search ───────────────────────────────────
|
|
306
|
-
rl.registerAction("vectorSearch.createIndex", {
|
|
307
|
-
|
|
650
|
+
rl.registerAction("vectorSearch.createIndex", {
|
|
651
|
+
description: "Create a vector search index",
|
|
652
|
+
inputSchema: {
|
|
653
|
+
indexName: { type: "string", required: true },
|
|
654
|
+
endpointName: { type: "string", required: true },
|
|
655
|
+
primaryKey: { type: "string", required: true },
|
|
656
|
+
indexType: {
|
|
657
|
+
type: "string",
|
|
658
|
+
required: true,
|
|
659
|
+
description: "DELTA_SYNC or DIRECT_ACCESS",
|
|
660
|
+
},
|
|
661
|
+
deltaSyncIndexSpec: {
|
|
662
|
+
type: "object",
|
|
663
|
+
required: false,
|
|
664
|
+
description: "Spec for DELTA_SYNC type",
|
|
665
|
+
},
|
|
666
|
+
directAccessIndexSpec: {
|
|
667
|
+
type: "object",
|
|
668
|
+
required: false,
|
|
669
|
+
description: "Spec for DIRECT_ACCESS type",
|
|
670
|
+
},
|
|
671
|
+
},
|
|
308
672
|
async execute(input, ctx) {
|
|
309
673
|
const { host, token } = getConn(ctx);
|
|
310
674
|
const p = input;
|
|
311
|
-
const body = {
|
|
675
|
+
const body = {
|
|
676
|
+
name: p.indexName,
|
|
677
|
+
endpoint_name: p.endpointName,
|
|
678
|
+
primary_key: p.primaryKey,
|
|
679
|
+
index_type: p.indexType,
|
|
680
|
+
};
|
|
312
681
|
if (p.indexType === "DELTA_SYNC" && p.deltaSyncIndexSpec)
|
|
313
682
|
body.delta_sync_index_spec = p.deltaSyncIndexSpec;
|
|
314
683
|
if (p.indexType === "DIRECT_ACCESS" && p.directAccessIndexSpec)
|
|
315
684
|
body.direct_access_index_spec = p.directAccessIndexSpec;
|
|
316
685
|
return api(host, token, "POST", "/api/2.0/vector-search/indexes", body);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
686
|
+
},
|
|
687
|
+
});
|
|
688
|
+
rl.registerAction("vectorSearch.getIndex", {
|
|
689
|
+
description: "Get a vector search index",
|
|
690
|
+
inputSchema: { indexName: { type: "string", required: true } },
|
|
691
|
+
async execute(input, ctx) {
|
|
692
|
+
const { host, token } = getConn(ctx);
|
|
693
|
+
return api(host, token, "GET", `/api/2.0/vector-search/indexes/${input.indexName}`);
|
|
694
|
+
},
|
|
695
|
+
});
|
|
696
|
+
rl.registerAction("vectorSearch.listIndexes", {
|
|
697
|
+
description: "List vector search indexes for an endpoint",
|
|
698
|
+
inputSchema: { endpointName: { type: "string", required: true } },
|
|
699
|
+
async execute(input, ctx) {
|
|
700
|
+
const { host, token } = getConn(ctx);
|
|
701
|
+
return api(host, token, "GET", "/api/2.0/vector-search/indexes", undefined, {
|
|
702
|
+
endpoint_name: input
|
|
703
|
+
.endpointName,
|
|
704
|
+
});
|
|
705
|
+
},
|
|
706
|
+
});
|
|
707
|
+
rl.registerAction("vectorSearch.queryIndex", {
|
|
708
|
+
description: "Query a vector search index",
|
|
709
|
+
inputSchema: {
|
|
710
|
+
indexName: { type: "string", required: true },
|
|
711
|
+
queryType: {
|
|
712
|
+
type: "string",
|
|
713
|
+
required: true,
|
|
714
|
+
description: "text or vector",
|
|
715
|
+
},
|
|
716
|
+
queryText: {
|
|
717
|
+
type: "string",
|
|
718
|
+
required: false,
|
|
719
|
+
description: "For text queries",
|
|
720
|
+
},
|
|
721
|
+
queryVector: {
|
|
722
|
+
type: "object",
|
|
723
|
+
required: false,
|
|
724
|
+
description: "For vector queries — array of numbers",
|
|
725
|
+
},
|
|
726
|
+
numResults: { type: "number", required: false },
|
|
727
|
+
columns: {
|
|
728
|
+
type: "string",
|
|
729
|
+
required: true,
|
|
730
|
+
description: "Comma-separated column names to return",
|
|
731
|
+
},
|
|
732
|
+
searchMode: {
|
|
733
|
+
type: "string",
|
|
734
|
+
required: false,
|
|
735
|
+
description: "HYBRID (default), ANN, or EXACT",
|
|
736
|
+
},
|
|
737
|
+
filterExpression: { type: "string", required: false },
|
|
738
|
+
scoreThreshold: { type: "number", required: false },
|
|
739
|
+
enableReranking: { type: "boolean", required: false },
|
|
740
|
+
rerankerModel: { type: "string", required: false },
|
|
741
|
+
columnsToRerank: { type: "string", required: false },
|
|
742
|
+
},
|
|
324
743
|
async execute(input, ctx) {
|
|
325
744
|
const { host, token } = getConn(ctx);
|
|
326
745
|
const p = input;
|
|
327
|
-
const body = {
|
|
746
|
+
const body = {
|
|
747
|
+
num_results: p.numResults ?? 10,
|
|
748
|
+
query_type: p.searchMode ?? "HYBRID",
|
|
749
|
+
};
|
|
328
750
|
if (p.queryType === "text")
|
|
329
751
|
body.query_text = p.queryText;
|
|
330
752
|
else
|
|
331
753
|
body.query_vector = p.queryVector;
|
|
332
|
-
body.columns = p.columns
|
|
754
|
+
body.columns = p.columns
|
|
755
|
+
.split(",")
|
|
756
|
+
.map((c) => c.trim())
|
|
757
|
+
.filter(Boolean);
|
|
333
758
|
if (p.filterExpression)
|
|
334
759
|
body.filters_json = p.filterExpression;
|
|
335
760
|
if (p.scoreThreshold)
|
|
336
761
|
body.score_threshold = p.scoreThreshold;
|
|
337
762
|
if (p.enableReranking) {
|
|
338
|
-
body.reranker = {
|
|
763
|
+
body.reranker = {
|
|
764
|
+
model: p.rerankerModel ?? "databricks_reranker",
|
|
765
|
+
parameters: {
|
|
766
|
+
columns_to_rerank: (p.columnsToRerank || "")
|
|
767
|
+
.split(",")
|
|
768
|
+
.map((c) => c.trim())
|
|
769
|
+
.filter(Boolean),
|
|
770
|
+
},
|
|
771
|
+
};
|
|
339
772
|
}
|
|
340
773
|
return api(host, token, "POST", `/api/2.0/vector-search/indexes/${p.indexName}/query`, body);
|
|
341
|
-
}
|
|
774
|
+
},
|
|
775
|
+
});
|
|
342
776
|
}
|