@xeno-corporation/xeno-agent-sdk 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +263 -0
- package/dist/electron/index.d.ts +1166 -0
- package/dist/electron/index.js +933 -0
- package/dist/index.d.ts +4838 -0
- package/dist/index.js +1374 -0
- package/dist/mcp/index.d.ts +469 -0
- package/dist/mcp/index.js +21 -0
- package/dist/providers/index.cjs +3 -0
- package/dist/providers/index.d.cts +148 -0
- package/dist/providers/index.d.ts +148 -0
- package/dist/providers/index.js +3 -0
- package/dist/session/index.d.ts +386 -0
- package/dist/session/index.js +48 -0
- package/dist/ui/index.d.ts +2983 -0
- package/dist/ui/index.js +32 -0
- package/dist/utils/index.d.ts +161 -0
- package/dist/utils/index.js +18 -0
- package/package.json +92 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Copyright (c) 2026 XENO Corporation
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
This software and the accompanying documentation are proprietary and
|
|
5
|
+
confidential. No license or other right is granted to use, copy, modify,
|
|
6
|
+
merge, publish, distribute, sublicense, sell, reverse engineer, create
|
|
7
|
+
derivative works from, or otherwise exploit this software or any portion of it
|
|
8
|
+
without prior written permission from XENO Corporation.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
+
FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE. IN NO EVENT
|
|
13
|
+
SHALL XENO CORPORATION OR ITS LICENSORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR
|
|
14
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING
|
|
15
|
+
FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# XENO Agent SDK
|
|
2
|
+
|
|
3
|
+
Core runtime for XENO agent-enabled products. It provides the agent loop, tool execution, permissions, sessions, memory, audit logging, and provider integration used across the XENO platform.
|
|
4
|
+
|
|
5
|
+
## Vision
|
|
6
|
+
|
|
7
|
+
Every XENO creative app (Pixel, Motion, Sound) has an AI agent embedded directly into the interface. Users open a sidebar, type what they want ("remove the background from this layer", "cut the silence from this podcast", "match-cut these two clips"), and the agent translates that into tool calls against the app's engine. One request can span multiple apps: "Create a product video from these photos with background music" triggers coordinated work across Pixel, Motion, and Sound simultaneously.
|
|
8
|
+
|
|
9
|
+
This is what makes XENO fundamentally different from Adobe. No other creative suite has embedded agent orchestration.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Without agent SDK: User manually opens Pixel, edits, opens Motion, edits, opens Sound, edits
|
|
13
|
+
With agent SDK: User says "Create a product video" -> agents in all 3 apps coordinate automatically
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Current State
|
|
17
|
+
|
|
18
|
+
- **7,394 lines** of TypeScript, v0.1.0
|
|
19
|
+
- **10 subsystems**: core loop, tools, security, session, identity, memory, audit, config, utils, types
|
|
20
|
+
- **6 built-in tools**: Read, Write, Edit, Glob, Grep, Bash
|
|
21
|
+
- **Provider-agnostic** LLM integration (Xeno API, Ollama, any OpenAI-compatible endpoint)
|
|
22
|
+
- **4 permission modes**: `default`, `acceptEdits`, `bypassPermissions`, `plan`
|
|
23
|
+
- **4-level identity hierarchy**: global, project, role, session
|
|
24
|
+
- **4-level memory system** with auto-capture (conversation, session, project, global)
|
|
25
|
+
- **Session persistence** with checkpoints, transcript writing, and crash recovery
|
|
26
|
+
- **Audit logging** in JSON-lines format (who, what, when, result)
|
|
27
|
+
- **Delegation system**: planner/executor/reviewer sub-agent workflows
|
|
28
|
+
- ESM-only, TypeScript 5.7.3, tsup build
|
|
29
|
+
- Dependencies: chalk, glob, gray-matter
|
|
30
|
+
|
|
31
|
+
## Automation
|
|
32
|
+
|
|
33
|
+
The SDK repo now carries the same production automation discipline as the CLI:
|
|
34
|
+
|
|
35
|
+
- `.github/workflows/ci.yml` -- cross-platform build verification plus full Linux runtime checks
|
|
36
|
+
- `.github/workflows/certification.yml` -- scheduled production/stress verification and large-repo coding benchmarks
|
|
37
|
+
- `.github/workflows/release.yml` -- npm Trusted Publishing with provenance, checksums, and GitHub release artifacts
|
|
38
|
+
|
|
39
|
+
## Architecture
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
xeno-agent-sdk/
|
|
43
|
+
src/
|
|
44
|
+
core/ Agent loop engine (provider-agnostic LLM interface, delegation, reducer)
|
|
45
|
+
tools/ Tool registry with permission checks and built-in tools (6)
|
|
46
|
+
security/ Permission engine (4 modes), path safety, approval flows
|
|
47
|
+
session/ Session persistence, checkpoints, transcript, lock management
|
|
48
|
+
identity/ 4-level identity hierarchy (global/project/role/session)
|
|
49
|
+
memory/ Memory manager (conversation -> session -> project -> global)
|
|
50
|
+
audit/ JSON-lines audit logger (every tool call, every decision)
|
|
51
|
+
config/ Model configuration, API endpoints, defaults
|
|
52
|
+
utils/ Shared utilities
|
|
53
|
+
types.ts All shared TypeScript types (exported for consumers)
|
|
54
|
+
create-agent.ts Main entry point: createXenoAgent()
|
|
55
|
+
permission-engine.ts Audit-backed permission engine factory
|
|
56
|
+
prompt-context.ts System prompt and context assembly
|
|
57
|
+
session-runtime.ts Session lifecycle management
|
|
58
|
+
delegated-agent.ts Sub-agent creation for delegation workflows
|
|
59
|
+
delegated-turn.ts Single-turn delegated execution
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 10 Subsystems
|
|
63
|
+
|
|
64
|
+
| Subsystem | Purpose | Key exports |
|
|
65
|
+
|-----------|---------|-------------|
|
|
66
|
+
| **Core Loop** | Agentic turn loop with tool dispatch, streaming, reducer | `AgentLoop`, `AgentLoopConfig` |
|
|
67
|
+
| **Tools** | Registry pattern for tool registration + 6 built-in tools | `ToolRegistry`, `registry` |
|
|
68
|
+
| **Security** | Permission engine with 4 modes, path sandboxing | `PermissionEngine`, `PermissionConfig` |
|
|
69
|
+
| **Session** | Persistence, checkpoints, transcripts, locks, recovery | `SessionManager`, `CheckpointManager` |
|
|
70
|
+
| **Identity** | Persona loading and resolution across 4 levels | `IdentityLoader`, `IdentityResolver` |
|
|
71
|
+
| **Memory** | Hierarchical memory with budget management | `MemoryManager`, `MemoryBudget` |
|
|
72
|
+
| **Audit** | JSON-lines logging for every action | `AuditLogger` |
|
|
73
|
+
| **Config** | Model settings, API endpoints, defaults | `XENO_API_BASE`, `DEFAULT_MODEL` |
|
|
74
|
+
| **Delegation** | Planner/executor/reviewer sub-agent workflows | `DelegatedAgent`, `DelegatedTurn` |
|
|
75
|
+
| **Types** | All shared TypeScript types | `ExecutionMode`, `ResolvedIdentity`, etc. |
|
|
76
|
+
|
|
77
|
+
## How Apps Integrate
|
|
78
|
+
|
|
79
|
+
The primary entry point is `createXenoAgent()`. Each app registers its own operations as tools, and the SDK handles everything else: the agentic loop, permission checks, audit logging, memory, sessions.
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { createXenoAgent } from '@xeno-corporation/xeno-agent-sdk'
|
|
83
|
+
|
|
84
|
+
// Each app defines its domain-specific tools
|
|
85
|
+
const pixelTools = {
|
|
86
|
+
'layer.remove-bg': {
|
|
87
|
+
description: 'Remove background from the active layer',
|
|
88
|
+
execute: async (params) => {
|
|
89
|
+
const result = await xenoLib.rmbg(params.layerId) // xeno-lib AI model
|
|
90
|
+
await engine.applyMask(params.layerId, result.mask) // app engine
|
|
91
|
+
return { success: true, layerId: params.layerId }
|
|
92
|
+
},
|
|
93
|
+
confirm: true, // requires user approval
|
|
94
|
+
},
|
|
95
|
+
'brush.draw': {
|
|
96
|
+
description: 'Draw a stroke on the active layer',
|
|
97
|
+
execute: async (params) => engine.drawStroke(params),
|
|
98
|
+
confirm: false, // safe, no confirmation needed
|
|
99
|
+
},
|
|
100
|
+
'file.export': {
|
|
101
|
+
description: 'Export the current document',
|
|
102
|
+
execute: async (params) => exporter.save(params),
|
|
103
|
+
confirm: true,
|
|
104
|
+
destructive: false,
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const agent = await createXenoAgent({
|
|
109
|
+
toolRegistry: pixelTools,
|
|
110
|
+
model: 'claude-sonnet-4-20250514',
|
|
111
|
+
permissionConfig: { mode: 'default' },
|
|
112
|
+
// identity, memory, session all auto-configured
|
|
113
|
+
})
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### End-to-End Example
|
|
117
|
+
|
|
118
|
+
User types in Pixel's agent sidebar: **"Remove the background from this layer"**
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
1. Agent receives natural language input
|
|
122
|
+
2. LLM decides to call tool: layer.remove-bg({ layerId: 'layer-3' })
|
|
123
|
+
3. Permission engine checks: confirm=true -> prompts user for approval
|
|
124
|
+
4. User approves -> tool executes:
|
|
125
|
+
a. Calls xeno-lib's RMBG model (Rust, ONNX, GPU-accelerated)
|
|
126
|
+
b. Receives alpha mask
|
|
127
|
+
c. Applies mask to layer in Pixel's rendering engine
|
|
128
|
+
5. Audit logger records: who=user, what=layer.remove-bg, when=timestamp, result=success
|
|
129
|
+
6. Agent responds: "Done. Background removed from Layer 3."
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## The Tool Registry Pattern
|
|
133
|
+
|
|
134
|
+
Apps extend the SDK by registering their operations as tools. The SDK provides 6 built-in tools for file operations (Read, Write, Edit, Glob, Grep, Bash). Apps add domain-specific tools:
|
|
135
|
+
|
|
136
|
+
| App | Example tools |
|
|
137
|
+
|-----|---------------|
|
|
138
|
+
| **Pixel** | `brush.draw`, `layer.remove-bg`, `selection.expand`, `filter.blur`, `file.export` |
|
|
139
|
+
| **Motion** | `timeline.cut`, `clip.speed`, `transition.add`, `keyframe.set`, `render.export` |
|
|
140
|
+
| **Sound** | `track.eq`, `region.normalize`, `master.lufs`, `effect.reverb`, `bounce.export` |
|
|
141
|
+
| **Hub** | `workspace.create`, `app.launch`, `agent.dispatch` |
|
|
142
|
+
|
|
143
|
+
Each tool declares: `description` (for the LLM), `execute` (the implementation), `confirm` (whether to ask the user), and `destructive` (whether it's irreversible).
|
|
144
|
+
|
|
145
|
+
## Cross-App Orchestration
|
|
146
|
+
|
|
147
|
+
One agent request can trigger coordinated work across multiple apps. The Hub acts as an orchestrator, dispatching tasks to per-app agents via a mailbox system.
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
User: "Create a product video from these photos with background music"
|
|
151
|
+
|
|
152
|
+
xeno-hub (orchestrator)
|
|
153
|
+
|-- mailbox.send('pixel-agent', { task: 'export hero images as PNGs' })
|
|
154
|
+
|-- mailbox.send('motion-agent', { task: 'create timeline from exported images' })
|
|
155
|
+
|-- mailbox.send('sound-agent', { task: 'add background track, master to -14 LUFS' })
|
|
156
|
+
|
|
157
|
+
Each agent receives via:
|
|
158
|
+
mailbox.onMessage((msg) => agent.execute(msg.task))
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Messages are JSON-serializable for cross-process IPC. Timeout and retry are built in. This system is planned and not yet implemented in the current codebase.
|
|
162
|
+
|
|
163
|
+
## Security Model
|
|
164
|
+
|
|
165
|
+
### Permission Modes
|
|
166
|
+
|
|
167
|
+
| Mode | Behavior |
|
|
168
|
+
|------|----------|
|
|
169
|
+
| `default` | Ask user before writes and shell commands |
|
|
170
|
+
| `acceptEdits` | Auto-approve file edits, ask for shell commands |
|
|
171
|
+
| `bypassPermissions` | Auto-approve everything (development/testing only) |
|
|
172
|
+
| `plan` | Read-only mode, agent can only plan and suggest |
|
|
173
|
+
|
|
174
|
+
### Safety Features
|
|
175
|
+
|
|
176
|
+
- **Path sandboxing**: agents cannot access files outside configured boundaries
|
|
177
|
+
- **Destructive action gates**: delete, overwrite, and shell commands require explicit approval
|
|
178
|
+
- **Audit trail**: every tool call logged in JSON-lines format with trace IDs
|
|
179
|
+
- **Risk classification**: each tool call classified as low/medium/high risk
|
|
180
|
+
- **Permission rules**: per-tool, per-path override rules
|
|
181
|
+
|
|
182
|
+
## Session Persistence
|
|
183
|
+
|
|
184
|
+
- Sessions have unique IDs with embedded timestamps
|
|
185
|
+
- Full conversation transcripts written to disk
|
|
186
|
+
- Checkpoint system for long-running workflows
|
|
187
|
+
- Lock management prevents concurrent access to the same session
|
|
188
|
+
- Turn restore for crash recovery (resume mid-conversation)
|
|
189
|
+
- Session registry tracks all sessions per project
|
|
190
|
+
|
|
191
|
+
## Memory System
|
|
192
|
+
|
|
193
|
+
4-level hierarchy with automatic capture and budget management:
|
|
194
|
+
|
|
195
|
+
| Level | Scope | Persists | Example |
|
|
196
|
+
|-------|-------|----------|---------|
|
|
197
|
+
| **Conversation** | Current turn | No | "The user just asked about Layer 3" |
|
|
198
|
+
| **Session** | Current session | Until session ends | "We're working on the hero image" |
|
|
199
|
+
| **Project** | Current project | Yes | "This project uses 300 DPI, CMYK" |
|
|
200
|
+
| **Global** | All projects | Yes | "User prefers dark theme, metric units" |
|
|
201
|
+
|
|
202
|
+
Memory is injected into the system prompt with configurable token budgets to avoid context overflow.
|
|
203
|
+
|
|
204
|
+
## LLM Providers
|
|
205
|
+
|
|
206
|
+
| Provider | How | When |
|
|
207
|
+
|----------|-----|------|
|
|
208
|
+
| **Xeno API** (cloud) | `api.xenostudio.ai` proxy to hosted models | Online, highest capability |
|
|
209
|
+
| **xeno-rt** (local) | OpenAI-compatible API on localhost | Offline, privacy, no cost |
|
|
210
|
+
| **Ollama** (local) | OpenAI-compatible API | Alternative local provider |
|
|
211
|
+
|
|
212
|
+
The SDK is provider-agnostic. Any OpenAI-compatible endpoint works. Provider selection and fallback logic are handled by the config subsystem.
|
|
213
|
+
|
|
214
|
+
## Consumers
|
|
215
|
+
|
|
216
|
+
| App | How it uses the SDK | Example agent task |
|
|
217
|
+
|-----|--------------------|--------------------|
|
|
218
|
+
| **xeno-agent-cli** | Terminal agent (reference implementation) | "Refactor this codebase" |
|
|
219
|
+
| **xeno-pixel** | Image editing agent sidebar | "Remove backgrounds from 50 images" |
|
|
220
|
+
| **xeno-motion** | Video editing agent sidebar | "Cut this interview into a highlight reel" |
|
|
221
|
+
| **xeno-sound** | Audio editing agent sidebar | "Master this podcast to -16 LUFS" |
|
|
222
|
+
| **xeno-hub** | Orchestrator routing tasks between apps | "Create marketing materials" dispatches to Pixel + Motion + Sound |
|
|
223
|
+
|
|
224
|
+
## Planned: React Component Library
|
|
225
|
+
|
|
226
|
+
A separate `/react` or `/ui` export will provide pre-built React components for embedding the agent interface in Electron-based XENO apps:
|
|
227
|
+
|
|
228
|
+
- **ChatPanel** -- full agent sidebar with message history
|
|
229
|
+
- **MessageBubble** -- individual messages (user, agent, system)
|
|
230
|
+
- **ToolCallIndicator** -- real-time display of tool execution with status
|
|
231
|
+
- **ThinkingState** -- streaming thinking/reasoning indicator
|
|
232
|
+
- **PermissionPrompt** -- inline approval UI for destructive actions
|
|
233
|
+
- **SessionSwitcher** -- switch between conversation sessions
|
|
234
|
+
|
|
235
|
+
These components will NOT live in the core SDK (no DOM dependencies in core). They will be a separate package entry point that apps can import independently.
|
|
236
|
+
|
|
237
|
+
## Ecosystem Position
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
LAYER 5 -- APPS (Pixel, Motion, Sound, Hub)
|
|
241
|
+
| embed xeno-agent-sdk for AI automation
|
|
242
|
+
| agent sidebar in every app
|
|
243
|
+
LAYER 3 -- THIS REPO (xeno-agent-sdk)
|
|
244
|
+
| uses LLM providers + invokes AI models
|
|
245
|
+
LAYER 2 -- COMPUTE (xeno-rt for LLM, xeno-lib for 17 AI models)
|
|
246
|
+
| runs on
|
|
247
|
+
LAYER 1 -- PLATFORM (servers, auth, credits)
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
See [Full Ecosystem Report](../XENO%20CORPORATION%20-%20Full%20Ecosystem%20Report.md) for complete context.
|
|
251
|
+
|
|
252
|
+
## Development
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
npm install
|
|
256
|
+
npm run build # tsup -> ESM output
|
|
257
|
+
npm run typecheck # TypeScript 5.7.3 strict mode
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
Proprietary and confidential. Copyright (c) 2026 XENO Corporation.
|
|
263
|
+
All rights reserved.
|