@dot-agent/compiler 0.1.0 → 0.5.0-alpha.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/{chunk-IT25ILTQ.js → chunk-P5LFGJ6P.js} +30 -4
- package/dist/chunk-P5LFGJ6P.js.map +1 -0
- package/dist/{core-DLZGpzev.d.cts → core-b-7c6X6q.d.cts} +29 -70
- package/dist/{core-DLZGpzev.d.ts → core-b-7c6X6q.d.ts} +29 -70
- package/dist/core.cjs +31 -5
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -1
- package/dist/core.d.ts +2 -1
- package/dist/core.js +7 -3
- package/dist/index.cjs +286 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -5
- package/dist/index.d.ts +14 -5
- package/dist/index.js +263 -65
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
- package/dist/chunk-IT25ILTQ.js.map +0 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
// src/generated-version.ts
|
|
2
|
+
var DSL_VERSION = "0.1-alpha";
|
|
3
|
+
var COMPILER_VERSION = "0.5.0-alpha.2";
|
|
4
|
+
|
|
1
5
|
// src/manifest.ts
|
|
2
6
|
function parseAboutme(json) {
|
|
3
|
-
if (!json.
|
|
7
|
+
if (!json.dslVersion) throw new Error("Missing dslVersion in aboutme.json");
|
|
4
8
|
if (!json.id) throw new Error("Missing id in aboutme.json");
|
|
5
9
|
if (!json.name) throw new Error("Missing name in aboutme.json");
|
|
6
10
|
if (!json.description) throw new Error("Missing description in aboutme.json");
|
|
@@ -12,7 +16,7 @@ function parseAboutme(json) {
|
|
|
12
16
|
if (!Array.isArray(json.requires)) throw new Error("Missing requires array in aboutme.json");
|
|
13
17
|
if (!json.integrity) throw new Error("Missing integrity in aboutme.json");
|
|
14
18
|
return {
|
|
15
|
-
|
|
19
|
+
dslVersion: json.dslVersion,
|
|
16
20
|
id: json.id,
|
|
17
21
|
name: json.name,
|
|
18
22
|
description: json.description,
|
|
@@ -30,7 +34,7 @@ function parseAboutme(json) {
|
|
|
30
34
|
}
|
|
31
35
|
function buildAboutme(opts) {
|
|
32
36
|
return {
|
|
33
|
-
|
|
37
|
+
dslVersion: `dot-agent/${DSL_VERSION}`,
|
|
34
38
|
id: opts.id,
|
|
35
39
|
name: opts.name,
|
|
36
40
|
description: opts.description,
|
|
@@ -147,6 +151,25 @@ function extractName(id) {
|
|
|
147
151
|
|
|
148
152
|
// src/zip-core.ts
|
|
149
153
|
import JSZip from "jszip";
|
|
154
|
+
var MAX_ZIP_SIZE = 500 * 1024 * 1024;
|
|
155
|
+
var MAX_COMPRESSION_RATIO = 100;
|
|
156
|
+
function validateMagicBytes(bytes) {
|
|
157
|
+
if (!(bytes[0] === 80 && bytes[1] === 75 && bytes[2] === 3 && bytes[3] === 4)) {
|
|
158
|
+
throw new Error("Not a valid .agent file (invalid magic bytes)");
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function validateZipBomb(zip, compressedSize) {
|
|
162
|
+
let totalUncompressed = 0;
|
|
163
|
+
zip.forEach((_path, file) => {
|
|
164
|
+
if (!file.dir) totalUncompressed += file._data?.uncompressedSize || 0;
|
|
165
|
+
});
|
|
166
|
+
if (totalUncompressed > MAX_ZIP_SIZE) {
|
|
167
|
+
throw new Error(`Bundle exceeds 500MB uncompressed: ${totalUncompressed}`);
|
|
168
|
+
}
|
|
169
|
+
if (totalUncompressed / compressedSize > MAX_COMPRESSION_RATIO) {
|
|
170
|
+
throw new Error(`Compression ratio exceeds 100x: ${(totalUncompressed / compressedSize).toFixed(1)}x`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
150
173
|
function createZip() {
|
|
151
174
|
return new JSZip();
|
|
152
175
|
}
|
|
@@ -167,6 +190,7 @@ async function extractFiles(zip, filter) {
|
|
|
167
190
|
}
|
|
168
191
|
|
|
169
192
|
export {
|
|
193
|
+
COMPILER_VERSION,
|
|
170
194
|
parseAboutme,
|
|
171
195
|
buildAboutme,
|
|
172
196
|
aboutmeToJson,
|
|
@@ -174,7 +198,9 @@ export {
|
|
|
174
198
|
buildId,
|
|
175
199
|
extractDigest,
|
|
176
200
|
extractName,
|
|
201
|
+
validateMagicBytes,
|
|
202
|
+
validateZipBomb,
|
|
177
203
|
createZip,
|
|
178
204
|
extractFiles
|
|
179
205
|
};
|
|
180
|
-
//# sourceMappingURL=chunk-
|
|
206
|
+
//# sourceMappingURL=chunk-P5LFGJ6P.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generated-version.ts","../src/manifest.ts","../src/id.ts","../src/zip-core.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-alpha'\nexport const COMPILER_VERSION = '0.5.0-alpha.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.version) throw new Error('Missing version in aboutme.json')\n if (!json.domain) throw new Error('Missing domain in aboutme.json')\n if (!json.persona) throw new Error('Missing persona 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 return result\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"],"mappings":";AACO,IAAM,cAAc;AACpB,IAAM,mBAAmB;;;ACSzB,SAAS,aAAa,MAAoB;AAC/C,MAAI,CAAC,KAAK,WAAY,OAAM,IAAI,MAAM,oCAAoC;AAC1E,MAAI,CAAC,KAAK,GAAI,OAAM,IAAI,MAAM,4BAA4B;AAC1D,MAAI,CAAC,KAAK,KAAM,OAAM,IAAI,MAAM,8BAA8B;AAC9D,MAAI,CAAC,KAAK,YAAa,OAAM,IAAI,MAAM,qCAAqC;AAC5E,MAAI,CAAC,KAAK,QAAS,OAAM,IAAI,MAAM,iCAAiC;AACpE,MAAI,CAAC,KAAK,OAAQ,OAAM,IAAI,MAAM,gCAAgC;AAClE,MAAI,CAAC,KAAK,QAAS,OAAM,IAAI,MAAM,iCAAiC;AACpE,MAAI,CAAC,KAAK,SAAU,OAAM,IAAI,MAAM,kCAAkC;AACtE,MAAI,CAAC,MAAM,QAAQ,KAAK,YAAY,EAAG,OAAM,IAAI,MAAM,4CAA4C;AACnG,MAAI,CAAC,MAAM,QAAQ,KAAK,QAAQ,EAAG,OAAM,IAAI,MAAM,wCAAwC;AAC3F,MAAI,CAAC,KAAK,UAAW,OAAM,IAAI,MAAM,mCAAmC;AAExE,SAAO;AAAA,IACL,YAAY,KAAK;AAAA,IACjB,IAAI,KAAK;AAAA,IACT,MAAM,KAAK;AAAA,IACX,aAAa,KAAK;AAAA,IAClB,SAAS,KAAK;AAAA,IACd,QAAQ,KAAK;AAAA,IACb,SAAS,KAAK,WAAW;AAAA,IACzB,SAAS,KAAK;AAAA,IACd,SAAS,KAAK,WAAW;AAAA,IACzB,UAAU,KAAK;AAAA,IACf,QAAQ,KAAK;AAAA,IACb,cA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EAC3E;AACA,MAAI,oBAAoB,iBAAiB,uBAAuB;AAC9D,UAAM,IAAI,MAAM,oCAAoC,oBAAoB,gBAAgB,QAAQ,CAAC,CAAC,GAAG;AAAA,EACvG;AACF;AAEO,SAAS,YAAmB;AACjC,SAAO,IAAI,MAAM;AACnB;AAEA,eAAsB,aAAa,KAAY,QAAiD;AAC9F,QAAM,QAAQ,oBAAI,IAAoB;AACtC,QAAM,WAA4B,CAAC;AAEnC,MAAI,QAAQ,CAAC,cAAc,SAAS;AAClC,QAAI,KAAK,IAAK;AACd,QAAI,UAAU,CAAC,OAAO,KAAK,OAAK,aAAa,WAAW,CAAC,CAAC,EAAG;AAC7D,aAAS;AAAA,MACP,KAAK,MAAM,MAAM,EAAE,KAAK,aAAW;AACjC,cAAM,IAAI,cAAc,OAAO;AAAA,MACjC,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,QAAM,QAAQ,IAAI,QAAQ;AAC1B,SAAO;AACT;","names":[]}
|
|
@@ -1,74 +1,8 @@
|
|
|
1
|
+
import { AnnotatedRef } from '@dot-agent/parser-dsl';
|
|
1
2
|
import JSZip from 'jszip';
|
|
2
3
|
|
|
3
4
|
type LangId = 'description' | 'behavior';
|
|
4
|
-
|
|
5
|
-
type: string;
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
}
|
|
8
|
-
interface StateDef {
|
|
9
|
-
name: string;
|
|
10
|
-
body: BehaviorStatement[];
|
|
11
|
-
}
|
|
12
|
-
interface TriggerDecl {
|
|
13
|
-
event: string;
|
|
14
|
-
body: BehaviorStatement[];
|
|
15
|
-
}
|
|
16
|
-
interface BehaviorFile {
|
|
17
|
-
merges: string[];
|
|
18
|
-
global_triggers: TriggerDecl[];
|
|
19
|
-
states: StateDef[];
|
|
20
|
-
}
|
|
21
|
-
interface OntologyRef {
|
|
22
|
-
uri: string;
|
|
23
|
-
label?: string;
|
|
24
|
-
}
|
|
25
|
-
interface AgentDecl {
|
|
26
|
-
name: string;
|
|
27
|
-
domain?: string;
|
|
28
|
-
license?: string;
|
|
29
|
-
terms?: string;
|
|
30
|
-
privacy?: string;
|
|
31
|
-
}
|
|
32
|
-
interface AnnotatedRef {
|
|
33
|
-
name: string;
|
|
34
|
-
description?: string;
|
|
35
|
-
}
|
|
36
|
-
type PropertyType = {
|
|
37
|
-
kind: 'primitive';
|
|
38
|
-
value: string;
|
|
39
|
-
} | {
|
|
40
|
-
kind: 'reference';
|
|
41
|
-
value: string;
|
|
42
|
-
} | {
|
|
43
|
-
kind: 'array';
|
|
44
|
-
value: PropertyType;
|
|
45
|
-
} | {
|
|
46
|
-
kind: 'enum';
|
|
47
|
-
value: string[];
|
|
48
|
-
};
|
|
49
|
-
interface PropertyDecl {
|
|
50
|
-
name: string;
|
|
51
|
-
type: PropertyType;
|
|
52
|
-
is_optional: boolean;
|
|
53
|
-
description?: string;
|
|
54
|
-
}
|
|
55
|
-
interface TypeDefinition {
|
|
56
|
-
name: string;
|
|
57
|
-
category: OntologyRef;
|
|
58
|
-
concept?: OntologyRef;
|
|
59
|
-
properties: PropertyDecl[];
|
|
60
|
-
}
|
|
61
|
-
interface DescriptionFile {
|
|
62
|
-
agent: AgentDecl;
|
|
63
|
-
description?: string;
|
|
64
|
-
persona?: string;
|
|
65
|
-
behavior?: string;
|
|
66
|
-
requires: AnnotatedRef[];
|
|
67
|
-
input: AnnotatedRef[];
|
|
68
|
-
capabilities: AnnotatedRef[];
|
|
69
|
-
output: AnnotatedRef[];
|
|
70
|
-
types: TypeDefinition[];
|
|
71
|
-
}
|
|
5
|
+
|
|
72
6
|
/** Structured diagnostic from the Rust WASM parser. */
|
|
73
7
|
interface ParseDiagnostic {
|
|
74
8
|
severity: 'error' | 'warning' | 'info' | 'hint';
|
|
@@ -104,7 +38,7 @@ interface Integrity {
|
|
|
104
38
|
files?: string;
|
|
105
39
|
}
|
|
106
40
|
interface AboutMe {
|
|
107
|
-
|
|
41
|
+
dslVersion: string;
|
|
108
42
|
id: string;
|
|
109
43
|
name: string;
|
|
110
44
|
description: string;
|
|
@@ -119,11 +53,34 @@ interface AboutMe {
|
|
|
119
53
|
requires: AnnotatedRef[];
|
|
120
54
|
integrity: Integrity;
|
|
121
55
|
}
|
|
56
|
+
interface AgentFiles {
|
|
57
|
+
description: string;
|
|
58
|
+
behavior: string;
|
|
59
|
+
soul?: string;
|
|
60
|
+
guides: Array<{
|
|
61
|
+
path: string;
|
|
62
|
+
content: string;
|
|
63
|
+
}>;
|
|
64
|
+
knowledge: Array<{
|
|
65
|
+
path: string;
|
|
66
|
+
content: string;
|
|
67
|
+
}>;
|
|
68
|
+
behaviors: Array<{
|
|
69
|
+
path: string;
|
|
70
|
+
content: string;
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
interface AgentBundle {
|
|
74
|
+
id: string;
|
|
75
|
+
aboutme: AboutMe;
|
|
76
|
+
files: AgentFiles;
|
|
77
|
+
}
|
|
122
78
|
interface PackOptions {
|
|
123
79
|
dir?: string;
|
|
124
80
|
out?: string;
|
|
125
81
|
commit?: string;
|
|
126
82
|
version?: string;
|
|
83
|
+
description?: string;
|
|
127
84
|
}
|
|
128
85
|
interface PackResult {
|
|
129
86
|
path: string;
|
|
@@ -155,7 +112,9 @@ declare function buildId(parts: IdParts): string;
|
|
|
155
112
|
declare function extractDigest(id: string): string;
|
|
156
113
|
declare function extractName(id: string): string;
|
|
157
114
|
|
|
115
|
+
declare function validateMagicBytes(bytes: Uint8Array): void;
|
|
116
|
+
declare function validateZipBomb(zip: JSZip, compressedSize: number): void;
|
|
158
117
|
declare function createZip(): JSZip;
|
|
159
118
|
declare function extractFiles(zip: JSZip, filter?: string[]): Promise<Map<string, string>>;
|
|
160
119
|
|
|
161
|
-
export { type
|
|
120
|
+
export { type AgentBundle as A, type BuildAboutmeOptions as B, type Capability as C, type IdParts as I, type LangId as L, type ParseDiagnostic as P, type LintMessage as a, type PackOptions as b, type PackResult as c, type AboutMe as d, type AgentFiles as e, type Integrity as f, aboutmeToJson as g, buildAboutme as h, buildId as i, createZip as j, extractDigest as k, extractFiles as l, extractName as m, parseId as n, validateZipBomb as o, parseAboutme as p, validateMagicBytes as v };
|
|
@@ -1,74 +1,8 @@
|
|
|
1
|
+
import { AnnotatedRef } from '@dot-agent/parser-dsl';
|
|
1
2
|
import JSZip from 'jszip';
|
|
2
3
|
|
|
3
4
|
type LangId = 'description' | 'behavior';
|
|
4
|
-
|
|
5
|
-
type: string;
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
}
|
|
8
|
-
interface StateDef {
|
|
9
|
-
name: string;
|
|
10
|
-
body: BehaviorStatement[];
|
|
11
|
-
}
|
|
12
|
-
interface TriggerDecl {
|
|
13
|
-
event: string;
|
|
14
|
-
body: BehaviorStatement[];
|
|
15
|
-
}
|
|
16
|
-
interface BehaviorFile {
|
|
17
|
-
merges: string[];
|
|
18
|
-
global_triggers: TriggerDecl[];
|
|
19
|
-
states: StateDef[];
|
|
20
|
-
}
|
|
21
|
-
interface OntologyRef {
|
|
22
|
-
uri: string;
|
|
23
|
-
label?: string;
|
|
24
|
-
}
|
|
25
|
-
interface AgentDecl {
|
|
26
|
-
name: string;
|
|
27
|
-
domain?: string;
|
|
28
|
-
license?: string;
|
|
29
|
-
terms?: string;
|
|
30
|
-
privacy?: string;
|
|
31
|
-
}
|
|
32
|
-
interface AnnotatedRef {
|
|
33
|
-
name: string;
|
|
34
|
-
description?: string;
|
|
35
|
-
}
|
|
36
|
-
type PropertyType = {
|
|
37
|
-
kind: 'primitive';
|
|
38
|
-
value: string;
|
|
39
|
-
} | {
|
|
40
|
-
kind: 'reference';
|
|
41
|
-
value: string;
|
|
42
|
-
} | {
|
|
43
|
-
kind: 'array';
|
|
44
|
-
value: PropertyType;
|
|
45
|
-
} | {
|
|
46
|
-
kind: 'enum';
|
|
47
|
-
value: string[];
|
|
48
|
-
};
|
|
49
|
-
interface PropertyDecl {
|
|
50
|
-
name: string;
|
|
51
|
-
type: PropertyType;
|
|
52
|
-
is_optional: boolean;
|
|
53
|
-
description?: string;
|
|
54
|
-
}
|
|
55
|
-
interface TypeDefinition {
|
|
56
|
-
name: string;
|
|
57
|
-
category: OntologyRef;
|
|
58
|
-
concept?: OntologyRef;
|
|
59
|
-
properties: PropertyDecl[];
|
|
60
|
-
}
|
|
61
|
-
interface DescriptionFile {
|
|
62
|
-
agent: AgentDecl;
|
|
63
|
-
description?: string;
|
|
64
|
-
persona?: string;
|
|
65
|
-
behavior?: string;
|
|
66
|
-
requires: AnnotatedRef[];
|
|
67
|
-
input: AnnotatedRef[];
|
|
68
|
-
capabilities: AnnotatedRef[];
|
|
69
|
-
output: AnnotatedRef[];
|
|
70
|
-
types: TypeDefinition[];
|
|
71
|
-
}
|
|
5
|
+
|
|
72
6
|
/** Structured diagnostic from the Rust WASM parser. */
|
|
73
7
|
interface ParseDiagnostic {
|
|
74
8
|
severity: 'error' | 'warning' | 'info' | 'hint';
|
|
@@ -104,7 +38,7 @@ interface Integrity {
|
|
|
104
38
|
files?: string;
|
|
105
39
|
}
|
|
106
40
|
interface AboutMe {
|
|
107
|
-
|
|
41
|
+
dslVersion: string;
|
|
108
42
|
id: string;
|
|
109
43
|
name: string;
|
|
110
44
|
description: string;
|
|
@@ -119,11 +53,34 @@ interface AboutMe {
|
|
|
119
53
|
requires: AnnotatedRef[];
|
|
120
54
|
integrity: Integrity;
|
|
121
55
|
}
|
|
56
|
+
interface AgentFiles {
|
|
57
|
+
description: string;
|
|
58
|
+
behavior: string;
|
|
59
|
+
soul?: string;
|
|
60
|
+
guides: Array<{
|
|
61
|
+
path: string;
|
|
62
|
+
content: string;
|
|
63
|
+
}>;
|
|
64
|
+
knowledge: Array<{
|
|
65
|
+
path: string;
|
|
66
|
+
content: string;
|
|
67
|
+
}>;
|
|
68
|
+
behaviors: Array<{
|
|
69
|
+
path: string;
|
|
70
|
+
content: string;
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
interface AgentBundle {
|
|
74
|
+
id: string;
|
|
75
|
+
aboutme: AboutMe;
|
|
76
|
+
files: AgentFiles;
|
|
77
|
+
}
|
|
122
78
|
interface PackOptions {
|
|
123
79
|
dir?: string;
|
|
124
80
|
out?: string;
|
|
125
81
|
commit?: string;
|
|
126
82
|
version?: string;
|
|
83
|
+
description?: string;
|
|
127
84
|
}
|
|
128
85
|
interface PackResult {
|
|
129
86
|
path: string;
|
|
@@ -155,7 +112,9 @@ declare function buildId(parts: IdParts): string;
|
|
|
155
112
|
declare function extractDigest(id: string): string;
|
|
156
113
|
declare function extractName(id: string): string;
|
|
157
114
|
|
|
115
|
+
declare function validateMagicBytes(bytes: Uint8Array): void;
|
|
116
|
+
declare function validateZipBomb(zip: JSZip, compressedSize: number): void;
|
|
158
117
|
declare function createZip(): JSZip;
|
|
159
118
|
declare function extractFiles(zip: JSZip, filter?: string[]): Promise<Map<string, string>>;
|
|
160
119
|
|
|
161
|
-
export { type
|
|
120
|
+
export { type AgentBundle as A, type BuildAboutmeOptions as B, type Capability as C, type IdParts as I, type LangId as L, type ParseDiagnostic as P, type LintMessage as a, type PackOptions as b, type PackResult as c, type AboutMe as d, type AgentFiles as e, type Integrity as f, aboutmeToJson as g, buildAboutme as h, buildId as i, createZip as j, extractDigest as k, extractFiles as l, extractName as m, parseId as n, validateZipBomb as o, parseAboutme as p, validateMagicBytes as v };
|
package/dist/core.cjs
CHANGED
|
@@ -38,13 +38,18 @@ __export(core_exports, {
|
|
|
38
38
|
extractFiles: () => extractFiles,
|
|
39
39
|
extractName: () => extractName,
|
|
40
40
|
parseAboutme: () => parseAboutme,
|
|
41
|
-
parseId: () => parseId
|
|
41
|
+
parseId: () => parseId,
|
|
42
|
+
validateMagicBytes: () => validateMagicBytes,
|
|
43
|
+
validateZipBomb: () => validateZipBomb
|
|
42
44
|
});
|
|
43
45
|
module.exports = __toCommonJS(core_exports);
|
|
44
46
|
|
|
47
|
+
// src/generated-version.ts
|
|
48
|
+
var DSL_VERSION = "0.1-alpha";
|
|
49
|
+
|
|
45
50
|
// src/manifest.ts
|
|
46
51
|
function parseAboutme(json) {
|
|
47
|
-
if (!json.
|
|
52
|
+
if (!json.dslVersion) throw new Error("Missing dslVersion in aboutme.json");
|
|
48
53
|
if (!json.id) throw new Error("Missing id in aboutme.json");
|
|
49
54
|
if (!json.name) throw new Error("Missing name in aboutme.json");
|
|
50
55
|
if (!json.description) throw new Error("Missing description in aboutme.json");
|
|
@@ -56,7 +61,7 @@ function parseAboutme(json) {
|
|
|
56
61
|
if (!Array.isArray(json.requires)) throw new Error("Missing requires array in aboutme.json");
|
|
57
62
|
if (!json.integrity) throw new Error("Missing integrity in aboutme.json");
|
|
58
63
|
return {
|
|
59
|
-
|
|
64
|
+
dslVersion: json.dslVersion,
|
|
60
65
|
id: json.id,
|
|
61
66
|
name: json.name,
|
|
62
67
|
description: json.description,
|
|
@@ -74,7 +79,7 @@ function parseAboutme(json) {
|
|
|
74
79
|
}
|
|
75
80
|
function buildAboutme(opts) {
|
|
76
81
|
return {
|
|
77
|
-
|
|
82
|
+
dslVersion: `dot-agent/${DSL_VERSION}`,
|
|
78
83
|
id: opts.id,
|
|
79
84
|
name: opts.name,
|
|
80
85
|
description: opts.description,
|
|
@@ -191,6 +196,25 @@ function extractName(id) {
|
|
|
191
196
|
|
|
192
197
|
// src/zip-core.ts
|
|
193
198
|
var import_jszip = __toESM(require("jszip"), 1);
|
|
199
|
+
var MAX_ZIP_SIZE = 500 * 1024 * 1024;
|
|
200
|
+
var MAX_COMPRESSION_RATIO = 100;
|
|
201
|
+
function validateMagicBytes(bytes) {
|
|
202
|
+
if (!(bytes[0] === 80 && bytes[1] === 75 && bytes[2] === 3 && bytes[3] === 4)) {
|
|
203
|
+
throw new Error("Not a valid .agent file (invalid magic bytes)");
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function validateZipBomb(zip, compressedSize) {
|
|
207
|
+
let totalUncompressed = 0;
|
|
208
|
+
zip.forEach((_path, file) => {
|
|
209
|
+
if (!file.dir) totalUncompressed += file._data?.uncompressedSize || 0;
|
|
210
|
+
});
|
|
211
|
+
if (totalUncompressed > MAX_ZIP_SIZE) {
|
|
212
|
+
throw new Error(`Bundle exceeds 500MB uncompressed: ${totalUncompressed}`);
|
|
213
|
+
}
|
|
214
|
+
if (totalUncompressed / compressedSize > MAX_COMPRESSION_RATIO) {
|
|
215
|
+
throw new Error(`Compression ratio exceeds 100x: ${(totalUncompressed / compressedSize).toFixed(1)}x`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
194
218
|
function createZip() {
|
|
195
219
|
return new import_jszip.default();
|
|
196
220
|
}
|
|
@@ -219,6 +243,8 @@ async function extractFiles(zip, filter) {
|
|
|
219
243
|
extractFiles,
|
|
220
244
|
extractName,
|
|
221
245
|
parseAboutme,
|
|
222
|
-
parseId
|
|
246
|
+
parseId,
|
|
247
|
+
validateMagicBytes,
|
|
248
|
+
validateZipBomb
|
|
223
249
|
});
|
|
224
250
|
//# sourceMappingURL=core.cjs.map
|
package/dist/core.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core.ts","../src/manifest.ts","../src/id.ts","../src/zip-core.ts"],"sourcesContent":["// 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\n// Browser-safe sub-path export — no Node.js dependencies.\n// Import via: import { ... } from '@dot-agent/compiler/core'\n\nexport { parseAboutme, buildAboutme, aboutmeToJson } from './manifest.js'\nexport { parseId, buildId, extractDigest, extractName } from './id.js'\nexport { createZip, extractFiles } from './zip-core.js'\n\nexport type {\n AboutMe,\n Capability,\n AnnotatedRef,\n DescriptionFile,\n Integrity,\n BuildAboutmeOptions,\n IdParts,\n LintMessage,\n} from './types.js'\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'\n\nexport function parseAboutme(json: any): AboutMe {\n if (!json.schemaVersion) throw new Error('Missing schemaVersion 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.version) throw new Error('Missing version in aboutme.json')\n if (!json.domain) throw new Error('Missing domain in aboutme.json')\n if (!json.persona) throw new Error('Missing persona 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 schemaVersion: json.schemaVersion,\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 schemaVersion: 'dot-agent/1.0',\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 return result\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 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUO,SAAS,aAAa,MAAoB;AAC/C,MAAI,CAAC,KAAK,cAAe,OAAM,IAAI,MAAM,uCAAuC;AAChF,MAAI,CAAC,KAAK,GAAI,OAAM,IAAI,MAAM,4BAA4B;AAC1D,MAAI,CAAC,KAAK,KAAM,OAAM,IAAI,MAAM,8BAA8B;AAC9D,MAAI,CAAC,KAAK,YAAa,OAAM,IAAI,MAAM,qCAAqC;AAC5E,MAAI,CAAC,KAAK,QAAS,OAAM,IAAI,MAAM,iCAAiC;AACpE,MAAI,CAAC,KAAK,OAAQ,OAAM,IAAI,MAAM,gCAAgC;AAClE,MAAI,CAAC,KAAK,QAAS,OAAM,IAAI,MAAM,iCAAiC;AACpE,MAAI,CAAC,KAAK,SAAU,OAAM,IAAI,MAAM,kCAAkC;AACtE,MAAI,CAAC,MAAM,QAAQ,KAAK,YAAY,EAAG,OAAM,IAAI,MAAM,4CAA4C;AACnG,MAAI,CAAC,MAAM,QAAQ,KAAK,QAAQ,EAAG,OAAM,IAAI,MAAM,wCAAwC;AAC3F,MAAI,CAAC,KAAK,UAAW,OAAM,IAAI,MAAM,mCAAmC;AAExE,SAAO;AAAA,IACL,eAAe,KAAK;AAAA,I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AW,CAAC,CAAC,EAAG;AAC7D,aAAS;AAAA,MACP,KAAK,MAAM,MAAM,EAAE,KAAK,aAAW;AACjC,cAAM,IAAI,cAAc,OAAO;AAAA,MACjC,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,QAAM,QAAQ,IAAI,QAAQ;AAC1B,SAAO;AACT;","names":["JSZip"]}
|
|
1
|
+
{"version":3,"sources":["../src/core.ts","../src/generated-version.ts","../src/manifest.ts","../src/id.ts","../src/zip-core.ts"],"sourcesContent":["// 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\n// Browser-safe sub-path export — no Node.js dependencies.\n// Import via: import { ... } from '@dot-agent/compiler/core'\n\nexport { parseAboutme, buildAboutme, aboutmeToJson } from './manifest.js'\nexport { parseId, buildId, extractDigest, extractName } from './id.js'\nexport { createZip, extractFiles, validateMagicBytes, validateZipBomb } from './zip-core.js'\n\nexport type {\n AboutMe,\n AgentBundle,\n AgentFiles,\n Capability,\n AnnotatedRef,\n DescriptionFile,\n Integrity,\n BuildAboutmeOptions,\n IdParts,\n LintMessage,\n} from './types.js'\n","// Generated by scripts/embed-version.mjs from dsl/VERSION and package.json — do not edit by hand.\nexport const DSL_VERSION = '0.1-alpha'\nexport const COMPILER_VERSION = '0.5.0-alpha.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.version) throw new Error('Missing version in aboutme.json')\n if (!json.domain) throw new Error('Missing domain in aboutme.json')\n if (!json.persona) throw new Error('Missing persona 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 return result\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCO,IAAM,cAAc;;;ACUpB,SAAS,aAAa,MAAoB;AAC/C,MAAI,CAAC,KAAK,WAAY,OAAM,IAAI,MAAM,oCAAoC;AAC1E,MAAI,CAAC,KAAK,GAAI,OAAM,IAAI,MAAM,4BAA4B;AAC1D,MAAI,CAAC,KAAK,KAAM,OAAM,IAAI,MAAM,8BAA8B;AAC9D,MAAI,CAAC,KAAK,YAAa,OAAM,IAAI,MAAM,qCAAqC;AAC5E,MAAI,CAAC,KAAK,QAAS,OAAM,IAAI,MAAM,iCAAiC;AACpE,MAAI,CAAC,KAAK,OAAQ,OAAM,IAAI,MAAM,gCAAgC;AAClE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package/dist/core.d.cts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { d as AboutMe, A as AgentBundle, e as AgentFiles, B as BuildAboutmeOptions, C as Capability, I as IdParts, f as Integrity, a as LintMessage, g as aboutmeToJson, h as buildAboutme, i as buildId, j as createZip, k as extractDigest, l as extractFiles, m as extractName, p as parseAboutme, n as parseId, v as validateMagicBytes, o as validateZipBomb } from './core-b-7c6X6q.cjs';
|
|
2
|
+
export { AnnotatedRef, DescriptionFile } from '@dot-agent/parser-dsl';
|
|
2
3
|
import 'jszip';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { d as AboutMe, A as AgentBundle, e as AgentFiles, B as BuildAboutmeOptions, C as Capability, I as IdParts, f as Integrity, a as LintMessage, g as aboutmeToJson, h as buildAboutme, i as buildId, j as createZip, k as extractDigest, l as extractFiles, m as extractName, p as parseAboutme, n as parseId, v as validateMagicBytes, o as validateZipBomb } from './core-b-7c6X6q.js';
|
|
2
|
+
export { AnnotatedRef, DescriptionFile } from '@dot-agent/parser-dsl';
|
|
2
3
|
import 'jszip';
|
package/dist/core.js
CHANGED
|
@@ -7,8 +7,10 @@ import {
|
|
|
7
7
|
extractFiles,
|
|
8
8
|
extractName,
|
|
9
9
|
parseAboutme,
|
|
10
|
-
parseId
|
|
11
|
-
|
|
10
|
+
parseId,
|
|
11
|
+
validateMagicBytes,
|
|
12
|
+
validateZipBomb
|
|
13
|
+
} from "./chunk-P5LFGJ6P.js";
|
|
12
14
|
export {
|
|
13
15
|
aboutmeToJson,
|
|
14
16
|
buildAboutme,
|
|
@@ -18,6 +20,8 @@ export {
|
|
|
18
20
|
extractFiles,
|
|
19
21
|
extractName,
|
|
20
22
|
parseAboutme,
|
|
21
|
-
parseId
|
|
23
|
+
parseId,
|
|
24
|
+
validateMagicBytes,
|
|
25
|
+
validateZipBomb
|
|
22
26
|
};
|
|
23
27
|
//# sourceMappingURL=core.js.map
|