@openwaggle/extension-sdk 0.0.0-bootstrap.0 → 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/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/agent-loop.d.ts +128 -0
- package/dist/agent-loop.js +47 -0
- package/dist/broker-validation.d.ts +17 -0
- package/dist/broker-validation.js +99 -0
- package/dist/broker.d.ts +193 -0
- package/dist/broker.js +81 -0
- package/dist/constants.d.ts +183 -0
- package/dist/constants.js +245 -0
- package/dist/context.d.ts +66 -0
- package/dist/context.js +49 -0
- package/dist/contribution-types.d.ts +21 -0
- package/dist/contribution-types.js +1 -0
- package/dist/core-types.d.ts +58 -0
- package/dist/core-types.js +1 -0
- package/dist/docs-validation.d.ts +3 -0
- package/dist/docs-validation.js +93 -0
- package/dist/docs.d.ts +231 -0
- package/dist/docs.js +85 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +10 -0
- package/dist/internal-validation.d.ts +4 -0
- package/dist/internal-validation.js +24 -0
- package/dist/json.d.ts +9 -0
- package/dist/json.js +3 -0
- package/dist/manifest-contributions.d.ts +380 -0
- package/dist/manifest-contributions.js +75 -0
- package/dist/manifest-primitives.d.ts +20 -0
- package/dist/manifest-primitives.js +118 -0
- package/dist/manifest.d.ts +303 -0
- package/dist/manifest.js +89 -0
- package/dist/openwaggle-sdk.d.ts +2 -0
- package/dist/openwaggle-sdk.js +127 -0
- package/dist/openwaggle-types.d.ts +111 -0
- package/dist/openwaggle-types.js +1 -0
- package/dist/openwaggle-validation.d.ts +12 -0
- package/dist/openwaggle-validation.js +135 -0
- package/dist/registry-types.d.ts +34 -0
- package/dist/registry-types.js +1 -0
- package/dist/runtime-sdk.d.ts +2 -0
- package/dist/runtime-sdk.js +19 -0
- package/dist/runtime-types.d.ts +19 -0
- package/dist/runtime-types.js +1 -0
- package/dist/runtime.d.ts +22 -0
- package/dist/runtime.js +22 -0
- package/dist/schema.d.ts +13 -0
- package/dist/schema.js +25 -0
- package/dist/sdk-types.d.ts +92 -0
- package/dist/sdk-types.js +1 -0
- package/dist/storage-sdk.d.ts +2 -0
- package/dist/storage-sdk.js +51 -0
- package/dist/storage-types.d.ts +40 -0
- package/dist/storage-types.js +1 -0
- package/dist/theme-data.d.ts +126 -0
- package/dist/theme-data.js +144 -0
- package/dist/theme-types.d.ts +61 -0
- package/dist/theme-types.js +1 -0
- package/dist/theme.d.ts +6 -0
- package/dist/theme.js +128 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.js +1 -0
- package/dist/ui-constants.d.ts +24 -0
- package/dist/ui-constants.js +22 -0
- package/dist/ui-stylesheet.d.ts +8 -0
- package/dist/ui-stylesheet.js +223 -0
- package/dist/ui.d.ts +6 -0
- package/dist/ui.js +16 -0
- package/dist-cjs/agent-loop.js +83 -0
- package/dist-cjs/broker-validation.js +109 -0
- package/dist-cjs/broker.js +120 -0
- package/dist-cjs/constants.js +248 -0
- package/dist-cjs/context.js +54 -0
- package/dist-cjs/contribution-types.js +2 -0
- package/dist-cjs/core-types.js +2 -0
- package/dist-cjs/docs-validation.js +97 -0
- package/dist-cjs/docs.js +121 -0
- package/dist-cjs/index.js +56 -0
- package/dist-cjs/internal-validation.js +30 -0
- package/dist-cjs/json.js +39 -0
- package/dist-cjs/manifest-contributions.js +111 -0
- package/dist-cjs/manifest-primitives.js +158 -0
- package/dist-cjs/manifest.js +140 -0
- package/dist-cjs/openwaggle-sdk.js +130 -0
- package/dist-cjs/openwaggle-types.js +2 -0
- package/dist-cjs/openwaggle-validation.js +148 -0
- package/dist-cjs/package.json +3 -0
- package/dist-cjs/registry-types.js +2 -0
- package/dist-cjs/runtime-sdk.js +22 -0
- package/dist-cjs/runtime-types.js +2 -0
- package/dist-cjs/runtime.js +61 -0
- package/dist-cjs/schema.js +61 -0
- package/dist-cjs/sdk-types.js +2 -0
- package/dist-cjs/storage-sdk.js +54 -0
- package/dist-cjs/storage-types.js +2 -0
- package/dist-cjs/theme-data.js +147 -0
- package/dist-cjs/theme-types.js +2 -0
- package/dist-cjs/theme.js +135 -0
- package/dist-cjs/types.js +2 -0
- package/dist-cjs/ui-constants.js +25 -0
- package/dist-cjs/ui-stylesheet.js +227 -0
- package/dist-cjs/ui.js +24 -0
- package/package.json +98 -8
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDocsDiscoverResult = isDocsDiscoverResult;
|
|
4
|
+
exports.isDocsResolveTopicResult = isDocsResolveTopicResult;
|
|
5
|
+
const constants_js_1 = require("./constants.js");
|
|
6
|
+
const internal_validation_js_1 = require("./internal-validation.js");
|
|
7
|
+
function isStringOrNull(value) {
|
|
8
|
+
return value === null || typeof value === 'string';
|
|
9
|
+
}
|
|
10
|
+
function isOptionalNonEmptyString(value) {
|
|
11
|
+
return value === undefined || (0, internal_validation_js_1.isNonEmptyString)(value);
|
|
12
|
+
}
|
|
13
|
+
function hasOpenWaggleResultBase(value, capability, method) {
|
|
14
|
+
return ((0, internal_validation_js_1.isNonEmptyString)(value.extensionId) &&
|
|
15
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.contributionId) &&
|
|
16
|
+
value.capability === capability &&
|
|
17
|
+
value.method === method);
|
|
18
|
+
}
|
|
19
|
+
function isDocsDiscoveryDiagnostic(value) {
|
|
20
|
+
return ((0, internal_validation_js_1.isRecord)(value) &&
|
|
21
|
+
(value.severity === 'warning' || value.severity === 'error') &&
|
|
22
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.code) &&
|
|
23
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.message) &&
|
|
24
|
+
isOptionalNonEmptyString(value.path));
|
|
25
|
+
}
|
|
26
|
+
function isFirstPartyDocsTopicSummary(value) {
|
|
27
|
+
return ((0, internal_validation_js_1.isRecord)(value) &&
|
|
28
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.topic) &&
|
|
29
|
+
(value.source === 'openwaggle' || value.source === 'pi') &&
|
|
30
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.group) &&
|
|
31
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.title) &&
|
|
32
|
+
isOptionalNonEmptyString(value.description) &&
|
|
33
|
+
isOptionalNonEmptyString(value.section) &&
|
|
34
|
+
typeof value.order === 'number' &&
|
|
35
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.path) &&
|
|
36
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.bundlePath) &&
|
|
37
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.sourcePath) &&
|
|
38
|
+
(0, internal_validation_js_1.isStringArray)(value.aliases) &&
|
|
39
|
+
(0, internal_validation_js_1.isStringArray)(value.keywords) &&
|
|
40
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.contentHash));
|
|
41
|
+
}
|
|
42
|
+
function isExtensionDocsPackageScopeView(value) {
|
|
43
|
+
return ((0, internal_validation_js_1.isRecord)(value) &&
|
|
44
|
+
(value.kind === 'global' || value.kind === 'project') &&
|
|
45
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.label) &&
|
|
46
|
+
isOptionalNonEmptyString(value.projectPath));
|
|
47
|
+
}
|
|
48
|
+
function isExtensionDocsProvenance(value) {
|
|
49
|
+
return ((0, internal_validation_js_1.isRecord)(value) &&
|
|
50
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.extensionId) &&
|
|
51
|
+
isStringOrNull(value.extensionName) &&
|
|
52
|
+
isStringOrNull(value.extensionVersion) &&
|
|
53
|
+
isExtensionDocsPackageScopeView(value.scope) &&
|
|
54
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.packagePath) &&
|
|
55
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.manifestPath) &&
|
|
56
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.path) &&
|
|
57
|
+
isStringOrNull(value.packageContentHash) &&
|
|
58
|
+
(value.trust === 'trusted' || value.trust === 'untrusted' || value.trust === 'unknown') &&
|
|
59
|
+
(value.lifecycle === 'enabled' ||
|
|
60
|
+
value.lifecycle === 'disabled' ||
|
|
61
|
+
value.lifecycle === 'unavailable'));
|
|
62
|
+
}
|
|
63
|
+
function isExtensionDocsTopicSummary(value) {
|
|
64
|
+
return ((0, internal_validation_js_1.isRecord)(value) &&
|
|
65
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.topic) &&
|
|
66
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.localTopic) &&
|
|
67
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.title) &&
|
|
68
|
+
isOptionalNonEmptyString(value.description) &&
|
|
69
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.path) &&
|
|
70
|
+
(0, internal_validation_js_1.isStringArray)(value.aliases) &&
|
|
71
|
+
(0, internal_validation_js_1.isStringArray)(value.keywords) &&
|
|
72
|
+
isStringOrNull(value.contentHash) &&
|
|
73
|
+
isExtensionDocsProvenance(value.provenance) &&
|
|
74
|
+
Array.isArray(value.diagnostics) &&
|
|
75
|
+
value.diagnostics.every(isDocsDiscoveryDiagnostic));
|
|
76
|
+
}
|
|
77
|
+
function isDocsDiscoveryView(value) {
|
|
78
|
+
return ((0, internal_validation_js_1.isRecord)(value) &&
|
|
79
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.generatedAt) &&
|
|
80
|
+
(0, internal_validation_js_1.isNonEmptyString)(value.bundlePath) &&
|
|
81
|
+
Array.isArray(value.firstPartyTopics) &&
|
|
82
|
+
value.firstPartyTopics.every(isFirstPartyDocsTopicSummary) &&
|
|
83
|
+
Array.isArray(value.extensionTopics) &&
|
|
84
|
+
value.extensionTopics.every(isExtensionDocsTopicSummary) &&
|
|
85
|
+
Array.isArray(value.diagnostics) &&
|
|
86
|
+
value.diagnostics.every(isDocsDiscoveryDiagnostic));
|
|
87
|
+
}
|
|
88
|
+
function isDocsDiscoverResult(value) {
|
|
89
|
+
return ((0, internal_validation_js_1.isRecord)(value) &&
|
|
90
|
+
hasOpenWaggleResultBase(value, constants_js_1.OPENWAGGLE_EXTENSION_BROKER.CAPABILITY.DOCS, constants_js_1.OPENWAGGLE_EXTENSION_BROKER.METHOD.DISCOVER_DOCS) &&
|
|
91
|
+
isDocsDiscoveryView(value.docs));
|
|
92
|
+
}
|
|
93
|
+
function isDocsResolveTopicResult(value) {
|
|
94
|
+
return ((0, internal_validation_js_1.isRecord)(value) &&
|
|
95
|
+
hasOpenWaggleResultBase(value, constants_js_1.OPENWAGGLE_EXTENSION_BROKER.CAPABILITY.DOCS, constants_js_1.OPENWAGGLE_EXTENSION_BROKER.METHOD.RESOLVE_DOCS_TOPIC) &&
|
|
96
|
+
(value.resolvedTopic === null || isFirstPartyDocsTopicSummary(value.resolvedTopic)));
|
|
97
|
+
}
|
package/dist-cjs/docs.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.extensionDocsResolveTopicResultSchema = exports.extensionDocsDiscoverResultSchema = exports.docsDiscoveryViewSchema = exports.extensionDocsTopicSummarySchema = exports.extensionDocsProvenanceSchema = exports.extensionDocsPackageScopeViewSchema = exports.firstPartyDocsTopicSummarySchema = exports.docsDiscoveryDiagnosticSchema = exports.extensionDocsResolveTopicPayloadSchema = exports.extensionDocsDiscoverPayloadSchema = exports.firstPartyDocTopicSchema = void 0;
|
|
37
|
+
const Schema = __importStar(require("effect/Schema"));
|
|
38
|
+
const constants_js_1 = require("./constants.js");
|
|
39
|
+
const manifest_js_1 = require("./manifest.js");
|
|
40
|
+
const nonEmptyStringSchema = Schema.String.pipe(Schema.minLength(1));
|
|
41
|
+
const EXTENSION_TOPIC_PREFIX = 'extension:';
|
|
42
|
+
exports.firstPartyDocTopicSchema = nonEmptyStringSchema.pipe(Schema.filter((value) => !value.startsWith(EXTENSION_TOPIC_PREFIX) ||
|
|
43
|
+
'Extension docs topics must be resolved through extension docs discovery.'));
|
|
44
|
+
exports.extensionDocsDiscoverPayloadSchema = Schema.Struct({
|
|
45
|
+
projectPaths: Schema.optional(Schema.Array(nonEmptyStringSchema)),
|
|
46
|
+
includeExtensions: Schema.optional(Schema.Boolean),
|
|
47
|
+
});
|
|
48
|
+
exports.extensionDocsResolveTopicPayloadSchema = Schema.Struct({
|
|
49
|
+
topic: exports.firstPartyDocTopicSchema,
|
|
50
|
+
});
|
|
51
|
+
exports.docsDiscoveryDiagnosticSchema = Schema.Struct({
|
|
52
|
+
severity: Schema.Literal('warning', 'error'),
|
|
53
|
+
code: nonEmptyStringSchema,
|
|
54
|
+
message: nonEmptyStringSchema,
|
|
55
|
+
path: Schema.optional(nonEmptyStringSchema),
|
|
56
|
+
});
|
|
57
|
+
exports.firstPartyDocsTopicSummarySchema = Schema.Struct({
|
|
58
|
+
topic: exports.firstPartyDocTopicSchema,
|
|
59
|
+
source: Schema.Literal('openwaggle', 'pi'),
|
|
60
|
+
group: nonEmptyStringSchema,
|
|
61
|
+
title: nonEmptyStringSchema,
|
|
62
|
+
description: Schema.optional(nonEmptyStringSchema),
|
|
63
|
+
section: Schema.optional(nonEmptyStringSchema),
|
|
64
|
+
order: Schema.Number,
|
|
65
|
+
path: nonEmptyStringSchema,
|
|
66
|
+
bundlePath: nonEmptyStringSchema,
|
|
67
|
+
sourcePath: nonEmptyStringSchema,
|
|
68
|
+
aliases: Schema.Array(nonEmptyStringSchema),
|
|
69
|
+
keywords: Schema.Array(nonEmptyStringSchema),
|
|
70
|
+
contentHash: nonEmptyStringSchema,
|
|
71
|
+
});
|
|
72
|
+
exports.extensionDocsPackageScopeViewSchema = Schema.Struct({
|
|
73
|
+
kind: Schema.Literal(constants_js_1.OPENWAGGLE_EXTENSION.SCOPE.GLOBAL_KIND, constants_js_1.OPENWAGGLE_EXTENSION.SCOPE.PROJECT_KIND),
|
|
74
|
+
label: nonEmptyStringSchema,
|
|
75
|
+
projectPath: Schema.optional(nonEmptyStringSchema),
|
|
76
|
+
});
|
|
77
|
+
exports.extensionDocsProvenanceSchema = Schema.Struct({
|
|
78
|
+
extensionId: manifest_js_1.extensionIdSchema,
|
|
79
|
+
extensionName: Schema.NullOr(nonEmptyStringSchema),
|
|
80
|
+
extensionVersion: Schema.NullOr(nonEmptyStringSchema),
|
|
81
|
+
scope: exports.extensionDocsPackageScopeViewSchema,
|
|
82
|
+
packagePath: nonEmptyStringSchema,
|
|
83
|
+
manifestPath: nonEmptyStringSchema,
|
|
84
|
+
path: nonEmptyStringSchema,
|
|
85
|
+
packageContentHash: Schema.NullOr(nonEmptyStringSchema),
|
|
86
|
+
trust: Schema.Literal('trusted', 'untrusted', 'unknown'),
|
|
87
|
+
lifecycle: Schema.Literal('enabled', 'disabled', 'unavailable'),
|
|
88
|
+
});
|
|
89
|
+
exports.extensionDocsTopicSummarySchema = Schema.Struct({
|
|
90
|
+
topic: nonEmptyStringSchema,
|
|
91
|
+
localTopic: nonEmptyStringSchema,
|
|
92
|
+
title: nonEmptyStringSchema,
|
|
93
|
+
description: Schema.optional(nonEmptyStringSchema),
|
|
94
|
+
path: nonEmptyStringSchema,
|
|
95
|
+
aliases: Schema.Array(nonEmptyStringSchema),
|
|
96
|
+
keywords: Schema.Array(nonEmptyStringSchema),
|
|
97
|
+
contentHash: Schema.NullOr(nonEmptyStringSchema),
|
|
98
|
+
provenance: exports.extensionDocsProvenanceSchema,
|
|
99
|
+
diagnostics: Schema.Array(exports.docsDiscoveryDiagnosticSchema),
|
|
100
|
+
});
|
|
101
|
+
exports.docsDiscoveryViewSchema = Schema.Struct({
|
|
102
|
+
generatedAt: nonEmptyStringSchema,
|
|
103
|
+
bundlePath: nonEmptyStringSchema,
|
|
104
|
+
firstPartyTopics: Schema.Array(exports.firstPartyDocsTopicSummarySchema),
|
|
105
|
+
extensionTopics: Schema.Array(exports.extensionDocsTopicSummarySchema),
|
|
106
|
+
diagnostics: Schema.Array(exports.docsDiscoveryDiagnosticSchema),
|
|
107
|
+
});
|
|
108
|
+
exports.extensionDocsDiscoverResultSchema = Schema.Struct({
|
|
109
|
+
extensionId: manifest_js_1.extensionIdSchema,
|
|
110
|
+
contributionId: manifest_js_1.extensionContributionIdSchema,
|
|
111
|
+
capability: Schema.Literal(constants_js_1.OPENWAGGLE_EXTENSION_BROKER.CAPABILITY.DOCS),
|
|
112
|
+
method: Schema.Literal(constants_js_1.OPENWAGGLE_EXTENSION_BROKER.METHOD.DISCOVER_DOCS),
|
|
113
|
+
docs: exports.docsDiscoveryViewSchema,
|
|
114
|
+
});
|
|
115
|
+
exports.extensionDocsResolveTopicResultSchema = Schema.Struct({
|
|
116
|
+
extensionId: manifest_js_1.extensionIdSchema,
|
|
117
|
+
contributionId: manifest_js_1.extensionContributionIdSchema,
|
|
118
|
+
capability: Schema.Literal(constants_js_1.OPENWAGGLE_EXTENSION_BROKER.CAPABILITY.DOCS),
|
|
119
|
+
method: Schema.Literal(constants_js_1.OPENWAGGLE_EXTENSION_BROKER.METHOD.RESOLVE_DOCS_TOPIC),
|
|
120
|
+
resolvedTopic: Schema.NullOr(exports.firstPartyDocsTopicSummarySchema),
|
|
121
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.openWaggleExtensionClassName = exports.OPENWAGGLE_EXTENSION_UI_CLASS_NAMES = exports.OPENWAGGLE_EXTENSION_UI_ATTRIBUTES = exports.extensionThemeCssVariableDeclarations = exports.createOpenWaggleExtensionUiStylesheet = exports.OPENWAGGLE_EXTENSION_THEME_CSS_VARIABLES = exports.isOpenWaggleExtensionTheme = exports.extensionThemeCssVariableEntries = exports.createOpenWaggleExtensionTheme = exports.extensionRuntimeUnregisterContributionResultSchema = exports.extensionRuntimeRegisterContributionResultSchema = exports.createRuntimeContributionSdk = exports.jsonValueSchema = exports.jsonPrimitiveSchema = exports.createOpenWaggleExtensionSurfaceContext = exports.createOpenWaggleExtensionSharedModules = exports.createNoopExtensionSurfaceSdk = exports.OPENWAGGLE_EXTENSION_BROKER = exports.OPENWAGGLE_EXTENSION = exports.toInvokeInput = exports.extensionInvokeSuccessSchema = exports.extensionInvokeScopeSchema = exports.extensionInvokeResultSchema = exports.extensionInvokeInputSchema = exports.extensionInvokeFailureSchema = exports.extensionInvokeErrorSchema = exports.extensionCapabilityAuditEntrySchema = exports.createExtensionBrokerSdkFromInvoke = exports.createExtensionBrokerSdk = void 0;
|
|
18
|
+
__exportStar(require("./agent-loop.js"), exports);
|
|
19
|
+
var broker_js_1 = require("./broker.js");
|
|
20
|
+
Object.defineProperty(exports, "createExtensionBrokerSdk", { enumerable: true, get: function () { return broker_js_1.createExtensionBrokerSdk; } });
|
|
21
|
+
Object.defineProperty(exports, "createExtensionBrokerSdkFromInvoke", { enumerable: true, get: function () { return broker_js_1.createExtensionBrokerSdkFromInvoke; } });
|
|
22
|
+
Object.defineProperty(exports, "extensionCapabilityAuditEntrySchema", { enumerable: true, get: function () { return broker_js_1.extensionCapabilityAuditEntrySchema; } });
|
|
23
|
+
Object.defineProperty(exports, "extensionInvokeErrorSchema", { enumerable: true, get: function () { return broker_js_1.extensionInvokeErrorSchema; } });
|
|
24
|
+
Object.defineProperty(exports, "extensionInvokeFailureSchema", { enumerable: true, get: function () { return broker_js_1.extensionInvokeFailureSchema; } });
|
|
25
|
+
Object.defineProperty(exports, "extensionInvokeInputSchema", { enumerable: true, get: function () { return broker_js_1.extensionInvokeInputSchema; } });
|
|
26
|
+
Object.defineProperty(exports, "extensionInvokeResultSchema", { enumerable: true, get: function () { return broker_js_1.extensionInvokeResultSchema; } });
|
|
27
|
+
Object.defineProperty(exports, "extensionInvokeScopeSchema", { enumerable: true, get: function () { return broker_js_1.extensionInvokeScopeSchema; } });
|
|
28
|
+
Object.defineProperty(exports, "extensionInvokeSuccessSchema", { enumerable: true, get: function () { return broker_js_1.extensionInvokeSuccessSchema; } });
|
|
29
|
+
Object.defineProperty(exports, "toInvokeInput", { enumerable: true, get: function () { return broker_js_1.toInvokeInput; } });
|
|
30
|
+
var constants_js_1 = require("./constants.js");
|
|
31
|
+
Object.defineProperty(exports, "OPENWAGGLE_EXTENSION", { enumerable: true, get: function () { return constants_js_1.OPENWAGGLE_EXTENSION; } });
|
|
32
|
+
Object.defineProperty(exports, "OPENWAGGLE_EXTENSION_BROKER", { enumerable: true, get: function () { return constants_js_1.OPENWAGGLE_EXTENSION_BROKER; } });
|
|
33
|
+
var context_js_1 = require("./context.js");
|
|
34
|
+
Object.defineProperty(exports, "createNoopExtensionSurfaceSdk", { enumerable: true, get: function () { return context_js_1.createNoopExtensionSurfaceSdk; } });
|
|
35
|
+
Object.defineProperty(exports, "createOpenWaggleExtensionSharedModules", { enumerable: true, get: function () { return context_js_1.createOpenWaggleExtensionSharedModules; } });
|
|
36
|
+
Object.defineProperty(exports, "createOpenWaggleExtensionSurfaceContext", { enumerable: true, get: function () { return context_js_1.createOpenWaggleExtensionSurfaceContext; } });
|
|
37
|
+
__exportStar(require("./docs.js"), exports);
|
|
38
|
+
var json_js_1 = require("./json.js");
|
|
39
|
+
Object.defineProperty(exports, "jsonPrimitiveSchema", { enumerable: true, get: function () { return json_js_1.jsonPrimitiveSchema; } });
|
|
40
|
+
Object.defineProperty(exports, "jsonValueSchema", { enumerable: true, get: function () { return json_js_1.jsonValueSchema; } });
|
|
41
|
+
__exportStar(require("./manifest.js"), exports);
|
|
42
|
+
var runtime_js_1 = require("./runtime.js");
|
|
43
|
+
Object.defineProperty(exports, "createRuntimeContributionSdk", { enumerable: true, get: function () { return runtime_js_1.createRuntimeContributionSdk; } });
|
|
44
|
+
Object.defineProperty(exports, "extensionRuntimeRegisterContributionResultSchema", { enumerable: true, get: function () { return runtime_js_1.extensionRuntimeRegisterContributionResultSchema; } });
|
|
45
|
+
Object.defineProperty(exports, "extensionRuntimeUnregisterContributionResultSchema", { enumerable: true, get: function () { return runtime_js_1.extensionRuntimeUnregisterContributionResultSchema; } });
|
|
46
|
+
var theme_js_1 = require("./theme.js");
|
|
47
|
+
Object.defineProperty(exports, "createOpenWaggleExtensionTheme", { enumerable: true, get: function () { return theme_js_1.createOpenWaggleExtensionTheme; } });
|
|
48
|
+
Object.defineProperty(exports, "extensionThemeCssVariableEntries", { enumerable: true, get: function () { return theme_js_1.extensionThemeCssVariableEntries; } });
|
|
49
|
+
Object.defineProperty(exports, "isOpenWaggleExtensionTheme", { enumerable: true, get: function () { return theme_js_1.isOpenWaggleExtensionTheme; } });
|
|
50
|
+
Object.defineProperty(exports, "OPENWAGGLE_EXTENSION_THEME_CSS_VARIABLES", { enumerable: true, get: function () { return theme_js_1.OPENWAGGLE_EXTENSION_THEME_CSS_VARIABLES; } });
|
|
51
|
+
var ui_js_1 = require("./ui.js");
|
|
52
|
+
Object.defineProperty(exports, "createOpenWaggleExtensionUiStylesheet", { enumerable: true, get: function () { return ui_js_1.createOpenWaggleExtensionUiStylesheet; } });
|
|
53
|
+
Object.defineProperty(exports, "extensionThemeCssVariableDeclarations", { enumerable: true, get: function () { return ui_js_1.extensionThemeCssVariableDeclarations; } });
|
|
54
|
+
Object.defineProperty(exports, "OPENWAGGLE_EXTENSION_UI_ATTRIBUTES", { enumerable: true, get: function () { return ui_js_1.OPENWAGGLE_EXTENSION_UI_ATTRIBUTES; } });
|
|
55
|
+
Object.defineProperty(exports, "OPENWAGGLE_EXTENSION_UI_CLASS_NAMES", { enumerable: true, get: function () { return ui_js_1.OPENWAGGLE_EXTENSION_UI_CLASS_NAMES; } });
|
|
56
|
+
Object.defineProperty(exports, "openWaggleExtensionClassName", { enumerable: true, get: function () { return ui_js_1.openWaggleExtensionClassName; } });
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRecord = isRecord;
|
|
4
|
+
exports.isNonEmptyString = isNonEmptyString;
|
|
5
|
+
exports.isStringArray = isStringArray;
|
|
6
|
+
exports.isJsonValue = isJsonValue;
|
|
7
|
+
function isRecord(value) {
|
|
8
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
function isNonEmptyString(value) {
|
|
11
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
12
|
+
}
|
|
13
|
+
function isStringArray(value) {
|
|
14
|
+
return Array.isArray(value) && value.every((item) => typeof item === 'string');
|
|
15
|
+
}
|
|
16
|
+
function isJsonValue(value) {
|
|
17
|
+
if (value === null ||
|
|
18
|
+
typeof value === 'string' ||
|
|
19
|
+
typeof value === 'boolean' ||
|
|
20
|
+
typeof value === 'number') {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
if (Array.isArray(value)) {
|
|
24
|
+
return value.every(isJsonValue);
|
|
25
|
+
}
|
|
26
|
+
if (!isRecord(value)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return Object.values(value).every(isJsonValue);
|
|
30
|
+
}
|
package/dist-cjs/json.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.jsonValueSchema = exports.jsonPrimitiveSchema = void 0;
|
|
37
|
+
const Schema = __importStar(require("effect/Schema"));
|
|
38
|
+
exports.jsonPrimitiveSchema = Schema.Union(Schema.String, Schema.Number, Schema.Boolean, Schema.Null);
|
|
39
|
+
exports.jsonValueSchema = Schema.suspend(() => Schema.Union(exports.jsonPrimitiveSchema, Schema.mutable(Schema.Array(exports.jsonValueSchema)), Schema.mutable(Schema.Record({ key: Schema.String, value: exports.jsonValueSchema }))));
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.extensionContributionUnregistrationSchema = exports.extensionContributionRegistrationSchema = exports.extensionSlotContributionRegistrationSchema = exports.extensionRouteContributionRegistrationSchema = exports.extensionCommandContributionRegistrationSchema = exports.extensionContributionsSchema = exports.extensionSlotContributionSchema = exports.extensionRouteContributionSchema = exports.extensionCommandContributionSchema = exports.extensionCapabilityDeclarationSchema = void 0;
|
|
37
|
+
const Schema = __importStar(require("effect/Schema"));
|
|
38
|
+
const constants_js_1 = require("./constants.js");
|
|
39
|
+
const manifest_primitives_js_1 = require("./manifest-primitives.js");
|
|
40
|
+
exports.extensionCapabilityDeclarationSchema = Schema.Struct({
|
|
41
|
+
id: manifest_primitives_js_1.extensionContributionIdSchema,
|
|
42
|
+
methods: Schema.optional(Schema.Array(manifest_primitives_js_1.extensionContributionIdSchema)),
|
|
43
|
+
scopes: Schema.optional(Schema.Array(manifest_primitives_js_1.extensionCapabilityScopeSchema)),
|
|
44
|
+
}).pipe(Schema.filter(manifest_primitives_js_1.validateBrokerCapabilityDeclaration));
|
|
45
|
+
const brokerBindingSchema = {
|
|
46
|
+
capability: Schema.optional(manifest_primitives_js_1.extensionContributionIdSchema),
|
|
47
|
+
method: Schema.optional(manifest_primitives_js_1.extensionContributionIdSchema),
|
|
48
|
+
methods: Schema.optional(Schema.Array(manifest_primitives_js_1.extensionContributionIdSchema)),
|
|
49
|
+
};
|
|
50
|
+
const targetSchema = Schema.Struct({
|
|
51
|
+
projectPaths: Schema.optional(Schema.Array(manifest_primitives_js_1.extensionNonEmptyStringSchema)),
|
|
52
|
+
sessionIds: Schema.optional(Schema.Array(manifest_primitives_js_1.extensionNonEmptyStringSchema)),
|
|
53
|
+
});
|
|
54
|
+
const matchSchema = Schema.Struct({
|
|
55
|
+
toolNames: Schema.optional(Schema.Array(manifest_primitives_js_1.extensionNonEmptyStringSchema)),
|
|
56
|
+
customMessageNames: Schema.optional(Schema.Array(manifest_primitives_js_1.extensionNonEmptyStringSchema)),
|
|
57
|
+
interactionKinds: Schema.optional(Schema.Array(manifest_primitives_js_1.extensionNonEmptyStringSchema)),
|
|
58
|
+
});
|
|
59
|
+
function validateEntryRuntime(input) {
|
|
60
|
+
return (input.runtime !== constants_js_1.OPENWAGGLE_EXTENSION.CONTRIBUTION_RUNTIME.TRUSTED_RENDERER ||
|
|
61
|
+
input.execution === constants_js_1.OPENWAGGLE_EXTENSION.EXECUTION_PLACEMENT.HOST_RENDERER ||
|
|
62
|
+
'Trusted renderer contributions must execute in the host renderer.');
|
|
63
|
+
}
|
|
64
|
+
exports.extensionCommandContributionSchema = Schema.Struct({
|
|
65
|
+
id: manifest_primitives_js_1.extensionContributionIdSchema,
|
|
66
|
+
title: manifest_primitives_js_1.extensionNonEmptyStringSchema.pipe(Schema.maxLength(constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.NAME_MAX_LENGTH)),
|
|
67
|
+
category: Schema.optional(manifest_primitives_js_1.extensionNonEmptyStringSchema.pipe(Schema.maxLength(constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.NAME_MAX_LENGTH))),
|
|
68
|
+
target: Schema.optional(targetSchema),
|
|
69
|
+
...brokerBindingSchema,
|
|
70
|
+
});
|
|
71
|
+
exports.extensionRouteContributionSchema = Schema.Struct({
|
|
72
|
+
id: manifest_primitives_js_1.extensionContributionIdSchema,
|
|
73
|
+
title: manifest_primitives_js_1.extensionNonEmptyStringSchema.pipe(Schema.maxLength(constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.NAME_MAX_LENGTH)),
|
|
74
|
+
runtime: manifest_primitives_js_1.extensionContributionRuntimeSchema,
|
|
75
|
+
execution: manifest_primitives_js_1.extensionExecutionPlacementSchema,
|
|
76
|
+
entry: manifest_primitives_js_1.extensionContributionEntryPathSchema,
|
|
77
|
+
target: Schema.optional(targetSchema),
|
|
78
|
+
matches: Schema.optional(matchSchema),
|
|
79
|
+
...brokerBindingSchema,
|
|
80
|
+
}).pipe(Schema.filter(validateEntryRuntime));
|
|
81
|
+
exports.extensionSlotContributionSchema = exports.extensionRouteContributionSchema;
|
|
82
|
+
exports.extensionContributionsSchema = Schema.Struct({
|
|
83
|
+
commands: Schema.optional(Schema.Array(exports.extensionCommandContributionSchema)),
|
|
84
|
+
slashCommands: Schema.optional(Schema.Array(exports.extensionCommandContributionSchema)),
|
|
85
|
+
routes: Schema.optional(Schema.Array(exports.extensionRouteContributionSchema)),
|
|
86
|
+
settingsSections: Schema.optional(Schema.Array(exports.extensionSlotContributionSchema)),
|
|
87
|
+
sidePanels: Schema.optional(Schema.Array(exports.extensionSlotContributionSchema)),
|
|
88
|
+
dialogs: Schema.optional(Schema.Array(exports.extensionSlotContributionSchema)),
|
|
89
|
+
transcriptRenderers: Schema.optional(Schema.Array(exports.extensionSlotContributionSchema)),
|
|
90
|
+
toolRenderers: Schema.optional(Schema.Array(exports.extensionSlotContributionSchema)),
|
|
91
|
+
customMessageRenderers: Schema.optional(Schema.Array(exports.extensionSlotContributionSchema)),
|
|
92
|
+
interactionRenderers: Schema.optional(Schema.Array(exports.extensionSlotContributionSchema)),
|
|
93
|
+
statusWidgets: Schema.optional(Schema.Array(exports.extensionSlotContributionSchema)),
|
|
94
|
+
});
|
|
95
|
+
exports.extensionCommandContributionRegistrationSchema = Schema.Struct({
|
|
96
|
+
family: manifest_primitives_js_1.extensionCommandContributionFamilySchema,
|
|
97
|
+
contribution: exports.extensionCommandContributionSchema,
|
|
98
|
+
});
|
|
99
|
+
exports.extensionRouteContributionRegistrationSchema = Schema.Struct({
|
|
100
|
+
family: Schema.Literal(constants_js_1.OPENWAGGLE_EXTENSION.CONTRIBUTION_FAMILY.ROUTES),
|
|
101
|
+
contribution: exports.extensionRouteContributionSchema,
|
|
102
|
+
});
|
|
103
|
+
exports.extensionSlotContributionRegistrationSchema = Schema.Struct({
|
|
104
|
+
family: manifest_primitives_js_1.extensionSlotContributionFamilySchema,
|
|
105
|
+
contribution: exports.extensionSlotContributionSchema,
|
|
106
|
+
});
|
|
107
|
+
exports.extensionContributionRegistrationSchema = Schema.Union(exports.extensionCommandContributionRegistrationSchema, exports.extensionRouteContributionRegistrationSchema, exports.extensionSlotContributionRegistrationSchema);
|
|
108
|
+
exports.extensionContributionUnregistrationSchema = Schema.Struct({
|
|
109
|
+
family: manifest_primitives_js_1.extensionContributionFamilySchema,
|
|
110
|
+
contributionId: manifest_primitives_js_1.extensionContributionIdSchema,
|
|
111
|
+
});
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.extensionSlotContributionFamilySchema = exports.extensionCommandContributionFamilySchema = exports.extensionContributionFamilySchema = exports.extensionExecutionPlacementSchema = exports.extensionContributionRuntimeSchema = exports.extensionCapabilityScopeSchema = exports.extensionContributionEntryPathSchema = exports.extensionRelativePathSchema = exports.extensionSemverVersionSchema = exports.extensionContributionIdSchema = exports.extensionIdSchema = exports.extensionNonEmptyStringSchema = void 0;
|
|
37
|
+
exports.isBuildCommand = isBuildCommand;
|
|
38
|
+
exports.isRuntimeRequirementBinary = isRuntimeRequirementBinary;
|
|
39
|
+
exports.isNetworkOrigin = isNetworkOrigin;
|
|
40
|
+
exports.validateBrokerCapabilityDeclaration = validateBrokerCapabilityDeclaration;
|
|
41
|
+
const Schema = __importStar(require("effect/Schema"));
|
|
42
|
+
const constants_js_1 = require("./constants.js");
|
|
43
|
+
exports.extensionNonEmptyStringSchema = Schema.String.pipe(Schema.minLength(1), Schema.filter((value) => value.trim().length > 0 || 'Must not be empty.'));
|
|
44
|
+
function isExtensionId(value) {
|
|
45
|
+
if (value.length > constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.ID_MAX_LENGTH) {
|
|
46
|
+
return `Must be at most ${constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.ID_MAX_LENGTH} characters.`;
|
|
47
|
+
}
|
|
48
|
+
return (constants_js_1.OPENWAGGLE_EXTENSION.PATTERNS.ID.test(value) ||
|
|
49
|
+
'Use lowercase letters, numbers, dots, underscores, and dashes; start with a letter or number.');
|
|
50
|
+
}
|
|
51
|
+
function isContributionId(value) {
|
|
52
|
+
if (value.length > constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.CONTRIBUTION_ID_MAX_LENGTH) {
|
|
53
|
+
return `Must be at most ${constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.CONTRIBUTION_ID_MAX_LENGTH} characters.`;
|
|
54
|
+
}
|
|
55
|
+
return (constants_js_1.OPENWAGGLE_EXTENSION.PATTERNS.CONTRIBUTION_ID.test(value) ||
|
|
56
|
+
'Use lowercase letters, numbers, dots, underscores, dashes, and forward slashes; start with a letter or number.');
|
|
57
|
+
}
|
|
58
|
+
function isSemverVersion(value) {
|
|
59
|
+
return (constants_js_1.OPENWAGGLE_EXTENSION.PATTERNS.SEMVER_VERSION.test(value) ||
|
|
60
|
+
'Must be a semantic version such as 1.2.3.');
|
|
61
|
+
}
|
|
62
|
+
function isPortableRelativePath(value) {
|
|
63
|
+
const trimmed = value.trim();
|
|
64
|
+
if (trimmed.length === 0)
|
|
65
|
+
return 'Must not be empty.';
|
|
66
|
+
if (value !== trimmed)
|
|
67
|
+
return 'Must not have leading or trailing whitespace.';
|
|
68
|
+
if (trimmed.length > constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.RELATIVE_PATH_MAX_LENGTH) {
|
|
69
|
+
return `Must be at most ${constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.RELATIVE_PATH_MAX_LENGTH} characters.`;
|
|
70
|
+
}
|
|
71
|
+
if (trimmed.includes(constants_js_1.OPENWAGGLE_EXTENSION.PATH.NUL_CHARACTER)) {
|
|
72
|
+
return 'Must not contain NUL bytes.';
|
|
73
|
+
}
|
|
74
|
+
if (trimmed.startsWith(constants_js_1.OPENWAGGLE_EXTENSION.PATH.POSIX_SEPARATOR) ||
|
|
75
|
+
trimmed.startsWith(constants_js_1.OPENWAGGLE_EXTENSION.PATH.WINDOWS_SEPARATOR) ||
|
|
76
|
+
constants_js_1.OPENWAGGLE_EXTENSION.PATTERNS.WINDOWS_ABSOLUTE_PATH.test(trimmed)) {
|
|
77
|
+
return 'Must be relative to the extension package root.';
|
|
78
|
+
}
|
|
79
|
+
const segments = trimmed
|
|
80
|
+
.replaceAll(constants_js_1.OPENWAGGLE_EXTENSION.PATH.WINDOWS_SEPARATOR, constants_js_1.OPENWAGGLE_EXTENSION.PATH.POSIX_SEPARATOR)
|
|
81
|
+
.split(constants_js_1.OPENWAGGLE_EXTENSION.PATH.POSIX_SEPARATOR);
|
|
82
|
+
return (!segments.some((segment) => segment.length === 0 ||
|
|
83
|
+
segment === constants_js_1.OPENWAGGLE_EXTENSION.PATH.CURRENT_DIRECTORY_SEGMENT ||
|
|
84
|
+
segment === constants_js_1.OPENWAGGLE_EXTENSION.PATH.RELATIVE_PARENT_SEGMENT) || 'Must not contain empty, "." or ".." path segments.');
|
|
85
|
+
}
|
|
86
|
+
function isBuildCommand(value) {
|
|
87
|
+
if (value.length > constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.BUILD_COMMAND_MAX_LENGTH) {
|
|
88
|
+
return `Must be at most ${constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.BUILD_COMMAND_MAX_LENGTH} characters.`;
|
|
89
|
+
}
|
|
90
|
+
if (value.includes(constants_js_1.OPENWAGGLE_EXTENSION.PATH.NUL_CHARACTER)) {
|
|
91
|
+
return 'Must not contain NUL bytes.';
|
|
92
|
+
}
|
|
93
|
+
return (!value.includes('\n') && !value.includes('\r')) || 'Must be a single command line.';
|
|
94
|
+
}
|
|
95
|
+
function isRuntimeRequirementBinary(value) {
|
|
96
|
+
const trimmed = value.trim();
|
|
97
|
+
if (value !== trimmed)
|
|
98
|
+
return 'Must not have leading or trailing whitespace.';
|
|
99
|
+
if (value.length > constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.RUNTIME_REQUIREMENT_BINARY_MAX_LENGTH) {
|
|
100
|
+
return `Must be at most ${constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.RUNTIME_REQUIREMENT_BINARY_MAX_LENGTH} characters.`;
|
|
101
|
+
}
|
|
102
|
+
if (value.includes(constants_js_1.OPENWAGGLE_EXTENSION.PATH.NUL_CHARACTER)) {
|
|
103
|
+
return 'Must not contain NUL bytes.';
|
|
104
|
+
}
|
|
105
|
+
if (value.includes('\n') || value.includes('\r'))
|
|
106
|
+
return 'Must be a single executable name.';
|
|
107
|
+
return ((!value.includes(constants_js_1.OPENWAGGLE_EXTENSION.PATH.POSIX_SEPARATOR) &&
|
|
108
|
+
!value.includes(constants_js_1.OPENWAGGLE_EXTENSION.PATH.WINDOWS_SEPARATOR)) ||
|
|
109
|
+
'Must be an executable name, not a path.');
|
|
110
|
+
}
|
|
111
|
+
function isNetworkOrigin(value) {
|
|
112
|
+
const trimmed = value.trim();
|
|
113
|
+
if (value !== trimmed)
|
|
114
|
+
return 'Must not have leading or trailing whitespace.';
|
|
115
|
+
if (value.length > constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.NETWORK_ORIGIN_MAX_LENGTH) {
|
|
116
|
+
return `Must be at most ${constants_js_1.OPENWAGGLE_EXTENSION.LIMITS.NETWORK_ORIGIN_MAX_LENGTH} characters.`;
|
|
117
|
+
}
|
|
118
|
+
let url;
|
|
119
|
+
try {
|
|
120
|
+
url = new URL(value);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return 'Must be a valid URL origin.';
|
|
124
|
+
}
|
|
125
|
+
if (url.protocol !== 'https:')
|
|
126
|
+
return 'Must use https.';
|
|
127
|
+
return (url.origin === value ||
|
|
128
|
+
'Must be an exact origin without a path, query, fragment, or trailing slash.');
|
|
129
|
+
}
|
|
130
|
+
function validateBrokerCapabilityDeclaration(declaration) {
|
|
131
|
+
const supportedMethods = constants_js_1.OPENWAGGLE_EXTENSION_BROKER.CAPABILITY_METHODS.find((descriptor) => descriptor.capability === declaration.id)?.methods ?? null;
|
|
132
|
+
if (supportedMethods === null)
|
|
133
|
+
return true;
|
|
134
|
+
if (declaration.methods === undefined || declaration.methods.length === 0) {
|
|
135
|
+
return `Built-in broker capability "${declaration.id}" must declare at least one supported method.`;
|
|
136
|
+
}
|
|
137
|
+
const unsupportedMethod = declaration.methods.find((declaredMethod) => !supportedMethods.some((method) => method === declaredMethod));
|
|
138
|
+
return (unsupportedMethod === undefined ||
|
|
139
|
+
`Built-in broker capability "${declaration.id}" does not support method "${unsupportedMethod}".`);
|
|
140
|
+
}
|
|
141
|
+
function isNotRuntimeModuleContextEntryPath(value) {
|
|
142
|
+
const [firstSegment] = value
|
|
143
|
+
.replaceAll(constants_js_1.OPENWAGGLE_EXTENSION.PATH.WINDOWS_SEPARATOR, constants_js_1.OPENWAGGLE_EXTENSION.PATH.POSIX_SEPARATOR)
|
|
144
|
+
.split(constants_js_1.OPENWAGGLE_EXTENSION.PATH.POSIX_SEPARATOR);
|
|
145
|
+
return (firstSegment !== constants_js_1.OPENWAGGLE_EXTENSION.RUNTIME_MODULE_PROTOCOL.MODULE_CONTEXT_SEGMENT ||
|
|
146
|
+
`Must not start with the reserved "${constants_js_1.OPENWAGGLE_EXTENSION.RUNTIME_MODULE_PROTOCOL.MODULE_CONTEXT_SEGMENT}" runtime module path segment.`);
|
|
147
|
+
}
|
|
148
|
+
exports.extensionIdSchema = Schema.String.pipe(Schema.minLength(1), Schema.filter(isExtensionId));
|
|
149
|
+
exports.extensionContributionIdSchema = Schema.String.pipe(Schema.minLength(1), Schema.filter(isContributionId));
|
|
150
|
+
exports.extensionSemverVersionSchema = Schema.String.pipe(Schema.minLength(1), Schema.filter(isSemverVersion));
|
|
151
|
+
exports.extensionRelativePathSchema = Schema.String.pipe(Schema.minLength(1), Schema.filter(isPortableRelativePath));
|
|
152
|
+
exports.extensionContributionEntryPathSchema = exports.extensionRelativePathSchema.pipe(Schema.filter(isNotRuntimeModuleContextEntryPath));
|
|
153
|
+
exports.extensionCapabilityScopeSchema = Schema.Literal(...constants_js_1.OPENWAGGLE_EXTENSION.CAPABILITY_SCOPES);
|
|
154
|
+
exports.extensionContributionRuntimeSchema = Schema.Literal(...constants_js_1.OPENWAGGLE_EXTENSION.CONTRIBUTION_RUNTIMES);
|
|
155
|
+
exports.extensionExecutionPlacementSchema = Schema.Literal(...constants_js_1.OPENWAGGLE_EXTENSION.EXECUTION_PLACEMENTS);
|
|
156
|
+
exports.extensionContributionFamilySchema = Schema.Literal(...constants_js_1.OPENWAGGLE_EXTENSION.CONTRIBUTION_FAMILIES);
|
|
157
|
+
exports.extensionCommandContributionFamilySchema = Schema.Literal(...constants_js_1.OPENWAGGLE_EXTENSION.COMMAND_CONTRIBUTION_FAMILIES);
|
|
158
|
+
exports.extensionSlotContributionFamilySchema = Schema.Literal(...constants_js_1.OPENWAGGLE_EXTENSION.SLOT_CONTRIBUTION_FAMILIES);
|