@dot-agent/sdk 0.1.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.
package/dist/index.cjs ADDED
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ AgentSession: () => AgentSession,
34
+ loadAgent: () => loadAgent
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+
38
+ // src/load.ts
39
+ var import_jszip = __toESM(require("jszip"), 1);
40
+ var import_core = require("@dot-agent/compiler/core");
41
+ var MAX_ZIP_SIZE = 500 * 1024 * 1024;
42
+ var MAX_COMPRESSION_RATIO = 100;
43
+ function validateMagicBytes(bytes) {
44
+ if (!(bytes[0] === 80 && bytes[1] === 75 && bytes[2] === 3 && bytes[3] === 4)) {
45
+ throw new Error("Not a valid .agent file (invalid magic bytes)");
46
+ }
47
+ }
48
+ function validateZipBomb(zip, compressedSize) {
49
+ let totalUncompressed = 0;
50
+ zip.forEach((_path, file) => {
51
+ if (!file.dir) totalUncompressed += file._data?.uncompressedSize || 0;
52
+ });
53
+ if (totalUncompressed > MAX_ZIP_SIZE) {
54
+ throw new Error(`Bundle exceeds 500MB uncompressed: ${totalUncompressed}`);
55
+ }
56
+ if (totalUncompressed / compressedSize > MAX_COMPRESSION_RATIO) {
57
+ throw new Error(`Compression ratio exceeds 100x: ${(totalUncompressed / compressedSize).toFixed(1)}x`);
58
+ }
59
+ }
60
+ async function loadAgent(input) {
61
+ const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
62
+ validateMagicBytes(bytes);
63
+ const zip = await import_jszip.default.loadAsync(bytes);
64
+ validateZipBomb(zip, bytes.length);
65
+ const aboutmeFile = zip.file(".agent/aboutme.json");
66
+ if (!aboutmeFile) throw new Error("Missing .agent/aboutme.json in bundle");
67
+ const aboutme = (0, import_core.parseAboutme)(JSON.parse(await aboutmeFile.async("text")));
68
+ const filesJsonFile = zip.file(".agent/files.json");
69
+ if (!filesJsonFile) throw new Error("Missing .agent/files.json in bundle");
70
+ const filesJson = JSON.parse(await filesJsonFile.async("text"));
71
+ const descFile = zip.file(filesJson.description);
72
+ const behavFile = zip.file(filesJson.behavior);
73
+ if (!descFile) throw new Error(`Missing ${filesJson.description} in bundle`);
74
+ if (!behavFile) throw new Error(`Missing ${filesJson.behavior} in bundle`);
75
+ const soulFile = zip.file("SOUL.md");
76
+ const allFiles = await (0, import_core.extractFiles)(zip);
77
+ const guides = [];
78
+ const knowledge = [];
79
+ const behaviors = [];
80
+ for (const [path, content] of allFiles) {
81
+ if (path.startsWith("guides/") && path !== "guides/.gitkeep") {
82
+ guides.push({ path, content });
83
+ } else if (path.startsWith("knowledge/") && path !== "knowledge/.gitkeep") {
84
+ knowledge.push({ path, content });
85
+ } else if (path.startsWith("behaviors/") && path !== "behaviors/.gitkeep") {
86
+ behaviors.push({ path, content });
87
+ }
88
+ }
89
+ return {
90
+ id: aboutme.id,
91
+ aboutme,
92
+ files: {
93
+ description: await descFile.async("text"),
94
+ behavior: await behavFile.async("text"),
95
+ soul: soulFile ? await soulFile.async("text") : void 0,
96
+ guides,
97
+ knowledge,
98
+ behaviors
99
+ }
100
+ };
101
+ }
102
+
103
+ // src/session.ts
104
+ var import_kernel_dsl = require("@dot-agent/kernel-dsl");
105
+ var AgentSession = class _AgentSession {
106
+ kernel;
107
+ handlers = /* @__PURE__ */ new Map();
108
+ bundle;
109
+ constructor(kernel, bundle) {
110
+ this.kernel = kernel;
111
+ this.bundle = bundle;
112
+ }
113
+ static async create(bundle) {
114
+ await (0, import_kernel_dsl.init)();
115
+ const kernel = new import_kernel_dsl.AgentDSLKernel();
116
+ return new _AgentSession(kernel, bundle);
117
+ }
118
+ // Call after registerHandler() — loads the behavior and fires initial effects.
119
+ start() {
120
+ this.dispatchRaw(this.kernel.load_behavior(this.bundle.files.behavior));
121
+ }
122
+ registerHandler(effectType, handler) {
123
+ this.handlers.set(effectType, handler);
124
+ }
125
+ dispatchRaw(raw) {
126
+ if (!raw) return;
127
+ let effects;
128
+ try {
129
+ effects = JSON.parse(raw);
130
+ } catch {
131
+ console.error("[AgentSession] failed to parse effects JSON:", raw);
132
+ return;
133
+ }
134
+ if (!Array.isArray(effects)) return;
135
+ for (const effect of effects) {
136
+ const handler = this.handlers.get(effect.type);
137
+ if (handler) {
138
+ Promise.resolve(handler(effect)).catch((err) => {
139
+ console.error(`[AgentSession] handler error for effect "${effect.type}":`, err);
140
+ });
141
+ }
142
+ }
143
+ }
144
+ sendIntent(intent) {
145
+ this.dispatchRaw(this.kernel.send_intent(intent));
146
+ }
147
+ sendEvent(event) {
148
+ this.dispatchRaw(this.kernel.send_event(event));
149
+ }
150
+ sendComplete() {
151
+ this.dispatchRaw(this.kernel.send_complete());
152
+ }
153
+ sendFailed() {
154
+ this.dispatchRaw(this.kernel.send_failed());
155
+ }
156
+ sendOfftopic() {
157
+ this.dispatchRaw(this.kernel.send_offtopic());
158
+ }
159
+ tickPrompt() {
160
+ this.dispatchRaw(this.kernel.tick_prompt());
161
+ }
162
+ getState() {
163
+ return this.kernel.get_current_state();
164
+ }
165
+ getValidIntents() {
166
+ return this.kernel.get_valid_intents();
167
+ }
168
+ getGraph() {
169
+ return this.kernel.get_graph();
170
+ }
171
+ injectMemory(domain, key, value) {
172
+ this.kernel.set_memory(domain, key, value);
173
+ }
174
+ dispose() {
175
+ this.kernel.free();
176
+ }
177
+ };
178
+ // Annotate the CommonJS export names for ESM import in node:
179
+ 0 && (module.exports = {
180
+ AgentSession,
181
+ loadAgent
182
+ });
183
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/load.ts","../src/session.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\nexport { loadAgent } from './load.js'\nexport { AgentSession } from './session.js'\nexport type { AgentBundle, AgentFiles, Effect, EffectHandler, AboutMe } 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//\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'\nimport { parseAboutme, extractFiles } from '@dot-agent/compiler/core'\nimport type { AgentBundle } from './types.js'\n\nconst MAX_ZIP_SIZE = 500 * 1024 * 1024\nconst MAX_COMPRESSION_RATIO = 100\n\nfunction 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\nfunction 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 async function loadAgent(input: Uint8Array | ArrayBuffer): Promise<AgentBundle> {\n const bytes = input instanceof Uint8Array ? input : new Uint8Array(input)\n\n validateMagicBytes(bytes)\n\n const zip = await JSZip.loadAsync(bytes)\n validateZipBomb(zip, bytes.length)\n\n const aboutmeFile = zip.file('.agent/aboutme.json')\n if (!aboutmeFile) throw new Error('Missing .agent/aboutme.json in bundle')\n const aboutme = parseAboutme(JSON.parse(await aboutmeFile.async('text')))\n\n const filesJsonFile = zip.file('.agent/files.json')\n if (!filesJsonFile) throw new Error('Missing .agent/files.json in bundle')\n const filesJson = JSON.parse(await filesJsonFile.async('text')) as {\n description: string\n behavior: string\n behaviors?: string[]\n guides?: string[]\n knowledge?: string[]\n }\n\n const descFile = zip.file(filesJson.description)\n const behavFile = zip.file(filesJson.behavior)\n if (!descFile) throw new Error(`Missing ${filesJson.description} in bundle`)\n if (!behavFile) throw new Error(`Missing ${filesJson.behavior} in bundle`)\n\n const soulFile = zip.file('SOUL.md')\n const allFiles = await extractFiles(zip)\n\n const guides: Array<{ path: string; content: string }> = []\n const knowledge: Array<{ path: string; content: string }> = []\n const behaviors: Array<{ path: string; content: string }> = []\n\n for (const [path, content] of allFiles) {\n if (path.startsWith('guides/') && path !== 'guides/.gitkeep') {\n guides.push({ path, content })\n } else if (path.startsWith('knowledge/') && path !== 'knowledge/.gitkeep') {\n knowledge.push({ path, content })\n } else if (path.startsWith('behaviors/') && path !== 'behaviors/.gitkeep') {\n behaviors.push({ path, content })\n }\n }\n\n return {\n id: aboutme.id,\n aboutme,\n files: {\n description: await descFile.async('text'),\n behavior: await behavFile.async('text'),\n soul: soulFile ? await soulFile.async('text') : undefined,\n guides,\n knowledge,\n behaviors,\n },\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 { AgentDSLKernel, init as initKernel } from '@dot-agent/kernel-dsl'\nimport type { AgentBundle, Effect, EffectHandler } from './types.js'\n\nexport class AgentSession {\n private kernel: AgentDSLKernel\n private handlers = new Map<string, EffectHandler>()\n readonly bundle: AgentBundle\n\n private constructor(kernel: AgentDSLKernel, bundle: AgentBundle) {\n this.kernel = kernel\n this.bundle = bundle\n }\n\n static async create(bundle: AgentBundle): Promise<AgentSession> {\n await initKernel()\n const kernel = new AgentDSLKernel()\n return new AgentSession(kernel, bundle)\n }\n\n // Call after registerHandler() — loads the behavior and fires initial effects.\n start(): void {\n this.dispatchRaw(this.kernel.load_behavior(this.bundle.files.behavior))\n }\n\n registerHandler(effectType: string, handler: EffectHandler): void {\n this.handlers.set(effectType, handler)\n }\n\n private dispatchRaw(raw: string): void {\n if (!raw) return\n let effects: Effect[]\n try {\n effects = JSON.parse(raw)\n } catch {\n console.error('[AgentSession] failed to parse effects JSON:', raw)\n return\n }\n if (!Array.isArray(effects)) return\n for (const effect of effects) {\n const handler = this.handlers.get(effect.type)\n if (handler) {\n Promise.resolve(handler(effect)).catch(err => {\n console.error(`[AgentSession] handler error for effect \"${effect.type}\":`, err)\n })\n }\n }\n }\n\n sendIntent(intent: string): void { this.dispatchRaw(this.kernel.send_intent(intent)) }\n sendEvent(event: string): void { this.dispatchRaw(this.kernel.send_event(event)) }\n sendComplete(): void { this.dispatchRaw(this.kernel.send_complete()) }\n sendFailed(): void { this.dispatchRaw(this.kernel.send_failed()) }\n sendOfftopic(): void { this.dispatchRaw(this.kernel.send_offtopic()) }\n tickPrompt(): void { this.dispatchRaw(this.kernel.tick_prompt()) }\n\n getState(): string { return this.kernel.get_current_state() }\n getValidIntents(): Array<any> { return this.kernel.get_valid_intents() }\n getGraph(): string { return this.kernel.get_graph() }\n\n injectMemory(domain: string, key: string, value: string): void {\n this.kernel.set_memory(domain, key, value)\n }\n\n dispose(): void { this.kernel.free() }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcA,mBAAkB;AAClB,kBAA2C;AAG3C,IAAM,eAAe,MAAM,OAAO;AAClC,IAAM,wBAAwB;AAE9B,SAAS,mBAAmB,OAAyB;AACnD,MAAI,EAAE,MAAM,CAAC,MAAM,MAAQ,MAAM,CAAC,MAAM,MAAQ,MAAM,CAAC,MAAM,KAAQ,MAAM,CAAC,MAAM,IAAO;AACvF,UAAM,IAAI,MAAM,+CAA+C;AAAA,EACjE;AACF;AAEA,SAAS,gBAAgB,KAAY,gBAA8B;AACjE,MAAI,oBAAoB;AACxB,MAAI,QAAQ,CAAC,OAAO,SAAS;AAC3B,QA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
+
4
+ interface AgentFiles {
5
+ description: string;
6
+ behavior: string;
7
+ soul?: string;
8
+ guides: Array<{
9
+ path: string;
10
+ content: string;
11
+ }>;
12
+ knowledge: Array<{
13
+ path: string;
14
+ content: string;
15
+ }>;
16
+ behaviors: Array<{
17
+ path: string;
18
+ content: string;
19
+ }>;
20
+ }
21
+ interface AgentBundle {
22
+ id: string;
23
+ aboutme: AboutMe;
24
+ files: AgentFiles;
25
+ }
26
+ type EffectHandler = (effect: Effect) => void | Promise<void>;
27
+ interface Effect {
28
+ type: string;
29
+ [key: string]: unknown;
30
+ }
31
+
32
+ declare function loadAgent(input: Uint8Array | ArrayBuffer): Promise<AgentBundle>;
33
+
34
+ declare class AgentSession {
35
+ private kernel;
36
+ private handlers;
37
+ readonly bundle: AgentBundle;
38
+ private constructor();
39
+ static create(bundle: AgentBundle): Promise<AgentSession>;
40
+ start(): void;
41
+ registerHandler(effectType: string, handler: EffectHandler): void;
42
+ private dispatchRaw;
43
+ sendIntent(intent: string): void;
44
+ sendEvent(event: string): void;
45
+ sendComplete(): void;
46
+ sendFailed(): void;
47
+ sendOfftopic(): void;
48
+ tickPrompt(): void;
49
+ getState(): string;
50
+ getValidIntents(): Array<any>;
51
+ getGraph(): string;
52
+ injectMemory(domain: string, key: string, value: string): void;
53
+ dispose(): void;
54
+ }
55
+
56
+ export { type AgentBundle, type AgentFiles, AgentSession, type Effect, type EffectHandler, loadAgent };
@@ -0,0 +1,56 @@
1
+ import { AboutMe } from '@dot-agent/compiler/core';
2
+ export { AboutMe } from '@dot-agent/compiler/core';
3
+
4
+ interface AgentFiles {
5
+ description: string;
6
+ behavior: string;
7
+ soul?: string;
8
+ guides: Array<{
9
+ path: string;
10
+ content: string;
11
+ }>;
12
+ knowledge: Array<{
13
+ path: string;
14
+ content: string;
15
+ }>;
16
+ behaviors: Array<{
17
+ path: string;
18
+ content: string;
19
+ }>;
20
+ }
21
+ interface AgentBundle {
22
+ id: string;
23
+ aboutme: AboutMe;
24
+ files: AgentFiles;
25
+ }
26
+ type EffectHandler = (effect: Effect) => void | Promise<void>;
27
+ interface Effect {
28
+ type: string;
29
+ [key: string]: unknown;
30
+ }
31
+
32
+ declare function loadAgent(input: Uint8Array | ArrayBuffer): Promise<AgentBundle>;
33
+
34
+ declare class AgentSession {
35
+ private kernel;
36
+ private handlers;
37
+ readonly bundle: AgentBundle;
38
+ private constructor();
39
+ static create(bundle: AgentBundle): Promise<AgentSession>;
40
+ start(): void;
41
+ registerHandler(effectType: string, handler: EffectHandler): void;
42
+ private dispatchRaw;
43
+ sendIntent(intent: string): void;
44
+ sendEvent(event: string): void;
45
+ sendComplete(): void;
46
+ sendFailed(): void;
47
+ sendOfftopic(): void;
48
+ tickPrompt(): void;
49
+ getState(): string;
50
+ getValidIntents(): Array<any>;
51
+ getGraph(): string;
52
+ injectMemory(domain: string, key: string, value: string): void;
53
+ dispose(): void;
54
+ }
55
+
56
+ export { type AgentBundle, type AgentFiles, AgentSession, type Effect, type EffectHandler, loadAgent };
package/dist/index.js ADDED
@@ -0,0 +1,145 @@
1
+ // src/load.ts
2
+ import JSZip from "jszip";
3
+ import { parseAboutme, extractFiles } from "@dot-agent/compiler/core";
4
+ var MAX_ZIP_SIZE = 500 * 1024 * 1024;
5
+ var MAX_COMPRESSION_RATIO = 100;
6
+ function validateMagicBytes(bytes) {
7
+ if (!(bytes[0] === 80 && bytes[1] === 75 && bytes[2] === 3 && bytes[3] === 4)) {
8
+ throw new Error("Not a valid .agent file (invalid magic bytes)");
9
+ }
10
+ }
11
+ function validateZipBomb(zip, compressedSize) {
12
+ let totalUncompressed = 0;
13
+ zip.forEach((_path, file) => {
14
+ if (!file.dir) totalUncompressed += file._data?.uncompressedSize || 0;
15
+ });
16
+ if (totalUncompressed > MAX_ZIP_SIZE) {
17
+ throw new Error(`Bundle exceeds 500MB uncompressed: ${totalUncompressed}`);
18
+ }
19
+ if (totalUncompressed / compressedSize > MAX_COMPRESSION_RATIO) {
20
+ throw new Error(`Compression ratio exceeds 100x: ${(totalUncompressed / compressedSize).toFixed(1)}x`);
21
+ }
22
+ }
23
+ async function loadAgent(input) {
24
+ const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
25
+ validateMagicBytes(bytes);
26
+ const zip = await JSZip.loadAsync(bytes);
27
+ validateZipBomb(zip, bytes.length);
28
+ const aboutmeFile = zip.file(".agent/aboutme.json");
29
+ if (!aboutmeFile) throw new Error("Missing .agent/aboutme.json in bundle");
30
+ const aboutme = parseAboutme(JSON.parse(await aboutmeFile.async("text")));
31
+ const filesJsonFile = zip.file(".agent/files.json");
32
+ if (!filesJsonFile) throw new Error("Missing .agent/files.json in bundle");
33
+ const filesJson = JSON.parse(await filesJsonFile.async("text"));
34
+ const descFile = zip.file(filesJson.description);
35
+ const behavFile = zip.file(filesJson.behavior);
36
+ if (!descFile) throw new Error(`Missing ${filesJson.description} in bundle`);
37
+ if (!behavFile) throw new Error(`Missing ${filesJson.behavior} in bundle`);
38
+ const soulFile = zip.file("SOUL.md");
39
+ const allFiles = await extractFiles(zip);
40
+ const guides = [];
41
+ const knowledge = [];
42
+ const behaviors = [];
43
+ for (const [path, content] of allFiles) {
44
+ if (path.startsWith("guides/") && path !== "guides/.gitkeep") {
45
+ guides.push({ path, content });
46
+ } else if (path.startsWith("knowledge/") && path !== "knowledge/.gitkeep") {
47
+ knowledge.push({ path, content });
48
+ } else if (path.startsWith("behaviors/") && path !== "behaviors/.gitkeep") {
49
+ behaviors.push({ path, content });
50
+ }
51
+ }
52
+ return {
53
+ id: aboutme.id,
54
+ aboutme,
55
+ files: {
56
+ description: await descFile.async("text"),
57
+ behavior: await behavFile.async("text"),
58
+ soul: soulFile ? await soulFile.async("text") : void 0,
59
+ guides,
60
+ knowledge,
61
+ behaviors
62
+ }
63
+ };
64
+ }
65
+
66
+ // src/session.ts
67
+ import { AgentDSLKernel, init as initKernel } from "@dot-agent/kernel-dsl";
68
+ var AgentSession = class _AgentSession {
69
+ kernel;
70
+ handlers = /* @__PURE__ */ new Map();
71
+ bundle;
72
+ constructor(kernel, bundle) {
73
+ this.kernel = kernel;
74
+ this.bundle = bundle;
75
+ }
76
+ static async create(bundle) {
77
+ await initKernel();
78
+ const kernel = new AgentDSLKernel();
79
+ return new _AgentSession(kernel, bundle);
80
+ }
81
+ // Call after registerHandler() — loads the behavior and fires initial effects.
82
+ start() {
83
+ this.dispatchRaw(this.kernel.load_behavior(this.bundle.files.behavior));
84
+ }
85
+ registerHandler(effectType, handler) {
86
+ this.handlers.set(effectType, handler);
87
+ }
88
+ dispatchRaw(raw) {
89
+ if (!raw) return;
90
+ let effects;
91
+ try {
92
+ effects = JSON.parse(raw);
93
+ } catch {
94
+ console.error("[AgentSession] failed to parse effects JSON:", raw);
95
+ return;
96
+ }
97
+ if (!Array.isArray(effects)) return;
98
+ for (const effect of effects) {
99
+ const handler = this.handlers.get(effect.type);
100
+ if (handler) {
101
+ Promise.resolve(handler(effect)).catch((err) => {
102
+ console.error(`[AgentSession] handler error for effect "${effect.type}":`, err);
103
+ });
104
+ }
105
+ }
106
+ }
107
+ sendIntent(intent) {
108
+ this.dispatchRaw(this.kernel.send_intent(intent));
109
+ }
110
+ sendEvent(event) {
111
+ this.dispatchRaw(this.kernel.send_event(event));
112
+ }
113
+ sendComplete() {
114
+ this.dispatchRaw(this.kernel.send_complete());
115
+ }
116
+ sendFailed() {
117
+ this.dispatchRaw(this.kernel.send_failed());
118
+ }
119
+ sendOfftopic() {
120
+ this.dispatchRaw(this.kernel.send_offtopic());
121
+ }
122
+ tickPrompt() {
123
+ this.dispatchRaw(this.kernel.tick_prompt());
124
+ }
125
+ getState() {
126
+ return this.kernel.get_current_state();
127
+ }
128
+ getValidIntents() {
129
+ return this.kernel.get_valid_intents();
130
+ }
131
+ getGraph() {
132
+ return this.kernel.get_graph();
133
+ }
134
+ injectMemory(domain, key, value) {
135
+ this.kernel.set_memory(domain, key, value);
136
+ }
137
+ dispose() {
138
+ this.kernel.free();
139
+ }
140
+ };
141
+ export {
142
+ AgentSession,
143
+ loadAgent
144
+ };
145
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/load.ts","../src/session.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\nimport JSZip from 'jszip'\nimport { parseAboutme, extractFiles } from '@dot-agent/compiler/core'\nimport type { AgentBundle } from './types.js'\n\nconst MAX_ZIP_SIZE = 500 * 1024 * 1024\nconst MAX_COMPRESSION_RATIO = 100\n\nfunction 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\nfunction 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 async function loadAgent(input: Uint8Array | ArrayBuffer): Promise<AgentBundle> {\n const bytes = input instanceof Uint8Array ? input : new Uint8Array(input)\n\n validateMagicBytes(bytes)\n\n const zip = await JSZip.loadAsync(bytes)\n validateZipBomb(zip, bytes.length)\n\n const aboutmeFile = zip.file('.agent/aboutme.json')\n if (!aboutmeFile) throw new Error('Missing .agent/aboutme.json in bundle')\n const aboutme = parseAboutme(JSON.parse(await aboutmeFile.async('text')))\n\n const filesJsonFile = zip.file('.agent/files.json')\n if (!filesJsonFile) throw new Error('Missing .agent/files.json in bundle')\n const filesJson = JSON.parse(await filesJsonFile.async('text')) as {\n description: string\n behavior: string\n behaviors?: string[]\n guides?: string[]\n knowledge?: string[]\n }\n\n const descFile = zip.file(filesJson.description)\n const behavFile = zip.file(filesJson.behavior)\n if (!descFile) throw new Error(`Missing ${filesJson.description} in bundle`)\n if (!behavFile) throw new Error(`Missing ${filesJson.behavior} in bundle`)\n\n const soulFile = zip.file('SOUL.md')\n const allFiles = await extractFiles(zip)\n\n const guides: Array<{ path: string; content: string }> = []\n const knowledge: Array<{ path: string; content: string }> = []\n const behaviors: Array<{ path: string; content: string }> = []\n\n for (const [path, content] of allFiles) {\n if (path.startsWith('guides/') && path !== 'guides/.gitkeep') {\n guides.push({ path, content })\n } else if (path.startsWith('knowledge/') && path !== 'knowledge/.gitkeep') {\n knowledge.push({ path, content })\n } else if (path.startsWith('behaviors/') && path !== 'behaviors/.gitkeep') {\n behaviors.push({ path, content })\n }\n }\n\n return {\n id: aboutme.id,\n aboutme,\n files: {\n description: await descFile.async('text'),\n behavior: await behavFile.async('text'),\n soul: soulFile ? await soulFile.async('text') : undefined,\n guides,\n knowledge,\n behaviors,\n },\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 { AgentDSLKernel, init as initKernel } from '@dot-agent/kernel-dsl'\nimport type { AgentBundle, Effect, EffectHandler } from './types.js'\n\nexport class AgentSession {\n private kernel: AgentDSLKernel\n private handlers = new Map<string, EffectHandler>()\n readonly bundle: AgentBundle\n\n private constructor(kernel: AgentDSLKernel, bundle: AgentBundle) {\n this.kernel = kernel\n this.bundle = bundle\n }\n\n static async create(bundle: AgentBundle): Promise<AgentSession> {\n await initKernel()\n const kernel = new AgentDSLKernel()\n return new AgentSession(kernel, bundle)\n }\n\n // Call after registerHandler() — loads the behavior and fires initial effects.\n start(): void {\n this.dispatchRaw(this.kernel.load_behavior(this.bundle.files.behavior))\n }\n\n registerHandler(effectType: string, handler: EffectHandler): void {\n this.handlers.set(effectType, handler)\n }\n\n private dispatchRaw(raw: string): void {\n if (!raw) return\n let effects: Effect[]\n try {\n effects = JSON.parse(raw)\n } catch {\n console.error('[AgentSession] failed to parse effects JSON:', raw)\n return\n }\n if (!Array.isArray(effects)) return\n for (const effect of effects) {\n const handler = this.handlers.get(effect.type)\n if (handler) {\n Promise.resolve(handler(effect)).catch(err => {\n console.error(`[AgentSession] handler error for effect \"${effect.type}\":`, err)\n })\n }\n }\n }\n\n sendIntent(intent: string): void { this.dispatchRaw(this.kernel.send_intent(intent)) }\n sendEvent(event: string): void { this.dispatchRaw(this.kernel.send_event(event)) }\n sendComplete(): void { this.dispatchRaw(this.kernel.send_complete()) }\n sendFailed(): void { this.dispatchRaw(this.kernel.send_failed()) }\n sendOfftopic(): void { this.dispatchRaw(this.kernel.send_offtopic()) }\n tickPrompt(): void { this.dispatchRaw(this.kernel.tick_prompt()) }\n\n getState(): string { return this.kernel.get_current_state() }\n getValidIntents(): Array<any> { return this.kernel.get_valid_intents() }\n getGraph(): string { return this.kernel.get_graph() }\n\n injectMemory(domain: string, key: string, value: string): void {\n this.kernel.set_memory(domain, key, value)\n }\n\n dispose(): void { this.kernel.free() }\n}\n"],"mappings":";AAcA,OAAO,WAAW;AAClB,SAAS,cAAc,oBAAoB;AAG3C,IAAM,eAAe,MAAM,OAAO;AAClC,IAAM,wBAAwB;AAE9B,SAAS,mBAAmB,OAAyB;AACnD,MAAI,E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E/D,aAAa,QAAgB,KAAa,OAAqB;AAC7D,SAAK,OAAO,WAAW,QAAQ,KAAK,KAAK;AAAA,EAC3C;AAAA,EAEA,UAAgB;AAAE,SAAK,OAAO,KAAK;AAAA,EAAE;AACvC;","names":[]}
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@dot-agent/sdk",
3
+ "version": "0.1.0",
4
+ "description": "Browser-compatible SDK for loading and running dot-agent bundles",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "Danilo Borges",
8
+ "email": "contato@daniloborg.es",
9
+ "url": "https://daniloborg.es"
10
+ },
11
+ "contributors": [
12
+ {
13
+ "name": "Danilo Borges",
14
+ "email": "contato@daniloborg.es",
15
+ "url": "https://daniloborg.es"
16
+ }
17
+ ],
18
+ "homepage": "https://dot-agent.ai",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/dot-agent-spec/platform",
22
+ "directory": "packages/sdk"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/dot-agent-spec/platform/issues",
26
+ "email": "contato@daniloborg.es"
27
+ },
28
+ "keywords": [
29
+ "agent",
30
+ "agents",
31
+ "llm",
32
+ "sdk",
33
+ "dsl",
34
+ "fsm",
35
+ "wasm",
36
+ "browser",
37
+ "dot-agent"
38
+ ],
39
+ "type": "module",
40
+ "main": "dist/index.js",
41
+ "types": "dist/index.d.ts",
42
+ "exports": {
43
+ ".": {
44
+ "types": "./dist/index.d.ts",
45
+ "import": "./dist/index.js",
46
+ "require": "./dist/index.cjs"
47
+ }
48
+ },
49
+ "files": [
50
+ "dist"
51
+ ],
52
+ "scripts": {
53
+ "build": "tsup",
54
+ "dev": "tsup --watch",
55
+ "typecheck": "tsc --noEmit",
56
+ "test": "node --test tests/node.test.js"
57
+ },
58
+ "dependencies": {
59
+ "@dot-agent/compiler": "*",
60
+ "@dot-agent/kernel-dsl": "*",
61
+ "jszip": "^3.10.1"
62
+ },
63
+ "devDependencies": {
64
+ "@types/node": "^20.0.0",
65
+ "tsup": "^8.0.0",
66
+ "typescript": "^5.0.0"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public"
70
+ }
71
+ }