@sublang/spex 4.1.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +438 -54
  2. package/dist/cli.js +81 -31
  3. package/dist/commands/add.d.ts +12 -0
  4. package/dist/commands/add.js +138 -0
  5. package/dist/commands/auth-target.d.ts +11 -0
  6. package/dist/commands/auth-target.js +50 -0
  7. package/dist/commands/environment.d.ts +123 -0
  8. package/dist/commands/environment.js +411 -0
  9. package/dist/commands/export.d.ts +21 -0
  10. package/dist/commands/export.js +663 -0
  11. package/dist/commands/home.d.ts +56 -0
  12. package/dist/commands/home.js +215 -0
  13. package/dist/commands/install.d.ts +2 -0
  14. package/dist/commands/install.js +48 -0
  15. package/dist/commands/list.d.ts +2 -0
  16. package/dist/commands/list.js +87 -0
  17. package/dist/commands/login.d.ts +2 -0
  18. package/dist/commands/login.js +211 -0
  19. package/dist/commands/logout.d.ts +2 -0
  20. package/dist/commands/logout.js +74 -0
  21. package/dist/commands/publish.d.ts +2 -0
  22. package/dist/commands/publish.js +120 -0
  23. package/dist/commands/remove.d.ts +2 -0
  24. package/dist/commands/remove.js +34 -0
  25. package/dist/commands/run.d.ts +50 -0
  26. package/dist/commands/run.js +309 -0
  27. package/dist/commands/search.d.ts +2 -0
  28. package/dist/commands/search.js +34 -0
  29. package/dist/commands/settle.d.ts +124 -0
  30. package/dist/commands/settle.js +475 -0
  31. package/dist/commands/update.d.ts +2 -0
  32. package/dist/commands/update.js +37 -0
  33. package/dist/commands/whoami.d.ts +2 -0
  34. package/dist/commands/whoami.js +75 -0
  35. package/dist/lib/environment/agent-folders.d.ts +14 -0
  36. package/dist/lib/environment/agent-folders.js +11 -0
  37. package/dist/lib/environment/archive.d.ts +26 -0
  38. package/dist/lib/environment/archive.js +91 -0
  39. package/dist/lib/environment/builtins.d.ts +112 -0
  40. package/dist/lib/environment/builtins.js +539 -0
  41. package/dist/lib/environment/citations.d.ts +75 -0
  42. package/dist/lib/environment/citations.js +267 -0
  43. package/dist/lib/environment/exports.d.ts +190 -0
  44. package/dist/lib/environment/exports.js +1029 -0
  45. package/dist/lib/environment/format.d.ts +133 -0
  46. package/dist/lib/environment/format.js +651 -0
  47. package/dist/lib/environment/git-source.d.ts +41 -0
  48. package/dist/lib/environment/git-source.js +159 -0
  49. package/dist/lib/environment/index.d.ts +20 -0
  50. package/dist/lib/environment/index.js +27 -0
  51. package/dist/lib/environment/install.d.ts +140 -0
  52. package/dist/lib/environment/install.js +694 -0
  53. package/dist/lib/environment/layout.d.ts +15 -0
  54. package/dist/lib/environment/layout.js +50 -0
  55. package/dist/lib/environment/lock.d.ts +87 -0
  56. package/dist/lib/environment/lock.js +305 -0
  57. package/dist/lib/environment/marker.d.ts +15 -0
  58. package/dist/lib/environment/marker.js +31 -0
  59. package/dist/lib/environment/own-paths.d.ts +59 -0
  60. package/dist/lib/environment/own-paths.js +174 -0
  61. package/dist/lib/environment/placed-record.d.ts +32 -0
  62. package/dist/lib/environment/placed-record.js +72 -0
  63. package/dist/lib/environment/registries.d.ts +25 -0
  64. package/dist/lib/environment/registries.js +75 -0
  65. package/dist/lib/environment/registry.d.ts +173 -0
  66. package/dist/lib/environment/registry.js +390 -0
  67. package/dist/lib/environment/requests.d.ts +108 -0
  68. package/dist/lib/environment/requests.js +403 -0
  69. package/dist/lib/environment/resolve.d.ts +70 -0
  70. package/dist/lib/environment/resolve.js +451 -0
  71. package/dist/lib/environment/semver.d.ts +30 -0
  72. package/dist/lib/environment/semver.js +130 -0
  73. package/dist/lib/environment/store.d.ts +23 -0
  74. package/dist/lib/environment/store.js +123 -0
  75. package/dist/lib/environment/tar.d.ts +27 -0
  76. package/dist/lib/environment/tar.js +219 -0
  77. package/dist/lib/files.d.ts +66 -0
  78. package/dist/lib/files.js +233 -0
  79. package/dist/lib/git-host.d.ts +579 -0
  80. package/dist/lib/git-host.js +1363 -0
  81. package/dist/lib/home-file.d.ts +124 -0
  82. package/dist/lib/home-file.js +288 -0
  83. package/dist/lib/instance.d.ts +63 -0
  84. package/dist/lib/instance.js +130 -0
  85. package/dist/lib/words.d.ts +32 -0
  86. package/dist/lib/words.js +27 -0
  87. package/dist/lint.js +8 -0
  88. package/dist/testing/index.d.ts +1 -0
  89. package/dist/testing/index.js +7 -0
  90. package/dist/testing/standin-registry.d.ts +94 -0
  91. package/dist/testing/standin-registry.js +449 -0
  92. package/package.json +37 -3
  93. package/dist/attached-cli.d.ts +0 -13
  94. package/dist/attached-cli.js +0 -247
  95. package/dist/attached-client.d.ts +0 -36
  96. package/dist/attached-client.js +0 -189
  97. package/dist/generated-protocol.d.ts +0 -2
  98. package/dist/generated-protocol.js +0 -6
