@ubiquity-os/plugin-sdk 3.8.0 → 3.8.1
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 +43 -27
- package/dist/configuration.d.mts +3 -3
- package/dist/configuration.d.ts +3 -3
- package/dist/configuration.js +12 -2632
- package/dist/configuration.mjs +2 -2632
- package/dist/{context-zLHgu52i.d.ts → context-BE4WjJZf.d.ts} +0 -28
- package/dist/{context-Dwl3aRX-.d.mts → context-Ckj1HMjz.d.mts} +0 -28
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +127 -2857
- package/dist/index.mjs +93 -2823
- package/dist/llm.d.mts +2 -2
- package/dist/llm.d.ts +2 -2
- package/dist/llm.js +11 -0
- package/dist/llm.mjs +11 -0
- package/dist/octokit.d.mts +2 -2
- package/dist/octokit.d.ts +2 -2
- package/dist/octokit.js +2 -164
- package/dist/octokit.mjs +1 -163
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -15,10 +15,16 @@ The `createActionsPlugin` function allows users to create plugins that will be a
|
|
|
15
15
|
|
|
16
16
|
### `createPlugin`
|
|
17
17
|
|
|
18
|
-
The `createPlugin` function enables users to create a plugin that will run on Cloudflare Workers environment.
|
|
18
|
+
The `createPlugin` function enables users to create a plugin that will run on Cloudflare Workers environment. It accepts a handler and a manifest.
|
|
19
19
|
|
|
20
20
|
### `postComment`
|
|
21
21
|
|
|
22
|
+
Use `context.commentHandler.postComment` to write or update a comment on the triggering issue or pull request.
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
await context.commentHandler.postComment(context, context.logger.ok("Done"));
|
|
26
|
+
```
|
|
27
|
+
|
|
22
28
|
### `callLlm`
|
|
23
29
|
|
|
24
30
|
The `callLlm` function allows plugins to securely call the ai.ubq.fi LLM endpoint using inherited GitHub authentication.
|
|
@@ -26,33 +32,43 @@ The `callLlm` function allows plugins to securely call the ai.ubq.fi LLM endpoin
|
|
|
26
32
|
#### Usage
|
|
27
33
|
|
|
28
34
|
```typescript
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
import { createPlugin, callLlm, type Manifest } from '@ubiquity-os/plugin-sdk';
|
|
36
|
+
|
|
37
|
+
const manifest: Manifest = {
|
|
38
|
+
name: "llm-plugin",
|
|
39
|
+
short_name: "llm",
|
|
40
|
+
description: "LLM demo",
|
|
41
|
+
commands: {
|
|
42
|
+
llm: {
|
|
43
|
+
description: "Query the LLM",
|
|
44
|
+
"ubiquity:example": "/llm hello",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default createPlugin(async (context) => {
|
|
50
|
+
// Non-streaming: resolves to ChatCompletion.
|
|
51
|
+
const result = await callLlm(
|
|
52
|
+
{
|
|
53
|
+
messages: [{ role: "user", content: "Hello, world!" }],
|
|
54
|
+
},
|
|
55
|
+
context
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// Streaming: returns AsyncIterable<ChatCompletionChunk>.
|
|
59
|
+
const stream = await callLlm(
|
|
60
|
+
{
|
|
61
|
+
messages: [{ role: "user", content: "Hello, world!" }],
|
|
62
|
+
stream: true,
|
|
63
|
+
},
|
|
64
|
+
context
|
|
65
|
+
);
|
|
66
|
+
for await (const chunk of stream) {
|
|
67
|
+
const delta = chunk.choices?.[0]?.delta?.content ?? "";
|
|
68
|
+
// handle delta
|
|
54
69
|
}
|
|
55
|
-
}
|
|
70
|
+
return { success: true };
|
|
71
|
+
}, manifest);
|
|
56
72
|
```
|
|
57
73
|
|
|
58
74
|
Automatically extracts `authToken`, `owner`, `repo` from input and passes to ai.ubq.fi with proper headers for secure, repo-scoped access.
|
package/dist/configuration.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { Value } from '@sinclair/typebox/value';
|
|
|
2
2
|
import YAML from 'js-yaml';
|
|
3
3
|
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
4
4
|
import { StaticDecode, TLiteral } from '@sinclair/typebox';
|
|
5
|
-
import { C as Context } from './context-
|
|
5
|
+
import { C as Context } from './context-Ckj1HMjz.mjs';
|
|
6
6
|
import { Manifest } from './manifest.mjs';
|
|
7
7
|
import '@octokit/webhooks';
|
|
8
8
|
import '@ubiquity-os/ubiquity-os-logger';
|
|
@@ -11,7 +11,7 @@ import './octokit.mjs';
|
|
|
11
11
|
import '@octokit/core/types';
|
|
12
12
|
import '@octokit/plugin-paginate-graphql';
|
|
13
13
|
import '@octokit/plugin-paginate-rest';
|
|
14
|
-
import '@octokit/request-error';
|
|
14
|
+
import '@octokit/webhooks/node_modules/@octokit/request-error';
|
|
15
15
|
import '@octokit/core';
|
|
16
16
|
|
|
17
17
|
type GithubPlugin = {
|
|
@@ -125,8 +125,8 @@ declare class ConfigurationHandler {
|
|
|
125
125
|
private _parseYaml;
|
|
126
126
|
protected mergeConfigurations(configuration1: PluginConfiguration, configuration2: PluginConfiguration): PluginConfiguration;
|
|
127
127
|
getManifest(plugin: GithubPlugin): Promise<{
|
|
128
|
-
description?: string | undefined;
|
|
129
128
|
skipBotEvents?: boolean | undefined;
|
|
129
|
+
description?: string | undefined;
|
|
130
130
|
commands?: {
|
|
131
131
|
[x: string]: {
|
|
132
132
|
parameters?: {
|
package/dist/configuration.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Value } from '@sinclair/typebox/value';
|
|
|
2
2
|
import YAML from 'js-yaml';
|
|
3
3
|
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
4
4
|
import { StaticDecode, TLiteral } from '@sinclair/typebox';
|
|
5
|
-
import { C as Context } from './context-
|
|
5
|
+
import { C as Context } from './context-BE4WjJZf.js';
|
|
6
6
|
import { Manifest } from './manifest.js';
|
|
7
7
|
import '@octokit/webhooks';
|
|
8
8
|
import '@ubiquity-os/ubiquity-os-logger';
|
|
@@ -11,7 +11,7 @@ import './octokit.js';
|
|
|
11
11
|
import '@octokit/core/types';
|
|
12
12
|
import '@octokit/plugin-paginate-graphql';
|
|
13
13
|
import '@octokit/plugin-paginate-rest';
|
|
14
|
-
import '@octokit/request-error';
|
|
14
|
+
import '@octokit/webhooks/node_modules/@octokit/request-error';
|
|
15
15
|
import '@octokit/core';
|
|
16
16
|
|
|
17
17
|
type GithubPlugin = {
|
|
@@ -125,8 +125,8 @@ declare class ConfigurationHandler {
|
|
|
125
125
|
private _parseYaml;
|
|
126
126
|
protected mergeConfigurations(configuration1: PluginConfiguration, configuration2: PluginConfiguration): PluginConfiguration;
|
|
127
127
|
getManifest(plugin: GithubPlugin): Promise<{
|
|
128
|
-
description?: string | undefined;
|
|
129
128
|
skipBotEvents?: boolean | undefined;
|
|
129
|
+
description?: string | undefined;
|
|
130
130
|
commands?: {
|
|
131
131
|
[x: string]: {
|
|
132
132
|
parameters?: {
|