@dot-agent/sdk 0.1.0 → 0.5.0-alpha.1

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/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # @dot-agent/sdk
2
+
3
+ Browser-compatible dispatch layer for loading and running `.agent` bundles. This is **Level 3** of the dot-agent tooling hierarchy: it wraps `@dot-agent/kernel-dsl` (the WASM FSM runtime) and `@dot-agent/compiler` (bundle parsing) behind a small session API, so a host application never talks to the kernel directly.
4
+
5
+ ---
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @dot-agent/sdk
11
+ ```
12
+
13
+ ---
14
+
15
+ ## Quick start
16
+
17
+ ```ts
18
+ import { loadAgent, AgentSession } from '@dot-agent/sdk'
19
+
20
+ // 1. Load a .agent bundle (a ZIP, as Uint8Array or ArrayBuffer)
21
+ const bundle = await loadAgent(bytes)
22
+
23
+ // 2. Create a session and register effect handlers before starting
24
+ const session = await AgentSession.create(bundle)
25
+ session.registerHandler('goal', ({ text }) => console.log('goal:', text))
26
+ session.registerHandler('guide', ({ text }) => console.log('guide:', text))
27
+ session.registerHandler('request_interact', () => showInputBox())
28
+
29
+ // 3. Start the FSM — fires the init state's effects
30
+ session.start()
31
+
32
+ // 4. Drive the conversation
33
+ session.sendIntent('examine')
34
+ console.log(session.getState())
35
+ console.log(session.getValidIntents())
36
+
37
+ session.dispose()
38
+ ```
39
+
40
+ If the bundle's behavior files reference a `merge "…"` path that isn't already included in
41
+ `bundle.files.behaviors`, register a fallback resolver **before** calling `start()`:
42
+
43
+ ```ts
44
+ session.setFileResolver(path => lookupBehaviorSource(path))
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Public API
50
+
51
+ | Export | Description |
52
+ |--------|-------------|
53
+ | `loadAgent(input)` | Parse a `.agent` ZIP (`Uint8Array` \| `ArrayBuffer`) into an `AgentBundle` |
54
+ | `AgentSession.create(bundle)` | Construct a session around a loaded bundle; initializes the WASM kernel |
55
+ | `session.setFileResolver(fn)` | Register the Mode B fallback for `merge` paths missing from the bundle |
56
+ | `session.registerHandler(type, fn)` | Register a per-effect-type handler (`goal`, `guide`, `teach`, `request_interact`, `transition`, `run_script`, `run_subagent`, `run_tool`, `set_memory`, `apply_css`, `remove_css`, …) |
57
+ | `session.setEffectListener(fn)` | Optional catch-all called for every effect, in addition to per-type handlers |
58
+ | `session.start()` | Load the behavior into the kernel and fire the `init` state's effects |
59
+ | `session.sendIntent(intent)` | Dispatch a user intent to the current state's `on intent` handler |
60
+ | `session.sendEvent(event)` | Dispatch a named event to matching `on event` triggers |
61
+ | `session.sendOfftopic()` | Dispatch to the current state's `on offtopic` handler |
62
+ | `session.tickPrompt()` | Advance the turn counter, firing any `after N prompts` statements |
63
+ | `session.getState()` | Current FSM state name |
64
+ | `session.getValidIntents()` | Intents accepted by the current state |
65
+ | `session.getGraph()` | SCXML graph of the loaded behavior, with the active state annotated |
66
+ | `session.getMemory()` | Snapshot of kernel memory as `{ domain, key, value }[]` |
67
+ | `session.injectMemory(domain, key, value)` | Write a value into kernel memory |
68
+ | `session.dispose()` | Free the underlying WASM kernel instance |
69
+ | `validateMagicBytes(bytes)` \| `validateZipBomb(zip, size)` | Bundle-safety checks, re-exported from `@dot-agent/compiler/core` |
70
+
71
+ Full type definitions (`AgentBundle`, `AgentFiles`, `Effect`, `EffectHandler`, `AboutMe`) are in `dist/index.d.ts` after building.
72
+
73
+ ---
74
+
75
+ ## Development
76
+
77
+ ```bash
78
+ npm install
79
+ npm test # node --test against tests/node.test.js
80
+ npm run build # compile to dist/ with tsup
81
+ npm run typecheck # tsc --noEmit
82
+ ```
package/dist/index.cjs CHANGED
@@ -38,30 +38,11 @@ module.exports = __toCommonJS(index_exports);
38
38
  // src/load.ts