@@ -0,0 +1,133 @@
1
+ export declare const ARTIFACT_KINDS: readonly ["source", "spec", "skill", "playbook", "applet"];
2
+ export type ArtifactKind = (typeof ARTIFACT_KINDS)[number];
3
+ export interface Artifact {
4
+ kind: ArtifactKind;
5
+ /** The original text's language; absent for an applet. */
6
+ language?: string;
7
+ from?: string;
8
+ requires: string[];
9
+ generatedBy?: {
10
+ agent: string;
11
+ model: string;
12
+ };
13
+ }
14
+ export interface Manifest {
15
+ format: 2;
16
+ org: string;
17
+ name: string;
18
+ version: string;
19
+ description?: string;
20
+ license?: string;
21
+ repository?: string;
22
+ dependencies: Record<string, string>;
23
+ /** The artifact kinds the project is offered, as the manifest's
24
+ * `provides` lists them; absent where it has none (environments-1). */
25
+ provides?: ArtifactKind[];
26
+ artifacts: Record<string, Artifact>;
27
+ }
28
+ /** One file of a release: its `/`-separated path relative to the
29
+ * release root, size, SHA-256 and owner-execute bit. */
30
+ export interface ReleaseFile {
31
+ path: string;
32
+ size: number;
33
+ sha256: string;
34
+ executable: boolean;
35
+ }
36
+ export interface Release {
37
+ manifest: Manifest;
38
+ files: ReleaseFile[];
39
+ }
40
+ export interface Issue {
41
+ path?: string;
42
+ rule: string;
43
+ message: string;
44
+ }
45
+ export declare class FormatError extends Error {
46
+ readonly issues: Issue[];
47
+ constructor(issues: Issue[], subject?: string);
48
+ }
49
+ export declare const ROOT_FILES: readonly ["meta.yaml", "README.md", "LICENSE"];
50
+ export declare const KIND_FOLDERS: Record<ArtifactKind, string>;
51
+ /** A lowercase kebab-case name of at most 64 characters: an org, a
52
+ * package, and — by the same rule — an Agent Skills name. */
53
+ export declare function isKebabName(value: unknown): value is string;
54
+ /** An Agent Skills name: a skill's or a playbook's id, or an alias. */
55
+ export declare const isSkillName: typeof isKebabName;
56
+ export declare function isPackageName(value: unknown): value is string;
57
+ export declare function parsePackageName(name: string): {
58
+ org: string;
59
+ pkg: string;
60
+ };
61
+ /** A well-formed BCP 47 tag, such as `en` or `zh-Hans`. */
62
+ export declare function isLanguageTag(value: unknown): value is string;
63
+ /** Compare key for "unique after NFC and case folding". */
64
+ export declare function foldPath(path: string): string;
65
+ /** Every portable-path rule a list of release paths breaks. */
66
+ export declare function portablePathIssues(paths: readonly string[]): Issue[];
67
+ /** Read a parsed `meta.yaml` value as a manifest of `format: 2`. */
68
+ export declare function parseManifest(raw: unknown): {
69
+ manifest: Manifest | null;
70
+ issues: Issue[];
71
+ };
72
+ /** Parse `meta.yaml` text, YAML errors reported as issues. */
73
+ export declare function parseManifestText(text: string): {
74
+ manifest: Manifest | null;
75
+ issues: Issue[];
76
+ };
77
+ /** The manifest as `meta.yaml` text, fields in the format's order. */
78
+ export declare function serializeManifest(manifest: Manifest): string;
79
+ /** The ids of the artifacts a release provides (environments-1,
80
+ * DR-174): each whose kind `provides` lists — every kind where it is
81
+ * absent — save a sibling's support, whatever `provides` lists. An
82
+ * artifact a sibling names in `from` is that sibling's support, and so
83
+ * is one a sibling of another kind names in `requires`: a playbook's
84
+ * skill, a skill's spec. A playbook a playbook requires, or a skill a
85
+ * skill requires, is a peer and stays provided. */
86
+ export declare function providedArtifacts(manifest: Manifest): Set<string>;
87
+ /** Where a release path lies: a root file, an artifact's folder (with
88
+ * the spec's one file checked), or nowhere. */
89
+ export type PathPlace = {
90
+ root: true;
91
+ } | {
92
+ root: false;
93
+ kind: ArtifactKind;
94
+ id: string;
95
+ language?: string;
96
+ folder: string;
97
+ misplaced?: string;
98
+ } | null;
99
+ export declare function placeOf(path: string, pkg: string): PathPlace;
100
+ /** The folder prefix of an artifact in a language (none for an applet). */
101
+ export declare function artifactFolder(kind: ArtifactKind, id: string, language: string | null | undefined): string;
102
+ /** Whether a release path belongs to an artifact in a language. */
103
+ export declare function inArtifact(path: string, kind: ArtifactKind, id: string, language: string | null | undefined, pkg: string): boolean;
104
+ /** Each artifact's language folders, read from the files. */
105
+ export declare function artifactLanguages(manifest: Manifest, files: readonly {
106
+ path: string;
107
+ }[]): Record<string, string[]>;
108
+ /** A spec file's item ids, in order, from its `### <pkg>-<N>` and
109
+ * `#### <pkg>-<N>` headings. */
110
+ export declare function specItemIds(text: string, pkg: string): string[];
111
+ /** The `name` of a SKILL.md's YAML frontmatter, if it has one. */
112
+ export declare function skillFrontmatterName(text: string): string | undefined;
113
+ export type ReadReleaseFile = (path: string) => Uint8Array | undefined;
114
+ /** Every layout rule of environments-1 the release breaks. */
115
+ export declare function checkRelease(dir: string | ReadReleaseFile, manifest: Manifest, files: readonly ReleaseFile[]): Issue[];
116
+ export declare function sha256Hex(bytes: Uint8Array | string): string;
117
+ /** Every file of a folder with its digest and executable bit, but what
118
+ * the compiler keeps for itself beside a playbook; a link or a special
119
+ * file is an issue, never followed. */
120
+ export declare function listReleaseFiles(dir: string): Promise<{
121
+ files: ReleaseFile[];
122
+ issues: Issue[];
123
+ }>;
124
+ /** Read the manifest of a folder, refusing a missing or unknown one. */
125
+ export declare function readManifest(dir: string): Manifest;
126
+ /** Read and check a release folder (environments-1). */
127
+ export declare function readRelease(dir: string): Promise<Release>;
128
+ /** Every field the registry requires to publish that the manifest
129
+ * lacks, named as the registry names it (environments-10). */
130
+ export declare function publishIssues(manifest: Manifest): Issue[];
131
+ /** Read a release folder as publishing takes it (environments-10):
132
+ * every release check, then the fields the registry requires. */
133
+ export declare function readPublishableRelease(dir: string): Promise<Release>;