@ubiquity-os/plugin-sdk 3.4.6 → 3.5.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/compression.js +1 -1
- package/dist/compression.mjs +1 -1
- package/dist/configuration.d.mts +121 -0
- package/dist/configuration.d.ts +121 -0
- package/dist/configuration.js +338 -0
- package/dist/configuration.mjs +300 -0
- package/dist/context-3Ck9sBZI.d.mts +107 -0
- package/dist/context-DOUnUNNN.d.ts +107 -0
- package/dist/index.d.mts +7 -106
- package/dist/index.d.ts +7 -106
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/manifest.d.mts +1 -0
- package/dist/manifest.d.ts +1 -0
- package/dist/manifest.js +1 -0
- package/dist/manifest.mjs +1 -0
- package/dist/signature.js +1 -1
- package/dist/signature.mjs +1 -1
- package/package.json +12 -2
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { EmitterWebhookEventName, EmitterWebhookEvent } from '@octokit/webhooks';
|
|
2
|
+
import * as _ubiquity_os_ubiquity_os_logger from '@ubiquity-os/ubiquity-os-logger';
|
|
3
|
+
import { LogReturn, Metadata, Logs } from '@ubiquity-os/ubiquity-os-logger';
|
|
4
|
+
import { RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods';
|
|
5
|
+
import { customOctokit } from './octokit.mjs';
|
|
6
|
+
|
|
7
|
+
interface CommentOptions {
|
|
8
|
+
raw?: boolean;
|
|
9
|
+
updateComment?: boolean;
|
|
10
|
+
}
|
|
11
|
+
type PostedGithubComment = RestEndpointMethodTypes["issues"]["updateComment"]["response"]["data"] | RestEndpointMethodTypes["issues"]["createComment"]["response"]["data"] | RestEndpointMethodTypes["pulls"]["createReplyForReviewComment"]["response"]["data"];
|
|
12
|
+
type WithIssueNumber<T> = T & {
|
|
13
|
+
issueNumber: number;
|
|
14
|
+
};
|
|
15
|
+
interface IssueContext {
|
|
16
|
+
issueNumber: number;
|
|
17
|
+
commentId?: number;
|
|
18
|
+
owner: string;
|
|
19
|
+
repo: string;
|
|
20
|
+
}
|
|
21
|
+
declare class CommentHandler {
|
|
22
|
+
static readonly HEADER_NAME = "UbiquityOS";
|
|
23
|
+
private _lastCommentId;
|
|
24
|
+
_updateIssueComment(context: Context, params: {
|
|
25
|
+
owner: string;
|
|
26
|
+
repo: string;
|
|
27
|
+
body: string;
|
|
28
|
+
issueNumber: number;
|
|
29
|
+
}): Promise<WithIssueNumber<PostedGithubComment>>;
|
|
30
|
+
_updateReviewComment(context: Context, params: {
|
|
31
|
+
owner: string;
|
|
32
|
+
repo: string;
|
|
33
|
+
body: string;
|
|
34
|
+
issueNumber: number;
|
|
35
|
+
}): Promise<WithIssueNumber<PostedGithubComment>>;
|
|
36
|
+
_createNewComment(context: Context, params: {
|
|
37
|
+
owner: string;
|
|
38
|
+
repo: string;
|
|
39
|
+
body: string;
|
|
40
|
+
issueNumber: number;
|
|
41
|
+
commentId?: number;
|
|
42
|
+
}): Promise<WithIssueNumber<PostedGithubComment>>;
|
|
43
|
+
_getIssueNumber(context: Context): number | undefined;
|
|
44
|
+
_getCommentId(context: Context): number | undefined;
|
|
45
|
+
_extractIssueContext(context: Context): IssueContext | null;
|
|
46
|
+
_processMessage(context: Context, message: LogReturn | Error): {
|
|
47
|
+
metadata: {
|
|
48
|
+
message: string;
|
|
49
|
+
name: string;
|
|
50
|
+
stack: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
logMessage: {
|
|
53
|
+
raw: string;
|
|
54
|
+
diff: string;
|
|
55
|
+
level: _ubiquity_os_ubiquity_os_logger.LogLevel;
|
|
56
|
+
type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
|
|
57
|
+
};
|
|
58
|
+
} | {
|
|
59
|
+
metadata: {
|
|
60
|
+
message: string | undefined;
|
|
61
|
+
stack: string | string[] | undefined;
|
|
62
|
+
caller: {} | undefined;
|
|
63
|
+
error?: Error | {
|
|
64
|
+
stack: string;
|
|
65
|
+
} | undefined;
|
|
66
|
+
name?: string | undefined;
|
|
67
|
+
} | {
|
|
68
|
+
logMessage: {
|
|
69
|
+
raw: string;
|
|
70
|
+
diff: string;
|
|
71
|
+
level: _ubiquity_os_ubiquity_os_logger.LogLevel;
|
|
72
|
+
type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
|
|
73
|
+
};
|
|
74
|
+
metadata?: Metadata;
|
|
75
|
+
};
|
|
76
|
+
logMessage: {
|
|
77
|
+
raw: string;
|
|
78
|
+
diff: string;
|
|
79
|
+
level: _ubiquity_os_ubiquity_os_logger.LogLevel;
|
|
80
|
+
type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
_getInstigatorName(context: Context): string;
|
|
84
|
+
_createMetadataContent(context: Context, metadata: Metadata): {
|
|
85
|
+
header: string;
|
|
86
|
+
jsonPretty: string;
|
|
87
|
+
};
|
|
88
|
+
_formatMetadataContent(logMessage: LogReturn["logMessage"], header: string, jsonPretty: string): string;
|
|
89
|
+
createCommentBody(context: Context, message: LogReturn | Error, options?: Pick<CommentOptions, "raw">): string;
|
|
90
|
+
private _createCommentBody;
|
|
91
|
+
postComment(context: Context, message: LogReturn | Error, options?: CommentOptions): Promise<WithIssueNumber<PostedGithubComment> | null>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
interface Context<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName> {
|
|
95
|
+
eventName: TSupportedEvents;
|
|
96
|
+
payload: {
|
|
97
|
+
[K in TSupportedEvents]: K extends EmitterWebhookEventName ? EmitterWebhookEvent<K> : never;
|
|
98
|
+
}[TSupportedEvents]["payload"];
|
|
99
|
+
command: TCommand | null;
|
|
100
|
+
octokit: InstanceType<typeof customOctokit>;
|
|
101
|
+
config: TConfig;
|
|
102
|
+
env: TEnv;
|
|
103
|
+
logger: Logs;
|
|
104
|
+
commentHandler: CommentHandler;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { type Context as C, CommentHandler as a };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { EmitterWebhookEventName, EmitterWebhookEvent } from '@octokit/webhooks';
|
|
2
|
+
import * as _ubiquity_os_ubiquity_os_logger from '@ubiquity-os/ubiquity-os-logger';
|
|
3
|
+
import { LogReturn, Metadata, Logs } from '@ubiquity-os/ubiquity-os-logger';
|
|
4
|
+
import { RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods';
|
|
5
|
+
import { customOctokit } from './octokit.js';
|
|
6
|
+
|
|
7
|
+
interface CommentOptions {
|
|
8
|
+
raw?: boolean;
|
|
9
|
+
updateComment?: boolean;
|
|
10
|
+
}
|
|
11
|
+
type PostedGithubComment = RestEndpointMethodTypes["issues"]["updateComment"]["response"]["data"] | RestEndpointMethodTypes["issues"]["createComment"]["response"]["data"] | RestEndpointMethodTypes["pulls"]["createReplyForReviewComment"]["response"]["data"];
|
|
12
|
+
type WithIssueNumber<T> = T & {
|
|
13
|
+
issueNumber: number;
|
|
14
|
+
};
|
|
15
|
+
interface IssueContext {
|
|
16
|
+
issueNumber: number;
|
|
17
|
+
commentId?: number;
|
|
18
|
+
owner: string;
|
|
19
|
+
repo: string;
|
|
20
|
+
}
|
|
21
|
+
declare class CommentHandler {
|
|
22
|
+
static readonly HEADER_NAME = "UbiquityOS";
|
|
23
|
+
private _lastCommentId;
|
|
24
|
+
_updateIssueComment(context: Context, params: {
|
|
25
|
+
owner: string;
|
|
26
|
+
repo: string;
|
|
27
|
+
body: string;
|
|
28
|
+
issueNumber: number;
|
|
29
|
+
}): Promise<WithIssueNumber<PostedGithubComment>>;
|
|
30
|
+
_updateReviewComment(context: Context, params: {
|
|
31
|
+
owner: string;
|
|
32
|
+
repo: string;
|
|
33
|
+
body: string;
|
|
34
|
+
issueNumber: number;
|
|
35
|
+
}): Promise<WithIssueNumber<PostedGithubComment>>;
|
|
36
|
+
_createNewComment(context: Context, params: {
|
|
37
|
+
owner: string;
|
|
38
|
+
repo: string;
|
|
39
|
+
body: string;
|
|
40
|
+
issueNumber: number;
|
|
41
|
+
commentId?: number;
|
|
42
|
+
}): Promise<WithIssueNumber<PostedGithubComment>>;
|
|
43
|
+
_getIssueNumber(context: Context): number | undefined;
|
|
44
|
+
_getCommentId(context: Context): number | undefined;
|
|
45
|
+
_extractIssueContext(context: Context): IssueContext | null;
|
|
46
|
+
_processMessage(context: Context, message: LogReturn | Error): {
|
|
47
|
+
metadata: {
|
|
48
|
+
message: string;
|
|
49
|
+
name: string;
|
|
50
|
+
stack: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
logMessage: {
|
|
53
|
+
raw: string;
|
|
54
|
+
diff: string;
|
|
55
|
+
level: _ubiquity_os_ubiquity_os_logger.LogLevel;
|
|
56
|
+
type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
|
|
57
|
+
};
|
|
58
|
+
} | {
|
|
59
|
+
metadata: {
|
|
60
|
+
message: string | undefined;
|
|
61
|
+
stack: string | string[] | undefined;
|
|
62
|
+
caller: {} | undefined;
|
|
63
|
+
error?: Error | {
|
|
64
|
+
stack: string;
|
|
65
|
+
} | undefined;
|
|
66
|
+
name?: string | undefined;
|
|
67
|
+
} | {
|
|
68
|
+
logMessage: {
|
|
69
|
+
raw: string;
|
|
70
|
+
diff: string;
|
|
71
|
+
level: _ubiquity_os_ubiquity_os_logger.LogLevel;
|
|
72
|
+
type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
|
|
73
|
+
};
|
|
74
|
+
metadata?: Metadata;
|
|
75
|
+
};
|
|
76
|
+
logMessage: {
|
|
77
|
+
raw: string;
|
|
78
|
+
diff: string;
|
|
79
|
+
level: _ubiquity_os_ubiquity_os_logger.LogLevel;
|
|
80
|
+
type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
_getInstigatorName(context: Context): string;
|
|
84
|
+
_createMetadataContent(context: Context, metadata: Metadata): {
|
|
85
|
+
header: string;
|
|
86
|
+
jsonPretty: string;
|
|
87
|
+
};
|
|
88
|
+
_formatMetadataContent(logMessage: LogReturn["logMessage"], header: string, jsonPretty: string): string;
|
|
89
|
+
createCommentBody(context: Context, message: LogReturn | Error, options?: Pick<CommentOptions, "raw">): string;
|
|
90
|
+
private _createCommentBody;
|
|
91
|
+
postComment(context: Context, message: LogReturn | Error, options?: CommentOptions): Promise<WithIssueNumber<PostedGithubComment> | null>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
interface Context<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName> {
|
|
95
|
+
eventName: TSupportedEvents;
|
|
96
|
+
payload: {
|
|
97
|
+
[K in TSupportedEvents]: K extends EmitterWebhookEventName ? EmitterWebhookEvent<K> : never;
|
|
98
|
+
}[TSupportedEvents]["payload"];
|
|
99
|
+
command: TCommand | null;
|
|
100
|
+
octokit: InstanceType<typeof customOctokit>;
|
|
101
|
+
config: TConfig;
|
|
102
|
+
env: TEnv;
|
|
103
|
+
logger: Logs;
|
|
104
|
+
commentHandler: CommentHandler;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { type Context as C, CommentHandler as a };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,118 +1,19 @@
|
|
|
1
|
-
import { EmitterWebhookEventName
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods';
|
|
5
|
-
import { customOctokit } from './octokit.mjs';
|
|
1
|
+
import { EmitterWebhookEventName } from '@octokit/webhooks';
|
|
2
|
+
import { C as Context } from './context-3Ck9sBZI.mjs';
|
|
3
|
+
export { a as CommentHandler } from './context-3Ck9sBZI.mjs';
|
|
6
4
|
import { TSchema, TAnySchema } from '@sinclair/typebox';
|
|
5
|
+
import { LogLevel } from '@ubiquity-os/ubiquity-os-logger';
|
|
7
6
|
import * as hono_types from 'hono/types';
|
|
8
7
|
import { Hono } from 'hono';
|
|
9
8
|
import { Manifest } from './manifest.mjs';
|
|
9
|
+
import '@octokit/plugin-rest-endpoint-methods';
|
|
10
|
+
import './octokit.mjs';
|
|
10
11
|
import '@octokit/core/types';
|
|
11
12
|
import '@octokit/plugin-paginate-graphql';
|
|
12
13
|
import '@octokit/plugin-paginate-rest';
|
|
13
14
|
import '@octokit/webhooks/node_modules/@octokit/request-error';
|
|
14
15
|
import '@octokit/core';
|
|
15
16
|
|
|
16
|
-
interface CommentOptions {
|
|
17
|
-
raw?: boolean;
|
|
18
|
-
updateComment?: boolean;
|
|
19
|
-
}
|
|
20
|
-
type PostedGithubComment = RestEndpointMethodTypes["issues"]["updateComment"]["response"]["data"] | RestEndpointMethodTypes["issues"]["createComment"]["response"]["data"] | RestEndpointMethodTypes["pulls"]["createReplyForReviewComment"]["response"]["data"];
|
|
21
|
-
type WithIssueNumber<T> = T & {
|
|
22
|
-
issueNumber: number;
|
|
23
|
-
};
|
|
24
|
-
interface IssueContext {
|
|
25
|
-
issueNumber: number;
|
|
26
|
-
commentId?: number;
|
|
27
|
-
owner: string;
|
|
28
|
-
repo: string;
|
|
29
|
-
}
|
|
30
|
-
declare class CommentHandler {
|
|
31
|
-
static readonly HEADER_NAME = "UbiquityOS";
|
|
32
|
-
private _lastCommentId;
|
|
33
|
-
_updateIssueComment(context: Context, params: {
|
|
34
|
-
owner: string;
|
|
35
|
-
repo: string;
|
|
36
|
-
body: string;
|
|
37
|
-
issueNumber: number;
|
|
38
|
-
}): Promise<WithIssueNumber<PostedGithubComment>>;
|
|
39
|
-
_updateReviewComment(context: Context, params: {
|
|
40
|
-
owner: string;
|
|
41
|
-
repo: string;
|
|
42
|
-
body: string;
|
|
43
|
-
issueNumber: number;
|
|
44
|
-
}): Promise<WithIssueNumber<PostedGithubComment>>;
|
|
45
|
-
_createNewComment(context: Context, params: {
|
|
46
|
-
owner: string;
|
|
47
|
-
repo: string;
|
|
48
|
-
body: string;
|
|
49
|
-
issueNumber: number;
|
|
50
|
-
commentId?: number;
|
|
51
|
-
}): Promise<WithIssueNumber<PostedGithubComment>>;
|
|
52
|
-
_getIssueNumber(context: Context): number | undefined;
|
|
53
|
-
_getCommentId(context: Context): number | undefined;
|
|
54
|
-
_extractIssueContext(context: Context): IssueContext | null;
|
|
55
|
-
_processMessage(context: Context, message: LogReturn | Error): {
|
|
56
|
-
metadata: {
|
|
57
|
-
message: string;
|
|
58
|
-
name: string;
|
|
59
|
-
stack: string | undefined;
|
|
60
|
-
};
|
|
61
|
-
logMessage: {
|
|
62
|
-
raw: string;
|
|
63
|
-
diff: string;
|
|
64
|
-
level: _ubiquity_os_ubiquity_os_logger.LogLevel;
|
|
65
|
-
type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
|
|
66
|
-
};
|
|
67
|
-
} | {
|
|
68
|
-
metadata: {
|
|
69
|
-
message: string | undefined;
|
|
70
|
-
stack: string | string[] | undefined;
|
|
71
|
-
caller: {} | undefined;
|
|
72
|
-
error?: Error | {
|
|
73
|
-
stack: string;
|
|
74
|
-
} | undefined;
|
|
75
|
-
name?: string | undefined;
|
|
76
|
-
} | {
|
|
77
|
-
logMessage: {
|
|
78
|
-
raw: string;
|
|
79
|
-
diff: string;
|
|
80
|
-
level: _ubiquity_os_ubiquity_os_logger.LogLevel;
|
|
81
|
-
type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
|
|
82
|
-
};
|
|
83
|
-
metadata?: Metadata;
|
|
84
|
-
};
|
|
85
|
-
logMessage: {
|
|
86
|
-
raw: string;
|
|
87
|
-
diff: string;
|
|
88
|
-
level: _ubiquity_os_ubiquity_os_logger.LogLevel;
|
|
89
|
-
type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
_getInstigatorName(context: Context): string;
|
|
93
|
-
_createMetadataContent(context: Context, metadata: Metadata): {
|
|
94
|
-
header: string;
|
|
95
|
-
jsonPretty: string;
|
|
96
|
-
};
|
|
97
|
-
_formatMetadataContent(logMessage: LogReturn["logMessage"], header: string, jsonPretty: string): string;
|
|
98
|
-
createCommentBody(context: Context, message: LogReturn | Error, options?: Pick<CommentOptions, "raw">): string;
|
|
99
|
-
private _createCommentBody;
|
|
100
|
-
postComment(context: Context, message: LogReturn | Error, options?: CommentOptions): Promise<WithIssueNumber<PostedGithubComment> | null>;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
interface Context<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName> {
|
|
104
|
-
eventName: TSupportedEvents;
|
|
105
|
-
payload: {
|
|
106
|
-
[K in TSupportedEvents]: K extends EmitterWebhookEventName ? EmitterWebhookEvent<K> : never;
|
|
107
|
-
}[TSupportedEvents]["payload"];
|
|
108
|
-
command: TCommand | null;
|
|
109
|
-
octokit: InstanceType<typeof customOctokit>;
|
|
110
|
-
config: TConfig;
|
|
111
|
-
env: TEnv;
|
|
112
|
-
logger: Logs;
|
|
113
|
-
commentHandler: CommentHandler;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
17
|
type Return = Record<string, unknown> | undefined | void;
|
|
117
18
|
type HandlerReturn = Promise<Return> | Return;
|
|
118
19
|
|
|
@@ -168,4 +69,4 @@ declare function cleanMarkdown(md: string, options?: Options): string;
|
|
|
168
69
|
|
|
169
70
|
declare function createPlugin<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TCommand, TSupportedEvents>) => HandlerReturn, manifest: Manifest, options?: Options$1): Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
|
|
170
71
|
|
|
171
|
-
export {
|
|
72
|
+
export { Context, type Options$1 as Options, cleanMarkdown, createActionsPlugin, createPlugin, sanitizeLlmResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,118 +1,19 @@
|
|
|
1
|
-
import { EmitterWebhookEventName
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods';
|
|
5
|
-
import { customOctokit } from './octokit.js';
|
|
1
|
+
import { EmitterWebhookEventName } from '@octokit/webhooks';
|
|
2
|
+
import { C as Context } from './context-DOUnUNNN.js';
|
|
3
|
+
export { a as CommentHandler } from './context-DOUnUNNN.js';
|
|
6
4
|
import { TSchema, TAnySchema } from '@sinclair/typebox';
|
|
5
|
+
import { LogLevel } from '@ubiquity-os/ubiquity-os-logger';
|
|
7
6
|
import * as hono_types from 'hono/types';
|
|
8
7
|
import { Hono } from 'hono';
|
|
9
8
|
import { Manifest } from './manifest.js';
|
|
9
|
+
import '@octokit/plugin-rest-endpoint-methods';
|
|
10
|
+
import './octokit.js';
|
|
10
11
|
import '@octokit/core/types';
|
|
11
12
|
import '@octokit/plugin-paginate-graphql';
|
|
12
13
|
import '@octokit/plugin-paginate-rest';
|
|
13
14
|
import '@octokit/webhooks/node_modules/@octokit/request-error';
|
|
14
15
|
import '@octokit/core';
|
|
15
16
|
|
|
16
|
-
interface CommentOptions {
|
|
17
|
-
raw?: boolean;
|
|
18
|
-
updateComment?: boolean;
|
|
19
|
-
}
|
|
20
|
-
type PostedGithubComment = RestEndpointMethodTypes["issues"]["updateComment"]["response"]["data"] | RestEndpointMethodTypes["issues"]["createComment"]["response"]["data"] | RestEndpointMethodTypes["pulls"]["createReplyForReviewComment"]["response"]["data"];
|
|
21
|
-
type WithIssueNumber<T> = T & {
|
|
22
|
-
issueNumber: number;
|
|
23
|
-
};
|
|
24
|
-
interface IssueContext {
|
|
25
|
-
issueNumber: number;
|
|
26
|
-
commentId?: number;
|
|
27
|
-
owner: string;
|
|
28
|
-
repo: string;
|
|
29
|
-
}
|
|
30
|
-
declare class CommentHandler {
|
|
31
|
-
static readonly HEADER_NAME = "UbiquityOS";
|
|
32
|
-
private _lastCommentId;
|
|
33
|
-
_updateIssueComment(context: Context, params: {
|
|
34
|
-
owner: string;
|
|
35
|
-
repo: string;
|
|
36
|
-
body: string;
|
|
37
|
-
issueNumber: number;
|
|
38
|
-
}): Promise<WithIssueNumber<PostedGithubComment>>;
|
|
39
|
-
_updateReviewComment(context: Context, params: {
|
|
40
|
-
owner: string;
|
|
41
|
-
repo: string;
|
|
42
|
-
body: string;
|
|
43
|
-
issueNumber: number;
|
|
44
|
-
}): Promise<WithIssueNumber<PostedGithubComment>>;
|
|
45
|
-
_createNewComment(context: Context, params: {
|
|
46
|
-
owner: string;
|
|
47
|
-
repo: string;
|
|
48
|
-
body: string;
|
|
49
|
-
issueNumber: number;
|
|
50
|
-
commentId?: number;
|
|
51
|
-
}): Promise<WithIssueNumber<PostedGithubComment>>;
|
|
52
|
-
_getIssueNumber(context: Context): number | undefined;
|
|
53
|
-
_getCommentId(context: Context): number | undefined;
|
|
54
|
-
_extractIssueContext(context: Context): IssueContext | null;
|
|
55
|
-
_processMessage(context: Context, message: LogReturn | Error): {
|
|
56
|
-
metadata: {
|
|
57
|
-
message: string;
|
|
58
|
-
name: string;
|
|
59
|
-
stack: string | undefined;
|
|
60
|
-
};
|
|
61
|
-
logMessage: {
|
|
62
|
-
raw: string;
|
|
63
|
-
diff: string;
|
|
64
|
-
level: _ubiquity_os_ubiquity_os_logger.LogLevel;
|
|
65
|
-
type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
|
|
66
|
-
};
|
|
67
|
-
} | {
|
|
68
|
-
metadata: {
|
|
69
|
-
message: string | undefined;
|
|
70
|
-
stack: string | string[] | undefined;
|
|
71
|
-
caller: {} | undefined;
|
|
72
|
-
error?: Error | {
|
|
73
|
-
stack: string;
|
|
74
|
-
} | undefined;
|
|
75
|
-
name?: string | undefined;
|
|
76
|
-
} | {
|
|
77
|
-
logMessage: {
|
|
78
|
-
raw: string;
|
|
79
|
-
diff: string;
|
|
80
|
-
level: _ubiquity_os_ubiquity_os_logger.LogLevel;
|
|
81
|
-
type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
|
|
82
|
-
};
|
|
83
|
-
metadata?: Metadata;
|
|
84
|
-
};
|
|
85
|
-
logMessage: {
|
|
86
|
-
raw: string;
|
|
87
|
-
diff: string;
|
|
88
|
-
level: _ubiquity_os_ubiquity_os_logger.LogLevel;
|
|
89
|
-
type: _ubiquity_os_ubiquity_os_logger.LogLevelWithOk;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
_getInstigatorName(context: Context): string;
|
|
93
|
-
_createMetadataContent(context: Context, metadata: Metadata): {
|
|
94
|
-
header: string;
|
|
95
|
-
jsonPretty: string;
|
|
96
|
-
};
|
|
97
|
-
_formatMetadataContent(logMessage: LogReturn["logMessage"], header: string, jsonPretty: string): string;
|
|
98
|
-
createCommentBody(context: Context, message: LogReturn | Error, options?: Pick<CommentOptions, "raw">): string;
|
|
99
|
-
private _createCommentBody;
|
|
100
|
-
postComment(context: Context, message: LogReturn | Error, options?: CommentOptions): Promise<WithIssueNumber<PostedGithubComment> | null>;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
interface Context<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName> {
|
|
104
|
-
eventName: TSupportedEvents;
|
|
105
|
-
payload: {
|
|
106
|
-
[K in TSupportedEvents]: K extends EmitterWebhookEventName ? EmitterWebhookEvent<K> : never;
|
|
107
|
-
}[TSupportedEvents]["payload"];
|
|
108
|
-
command: TCommand | null;
|
|
109
|
-
octokit: InstanceType<typeof customOctokit>;
|
|
110
|
-
config: TConfig;
|
|
111
|
-
env: TEnv;
|
|
112
|
-
logger: Logs;
|
|
113
|
-
commentHandler: CommentHandler;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
17
|
type Return = Record<string, unknown> | undefined | void;
|
|
117
18
|
type HandlerReturn = Promise<Return> | Return;
|
|
118
19
|
|
|
@@ -168,4 +69,4 @@ declare function cleanMarkdown(md: string, options?: Options): string;
|
|
|
168
69
|
|
|
169
70
|
declare function createPlugin<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TCommand, TSupportedEvents>) => HandlerReturn, manifest: Manifest, options?: Options$1): Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
|
|
170
71
|
|
|
171
|
-
export {
|
|
72
|
+
export { Context, type Options$1 as Options, cleanMarkdown, createActionsPlugin, createPlugin, sanitizeLlmResponse };
|
package/dist/index.js
CHANGED
|
@@ -379,7 +379,7 @@ function getCommand(inputs, pluginOptions) {
|
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
// src/helpers/compression.ts
|
|
382
|
-
var import_node_zlib = require("zlib");
|
|
382
|
+
var import_node_zlib = require("node:zlib");
|
|
383
383
|
function compressString(str) {
|
|
384
384
|
const input = Buffer.from(str, "utf8");
|
|
385
385
|
const compressed = (0, import_node_zlib.brotliCompressSync)(input);
|
package/dist/index.mjs
CHANGED
|
@@ -339,7 +339,7 @@ function getCommand(inputs, pluginOptions) {
|
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
// src/helpers/compression.ts
|
|
342
|
-
import { brotliCompressSync, brotliDecompressSync } from "zlib";
|
|
342
|
+
import { brotliCompressSync, brotliDecompressSync } from "node:zlib";
|
|
343
343
|
function compressString(str) {
|
|
344
344
|
const input = Buffer.from(str, "utf8");
|
|
345
345
|
const compressed = brotliCompressSync(input);
|
package/dist/manifest.d.mts
CHANGED
|
@@ -25,6 +25,7 @@ declare const commandSchema: _sinclair_typebox.TObject<{
|
|
|
25
25
|
}>;
|
|
26
26
|
declare const manifestSchema: _sinclair_typebox.TObject<{
|
|
27
27
|
name: _sinclair_typebox.TString;
|
|
28
|
+
short_name: _sinclair_typebox.TString;
|
|
28
29
|
description: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
29
30
|
commands: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TObject<{
|
|
30
31
|
description: _sinclair_typebox.TString;
|
package/dist/manifest.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ declare const commandSchema: _sinclair_typebox.TObject<{
|
|
|
25
25
|
}>;
|
|
26
26
|
declare const manifestSchema: _sinclair_typebox.TObject<{
|
|
27
27
|
name: _sinclair_typebox.TString;
|
|
28
|
+
short_name: _sinclair_typebox.TString;
|
|
28
29
|
description: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
29
30
|
commands: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TObject<{
|
|
30
31
|
description: _sinclair_typebox.TString;
|
package/dist/manifest.js
CHANGED
|
@@ -45,6 +45,7 @@ var commandSchema = import_typebox.Type.Object({
|
|
|
45
45
|
});
|
|
46
46
|
var manifestSchema = import_typebox.Type.Object({
|
|
47
47
|
name: import_typebox.Type.String({ minLength: 1 }),
|
|
48
|
+
short_name: import_typebox.Type.String({ minLength: 1 }),
|
|
48
49
|
description: import_typebox.Type.Optional(import_typebox.Type.String({ default: "" })),
|
|
49
50
|
commands: import_typebox.Type.Optional(import_typebox.Type.Record(import_typebox.Type.String({ pattern: "^[A-Za-z-_]+$" }), commandSchema, { default: {} })),
|
|
50
51
|
"ubiquity:listeners": import_typebox.Type.Optional(import_typebox.Type.Array(runEvent, { default: [] })),
|
package/dist/manifest.mjs
CHANGED
|
@@ -18,6 +18,7 @@ var commandSchema = T.Object({
|
|
|
18
18
|
});
|
|
19
19
|
var manifestSchema = T.Object({
|
|
20
20
|
name: T.String({ minLength: 1 }),
|
|
21
|
+
short_name: T.String({ minLength: 1 }),
|
|
21
22
|
description: T.Optional(T.String({ default: "" })),
|
|
22
23
|
commands: T.Optional(T.Record(T.String({ pattern: "^[A-Za-z-_]+$" }), commandSchema, { default: {} })),
|
|
23
24
|
"ubiquity:listeners": T.Optional(T.Array(runEvent, { default: [] })),
|
package/dist/signature.js
CHANGED
|
@@ -27,7 +27,7 @@ __export(signature_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(signature_exports);
|
|
28
28
|
|
|
29
29
|
// src/helpers/compression.ts
|
|
30
|
-
var import_node_zlib = require("zlib");
|
|
30
|
+
var import_node_zlib = require("node:zlib");
|
|
31
31
|
function compressString(str) {
|
|
32
32
|
const input = Buffer.from(str, "utf8");
|
|
33
33
|
const compressed = (0, import_node_zlib.brotliCompressSync)(input);
|
package/dist/signature.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/helpers/compression.ts
|
|
2
|
-
import { brotliCompressSync, brotliDecompressSync } from "zlib";
|
|
2
|
+
import { brotliCompressSync, brotliDecompressSync } from "node:zlib";
|
|
3
3
|
function compressString(str) {
|
|
4
4
|
const input = Buffer.from(str, "utf8");
|
|
5
5
|
const compressed = brotliCompressSync(input);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubiquity-os/plugin-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "SDK for plugin support.",
|
|
5
5
|
"author": "Ubiquity DAO",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
],
|
|
31
31
|
"compression": [
|
|
32
32
|
"dist/compression.d.ts"
|
|
33
|
+
],
|
|
34
|
+
"configuration": [
|
|
35
|
+
"dist/configuration.d.ts"
|
|
33
36
|
]
|
|
34
37
|
}
|
|
35
38
|
},
|
|
@@ -68,6 +71,11 @@
|
|
|
68
71
|
"types": "./dist/compression.d.ts",
|
|
69
72
|
"import": "./dist/compression.mjs",
|
|
70
73
|
"require": "./dist/compression.js"
|
|
74
|
+
},
|
|
75
|
+
"./configuration": {
|
|
76
|
+
"types": "./dist/configuration.d.ts",
|
|
77
|
+
"import": "./dist/configuration.mjs",
|
|
78
|
+
"require": "./dist/configuration.js"
|
|
71
79
|
}
|
|
72
80
|
},
|
|
73
81
|
"files": [
|
|
@@ -104,7 +112,8 @@
|
|
|
104
112
|
"@octokit/webhooks": "^14.1.3",
|
|
105
113
|
"@ubiquity-os/ubiquity-os-logger": "^1.4.0",
|
|
106
114
|
"dotenv": "^17.2.3",
|
|
107
|
-
"hono": "^4.10.6"
|
|
115
|
+
"hono": "^4.10.6",
|
|
116
|
+
"js-yaml": "^4.1.1"
|
|
108
117
|
},
|
|
109
118
|
"peerDependencies": {
|
|
110
119
|
"@sinclair/typebox": "0.34.41"
|
|
@@ -120,6 +129,7 @@
|
|
|
120
129
|
"@mswjs/data": "0.15.0",
|
|
121
130
|
"@mswjs/http-middleware": "^0.10.3",
|
|
122
131
|
"@swc/jest": "^0.2.39",
|
|
132
|
+
"@types/js-yaml": "^4.0.9",
|
|
123
133
|
"@types/node": "^20.19.25",
|
|
124
134
|
"@ubiquity-os/eslint-plugin-no-empty-strings": "^1.0.3",
|
|
125
135
|
"cross-env": "^7.0.3",
|