@dot-agent/compiler 0.10.0 → 0.10.2
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/dist/core.cjs +16 -248
- package/dist/core.d.cts +2 -3
- package/dist/core.d.mts +2 -0
- package/dist/core.mjs +2 -0
- package/dist/index.cjs +1029 -1305
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -27
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +66 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1075 -0
- package/dist/index.mjs.map +1 -0
- package/dist/namespace-0cuKn3-s.cjs +319 -0
- package/dist/namespace-0cuKn3-s.cjs.map +1 -0
- package/dist/namespace-CjeG5-7u.mjs +189 -0
- package/dist/namespace-CjeG5-7u.mjs.map +1 -0
- package/dist/namespace-DsoVSANe.d.cts +129 -0
- package/dist/namespace-DsoVSANe.d.cts.map +1 -0
- package/dist/namespace-DsoVSANe.d.mts +129 -0
- package/dist/namespace-DsoVSANe.d.mts.map +1 -0
- package/package.json +27 -19
- package/dist/chunk-AYXHOOUX.js +0 -213
- package/dist/chunk-AYXHOOUX.js.map +0 -1
- package/dist/core-D2X2Eohl.d.cts +0 -120
- package/dist/core-D2X2Eohl.d.ts +0 -120
- package/dist/core.cjs.map +0 -1
- package/dist/core.d.ts +0 -3
- package/dist/core.js +0 -27
- package/dist/core.js.map +0 -1
- package/dist/index.d.ts +0 -64
- package/dist/index.js +0 -1134
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import JSZip from "jszip";
|
|
2
|
+
//#region src/generated-version.ts
|
|
3
|
+
const COMPILER_VERSION = "0.10.2";
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/manifest.ts
|
|
6
|
+
function parseAboutme(json) {
|
|
7
|
+
if (!json.dslVersion) throw new Error("Missing dslVersion in aboutme.json");
|
|
8
|
+
if (!json.id) throw new Error("Missing id in aboutme.json");
|
|
9
|
+
if (!json.name) throw new Error("Missing name in aboutme.json");
|
|
10
|
+
if (!json.description) throw new Error("Missing description in aboutme.json");
|
|
11
|
+
if (!json.domain) throw new Error("Missing domain in aboutme.json");
|
|
12
|
+
if (!json.compiler) throw new Error("Missing compiler in aboutme.json");
|
|
13
|
+
if (!Array.isArray(json.capabilities)) throw new Error("Missing capabilities array in aboutme.json");
|
|
14
|
+
if (!Array.isArray(json.requires)) throw new Error("Missing requires array in aboutme.json");
|
|
15
|
+
if (!json.integrity) throw new Error("Missing integrity in aboutme.json");
|
|
16
|
+
return {
|
|
17
|
+
dslVersion: json.dslVersion,
|
|
18
|
+
id: json.id,
|
|
19
|
+
name: json.name,
|
|
20
|
+
description: json.description,
|
|
21
|
+
version: json.version ?? "",
|
|
22
|
+
domain: json.domain,
|
|
23
|
+
license: json.license ?? "",
|
|
24
|
+
persona: json.persona,
|
|
25
|
+
purpose: json.purpose ?? "unknown",
|
|
26
|
+
compiler: json.compiler,
|
|
27
|
+
commit: json.commit,
|
|
28
|
+
capabilities: json.capabilities,
|
|
29
|
+
requires: json.requires,
|
|
30
|
+
integrity: json.integrity
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function buildAboutme(opts) {
|
|
34
|
+
return {
|
|
35
|
+
dslVersion: `dot-agent/0.1`,
|
|
36
|
+
id: opts.id,
|
|
37
|
+
name: opts.name,
|
|
38
|
+
description: opts.description,
|
|
39
|
+
version: opts.version,
|
|
40
|
+
domain: opts.domain,
|
|
41
|
+
license: opts.license ?? "",
|
|
42
|
+
persona: opts.persona,
|
|
43
|
+
purpose: opts.purpose ?? "unknown",
|
|
44
|
+
compiler: opts.compiler,
|
|
45
|
+
commit: opts.commit,
|
|
46
|
+
capabilities: opts.capabilities ?? [],
|
|
47
|
+
requires: opts.requires ?? [],
|
|
48
|
+
integrity: opts.integrity
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function aboutmeToJson(aboutme) {
|
|
52
|
+
return JSON.stringify(aboutme, null, 2);
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/id.ts
|
|
56
|
+
const KNOWN_PLATFORMS = [
|
|
57
|
+
"github.com",
|
|
58
|
+
"gitlab.com",
|
|
59
|
+
"codeberg.org",
|
|
60
|
+
"sr.ht"
|
|
61
|
+
];
|
|
62
|
+
function parseNamespaceName(identifier) {
|
|
63
|
+
const atIdx = identifier.indexOf("@");
|
|
64
|
+
if (atIdx !== -1 && (identifier.indexOf("/") === -1 || atIdx < identifier.indexOf("/"))) {
|
|
65
|
+
const slashIdx = identifier.indexOf("/");
|
|
66
|
+
if (slashIdx === -1) throw new Error(`Invalid agent ID: email namespace requires a name after '/' (got '${identifier}')`);
|
|
67
|
+
return {
|
|
68
|
+
namespace: identifier.slice(0, slashIdx),
|
|
69
|
+
name: identifier.slice(slashIdx + 1)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
for (const platform of KNOWN_PLATFORMS) if (identifier.startsWith(platform + "/")) {
|
|
73
|
+
const afterPlatform = identifier.slice(platform.length + 1);
|
|
74
|
+
const slashIdx = afterPlatform.indexOf("/");
|
|
75
|
+
if (slashIdx === -1) throw new Error(`Invalid agent ID: '${platform}' namespace requires a user segment and a name (got '${identifier}')`);
|
|
76
|
+
return {
|
|
77
|
+
namespace: platform + "/" + afterPlatform.slice(0, slashIdx),
|
|
78
|
+
name: afterPlatform.slice(slashIdx + 1)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const lastSlash = identifier.lastIndexOf("/");
|
|
82
|
+
if (lastSlash === -1) throw new Error(`Invalid agent ID: missing '/' separator in '${identifier}'`);
|
|
83
|
+
return {
|
|
84
|
+
namespace: identifier.slice(0, lastSlash),
|
|
85
|
+
name: identifier.slice(lastSlash + 1)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function parseId(id) {
|
|
89
|
+
if (!id) throw new Error("Invalid agent ID: empty string");
|
|
90
|
+
const colonIdx = id.indexOf(":");
|
|
91
|
+
let identifier;
|
|
92
|
+
let version;
|
|
93
|
+
let digest;
|
|
94
|
+
if (colonIdx === -1) identifier = id;
|
|
95
|
+
else {
|
|
96
|
+
identifier = id.slice(0, colonIdx);
|
|
97
|
+
const rest = id.slice(colonIdx + 1);
|
|
98
|
+
if (!rest) throw new Error(`Invalid agent ID: empty version after ':' in '${id}'`);
|
|
99
|
+
const tildeIdx = rest.indexOf("~");
|
|
100
|
+
if (tildeIdx === -1) version = rest;
|
|
101
|
+
else {
|
|
102
|
+
version = rest.slice(0, tildeIdx);
|
|
103
|
+
digest = rest.slice(tildeIdx + 1);
|
|
104
|
+
if (!version) throw new Error(`Invalid agent ID: empty version before '~' in '${id}'`);
|
|
105
|
+
if (!digest) throw new Error(`Invalid agent ID: empty digest after '~' in '${id}'`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const { namespace, name } = parseNamespaceName(identifier);
|
|
109
|
+
if (!namespace) throw new Error(`Invalid agent ID: empty namespace in '${id}'`);
|
|
110
|
+
if (!name) throw new Error(`Invalid agent ID: empty name in '${id}'`);
|
|
111
|
+
return {
|
|
112
|
+
namespace,
|
|
113
|
+
name,
|
|
114
|
+
version,
|
|
115
|
+
digest
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function buildId(parts) {
|
|
119
|
+
const { namespace, name, version, digest } = parts;
|
|
120
|
+
if (!namespace || !name) throw new Error("Missing required ID parts: namespace and name");
|
|
121
|
+
if (digest && !version) throw new Error("Invalid ID parts: digest requires version");
|
|
122
|
+
let result = `${namespace}/${name}`;
|
|
123
|
+
if (version) {
|
|
124
|
+
result += `:${version}`;
|
|
125
|
+
if (digest) result += `~${digest}`;
|
|
126
|
+
}
|
|
127
|
+
return result.toLowerCase();
|
|
128
|
+
}
|
|
129
|
+
function slugify(name) {
|
|
130
|
+
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
131
|
+
}
|
|
132
|
+
const VERSION_RE = /^v?\d+(\.\d+){0,2}(-[0-9A-Za-z.]+)?(\+[0-9A-Za-z.]+)?$/i;
|
|
133
|
+
function isValidVersion(version) {
|
|
134
|
+
return VERSION_RE.test(version);
|
|
135
|
+
}
|
|
136
|
+
function extractDigest(id) {
|
|
137
|
+
try {
|
|
138
|
+
return parseId(id).digest ?? "";
|
|
139
|
+
} catch {
|
|
140
|
+
return "";
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function extractName(id) {
|
|
144
|
+
try {
|
|
145
|
+
return parseId(id).name;
|
|
146
|
+
} catch {
|
|
147
|
+
return "";
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function validateMagicBytes(bytes) {
|
|
151
|
+
if (!(bytes[0] === 80 && bytes[1] === 75 && bytes[2] === 3 && bytes[3] === 4)) throw new Error("Not a valid .agent file (invalid magic bytes)");
|
|
152
|
+
}
|
|
153
|
+
function validateZipBomb(zip, compressedSize) {
|
|
154
|
+
let totalUncompressed = 0;
|
|
155
|
+
zip.forEach((_path, file) => {
|
|
156
|
+
if (!file.dir) totalUncompressed += file._data?.uncompressedSize || 0;
|
|
157
|
+
});
|
|
158
|
+
if (totalUncompressed > 524288e3) throw new Error(`Bundle exceeds 500MB uncompressed: ${totalUncompressed}`);
|
|
159
|
+
if (totalUncompressed / compressedSize > 100) throw new Error(`Compression ratio exceeds 100x: ${(totalUncompressed / compressedSize).toFixed(1)}x`);
|
|
160
|
+
}
|
|
161
|
+
function createZip() {
|
|
162
|
+
return new JSZip();
|
|
163
|
+
}
|
|
164
|
+
async function extractFiles(zip, filter) {
|
|
165
|
+
const files = /* @__PURE__ */ new Map();
|
|
166
|
+
const promises = [];
|
|
167
|
+
zip.forEach((relativePath, file) => {
|
|
168
|
+
if (file.dir) return;
|
|
169
|
+
if (filter && !filter.some((f) => relativePath.startsWith(f))) return;
|
|
170
|
+
promises.push(file.async("text").then((content) => {
|
|
171
|
+
files.set(relativePath, content);
|
|
172
|
+
}));
|
|
173
|
+
});
|
|
174
|
+
await Promise.all(promises);
|
|
175
|
+
return files;
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/namespace.ts
|
|
179
|
+
const CONTENT_NAMESPACES = ["guides", "knowledge"];
|
|
180
|
+
function isInContentNamespace(bundlePath) {
|
|
181
|
+
return classifyContentPath(bundlePath) !== null;
|
|
182
|
+
}
|
|
183
|
+
function classifyContentPath(bundlePath) {
|
|
184
|
+
return CONTENT_NAMESPACES.find((ns) => bundlePath.startsWith(`${ns}/`)) ?? null;
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
export { COMPILER_VERSION as _, extractFiles as a, buildId as c, isValidVersion as d, parseId as f, parseAboutme as g, buildAboutme as h, createZip as i, extractDigest as l, aboutmeToJson as m, classifyContentPath as n, validateMagicBytes as o, slugify as p, isInContentNamespace as r, validateZipBomb as s, CONTENT_NAMESPACES as t, extractName as u };
|
|
188
|
+
|
|
189
|
+
//# sourceMappingURL=namespace-CjeG5-7u.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace-CjeG5-7u.mjs","names":[],"sources":["../src/generated-version.ts","../src/manifest.ts","../src/id.ts","../src/zip-core.ts","../src/namespace.ts"],"sourcesContent":["// Generated by scripts/embed-version.mjs from dsl/VERSION and package.json — do not edit by hand.\nexport const DSL_VERSION = '0.1'\nexport const COMPILER_VERSION = '0.10.2'\n","// Copyright 2026 Danilo Borges\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n\nimport type { AboutMe, BuildAboutmeOptions } from './types.js'\nimport { DSL_VERSION } from './generated-version.js'\n\nexport function parseAboutme(json: any): AboutMe {\n if (!json.dslVersion) throw new Error('Missing dslVersion in aboutme.json')\n if (!json.id) throw new Error('Missing id in aboutme.json')\n if (!json.name) throw new Error('Missing name in aboutme.json')\n if (!json.description) throw new Error('Missing description in aboutme.json')\n if (!json.domain) throw new Error('Missing domain in aboutme.json')\n if (!json.compiler) throw new Error('Missing compiler in aboutme.json')\n if (!Array.isArray(json.capabilities)) throw new Error('Missing capabilities array in aboutme.json')\n if (!Array.isArray(json.requires)) throw new Error('Missing requires array in aboutme.json')\n if (!json.integrity) throw new Error('Missing integrity in aboutme.json')\n\n return {\n dslVersion: json.dslVersion,\n id: json.id,\n name: json.name,\n description: json.description,\n version: json.version ?? '',\n domain: json.domain,\n license: json.license ?? '',\n persona: json.persona,\n purpose: json.purpose ?? 'unknown',\n compiler: json.compiler,\n commit: json.commit,\n capabilities: json.capabilities,\n requires: json.requires,\n integrity: json.integrity,\n }\n}\n\nexport function buildAboutme(opts: BuildAboutmeOptions): AboutMe {\n return {\n dslVersion: `dot-agent/${DSL_VERSION}`,\n id: opts.id,\n name: opts.name,\n description: opts.description,\n version: opts.version,\n domain: opts.domain,\n license: opts.license ?? '',\n persona: opts.persona,\n purpose: opts.purpose ?? 'unknown',\n compiler: opts.compiler,\n commit: opts.commit,\n capabilities: opts.capabilities ?? [],\n requires: opts.requires ?? [],\n integrity: opts.integrity,\n }\n}\n\nexport function aboutmeToJson(aboutme: AboutMe): string {\n return JSON.stringify(aboutme, null, 2)\n}\n","// Copyright 2026 Danilo Borges\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { IdParts } from './types.js'\n\n// Code hosting platforms whose namespace format is platform/user rather than plain domain.\n// The list is maintained by the compiler and updated via CLI releases.\nexport const KNOWN_PLATFORMS = ['github.com', 'gitlab.com', 'codeberg.org', 'sr.ht'] as const\n\nfunction parseNamespaceName(identifier: string): { namespace: string; name: string } {\n // Email namespace: @ appears before any /\n const atIdx = identifier.indexOf('@')\n if (atIdx !== -1 && (identifier.indexOf('/') === -1 || atIdx < identifier.indexOf('/'))) {\n const slashIdx = identifier.indexOf('/')\n if (slashIdx === -1) {\n throw new Error(`Invalid agent ID: email namespace requires a name after '/' (got '${identifier}')`)\n }\n return {\n namespace: identifier.slice(0, slashIdx),\n name: identifier.slice(slashIdx + 1),\n }\n }\n\n // Known code-hosting platforms: namespace is platform/user, name is the next segment.\n for (const platform of KNOWN_PLATFORMS) {\n if (identifier.startsWith(platform + '/')) {\n const afterPlatform = identifier.slice(platform.length + 1)\n const slashIdx = afterPlatform.indexOf('/')\n if (slashIdx === -1) {\n throw new Error(\n `Invalid agent ID: '${platform}' namespace requires a user segment and a name (got '${identifier}')`,\n )\n }\n return {\n namespace: platform + '/' + afterPlatform.slice(0, slashIdx),\n name: afterPlatform.slice(slashIdx + 1),\n }\n }\n }\n\n // Domain or reserved keyword (e.g. 'unknown'): last '/' separates namespace from name.\n const lastSlash = identifier.lastIndexOf('/')\n if (lastSlash === -1) {\n throw new Error(`Invalid agent ID: missing '/' separator in '${identifier}'`)\n }\n return {\n namespace: identifier.slice(0, lastSlash),\n name: identifier.slice(lastSlash + 1),\n }\n}\n\nexport function parseId(id: string): IdParts {\n if (!id) throw new Error('Invalid agent ID: empty string')\n\n // Phase 1: split on the first ':' to isolate the identifier from version~digest.\n const colonIdx = id.indexOf(':')\n\n let identifier: string\n let version: string | undefined\n let digest: string | undefined\n\n if (colonIdx === -1) {\n // Form A: namespace/name\n identifier = id\n } else {\n identifier = id.slice(0, colonIdx)\n const rest = id.slice(colonIdx + 1)\n if (!rest) throw new Error(`Invalid agent ID: empty version after ':' in '${id}'`)\n\n // Phase 2: split version~digest\n const tildeIdx = rest.indexOf('~')\n if (tildeIdx === -1) {\n // Form B: namespace/name:version\n version = rest\n } else {\n // Form D: namespace/name:version~digest\n version = rest.slice(0, tildeIdx)\n digest = rest.slice(tildeIdx + 1)\n if (!version) throw new Error(`Invalid agent ID: empty version before '~' in '${id}'`)\n if (!digest) throw new Error(`Invalid agent ID: empty digest after '~' in '${id}'`)\n }\n }\n\n // Phase 3: extract namespace and name from the identifier\n const { namespace, name } = parseNamespaceName(identifier)\n\n if (!namespace) throw new Error(`Invalid agent ID: empty namespace in '${id}'`)\n if (!name) throw new Error(`Invalid agent ID: empty name in '${id}'`)\n\n return { namespace, name, version, digest }\n}\n\nexport function buildId(parts: IdParts): string {\n const { namespace, name, version, digest } = parts\n if (!namespace || !name) {\n throw new Error('Missing required ID parts: namespace and name')\n }\n if (digest && !version) {\n throw new Error('Invalid ID parts: digest requires version')\n }\n let result = `${namespace}/${name}`\n if (version) {\n result += `:${version}`\n if (digest) result += `~${digest}`\n }\n // Ids are always lowercase — domains, platform usernames (GitHub/GitLab/\n // Codeberg/Sourcehut) and email local-parts are all case-insensitive in\n // practice, so normalizing here is safe and gives every id a single shape.\n return result.toLowerCase()\n}\n\n// Turns a human display name (e.g. \"Fridge Assistant\", from `agent Fridge\n// Assistant` in the DSL — spaces/capitalization are deliberate there) into\n// the kebab-case slug used for an id's name segment.\nexport function slugify(name: string): string {\n return name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n}\n\n// Accepts optional leading 'v' (id spec examples use it; monorepo tags after\n// their '@' split don't), 1-3 dot-separated numeric groups, and optional\n// -prerelease / +build suffixes — e.g. v1.0, 2.3.1, v1.0.0-alpha.1, 1.0+build.\nconst VERSION_RE = /^v?\\d+(\\.\\d+){0,2}(-[0-9A-Za-z.]+)?(\\+[0-9A-Za-z.]+)?$/i\n\nexport function isValidVersion(version: string): boolean {\n return VERSION_RE.test(version)\n}\n\nexport function extractDigest(id: string): string {\n try {\n return parseId(id).digest ?? ''\n } catch {\n return ''\n }\n}\n\nexport function extractName(id: string): string {\n try {\n return parseId(id).name\n } catch {\n return ''\n }\n}\n","// Copyright 2026 Danilo Borges\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport JSZip from 'jszip'\n\nexport const MAX_ZIP_SIZE = 500 * 1024 * 1024\nexport const MAX_COMPRESSION_RATIO = 100\n\nexport function validateMagicBytes(bytes: Uint8Array): void {\n if (!(bytes[0] === 0x50 && bytes[1] === 0x4b && bytes[2] === 0x03 && bytes[3] === 0x04)) {\n throw new Error('Not a valid .agent file (invalid magic bytes)')\n }\n}\n\nexport function validateZipBomb(zip: JSZip, compressedSize: number): void {\n let totalUncompressed = 0\n zip.forEach((_path, file) => {\n if (!file.dir) totalUncompressed += (file as any)._data?.uncompressedSize || 0\n })\n if (totalUncompressed > MAX_ZIP_SIZE) {\n throw new Error(`Bundle exceeds 500MB uncompressed: ${totalUncompressed}`)\n }\n if (totalUncompressed / compressedSize > MAX_COMPRESSION_RATIO) {\n throw new Error(`Compression ratio exceeds 100x: ${(totalUncompressed / compressedSize).toFixed(1)}x`)\n }\n}\n\nexport function createZip(): JSZip {\n return new JSZip()\n}\n\nexport async function extractFiles(zip: JSZip, filter?: string[]): Promise<Map<string, string>> {\n const files = new Map<string, string>()\n const promises: Promise<void>[] = []\n\n zip.forEach((relativePath, file) => {\n if (file.dir) return\n if (filter && !filter.some(f => relativePath.startsWith(f))) return\n promises.push(\n file.async('text').then(content => {\n files.set(relativePath, content)\n })\n )\n })\n\n await Promise.all(promises)\n return files\n}\n","// Copyright 2026 Danilo Borges\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n\n// The two directories the runtime can actually serve content from: pack.ts's\n// collectFiles() bundles a guide/teach reference at its literal path, but\n// bundle.ts, sdk/load.ts, and the CLI's MCP resource handlers each classify a\n// bundled file into guides/knowledge purely by this prefix — a reference\n// resolving outside them is bundled but unreachable (see pack.ts's W016).\n// Single source of truth so the three sites can't drift on the prefix list.\nexport const CONTENT_NAMESPACES = ['guides', 'knowledge'] as const\nexport type ContentNamespace = (typeof CONTENT_NAMESPACES)[number]\n\nexport function isInContentNamespace(bundlePath: string): boolean {\n return classifyContentPath(bundlePath) !== null\n}\n\nexport function classifyContentPath(bundlePath: string): ContentNamespace | null {\n return CONTENT_NAMESPACES.find(ns => bundlePath.startsWith(`${ns}/`)) ?? null\n}\n"],"mappings":";;AAEA,MAAa,mBAAmB;;;ACShC,SAAgB,aAAa,MAAoB;CAC/C,IAAI,CAAC,KAAK,YAAY,MAAM,IAAI,MAAM,oCAAoC;CAC1E,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,MAAM,4BAA4B;CAC1D,IAAI,CAAC,KAAK,MAAM,MAAM,IAAI,MAAM,8BAA8B;CAC9D,IAAI,CAAC,KAAK,aAAa,MAAM,IAAI,MAAM,qCAAqC;CAC5E,IAAI,CAAC,KAAK,QAAQ,MAAM,IAAI,MAAM,gCAAgC;CAClE,IAAI,CAAC,KAAK,UAAU,MAAM,IAAI,MAAM,kCAAkC;CACtE,IAAI,CAAC,MAAM,QAAQ,KAAK,YAAY,GAAG,MAAM,IAAI,MAAM,4CAA4C;CACnG,IAAI,CAAC,MAAM,QAAQ,KAAK,QAAQ,GAAG,MAAM,IAAI,MAAM,wCAAwC;CAC3F,IAAI,CAAC,KAAK,WAAW,MAAM,IAAI,MAAM,mCAAmC;CAExE,OAAO;EACL,YAAY,KAAK;EACjB,IAAI,KAAK;EACT,MAAM,KAAK;EACX,aAAa,KAAK;EAClB,SAAS,KAAK,WAAW;EACzB,QAAQ,KAAK;EACb,SAAS,KAAK,WAAW;EACzB,SAAS,KAAK;EACd,SAAS,KAAK,WAAW;EACzB,UAAU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AAS;EAClC,IAAI,KAAK,KAAK;EACd,IAAI,UAAU,CAAC,OAAO,MAAK,MAAK,aAAa,WAAW,CAAC,CAAC,GAAG;EAC7D,SAAS,KACP,KAAK,MAAM,MAAM,CAAC,CAAC,MAAK,YAAW;GACjC,MAAM,IAAI,cAAc,OAAO;EACjC,CAAC,CACH;CACF,CAAC;CAED,MAAM,QAAQ,IAAI,QAAQ;CAC1B,OAAO;AACT;;;AC5CA,MAAa,qBAAqB,CAAC,UAAU,WAAW;AAGxD,SAAgB,qBAAqB,YAA6B;CAChE,OAAO,oBAAoB,UAAU,MAAM;AAC7C;AAEA,SAAgB,oBAAoB,YAA6C;CAC/E,OAAO,mBAAmB,MAAK,OAAM,WAAW,WAAW,GAAG,GAAG,EAAE,CAAC,KAAK;AAC3E"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { AgentDecl, AnnotatedRef, BehaviorFile, DescriptionFile, OntologyRef, PropertyDecl, PropertyType, StateDef, Statement, TriggerDecl, TypeDefinition } from "@dot-agent/parser-dsl";
|
|
2
|
+
import JSZip from "jszip";
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
type LangId = 'description' | 'behavior';
|
|
5
|
+
/** Structured diagnostic from the Rust WASM parser. */
|
|
6
|
+
interface ParseDiagnostic {
|
|
7
|
+
severity: 'error' | 'warning' | 'info' | 'hint';
|
|
8
|
+
code: string;
|
|
9
|
+
message: string;
|
|
10
|
+
hint?: string;
|
|
11
|
+
/** [line, col] 1-based, absent when position is unavailable (e.g. serde errors). */
|
|
12
|
+
start?: [number, number];
|
|
13
|
+
end?: [number, number];
|
|
14
|
+
}
|
|
15
|
+
interface LintMessage {
|
|
16
|
+
file: string;
|
|
17
|
+
line: number;
|
|
18
|
+
col: number;
|
|
19
|
+
severity: 'error' | 'warning' | 'info' | 'hint';
|
|
20
|
+
code: string;
|
|
21
|
+
message: string;
|
|
22
|
+
hint?: string;
|
|
23
|
+
}
|
|
24
|
+
interface IdParts {
|
|
25
|
+
namespace: string;
|
|
26
|
+
name: string;
|
|
27
|
+
version?: string;
|
|
28
|
+
digest?: string;
|
|
29
|
+
}
|
|
30
|
+
interface Capability {
|
|
31
|
+
id: string;
|
|
32
|
+
description: string;
|
|
33
|
+
}
|
|
34
|
+
interface Integrity {
|
|
35
|
+
sha256: string;
|
|
36
|
+
types?: string;
|
|
37
|
+
files?: string;
|
|
38
|
+
}
|
|
39
|
+
interface AboutMe {
|
|
40
|
+
dslVersion: string;
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
version: string;
|
|
45
|
+
domain: string;
|
|
46
|
+
license: string;
|
|
47
|
+
persona?: string;
|
|
48
|
+
purpose: string;
|
|
49
|
+
compiler: string;
|
|
50
|
+
commit?: string;
|
|
51
|
+
capabilities: Capability[];
|
|
52
|
+
requires: AnnotatedRef[];
|
|
53
|
+
integrity: Integrity;
|
|
54
|
+
}
|
|
55
|
+
interface AgentFiles {
|
|
56
|
+
description: string;
|
|
57
|
+
behavior: string;
|
|
58
|
+
persona?: string;
|
|
59
|
+
guides: Array<{
|
|
60
|
+
path: string;
|
|
61
|
+
content: string;
|
|
62
|
+
}>;
|
|
63
|
+
knowledge: Array<{
|
|
64
|
+
path: string;
|
|
65
|
+
content: string;
|
|
66
|
+
}>;
|
|
67
|
+
behaviors: Array<{
|
|
68
|
+
path: string;
|
|
69
|
+
content: string;
|
|
70
|
+
}>;
|
|
71
|
+
}
|
|
72
|
+
interface AgentBundle {
|
|
73
|
+
id: string;
|
|
74
|
+
aboutme: AboutMe;
|
|
75
|
+
files: AgentFiles;
|
|
76
|
+
}
|
|
77
|
+
interface PackOptions {
|
|
78
|
+
dir?: string;
|
|
79
|
+
out?: string;
|
|
80
|
+
commit?: string;
|
|
81
|
+
version?: string;
|
|
82
|
+
description?: string;
|
|
83
|
+
}
|
|
84
|
+
interface PackResult {
|
|
85
|
+
path: string;
|
|
86
|
+
id: string;
|
|
87
|
+
warnings: LintMessage[];
|
|
88
|
+
}
|
|
89
|
+
interface BuildAboutmeOptions {
|
|
90
|
+
id: string;
|
|
91
|
+
name: string;
|
|
92
|
+
description: string;
|
|
93
|
+
version: string;
|
|
94
|
+
domain: string;
|
|
95
|
+
license?: string;
|
|
96
|
+
persona?: string;
|
|
97
|
+
purpose?: string;
|
|
98
|
+
compiler: string;
|
|
99
|
+
commit?: string;
|
|
100
|
+
capabilities?: Capability[];
|
|
101
|
+
requires?: AnnotatedRef[];
|
|
102
|
+
integrity: Integrity;
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/manifest.d.ts
|
|
106
|
+
declare function parseAboutme(json: any): AboutMe;
|
|
107
|
+
declare function buildAboutme(opts: BuildAboutmeOptions): AboutMe;
|
|
108
|
+
declare function aboutmeToJson(aboutme: AboutMe): string;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/id.d.ts
|
|
111
|
+
declare function parseId(id: string): IdParts;
|
|
112
|
+
declare function buildId(parts: IdParts): string;
|
|
113
|
+
declare function extractDigest(id: string): string;
|
|
114
|
+
declare function extractName(id: string): string;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/zip-core.d.ts
|
|
117
|
+
declare function validateMagicBytes(bytes: Uint8Array): void;
|
|
118
|
+
declare function validateZipBomb(zip: JSZip, compressedSize: number): void;
|
|
119
|
+
declare function createZip(): JSZip;
|
|
120
|
+
declare function extractFiles(zip: JSZip, filter?: string[]): Promise<Map<string, string>>;
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/namespace.d.ts
|
|
123
|
+
declare const CONTENT_NAMESPACES: readonly ['guides', 'knowledge'];
|
|
124
|
+
type ContentNamespace = (typeof CONTENT_NAMESPACES)[number];
|
|
125
|
+
declare function isInContentNamespace(bundlePath: string): boolean;
|
|
126
|
+
declare function classifyContentPath(bundlePath: string): ContentNamespace | null;
|
|
127
|
+
//#endregion
|
|
128
|
+
export { PackOptions as A, Capability as C, LangId as D, Integrity as E, StateDef as F, Statement as I, TriggerDecl as L, ParseDiagnostic as M, PropertyDecl as N, LintMessage as O, PropertyType as P, TypeDefinition as R, BuildAboutmeOptions as S, IdParts as T, AgentBundle as _, createZip as a, AnnotatedRef as b, validateZipBomb as c, extractName as d, parseId as f, AboutMe as g, parseAboutme as h, isInContentNamespace as i, PackResult as j, OntologyRef as k, buildId as l, buildAboutme as m, ContentNamespace as n, extractFiles as o, aboutmeToJson as p, classifyContentPath as r, validateMagicBytes as s, CONTENT_NAMESPACES as t, extractDigest as u, AgentDecl as v, DescriptionFile as w, BehaviorFile as x, AgentFiles as y };
|
|
129
|
+
//# sourceMappingURL=namespace-DsoVSANe.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace-DsoVSANe.d.cts","names":[],"sources":["../src/types.ts","../src/manifest.ts","../src/id.ts","../src/zip-core.ts","../src/namespace.ts"],"mappings":";;;KAQY;;UAiCK;EACf;EACA;EACA;EACA;;EAEA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd,UAAU;EACV,WAAW;;UAGI;EACf;EACA;EACA;EACA,QAAQ;IAAQ;IAAc;;EAC9B,WAAW;IAAQ;IAAc;;EACjC,WAAW;IAAQ;IAAc;;;UAGlB;EACf;EACA,SAAS;EACT,OAAO;;UAGQ;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA,UAAU;;UAGK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf,WAAW;EACX,WAAW;;;;iBC/HG,aAAa,YAAY;iBA6BzB,aAAa,MAAM,sBAAsB;iBAmBzC,cAAc,SAAS;;;iBCGvB,QAAQ,aAAa;iBAyCrB,QAAQ,OAAO;iBAsCf,cAAc;iBAQd,YAAY;;;iBClIZ,mBAAmB,OAAO;iBAM1B,gBAAgB,KAAK,OAAO;iBAa5B,aAAa;iBAIP,aAAa,KAAK,OAAO,oBAAoB,QAAQ;;;cC5B9D;KACD,2BAA2B;iBAEvB,qBAAqB;iBAIrB,oBAAoB,qBAAqB"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { AgentDecl, AnnotatedRef, BehaviorFile, DescriptionFile, OntologyRef, PropertyDecl, PropertyType, StateDef, Statement, TriggerDecl, TypeDefinition } from "@dot-agent/parser-dsl";
|
|
2
|
+
import JSZip from "jszip";
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
type LangId = 'description' | 'behavior';
|
|
5
|
+
/** Structured diagnostic from the Rust WASM parser. */
|
|
6
|
+
interface ParseDiagnostic {
|
|
7
|
+
severity: 'error' | 'warning' | 'info' | 'hint';
|
|
8
|
+
code: string;
|
|
9
|
+
message: string;
|
|
10
|
+
hint?: string;
|
|
11
|
+
/** [line, col] 1-based, absent when position is unavailable (e.g. serde errors). */
|
|
12
|
+
start?: [number, number];
|
|
13
|
+
end?: [number, number];
|
|
14
|
+
}
|
|
15
|
+
interface LintMessage {
|
|
16
|
+
file: string;
|
|
17
|
+
line: number;
|
|
18
|
+
col: number;
|
|
19
|
+
severity: 'error' | 'warning' | 'info' | 'hint';
|
|
20
|
+
code: string;
|
|
21
|
+
message: string;
|
|
22
|
+
hint?: string;
|
|
23
|
+
}
|
|
24
|
+
interface IdParts {
|
|
25
|
+
namespace: string;
|
|
26
|
+
name: string;
|
|
27
|
+
version?: string;
|
|
28
|
+
digest?: string;
|
|
29
|
+
}
|
|
30
|
+
interface Capability {
|
|
31
|
+
id: string;
|
|
32
|
+
description: string;
|
|
33
|
+
}
|
|
34
|
+
interface Integrity {
|
|
35
|
+
sha256: string;
|
|
36
|
+
types?: string;
|
|
37
|
+
files?: string;
|
|
38
|
+
}
|
|
39
|
+
interface AboutMe {
|
|
40
|
+
dslVersion: string;
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
version: string;
|
|
45
|
+
domain: string;
|
|
46
|
+
license: string;
|
|
47
|
+
persona?: string;
|
|
48
|
+
purpose: string;
|
|
49
|
+
compiler: string;
|
|
50
|
+
commit?: string;
|
|
51
|
+
capabilities: Capability[];
|
|
52
|
+
requires: AnnotatedRef[];
|
|
53
|
+
integrity: Integrity;
|
|
54
|
+
}
|
|
55
|
+
interface AgentFiles {
|
|
56
|
+
description: string;
|
|
57
|
+
behavior: string;
|
|
58
|
+
persona?: string;
|
|
59
|
+
guides: Array<{
|
|
60
|
+
path: string;
|
|
61
|
+
content: string;
|
|
62
|
+
}>;
|
|
63
|
+
knowledge: Array<{
|
|
64
|
+
path: string;
|
|
65
|
+
content: string;
|
|
66
|
+
}>;
|
|
67
|
+
behaviors: Array<{
|
|
68
|
+
path: string;
|
|
69
|
+
content: string;
|
|
70
|
+
}>;
|
|
71
|
+
}
|
|
72
|
+
interface AgentBundle {
|
|
73
|
+
id: string;
|
|
74
|
+
aboutme: AboutMe;
|
|
75
|
+
files: AgentFiles;
|
|
76
|
+
}
|
|
77
|
+
interface PackOptions {
|
|
78
|
+
dir?: string;
|
|
79
|
+
out?: string;
|
|
80
|
+
commit?: string;
|
|
81
|
+
version?: string;
|
|
82
|
+
description?: string;
|
|
83
|
+
}
|
|
84
|
+
interface PackResult {
|
|
85
|
+
path: string;
|
|
86
|
+
id: string;
|
|
87
|
+
warnings: LintMessage[];
|
|
88
|
+
}
|
|
89
|
+
interface BuildAboutmeOptions {
|
|
90
|
+
id: string;
|
|
91
|
+
name: string;
|
|
92
|
+
description: string;
|
|
93
|
+
version: string;
|
|
94
|
+
domain: string;
|
|
95
|
+
license?: string;
|
|
96
|
+
persona?: string;
|
|
97
|
+
purpose?: string;
|
|
98
|
+
compiler: string;
|
|
99
|
+
commit?: string;
|
|
100
|
+
capabilities?: Capability[];
|
|
101
|
+
requires?: AnnotatedRef[];
|
|
102
|
+
integrity: Integrity;
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/manifest.d.ts
|
|
106
|
+
declare function parseAboutme(json: any): AboutMe;
|
|
107
|
+
declare function buildAboutme(opts: BuildAboutmeOptions): AboutMe;
|
|
108
|
+
declare function aboutmeToJson(aboutme: AboutMe): string;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/id.d.ts
|
|
111
|
+
declare function parseId(id: string): IdParts;
|
|
112
|
+
declare function buildId(parts: IdParts): string;
|
|
113
|
+
declare function extractDigest(id: string): string;
|
|
114
|
+
declare function extractName(id: string): string;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/zip-core.d.ts
|
|
117
|
+
declare function validateMagicBytes(bytes: Uint8Array): void;
|
|
118
|
+
declare function validateZipBomb(zip: JSZip, compressedSize: number): void;
|
|
119
|
+
declare function createZip(): JSZip;
|
|
120
|
+
declare function extractFiles(zip: JSZip, filter?: string[]): Promise<Map<string, string>>;
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/namespace.d.ts
|
|
123
|
+
declare const CONTENT_NAMESPACES: readonly ['guides', 'knowledge'];
|
|
124
|
+
type ContentNamespace = (typeof CONTENT_NAMESPACES)[number];
|
|
125
|
+
declare function isInContentNamespace(bundlePath: string): boolean;
|
|
126
|
+
declare function classifyContentPath(bundlePath: string): ContentNamespace | null;
|
|
127
|
+
//#endregion
|
|
128
|
+
export { PackOptions as A, Capability as C, LangId as D, Integrity as E, StateDef as F, Statement as I, TriggerDecl as L, ParseDiagnostic as M, PropertyDecl as N, LintMessage as O, PropertyType as P, TypeDefinition as R, BuildAboutmeOptions as S, IdParts as T, AgentBundle as _, createZip as a, AnnotatedRef as b, validateZipBomb as c, extractName as d, parseId as f, AboutMe as g, parseAboutme as h, isInContentNamespace as i, PackResult as j, OntologyRef as k, buildId as l, buildAboutme as m, ContentNamespace as n, extractFiles as o, aboutmeToJson as p, classifyContentPath as r, validateMagicBytes as s, CONTENT_NAMESPACES as t, extractDigest as u, AgentDecl as v, DescriptionFile as w, BehaviorFile as x, AgentFiles as y };
|
|
129
|
+
//# sourceMappingURL=namespace-DsoVSANe.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace-DsoVSANe.d.mts","names":[],"sources":["../src/types.ts","../src/manifest.ts","../src/id.ts","../src/zip-core.ts","../src/namespace.ts"],"mappings":";;;KAQY;;UAiCK;EACf;EACA;EACA;EACA;;EAEA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd,UAAU;EACV,WAAW;;UAGI;EACf;EACA;EACA;EACA,QAAQ;IAAQ;IAAc;;EAC9B,WAAW;IAAQ;IAAc;;EACjC,WAAW;IAAQ;IAAc;;;UAGlB;EACf;EACA,SAAS;EACT,OAAO;;UAGQ;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA,UAAU;;UAGK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf,WAAW;EACX,WAAW;;;;iBC/HG,aAAa,YAAY;iBA6BzB,aAAa,MAAM,sBAAsB;iBAmBzC,cAAc,SAAS;;;iBCGvB,QAAQ,aAAa;iBAyCrB,QAAQ,OAAO;iBAsCf,cAAc;iBAQd,YAAY;;;iBClIZ,mBAAmB,OAAO;iBAM1B,gBAAgB,KAAK,OAAO;iBAa5B,aAAa;iBAIP,aAAa,KAAK,OAAO,oBAAoB,QAAQ;;;cC5B9D;KACD,2BAA2B;iBAEvB,qBAAqB;iBAIrB,oBAAoB,qBAAqB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dot-agent/compiler",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Compiler for the dot-agent DSL: AST parsing, linting, graph extraction and .agent packaging",
|
|
6
6
|
"author": {
|
|
@@ -36,27 +36,41 @@
|
|
|
36
36
|
"dot-agent"
|
|
37
37
|
],
|
|
38
38
|
"type": "module",
|
|
39
|
-
"main": "dist/index.
|
|
40
|
-
"
|
|
39
|
+
"main": "dist/index.cjs",
|
|
40
|
+
"module": "dist/index.mjs",
|
|
41
|
+
"types": "dist/index.d.mts",
|
|
41
42
|
"exports": {
|
|
42
43
|
".": {
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
"import": {
|
|
45
|
+
"types": "./dist/index.d.mts",
|
|
46
|
+
"default": "./dist/index.mjs"
|
|
47
|
+
},
|
|
48
|
+
"require": {
|
|
49
|
+
"types": "./dist/index.d.cts",
|
|
50
|
+
"default": "./dist/index.cjs"
|
|
51
|
+
}
|
|
46
52
|
},
|
|
47
53
|
"./core": {
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
"import": {
|
|
55
|
+
"types": "./dist/core.d.mts",
|
|
56
|
+
"default": "./dist/core.mjs"
|
|
57
|
+
},
|
|
58
|
+
"require": {
|
|
59
|
+
"types": "./dist/core.d.cts",
|
|
60
|
+
"default": "./dist/core.cjs"
|
|
61
|
+
}
|
|
51
62
|
}
|
|
52
63
|
},
|
|
53
64
|
"files": [
|
|
54
65
|
"dist"
|
|
55
66
|
],
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">=24.0.0"
|
|
69
|
+
},
|
|
56
70
|
"scripts": {
|
|
57
71
|
"prebuild": "node scripts/embed-version.mjs",
|
|
58
|
-
"build": "
|
|
59
|
-
"dev": "
|
|
72
|
+
"build": "tsdown",
|
|
73
|
+
"dev": "tsdown --watch",
|
|
60
74
|
"pretypecheck": "node scripts/embed-version.mjs",
|
|
61
75
|
"typecheck": "tsc --noEmit",
|
|
62
76
|
"pretest": "node scripts/embed-version.mjs",
|
|
@@ -65,17 +79,11 @@
|
|
|
65
79
|
},
|
|
66
80
|
"dependencies": {
|
|
67
81
|
"@clack/prompts": "^1.7.0",
|
|
68
|
-
"@dot-agent/parser-dsl": "0.10.
|
|
69
|
-
"@dot-agent/tree-sitter": "0.10.
|
|
82
|
+
"@dot-agent/parser-dsl": "0.10.2",
|
|
83
|
+
"@dot-agent/tree-sitter": "0.10.1",
|
|
70
84
|
"jszip": "^3.10.1",
|
|
71
85
|
"web-tree-sitter": "^0.26.9"
|
|
72
86
|
},
|
|
73
|
-
"devDependencies": {
|
|
74
|
-
"@types/node": "^20.0.0",
|
|
75
|
-
"tsup": "^8.0.0",
|
|
76
|
-
"typescript": "^5.0.0",
|
|
77
|
-
"vitest": "^1.6.0"
|
|
78
|
-
},
|
|
79
87
|
"publishConfig": {
|
|
80
88
|
"access": "public"
|
|
81
89
|
}
|