@lesliechan721/aw-plugin-core 0.1.0-beta.6 → 0.1.0-beta.61

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.
Files changed (58) hide show
  1. package/dist/aw-capabilities.d.ts +27 -0
  2. package/dist/aw-capabilities.js +117 -0
  3. package/dist/aw-capabilities.js.map +1 -0
  4. package/dist/catalog-file-modes.d.ts +5 -0
  5. package/dist/catalog-file-modes.js +67 -0
  6. package/dist/catalog-file-modes.js.map +1 -0
  7. package/dist/catalog-workspace-resolution.d.ts +3 -0
  8. package/dist/catalog-workspace-resolution.js +34 -0
  9. package/dist/catalog-workspace-resolution.js.map +1 -0
  10. package/dist/generated/plugin-manifest-v3.d.ts +1532 -0
  11. package/dist/generated/{plugin-manifest-v1.js → plugin-manifest-v3.js} +1 -1
  12. package/dist/generated/plugin-manifest-v3.js.map +1 -0
  13. package/dist/index.d.ts +3 -2
  14. package/dist/index.js +2 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/managed-commands.d.ts +167 -0
  17. package/dist/managed-commands.js +463 -0
  18. package/dist/managed-commands.js.map +1 -0
  19. package/dist/manifest-contract.d.ts +3 -6
  20. package/dist/manifest-contract.js +271 -407
  21. package/dist/manifest-contract.js.map +1 -1
  22. package/dist/manifest-type-contract.d.ts +2 -2
  23. package/dist/manifest.d.ts +12 -8
  24. package/dist/manifest.js +18 -7
  25. package/dist/manifest.js.map +1 -1
  26. package/dist/native-runtime/reader-runtime.mjs +34 -0
  27. package/dist/native-runtime/reader.d.mts +6 -0
  28. package/dist/native-runtime/reader.mjs +11 -0
  29. package/dist/native-tools.d.ts +48 -0
  30. package/dist/native-tools.js +192 -0
  31. package/dist/native-tools.js.map +1 -0
  32. package/dist/plugin-authoring-capabilities.d.ts +1 -1
  33. package/dist/plugin-authoring-capabilities.js +133 -26
  34. package/dist/plugin-authoring-capabilities.js.map +1 -1
  35. package/dist/plugin-config.d.ts +47 -0
  36. package/dist/plugin-config.js +1355 -0
  37. package/dist/plugin-config.js.map +1 -0
  38. package/dist/plugin-requirements.d.ts +34 -0
  39. package/dist/plugin-requirements.js +300 -0
  40. package/dist/plugin-requirements.js.map +1 -0
  41. package/dist/plugin-script-contract.d.ts +11 -12
  42. package/dist/plugin-script-contract.js +44 -71
  43. package/dist/plugin-script-contract.js.map +1 -1
  44. package/dist/runtime-config.d.ts +38 -0
  45. package/dist/runtime-config.js +31 -0
  46. package/dist/runtime-config.js.map +1 -0
  47. package/dist/types.d.ts +266 -73
  48. package/dist/workspace.d.ts +37 -9
  49. package/dist/workspace.js +436 -195
  50. package/dist/workspace.js.map +1 -1
  51. package/package.json +16 -6
  52. package/schemas/plugin-manifest-v3.json +2655 -0
  53. package/dist/generated/plugin-manifest-v1.d.ts +0 -368
  54. package/dist/generated/plugin-manifest-v1.js.map +0 -1
  55. package/dist/plugin-release.d.ts +0 -30
  56. package/dist/plugin-release.js +0 -187
  57. package/dist/plugin-release.js.map +0 -1
  58. package/schemas/plugin-manifest-v1.json +0 -329
package/dist/manifest.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { Ajv2020 } from 'ajv/dist/2020.js';
2
- import schema from '../schemas/plugin-manifest-v1.json' with { type: 'json' };
3
- export const PLUGIN_MANIFEST_SCHEMA_VERSION = 1;
4
- export const SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION = 7;
2
+ import schema from '../schemas/plugin-manifest-v3.json' with { type: 'json' };
3
+ export const PLUGIN_MANIFEST_SCHEMA_VERSION = 3;
4
+ export const SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION = 18;
5
5
  const ajv = new Ajv2020({
6
6
  allErrors: true,
7
7
  strict: true,
8
8
  });
