@dot-agent/sdk 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/index.cjs +145 -169
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -34
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +42 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +132 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +19 -15
- package/dist/index.d.ts +0 -40
- package/dist/index.js +0 -143
- package/dist/index.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,181 +1,157 @@
|
|
|
1
|
-
"
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
8
|
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
9
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
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");
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
let jszip = require("jszip");
|
|
25
|
+
jszip = __toESM(jszip, 1);
|
|
26
|
+
let _dot_agent_compiler_core = require("@dot-agent/compiler/core");
|
|
27
|
+
let _dot_agent_kernel_dsl = require("@dot-agent/kernel-dsl");
|
|
28
|
+
//#region src/load.ts
|
|
41
29
|
async function loadAgent(input) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
30
|
+
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
31
|
+
(0, _dot_agent_compiler_core.validateMagicBytes)(bytes);
|
|
32
|
+
const zip = await jszip.default.loadAsync(bytes);
|
|
33
|
+
(0, _dot_agent_compiler_core.validateZipBomb)(zip, bytes.length);
|
|
34
|
+
const aboutmeFile = zip.file(".agent/aboutme.json");
|
|
35
|
+
if (!aboutmeFile) throw new Error("Missing .agent/aboutme.json in bundle");
|
|
36
|
+
const aboutme = (0, _dot_agent_compiler_core.parseAboutme)(JSON.parse(await aboutmeFile.async("text")));
|
|
37
|
+
const filesJsonFile = zip.file(".agent/files.json");
|
|
38
|
+
if (!filesJsonFile) throw new Error("Missing .agent/files.json in bundle");
|
|
39
|
+
const filesJson = JSON.parse(await filesJsonFile.async("text"));
|
|
40
|
+
const descFile = zip.file(filesJson.description);
|
|
41
|
+
const behavFile = zip.file(filesJson.behavior);
|
|
42
|
+
if (!descFile) throw new Error(`Missing ${filesJson.description} in bundle`);
|
|
43
|
+
if (!behavFile) throw new Error(`Missing ${filesJson.behavior} in bundle`);
|
|
44
|
+
const personaFile = filesJson.persona ? zip.file(filesJson.persona) : null;
|
|
45
|
+
const allFiles = await (0, _dot_agent_compiler_core.extractFiles)(zip);
|
|
46
|
+
const guides = [];
|
|
47
|
+
const knowledge = [];
|
|
48
|
+
const behaviors = [];
|
|
49
|
+
for (const [path, content] of allFiles) if (path.startsWith("guides/") && path !== "guides/.gitkeep") guides.push({
|
|
50
|
+
path,
|
|
51
|
+
content
|
|
52
|
+
});
|
|
53
|
+
else if (path.startsWith("knowledge/") && path !== "knowledge/.gitkeep") knowledge.push({
|
|
54
|
+
path,
|
|
55
|
+
content
|
|
56
|
+
});
|
|
57
|
+
else if (path.startsWith("behaviors/") && path !== "behaviors/.gitkeep") behaviors.push({
|
|
58
|
+
path,
|
|
59
|
+
content
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
id: aboutme.id,
|
|
63
|
+
aboutme,
|
|
64
|
+
files: {
|
|
65
|
+
description: await descFile.async("text"),
|
|
66
|
+
behavior: await behavFile.async("text"),
|
|
67
|
+
persona: personaFile ? await personaFile.async("text") : void 0,
|
|
68
|
+
guides,
|
|
69
|
+
knowledge,
|
|
70
|
+
behaviors
|
|
71
|
+
}
|
|
72
|
+
};
|
|
82
73
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return this.kernel.get_valid_intents();
|
|
162
|
-
}
|
|
163
|
-
getGraph() {
|
|
164
|
-
return this.kernel.get_graph();
|
|
165
|
-
}
|
|
166
|
-
getMemory() {
|
|
167
|
-
return JSON.parse(this.kernel.get_memory());
|
|
168
|
-
}
|
|
169
|
-
injectMemory(domain, key, value) {
|
|
170
|
-
this.kernel.set_memory(domain, key, value);
|
|
171
|
-
}
|
|
172
|
-
dispose() {
|
|
173
|
-
this.kernel.free();
|
|
174
|
-
}
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/session.ts
|
|
76
|
+
var AgentSession = class AgentSession {
|
|
77
|
+
kernel;
|
|
78
|
+
handlers = /* @__PURE__ */ new Map();
|
|
79
|
+
effectListener;
|
|
80
|
+
bundle;
|
|
81
|
+
constructor(kernel, bundle) {
|
|
82
|
+
this.kernel = kernel;
|
|
83
|
+
this.bundle = bundle;
|
|
84
|
+
}
|
|
85
|
+
static async create(bundle) {
|
|
86
|
+
await (0, _dot_agent_kernel_dsl.init)();
|
|
87
|
+
const kernel = new _dot_agent_kernel_dsl.AgentDSLKernel();
|
|
88
|
+
return new AgentSession(kernel, bundle);
|
|
89
|
+
}
|
|
90
|
+
setFileResolver(resolver) {
|
|
91
|
+
this.kernel.set_file_resolver(resolver);
|
|
92
|
+
}
|
|
93
|
+
start() {
|
|
94
|
+
const bundle = {};
|
|
95
|
+
for (const { path, content } of this.bundle.files.behaviors) bundle[path] = content;
|
|
96
|
+
this.dispatchRaw(this.kernel.load_behavior_with_bundle(this.bundle.files.behavior, JSON.stringify(bundle)));
|
|
97
|
+
}
|
|
98
|
+
registerHandler(effectType, handler) {
|
|
99
|
+
this.handlers.set(effectType, handler);
|
|
100
|
+
}
|
|
101
|
+
setEffectListener(listener) {
|
|
102
|
+
this.effectListener = listener;
|
|
103
|
+
}
|
|
104
|
+
dispatchRaw(raw) {
|
|
105
|
+
if (!raw) return;
|
|
106
|
+
let effects;
|
|
107
|
+
try {
|
|
108
|
+
effects = JSON.parse(raw);
|
|
109
|
+
} catch {
|
|
110
|
+
console.error("[AgentSession] failed to parse effects JSON:", raw);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (!Array.isArray(effects)) return;
|
|
114
|
+
for (const effect of effects) {
|
|
115
|
+
this.effectListener?.(effect);
|
|
116
|
+
const handler = this.handlers.get(effect.type);
|
|
117
|
+
if (handler) Promise.resolve(handler(effect)).catch((err) => {
|
|
118
|
+
console.error(`[AgentSession] handler error for effect "${effect.type}":`, err);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
sendIntent(intent) {
|
|
123
|
+
this.dispatchRaw(this.kernel.send_intent(intent));
|
|
124
|
+
}
|
|
125
|
+
sendEvent(event) {
|
|
126
|
+
this.dispatchRaw(this.kernel.send_event(event));
|
|
127
|
+
}
|
|
128
|
+
sendOfftopic() {
|
|
129
|
+
this.dispatchRaw(this.kernel.send_offtopic());
|
|
130
|
+
}
|
|
131
|
+
tickPrompt() {
|
|
132
|
+
this.dispatchRaw(this.kernel.tick_prompt());
|
|
133
|
+
}
|
|
134
|
+
getState() {
|
|
135
|
+
return this.kernel.get_current_state();
|
|
136
|
+
}
|
|
137
|
+
getValidIntents() {
|
|
138
|
+
return this.kernel.get_valid_intents();
|
|
139
|
+
}
|
|
140
|
+
getGraph() {
|
|
141
|
+
return this.kernel.get_graph();
|
|
142
|
+
}
|
|
143
|
+
getMemory() {
|
|
144
|
+
return JSON.parse(this.kernel.get_memory());
|
|
145
|
+
}
|
|
146
|
+
injectMemory(domain, key, value) {
|
|
147
|
+
this.kernel.set_memory(domain, key, value);
|
|
148
|
+
}
|
|
149
|
+
dispose() {
|
|
150
|
+
this.kernel.free();
|
|
151
|
+
}
|
|
175
152
|
};
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
});
|
|
153
|
+
//#endregion
|
|
154
|
+
exports.AgentSession = AgentSession;
|
|
155
|
+
exports.loadAgent = loadAgent;
|
|
156
|
+
|
|
181
157
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +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, validateMagicBytes, validateZipBomb } from '@dot-agent/compiler/core'\nimport type { AgentBundle } from './types.js'\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 persona?: 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 personaFile = filesJson.persona ? zip.file(filesJson.persona) : null\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 persona: personaFile ? await personaFile.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 private effectListener?: (effect: Effect) => void\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 // Register a synchronous fallback called when a `merge \"…\"` path is not in the bundle.\n // Must be called before start(). Return null/undefined if the path cannot be resolved.\n setFileResolver(resolver: (path: string) => string | null | undefined): void {\n this.kernel.set_file_resolver(resolver as unknown as Function)\n }\n\n // Call after registerHandler() — loads the behavior and fires initial effects.\n // Passes all merged behavior files as a bundle so the kernel can resolve `merge \"…\"` paths.\n start(): void {\n const bundle: Record<string, string> = {}\n for (const { path, content } of this.bundle.files.behaviors) {\n bundle[path] = content\n }\n this.dispatchRaw(\n this.kernel.load_behavior_with_bundle(\n this.bundle.files.behavior,\n JSON.stringify(bundle),\n )\n )\n }\n\n registerHandler(effectType: string, handler: EffectHandler): void {\n this.handlers.set(effectType, handler)\n }\n\n setEffectListener(listener: ((effect: Effect) => void) | undefined): void {\n this.effectListener = listener\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 this.effectListener?.(effect)\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 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 getMemory(): Array<{ domain: string; key: string; value: unknown }> {\n return JSON.parse(this.kernel.get_memory())\n }\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,kBAAgF;AAGhF,eAAsB,UAAU,OAAuD;AACrF,QAAM,QAAQ,iBAAiB,aAAa,QAAQ,IAAI,WAAW,KAAK;AAExE,sCAAmB,KAAK;AAExB,QAAM,MAAM,MAAM,aAAAA,QAAM,UAAU,KAAK;AACvC,mCAAgB,KAAK,MAAM,MAAM;AAEjC,QAAM,cAAc,IAAI,KAAK,qBAAqB;AAClD,MAAI,CAAC,YAAa,OAAM,IAAI,MAAM,uCAAuC;AACzE,QAAM,cAAU,0BAAa,KAAK,MAAM,MAAM,YAAY,MAAM,MAAM,CAAC,CAAC;AAExE,QAAM,gBAAgB,IAAI,KAAK,mBAAmB;AAClD,MAAI,CAAC,cAAe,OAAM,IAAI,MAAM,qCAAqC;AACzE,QAAM,YAAY,KAAK,MAAM,MAAM,cAAc,MAAM,MAAM,CAAC;AAS9D,QAAM,WAAW,IAAI,KAAK,UAAU,WAAW;AAC/C,QAAM,YAAY,IAAI,KAAK,UAAU,QAAQ;AAC7C,MAAI,CAAC,SAAU,OAAM,IAAI,MAAM,WAAW,UAAU,WAAW,YAAY;AAC3E,MAAI,CAAC,UAAW,OAAM,IAAI,MAAM,WAAW,UAAU,QAAQ,YAAY;AAEzE,QAAM,cAAc,UAAU,UAAU,IAAI,KAAK,UAAU,OAAO,IAAI;AACtE,QAAM,WAAW,UAAM,0BAAa,GAAG;AAEvC,QAAM,SAAmD,CAAC;AAC1D,QA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AAAA,EACvE,WAA8B;AAAE,WAAO,KAAK,OAAO,UAAU;AAAA,EAAE;AAAA,EAC/D,YAAoE;AAClE,WAAO,KAAK,MAAM,KAAK,OAAO,WAAW,CAAC;AAAA,EAC5C;AAAA,EAEA,aAAa,QAAgB,KAAa,OAAqB;AAC7D,SAAK,OAAO,WAAW,QAAQ,KAAK,KAAK;AAAA,EAC3C;AAAA,EAEA,UAAgB;AAAE,SAAK,OAAO,KAAK;AAAA,EAAE;AACvC;","names":["JSZip","initKernel"]}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["JSZip","AgentDSLKernel"],"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, validateMagicBytes, validateZipBomb } from '@dot-agent/compiler/core'\nimport type { AgentBundle } from './types.js'\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 persona?: 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 personaFile = filesJson.persona ? zip.file(filesJson.persona) : null\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 persona: personaFile ? await personaFile.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 private effectListener?: (effect: Effect) => void\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 // Register a synchronous fallback called when a `merge \"…\"` path is not in the bundle.\n // Must be called before start(). Return null/undefined if the path cannot be resolved.\n setFileResolver(resolver: (path: string) => string | null | undefined): void {\n this.kernel.set_file_resolver(resolver as unknown as Function)\n }\n\n // Call after registerHandler() — loads the behavior and fires initial effects.\n // Passes all merged behavior files as a bundle so the kernel can resolve `merge \"…\"` paths.\n start(): void {\n const bundle: Record<string, string> = {}\n for (const { path, content } of this.bundle.files.behaviors) {\n bundle[path] = content\n }\n this.dispatchRaw(\n this.kernel.load_behavior_with_bundle(\n this.bundle.files.behavior,\n JSON.stringify(bundle),\n )\n )\n }\n\n registerHandler(effectType: string, handler: EffectHandler): void {\n this.handlers.set(effectType, handler)\n }\n\n setEffectListener(listener: ((effect: Effect) => void) | undefined): void {\n this.effectListener = listener\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 this.effectListener?.(effect)\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 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 getMemory(): Array<{ domain: string; key: string; value: unknown }> {\n return JSON.parse(this.kernel.get_memory())\n }\n\n injectMemory(domain: string, key: string, value: string): void {\n this.kernel.set_memory(domain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,KAAK,MAAM,UAAU,SAAS;GAC5B,KAAK,iBAAiB,MAAM;GAC5B,MAAM,UAAU,KAAK,SAAS,IAAI,OAAO,IAAI;GAC7C,IAAI,SACF,QAAQ,QAAQ,QAAQ,MAAM,CAAC,CAAC,CAAC,OAAM,QAAO;IAC5C,QAAQ,MAAM,4CAA4C,OAAO,KAAK,KAAK,GAAG;GAChF,CAAC;EAEL;CACF;CAEA,WAAW,QAAuB;EAAE,KAAK,YAAY,KAAK,OAAO,YAAY,MAAM,CAAC;CAAE;CACtF,UAAU,OAAwB;EAAE,KAAK,YAAY,KAAK,OAAO,WAAW,KAAK,CAAC;CAAE;CACpF,eAAkC;EAAE,KAAK,YAAY,KAAK,OAAO,cAAc,CAAC;CAAE;CAClF,aAAkC;EAAE,KAAK,YAAY,KAAK,OAAO,YAAY,CAAC;CAAE;CAEhF,WAA8B;EAAE,OAAO,KAAK,OAAO,kBAAkB;CAAE;CACvE,kBAA8B;EAAE,OAAO,KAAK,OAAO,kBAAkB;CAAE;CACvE,WAA8B;EAAE,OAAO,KAAK,OAAO,UAAU;CAAE;CAC/D,YAAoE;EAClE,OAAO,KAAK,MAAM,KAAK,OAAO,WAAW,CAAC;CAC5C;CAEA,aAAa,QAAgB,KAAa,OAAqB;EAC7D,KAAK,OAAO,WAAW,QAAQ,KAAK,KAAK;CAC3C;CAEA,UAAgB;EAAE,KAAK,OAAO,KAAK;CAAE;AACvC"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import { AgentBundle } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { AboutMe, AgentBundle, AgentFiles } from "@dot-agent/compiler/core";
|
|
2
|
+
//#region src/types.d.ts
|
|
4
3
|
type EffectHandler = (effect: Effect) => void | Promise<void>;
|
|
5
4
|
interface Effect {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
type: string;
|
|
6
|
+
[key: string]: unknown;
|
|
8
7
|
}
|
|
9
|
-
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/load.d.ts
|
|
10
10
|
declare function loadAgent(input: Uint8Array | ArrayBuffer): Promise<AgentBundle>;
|
|
11
|
-
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/session.d.ts
|
|
12
13
|
declare class AgentSession {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
14
|
+
private kernel;
|
|
15
|
+
private handlers;
|
|
16
|
+
private effectListener?;
|
|
17
|
+
readonly bundle: AgentBundle;
|
|
18
|
+
private constructor();
|
|
19
|
+
static create(bundle: AgentBundle): Promise<AgentSession>;
|
|
20
|
+
setFileResolver(resolver: (path: string) => string | null | undefined): void;
|
|
21
|
+
start(): void;
|
|
22
|
+
registerHandler(effectType: string, handler: EffectHandler): void;
|
|
23
|
+
setEffectListener(listener: ((effect: Effect) => void) | undefined): void;
|
|
24
|
+
private dispatchRaw;
|
|
25
|
+
sendIntent(intent: string): void;
|
|
26
|
+
sendEvent(event: string): void;
|
|
27
|
+
sendOfftopic(): void;
|
|
28
|
+
tickPrompt(): void;
|
|
29
|
+
getState(): string;
|
|
30
|
+
getValidIntents(): Array<any>;
|
|
31
|
+
getGraph(): string;
|
|
32
|
+
getMemory(): Array<{
|
|
33
|
+
domain: string;
|
|
34
|
+
key: string;
|
|
35
|
+
value: unknown;
|
|
36
|
+
}>;
|
|
37
|
+
injectMemory(domain: string, key: string, value: string): void;
|
|
38
|
+
dispose(): void;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
export { AgentSession, type Effect, type EffectHandler, loadAgent };
|
|
40
|
+
//#endregion
|
|
41
|
+
export { type AboutMe, type AgentBundle, type AgentFiles, AgentSession, type Effect, type EffectHandler, loadAgent };
|
|
42
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/load.ts","../src/session.ts"],"mappings":";;KAkBY,iBAAiB,QAAQ,kBAAkB;UAEtC;EACf;GACC;;;;iBCJmB,UAAU,OAAO,aAAa,cAAc,QAAQ;;;cCD7D;UACH;UACA;UACA;WACC,QAAQ;UAEV;SAKM,OAAO,QAAQ,cAAc,QAAQ;EAQlD,gBAAgB,WAAW;EAM3B;EAaA,gBAAgB,oBAAoB,SAAS;EAI7C,kBAAkB,YAAY,QAAQ;UAI9B;EAqBR,WAAW;EACX,UAAU;EACV;EACA;EAEA;EACA,mBAAmB;EACnB;EACA,aAAa;IAAQ;IAAgB;IAAa;;EAIlD,aAAa,gBAAgB,aAAa;EAI1C"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AboutMe, AgentBundle, AgentFiles } from "@dot-agent/compiler/core";
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
type EffectHandler = (effect: Effect) => void | Promise<void>;
|
|
4
|
+
interface Effect {
|
|
5
|
+
type: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/load.d.ts
|
|
10
|
+
declare function loadAgent(input: Uint8Array | ArrayBuffer): Promise<AgentBundle>;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/session.d.ts
|
|
13
|
+
declare class AgentSession {
|
|
14
|
+
private kernel;
|
|
15
|
+
private handlers;
|
|
16
|
+
private effectListener?;
|
|
17
|
+
readonly bundle: AgentBundle;
|
|
18
|
+
private constructor();
|
|
19
|
+
static create(bundle: AgentBundle): Promise<AgentSession>;
|
|
20
|
+
setFileResolver(resolver: (path: string) => string | null | undefined): void;
|
|
21
|
+
start(): void;
|
|
22
|
+
registerHandler(effectType: string, handler: EffectHandler): void;
|
|
23
|
+
setEffectListener(listener: ((effect: Effect) => void) | undefined): void;
|
|
24
|
+
private dispatchRaw;
|
|
25
|
+
sendIntent(intent: string): void;
|
|
26
|
+
sendEvent(event: string): void;
|
|
27
|
+
sendOfftopic(): void;
|
|
28
|
+
tickPrompt(): void;
|
|
29
|
+
getState(): string;
|
|
30
|
+
getValidIntents(): Array<any>;
|
|
31
|
+
getGraph(): string;
|
|
32
|
+
getMemory(): Array<{
|
|
33
|
+
domain: string;
|
|
34
|
+
key: string;
|
|
35
|
+
value: unknown;
|
|
36
|
+
}>;
|
|
37
|
+
injectMemory(domain: string, key: string, value: string): void;
|
|
38
|
+
dispose(): void;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { type AboutMe, type AgentBundle, type AgentFiles, AgentSession, type Effect, type EffectHandler, loadAgent };
|
|
42
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/load.ts","../src/session.ts"],"mappings":";;KAkBY,iBAAiB,QAAQ,kBAAkB;UAEtC;EACf;GACC;;;;iBCJmB,UAAU,OAAO,aAAa,cAAc,QAAQ;;;cCD7D;UACH;UACA;UACA;WACC,QAAQ;UAEV;SAKM,OAAO,QAAQ,cAAc,QAAQ;EAQlD,gBAAgB,WAAW;EAM3B;EAaA,gBAAgB,oBAAoB,SAAS;EAI7C,kBAAkB,YAAY,QAAQ;UAI9B;EAqBR,WAAW;EACX,UAAU;EACV;EACA;EAEA;EACA,mBAAmB;EACnB;EACA,aAAa;IAAQ;IAAgB;IAAa;;EAIlD,aAAa,gBAAgB,aAAa;EAI1C"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import JSZip from "jszip";
|
|
2
|
+
import { extractFiles, parseAboutme, validateMagicBytes, validateZipBomb } from "@dot-agent/compiler/core";
|
|
3
|
+
import { AgentDSLKernel, init } from "@dot-agent/kernel-dsl";
|
|
4
|
+
//#region src/load.ts
|
|
5
|
+
async function loadAgent(input) {
|
|
6
|
+
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
7
|
+
validateMagicBytes(bytes);
|
|
8
|
+
const zip = await JSZip.loadAsync(bytes);
|
|
9
|
+
validateZipBomb(zip, bytes.length);
|
|
10
|
+
const aboutmeFile = zip.file(".agent/aboutme.json");
|
|
11
|
+
if (!aboutmeFile) throw new Error("Missing .agent/aboutme.json in bundle");
|
|
12
|
+
const aboutme = parseAboutme(JSON.parse(await aboutmeFile.async("text")));
|
|
13
|
+
const filesJsonFile = zip.file(".agent/files.json");
|
|
14
|
+
if (!filesJsonFile) throw new Error("Missing .agent/files.json in bundle");
|
|
15
|
+
const filesJson = JSON.parse(await filesJsonFile.async("text"));
|
|
16
|
+
const descFile = zip.file(filesJson.description);
|
|
17
|
+
const behavFile = zip.file(filesJson.behavior);
|
|
18
|
+
if (!descFile) throw new Error(`Missing ${filesJson.description} in bundle`);
|
|
19
|
+
if (!behavFile) throw new Error(`Missing ${filesJson.behavior} in bundle`);
|
|
20
|
+
const personaFile = filesJson.persona ? zip.file(filesJson.persona) : null;
|
|
21
|
+
const allFiles = await extractFiles(zip);
|
|
22
|
+
const guides = [];
|
|
23
|
+
const knowledge = [];
|
|
24
|
+
const behaviors = [];
|
|
25
|
+
for (const [path, content] of allFiles) if (path.startsWith("guides/") && path !== "guides/.gitkeep") guides.push({
|
|
26
|
+
path,
|
|
27
|
+
content
|
|
28
|
+
});
|
|
29
|
+
else if (path.startsWith("knowledge/") && path !== "knowledge/.gitkeep") knowledge.push({
|
|
30
|
+
path,
|
|
31
|
+
content
|
|
32
|
+
});
|
|
33
|
+
else if (path.startsWith("behaviors/") && path !== "behaviors/.gitkeep") behaviors.push({
|
|
34
|
+
path,
|
|
35
|
+
content
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
id: aboutme.id,
|
|
39
|
+
aboutme,
|
|
40
|
+
files: {
|
|
41
|
+
description: await descFile.async("text"),
|
|
42
|
+
behavior: await behavFile.async("text"),
|
|
43
|
+
persona: personaFile ? await personaFile.async("text") : void 0,
|
|
44
|
+
guides,
|
|
45
|
+
knowledge,
|
|
46
|
+
behaviors
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/session.ts
|
|
52
|
+
var AgentSession = class AgentSession {
|
|
53
|
+
kernel;
|
|
54
|
+
handlers = /* @__PURE__ */ new Map();
|
|
55
|
+
effectListener;
|
|
56
|
+
bundle;
|
|
57
|
+
constructor(kernel, bundle) {
|
|
58
|
+
this.kernel = kernel;
|
|
59
|
+
this.bundle = bundle;
|
|
60
|
+
}
|
|
61
|
+
static async create(bundle) {
|
|
62
|
+
await init();
|
|
63
|
+
const kernel = new AgentDSLKernel();
|
|
64
|
+
return new AgentSession(kernel, bundle);
|
|
65
|
+
}
|
|
66
|
+
setFileResolver(resolver) {
|
|
67
|
+
this.kernel.set_file_resolver(resolver);
|
|
68
|
+
}
|
|
69
|
+
start() {
|
|
70
|
+
const bundle = {};
|
|
71
|
+
for (const { path, content } of this.bundle.files.behaviors) bundle[path] = content;
|
|
72
|
+
this.dispatchRaw(this.kernel.load_behavior_with_bundle(this.bundle.files.behavior, JSON.stringify(bundle)));
|
|
73
|
+
}
|
|
74
|
+
registerHandler(effectType, handler) {
|
|
75
|
+
this.handlers.set(effectType, handler);
|
|
76
|
+
}
|
|
77
|
+
setEffectListener(listener) {
|
|
78
|
+
this.effectListener = listener;
|
|
79
|
+
}
|
|
80
|
+
dispatchRaw(raw) {
|
|
81
|
+
if (!raw) return;
|
|
82
|
+
let effects;
|
|
83
|
+
try {
|
|
84
|
+
effects = JSON.parse(raw);
|
|
85
|
+
} catch {
|
|
86
|
+
console.error("[AgentSession] failed to parse effects JSON:", raw);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (!Array.isArray(effects)) return;
|
|
90
|
+
for (const effect of effects) {
|
|
91
|
+
this.effectListener?.(effect);
|
|
92
|
+
const handler = this.handlers.get(effect.type);
|
|
93
|
+
if (handler) Promise.resolve(handler(effect)).catch((err) => {
|
|
94
|
+
console.error(`[AgentSession] handler error for effect "${effect.type}":`, err);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
sendIntent(intent) {
|
|
99
|
+
this.dispatchRaw(this.kernel.send_intent(intent));
|
|
100
|
+
}
|
|
101
|
+
sendEvent(event) {
|
|
102
|
+
this.dispatchRaw(this.kernel.send_event(event));
|
|
103
|
+
}
|
|
104
|
+
sendOfftopic() {
|
|
105
|
+
this.dispatchRaw(this.kernel.send_offtopic());
|
|
106
|
+
}
|
|
107
|
+
tickPrompt() {
|
|
108
|
+
this.dispatchRaw(this.kernel.tick_prompt());
|
|
109
|
+
}
|
|
110
|
+
getState() {
|
|
111
|
+
return this.kernel.get_current_state();
|
|
112
|
+
}
|
|
113
|
+
getValidIntents() {
|
|
114
|
+
return this.kernel.get_valid_intents();
|
|
115
|
+
}
|
|
116
|
+
getGraph() {
|
|
117
|
+
return this.kernel.get_graph();
|
|
118
|
+
}
|
|
119
|
+
getMemory() {
|
|
120
|
+
return JSON.parse(this.kernel.get_memory());
|
|
121
|
+
}
|
|
122
|
+
injectMemory(domain, key, value) {
|
|
123
|
+
this.kernel.set_memory(domain, key, value);
|
|
124
|
+
}
|
|
125
|
+
dispose() {
|
|
126
|
+
this.kernel.free();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
//#endregion
|
|
130
|
+
export { AgentSession, loadAgent };
|
|
131
|
+
|
|
132
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["initKernel"],"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, validateMagicBytes, validateZipBomb } from '@dot-agent/compiler/core'\nimport type { AgentBundle } from './types.js'\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 persona?: 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 personaFile = filesJson.persona ? zip.file(filesJson.persona) : null\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 persona: personaFile ? await personaFile.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 private effectListener?: (effect: Effect) => void\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 // Register a synchronous fallback called when a `merge \"…\"` path is not in the bundle.\n // Must be called before start(). Return null/undefined if the path cannot be resolved.\n setFileResolver(resolver: (path: string) => string | null | undefined): void {\n this.kernel.set_file_resolver(resolver as unknown as Function)\n }\n\n // Call after registerHandler() — loads the behavior and fires initial effects.\n // Passes all merged behavior files as a bundle so the kernel can resolve `merge \"…\"` paths.\n start(): void {\n const bundle: Record<string, string> = {}\n for (const { path, content } of this.bundle.files.behaviors) {\n bundle[path] = content\n }\n this.dispatchRaw(\n this.kernel.load_behavior_with_bundle(\n this.bundle.files.behavior,\n JSON.stringify(bundle),\n )\n )\n }\n\n registerHandler(effectType: string, handler: EffectHandler): void {\n this.handlers.set(effectType, handler)\n }\n\n setEffectListener(listener: ((effect: Effect) => void) | undefined): void {\n this.effectListener = listener\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 this.effectListener?.(effect)\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 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 getMemory(): Array<{ domain: string; key: string; value: unknown }> {\n return JSON.parse(this.kernel.get_memory())\n }\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":";;;;AAkBA,eAAsB,UAAU,OAAuD;CACrF,MAAM,QAAQ,iBAAiB,aAAa,QAAQ,IAAI,WAAW,KAAK;CAExE,mBAAmB,KAAK;CAExB,MAAM,MAAM,MAAM,MAAM,UAAU,KAAK;CACvC,gBAAgB,KAAK,MAAM,MAAM;CAEjC,MAAM,cAAc,IAAI,KAAK,qBAAqB;CAClD,IAAI,CAAC,aAAa,MAAM,IAAI,MAAM,uCAAuC;CACzE,MAAM,UAAU,aAAa,KAAK,MAAM,MAAM,YAAY,MAAM,MAAM,CAAC,CAAC;CAExE,MAAM,gBAAgB,IAAI,KAAK,m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B;EAAE,OAAO,KAAK,OAAO,kBAAkB;CAAE;CACvE,WAA8B;EAAE,OAAO,KAAK,OAAO,UAAU;CAAE;CAC/D,YAAoE;EAClE,OAAO,KAAK,MAAM,KAAK,OAAO,WAAW,CAAC;CAC5C;CAEA,aAAa,QAAgB,KAAa,OAAqB;EAC7D,KAAK,OAAO,WAAW,QAAQ,KAAK,KAAK;CAC3C;CAEA,UAAgB;EAAE,KAAK,OAAO,KAAK;CAAE;AACvC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dot-agent/sdk",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Browser-compatible SDK for loading and running dot-agent bundles",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,34 +37,38 @@
|
|
|
37
37
|
"dot-agent"
|
|
38
38
|
],
|
|
39
39
|
"type": "module",
|
|
40
|
-
"main": "dist/index.
|
|
41
|
-
"
|
|
40
|
+
"main": "dist/index.cjs",
|
|
41
|
+
"module": "dist/index.mjs",
|
|
42
|
+
"types": "dist/index.d.mts",
|
|
42
43
|
"exports": {
|
|
43
44
|
".": {
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
"import": {
|
|
46
|
+
"types": "./dist/index.d.mts",
|
|
47
|
+
"default": "./dist/index.mjs"
|
|
48
|
+
},
|
|
49
|
+
"require": {
|
|
50
|
+
"types": "./dist/index.d.cts",
|
|
51
|
+
"default": "./dist/index.cjs"
|
|
52
|
+
}
|
|
47
53
|
}
|
|
48
54
|
},
|
|
49
55
|
"files": [
|
|
50
56
|
"dist"
|
|
51
57
|
],
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=24.0.0"
|
|
60
|
+
},
|
|
52
61
|
"scripts": {
|
|
53
|
-
"build": "
|
|
54
|
-
"dev": "
|
|
62
|
+
"build": "tsdown",
|
|
63
|
+
"dev": "tsdown --watch",
|
|
55
64
|
"typecheck": "tsc --noEmit",
|
|
56
65
|
"test": "node --test tests/node.test.js"
|
|
57
66
|
},
|
|
58
67
|
"dependencies": {
|
|
59
|
-
"@dot-agent/compiler": "0.10.
|
|
60
|
-
"@dot-agent/kernel-dsl": "0.10.
|
|
68
|
+
"@dot-agent/compiler": "0.10.1",
|
|
69
|
+
"@dot-agent/kernel-dsl": "0.10.2",
|
|
61
70
|
"jszip": "^3.10.1"
|
|
62
71
|
},
|
|
63
|
-
"devDependencies": {
|
|
64
|
-
"@types/node": "^20.0.0",
|
|
65
|
-
"tsup": "^8.0.0",
|
|
66
|
-
"typescript": "^5.0.0"
|
|
67
|
-
},
|
|
68
72
|
"publishConfig": {
|
|
69
73
|
"access": "public"
|
|
70
74
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { AgentBundle } from '@dot-agent/compiler/core';
|
|
2
|
-
export { AboutMe, AgentBundle, AgentFiles } from '@dot-agent/compiler/core';
|
|
3
|
-
|
|
4
|
-
type EffectHandler = (effect: Effect) => void | Promise<void>;
|
|
5
|
-
interface Effect {
|
|
6
|
-
type: string;
|
|
7
|
-
[key: string]: unknown;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare function loadAgent(input: Uint8Array | ArrayBuffer): Promise<AgentBundle>;
|
|
11
|
-
|
|
12
|
-
declare class AgentSession {
|
|
13
|
-
private kernel;
|
|
14
|
-
private handlers;
|
|
15
|
-
private effectListener?;
|
|
16
|
-
readonly bundle: AgentBundle;
|
|
17
|
-
private constructor();
|
|
18
|
-
static create(bundle: AgentBundle): Promise<AgentSession>;
|
|
19
|
-
setFileResolver(resolver: (path: string) => string | null | undefined): void;
|
|
20
|
-
start(): void;
|
|
21
|
-
registerHandler(effectType: string, handler: EffectHandler): void;
|
|
22
|
-
setEffectListener(listener: ((effect: Effect) => void) | undefined): void;
|
|
23
|
-
private dispatchRaw;
|
|
24
|
-
sendIntent(intent: string): void;
|
|
25
|
-
sendEvent(event: string): void;
|
|
26
|
-
sendOfftopic(): void;
|
|
27
|
-
tickPrompt(): void;
|
|
28
|
-
getState(): string;
|
|
29
|
-
getValidIntents(): Array<any>;
|
|
30
|
-
getGraph(): string;
|
|
31
|
-
getMemory(): Array<{
|
|
32
|
-
domain: string;
|
|
33
|
-
key: string;
|
|
34
|
-
value: unknown;
|
|
35
|
-
}>;
|
|
36
|
-
injectMemory(domain: string, key: string, value: string): void;
|
|
37
|
-
dispose(): void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { AgentSession, type Effect, type EffectHandler, loadAgent };
|
package/dist/index.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
// src/load.ts
|
|
2
|
-
import JSZip from "jszip";
|
|
3
|
-
import { parseAboutme, extractFiles, validateMagicBytes, validateZipBomb } from "@dot-agent/compiler/core";
|
|
4
|
-
async function loadAgent(input) {
|
|
5
|
-
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
6
|
-
validateMagicBytes(bytes);
|
|
7
|
-
const zip = await JSZip.loadAsync(bytes);
|
|
8
|
-
validateZipBomb(zip, bytes.length);
|
|
9
|
-
const aboutmeFile = zip.file(".agent/aboutme.json");
|
|
10
|
-
if (!aboutmeFile) throw new Error("Missing .agent/aboutme.json in bundle");
|
|
11
|
-
const aboutme = parseAboutme(JSON.parse(await aboutmeFile.async("text")));
|
|
12
|
-
const filesJsonFile = zip.file(".agent/files.json");
|
|
13
|
-
if (!filesJsonFile) throw new Error("Missing .agent/files.json in bundle");
|
|
14
|
-
const filesJson = JSON.parse(await filesJsonFile.async("text"));
|
|
15
|
-
const descFile = zip.file(filesJson.description);
|
|
16
|
-
const behavFile = zip.file(filesJson.behavior);
|
|
17
|
-
if (!descFile) throw new Error(`Missing ${filesJson.description} in bundle`);
|
|
18
|
-
if (!behavFile) throw new Error(`Missing ${filesJson.behavior} in bundle`);
|
|
19
|
-
const personaFile = filesJson.persona ? zip.file(filesJson.persona) : null;
|
|
20
|
-
const allFiles = await extractFiles(zip);
|
|
21
|
-
const guides = [];
|
|
22
|
-
const knowledge = [];
|
|
23
|
-
const behaviors = [];
|
|
24
|
-
for (const [path, content] of allFiles) {
|
|
25
|
-
if (path.startsWith("guides/") && path !== "guides/.gitkeep") {
|
|
26
|
-
guides.push({ path, content });
|
|
27
|
-
} else if (path.startsWith("knowledge/") && path !== "knowledge/.gitkeep") {
|
|
28
|
-
knowledge.push({ path, content });
|
|
29
|
-
} else if (path.startsWith("behaviors/") && path !== "behaviors/.gitkeep") {
|
|
30
|
-
behaviors.push({ path, content });
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
id: aboutme.id,
|
|
35
|
-
aboutme,
|
|
36
|
-
files: {
|
|
37
|
-
description: await descFile.async("text"),
|
|
38
|
-
behavior: await behavFile.async("text"),
|
|
39
|
-
persona: personaFile ? await personaFile.async("text") : void 0,
|
|
40
|
-
guides,
|
|
41
|
-
knowledge,
|
|
42
|
-
behaviors
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// src/session.ts
|
|
48
|
-
import { AgentDSLKernel, init as initKernel } from "@dot-agent/kernel-dsl";
|
|
49
|
-
var AgentSession = class _AgentSession {
|
|
50
|
-
kernel;
|
|
51
|
-
handlers = /* @__PURE__ */ new Map();
|
|
52
|
-
effectListener;
|
|
53
|
-
bundle;
|
|
54
|
-
constructor(kernel, bundle) {
|
|
55
|
-
this.kernel = kernel;
|
|
56
|
-
this.bundle = bundle;
|
|
57
|
-
}
|
|
58
|
-
static async create(bundle) {
|
|
59
|
-
await initKernel();
|
|
60
|
-
const kernel = new AgentDSLKernel();
|
|
61
|
-
return new _AgentSession(kernel, bundle);
|
|
62
|
-
}
|
|
63
|
-
// Register a synchronous fallback called when a `merge "…"` path is not in the bundle.
|
|
64
|
-
// Must be called before start(). Return null/undefined if the path cannot be resolved.
|
|
65
|
-
setFileResolver(resolver) {
|
|
66
|
-
this.kernel.set_file_resolver(resolver);
|
|
67
|
-
}
|
|
68
|
-
// Call after registerHandler() — loads the behavior and fires initial effects.
|
|
69
|
-
// Passes all merged behavior files as a bundle so the kernel can resolve `merge "…"` paths.
|
|
70
|
-
start() {
|
|
71
|
-
const bundle = {};
|
|
72
|
-
for (const { path, content } of this.bundle.files.behaviors) {
|
|
73
|
-
bundle[path] = content;
|
|
74
|
-
}
|
|
75
|
-
this.dispatchRaw(
|
|
76
|
-
this.kernel.load_behavior_with_bundle(
|
|
77
|
-
this.bundle.files.behavior,
|
|
78
|
-
JSON.stringify(bundle)
|
|
79
|
-
)
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
registerHandler(effectType, handler) {
|
|
83
|
-
this.handlers.set(effectType, handler);
|
|
84
|
-
}
|
|
85
|
-
setEffectListener(listener) {
|
|
86
|
-
this.effectListener = listener;
|
|
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
|
-
this.effectListener?.(effect);
|
|
100
|
-
const handler = this.handlers.get(effect.type);
|
|
101
|
-
if (handler) {
|
|
102
|
-
Promise.resolve(handler(effect)).catch((err) => {
|
|
103
|
-
console.error(`[AgentSession] handler error for effect "${effect.type}":`, err);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
sendIntent(intent) {
|
|
109
|
-
this.dispatchRaw(this.kernel.send_intent(intent));
|
|
110
|
-
}
|
|
111
|
-
sendEvent(event) {
|
|
112
|
-
this.dispatchRaw(this.kernel.send_event(event));
|
|
113
|
-
}
|
|
114
|
-
sendOfftopic() {
|
|
115
|
-
this.dispatchRaw(this.kernel.send_offtopic());
|
|
116
|
-
}
|
|
117
|
-
tickPrompt() {
|
|
118
|
-
this.dispatchRaw(this.kernel.tick_prompt());
|
|
119
|
-
}
|
|
120
|
-
getState() {
|
|
121
|
-
return this.kernel.get_current_state();
|
|
122
|
-
}
|
|
123
|
-
getValidIntents() {
|
|
124
|
-
return this.kernel.get_valid_intents();
|
|
125
|
-
}
|
|
126
|
-
getGraph() {
|
|
127
|
-
return this.kernel.get_graph();
|
|
128
|
-
}
|
|
129
|
-
getMemory() {
|
|
130
|
-
return JSON.parse(this.kernel.get_memory());
|
|
131
|
-
}
|
|
132
|
-
injectMemory(domain, key, value) {
|
|
133
|
-
this.kernel.set_memory(domain, key, value);
|
|
134
|
-
}
|
|
135
|
-
dispose() {
|
|
136
|
-
this.kernel.free();
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
export {
|
|
140
|
-
AgentSession,
|
|
141
|
-
loadAgent
|
|
142
|
-
};
|
|
143
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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, validateMagicBytes, validateZipBomb } from '@dot-agent/compiler/core'\nimport type { AgentBundle } from './types.js'\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 persona?: 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 personaFile = filesJson.persona ? zip.file(filesJson.persona) : null\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 persona: personaFile ? await personaFile.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 private effectListener?: (effect: Effect) => void\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 // Register a synchronous fallback called when a `merge \"…\"` path is not in the bundle.\n // Must be called before start(). Return null/undefined if the path cannot be resolved.\n setFileResolver(resolver: (path: string) => string | null | undefined): void {\n this.kernel.set_file_resolver(resolver as unknown as Function)\n }\n\n // Call after registerHandler() — loads the behavior and fires initial effects.\n // Passes all merged behavior files as a bundle so the kernel can resolve `merge \"…\"` paths.\n start(): void {\n const bundle: Record<string, string> = {}\n for (const { path, content } of this.bundle.files.behaviors) {\n bundle[path] = content\n }\n this.dispatchRaw(\n this.kernel.load_behavior_with_bundle(\n this.bundle.files.behavior,\n JSON.stringify(bundle),\n )\n )\n }\n\n registerHandler(effectType: string, handler: EffectHandler): void {\n this.handlers.set(effectType, handler)\n }\n\n setEffectListener(listener: ((effect: Effect) => void) | undefined): void {\n this.effectListener = listener\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 this.effectListener?.(effect)\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 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 getMemory(): Array<{ domain: string; key: string; value: unknown }> {\n return JSON.parse(this.kernel.get_memory())\n }\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,cAAc,oBAAoB,uBAAuB;AAGhF,eAAsB,UAAU,OAAuD;AACrF,QAAM,QAAQ,iBAAiB,aAAa,QAAQ,IAAI,WAAW,KAAK;AAExE,qBAAmB,KAAK;AAExB,QAAM,MAAM,MAAM,MAAM,UAAU,KAAK;AACvC,kBAAgB,KAAK,MAAM,MAAM;AAEjC,QAAM,cAAc,IAAI,KAAK,qBAAqB;AAClD,MAAI,CAAC,YAAa,OAAM,IAAI,MAAM,uCAAuC;AACzE,QAAM,UAAU,aAAa,KAAK,MAAM,MAAM,YAAY,MAAM,MAAM,CAAC,CAAC;AAExE,QAAM,gBAAgB,IAAI,KAAK,mBAAmB;AAClD,MAAI,CAAC,cAAe,OAAM,IAAI,MAAM,qCAAqC;AACzE,QAAM,YAAY,KAAK,MAAM,MAAM,cAAc,MAAM,MAAM,CAAC;AAS9D,QAAM,WAAW,IAAI,KAAK,UAAU,WAAW;AAC/C,QAAM,YAAY,IAAI,KAAK,UAAU,QAAQ;AAC7C,MAAI,CAAC,SAAU,OAAM,IAAI,MAAM,WAAW,UAAU,WAAW,YAAY;AAC3E,MAAI,CAAC,UAAW,OAAM,IAAI,MAAM,WAAW,UAAU,QAAQ,YAAY;AAEzE,QAAM,cAAc,UAAU,UAAU,IAAI,KAAK,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