@sweetoburrito/backstage-plugin-ai-assistant-backend-module-tool-provider-backstage 0.2.2 → 0.4.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/module.cjs.js +5 -1
- package/dist/module.cjs.js.map +1 -1
- package/package.json +2 -2
package/dist/module.cjs.js
CHANGED
|
@@ -26,6 +26,7 @@ const aiAssistantModuleToolProviderBackstage = backendPluginApi.createBackendMod
|
|
|
26
26
|
name: action.name,
|
|
27
27
|
description: action.description,
|
|
28
28
|
schema: jsonSchemaToZod.jsonSchemaToZod(action.schema.input),
|
|
29
|
+
provider: "backstage",
|
|
29
30
|
func: async (params) => {
|
|
30
31
|
const callCredentials = await auth.getOwnServiceCredentials();
|
|
31
32
|
const { output } = await actionsService.invoke({
|
|
@@ -33,7 +34,10 @@ const aiAssistantModuleToolProviderBackstage = backendPluginApi.createBackendMod
|
|
|
33
34
|
credentials: callCredentials,
|
|
34
35
|
input: params
|
|
35
36
|
});
|
|
36
|
-
|
|
37
|
+
const content = JSON.stringify(output);
|
|
38
|
+
return {
|
|
39
|
+
content
|
|
40
|
+
};
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
});
|
package/dist/module.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["import {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport type { JsonObject } from '@backstage/types';\nimport { actionsServiceRef } from '@backstage/backend-plugin-api/alpha';\nimport {\n toolExtensionPoint,\n createAssistantTool,\n} from '@sweetoburrito/backstage-plugin-ai-assistant-node';\nimport { jsonSchemaToZod } from '@n8n/json-schema-to-zod';\n\nexport const aiAssistantModuleToolProviderBackstage = createBackendModule({\n pluginId: 'ai-assistant',\n moduleId: 'tool-provider-backstage',\n register(reg) {\n reg.registerInit({\n deps: {\n actionsService: actionsServiceRef,\n auth: coreServices.auth,\n toolExtension: toolExtensionPoint,\n },\n async init({ actionsService, auth, toolExtension }) {\n const credentials = await auth.getOwnServiceCredentials();\n\n const { actions } = await actionsService.list({\n credentials,\n });\n\n actions.forEach(action => {\n const tool = createAssistantTool({\n tool: {\n name: action.name,\n description: action.description,\n schema: jsonSchemaToZod(action.schema.input),\n func: async params => {\n const callCredentials = await auth.getOwnServiceCredentials();\n\n const { output } = await actionsService.invoke({\n id: action.id,\n credentials: callCredentials,\n input: params as JsonObject,\n });\n\n
|
|
1
|
+
{"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["import {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport type { JsonObject } from '@backstage/types';\nimport { actionsServiceRef } from '@backstage/backend-plugin-api/alpha';\nimport {\n toolExtensionPoint,\n createAssistantTool,\n} from '@sweetoburrito/backstage-plugin-ai-assistant-node';\nimport { jsonSchemaToZod } from '@n8n/json-schema-to-zod';\n\nexport const aiAssistantModuleToolProviderBackstage = createBackendModule({\n pluginId: 'ai-assistant',\n moduleId: 'tool-provider-backstage',\n register(reg) {\n reg.registerInit({\n deps: {\n actionsService: actionsServiceRef,\n auth: coreServices.auth,\n toolExtension: toolExtensionPoint,\n },\n async init({ actionsService, auth, toolExtension }) {\n const credentials = await auth.getOwnServiceCredentials();\n\n const { actions } = await actionsService.list({\n credentials,\n });\n\n actions.forEach(action => {\n const tool = createAssistantTool({\n tool: {\n name: action.name,\n description: action.description,\n schema: jsonSchemaToZod(action.schema.input),\n provider: 'backstage',\n func: async params => {\n const callCredentials = await auth.getOwnServiceCredentials();\n\n const { output } = await actionsService.invoke({\n id: action.id,\n credentials: callCredentials,\n input: params as JsonObject,\n });\n\n const content = JSON.stringify(output);\n\n return {\n content,\n };\n },\n },\n });\n toolExtension.register(tool);\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","actionsServiceRef","coreServices","toolExtensionPoint","createAssistantTool","jsonSchemaToZod"],"mappings":";;;;;;;AAYO,MA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AAA;AACD,UAAA,aAAA,CAAc,SAAS,IAAI,CAAA;AAAA,QAC7B,CAAC,CAAA;AAAA,MACH;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sweetoburrito/backstage-plugin-ai-assistant-backend-module-tool-provider-backstage",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "The tool-provider-backstage backend module for the ai-assistant plugin.",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@backstage/backend-plugin-api": "^1.4.3",
|
|
32
32
|
"@n8n/json-schema-to-zod": "1.1.0",
|
|
33
|
-
"@sweetoburrito/backstage-plugin-ai-assistant-node": "^0.
|
|
33
|
+
"@sweetoburrito/backstage-plugin-ai-assistant-node": "^0.8.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@backstage/backend-test-utils": "^1.9.0",
|