@sorbetai/plugins 0.0.0-stage → 0.1.0-alpha.16
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 +1179 -2
- package/dist/LICENSE.worker.acorn +21 -0
- package/dist/LICENSE.worker.acorn-walk +21 -0
- package/dist/LICENSE.worker.effect +21 -0
- package/dist/LICENSE.worker.ensure-error +9 -0
- package/dist/LICENSE.worker.es-toolkit +21 -0
- package/dist/LICENSE.worker.pi-schema.typebox +23 -0
- package/dist/authority-BWlX47zt.d.ts +547 -0
- package/dist/authority-Ci--C1Np.js +4667 -0
- package/dist/context-i4UGSmNB.d.ts +1326 -0
- package/dist/data-schema-CHZWAtoX.js +185 -0
- package/dist/facet-C9IwWGl5.d.ts +178 -0
- package/dist/index-NehD_iIX.d.ts +610 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1400 -0
- package/dist/isolate-worker.d.mts +1 -0
- package/dist/isolate-worker.mjs +180791 -0
- package/dist/model.d.ts +27 -0
- package/dist/model.js +274 -0
- package/dist/node.d.ts +273 -0
- package/dist/node.js +2844 -0
- package/dist/object-borrow-C81Gj5tq.js +488 -0
- package/dist/object-invocation-DC6PCiFY.js +15 -0
- package/dist/object-invocation-DMnRagqW.d.ts +13 -0
- package/dist/object-method-Bs7hYSjS.js +69 -0
- package/dist/objects-DdioT9PR.js +113 -0
- package/dist/remote.d.ts +39 -0
- package/dist/remote.js +899 -0
- package/dist/run-yield-B1AE7-PN.js +16 -0
- package/dist/source-Ns6MY6kd.d.ts +214 -0
- package/dist/view-Cn9jz2Wx.js +73 -0
- package/package.json +53 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2012-2022 by various contributors (see AUTHORS)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2012-2020 by various contributors (see AUTHORS)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Effectful Technologies Inc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Viva Republica, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
TypeBox
|
|
2
|
+
|
|
3
|
+
The MIT License (MIT)
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2017-2026 Haydn Paterson
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
import { _n as ReadonlyJsonValue } from "./context-i4UGSmNB.js";
|
|
2
|
+
import * as s from "@earendil-works/pi-schema";
|
|
3
|
+
import * as _sorbetai_schema60 from "@sorbetai/schema";
|
|
4
|
+
import { DeepReadonly } from "es-toolkit/types";
|
|
5
|
+
|
|
6
|
+
//#region src/package/config.d.ts
|
|
7
|
+
interface ConfigAnnotations {
|
|
8
|
+
readonly title?: string;
|
|
9
|
+
readonly description?: string;
|
|
10
|
+
readonly default?: ReadonlyJsonValue;
|
|
11
|
+
readonly enum?: readonly ReadonlyJsonValue[];
|
|
12
|
+
}
|
|
13
|
+
type PluginConfigSchema = ConfigAnnotations & ({
|
|
14
|
+
readonly type: 'string';
|
|
15
|
+
readonly minLength?: number;
|
|
16
|
+
readonly maxLength?: number;
|
|
17
|
+
} | {
|
|
18
|
+
readonly type: 'number' | 'integer';
|
|
19
|
+
readonly minimum?: number;
|
|
20
|
+
readonly maximum?: number;
|
|
21
|
+
} | {
|
|
22
|
+
readonly type: 'boolean' | 'null';
|
|
23
|
+
} | {
|
|
24
|
+
readonly type: 'array';
|
|
25
|
+
readonly items: PluginConfigSchema;
|
|
26
|
+
readonly minItems?: number;
|
|
27
|
+
readonly maxItems?: number;
|
|
28
|
+
} | {
|
|
29
|
+
readonly type: 'object';
|
|
30
|
+
readonly properties: Readonly<Record<string, PluginConfigSchema>>;
|
|
31
|
+
readonly required?: readonly string[];
|
|
32
|
+
readonly additionalProperties: false;
|
|
33
|
+
});
|
|
34
|
+
declare class PluginConfigError extends Error {
|
|
35
|
+
readonly code: 'invalid-schema' | 'invalid-default' | 'invalid-config' | 'expansion-limit';
|
|
36
|
+
constructor(code: 'invalid-schema' | 'invalid-default' | 'invalid-config' | 'expansion-limit');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Applies only declared defaults to a detached JSON snapshot; never coerces or removes
|
|
40
|
+
* input fields. Missing objects are not invented. Explicit null is not absence.
|
|
41
|
+
* Returns deterministic data for admission and recovery without invoking author code.
|
|
42
|
+
*/
|
|
43
|
+
declare function materializePluginConfig(schema: PluginConfigSchema, input?: ReadonlyJsonValue): ReadonlyJsonValue;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/package/format.d.ts
|
|
46
|
+
|
|
47
|
+
declare const PluginPackageDocumentSchema: s.Schema<{
|
|
48
|
+
formatVersion: 1;
|
|
49
|
+
manifest: {
|
|
50
|
+
name: string;
|
|
51
|
+
version: string;
|
|
52
|
+
abi: string;
|
|
53
|
+
componentId: string;
|
|
54
|
+
entrypoint: string;
|
|
55
|
+
configSchema: (ConfigAnnotations & {
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
readonly minLength?: number;
|
|
58
|
+
readonly maxLength?: number;
|
|
59
|
+
}) | (ConfigAnnotations & {
|
|
60
|
+
readonly type: "number" | "integer";
|
|
61
|
+
readonly minimum?: number;
|
|
62
|
+
readonly maximum?: number;
|
|
63
|
+
}) | (ConfigAnnotations & {
|
|
64
|
+
readonly type: "boolean" | "null";
|
|
65
|
+
}) | (ConfigAnnotations & {
|
|
66
|
+
readonly type: "array";
|
|
67
|
+
readonly items: PluginConfigSchema;
|
|
68
|
+
readonly minItems?: number;
|
|
69
|
+
readonly maxItems?: number;
|
|
70
|
+
}) | (ConfigAnnotations & {
|
|
71
|
+
readonly type: "object";
|
|
72
|
+
readonly properties: Readonly<Record<string, PluginConfigSchema>>;
|
|
73
|
+
readonly required?: readonly string[];
|
|
74
|
+
readonly additionalProperties: false;
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
files: {
|
|
78
|
+
path: string;
|
|
79
|
+
content: string;
|
|
80
|
+
}[];
|
|
81
|
+
}>;
|
|
82
|
+
type PackageDocumentData = s.Static<typeof PluginPackageDocumentSchema>;
|
|
83
|
+
type PluginPackageDocument = Readonly<Omit<PackageDocumentData, 'manifest' | 'files'>> & {
|
|
84
|
+
readonly manifest: Readonly<PackageDocumentData['manifest']>;
|
|
85
|
+
readonly files: readonly Readonly<PackageDocumentData['files'][number]>[];
|
|
86
|
+
};
|
|
87
|
+
/** Caller-owned bytes; the installing owner retains these bytes. */
|
|
88
|
+
interface StoredPluginPackage {
|
|
89
|
+
readonly packageId: string;
|
|
90
|
+
readonly bytes: Uint8Array;
|
|
91
|
+
}
|
|
92
|
+
declare class PluginPackageFormatError extends Error {
|
|
93
|
+
readonly code: 'format' | 'quota';
|
|
94
|
+
/** `quota` reports a bounded Host resource limit, `format` reports the package bytes themselves. */
|
|
95
|
+
constructor(message: string, code?: 'format' | 'quota');
|
|
96
|
+
}
|
|
97
|
+
/** Creates an installation identity and its UTF-8 container without evaluating code. */
|
|
98
|
+
declare function encodePluginPackage(input: PluginPackageDocument): Promise<StoredPluginPackage>;
|
|
99
|
+
/** Decodes the package representation and its supported module/configuration profile. */
|
|
100
|
+
declare function decodePluginPackage(input: StoredPluginPackage): Promise<PluginPackageDocument>;
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/package/modules.d.ts
|
|
103
|
+
interface PluginModuleInspection {
|
|
104
|
+
readonly packageId: string;
|
|
105
|
+
readonly profile: 'sorbet.esm2022/v1';
|
|
106
|
+
readonly entrypoint: string;
|
|
107
|
+
readonly modules: readonly {
|
|
108
|
+
readonly path: string;
|
|
109
|
+
readonly imports: readonly {
|
|
110
|
+
readonly specifier: string;
|
|
111
|
+
readonly target: string;
|
|
112
|
+
readonly kind: 'static' | 'dynamic';
|
|
113
|
+
}[];
|
|
114
|
+
}[];
|
|
115
|
+
}
|
|
116
|
+
declare class PluginModuleError extends Error {
|
|
117
|
+
readonly code: 'invalid-syntax' | 'unsupported-import' | 'missing-module' | 'unsupported-module' | 'missing-default-export';
|
|
118
|
+
readonly modulePath: string;
|
|
119
|
+
constructor(code: 'invalid-syntax' | 'unsupported-import' | 'missing-module' | 'unsupported-module' | 'missing-default-export', modulePath: string);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Inspects the decoded package without evaluating code or resolving Host paths.
|
|
123
|
+
* The result describes explicit ESM imports for managed module resolution.
|
|
124
|
+
*/
|
|
125
|
+
declare function inspectPluginModules(input: StoredPluginPackage, document?: PluginPackageDocument): Promise<PluginModuleInspection>;
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/package/profile.d.ts
|
|
128
|
+
/** Trusted Host policy; inspection must not evaluate author code or resolve ambient files. */
|
|
129
|
+
interface PluginPackageInspector {
|
|
130
|
+
readonly abi: string;
|
|
131
|
+
readonly sourceProfile: string;
|
|
132
|
+
inspect(record: StoredPluginPackage, document: PluginPackageDocument): Promise<void>;
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/authority/desired.d.ts
|
|
136
|
+
declare const AuthoredPluginEntrySchema: s.Schema<{
|
|
137
|
+
enabled: boolean;
|
|
138
|
+
parentId: string | null;
|
|
139
|
+
order: number;
|
|
140
|
+
entryId: string;
|
|
141
|
+
packageId: string;
|
|
142
|
+
config?: string | number | boolean | _sorbetai_schema60.JsonArray | _sorbetai_schema60.JsonObject | null | undefined;
|
|
143
|
+
}>;
|
|
144
|
+
declare const CompositionMutationSchema: s.Schema<{
|
|
145
|
+
kind: "add";
|
|
146
|
+
entry: {
|
|
147
|
+
enabled: boolean;
|
|
148
|
+
parentId: string | null;
|
|
149
|
+
order: number;
|
|
150
|
+
entryId: string;
|
|
151
|
+
packageId: string;
|
|
152
|
+
config?: string | number | boolean | _sorbetai_schema60.JsonArray | _sorbetai_schema60.JsonObject | null | undefined;
|
|
153
|
+
};
|
|
154
|
+
} | {
|
|
155
|
+
kind: "configure";
|
|
156
|
+
entryId: string;
|
|
157
|
+
config?: string | number | boolean | _sorbetai_schema60.JsonArray | _sorbetai_schema60.JsonObject | null | undefined;
|
|
158
|
+
} | {
|
|
159
|
+
kind: "replace";
|
|
160
|
+
entryId: string;
|
|
161
|
+
packageId: string;
|
|
162
|
+
} | {
|
|
163
|
+
parentId: string | null;
|
|
164
|
+
order: number;
|
|
165
|
+
kind: "move";
|
|
166
|
+
entryId: string;
|
|
167
|
+
} | {
|
|
168
|
+
kind: "set-enabled";
|
|
169
|
+
entryId: string;
|
|
170
|
+
enabled: boolean;
|
|
171
|
+
} | {
|
|
172
|
+
kind: "remove";
|
|
173
|
+
entryId: string;
|
|
174
|
+
}>;
|
|
175
|
+
type ReadonlyMutation<T> = T extends {
|
|
176
|
+
kind: 'add';
|
|
177
|
+
} ? Readonly<Omit<T, 'entry'>> & {
|
|
178
|
+
readonly entry: Readonly<AuthoredEntry>;
|
|
179
|
+
} : T extends {
|
|
180
|
+
kind: 'configure';
|
|
181
|
+
} ? Readonly<Omit<T, 'config'>> & {
|
|
182
|
+
readonly config?: ReadonlyJsonValue;
|
|
183
|
+
} : Readonly<T>;
|
|
184
|
+
type PluginCompositionMutation = ReadonlyMutation<s.Static<typeof CompositionMutationSchema>>;
|
|
185
|
+
declare const DesiredPluginPatchSchema: s.Schema<{
|
|
186
|
+
commandId: string;
|
|
187
|
+
baseGeneration: number;
|
|
188
|
+
mutations: ({
|
|
189
|
+
kind: "add";
|
|
190
|
+
entry: {
|
|
191
|
+
enabled: boolean;
|
|
192
|
+
parentId: string | null;
|
|
193
|
+
order: number;
|
|
194
|
+
entryId: string;
|
|
195
|
+
packageId: string;
|
|
196
|
+
config?: string | number | boolean | _sorbetai_schema60.JsonArray | _sorbetai_schema60.JsonObject | null | undefined;
|
|
197
|
+
};
|
|
198
|
+
} | {
|
|
199
|
+
kind: "configure";
|
|
200
|
+
entryId: string;
|
|
201
|
+
config?: string | number | boolean | _sorbetai_schema60.JsonArray | _sorbetai_schema60.JsonObject | null | undefined;
|
|
202
|
+
} | {
|
|
203
|
+
kind: "replace";
|
|
204
|
+
entryId: string;
|
|
205
|
+
packageId: string;
|
|
206
|
+
} | {
|
|
207
|
+
parentId: string | null;
|
|
208
|
+
order: number;
|
|
209
|
+
kind: "move";
|
|
210
|
+
entryId: string;
|
|
211
|
+
} | {
|
|
212
|
+
kind: "set-enabled";
|
|
213
|
+
entryId: string;
|
|
214
|
+
enabled: boolean;
|
|
215
|
+
} | {
|
|
216
|
+
kind: "remove";
|
|
217
|
+
entryId: string;
|
|
218
|
+
})[];
|
|
219
|
+
}>;
|
|
220
|
+
type DesiredPluginPatch = s.Static<typeof DesiredPluginPatchSchema>;
|
|
221
|
+
interface PluginCompositionBatch {
|
|
222
|
+
readonly sequence: number;
|
|
223
|
+
readonly mutations: readonly PluginCompositionMutation[];
|
|
224
|
+
}
|
|
225
|
+
interface AuthoredPluginComposition {
|
|
226
|
+
readonly sequence: number;
|
|
227
|
+
readonly entries: readonly Readonly<AuthoredEntry>[];
|
|
228
|
+
}
|
|
229
|
+
interface AuthoredEntry extends Omit<s.Static<typeof AuthoredPluginEntrySchema>, 'config'> {
|
|
230
|
+
config?: ReadonlyJsonValue;
|
|
231
|
+
}
|
|
232
|
+
interface DesiredPluginEntry {
|
|
233
|
+
readonly entryId: string;
|
|
234
|
+
readonly packageId: string;
|
|
235
|
+
readonly parentId: string | null;
|
|
236
|
+
readonly order: number;
|
|
237
|
+
readonly enabled: boolean;
|
|
238
|
+
readonly effectiveEnabled: boolean;
|
|
239
|
+
readonly config: ReadonlyJsonValue;
|
|
240
|
+
}
|
|
241
|
+
interface DesiredPluginComposition {
|
|
242
|
+
readonly sequence: number;
|
|
243
|
+
/** Flat parent references, ordered by explicit order then entry id; not activation order. */
|
|
244
|
+
readonly entries: readonly DesiredPluginEntry[];
|
|
245
|
+
}
|
|
246
|
+
declare class PluginCompositionError extends Error {
|
|
247
|
+
readonly code: 'invalid-history' | 'input-limit' | 'invalid-sequence' | 'duplicate-package' | 'duplicate-entry' | 'missing-entry' | 'missing-package' | 'missing-parent' | 'parent-cycle';
|
|
248
|
+
constructor(code: 'invalid-history' | 'input-limit' | 'invalid-sequence' | 'duplicate-package' | 'duplicate-entry' | 'missing-entry' | 'missing-package' | 'missing-parent' | 'parent-cycle');
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Replays detached inputs without IO or author evaluation. Each batch must leave a
|
|
252
|
+
* valid tree; references/configuration are checked after its last mutation. This
|
|
253
|
+
* does not register Packages, authorize commands, or publish executable revisions.
|
|
254
|
+
*/
|
|
255
|
+
declare function projectPluginComposition(packages: readonly StoredPluginPackage[], history: readonly PluginCompositionBatch[]): Promise<DesiredPluginComposition>;
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/authority/execution-reference.d.ts
|
|
258
|
+
declare const ExecutionReferenceSchema: s.Schema<{
|
|
259
|
+
schemaVersion: 1;
|
|
260
|
+
authorityId: string;
|
|
261
|
+
compositionSequence: number;
|
|
262
|
+
entryId: string;
|
|
263
|
+
packageId: string;
|
|
264
|
+
}>;
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/authority/commands.d.ts
|
|
267
|
+
declare const PluginAuthorityCheckpointSchema: s.Schema<{
|
|
268
|
+
schemaVersion: 1;
|
|
269
|
+
authorityId: string;
|
|
270
|
+
sequence: number;
|
|
271
|
+
composition: {
|
|
272
|
+
sequence: number;
|
|
273
|
+
entries: {
|
|
274
|
+
enabled: boolean;
|
|
275
|
+
parentId: string | null;
|
|
276
|
+
order: number;
|
|
277
|
+
entryId: string;
|
|
278
|
+
packageId: string;
|
|
279
|
+
config?: string | number | boolean | _sorbetai_schema60.JsonArray | _sorbetai_schema60.JsonObject | null | undefined;
|
|
280
|
+
}[];
|
|
281
|
+
};
|
|
282
|
+
registrations: {
|
|
283
|
+
packageId: string;
|
|
284
|
+
sourceProfile: string;
|
|
285
|
+
retired: boolean;
|
|
286
|
+
}[];
|
|
287
|
+
revocations: {
|
|
288
|
+
issuerId: string;
|
|
289
|
+
reason: "operator" | "policy" | "compromised";
|
|
290
|
+
policyVersion: 1;
|
|
291
|
+
packageId: string;
|
|
292
|
+
}[];
|
|
293
|
+
}>;
|
|
294
|
+
type CheckpointData = s.Static<typeof PluginAuthorityCheckpointSchema>;
|
|
295
|
+
type PluginAuthorityCheckpoint = Readonly<Omit<CheckpointData, 'composition' | 'registrations' | 'revocations'>> & {
|
|
296
|
+
readonly composition: AuthoredPluginComposition;
|
|
297
|
+
readonly registrations: readonly Readonly<CheckpointData['registrations'][number]>[];
|
|
298
|
+
readonly revocations: readonly Readonly<CheckpointData['revocations'][number]>[];
|
|
299
|
+
};
|
|
300
|
+
declare const CompositionCommandSchema: s.Schema<{
|
|
301
|
+
commandId: string;
|
|
302
|
+
idempotencyKey: string;
|
|
303
|
+
baseSequence: number;
|
|
304
|
+
action: {
|
|
305
|
+
issuerId: string;
|
|
306
|
+
reason: "operator" | "policy" | "compromised";
|
|
307
|
+
policyVersion: 1;
|
|
308
|
+
packageId: string;
|
|
309
|
+
kind: "revoke-package";
|
|
310
|
+
} | {
|
|
311
|
+
kind: "register";
|
|
312
|
+
packageId: string;
|
|
313
|
+
} | {
|
|
314
|
+
kind: "apply";
|
|
315
|
+
mutations: ({
|
|
316
|
+
kind: "add";
|
|
317
|
+
entry: {
|
|
318
|
+
enabled: boolean;
|
|
319
|
+
parentId: string | null;
|
|
320
|
+
order: number;
|
|
321
|
+
entryId: string;
|
|
322
|
+
packageId: string;
|
|
323
|
+
config?: string | number | boolean | _sorbetai_schema60.JsonArray | _sorbetai_schema60.JsonObject | null | undefined;
|
|
324
|
+
};
|
|
325
|
+
} | {
|
|
326
|
+
kind: "configure";
|
|
327
|
+
entryId: string;
|
|
328
|
+
config?: string | number | boolean | _sorbetai_schema60.JsonArray | _sorbetai_schema60.JsonObject | null | undefined;
|
|
329
|
+
} | {
|
|
330
|
+
kind: "replace";
|
|
331
|
+
entryId: string;
|
|
332
|
+
packageId: string;
|
|
333
|
+
} | {
|
|
334
|
+
parentId: string | null;
|
|
335
|
+
order: number;
|
|
336
|
+
kind: "move";
|
|
337
|
+
entryId: string;
|
|
338
|
+
} | {
|
|
339
|
+
kind: "set-enabled";
|
|
340
|
+
entryId: string;
|
|
341
|
+
enabled: boolean;
|
|
342
|
+
} | {
|
|
343
|
+
kind: "remove";
|
|
344
|
+
entryId: string;
|
|
345
|
+
})[];
|
|
346
|
+
};
|
|
347
|
+
}>;
|
|
348
|
+
declare const AcceptedSchema: s.Schema<{
|
|
349
|
+
kind: "package.registration.accepted" | "composition.command.accepted" | "security.revocation.command.accepted";
|
|
350
|
+
payload: {
|
|
351
|
+
commandId: string;
|
|
352
|
+
idempotencyKey: string;
|
|
353
|
+
baseSequence: number;
|
|
354
|
+
action: {
|
|
355
|
+
issuerId: string;
|
|
356
|
+
reason: "operator" | "policy" | "compromised";
|
|
357
|
+
policyVersion: 1;
|
|
358
|
+
packageId: string;
|
|
359
|
+
kind: "revoke-package";
|
|
360
|
+
} | {
|
|
361
|
+
kind: "register";
|
|
362
|
+
packageId: string;
|
|
363
|
+
} | {
|
|
364
|
+
kind: "apply";
|
|
365
|
+
mutations: ({
|
|
366
|
+
kind: "add";
|
|
367
|
+
entry: {
|
|
368
|
+
enabled: boolean;
|
|
369
|
+
parentId: string | null;
|
|
370
|
+
order: number;
|
|
371
|
+
entryId: string;
|
|
372
|
+
packageId: string;
|
|
373
|
+
config?: string | number | boolean | _sorbetai_schema60.JsonArray | _sorbetai_schema60.JsonObject | null | undefined;
|
|
374
|
+
};
|
|
375
|
+
} | {
|
|
376
|
+
kind: "configure";
|
|
377
|
+
entryId: string;
|
|
378
|
+
config?: string | number | boolean | _sorbetai_schema60.JsonArray | _sorbetai_schema60.JsonObject | null | undefined;
|
|
379
|
+
} | {
|
|
380
|
+
kind: "replace";
|
|
381
|
+
entryId: string;
|
|
382
|
+
packageId: string;
|
|
383
|
+
} | {
|
|
384
|
+
parentId: string | null;
|
|
385
|
+
order: number;
|
|
386
|
+
kind: "move";
|
|
387
|
+
entryId: string;
|
|
388
|
+
} | {
|
|
389
|
+
kind: "set-enabled";
|
|
390
|
+
entryId: string;
|
|
391
|
+
enabled: boolean;
|
|
392
|
+
} | {
|
|
393
|
+
kind: "remove";
|
|
394
|
+
entryId: string;
|
|
395
|
+
})[];
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
entryId: string;
|
|
399
|
+
authorityId: string;
|
|
400
|
+
commandId: string;
|
|
401
|
+
sequence: number;
|
|
402
|
+
timestamp: number;
|
|
403
|
+
schemaVersion: 2;
|
|
404
|
+
}>;
|
|
405
|
+
declare const ResultSchema: s.Schema<{
|
|
406
|
+
kind: "security.revocation.committed";
|
|
407
|
+
payload: {
|
|
408
|
+
issuerId: string;
|
|
409
|
+
reason: "operator" | "policy" | "compromised";
|
|
410
|
+
policyVersion: 1;
|
|
411
|
+
packageId: string;
|
|
412
|
+
};
|
|
413
|
+
entryId: string;
|
|
414
|
+
authorityId: string;
|
|
415
|
+
commandId: string;
|
|
416
|
+
sequence: number;
|
|
417
|
+
timestamp: number;
|
|
418
|
+
schemaVersion: 2;
|
|
419
|
+
} | {
|
|
420
|
+
kind: "package.registered";
|
|
421
|
+
payload: {
|
|
422
|
+
packageId: string;
|
|
423
|
+
sourceProfile: string;
|
|
424
|
+
};
|
|
425
|
+
entryId: string;
|
|
426
|
+
authorityId: string;
|
|
427
|
+
commandId: string;
|
|
428
|
+
sequence: number;
|
|
429
|
+
timestamp: number;
|
|
430
|
+
schemaVersion: 2;
|
|
431
|
+
} | {
|
|
432
|
+
kind: "composition.changed";
|
|
433
|
+
payload: {};
|
|
434
|
+
entryId: string;
|
|
435
|
+
authorityId: string;
|
|
436
|
+
commandId: string;
|
|
437
|
+
sequence: number;
|
|
438
|
+
timestamp: number;
|
|
439
|
+
schemaVersion: 2;
|
|
440
|
+
}>;
|
|
441
|
+
type CommandData = s.Static<typeof CompositionCommandSchema>;
|
|
442
|
+
type PluginCompositionCommand = Readonly<Omit<CommandData, 'action'>> & {
|
|
443
|
+
readonly action: Readonly<Exclude<CommandData['action'], {
|
|
444
|
+
kind: 'apply';
|
|
445
|
+
}>> | {
|
|
446
|
+
readonly kind: 'apply';
|
|
447
|
+
readonly mutations: readonly PluginCompositionMutation[];
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
type PluginCompositionJournalBatch = readonly [Readonly<Omit<s.Static<typeof AcceptedSchema>, 'payload'>> & {
|
|
451
|
+
readonly payload: PluginCompositionCommand;
|
|
452
|
+
}, DeepReadonly<s.Static<typeof ResultSchema>>];
|
|
453
|
+
type PluginAuthorityJournalBatch = PluginCompositionJournalBatch;
|
|
454
|
+
declare class PluginAuthorityError extends Error {
|
|
455
|
+
readonly code: 'invalid-data' | 'quota' | 'conflict' | 'stale-command' | 'unregistered-package' | 'expired-package' | 'revoked-package' | 'disabled-entry' | 'not-committed' | 'fenced' | 'closed';
|
|
456
|
+
constructor(code: 'invalid-data' | 'quota' | 'conflict' | 'stale-command' | 'unregistered-package' | 'expired-package' | 'revoked-package' | 'disabled-entry' | 'not-committed' | 'fenced' | 'closed');
|
|
457
|
+
}
|
|
458
|
+
//#endregion
|
|
459
|
+
//#region src/authority/store.d.ts
|
|
460
|
+
interface PluginCommitData {
|
|
461
|
+
readonly package?: StoredPluginPackage;
|
|
462
|
+
}
|
|
463
|
+
/** Each batch and its associated bytes become visible in the same durable transaction. */
|
|
464
|
+
interface PluginStore {
|
|
465
|
+
readonly authorityId: string;
|
|
466
|
+
/** Recent command receipts and every batch newer than the committed checkpoint. */
|
|
467
|
+
read(): Promise<readonly PluginAuthorityJournalBatch[]>;
|
|
468
|
+
readCheckpoint(): Promise<PluginAuthorityCheckpoint | undefined>;
|
|
469
|
+
readPackage(packageId: string): Promise<StoredPluginPackage | undefined>;
|
|
470
|
+
/** Receives admitted facts, captures caller-owned inputs before suspension, and enforces append order. */
|
|
471
|
+
append(batch: PluginAuthorityJournalBatch, data?: PluginCommitData): Promise<'committed' | 'not-committed' | 'unknown' | 'conflict'>;
|
|
472
|
+
reconcile(batch: PluginAuthorityJournalBatch): Promise<'committed' | 'absent' | 'unknown'>;
|
|
473
|
+
/** Atomically replace current state, collect retired bytes, and retain the latest retry receipts. */
|
|
474
|
+
compact(checkpoint: PluginAuthorityCheckpoint): Promise<'committed' | 'not-committed' | 'unknown' | 'conflict'>;
|
|
475
|
+
}
|
|
476
|
+
/** Process-lifetime implementation with the same atomic visibility as durable adapters. */
|
|
477
|
+
declare class MemoryPluginStore implements PluginStore {
|
|
478
|
+
#private;
|
|
479
|
+
readonly authorityId: string;
|
|
480
|
+
constructor(authorityId: string);
|
|
481
|
+
read(): Promise<readonly PluginAuthorityJournalBatch[]>;
|
|
482
|
+
readCheckpoint(): Promise<PluginAuthorityCheckpoint | undefined>;
|
|
483
|
+
readPackage(packageId: string): Promise<StoredPluginPackage | undefined>;
|
|
484
|
+
append(batch: PluginAuthorityJournalBatch, data?: PluginCommitData): Promise<'committed' | 'conflict'>;
|
|
485
|
+
reconcile(batch: PluginAuthorityJournalBatch): Promise<'committed' | 'absent'>;
|
|
486
|
+
compact(checkpoint: PluginAuthorityCheckpoint): Promise<'committed' | 'conflict'>;
|
|
487
|
+
}
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region src/authority/authority.d.ts
|
|
490
|
+
interface PluginCompositionAuthorityOptions {
|
|
491
|
+
readonly store: PluginStore;
|
|
492
|
+
readonly createId: () => string;
|
|
493
|
+
readonly now: () => number;
|
|
494
|
+
/** Explicit non-native profiles; provide the same profile implementations to the loader. */
|
|
495
|
+
readonly packageProfiles?: readonly PluginPackageInspector[];
|
|
496
|
+
}
|
|
497
|
+
/** Current Desired input reference, not an execution grant or a historical executor key. */
|
|
498
|
+
type PluginExecutionReference = Readonly<s.Static<typeof ExecutionReferenceSchema>>;
|
|
499
|
+
interface PackageDetails {
|
|
500
|
+
readonly document: PluginPackageDocument;
|
|
501
|
+
readonly graph: PluginModuleInspection | undefined;
|
|
502
|
+
readonly sourceProfile: string;
|
|
503
|
+
}
|
|
504
|
+
/** Trusted Host command owner; author evaluation and executable residency belong to the Platform. */
|
|
505
|
+
declare class PluginCompositionAuthority {
|
|
506
|
+
#private;
|
|
507
|
+
/** Coalesced hints, including failed writes and close; reread status in the callback.
|
|
508
|
+
* Delivery is asynchronous. Unsubscribe suppresses queued delivery; observer throws cannot
|
|
509
|
+
* change command results. This port owns no executable Plugin or Effect resources. */
|
|
510
|
+
subscribeInvalidation(observer: () => void): () => void;
|
|
511
|
+
private constructor();
|
|
512
|
+
static open(options: PluginCompositionAuthorityOptions): Promise<PluginCompositionAuthority>;
|
|
513
|
+
/** Shares deeply frozen Desired; a fenced owner must not authorize execution from it. */
|
|
514
|
+
status(): {
|
|
515
|
+
sequence: number;
|
|
516
|
+
desired: DesiredPluginComposition;
|
|
517
|
+
fenced: boolean;
|
|
518
|
+
closed: boolean;
|
|
519
|
+
};
|
|
520
|
+
/** Shared deeply frozen Package metadata, including the inspected module graph. */
|
|
521
|
+
packageDetails(packageId: string): PackageDetails;
|
|
522
|
+
/** Revocation changes admission independently of Desired and executor residency. */
|
|
523
|
+
revokePackage(command: PluginCompositionCommand): Promise<PluginCompositionJournalBatch>;
|
|
524
|
+
/** Current policy gate for captured code; residency and new loading are checked separately. */
|
|
525
|
+
assertPackageExecution(packageId: string): void;
|
|
526
|
+
/** Captures the latest enabled Entry's provenance before suspension, without evaluating author code. */
|
|
527
|
+
executionReference(entryId: string): PluginExecutionReference;
|
|
528
|
+
/** Resolves current Desired under deny/fence checks; stale references cannot reconstruct historical executors. */
|
|
529
|
+
resolveExecution(reference: PluginExecutionReference): Promise<{
|
|
530
|
+
entry: DesiredPluginEntry;
|
|
531
|
+
package: StoredPluginPackage;
|
|
532
|
+
details: PackageDetails;
|
|
533
|
+
}>;
|
|
534
|
+
register(command: PluginCompositionCommand, input: StoredPluginPackage): Promise<PluginCompositionJournalBatch>;
|
|
535
|
+
apply(command: PluginCompositionCommand): Promise<PluginCompositionJournalBatch>;
|
|
536
|
+
/** Authorizes the materialized target under the authority lane, before writing or loading code.
|
|
537
|
+
* The authorizer must not issue commands on this authority. Generations track Desired only. */
|
|
538
|
+
applyDesired(patch: DesiredPluginPatch, authorize: (desired: DesiredPluginComposition) => Promise<void>): Promise<PluginCompositionJournalBatch>;
|
|
539
|
+
/** Resolve an uncertain exact write and reload authority; never retries a command or Package put. */
|
|
540
|
+
recover(): Promise<void>;
|
|
541
|
+
/** Fences queued commands and waits for the in-flight store call; borrowed stores remain open. */
|
|
542
|
+
close(): Promise<void>;
|
|
543
|
+
/** The loader must use the exact source profile accepted by registration. */
|
|
544
|
+
assertPackageProfile(packageId: string, sourceProfile: string): void;
|
|
545
|
+
}
|
|
546
|
+
//#endregion
|
|
547
|
+
export { materializePluginConfig as A, PluginPackageDocument as C, encodePluginPackage as D, decodePluginPackage as E, PluginConfigError as O, inspectPluginModules as S, StoredPluginPackage as T, PluginCompositionError as _, PluginCommitData as a, PluginModuleError as b, PluginAuthorityError as c, PluginCompositionJournalBatch as d, DesiredPluginComposition as f, PluginCompositionBatch as g, DesiredPluginPatchSchema as h, MemoryPluginStore as i, PluginConfigSchema as k, PluginAuthorityJournalBatch as l, DesiredPluginPatch as m, PluginCompositionAuthorityOptions as n, PluginStore as o, DesiredPluginEntry as p, PluginExecutionReference as r, PluginAuthorityCheckpoint as s, PluginCompositionAuthority as t, PluginCompositionCommand as u, projectPluginComposition as v, PluginPackageFormatError as w, PluginModuleInspection as x, PluginPackageInspector as y };
|