9
- const validateV1 = ajv.compile(schema);
9
+ const validateV3 = ajv.compile(schema);
10
10
  export class PluginManifestStructureError extends Error {
11
11
  issues;
12
12
  constructor(message, issues = []) {
@@ -18,7 +18,7 @@ export class PluginManifestStructureError extends Error {
18
18
  function formatIssue(issue) {
19
19
  const location = issue.instancePath || '/';
20
20
  if (issue.keyword === 'pattern'
21
- && (location === '/version' || location.endsWith('/minVersion'))) {
21
+ && location === '/version') {
22
22
  return `${location} must match pattern (expected a strict SemVer 2.0.0 string)`;
23
23
  }
24
24
  return `${location} ${issue.message ?? 'is invalid'}`;
@@ -31,8 +31,13 @@ export function assertPluginManifestStructure(value) {
31
31
  && value.schemaVersion !== PLUGIN_MANIFEST_SCHEMA_VERSION) {
32
32
  throw new PluginManifestStructureError(`Unsupported plugin manifest schemaVersion: expected ${PLUGIN_MANIFEST_SCHEMA_VERSION}.`);
33
33
  }
34
- if (!validateV1(value)) {
35
- const issues = validateV1.errors ?? [];
34
+ if (!validateV3(value)) {
35
+ const issues = validateV3.errors ?? [];
36
+ if (issues.some((issue) => issue.instancePath.endsWith('/runtimeConfig')
37
+ && issue.keyword === 'additionalProperties'
38
+ && ['resourceVersion', 'artifactIds'].includes(issue.params.additionalProperty))) {
39
+ throw new PluginManifestStructureError('runtimeConfigMigrationRequired: Remove runtimeConfig.resourceVersion and runtimeConfig.artifactIds; keep only keys and require aw.installed-runtime-config.v2. Rebuild, then sync or reinstall.', issues);
40
+ }
36
41
  throw new PluginManifestStructureError(`Invalid plugin manifest structure: ${issues.map(formatIssue).join('; ')}`, issues);
37
42
  }
38
43
  }
@@ -50,11 +55,17 @@ export * from './permission-command.js';
50
55
  export * from './platform-entries.js';
51
56
  export * from './platform-support.js';
52
57
  export * from './runtime-export-source.js';
58
+ export * from './runtime-config.js';
53
59
  export * from './plugin-script-contract.js';
54
60
  export * from './plugin-authoring-capabilities.js';
61
+ export * from './plugin-config.js';
62
+ export * from './aw-capabilities.js';
63
+ export * from './plugin-requirements.js';
55
64
  export * from './portable-skill-validation.js';
56
65
  export * from './skill-authoring.js';
57
66
  export * from './skill-frontmatter-capabilities.js';
58
67
  export * from './slash-commands.js';
59
68
  export * from './template-engine.js';
69
+ export * from './managed-commands.js';
70
+ export * from './native-tools.js';
60
71
  //# sourceMappingURL=manifest.js.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const NATIVE_TOOL_CONTEXT_ENV = 'AW_NATIVE_TOOL_CONTEXT';
2
+
3
+ // This standalone module is also the canonical text emitted into plugin bundles.
4
+ export function readNativeTool(key, protocol, environment = process.env) {
5
+ function reject() {
6
+ const error = new Error('nativeContextInvalid');
7
+ error.code = 'nativeContextInvalid';
8
+ throw error;
9
+ }
10
+ function record(value) {
11
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
12
+ }
13
+ if (typeof key !== 'string' || !key || typeof protocol !== 'string' || !protocol) reject();
14
+ const names = Object.keys(environment).filter((name) => name.toUpperCase() === 'AW_NATIVE_TOOL_CONTEXT');
15
+ if (names.length !== 1 || typeof environment[names[0]] !== 'string' || environment[names[0]].length > 128 * 1024) reject();
16
+ let context;
17
+ try { context = JSON.parse(environment[names[0]]); } catch { reject(); }
18
+ if (!record(context) || context.schemaVersion !== 1 || Object.keys(context).sort().join(',') !== 'schemaVersion,tools'
19
+ || !record(context.tools) || Object.keys(context.tools).length > 64) reject();
20
+ for (const [name, value] of Object.entries(context.tools)) {
21
+ if (!name || !record(value) || typeof value.protocol !== 'string' || !value.protocol) reject();
22
+ if (value.state === 'ready') {
23
+ if (Object.keys(value).sort().join(',') !== 'executable,protocol,state'
24
+ || typeof value.executable !== 'string' || value.executable.length > 32_768
25
+ || !/^(?:\/[^\x00]*|[A-Za-z]:[\\/][^\x00]*|\\\\[^\x00]+)$/.test(value.executable)
26
+ || /[\x00-\x1f\x7f]/.test(value.executable)) reject();
27
+ } else if (value.state === 'unavailable') {
28
+ if (Object.keys(value).sort().join(',') !== 'code,protocol,state'
29
+ || typeof value.code !== 'string' || !/^[a-zA-Z][a-zA-Z0-9]{0,95}$/.test(value.code)) reject();
30
+ } else reject();
31
+ }
32
+ if (!Object.hasOwn(context.tools, key) || context.tools[key].protocol !== protocol) reject();
33
+ return Object.freeze({ ...context.tools[key] });
34
+ }
@@ -0,0 +1,6 @@
1
+ export interface NativeToolReady { state: 'ready'; protocol: string; executable: string }
2
+ export interface NativeToolUnavailable { state: 'unavailable'; protocol: string; code: string }
3
+ export interface NativeToolContext { schemaVersion: 1; tools: Record<string, NativeToolReady | NativeToolUnavailable> }
4
+ export const NATIVE_TOOL_CONTEXT_ENV: 'AW_NATIVE_TOOL_CONTEXT';
5
+ export function readNativeTool(key: string, protocol: string, environment?: Record<string, string | undefined>): NativeToolReady | NativeToolUnavailable;
6
+ export function createNativeToolReaderSource(): string;
@@ -0,0 +1,11 @@
1
+ import { readFileSync } from 'node:fs';
2
+
3
+ export { NATIVE_TOOL_CONTEXT_ENV, readNativeTool } from './reader-runtime.mjs';
4
+
5
+ // Read the standalone source, rather than a function transformed by the caller's
6
+ // test runner or bundler. Normalize checkout line endings for identical bundles.
7
+ const readerSource = readFileSync(new URL('./reader-runtime.mjs', import.meta.url), 'utf8').replace(/\r\n/g, '\n');
8
+
9
+ export function createNativeToolReaderSource() {
10
+ return readerSource;
11
+ }
@@ -0,0 +1,48 @@
1
+ import type { NormalizedPluginManifest } from './types.js';
2
+ export { createNativeToolReaderSource } from './native-runtime/reader.mjs';
3
+ export declare const DEFAULT_NATIVE_TOOL_READER = "./.aw/native-tool-reader.mjs";
4
+ export declare const NATIVE_TOOLS_CAPABILITY = "aw.native-tools.v2";
5
+ export interface NativeToolDefinition {
6
+ key: string;
7
+ protocol: string;
8
+ }
9
+ export type NativeToolBinding = {
10
+ key: string;
11
+ platforms: ['win32'];
12
+ } & ({
13
+ policy: 'required';
14
+ fallback?: never;
15
+ } | {
16
+ policy: 'preferred';
17
+ fallback: string;
18
+ });
19
+ export interface NativeToolConsumer {
20
+ kind: 'managed-command-set' | 'plugin-test';
21
+ key: string;
22
+ tools: NativeToolBinding[];
23
+ }
24
+ export interface NativeTools {
25
+ reader: string;
26
+ definitions: NativeToolDefinition[];
27
+ consumers: NativeToolConsumer[];
28
+ }
29
+ export type NativeToolClosure = NativeTools;
30
+ export declare function normalizeNativeTools(value: unknown): NativeTools;
31
+ export declare function validateNativeToolsManifest(manifest: NormalizedPluginManifest, options?: {
32
+ source?: boolean;
33
+ }): void;
34
+ export declare function normalizeNativeToolClosure(value: unknown): NativeToolClosure;
35
+ export declare function loadPluginNativeToolClosure(pluginRoot: string, manifest: NormalizedPluginManifest): Promise<NativeToolClosure | undefined>;
36
+ export declare function getNativeToolConsumerClosure(closure: NativeToolClosure | undefined, kind: NativeToolConsumer['kind'], key: string | readonly string[]): NativeToolClosure | undefined;
37
+ /** Returns the generated reader and protocol requirements for the selected consumers. */
38
+ export declare function materializeNativeToolClosureFiles(closure: NativeToolClosure): {
39
+ closure: NativeToolClosure;
40
+ files: Record<string, string>;
41
+ };
42
+ export declare function preparePluginNativeTools(pluginRoot: string, manifest: NormalizedPluginManifest): Promise<string | undefined>;
43
+ export declare function validateNativeToolClosureFiles(root: string, closure: NativeToolClosure): Promise<void>;
44
+ export declare function copyNativeToolClosureFiles(options: {
45
+ sourceRoot: string;
46
+ destinationRoot: string;
47
+ closure: NativeToolClosure;
48
+ }): Promise<NativeToolClosure>;
@@ -0,0 +1,192 @@
1
+ import path from 'node:path';
2
+ import fs from 'fs-extra';
3
+ import { createNativeToolReaderSource } from './native-runtime/reader.mjs';
4
+ import { resolveCanonicalRuntimeSourceIdentity } from './runtime-export-source.js';
5
+ export { createNativeToolReaderSource } from './native-runtime/reader.mjs';
6
+ export const DEFAULT_NATIVE_TOOL_READER = './.aw/native-tool-reader.mjs';
7
+ export const NATIVE_TOOLS_CAPABILITY = 'aw.native-tools.v2';
8
+ function object(value, field, keys) {
9
+ if (!value || typeof value !== 'object' || Array.isArray(value))
10
+ throw new Error(`Invalid ${field}: expected an object.`);
11
+ if (Object.keys(value).some((key) => !keys.includes(key)))
12
+ throw new Error(`Invalid ${field}: unknown field.`);
13
+ return value;
14
+ }
15
+ function name(value, field) {
16
+ if (typeof value !== 'string' || !/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/u.test(value))
17
+ throw new Error(`Invalid ${field}: expected a Name.`);
18
+ return value;
19
+ }
20
+ function protocol(value, field) {
21
+ if (typeof value !== 'string' || value.length > 128 || !/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)+$/u.test(value))
22
+ throw new Error(`Invalid ${field}: expected a protocol ID.`);
23
+ return value;
24
+ }
25
+ function relativeFile(value, field) {
26
+ if (typeof value !== 'string' || !value.startsWith('./') || value.length > 512
27
+ || /[\\:\u0000-\u001f\u007f-\u009f<>"|?*]/u.test(value)
28
+ || value.slice(2).split('/').some((segment) => !segment || segment === '.' || segment === '..'
29
+ || /[. ]$/u.test(segment) || /^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])(?:\.|$)/iu.test(segment))
30
+ || value.slice(2).split('/').some((segment) => ['.git', 'node_modules', 'evals', 'reports', '.release', '.tmp'].includes(segment))) {
31
+ throw new Error(`Invalid ${field}: expected a safe plugin-relative file.`);
32
+ }
33
+ return value;
34
+ }
35
+ function array(value, field, max) {
36
+ if (!Array.isArray(value) || value.length < 1 || value.length > max)
37
+ throw new Error(`Invalid ${field}: expected 1..${max} entries.`);
38
+ return value;
39
+ }
40
+ function unique(values, field) {
41
+ if (new Set(values).size !== values.length)
42
+ throw new Error(`Invalid ${field}: duplicate entry.`);
43
+ }
44
+ function compare(left, right) { return left < right ? -1 : left > right ? 1 : 0; }
45
+ function normalizeConsumers(value) {
46
+ const consumers = array(value, 'nativeTools.consumers', 128).map((value) => {
47
+ const input = object(value, 'nativeTools consumer', ['kind', 'key', 'tools']);
48
+ if (input.kind !== 'managed-command-set' && input.kind !== 'plugin-test')
49
+ throw new Error('Invalid nativeTools consumer.kind.');
50
+ const tools = array(input.tools, 'nativeTools consumer.tools', 32).map((value) => {
51
+ const binding = object(value, 'nativeTools binding', ['key', 'platforms', 'policy', 'fallback']);
52
+ if (!Array.isArray(binding.platforms) || binding.platforms.length !== 1 || binding.platforms[0] !== 'win32')
53
+ throw new Error('Invalid nativeTools binding.platforms: only win32 is supported.');
54
+ const base = { key: name(binding.key, 'nativeTools binding.key'), platforms: ['win32'] };
55
+ if (binding.policy === 'preferred')
56
+ return { ...base, policy: 'preferred', fallback: name(binding.fallback, 'nativeTools binding.fallback') };
57
+ if (binding.policy !== 'required' || binding.fallback !== undefined)
58
+ throw new Error('Invalid nativeTools binding: required forbids fallback; preferred requires fallback.');
59
+ return { ...base, policy: 'required' };
60
+ });
61
+ unique(tools.map((tool) => tool.key), 'nativeTools consumer.tools');
62
+ return { kind: input.kind, key: name(input.key, 'nativeTools consumer.key'), tools: tools.sort((a, b) => compare(a.key, b.key)) };
63
+ });
64
+ unique(consumers.map((consumer) => `${consumer.kind}/${consumer.key}`), 'nativeTools.consumers');
65
+ return consumers.sort((a, b) => compare(`${a.kind}/${a.key}`, `${b.kind}/${b.key}`));
66
+ }
67
+ function validateReferences(definitions, consumers) {
68
+ const keys = new Set(definitions.map((entry) => entry.key));
69
+ const used = new Set(consumers.flatMap((entry) => entry.tools.map((tool) => tool.key)));
70
+ if ([...used].some((key) => !keys.has(key)))
71
+ throw new Error('Invalid nativeTools: unknown tool reference.');
72
+ if ([...keys].some((key) => !used.has(key)))
73
+ throw new Error('Invalid nativeTools: unused tool definition.');
74
+ }
75
+ export function normalizeNativeTools(value) {
76
+ const input = object(value, 'nativeTools', ['reader', 'definitions', 'consumers']);
77
+ const reader = relativeFile(input.reader === undefined ? DEFAULT_NATIVE_TOOL_READER : input.reader, 'nativeTools.reader');
78
+ if (!reader.endsWith('.mjs'))
79
+ throw new Error('Invalid nativeTools.reader: expected an .mjs file.');
80
+ const definitions = array(input.definitions, 'nativeTools.definitions', 32).map((value) => {
81
+ const entry = object(value, 'nativeTools definition', ['key', 'protocol']);
82
+ return { key: name(entry.key, 'nativeTools definition.key'), protocol: protocol(entry.protocol, 'nativeTools definition.protocol') };
83
+ }).sort((a, b) => compare(a.key, b.key));
84
+ unique(definitions.map((entry) => entry.key), 'nativeTools.definitions');
85
+ unique(definitions.map((entry) => entry.key.toLowerCase()), 'nativeTools.definitions generated file names');
86
+ const consumers = normalizeConsumers(input.consumers);
87
+ validateReferences(definitions, consumers);
88
+ return { reader, definitions, consumers };
89
+ }
90
+ export function validateNativeToolsManifest(manifest, options = {}) {
91
+ if (!manifest.nativeTools)
92
+ return;
93
+ for (const consumer of manifest.nativeTools.consumers) {
94
+ if (consumer.kind === 'managed-command-set') {
95
+ if (!manifest.managedCommands?.sets.some((set) => set.set === consumer.key))
96
+ throw new Error('Invalid nativeTools consumer: unknown managed command set.');
97
+ }
98
+ else if (consumer.key !== 'node' || (options.source && (manifest.scripts?.tests?.node?.length ?? 0) === 0)) {
99
+ throw new Error('Invalid nativeTools consumer: unknown plugin test runner.');
100
+ }
101
+ }
102
+ }
103
+ export function normalizeNativeToolClosure(value) {
104
+ return normalizeNativeTools(value);
105
+ }
106
+ export async function loadPluginNativeToolClosure(pluginRoot, manifest) {
107
+ if (!manifest.nativeTools)
108
+ return undefined;
109
+ validateNativeToolsManifest(manifest);
110
+ const closure = normalizeNativeToolClosure(manifest.nativeTools);
111
+ if (await fs.pathExists(path.resolve(pluginRoot, closure.reader))) {
112
+ await validateNativeToolReader(pluginRoot, closure.reader);
113
+ }
114
+ return closure;
115
+ }
116
+ export function getNativeToolConsumerClosure(closure, kind, key) {
117
+ if (!closure)
118
+ return undefined;
119
+ const normalized = normalizeNativeToolClosure(closure);
120
+ const keys = new Set(typeof key === 'string' ? [key] : key);
121
+ const consumers = normalized.consumers.filter((entry) => entry.kind === kind && keys.has(entry.key));
122
+ if (consumers.length === 0)
123
+ return undefined;
124
+ const tools = new Set(consumers.flatMap((entry) => entry.tools.map((tool) => tool.key)));
125
+ return { reader: normalized.reader, definitions: normalized.definitions.filter((entry) => tools.has(entry.key)), consumers };
126
+ }
127
+ /** Returns the generated reader and protocol requirements for the selected consumers. */
128
+ export function materializeNativeToolClosureFiles(closure) {
129
+ const normalized = normalizeNativeToolClosure(closure);
130
+ return {
131
+ closure: { ...normalized, reader: DEFAULT_NATIVE_TOOL_READER },
132
+ files: { [DEFAULT_NATIVE_TOOL_READER.slice(2)]: createNativeToolReaderSource() },
133
+ };
134
+ }
135
+ async function writeGeneratedFile(root, relative, content) {
136
+ const segments = relative.replace(/^\.\//u, '').split('/');
137
+ let current = root;
138
+ const rootStat = await fs.lstat(root);
139
+ if (!rootStat.isDirectory() || rootStat.isSymbolicLink())
140
+ throw new Error('nativeToolUnsafePath');
141
+ for (const segment of segments.slice(0, -1)) {
142
+ current = path.join(current, segment);
143
+ const stat = await fs.lstat(current).catch((error) => {
144
+ if (error.code === 'ENOENT')
145
+ return undefined;
146
+ throw error;
147
+ });
148
+ if (!stat)
149
+ await fs.mkdir(current);
150
+ else if (!stat.isDirectory() || stat.isSymbolicLink())
151
+ throw new Error('nativeToolUnsafePath');
152
+ }
153
+ const target = path.join(root, ...segments);
154
+ const existing = await fs.lstat(target).catch((error) => {
155
+ if (error.code === 'ENOENT')
156
+ return undefined;
157
+ throw error;
158
+ });
159
+ if (existing) {
160
+ if (!existing.isFile() || existing.isSymbolicLink() || await fs.readFile(target, 'utf8') !== content)
161
+ throw new Error('nativeToolGeneratedFileConflict');
162
+ return;
163
+ }
164
+ await fs.writeFile(target, content, { flag: 'wx' });
165
+ }
166
+ export async function preparePluginNativeTools(pluginRoot, manifest) {
167
+ const closure = await loadPluginNativeToolClosure(pluginRoot, manifest);
168
+ if (!closure)
169
+ return undefined;
170
+ await writeGeneratedFile(pluginRoot, closure.reader, createNativeToolReaderSource());
171
+ return path.resolve(pluginRoot, closure.reader);
172
+ }
173
+ export async function validateNativeToolClosureFiles(root, closure) {
174
+ const normalized = normalizeNativeToolClosure(closure);
175
+ await validateNativeToolReader(root, normalized.reader);
176
+ }
177
+ async function validateNativeToolReader(root, reader) {
178
+ const source = await resolveCanonicalRuntimeSourceIdentity(root, reader, 'native tool reader');
179
+ if ((await fs.stat(source.sourceRealPath)).size > 64 * 1024)
180
+ throw new Error('nativeToolReaderMismatch');
181
+ if (await fs.readFile(source.sourceRealPath, 'utf8') !== createNativeToolReaderSource())
182
+ throw new Error('nativeToolReaderMismatch');
183
+ }
184
+ export async function copyNativeToolClosureFiles(options) {
185
+ await validateNativeToolClosureFiles(options.sourceRoot, options.closure);
186
+ const materialized = materializeNativeToolClosureFiles(options.closure);
187
+ for (const [relative, content] of Object.entries(materialized.files))
188
+ await writeGeneratedFile(options.destinationRoot, relative, content);
189
+ await validateNativeToolClosureFiles(options.destinationRoot, materialized.closure);
190
+ return materialized.closure;
191
+ }
192
+ //# sourceMappingURL=native-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-tools.js","sourceRoot":"","sources":["../src/native-tools.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAEvF,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AAGnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,MAAM,CAAC,MAAM,0BAA0B,GAAG,8BAA8B,CAAC;AACzE,MAAM,CAAC,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAc5D,SAAS,MAAM,CAAC,KAAc,EAAE,KAAa,EAAE,IAAuB;IACpE,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,WAAW,KAAK,uBAAuB,CAAC,CAAC;IAC1H,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,WAAW,KAAK,kBAAkB,CAAC,CAAC;IAC/G,OAAO,KAAgC,CAAC;AAC1C,CAAC;AACD,SAAS,IAAI,CAAC,KAAc,EAAE,KAAa;IACzC,IAAI,OAAO,KAAK,KAAK,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build-config", "extensions", "slash-commands", "mcp-apps", "config", "lifecycle", "artifacts"];
1
+ export declare const PLUGIN_AUTHORING_CAPABILITY_SURFACES: readonly ["manifest", "build-config", "extensions", "slash-commands", "mcp-apps", "config", "pre-apply", "managed-commands", "native-tools", "artifacts"];
2
2
  export type PluginAuthoringCapabilitySurfaceName = (typeof PLUGIN_AUTHORING_CAPABILITY_SURFACES)[number];
3
3
  export type PluginAuthoringAcceptedValue = string | number | boolean;
4
4
  export interface PluginAuthoringCapabilityEntry {