39
39
  var import_jszip = __toESM(require("jszip"), 1);
40
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
41
  async function loadAgent(input) {
61
42
  const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
62
- validateMagicBytes(bytes);
43
+ (0, import_core.validateMagicBytes)(bytes);
63
44
  const zip = await import_jszip.default.loadAsync(bytes);
64
- validateZipBomb(zip, bytes.length);
45
+ (0, import_core.validateZipBomb)(zip, bytes.length);
65
46
  const aboutmeFile = zip.file(".agent/aboutme.json");
66
47
  if (!aboutmeFile) throw new Error("Missing .agent/aboutme.json in bundle");
67
48
  const aboutme = (0, import_core.parseAboutme)(JSON.parse(await aboutmeFile.async("text")));
@@ -105,6 +86,7 @@ var import_kernel_dsl = require("@dot-agent/kernel-dsl");
105
86
  var AgentSession = class _AgentSession {
106
87
  kernel;
107
88
  handlers = /* @__PURE__ */ new Map();
89
+ effectListener;
108
90
  bundle;
109
91
  constructor(kernel, bundle) {
110
92
  this.kernel = kernel;
@@ -115,13 +97,31 @@ var AgentSession = class _AgentSession {
115
97
  const kernel = new import_kernel_dsl.AgentDSLKernel();
116
98
  return new _AgentSession(kernel, bundle);
117
99
  }
100
+ // Register a synchronous fallback called when a `merge "…"` path is not in the bundle.
101
+ // Must be called before start(). Return null/undefined if the path cannot be resolved.
102
+ setFileResolver(resolver) {
103
+ this.kernel.set_file_resolver(resolver);
104
+ }
118
105
  // Call after registerHandler() — loads the behavior and fires initial effects.
106
+ // Passes all merged behavior files as a bundle so the kernel can resolve `merge "…"` paths.
119
107
  start() {
120
- this.dispatchRaw(this.kernel.load_behavior(this.bundle.files.behavior));
108
+ const bundle = {};
109
+ for (const { path, content } of this.bundle.files.behaviors) {
110
+ bundle[path] = content;
111
+ }
112
+ this.dispatchRaw(
113
+ this.kernel.load_behavior_with_bundle(
114
+ this.bundle.files.behavior,
115
+ JSON.stringify(bundle)
116
+ )
117
+ );
121
118
  }
122
119
  registerHandler(effectType, handler) {
123
120
  this.handlers.set(effectType, handler);
124
121
  }
122
+ setEffectListener(listener) {
123
+ this.effectListener = listener;
124
+ }
125
125
  dispatchRaw(raw) {
126
126
  if (!raw) return;
127
127
  let effects;
@@ -133,6 +133,7 @@ var AgentSession = class _AgentSession {
133
133
  }
134
134
  if (!Array.isArray(effects)) return;
135
135
  for (const effect of effects) {
136
+ this.effectListener?.(effect);
136
137
  const handler = this.handlers.get(effect.type);
137
138
  if (handler) {
138
139
  Promise.resolve(handler(effect)).catch((err) => {
@@ -147,12 +148,6 @@ var AgentSession = class _AgentSession {
147
148
  sendEvent(event) {
148
149
  this.dispatchRaw(this.kernel.send_event(event));
149
150
  }
150
- sendComplete() {
151
- this.dispatchRaw(this.kernel.send_complete());
152
- }
153
- sendFailed() {
154
- this.dispatchRaw(this.kernel.send_failed());
155
- }
156
151
  sendOfftopic() {
157
152
  this.dispatchRaw(this.kernel.send_offtopic());
158
153
  }
@@ -168,6 +163,9 @@ var AgentSession = class _AgentSession {
168
163
  getGraph() {
169
164
  return this.kernel.get_graph();
170
165
  }
166
+ getMemory() {
167
+ return JSON.parse(this.kernel.get_memory());
168
+ }
171
169
  injectMemory(domain, key, value) {
172
170
  this.kernel.set_memory(domain, key, value);
173
171
  }
@@ -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 } 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,QAAI,CAAC,KAAK,IAAK,sBAAsB,KAAa,OAAO,oBAAoB;AAAA,EAC/E,CAAC;AACD,MAAI,oBAAoB,cAAc;AACpC,UAAM,IAAI,MAAM,sCAAsC,iBAAiB,EAAE;AAAA,EAC3E;AACA,MAAI,oBAAoB,iBAAiB,uBAAuB;AAC9D,UAAM,IAAI,MAAM,oCAAoC,oBAAoB,gBAAgB,QAAQ,CAAC,CAAC,GAAG;AAAA,EACvG;AACF;AAEA,eAAsB,UAAU,OAAuD;AACrF,QAAM,QAAQ,iBAAiB,aAAa,QAAQ,IAAI,WAAW,KAAK;AAExE,qBAAmB,KAAK;AAExB,QAAM,MAAM,MAAM,aAAAA,QAAM,UAAU,KAAK;AACvC,kBAAgB,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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,cAAc,CAAC;AAAA,EAAE;AAAA,EAClF,aAAkC;AAAE,SAAK,YAAY,KAAK,OAAO,YAAY,CAAC;AAAA,EAAE;AAAA,EAEhF,WAA8B;AAAE,WAAO,KAAK,OAAO,kBAAkB;AAAA,EAAE;AAAA,EACvE,kBAA8B;AAAE,WAAO,KAAK,OAAO,kBAAkB;AAAA,EAAE;AAAA,EACvE,WAA8B;AAAE,WAAO,KAAK,OAAO,UAAU;AAAA,EAAE;AAAA,EAE/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":["JSZip","initKernel"]}
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 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 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;AAQ9D,QAAM,WAAW,IAAI,KAAK,UAAU,WAAW;AAC/C,QAAM,YAAY,IAAI,KAAK,UAAU,QAAQ;AAC7C,MAAI,CAAC,SA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Ac,CAAC;AAAA,EAAE;AAAA,EAClF,aAAkC;AAAE,SAAK,YAAY,KAAK,OAAO,YAAY,CAAC;AAAA,EAAE;AAAA,EAEhF,WAA8B;AAAE,WAAO,KAAK,OAAO,kBAAkB;AAAA,EAAE;AAAA,EACvE,kBAA8B;AAAE,WAAO,KAAK,OAAO,kBAAkB;AAAA,EAAE;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"]}
package/dist/index.d.cts CHANGED
@@ -1,28 +1,6 @@
1
- import { AboutMe } from '@dot-agent/compiler/core';
2
- export { AboutMe } from '@dot-agent/compiler/core';
1
+ import { AgentBundle } from '@dot-agent/compiler/core';
2
+ export { AboutMe, AgentBundle, AgentFiles } from '@dot-agent/compiler/core';
3
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
4
  type EffectHandler = (effect: Effect) => void | Promise<void>;
27
5
  interface Effect {
28
6
  type: string;
@@ -34,23 +12,29 @@ declare function loadAgent(input: Uint8Array | ArrayBuffer): Promise<AgentBundle
34
12
  declare class AgentSession {
35
13
  private kernel;
36
14
  private handlers;
15
+ private effectListener?;
37
16
  readonly bundle: AgentBundle;
38
17
  private constructor();
39
18
  static create(bundle: AgentBundle): Promise<AgentSession>;
19
+ setFileResolver(resolver: (path: string) => string | null | undefined): void;
40
20
  start(): void;
41
21
  registerHandler(effectType: string, handler: EffectHandler): void;
22
+ setEffectListener(listener: ((effect: Effect) => void) | undefined): void;
42
23
  private dispatchRaw;
43
24
  sendIntent(intent: string): void;
44
25
  sendEvent(event: string): void;
45
- sendComplete(): void;
46
- sendFailed(): void;
47
26
  sendOfftopic(): void;
48
27
  tickPrompt(): void;
49
28
  getState(): string;
50
29
  getValidIntents(): Array<any>;
51
30
  getGraph(): string;
31
+ getMemory(): Array<{
32
+ domain: string;
33
+ key: string;
34
+ value: unknown;
35
+ }>;
52
36
  injectMemory(domain: string, key: string, value: string): void;
53
37
  dispose(): void;
54
38
  }
55
39
 
56
- export { type AgentBundle, type AgentFiles, AgentSession, type Effect, type EffectHandler, loadAgent };
40
+ export { AgentSession, type Effect, type EffectHandler, loadAgent };
package/dist/index.d.ts CHANGED
@@ -1,28 +1,6 @@
1
- import { AboutMe } from '@dot-agent/compiler/core';
2
- export { AboutMe } from '@dot-agent/compiler/core';
1
+ import { AgentBundle } from '@dot-agent/compiler/core';
2
+ export { AboutMe, AgentBundle, AgentFiles } from '@dot-agent/compiler/core';
3
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
4
  type EffectHandler = (effect: Effect) => void | Promise<void>;
27
5
  interface Effect {
28
6
  type: string;
@@ -34,23 +12,29 @@ declare function loadAgent(input: Uint8Array | ArrayBuffer): Promise<AgentBundle
34
12
  declare class AgentSession {
35
13
  private kernel;
36
14
  private handlers;
15
+ private effectListener?;
37
16
  readonly bundle: AgentBundle;
38
17
  private constructor();
39
18
  static create(bundle: AgentBundle): Promise<AgentSession>;
19
+ setFileResolver(resolver: (path: string) => string | null | undefined): void;
40
20
  start(): void;
41
21
  registerHandler(effectType: string, handler: EffectHandler): void;
22
+ setEffectListener(listener: ((effect: Effect) => void) | undefined): void;
42
23
  private dispatchRaw;
43
24
  sendIntent(intent: string): void;
44
25
  sendEvent(event: string): void;
45
- sendComplete(): void;
46
- sendFailed(): void;
47
26
  sendOfftopic(): void;
48
27
  tickPrompt(): void;
49
28
  getState(): string;
50
29
  getValidIntents(): Array<any>;
51
30
  getGraph(): string;
31
+ getMemory(): Array<{
32
+ domain: string;
33
+ key: string;
34
+ value: unknown;
35
+ }>;
52
36
  injectMemory(domain: string, key: string, value: string): void;
53
37
  dispose(): void;
54
38
  }
55
39
 
56
- export { type AgentBundle, type AgentFiles, AgentSession, type Effect, type EffectHandler, loadAgent };
40
+ export { AgentSession, type Effect, type EffectHandler, loadAgent };
package/dist/index.js CHANGED
@@ -1,25 +1,6 @@
1
1
  // src/load.ts
2
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
- }
3
+ import { parseAboutme, extractFiles, validateMagicBytes, validateZipBomb } from "@dot-agent/compiler/core";
23
4
  async function loadAgent(input) {
24
5
  const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
25
6
  validateMagicBytes(bytes);
@@ -68,6 +49,7 @@ import { AgentDSLKernel, init as initKernel } from "@dot-agent/kernel-dsl";
68
49
  var AgentSession = class _AgentSession {
69
50
  kernel;
70
51
  handlers = /* @__PURE__ */ new Map();
52
+ effectListener;
71
53
  bundle;
72
54
  constructor(kernel, bundle) {
73
55
  this.kernel = kernel;
@@ -78,13 +60,31 @@ var AgentSession = class _AgentSession {
78
60
  const kernel = new AgentDSLKernel();
79
61
  return new _AgentSession(kernel, bundle);
80
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
+ }
81
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.
82
70
  start() {
83
- this.dispatchRaw(this.kernel.load_behavior(this.bundle.files.behavior));
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
+ );
84
81
  }
85
82
  registerHandler(effectType, handler) {
86
83
  this.handlers.set(effectType, handler);
87
84
  }
85
+ setEffectListener(listener) {
86
+ this.effectListener = listener;
87
+ }
88
88
  dispatchRaw(raw) {
89
89
  if (!raw) return;
90
90
  let effects;
@@ -96,6 +96,7 @@ var AgentSession = class _AgentSession {
96
96
  }
97
97
  if (!Array.isArray(effects)) return;
98
98
  for (const effect of effects) {
99
+ this.effectListener?.(effect);
99
100
  const handler = this.handlers.get(effect.type);
100
101
  if (handler) {
101
102
  Promise.resolve(handler(effect)).catch((err) => {
@@ -110,12 +111,6 @@ var AgentSession = class _AgentSession {
110
111
  sendEvent(event) {
111
112
  this.dispatchRaw(this.kernel.send_event(event));
112
113
  }
113
- sendComplete() {
114
- this.dispatchRaw(this.kernel.send_complete());
115
- }
116
- sendFailed() {
117
- this.dispatchRaw(this.kernel.send_failed());
118
- }
119
114
  sendOfftopic() {
120
115
  this.dispatchRaw(this.kernel.send_offtopic());
121
116
  }
@@ -131,6 +126,9 @@ var AgentSession = class _AgentSession {
131
126
  getGraph() {
132
127
  return this.kernel.get_graph();
133
128
  }
129
+ getMemory() {
130
+ return JSON.parse(this.kernel.get_memory());
131
+ }
134
132
  injectMemory(domain, key, value) {
135
133
  this.kernel.set_memory(domain, key, value);
136
134
  }
package/dist/index.js.map CHANGED
@@ -1 +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,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,QAAI,CAAC,KAAK,IAAK,sBAAsB,KAAa,OAAO,oBAAoB;AAAA,EAC/E,CAAC;AACD,MAAI,oBAAoB,cAAc;AACpC,UAAM,IAAI,MAAM,sCAAsC,iBAAiB,EAAE;AAAA,EAC3E;AACA,MAAI,oBAAoB,iBAAiB,uBAAuB;AAC9D,UAAM,IAAI,MAAM,oCAAoC,oBAAoB,gBAAgB,QAAQ,CAAC,CAAC,GAAG;AAAA,EACvG;AACF;AAEA,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,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AA,EAAE;AAAA,EAClF,aAAkC;AAAE,SAAK,YAAY,KAAK,OAAO,YAAY,CAAC;AAAA,EAAE;AAAA,EAChF,eAAkC;AAAE,SAAK,YAAY,KAAK,OAAO,cAAc,CAAC;AAAA,EAAE;AAAA,EAClF,aAAkC;AAAE,SAAK,YAAY,KAAK,OAAO,YAAY,CAAC;AAAA,EAAE;AAAA,EAEhF,WAA8B;AAAE,WAAO,KAAK,OAAO,kBAAkB;AAAA,EAAE;AAAA,EACvE,kBAA8B;AAAE,WAAO,KAAK,OAAO,kBAAkB;AAAA,EAAE;AAAA,EACvE,WAA8B;AAAE,WAAO,KAAK,OAAO,UAAU;AAAA,EAAE;AAAA,EAE/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":[]}
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 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 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;AAQ9D,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,WAAW,IAAI,KAAK,SAAS;AACnC,QAAM,WAAW,MAAM,aAAa,GAAG;AAEvC,QAAM,SAAmD,CAAC;AAC1D,QAAM,YAAsD,CAAC;AAC7D,QAAM,YAAsD,CAAC;AAE7D,aAAW,CAAC,MAAM,OAAO,KAAK,UAAU;AACtC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E;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":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dot-agent/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.5.0-alpha.1",
4
4
  "description": "Browser-compatible SDK for loading and running dot-agent bundles",
5
5
  "license": "Apache-2.0",
6
6
  "author": {