@stigmer/plugin-package 0.1.0-dev.20261017020314.g644422724c27
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/LICENSE +194 -0
- package/README.md +72 -0
- package/client/archive.d.ts +27 -0
- package/client/archive.d.ts.map +1 -0
- package/client/archive.js +38 -0
- package/client/archive.js.map +1 -0
- package/client/builtin.d.ts +37 -0
- package/client/builtin.d.ts.map +1 -0
- package/client/builtin.js +49 -0
- package/client/builtin.js.map +1 -0
- package/client/ignore/defaults.d.ts +2 -0
- package/client/ignore/defaults.d.ts.map +1 -0
- package/client/ignore/defaults.js +140 -0
- package/client/ignore/defaults.js.map +1 -0
- package/client/ignore/match.d.ts +3 -0
- package/client/ignore/match.d.ts.map +1 -0
- package/client/ignore/match.js +166 -0
- package/client/ignore/match.js.map +1 -0
- package/client/ignore/matcher.d.ts +50 -0
- package/client/ignore/matcher.d.ts.map +1 -0
- package/client/ignore/matcher.js +116 -0
- package/client/ignore/matcher.js.map +1 -0
- package/client/ignore/pattern.d.ts +13 -0
- package/client/ignore/pattern.d.ts.map +1 -0
- package/client/ignore/pattern.js +119 -0
- package/client/ignore/pattern.js.map +1 -0
- package/client/prepare-eval.d.ts +62 -0
- package/client/prepare-eval.d.ts.map +1 -0
- package/client/prepare-eval.js +60 -0
- package/client/prepare-eval.js.map +1 -0
- package/client/prepare.d.ts +99 -0
- package/client/prepare.d.ts.map +1 -0
- package/client/prepare.js +89 -0
- package/client/prepare.js.map +1 -0
- package/client/presentation.d.ts +19 -0
- package/client/presentation.d.ts.map +1 -0
- package/client/presentation.js +44 -0
- package/client/presentation.js.map +1 -0
- package/client/refs.d.ts +76 -0
- package/client/refs.d.ts.map +1 -0
- package/client/refs.js +123 -0
- package/client/refs.js.map +1 -0
- package/client/release.d.ts +20 -0
- package/client/release.d.ts.map +1 -0
- package/client/release.js +28 -0
- package/client/release.js.map +1 -0
- package/client/reroot.d.ts +21 -0
- package/client/reroot.d.ts.map +1 -0
- package/client/reroot.js +37 -0
- package/client/reroot.js.map +1 -0
- package/client/select.d.ts +74 -0
- package/client/select.d.ts.map +1 -0
- package/client/select.js +121 -0
- package/client/select.js.map +1 -0
- package/client/vocabulary.d.ts +13 -0
- package/client/vocabulary.d.ts.map +1 -0
- package/client/vocabulary.js +17 -0
- package/client/vocabulary.js.map +1 -0
- package/client.d.ts +51 -0
- package/client.d.ts.map +1 -0
- package/client.js +51 -0
- package/client.js.map +1 -0
- package/detect.d.ts +83 -0
- package/detect.d.ts.map +1 -0
- package/detect.js +210 -0
- package/detect.js.map +1 -0
- package/dialects/claude.d.ts +34 -0
- package/dialects/claude.d.ts.map +1 -0
- package/dialects/claude.js +84 -0
- package/dialects/claude.js.map +1 -0
- package/dialects/codex.d.ts +20 -0
- package/dialects/codex.d.ts.map +1 -0
- package/dialects/codex.js +21 -0
- package/dialects/codex.js.map +1 -0
- package/dialects/cursor.d.ts +25 -0
- package/dialects/cursor.d.ts.map +1 -0
- package/dialects/cursor.js +66 -0
- package/dialects/cursor.js.map +1 -0
- package/dialects/manifest.d.ts +164 -0
- package/dialects/manifest.d.ts.map +1 -0
- package/dialects/manifest.js +256 -0
- package/dialects/manifest.js.map +1 -0
- package/dialects/open.d.ts +19 -0
- package/dialects/open.d.ts.map +1 -0
- package/dialects/open.js +49 -0
- package/dialects/open.js.map +1 -0
- package/documents.d.ts +58 -0
- package/documents.d.ts.map +1 -0
- package/documents.js +121 -0
- package/documents.js.map +1 -0
- package/evals/eval-dir.d.ts +59 -0
- package/evals/eval-dir.d.ts.map +1 -0
- package/evals/eval-dir.js +84 -0
- package/evals/eval-dir.js.map +1 -0
- package/evals/fields.d.ts +78 -0
- package/evals/fields.d.ts.map +1 -0
- package/evals/fields.js +156 -0
- package/evals/fields.js.map +1 -0
- package/evals/glob.d.ts +40 -0
- package/evals/glob.d.ts.map +1 -0
- package/evals/glob.js +146 -0
- package/evals/glob.js.map +1 -0
- package/evals/graders.d.ts +52 -0
- package/evals/graders.d.ts.map +1 -0
- package/evals/graders.js +279 -0
- package/evals/graders.js.map +1 -0
- package/evals/markdown.d.ts +24 -0
- package/evals/markdown.d.ts.map +1 -0
- package/evals/markdown.js +48 -0
- package/evals/markdown.js.map +1 -0
- package/evals/mocks.d.ts +50 -0
- package/evals/mocks.d.ts.map +1 -0
- package/evals/mocks.js +182 -0
- package/evals/mocks.js.map +1 -0
- package/evals/read-eval-suite.d.ts +110 -0
- package/evals/read-eval-suite.d.ts.map +1 -0
- package/evals/read-eval-suite.js +603 -0
- package/evals/read-eval-suite.js.map +1 -0
- package/evals/summary.d.ts +61 -0
- package/evals/summary.d.ts.map +1 -0
- package/evals/summary.js +69 -0
- package/evals/summary.js.map +1 -0
- package/evals/types.d.ts +203 -0
- package/evals/types.d.ts.map +1 -0
- package/evals/types.js +21 -0
- package/evals/types.js.map +1 -0
- package/files.d.ts +135 -0
- package/files.d.ts.map +1 -0
- package/files.js +209 -0
- package/files.js.map +1 -0
- package/frontmatter.d.ts +51 -0
- package/frontmatter.d.ts.map +1 -0
- package/frontmatter.js +61 -0
- package/frontmatter.js.map +1 -0
- package/index.d.ts +37 -0
- package/index.d.ts.map +1 -0
- package/index.js +33 -0
- package/index.js.map +1 -0
- package/marketplace/messages.d.ts +20 -0
- package/marketplace/messages.d.ts.map +1 -0
- package/marketplace/messages.js +49 -0
- package/marketplace/messages.js.map +1 -0
- package/marketplace/outcome.d.ts +70 -0
- package/marketplace/outcome.d.ts.map +1 -0
- package/marketplace/outcome.js +29 -0
- package/marketplace/outcome.js.map +1 -0
- package/marketplace/read-marketplace.d.ts +52 -0
- package/marketplace/read-marketplace.d.ts.map +1 -0
- package/marketplace/read-marketplace.js +351 -0
- package/marketplace/read-marketplace.js.map +1 -0
- package/messages.d.ts +55 -0
- package/messages.d.ts.map +1 -0
- package/messages.js +167 -0
- package/messages.js.map +1 -0
- package/normalise/hooks.d.ts +91 -0
- package/normalise/hooks.d.ts.map +1 -0
- package/normalise/hooks.js +437 -0
- package/normalise/hooks.js.map +1 -0
- package/normalise/ignored.d.ts +34 -0
- package/normalise/ignored.d.ts.map +1 -0
- package/normalise/ignored.js +78 -0
- package/normalise/ignored.js.map +1 -0
- package/normalise/mcp-servers.d.ts +50 -0
- package/normalise/mcp-servers.d.ts.map +1 -0
- package/normalise/mcp-servers.js +398 -0
- package/normalise/mcp-servers.js.map +1 -0
- package/normalise/settings.d.ts +32 -0
- package/normalise/settings.d.ts.map +1 -0
- package/normalise/settings.js +72 -0
- package/normalise/settings.js.map +1 -0
- package/normalise/skills.d.ts +39 -0
- package/normalise/skills.d.ts.map +1 -0
- package/normalise/skills.js +135 -0
- package/normalise/skills.js.map +1 -0
- package/normalise/stigmer-folder.d.ts +17 -0
- package/normalise/stigmer-folder.d.ts.map +1 -0
- package/normalise/stigmer-folder.js +19 -0
- package/normalise/stigmer-folder.js.map +1 -0
- package/normalise/sub-agents.d.ts +54 -0
- package/normalise/sub-agents.d.ts.map +1 -0
- package/normalise/sub-agents.js +219 -0
- package/normalise/sub-agents.js.map +1 -0
- package/normalise/variables.d.ts +31 -0
- package/normalise/variables.d.ts.map +1 -0
- package/normalise/variables.js +170 -0
- package/normalise/variables.js.map +1 -0
- package/outcome.d.ts +59 -0
- package/outcome.d.ts.map +1 -0
- package/outcome.js +32 -0
- package/outcome.js.map +1 -0
- package/package.json +47 -0
- package/placeholders.d.ts +65 -0
- package/placeholders.d.ts.map +1 -0
- package/placeholders.js +99 -0
- package/placeholders.js.map +1 -0
- package/presentation.d.ts +53 -0
- package/presentation.d.ts.map +1 -0
- package/presentation.js +156 -0
- package/presentation.js.map +1 -0
- package/read-plugin-package.d.ts +20 -0
- package/read-plugin-package.d.ts.map +1 -0
- package/read-plugin-package.js +73 -0
- package/read-plugin-package.js.map +1 -0
- package/src/client/archive.ts +44 -0
- package/src/client/builtin.ts +60 -0
- package/src/client/ignore/defaults.ts +155 -0
- package/src/client/ignore/match.ts +158 -0
- package/src/client/ignore/matcher.ts +156 -0
- package/src/client/ignore/pattern.ts +132 -0
- package/src/client/prepare-eval.ts +92 -0
- package/src/client/prepare.ts +160 -0
- package/src/client/presentation.ts +47 -0
- package/src/client/refs.ts +170 -0
- package/src/client/release.ts +29 -0
- package/src/client/reroot.ts +35 -0
- package/src/client/select.ts +161 -0
- package/src/client/vocabulary.ts +19 -0
- package/src/client.ts +102 -0
- package/src/detect.ts +245 -0
- package/src/dialects/claude.ts +102 -0
- package/src/dialects/codex.ts +26 -0
- package/src/dialects/cursor.ts +77 -0
- package/src/dialects/manifest.ts +316 -0
- package/src/dialects/open.ts +50 -0
- package/src/documents.ts +158 -0
- package/src/evals/eval-dir.ts +101 -0
- package/src/evals/fields.ts +184 -0
- package/src/evals/glob.ts +141 -0
- package/src/evals/graders.ts +293 -0
- package/src/evals/markdown.ts +56 -0
- package/src/evals/mocks.ts +202 -0
- package/src/evals/read-eval-suite.ts +713 -0
- package/src/evals/summary.ts +100 -0
- package/src/evals/types.ts +217 -0
- package/src/files.ts +235 -0
- package/src/frontmatter.ts +70 -0
- package/src/index.ts +129 -0
- package/src/marketplace/messages.ts +61 -0
- package/src/marketplace/outcome.ts +91 -0
- package/src/marketplace/read-marketplace.ts +388 -0
- package/src/messages.ts +248 -0
- package/src/normalise/hooks.ts +469 -0
- package/src/normalise/ignored.ts +79 -0
- package/src/normalise/mcp-servers.ts +423 -0
- package/src/normalise/settings.ts +81 -0
- package/src/normalise/skills.ts +145 -0
- package/src/normalise/stigmer-folder.ts +23 -0
- package/src/normalise/sub-agents.ts +231 -0
- package/src/normalise/variables.ts +181 -0
- package/src/outcome.ts +158 -0
- package/src/placeholders.ts +110 -0
- package/src/presentation.ts +170 -0
- package/src/read-plugin-package.ts +80 -0
- package/src/testing.ts +347 -0
- package/src/tool-names.ts +30 -0
- package/src/trim.ts +10 -0
- package/src/types.ts +214 -0
- package/testing.d.ts +127 -0
- package/testing.d.ts.map +1 -0
- package/testing.js +266 -0
- package/testing.js.map +1 -0
- package/tool-names.d.ts +21 -0
- package/tool-names.d.ts.map +1 -0
- package/tool-names.js +28 -0
- package/tool-names.js.map +1 -0
- package/trim.d.ts +7 -0
- package/trim.d.ts.map +1 -0
- package/trim.js +12 -0
- package/trim.js.map +1 -0
- package/types.d.ts +179 -0
- package/types.d.ts.map +1 -0
- package/types.js +19 -0
- package/types.js.map +1 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The intermediate every dialect reader reduces its manifest to, and the
|
|
3
|
+
* field-reading helpers they share.
|
|
4
|
+
*
|
|
5
|
+
* A `DialectManifest` says what one manifest CONTRIBUTES: identity fields,
|
|
6
|
+
* declared component paths, MCP configuration and hooks sources, a
|
|
7
|
+
* variables block, Claude's inline settings, and the fields it carries that
|
|
8
|
+
* Stigmer records as ignored. It does not
|
|
9
|
+
* decide anything across manifests: precedence, name conflicts and default
|
|
10
|
+
* locations are `detect.ts`'s, and turning declarations into skills,
|
|
11
|
+
* servers and variables is `normalise/`'s. Keeping the readers to "what
|
|
12
|
+
* does this file say" is what lets a plugin carry a root manifest and a
|
|
13
|
+
* vendor manifest at once and have both read.
|
|
14
|
+
*
|
|
15
|
+
* Unknown fields WARN in every dialect (the open format says report and
|
|
16
|
+
* ignore; Cursor's own validator would reject them, but a warning serves
|
|
17
|
+
* the author and the install still works). A known field of the wrong type
|
|
18
|
+
* is fatal (`manifest-field-type`), the open format's rule for any
|
|
19
|
+
* violation other than an unknown field.
|
|
20
|
+
*/
|
|
21
|
+
import { type JsonObject } from "../documents.js";
|
|
22
|
+
import type { Findings } from "../messages.js";
|
|
23
|
+
import type { IgnoredComponent, IgnoredComponentKind, PluginAuthor, PluginDialect } from "../types.js";
|
|
24
|
+
export interface PluginIdentity {
|
|
25
|
+
readonly name?: string;
|
|
26
|
+
readonly version?: string;
|
|
27
|
+
readonly description?: string;
|
|
28
|
+
readonly author?: PluginAuthor;
|
|
29
|
+
readonly homepage?: string;
|
|
30
|
+
readonly repository?: string;
|
|
31
|
+
readonly license?: string;
|
|
32
|
+
readonly keywords?: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
/** A component path a manifest declared, normalised, with where it was declared. */
|
|
35
|
+
export interface DeclaredPath {
|
|
36
|
+
/** Plugin-relative, no leading `./`, no trailing slash; the root is `""`. */
|
|
37
|
+
readonly path: string;
|
|
38
|
+
/** The manifest that declared it, for messages. */
|
|
39
|
+
readonly manifest: string;
|
|
40
|
+
}
|
|
41
|
+
/** Where MCP server entries come from: a configuration file, or an object inline in a manifest. */
|
|
42
|
+
export type McpConfigSource = {
|
|
43
|
+
readonly kind: "file";
|
|
44
|
+
readonly path: string;
|
|
45
|
+
readonly dialect: PluginDialect;
|
|
46
|
+
readonly manifest: string;
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: "inline";
|
|
49
|
+
readonly manifest: string;
|
|
50
|
+
readonly servers: unknown;
|
|
51
|
+
readonly dialect: PluginDialect;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Where hooks come from: a hooks file, or an object inline in a manifest.
|
|
55
|
+
* An inline object from a Claude or Codex manifest is the bare event map
|
|
56
|
+
* (Claude's plugins reference); Cursor documents no inline form, so a
|
|
57
|
+
* Cursor inline object is read in its file's shape.
|
|
58
|
+
*/
|
|
59
|
+
export type HookSource = {
|
|
60
|
+
readonly kind: "file";
|
|
61
|
+
readonly path: string;
|
|
62
|
+
readonly dialect: PluginDialect;
|
|
63
|
+
readonly manifest: string;
|
|
64
|
+
} | {
|
|
65
|
+
readonly kind: "inline";
|
|
66
|
+
readonly manifest: string;
|
|
67
|
+
readonly value: JsonObject;
|
|
68
|
+
readonly dialect: PluginDialect;
|
|
69
|
+
};
|
|
70
|
+
/** A variables block, raw, tagged with the dialect whose shape it takes. */
|
|
71
|
+
export type VariablesDeclaration = {
|
|
72
|
+
readonly dialect: "cursor";
|
|
73
|
+
readonly value: unknown;
|
|
74
|
+
readonly manifest: string;
|
|
75
|
+
} | {
|
|
76
|
+
readonly dialect: "claude";
|
|
77
|
+
readonly value: unknown;
|
|
78
|
+
readonly manifest: string;
|
|
79
|
+
};
|
|
80
|
+
export interface DialectManifest {
|
|
81
|
+
readonly dialect: PluginDialect;
|
|
82
|
+
readonly path: string;
|
|
83
|
+
readonly identity: PluginIdentity;
|
|
84
|
+
/** Declared skill paths; the default `skills/` is scanned regardless. */
|
|
85
|
+
readonly skillPaths: readonly DeclaredPath[];
|
|
86
|
+
/** Declared agent paths; `undefined` leaves the default `agents/` scan in force. */
|
|
87
|
+
readonly agentPaths?: readonly DeclaredPath[];
|
|
88
|
+
readonly mcpConfigs: readonly McpConfigSource[];
|
|
89
|
+
/** Declared hooks sources; the default `hooks/hooks.json` is added by `detect.ts`. */
|
|
90
|
+
readonly hookSources: readonly HookSource[];
|
|
91
|
+
readonly variables?: VariablesDeclaration;
|
|
92
|
+
/** A Claude manifest's inline `settings` object, raw. */
|
|
93
|
+
readonly settings?: unknown;
|
|
94
|
+
/**
|
|
95
|
+
* A Claude-shaped manifest's `experimental.evals`, raw: where the plugin's
|
|
96
|
+
* eval suite lives when not `evals/`. The eval reader validates it; the
|
|
97
|
+
* install never reads it.
|
|
98
|
+
*/
|
|
99
|
+
readonly evalsDir?: {
|
|
100
|
+
readonly value: unknown;
|
|
101
|
+
readonly manifest: string;
|
|
102
|
+
};
|
|
103
|
+
readonly ignored: readonly IgnoredComponent[];
|
|
104
|
+
}
|
|
105
|
+
/** Warn once per field the dialect does not define. */
|
|
106
|
+
export declare function warnUnknownFields(object: JsonObject, known: ReadonlySet<string>, path: string, findings: Findings): void;
|
|
107
|
+
/**
|
|
108
|
+
* The identity fields every dialect shares. `author` is an object in every
|
|
109
|
+
* dialect (Cursor's schema has no `url`; the extra key is a warning there,
|
|
110
|
+
* reported by the caller's known-field set for `author`).
|
|
111
|
+
*/
|
|
112
|
+
export declare function readIdentity(object: JsonObject, path: string, findings: Findings): PluginIdentity;
|
|
113
|
+
/**
|
|
114
|
+
* A path field (`skills`, `agents`, ...) as declared paths. A value that is
|
|
115
|
+
* not a path (wrong prefix, escape, glob) is reported and dropped; the
|
|
116
|
+
* rest are kept, so one bad entry does not hide the others.
|
|
117
|
+
*/
|
|
118
|
+
export declare function readDeclaredPaths(object: JsonObject, field: string, path: string, findings: Findings): readonly DeclaredPath[] | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* A vendor `mcpServers` field: a path, an inline `mcpServers` object, or an
|
|
121
|
+
* array of either. Each becomes one source under the dialect's rules.
|
|
122
|
+
*/
|
|
123
|
+
export declare function readMcpSources(object: JsonObject, field: string, path: string, dialect: PluginDialect, findings: Findings): readonly McpConfigSource[];
|
|
124
|
+
/**
|
|
125
|
+
* A vendor `hooks` field: a path, an inline hooks object, or an array of
|
|
126
|
+
* either, read like `mcpServers`. Each becomes one source under the
|
|
127
|
+
* dialect's rules.
|
|
128
|
+
*/
|
|
129
|
+
export declare function readHookSources(object: JsonObject, path: string, dialect: PluginDialect, findings: Findings): readonly HookSource[];
|
|
130
|
+
/**
|
|
131
|
+
* Manifest fields Stigmer reads past, recorded as ignored components at
|
|
132
|
+
* `<manifest>#<field>` when present. Shared across dialects; each names the
|
|
133
|
+
* fields it knows through `known` so the same field is never also an
|
|
134
|
+
* unknown-field warning.
|
|
135
|
+
*/
|
|
136
|
+
export declare const IGNORED_FIELD_KINDS: Readonly<Record<string, IgnoredComponentKind>>;
|
|
137
|
+
export declare function ignoredFieldComponents(object: JsonObject, path: string): IgnoredComponent[];
|
|
138
|
+
/**
|
|
139
|
+
* Stigmer's own namespace under a root manifest's `extensions`. The open
|
|
140
|
+
* format has no appearance fields, so this is where an open-format plugin
|
|
141
|
+
* says what a storefront card shows: the same three the Cursor manifest
|
|
142
|
+
* carries at its top level, read by `presentation.ts` and treated by the
|
|
143
|
+
* install exactly as Cursor's are (`logo` an ignored component, because
|
|
144
|
+
* nothing in an Organization carries the image; `displayName` and
|
|
145
|
+
* `category` silent). The FOLDER `ai.stigmer/` (`normalise/stigmer-folder.ts`)
|
|
146
|
+
* is the same name in a different place, and is read by nothing.
|
|
147
|
+
*/
|
|
148
|
+
export declare const STIGMER_EXTENSION_NAMESPACE = "ai.stigmer";
|
|
149
|
+
export declare const STIGMER_EXTENSION_FIELDS: ReadonlySet<string>;
|
|
150
|
+
/** The `ai.stigmer` extension object of a root manifest, or `undefined` when absent or not an object. */
|
|
151
|
+
export declare function stigmerExtensionOf(object: JsonObject): JsonObject | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* `extensions` in a root manifest: every foreign namespace with content is
|
|
154
|
+
* an ignored component (a client ignores namespaces it does not implement
|
|
155
|
+
* without validating them); an empty object is silent. Stigmer's own
|
|
156
|
+
* namespace is read field by field: `logo` is recorded as the `logo`
|
|
157
|
+
* component Cursor's would be, the other appearance fields are silent, and
|
|
158
|
+
* any field beyond `STIGMER_EXTENSION_FIELDS` makes the namespace an
|
|
159
|
+
* ignored `extension` component so a misspelled key stays visible. A
|
|
160
|
+
* non-object `extensions` is the open format's one non-fatal type
|
|
161
|
+
* violation: reported and ignored.
|
|
162
|
+
*/
|
|
163
|
+
export declare function extensionComponents(object: JsonObject, path: string, findings: Findings): IgnoredComponent[];
|
|
164
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/dialects/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAwB,KAAK,UAAU,EAA4D,MAAM,iBAAiB,CAAC;AAElI,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvG,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,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AAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,gBAAgB,EAAE,CAmB5G"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The intermediate every dialect reader reduces its manifest to, and the
|
|
3
|
+
* field-reading helpers they share.
|
|
4
|
+
*
|
|
5
|
+
* A `DialectManifest` says what one manifest CONTRIBUTES: identity fields,
|
|
6
|
+
* declared component paths, MCP configuration and hooks sources, a
|
|
7
|
+
* variables block, Claude's inline settings, and the fields it carries that
|
|
8
|
+
* Stigmer records as ignored. It does not
|
|
9
|
+
* decide anything across manifests: precedence, name conflicts and default
|
|
10
|
+
* locations are `detect.ts`'s, and turning declarations into skills,
|
|
11
|
+
* servers and variables is `normalise/`'s. Keeping the readers to "what
|
|
12
|
+
* does this file say" is what lets a plugin carry a root manifest and a
|
|
13
|
+
* vendor manifest at once and have both read.
|
|
14
|
+
*
|
|
15
|
+
* Unknown fields WARN in every dialect (the open format says report and
|
|
16
|
+
* ignore; Cursor's own validator would reject them, but a warning serves
|
|
17
|
+
* the author and the install still works). A known field of the wrong type
|
|
18
|
+
* is fatal (`manifest-field-type`), the open format's rule for any
|
|
19
|
+
* violation other than an unknown field.
|
|
20
|
+
*/
|
|
21
|
+
import { fields, isJsonObject, optionalString, optionalStringArray, stringOrStringArray } from "../documents.js";
|
|
22
|
+
import { resolveDeclaredPath } from "../files.js";
|
|
23
|
+
/** Warn once per field the dialect does not define. */
|
|
24
|
+
export function warnUnknownFields(object, known, path, findings) {
|
|
25
|
+
for (const [name] of fields(object)) {
|
|
26
|
+
if (!known.has(name))
|
|
27
|
+
findings.warn("manifest-field-unknown", { path, subject: name });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The identity fields every dialect shares. `author` is an object in every
|
|
32
|
+
* dialect (Cursor's schema has no `url`; the extra key is a warning there,
|
|
33
|
+
* reported by the caller's known-field set for `author`).
|
|
34
|
+
*/
|
|
35
|
+
export function readIdentity(object, path, findings) {
|
|
36
|
+
const identity = {};
|
|
37
|
+
const name = optionalString(object, "name", path, findings);
|
|
38
|
+
if (name !== undefined)
|
|
39
|
+
identity.name = name;
|
|
40
|
+
const version = optionalString(object, "version", path, findings);
|
|
41
|
+
if (version !== undefined)
|
|
42
|
+
identity.version = version;
|
|
43
|
+
const description = optionalString(object, "description", path, findings);
|
|
44
|
+
if (description !== undefined)
|
|
45
|
+
identity.description = description;
|
|
46
|
+
const homepage = optionalString(object, "homepage", path, findings);
|
|
47
|
+
if (homepage !== undefined)
|
|
48
|
+
identity.homepage = homepage;
|
|
49
|
+
const repository = optionalString(object, "repository", path, findings);
|
|
50
|
+
if (repository !== undefined)
|
|
51
|
+
identity.repository = repository;
|
|
52
|
+
const license = optionalString(object, "license", path, findings);
|
|
53
|
+
if (license !== undefined)
|
|
54
|
+
identity.license = license;
|
|
55
|
+
const keywords = optionalStringArray(object, "keywords", path, findings);
|
|
56
|
+
if (keywords !== undefined)
|
|
57
|
+
identity.keywords = keywords;
|
|
58
|
+
const author = readAuthor(object, path, findings);
|
|
59
|
+
if (author !== undefined)
|
|
60
|
+
identity.author = author;
|
|
61
|
+
return identity;
|
|
62
|
+
}
|
|
63
|
+
function readAuthor(object, path, findings) {
|
|
64
|
+
const value = object["author"];
|
|
65
|
+
if (value === undefined)
|
|
66
|
+
return undefined;
|
|
67
|
+
if (!isJsonObject(value)) {
|
|
68
|
+
findings.error("manifest-field-type", { path, subject: "author", detail: "an object" });
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
const author = {};
|
|
72
|
+
const name = optionalString(value, "name", path, findings);
|
|
73
|
+
if (name !== undefined)
|
|
74
|
+
author.name = name;
|
|
75
|
+
const email = optionalString(value, "email", path, findings);
|
|
76
|
+
if (email !== undefined)
|
|
77
|
+
author.email = email;
|
|
78
|
+
const url = optionalString(value, "url", path, findings);
|
|
79
|
+
if (url !== undefined)
|
|
80
|
+
author.url = url;
|
|
81
|
+
return author;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A path field (`skills`, `agents`, ...) as declared paths. A value that is
|
|
85
|
+
* not a path (wrong prefix, escape, glob) is reported and dropped; the
|
|
86
|
+
* rest are kept, so one bad entry does not hide the others.
|
|
87
|
+
*/
|
|
88
|
+
export function readDeclaredPaths(object, field, path, findings) {
|
|
89
|
+
const values = stringOrStringArray(object, field, path, findings);
|
|
90
|
+
if (values === undefined)
|
|
91
|
+
return undefined;
|
|
92
|
+
const declared = [];
|
|
93
|
+
for (const value of values) {
|
|
94
|
+
const resolved = resolveDeclaredPath(value);
|
|
95
|
+
if (!resolved.ok) {
|
|
96
|
+
findings.error(resolved.kind, { path, subject: value });
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
declared.push({ path: resolved.path, manifest: path });
|
|
100
|
+
}
|
|
101
|
+
return declared;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A vendor `mcpServers` field: a path, an inline `mcpServers` object, or an
|
|
105
|
+
* array of either. Each becomes one source under the dialect's rules.
|
|
106
|
+
*/
|
|
107
|
+
export function readMcpSources(object, field, path, dialect, findings) {
|
|
108
|
+
const value = object[field];
|
|
109
|
+
if (value === undefined)
|
|
110
|
+
return [];
|
|
111
|
+
const items = Array.isArray(value) ? value : [value];
|
|
112
|
+
const sources = [];
|
|
113
|
+
for (const item of items) {
|
|
114
|
+
if (typeof item === "string") {
|
|
115
|
+
const resolved = resolveDeclaredPath(item);
|
|
116
|
+
if (!resolved.ok) {
|
|
117
|
+
findings.error(resolved.kind, { path, subject: item });
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
sources.push({ kind: "file", path: resolved.path, dialect, manifest: path });
|
|
121
|
+
}
|
|
122
|
+
else if (isJsonObject(item)) {
|
|
123
|
+
sources.push({ kind: "inline", manifest: path, servers: item, dialect });
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
findings.error("manifest-field-type", { path, subject: field, detail: "a path, an object, or an array of either" });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return sources;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* A vendor `hooks` field: a path, an inline hooks object, or an array of
|
|
133
|
+
* either, read like `mcpServers`. Each becomes one source under the
|
|
134
|
+
* dialect's rules.
|
|
135
|
+
*/
|
|
136
|
+
export function readHookSources(object, path, dialect, findings) {
|
|
137
|
+
const value = object["hooks"];
|
|
138
|
+
if (value === undefined)
|
|
139
|
+
return [];
|
|
140
|
+
const items = Array.isArray(value) ? value : [value];
|
|
141
|
+
const sources = [];
|
|
142
|
+
for (const item of items) {
|
|
143
|
+
if (typeof item === "string") {
|
|
144
|
+
const resolved = resolveDeclaredPath(item);
|
|
145
|
+
if (!resolved.ok) {
|
|
146
|
+
findings.error(resolved.kind, { path, subject: item });
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
sources.push({ kind: "file", path: resolved.path, dialect, manifest: path });
|
|
150
|
+
}
|
|
151
|
+
else if (isJsonObject(item)) {
|
|
152
|
+
sources.push({ kind: "inline", manifest: path, value: item, dialect });
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
findings.error("manifest-field-type", { path, subject: "hooks", detail: "a path, an object, or an array of either" });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return sources;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Manifest fields Stigmer reads past, recorded as ignored components at
|
|
162
|
+
* `<manifest>#<field>` when present. Shared across dialects; each names the
|
|
163
|
+
* fields it knows through `known` so the same field is never also an
|
|
164
|
+
* unknown-field warning.
|
|
165
|
+
*/
|
|
166
|
+
export const IGNORED_FIELD_KINDS = {
|
|
167
|
+
rules: "rules",
|
|
168
|
+
commands: "commands",
|
|
169
|
+
workflows: "workflows",
|
|
170
|
+
outputStyles: "output-styles",
|
|
171
|
+
lspServers: "lsp-servers",
|
|
172
|
+
channels: "channels",
|
|
173
|
+
dependencies: "dependencies",
|
|
174
|
+
defaultEnabled: "default-enabled",
|
|
175
|
+
minClientVersions: "min-client-versions",
|
|
176
|
+
logo: "logo",
|
|
177
|
+
apps: "apps",
|
|
178
|
+
};
|
|
179
|
+
export function ignoredFieldComponents(object, path) {
|
|
180
|
+
const ignored = [];
|
|
181
|
+
for (const [name, value] of fields(object)) {
|
|
182
|
+
const kind = IGNORED_FIELD_KINDS[name];
|
|
183
|
+
if (kind !== undefined)
|
|
184
|
+
ignored.push({ kind, path: `${path}#${name}` });
|
|
185
|
+
if (name === "experimental" && isJsonObject(value)) {
|
|
186
|
+
for (const [sub] of fields(value)) {
|
|
187
|
+
const subKind = EXPERIMENTAL_KINDS[sub];
|
|
188
|
+
if (subKind !== undefined)
|
|
189
|
+
ignored.push({ kind: subKind, path: `${path}#experimental.${sub}` });
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return ignored;
|
|
194
|
+
}
|
|
195
|
+
// `experimental.evals` is not here: it names the eval suite's directory,
|
|
196
|
+
// which the eval reader reads (`evals/read-eval-suite.ts`).
|
|
197
|
+
const EXPERIMENTAL_KINDS = {
|
|
198
|
+
themes: "themes",
|
|
199
|
+
monitors: "monitors",
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Stigmer's own namespace under a root manifest's `extensions`. The open
|
|
203
|
+
* format has no appearance fields, so this is where an open-format plugin
|
|
204
|
+
* says what a storefront card shows: the same three the Cursor manifest
|
|
205
|
+
* carries at its top level, read by `presentation.ts` and treated by the
|
|
206
|
+
* install exactly as Cursor's are (`logo` an ignored component, because
|
|
207
|
+
* nothing in an Organization carries the image; `displayName` and
|
|
208
|
+
* `category` silent). The FOLDER `ai.stigmer/` (`normalise/stigmer-folder.ts`)
|
|
209
|
+
* is the same name in a different place, and is read by nothing.
|
|
210
|
+
*/
|
|
211
|
+
export const STIGMER_EXTENSION_NAMESPACE = "ai.stigmer";
|
|
212
|
+
export const STIGMER_EXTENSION_FIELDS = new Set(["displayName", "logo", "category"]);
|
|
213
|
+
/** The `ai.stigmer` extension object of a root manifest, or `undefined` when absent or not an object. */
|
|
214
|
+
export function stigmerExtensionOf(object) {
|
|
215
|
+
const extensions = object["extensions"];
|
|
216
|
+
if (!isJsonObject(extensions))
|
|
217
|
+
return undefined;
|
|
218
|
+
const content = extensions[STIGMER_EXTENSION_NAMESPACE];
|
|
219
|
+
return isJsonObject(content) ? content : undefined;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* `extensions` in a root manifest: every foreign namespace with content is
|
|
223
|
+
* an ignored component (a client ignores namespaces it does not implement
|
|
224
|
+
* without validating them); an empty object is silent. Stigmer's own
|
|
225
|
+
* namespace is read field by field: `logo` is recorded as the `logo`
|
|
226
|
+
* component Cursor's would be, the other appearance fields are silent, and
|
|
227
|
+
* any field beyond `STIGMER_EXTENSION_FIELDS` makes the namespace an
|
|
228
|
+
* ignored `extension` component so a misspelled key stays visible. A
|
|
229
|
+
* non-object `extensions` is the open format's one non-fatal type
|
|
230
|
+
* violation: reported and ignored.
|
|
231
|
+
*/
|
|
232
|
+
export function extensionComponents(object, path, findings) {
|
|
233
|
+
const value = object["extensions"];
|
|
234
|
+
if (value === undefined)
|
|
235
|
+
return [];
|
|
236
|
+
if (!isJsonObject(value)) {
|
|
237
|
+
findings.warn("manifest-extensions-invalid", { path });
|
|
238
|
+
return [];
|
|
239
|
+
}
|
|
240
|
+
const ignored = [];
|
|
241
|
+
for (const [namespace, content] of fields(value)) {
|
|
242
|
+
if (isJsonObject(content) && fields(content).length === 0)
|
|
243
|
+
continue;
|
|
244
|
+
const at = `${path}#extensions.${namespace}`;
|
|
245
|
+
if (namespace === STIGMER_EXTENSION_NAMESPACE && isJsonObject(content)) {
|
|
246
|
+
if (content["logo"] !== undefined)
|
|
247
|
+
ignored.push({ kind: "logo", path: `${at}.logo` });
|
|
248
|
+
if (fields(content).some(([name]) => !STIGMER_EXTENSION_FIELDS.has(name)))
|
|
249
|
+
ignored.push({ kind: "extension", path: at });
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
ignored.push({ kind: "extension", path: at });
|
|
253
|
+
}
|
|
254
|
+
return ignored;
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/dialects/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAmB,cAAc,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAClI,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAkElD,uDAAuD;AACvD,MAAM,UAAU,iBAAiB,CAAC,MAAkB,EAAE,KAA0B,EAAE,IAAY,EAAE,QAAkB;IAChH,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACzF,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAkB,EAAE,IAAY,EAAE,QAAkB;IAC/E,MAAM,QAAQ,GAAiE,EAAE,CAAC;IAClF,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC5D,IAAI,IAAI,KAAK,SAAS;QAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;IAC7C,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAClE,IAAI,OAAO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C;QACvD,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,OAAO,GAAuB,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACpE,MAAM,EAAE,GAAG,GAAG,IAAI,eAAe,SAAS,EAAE,CAAC;QAC7C,IAAI,SAAS,KAAK,2BAA2B,IAAI,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;YACvE,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,SAAS;gBAAE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;YACtF,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAAE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YACzH,SAAS;QACX,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Agent Plugins 1.0.0 root manifest (`plugin.json`).
|
|
3
|
+
*
|
|
4
|
+
* The open format's manifest is closed and versioned: `$schema` is required
|
|
5
|
+
* and must be the canonical 1.0.0 identifier, the ten permitted fields are
|
|
6
|
+
* fixed, an unknown field is reported and ignored, and any other violation
|
|
7
|
+
* is fatal. Components live at fixed locations only (`skills/`, `mcp.json`),
|
|
8
|
+
* so this manifest declares no paths and no inline servers; `mcp.json` is
|
|
9
|
+
* read under the open format's rules by `detect.ts` when it exists.
|
|
10
|
+
* Client-specific data belongs under `extensions`, which Stigmer records as
|
|
11
|
+
* ignored per foreign namespace; its own `ai.stigmer` namespace carries the
|
|
12
|
+
* appearance fields a storefront card shows (`manifest.ts`,
|
|
13
|
+
* `STIGMER_EXTENSION_FIELDS`), the open format's only place for them.
|
|
14
|
+
*/
|
|
15
|
+
import { type JsonObject } from "../documents.js";
|
|
16
|
+
import { type Findings } from "../messages.js";
|
|
17
|
+
import { type DialectManifest } from "./manifest.js";
|
|
18
|
+
export declare function readOpenManifest(object: JsonObject, path: string, findings: Findings): DialectManifest;
|
|
19
|
+
//# sourceMappingURL=open.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../src/dialects/open.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAiC,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,KAAK,eAAe,EAAwD,MAAM,eAAe,CAAC;AAe3G,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,eAAe,CAiBtG"}
|
package/dialects/open.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Agent Plugins 1.0.0 root manifest (`plugin.json`).
|
|
3
|
+
*
|
|
4
|
+
* The open format's manifest is closed and versioned: `$schema` is required
|
|
5
|
+
* and must be the canonical 1.0.0 identifier, the ten permitted fields are
|
|
6
|
+
* fixed, an unknown field is reported and ignored, and any other violation
|
|
7
|
+
* is fatal. Components live at fixed locations only (`skills/`, `mcp.json`),
|
|
8
|
+
* so this manifest declares no paths and no inline servers; `mcp.json` is
|
|
9
|
+
* read under the open format's rules by `detect.ts` when it exists.
|
|
10
|
+
* Client-specific data belongs under `extensions`, which Stigmer records as
|
|
11
|
+
* ignored per foreign namespace; its own `ai.stigmer` namespace carries the
|
|
12
|
+
* appearance fields a storefront card shows (`manifest.ts`,
|
|
13
|
+
* `STIGMER_EXTENSION_FIELDS`), the open format's only place for them.
|
|
14
|
+
*/
|
|
15
|
+
import { describeValue } from "../documents.js";
|
|
16
|
+
import { AGENT_PLUGINS_MANIFEST_SCHEMA } from "../messages.js";
|
|
17
|
+
import { extensionComponents, readIdentity, warnUnknownFields } from "./manifest.js";
|
|
18
|
+
const KNOWN_FIELDS = new Set([
|
|
19
|
+
"$schema",
|
|
20
|
+
"name",
|
|
21
|
+
"version",
|
|
22
|
+
"description",
|
|
23
|
+
"author",
|
|
24
|
+
"homepage",
|
|
25
|
+
"repository",
|
|
26
|
+
"license",
|
|
27
|
+
"keywords",
|
|
28
|
+
"extensions",
|
|
29
|
+
]);
|
|
30
|
+
export function readOpenManifest(object, path, findings) {
|
|
31
|
+
const schema = object["$schema"];
|
|
32
|
+
if (schema === undefined) {
|
|
33
|
+
findings.error("manifest-schema-missing", { path });
|
|
34
|
+
}
|
|
35
|
+
else if (schema !== AGENT_PLUGINS_MANIFEST_SCHEMA) {
|
|
36
|
+
findings.error("manifest-schema-unsupported", { path, detail: describeValue(schema) });
|
|
37
|
+
}
|
|
38
|
+
warnUnknownFields(object, KNOWN_FIELDS, path, findings);
|
|
39
|
+
return {
|
|
40
|
+
dialect: "agent-plugins",
|
|
41
|
+
path,
|
|
42
|
+
identity: readIdentity(object, path, findings),
|
|
43
|
+
skillPaths: [],
|
|
44
|
+
mcpConfigs: [],
|
|
45
|
+
hookSources: [],
|
|
46
|
+
ignored: extensionComponents(object, path, findings),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=open.js.map
|
|
@@ -0,0 +1 @@
|
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AC"}
|
package/documents.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading one document through its cap, and the JSON shape checks every
|
|
3
|
+
* dialect reader repeats.
|
|
4
|
+
*
|
|
5
|
+
* `readText` is the only place the library calls `PluginFiles.read`: the
|
|
6
|
+
* declared size is checked against the document class's cap first, the
|
|
7
|
+
* returned length second, and an over-cap document becomes a
|
|
8
|
+
* `document-too-large` finding instead of a read. The JSON helpers turn a
|
|
9
|
+
* parse failure into a finding of the caller's kind and leave the value
|
|
10
|
+
* `unknown`, so each reader narrows fields with the `expect*` helpers and
|
|
11
|
+
* reports a wrong type with the field's name rather than trusting a cast.
|
|
12
|
+
*/
|
|
13
|
+
import { type PluginDocumentClass, type PluginFileIndex } from "./files.js";
|
|
14
|
+
import type { Findings } from "./messages.js";
|
|
15
|
+
import type { PluginErrorKind } from "./outcome.js";
|
|
16
|
+
/** The document's text, or `undefined` after a `document-too-large` finding. */
|
|
17
|
+
export declare function readText(index: PluginFileIndex, path: string, cls: PluginDocumentClass, findings: Findings): string | undefined;
|
|
18
|
+
/** The document's bytes, or `undefined` after a `document-too-large` finding. */
|
|
19
|
+
export declare function readBytes(index: PluginFileIndex, path: string, cls: PluginDocumentClass, findings: Findings): Uint8Array | undefined;
|
|
20
|
+
export type CappedRead = {
|
|
21
|
+
readonly ok: true;
|
|
22
|
+
readonly bytes: Uint8Array;
|
|
23
|
+
} | {
|
|
24
|
+
readonly ok: false;
|
|
25
|
+
readonly size: number;
|
|
26
|
+
readonly limit: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* One document through its class's cap, the outcome left to the caller:
|
|
30
|
+
* the declared size is checked before `read`, the returned length after.
|
|
31
|
+
* `readBytes` turns a refusal into a plugin finding; the eval reader turns
|
|
32
|
+
* it into a finding of its own vocabulary.
|
|
33
|
+
*/
|
|
34
|
+
export declare function readCapped(index: PluginFileIndex, path: string, cls: PluginDocumentClass): CappedRead;
|
|
35
|
+
/** A parsed JSON object (non-null, non-array), or `undefined` after a finding of `kind`. */
|
|
36
|
+
export declare function parseJsonObject(text: string, path: string, kind: Extract<PluginErrorKind, "manifest-unreadable" | "mcp-config-unreadable" | "hooks-unreadable" | "settings-unreadable">, findings: Findings): JsonObject | undefined;
|
|
37
|
+
export type JsonObject = Readonly<Record<string, unknown>>;
|
|
38
|
+
export declare function isJsonObject(value: unknown): value is JsonObject;
|
|
39
|
+
export declare function isStringArray(value: unknown): value is readonly string[];
|
|
40
|
+
export declare function isStringRecord(value: unknown): value is Readonly<Record<string, string>>;
|
|
41
|
+
/** A JSON value as a sentence can quote it: a string as itself, anything else serialised. */
|
|
42
|
+
export declare function describeValue(value: unknown): string;
|
|
43
|
+
/**
|
|
44
|
+
* The fields of `object`, in the document's own order. `Object.entries`
|
|
45
|
+
* reads own enumerable properties only, so a `__proto__` key in the JSON is
|
|
46
|
+
* just another entry here and never reaches a prototype.
|
|
47
|
+
*/
|
|
48
|
+
export declare function fields(object: JsonObject): readonly (readonly [string, unknown])[];
|
|
49
|
+
/** A string field or `undefined`; a present non-string reports `manifest-field-type`. */
|
|
50
|
+
export declare function optionalString(object: JsonObject, field: string, path: string, findings: Findings): string | undefined;
|
|
51
|
+
/** A string-array field or `undefined`; a present non-array-of-strings reports `manifest-field-type`. */
|
|
52
|
+
export declare function optionalStringArray(object: JsonObject, field: string, path: string, findings: Findings): readonly string[] | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* A field that may be one string or an array of strings (the vendor
|
|
55
|
+
* dialects' path fields), normalised to an array; `undefined` when absent.
|
|
56
|
+
*/
|
|
57
|
+
export declare function stringOrStringArray(object: JsonObject, field: string, path: string, findings: Findings): readonly string[] | undefined;
|
|
58
|
+
//# sourceMappingURL=documents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["src/documents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,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