@shardworks/animator-apparatus 0.1.101
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 +260 -0
- package/dist/animator.d.ts +20 -0
- package/dist/animator.d.ts.map +1 -0
- package/dist/animator.js +265 -0
- package/dist/animator.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +7 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/session-list.d.ts +22 -0
- package/dist/tools/session-list.d.ts.map +1 -0
- package/dist/tools/session-list.js +57 -0
- package/dist/tools/session-list.js.map +1 -0
- package/dist/tools/session-show.d.ts +14 -0
- package/dist/tools/session-show.d.ts.map +1 -0
- package/dist/tools/session-show.js +31 -0
- package/dist/tools/session-show.js.map +1 -0
- package/dist/tools/summon.d.ts +17 -0
- package/dist/tools/summon.d.ts.map +1 -0
- package/dist/tools/summon.js +48 -0
- package/dist/tools/summon.js.map +1 -0
- package/dist/types.d.ts +287 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sean Boots
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# `@shardworks/animator-apparatus`
|
|
2
|
+
|
|
3
|
+
The Animator brings animas to life. It is the guild's session apparatus — the single entry point for making an anima do work. Two API levels serve different callers:
|
|
4
|
+
|
|
5
|
+
- **`summon()`** — the high-level "make an anima do a thing" call. Passes the role to The Loom for identity composition, then launches a session with the work prompt. This is what the summon relay, the CLI, and most callers use.
|
|
6
|
+
- **`animate()`** — the low-level call for callers that compose their own `AnimaWeave` (e.g. The Parlour for multi-turn conversations).
|
|
7
|
+
|
|
8
|
+
Both methods return an `AnimateHandle` synchronously — a `{ chunks, result }` pair. The `result` promise resolves when the session completes. The `chunks` async iterable yields output as the session runs when `streaming: true` is set; otherwise it completes immediately with no items.
|
|
9
|
+
|
|
10
|
+
Depends on `@shardworks/stacks-apparatus` for persistence. Uses `@shardworks/loom-apparatus` for context composition (resolved at call time by `summon()`, not a startup dependency). The session provider (e.g. `@shardworks/claude-code-apparatus`) is discovered at runtime via guild config.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@shardworks/animator-apparatus": "workspace:*"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## API
|
|
25
|
+
|
|
26
|
+
The Animator exposes its API via `guild().apparatus<AnimatorApi>('animator')`:
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { guild } from '@shardworks/nexus-core';
|
|
30
|
+
import type { AnimatorApi } from '@shardworks/animator-apparatus';
|
|
31
|
+
|
|
32
|
+
const animator = guild().apparatus<AnimatorApi>('animator');
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### `summon(request): AnimateHandle`
|
|
36
|
+
|
|
37
|
+
Summon an anima — compose context via The Loom and launch a session. This is the primary entry point for dispatching work. Returns synchronously.
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
const { result } = animator.summon({
|
|
41
|
+
prompt: 'Build the frobnicator module with tests',
|
|
42
|
+
role: 'artificer', // passed to The Loom for composition
|
|
43
|
+
cwd: '/path/to/workdir',
|
|
44
|
+
metadata: { // optional, merged with auto-generated metadata
|
|
45
|
+
writId: 'wrt-8a4c9e2',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const session = await result;
|
|
50
|
+
console.log(session.status); // 'completed' | 'failed' | 'timeout'
|
|
51
|
+
console.log(session.costUsd); // 0.42
|
|
52
|
+
console.log(session.metadata?.trigger); // 'summon' (auto-populated)
|
|
53
|
+
console.log(session.metadata?.role); // 'artificer' (auto-populated from request)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
With streaming:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
const { chunks, result } = animator.summon({
|
|
60
|
+
prompt: 'Build the frobnicator module with tests',
|
|
61
|
+
role: 'artificer',
|
|
62
|
+
cwd: '/path/to/workdir',
|
|
63
|
+
streaming: true,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
for await (const chunk of chunks) {
|
|
67
|
+
if (chunk.type === 'text') process.stdout.write(chunk.text);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const session = await result;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The Loom owns system prompt composition — given the role, it produces the system prompt from the anima's identity layers (role instructions, curriculum, temperament, charter). The work prompt bypasses The Loom and goes directly to the session provider. At MVP, the Loom does not yet compose a system prompt (returns `undefined`); the session runs with the work prompt only. As the Loom gains composition logic, `summon()` callers get richer sessions without changing their code.
|
|
74
|
+
|
|
75
|
+
Requires The Loom apparatus to be installed. Throws with a clear error if not available.
|
|
76
|
+
|
|
77
|
+
### `animate(request): AnimateHandle`
|
|
78
|
+
|
|
79
|
+
Launch a session with a pre-composed context. Use this when you've already built an `AnimaWeave` yourself (e.g. The Parlour assembling inter-turn context for a multi-turn conversation). Returns synchronously.
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
const { result } = animator.animate({
|
|
83
|
+
context: animaWeave, // from The Loom or self-composed
|
|
84
|
+
prompt: 'Do the thing', // work prompt, sent directly to provider
|
|
85
|
+
cwd: '/path/to/workdir',
|
|
86
|
+
conversationId: 'conv-xyz', // optional, for multi-turn resume
|
|
87
|
+
metadata: { // optional, recorded as-is
|
|
88
|
+
trigger: 'consult',
|
|
89
|
+
animaName: 'coco',
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const session = await result;
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
With streaming:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
const { chunks, result } = animator.animate({
|
|
100
|
+
context: animaWeave,
|
|
101
|
+
prompt: 'Build the feature',
|
|
102
|
+
cwd: '/path/to/workdir',
|
|
103
|
+
streaming: true,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
for await (const chunk of chunks) {
|
|
107
|
+
if (chunk.type === 'text') process.stdout.write(chunk.text);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const session = await result;
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
If the session provider doesn't support streaming, `chunks` completes immediately with no items and `result` resolves normally via the non-streaming path — regardless of the `streaming` flag.
|
|
114
|
+
|
|
115
|
+
### Types
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
interface SummonRequest {
|
|
119
|
+
prompt: string; // The work prompt (sent to provider directly)
|
|
120
|
+
role?: string; // Role name (passed to The Loom for composition)
|
|
121
|
+
cwd: string; // Working directory for the session
|
|
122
|
+
conversationId?: string; // Optional, for multi-turn resume
|
|
123
|
+
metadata?: Record<string, unknown>; // Merged with { trigger: 'summon', role }
|
|
124
|
+
streaming?: boolean; // Enable streaming output (default false)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
interface AnimateRequest {
|
|
128
|
+
context: AnimaWeave; // Pre-composed identity context
|
|
129
|
+
prompt?: string; // Work prompt (sent to provider as initialPrompt)
|
|
130
|
+
cwd: string;
|
|
131
|
+
conversationId?: string;
|
|
132
|
+
metadata?: Record<string, unknown>;
|
|
133
|
+
streaming?: boolean; // Enable streaming output (default false)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
interface AnimateHandle {
|
|
137
|
+
chunks: AsyncIterable<SessionChunk>; // Empty when not streaming
|
|
138
|
+
result: Promise<SessionResult>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
interface SessionResult {
|
|
142
|
+
id: string; // Generated by The Animator (ses-{hex})
|
|
143
|
+
status: 'completed' | 'failed' | 'timeout';
|
|
144
|
+
startedAt: string; // ISO-8601
|
|
145
|
+
endedAt: string; // ISO-8601
|
|
146
|
+
durationMs: number;
|
|
147
|
+
provider: string; // e.g. 'claude-code'
|
|
148
|
+
exitCode: number;
|
|
149
|
+
error?: string;
|
|
150
|
+
conversationId?: string;
|
|
151
|
+
providerSessionId?: string;
|
|
152
|
+
tokenUsage?: TokenUsage;
|
|
153
|
+
costUsd?: number;
|
|
154
|
+
metadata?: Record<string, unknown>;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
type SessionChunk =
|
|
158
|
+
| { type: 'text'; text: string }
|
|
159
|
+
| { type: 'tool_use'; tool: string }
|
|
160
|
+
| { type: 'tool_result'; tool: string };
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Configuration
|
|
164
|
+
|
|
165
|
+
The Animator reads its config from `guild.json["animator"]`:
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"animator": {
|
|
170
|
+
"sessionProvider": "claude-code"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
| Field | Type | Default | Description |
|
|
176
|
+
|---|---|---|---|
|
|
177
|
+
| `sessionProvider` | `string` | `'claude-code'` | Plugin id of the apparatus that implements `AnimatorSessionProvider`. Looked up via `guild().apparatus()`. |
|
|
178
|
+
|
|
179
|
+
## Session Provider Interface
|
|
180
|
+
|
|
181
|
+
Session providers are apparatus plugins whose `provides` object implements `AnimatorSessionProvider`:
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
interface AnimatorSessionProvider {
|
|
185
|
+
name: string;
|
|
186
|
+
launch(config: SessionProviderConfig): Promise<SessionProviderResult>;
|
|
187
|
+
launchStreaming?(config: SessionProviderConfig): {
|
|
188
|
+
chunks: AsyncIterable<SessionChunk>;
|
|
189
|
+
result: Promise<SessionProviderResult>;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface SessionProviderConfig {
|
|
194
|
+
systemPrompt?: string; // From AnimaWeave (Loom output)
|
|
195
|
+
initialPrompt?: string; // From AnimateRequest.prompt (work prompt)
|
|
196
|
+
model: string;
|
|
197
|
+
conversationId?: string;
|
|
198
|
+
cwd: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
interface SessionProviderResult {
|
|
202
|
+
status: 'completed' | 'failed' | 'timeout';
|
|
203
|
+
exitCode: number;
|
|
204
|
+
error?: string;
|
|
205
|
+
providerSessionId?: string;
|
|
206
|
+
tokenUsage?: TokenUsage;
|
|
207
|
+
costUsd?: number;
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The Animator imports these types; provider packages import them from `@shardworks/animator-apparatus` and implement them.
|
|
212
|
+
|
|
213
|
+
## Support Kit
|
|
214
|
+
|
|
215
|
+
The Animator contributes a `sessions` book and inspection/dispatch tools:
|
|
216
|
+
|
|
217
|
+
### Books
|
|
218
|
+
|
|
219
|
+
| Book | Indexes | Description |
|
|
220
|
+
|---|---|---|
|
|
221
|
+
| `sessions` | `startedAt`, `status`, `conversationId`, `provider` | Session records — one per `animate()` call |
|
|
222
|
+
|
|
223
|
+
### Tools
|
|
224
|
+
|
|
225
|
+
| Tool | Permission | Description |
|
|
226
|
+
|---|---|---|
|
|
227
|
+
| `session-list` | `read` | List recent sessions with optional filters (status, provider, conversationId, limit) |
|
|
228
|
+
| `session-show` | `read` | Show full detail for a single session by id |
|
|
229
|
+
| `summon` | `animate` | Summon an anima from the CLI — compose context and launch a session |
|
|
230
|
+
|
|
231
|
+
The `summon` tool is CLI-only (`callableBy: 'cli'`). It calls `animator.summon()` with the guild home as the working directory.
|
|
232
|
+
|
|
233
|
+
## Exports
|
|
234
|
+
|
|
235
|
+
The main export provides the apparatus factory, API types, and provider interface types:
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
import {
|
|
239
|
+
createAnimator,
|
|
240
|
+
type AnimatorApi,
|
|
241
|
+
type AnimateHandle,
|
|
242
|
+
type AnimateRequest,
|
|
243
|
+
type SummonRequest,
|
|
244
|
+
type SessionResult,
|
|
245
|
+
type SessionChunk,
|
|
246
|
+
type TokenUsage,
|
|
247
|
+
type AnimatorSessionProvider,
|
|
248
|
+
type SessionProviderConfig,
|
|
249
|
+
type SessionProviderResult,
|
|
250
|
+
type SessionDoc,
|
|
251
|
+
type AnimatorConfig,
|
|
252
|
+
} from '@shardworks/animator-apparatus';
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
The default export is a pre-created apparatus plugin instance:
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
import animator from '@shardworks/animator-apparatus';
|
|
259
|
+
// animator is { apparatus: { requires: ['stacks'], recommends: ['loom'], provides: AnimatorApi, ... } }
|
|
260
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Animator — session launch and telemetry recording apparatus.
|
|
3
|
+
*
|
|
4
|
+
* Two API levels:
|
|
5
|
+
* - summon() — high-level: composes context via The Loom, then launches.
|
|
6
|
+
* - animate() — low-level: takes a pre-composed AnimaWeave + prompt.
|
|
7
|
+
*
|
|
8
|
+
* See: docs/specification.md (animator)
|
|
9
|
+
*/
|
|
10
|
+
import type { Plugin } from '@shardworks/nexus-core';
|
|
11
|
+
/**
|
|
12
|
+
* Create the Animator apparatus plugin.
|
|
13
|
+
*
|
|
14
|
+
* Returns a Plugin with:
|
|
15
|
+
* - `requires: ['stacks']` — records session results
|
|
16
|
+
* - `provides: AnimatorApi` — the session launch API
|
|
17
|
+
* - `supportKit` — contributes `sessions` book + inspection tools
|
|
18
|
+
*/
|
|
19
|
+
export declare function createAnimator(): Plugin;
|
|
20
|
+
//# sourceMappingURL=animator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animator.d.ts","sourceRoot":"","sources":["../src/animator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,wBAAwB,CAAC;AAiMrE;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAkIvC"}
|
package/dist/animator.js
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Animator — session launch and telemetry recording apparatus.
|
|
3
|
+
*
|
|
4
|
+
* Two API levels:
|
|
5
|
+
* - summon() — high-level: composes context via The Loom, then launches.
|
|
6
|
+
* - animate() — low-level: takes a pre-composed AnimaWeave + prompt.
|
|
7
|
+
*
|
|
8
|
+
* See: docs/specification.md (animator)
|
|
9
|
+
*/
|
|
10
|
+
import { guild, generateId } from '@shardworks/nexus-core';
|
|
11
|
+
import { sessionList, sessionShow, summon as summonTool } from "./tools/index.js";
|
|
12
|
+
// ── Core logic ───────────────────────────────────────────────────────
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the session provider apparatus.
|
|
15
|
+
*
|
|
16
|
+
* Looks up the provider by plugin id from guild config. The provider is
|
|
17
|
+
* an apparatus whose `provides` implements AnimatorSessionProvider.
|
|
18
|
+
* Arbor throws immediately if the plugin isn't loaded or has no provides.
|
|
19
|
+
*/
|
|
20
|
+
function resolveProvider(config) {
|
|
21
|
+
const pluginId = config.sessionProvider ?? 'claude-code';
|
|
22
|
+
return guild().apparatus(pluginId);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolve the model from guild settings.
|
|
26
|
+
*/
|
|
27
|
+
function resolveModel() {
|
|
28
|
+
const g = guild();
|
|
29
|
+
const guildConfig = g.guildConfig();
|
|
30
|
+
return guildConfig.settings?.model ?? 'sonnet';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Build the provider config from an AnimateRequest.
|
|
34
|
+
*
|
|
35
|
+
* The system prompt comes from the AnimaWeave (composed by The Loom).
|
|
36
|
+
* The work prompt comes from the request directly (bypasses The Loom).
|
|
37
|
+
* The streaming flag is passed through for the provider to honor (or ignore).
|
|
38
|
+
*/
|
|
39
|
+
function buildProviderConfig(request, model) {
|
|
40
|
+
return {
|
|
41
|
+
systemPrompt: request.context.systemPrompt,
|
|
42
|
+
initialPrompt: request.prompt,
|
|
43
|
+
model,
|
|
44
|
+
conversationId: request.conversationId,
|
|
45
|
+
cwd: request.cwd,
|
|
46
|
+
streaming: request.streaming,
|
|
47
|
+
tools: request.context.tools,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build a SessionResult from provider output and session metadata.
|
|
52
|
+
*/
|
|
53
|
+
function buildSessionResult(id, startedAt, providerName, providerResult, request) {
|
|
54
|
+
const endedAt = new Date().toISOString();
|
|
55
|
+
const durationMs = new Date(endedAt).getTime() - new Date(startedAt).getTime();
|
|
56
|
+
return {
|
|
57
|
+
id,
|
|
58
|
+
status: providerResult.status,
|
|
59
|
+
startedAt,
|
|
60
|
+
endedAt,
|
|
61
|
+
durationMs,
|
|
62
|
+
provider: providerName,
|
|
63
|
+
exitCode: providerResult.exitCode,
|
|
64
|
+
error: providerResult.error,
|
|
65
|
+
conversationId: request.conversationId,
|
|
66
|
+
providerSessionId: providerResult.providerSessionId,
|
|
67
|
+
tokenUsage: providerResult.tokenUsage,
|
|
68
|
+
costUsd: providerResult.costUsd,
|
|
69
|
+
metadata: request.metadata,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Build a failed SessionResult when the provider throws.
|
|
74
|
+
*/
|
|
75
|
+
function buildFailedResult(id, startedAt, providerName, error, request) {
|
|
76
|
+
const endedAt = new Date().toISOString();
|
|
77
|
+
const durationMs = new Date(endedAt).getTime() - new Date(startedAt).getTime();
|
|
78
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
79
|
+
return {
|
|
80
|
+
id,
|
|
81
|
+
status: 'failed',
|
|
82
|
+
startedAt,
|
|
83
|
+
endedAt,
|
|
84
|
+
durationMs,
|
|
85
|
+
provider: providerName,
|
|
86
|
+
exitCode: 1,
|
|
87
|
+
error: errorMessage,
|
|
88
|
+
conversationId: request.conversationId,
|
|
89
|
+
metadata: request.metadata,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Convert a SessionResult to a SessionDoc for Stacks storage.
|
|
94
|
+
*/
|
|
95
|
+
function toSessionDoc(result) {
|
|
96
|
+
return {
|
|
97
|
+
id: result.id,
|
|
98
|
+
status: result.status,
|
|
99
|
+
startedAt: result.startedAt,
|
|
100
|
+
endedAt: result.endedAt,
|
|
101
|
+
durationMs: result.durationMs,
|
|
102
|
+
provider: result.provider,
|
|
103
|
+
exitCode: result.exitCode,
|
|
104
|
+
error: result.error,
|
|
105
|
+
conversationId: result.conversationId,
|
|
106
|
+
providerSessionId: result.providerSessionId,
|
|
107
|
+
tokenUsage: result.tokenUsage,
|
|
108
|
+
costUsd: result.costUsd,
|
|
109
|
+
metadata: result.metadata,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Record a session result to The Stacks.
|
|
114
|
+
*
|
|
115
|
+
* Errors are logged but never propagated — session data loss is
|
|
116
|
+
* preferable to masking the original failure. See § Error Handling Contract.
|
|
117
|
+
*/
|
|
118
|
+
async function recordSession(sessions, result) {
|
|
119
|
+
try {
|
|
120
|
+
await sessions.put(toSessionDoc(result));
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
console.warn(`[animator] Failed to record session ${result.id}: ${err instanceof Error ? err.message : err}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Write the initial 'running' session record to The Stacks.
|
|
128
|
+
*/
|
|
129
|
+
async function recordRunning(sessions, id, startedAt, providerName, request) {
|
|
130
|
+
try {
|
|
131
|
+
await sessions.put({
|
|
132
|
+
id,
|
|
133
|
+
status: 'running',
|
|
134
|
+
startedAt,
|
|
135
|
+
provider: providerName,
|
|
136
|
+
conversationId: request.conversationId,
|
|
137
|
+
metadata: request.metadata,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
console.warn(`[animator] Failed to write initial session record ${id}: ${err instanceof Error ? err.message : err}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// ── Apparatus factory ────────────────────────────────────────────────
|
|
145
|
+
/**
|
|
146
|
+
* Create the Animator apparatus plugin.
|
|
147
|
+
*
|
|
148
|
+
* Returns a Plugin with:
|
|
149
|
+
* - `requires: ['stacks']` — records session results
|
|
150
|
+
* - `provides: AnimatorApi` — the session launch API
|
|
151
|
+
* - `supportKit` — contributes `sessions` book + inspection tools
|
|
152
|
+
*/
|
|
153
|
+
export function createAnimator() {
|
|
154
|
+
let config = {};
|
|
155
|
+
let sessions;
|
|
156
|
+
const api = {
|
|
157
|
+
summon(request) {
|
|
158
|
+
// Resolve The Loom at call time — not a startup dependency.
|
|
159
|
+
// This allows the Animator to start without the Loom installed;
|
|
160
|
+
// only summon() requires it.
|
|
161
|
+
let loom;
|
|
162
|
+
try {
|
|
163
|
+
loom = guild().apparatus('loom');
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
throw new Error('summon() requires The Loom apparatus to be installed. ' +
|
|
167
|
+
'Use animate() directly if you want to provide a pre-composed AnimaWeave.');
|
|
168
|
+
}
|
|
169
|
+
// We need to weave context before we can animate, but summon()
|
|
170
|
+
// must return synchronously. Wrap the async Loom call and the
|
|
171
|
+
// animate delegation into a single deferred flow.
|
|
172
|
+
const deferred = (async () => {
|
|
173
|
+
// Compose identity context via The Loom.
|
|
174
|
+
// The Loom owns system prompt composition — it produces the system
|
|
175
|
+
// prompt from the anima's identity layers (role instructions,
|
|
176
|
+
// curriculum, temperament, charter). MVP: returns empty (no
|
|
177
|
+
// systemPrompt); the session runs without one until the Loom
|
|
178
|
+
// gains composition logic. The work prompt bypasses the Loom.
|
|
179
|
+
const context = await loom.weave({
|
|
180
|
+
role: request.role,
|
|
181
|
+
});
|
|
182
|
+
// Merge caller metadata with auto-generated summon metadata
|
|
183
|
+
const metadata = {
|
|
184
|
+
trigger: 'summon',
|
|
185
|
+
...(request.role ? { role: request.role } : {}),
|
|
186
|
+
...request.metadata,
|
|
187
|
+
};
|
|
188
|
+
// Delegate to the standard animate path.
|
|
189
|
+
// The work prompt goes directly on the request — it is not
|
|
190
|
+
// a composition concern.
|
|
191
|
+
return this.animate({
|
|
192
|
+
context,
|
|
193
|
+
prompt: request.prompt,
|
|
194
|
+
cwd: request.cwd,
|
|
195
|
+
conversationId: request.conversationId,
|
|
196
|
+
metadata,
|
|
197
|
+
streaming: request.streaming,
|
|
198
|
+
});
|
|
199
|
+
})();
|
|
200
|
+
// Pipe chunks through — can't get them until the Loom weave resolves.
|
|
201
|
+
// Works for both streaming and non-streaming: non-streaming providers
|
|
202
|
+
// return empty chunks, so the generator yields nothing and completes.
|
|
203
|
+
async function* pipeChunks() {
|
|
204
|
+
const handle = await deferred;
|
|
205
|
+
yield* handle.chunks;
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
chunks: pipeChunks(),
|
|
209
|
+
result: deferred.then((handle) => handle.result),
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
animate(request) {
|
|
213
|
+
const provider = resolveProvider(config);
|
|
214
|
+
const model = resolveModel();
|
|
215
|
+
const providerConfig = buildProviderConfig(request, model);
|
|
216
|
+
// Step 1: generate session id, capture startedAt
|
|
217
|
+
const id = generateId('ses', 4);
|
|
218
|
+
const startedAt = new Date().toISOString();
|
|
219
|
+
// Single path — the provider returns { chunks, result } regardless
|
|
220
|
+
// of whether streaming is enabled. Providers that don't support
|
|
221
|
+
// streaming return empty chunks; the Animator doesn't branch.
|
|
222
|
+
const { chunks, result: providerResultPromise } = provider.launch(providerConfig);
|
|
223
|
+
// Write initial record (fire and forget — don't block streaming)
|
|
224
|
+
const initPromise = recordRunning(sessions, id, startedAt, provider.name, request);
|
|
225
|
+
const result = (async () => {
|
|
226
|
+
await initPromise;
|
|
227
|
+
let sessionResult;
|
|
228
|
+
try {
|
|
229
|
+
const providerResult = await providerResultPromise;
|
|
230
|
+
sessionResult = buildSessionResult(id, startedAt, provider.name, providerResult, request);
|
|
231
|
+
}
|
|
232
|
+
catch (err) {
|
|
233
|
+
sessionResult = buildFailedResult(id, startedAt, provider.name, err, request);
|
|
234
|
+
await recordSession(sessions, sessionResult);
|
|
235
|
+
throw err;
|
|
236
|
+
}
|
|
237
|
+
await recordSession(sessions, sessionResult);
|
|
238
|
+
return sessionResult;
|
|
239
|
+
})();
|
|
240
|
+
return { chunks, result };
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
return {
|
|
244
|
+
apparatus: {
|
|
245
|
+
requires: ['stacks'],
|
|
246
|
+
recommends: ['loom'],
|
|
247
|
+
supportKit: {
|
|
248
|
+
books: {
|
|
249
|
+
sessions: {
|
|
250
|
+
indexes: ['startedAt', 'status', 'conversationId', 'provider'],
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
tools: [sessionList, sessionShow, summonTool],
|
|
254
|
+
},
|
|
255
|
+
provides: api,
|
|
256
|
+
start(_ctx) {
|
|
257
|
+
const g = guild();
|
|
258
|
+
config = g.guildConfig().animator ?? {};
|
|
259
|
+
const stacks = g.apparatus('stacks');
|
|
260
|
+
sessions = stacks.book('animator', 'sessions');
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=animator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animator.js","sourceRoot":"","sources":["../src/animator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAmB3D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAElF,wEAAwE;AAExE;;;;;;GAMG;AACH,SAAS,eAAe,CAAC,MAAsB;IAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,eAAe,IAAI,aAAa,CAAC;IACzD,OAAO,KAAK,EAAE,CAAC,SAAS,CAA0B,QAAQ,CAAC,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,SAAS,YAAY;IACnB,MAAM,CAAC,GAAG,KAAK,EAAE,CAAC;IAClB,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IACpC,OAAO,WAAW,CAAC,QAAQ,EAAE,KAAK,IAAI,QAAQ,CAAC;AACjD,CAAC;AAED;;;;;;GAMG;AACH,SAAS,mBAAmB,CAC1B,OAAuB,EACvB,KAAa;IAEb,OAAO;QACL,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY;QAC1C,aAAa,EAAE,OAAO,CAAC,MAAM;QA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K,EAAE;oBACL,QAAQ,EAAE;wBACR,OAAO,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,UAAU,CAAC;qBAC/D;iBACF;gBACD,KAAK,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,UAAU,CAAC;aAC9C;YAED,QAAQ,EAAE,GAAG;YAEb,KAAK,CAAC,IAAoB;gBACxB,MAAM,CAAC,GAAG,KAAK,EAAE,CAAC;gBAClB,MAAM,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC;gBAExC,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,CAAY,QAAQ,CAAC,CAAC;gBAChD,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAa,UAAU,EAAE,UAAU,CAAC,CAAC;YAC7D,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @shardworks/animator-apparatus — The Animator.
|
|
3
|
+
*
|
|
4
|
+
* Session launch and telemetry recording: takes an AnimaWeave from The Loom,
|
|
5
|
+
* launches an AI process via a session provider, monitors it until exit, and
|
|
6
|
+
* records the result to The Stacks.
|
|
7
|
+
*
|
|
8
|
+
* See: docs/specification.md (animator)
|
|
9
|
+
*/
|
|
10
|
+
export { type AnimatorApi, type AnimateHandle, type AnimateRequest, type SummonRequest, type SessionResult, type SessionChunk, type TokenUsage, type SessionDoc, type AnimatorConfig, type AnimatorSessionProvider, type SessionProviderConfig, type SessionProviderResult, } from './types.ts';
|
|
11
|
+
export { createAnimator } from './animator.ts';
|
|
12
|
+
declare const _default: import("@shardworks/nexus-core").Plugin;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,cAAc,EAEnB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;;AAI/C,wBAAgC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @shardworks/animator-apparatus — The Animator.
|
|
3
|
+
*
|
|
4
|
+
* Session launch and telemetry recording: takes an AnimaWeave from The Loom,
|
|
5
|
+
* launches an AI process via a session provider, monitors it until exit, and
|
|
6
|
+
* records the result to The Stacks.
|
|
7
|
+
*
|
|
8
|
+
* See: docs/specification.md (animator)
|
|
9
|
+
*/
|
|
10
|
+
import { createAnimator } from "./animator.js";
|
|
11
|
+
// ── Animator API ─────────────────────────────────────────────────────
|
|
12
|
+
export {} from "./types.js";
|
|
13
|
+
export { createAnimator } from "./animator.js";
|
|
14
|
+
// ── Default export: the apparatus plugin ──────────────────────────────
|
|
15
|
+
export default createAnimator();
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,wEAAwE;AAExE,OAAO,EAcN,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,yEAAyE;AAEzE,eAAe,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session-list tool — list recent sessions with optional filters.
|
|
3
|
+
*
|
|
4
|
+
* Queries The Animator's `sessions` book in The Stacks.
|
|
5
|
+
* Returns session summaries ordered by startedAt descending (newest first).
|
|
6
|
+
*
|
|
7
|
+
* See: docs/specification.md (animator § session-list tool)
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
declare const _default: import("@shardworks/tools-apparatus").ToolDefinition<{
|
|
11
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
12
|
+
completed: "completed";
|
|
13
|
+
failed: "failed";
|
|
14
|
+
timeout: "timeout";
|
|
15
|
+
running: "running";
|
|
16
|
+
}>>;
|
|
17
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
18
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
20
|
+
}>;
|
|
21
|
+
export default _default;
|
|
22
|
+
//# sourceMappingURL=session-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-list.d.ts","sourceRoot":"","sources":["../../src/tools/session-list.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;;;;;;;;AAIxB,wBA6CG"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session-list tool — list recent sessions with optional filters.
|
|
3
|
+
*
|
|
4
|
+
* Queries The Animator's `sessions` book in The Stacks.
|
|
5
|
+
* Returns session summaries ordered by startedAt descending (newest first).
|
|
6
|
+
*
|
|
7
|
+
* See: docs/specification.md (animator § session-list tool)
|
|
8
|
+
*/
|
|
9
|
+
import { tool } from '@shardworks/tools-apparatus';
|
|
10
|
+
import { guild } from '@shardworks/nexus-core';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
export default tool({
|
|
13
|
+
name: 'session-list',
|
|
14
|
+
description: 'List recent sessions with optional filters',
|
|
15
|
+
instructions: 'Returns session summaries ordered by start time (newest first). ' +
|
|
16
|
+
'Use for investigating recent activity, debugging, or reporting. ' +
|
|
17
|
+
'Filters by indexed fields only — use Stacks queries directly for metadata fields.',
|
|
18
|
+
params: {
|
|
19
|
+
status: z.enum(['running', 'completed', 'failed', 'timeout']).optional()
|
|
20
|
+
.describe('Filter by session status'),
|
|
21
|
+
provider: z.string().optional()
|
|
22
|
+
.describe('Filter by provider name (e.g. "claude-code")'),
|
|
23
|
+
conversationId: z.string().optional()
|
|
24
|
+
.describe('Filter by conversation id'),
|
|
25
|
+
limit: z.number().optional().default(20)
|
|
26
|
+
.describe('Maximum results (default: 20)'),
|
|
27
|
+
},
|
|
28
|
+
permission: 'read',
|
|
29
|
+
handler: async (params) => {
|
|
30
|
+
const stacks = guild().apparatus('stacks');
|
|
31
|
+
const sessions = stacks.readBook('animator', 'sessions');
|
|
32
|
+
const where = [];
|
|
33
|
+
if (params.status)
|
|
34
|
+
where.push(['status', '=', params.status]);
|
|
35
|
+
if (params.provider)
|
|
36
|
+
where.push(['provider', '=', params.provider]);
|
|
37
|
+
if (params.conversationId)
|
|
38
|
+
where.push(['conversationId', '=', params.conversationId]);
|
|
39
|
+
const results = await sessions.find({
|
|
40
|
+
where: where.length > 0 ? where : undefined,
|
|
41
|
+
orderBy: ['startedAt', 'desc'],
|
|
42
|
+
limit: params.limit,
|
|
43
|
+
});
|
|
44
|
+
// Return summary projection
|
|
45
|
+
return results.map((s) => ({
|
|
46
|
+
id: s.id,
|
|
47
|
+
status: s.status,
|
|
48
|
+
provider: s.provider,
|
|
49
|
+
startedAt: s.startedAt,
|
|
50
|
+
endedAt: s.endedAt,
|
|
51
|
+
durationMs: s.durationMs,
|
|
52
|
+
exitCode: s.exitCode,
|
|
53
|
+
costUsd: s.costUsd,
|
|
54
|
+
}));
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=session-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-list.js","sourceRoot":"","sources":["../../src/tools/session-list.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAe,IAAI,CAAC;IAClB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,4CAA4C;IACzD,YAAY,EACV,kEAAkE;QAClE,kEAAkE;QAClE,mFAAmF;IACrF,MAAM,EAAE;QACN,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE;aACrE,QAAQ,CAAC,0BAA0B,CAAC;QACvC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;aAC5B,QAAQ,CAAC,8CAA8C,CAAC;QAC3D,cAAc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C,CAAC,EAAE;YACR,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,UAAU,EAAE,CAAC,CAAC,UAAU;YACxB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,OAAO,EAAE,CAAC,CAAC,OAAO;SACnB,CAAC,CAAC,CAAC;IACN,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session-show tool — show full detail for a single session by id.
|
|
3
|
+
*
|
|
4
|
+
* Reads the complete session record from The Animator's `sessions` book
|
|
5
|
+
* in The Stacks, including tokenUsage, metadata, and all indexed fields.
|
|
6
|
+
*
|
|
7
|
+
* See: docs/specification.md (animator § session-show tool)
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
declare const _default: import("@shardworks/tools-apparatus").ToolDefinition<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
}>;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=session-show.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-show.d.ts","sourceRoot":"","sources":["../../src/tools/session-show.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;AAIxB,wBAoBG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session-show tool — show full detail for a single session by id.
|
|
3
|
+
*
|
|
4
|
+
* Reads the complete session record from The Animator's `sessions` book
|
|
5
|
+
* in The Stacks, including tokenUsage, metadata, and all indexed fields.
|
|
6
|
+
*
|
|
7
|
+
* See: docs/specification.md (animator § session-show tool)
|
|
8
|
+
*/
|
|
9
|
+
import { tool } from '@shardworks/tools-apparatus';
|
|
10
|
+
import { guild } from '@shardworks/nexus-core';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
export default tool({
|
|
13
|
+
name: 'session-show',
|
|
14
|
+
description: 'Show full detail for a single session by id',
|
|
15
|
+
instructions: 'Returns the complete session record from The Stacks, including ' +
|
|
16
|
+
'tokenUsage, metadata, and all indexed fields.',
|
|
17
|
+
params: {
|
|
18
|
+
id: z.string().describe('Session id'),
|
|
19
|
+
},
|
|
20
|
+
permission: 'read',
|
|
21
|
+
handler: async (params) => {
|
|
22
|
+
const stacks = guild().apparatus('stacks');
|
|
23
|
+
const sessions = stacks.readBook('animator', 'sessions');
|
|
24
|
+
const session = await sessions.get(params.id);
|
|
25
|
+
if (!session) {
|
|
26
|
+
throw new Error(`Session "${params.id}" not found.`);
|
|
27
|
+
}
|
|
28
|
+
return session;
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=session-show.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-show.js","sourceRoot":"","sources":["../../src/tools/session-show.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAe,IAAI,CAAC;IAClB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,6CAA6C;IAC1D,YAAY,EACV,iEAAiE;QACjE,+CAA+C;IACjD,MAAM,EAAE;QACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC;KACtC;IACD,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC,SAAS,CAAY,QAAQ,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAa,UAAU,EAAE,UAAU,CAAC,CAAC;QAErE,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,YAAY,MAAM,CAAC,EAAE,cAAc,CAAC,CAAC;QACvD,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* summon tool — dispatch an anima session from the CLI.
|
|
3
|
+
*
|
|
4
|
+
* High-level entry point: composes context via The Loom (passing the
|
|
5
|
+
* role for system prompt composition), then launches a session via
|
|
6
|
+
* The Animator. The work prompt goes directly to the provider.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* nsg summon --prompt "Build the frobnicator" --role artificer
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
declare const _default: import("@shardworks/tools-apparatus").ToolDefinition<{
|
|
13
|
+
prompt: z.ZodString;
|
|
14
|
+
role: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}>;
|
|
16
|
+
export default _default;
|
|
17
|
+
//# sourceMappingURL=summon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summon.d.ts","sourceRoot":"","sources":["../../src/tools/summon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;AAGxB,wBAqCG"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* summon tool — dispatch an anima session from the CLI.
|
|
3
|
+
*
|
|
4
|
+
* High-level entry point: composes context via The Loom (passing the
|
|
5
|
+
* role for system prompt composition), then launches a session via
|
|
6
|
+
* The Animator. The work prompt goes directly to the provider.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* nsg summon --prompt "Build the frobnicator" --role artificer
|
|
10
|
+
*/
|
|
11
|
+
import { tool } from '@shardworks/tools-apparatus';
|
|
12
|
+
import { guild } from '@shardworks/nexus-core';
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
export default tool({
|
|
15
|
+
name: 'summon',
|
|
16
|
+
description: 'Summon an anima — compose context and launch a session',
|
|
17
|
+
instructions: 'Dispatches an anima session. Provide a work prompt (what the anima should do) ' +
|
|
18
|
+
'and optionally a role name (for system prompt composition). The Loom composes ' +
|
|
19
|
+
'the identity context from the role; the prompt goes directly to the AI process. ' +
|
|
20
|
+
'Returns the session result with id, status, cost, and token usage.',
|
|
21
|
+
params: {
|
|
22
|
+
prompt: z.string().describe('The work prompt — what the anima should do'),
|
|
23
|
+
role: z.string().optional().describe('Role to summon (e.g. "artificer", "scribe")'),
|
|
24
|
+
},
|
|
25
|
+
callableBy: 'cli',
|
|
26
|
+
permission: 'animate',
|
|
27
|
+
handler: async (params) => {
|
|
28
|
+
const animator = guild().apparatus('animator');
|
|
29
|
+
const cwd = guild().home;
|
|
30
|
+
const { result } = animator.summon({
|
|
31
|
+
prompt: params.prompt,
|
|
32
|
+
role: params.role,
|
|
33
|
+
cwd,
|
|
34
|
+
});
|
|
35
|
+
const session = await result;
|
|
36
|
+
return {
|
|
37
|
+
id: session.id,
|
|
38
|
+
status: session.status,
|
|
39
|
+
provider: session.provider,
|
|
40
|
+
durationMs: session.durationMs,
|
|
41
|
+
exitCode: session.exitCode,
|
|
42
|
+
costUsd: session.costUsd,
|
|
43
|
+
tokenUsage: session.tokenUsage,
|
|
44
|
+
error: session.error,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=summon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summon.js","sourceRoot":"","sources":["../../src/tools/summon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH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AC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Animator — public types.
|
|
3
|
+
*
|
|
4
|
+
* These types form the contract between The Animator apparatus and all
|
|
5
|
+
* callers (summon relay, nsg consult, etc.). No implementation details.
|
|
6
|
+
*
|
|
7
|
+
* See: docs/specification.md (animator)
|
|
8
|
+
*/
|
|
9
|
+
import type { AnimaWeave } from '@shardworks/loom-apparatus';
|
|
10
|
+
import type { ResolvedTool } from '@shardworks/tools-apparatus';
|
|
11
|
+
/** A chunk of output from a running session. */
|
|
12
|
+
export type SessionChunk = {
|
|
13
|
+
type: 'text';
|
|
14
|
+
text: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'tool_use';
|
|
17
|
+
tool: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'tool_result';
|
|
20
|
+
tool: string;
|
|
21
|
+
};
|
|
22
|
+
export interface AnimateRequest {
|
|
23
|
+
/** The anima weave from The Loom (composed identity context). */
|
|
24
|
+
context: AnimaWeave;
|
|
25
|
+
/**
|
|
26
|
+
* The work prompt — what the anima should do.
|
|
27
|
+
* Passed directly to the session provider as the initial prompt.
|
|
28
|
+
* This bypasses The Loom — it is not a composition concern.
|
|
29
|
+
*/
|
|
30
|
+
prompt?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Working directory for the session.
|
|
33
|
+
* The session provider launches the AI process here.
|
|
34
|
+
*/
|
|
35
|
+
cwd: string;
|
|
36
|
+
/**
|
|
37
|
+
* Optional conversation id to resume a multi-turn conversation.
|
|
38
|
+
* If provided, the session provider resumes the existing conversation
|
|
39
|
+
* rather than starting a new one.
|
|
40
|
+
*/
|
|
41
|
+
conversationId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Caller-supplied metadata recorded alongside the session.
|
|
44
|
+
* The Animator stores this as-is — it does not interpret the contents.
|
|
45
|
+
*/
|
|
46
|
+
metadata?: Record<string, unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* Enable streaming output. When true, the returned `chunks` iterable
|
|
49
|
+
* yields output as the session produces it. When false (default), the
|
|
50
|
+
* `chunks` iterable completes immediately with no items.
|
|
51
|
+
*
|
|
52
|
+
* Either way, the return shape is the same: `{ chunks, result }`.
|
|
53
|
+
*/
|
|
54
|
+
streaming?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface SessionResult {
|
|
57
|
+
/** Unique session id (generated by The Animator). */
|
|
58
|
+
id: string;
|
|
59
|
+
/** Terminal status. */
|
|
60
|
+
status: 'completed' | 'failed' | 'timeout';
|
|
61
|
+
/** When the session started (ISO-8601). */
|
|
62
|
+
startedAt: string;
|
|
63
|
+
/** When the session ended (ISO-8601). */
|
|
64
|
+
endedAt: string;
|
|
65
|
+
/** Wall-clock duration in milliseconds. */
|
|
66
|
+
durationMs: number;
|
|
67
|
+
/** Provider name (e.g. 'claude-code'). */
|
|
68
|
+
provider: string;
|
|
69
|
+
/** Numeric exit code from the provider process. */
|
|
70
|
+
exitCode: number;
|
|
71
|
+
/** Error message if failed. */
|
|
72
|
+
error?: string;
|
|
73
|
+
/** Conversation id (for multi-turn resume). */
|
|
74
|
+
conversationId?: string;
|
|
75
|
+
/** Session id from the provider (e.g. for --resume). */
|
|
76
|
+
providerSessionId?: string;
|
|
77
|
+
/** Token usage from the provider, if available. */
|
|
78
|
+
tokenUsage?: TokenUsage;
|
|
79
|
+
/** Cost in USD from the provider, if available. */
|
|
80
|
+
costUsd?: number;
|
|
81
|
+
/** Caller-supplied metadata, recorded as-is. */
|
|
82
|
+
metadata?: Record<string, unknown>;
|
|
83
|
+
}
|
|
84
|
+
export interface TokenUsage {
|
|
85
|
+
inputTokens: number;
|
|
86
|
+
outputTokens: number;
|
|
87
|
+
cacheReadTokens?: number;
|
|
88
|
+
cacheWriteTokens?: number;
|
|
89
|
+
}
|
|
90
|
+
export interface SummonRequest {
|
|
91
|
+
/**
|
|
92
|
+
* The work prompt — what the anima should do.
|
|
93
|
+
* Passed directly to the session provider as the initial prompt.
|
|
94
|
+
*/
|
|
95
|
+
prompt: string;
|
|
96
|
+
/**
|
|
97
|
+
* The role to summon (e.g. 'artificer', 'scribe').
|
|
98
|
+
* Passed to The Loom for context composition and recorded in session metadata.
|
|
99
|
+
*/
|
|
100
|
+
role?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Working directory for the session.
|
|
103
|
+
* The session provider launches the AI process here.
|
|
104
|
+
*/
|
|
105
|
+
cwd: string;
|
|
106
|
+
/**
|
|
107
|
+
* Optional conversation id to resume a multi-turn conversation.
|
|
108
|
+
*/
|
|
109
|
+
conversationId?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Additional metadata to record alongside the session.
|
|
112
|
+
* Merged with auto-generated metadata (trigger: 'summon', role).
|
|
113
|
+
*/
|
|
114
|
+
metadata?: Record<string, unknown>;
|
|
115
|
+
/**
|
|
116
|
+
* Enable streaming output. When true, the returned `chunks` iterable
|
|
117
|
+
* yields output as the session produces it. When false (default), the
|
|
118
|
+
* `chunks` iterable completes immediately with no items.
|
|
119
|
+
*/
|
|
120
|
+
streaming?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/** The return value from animate() and summon(). */
|
|
123
|
+
export interface AnimateHandle {
|
|
124
|
+
/**
|
|
125
|
+
* Async iterable of output chunks from the session. When streaming is
|
|
126
|
+
* disabled (the default), this iterable completes immediately with no
|
|
127
|
+
* items. When streaming is enabled, it yields chunks as the session
|
|
128
|
+
* produces output.
|
|
129
|
+
*/
|
|
130
|
+
chunks: AsyncIterable<SessionChunk>;
|
|
131
|
+
/**
|
|
132
|
+
* Promise that resolves to the final SessionResult after the session
|
|
133
|
+
* completes (or fails/times out) and the result is recorded to The Stacks.
|
|
134
|
+
*/
|
|
135
|
+
result: Promise<SessionResult>;
|
|
136
|
+
}
|
|
137
|
+
export interface AnimatorApi {
|
|
138
|
+
/**
|
|
139
|
+
* Summon an anima — compose context via The Loom and launch a session.
|
|
140
|
+
*
|
|
141
|
+
* This is the high-level "make an anima do a thing" entry point.
|
|
142
|
+
* Internally calls The Loom for context composition (passing the role),
|
|
143
|
+
* then animate() for session launch and recording. The work prompt
|
|
144
|
+
* bypasses the Loom and goes directly to the provider.
|
|
145
|
+
*
|
|
146
|
+
* Requires The Loom apparatus to be installed. Throws if not available.
|
|
147
|
+
*
|
|
148
|
+
* Auto-populates session metadata with `trigger: 'summon'` and `role`.
|
|
149
|
+
*
|
|
150
|
+
* Returns synchronously — the async work lives inside `result` and `chunks`.
|
|
151
|
+
*/
|
|
152
|
+
summon(request: SummonRequest): AnimateHandle;
|
|
153
|
+
/**
|
|
154
|
+
* Animate a session — launch an AI process with the given context.
|
|
155
|
+
*
|
|
156
|
+
* This is the low-level entry point for callers that compose their own
|
|
157
|
+
* AnimaWeave (e.g. The Parlour for multi-turn conversations).
|
|
158
|
+
*
|
|
159
|
+
* Records the session result to The Stacks before `result` resolves.
|
|
160
|
+
*
|
|
161
|
+
* Set `streaming: true` on the request to receive output chunks as the
|
|
162
|
+
* session runs. When streaming is disabled (default), the `chunks`
|
|
163
|
+
* iterable completes immediately with no items.
|
|
164
|
+
*
|
|
165
|
+
* Returns synchronously — the async work lives inside `result` and `chunks`.
|
|
166
|
+
*/
|
|
167
|
+
animate(request: AnimateRequest): AnimateHandle;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* A session provider — pluggable backend that knows how to launch and
|
|
171
|
+
* communicate with a specific AI system.
|
|
172
|
+
*
|
|
173
|
+
* Implemented as an apparatus plugin whose `provides` object satisfies
|
|
174
|
+
* this interface. The Animator discovers the provider via guild config:
|
|
175
|
+
* `guild.json["animator"]["sessionProvider"]` names the plugin id.
|
|
176
|
+
*
|
|
177
|
+
* The provider always returns `{ chunks, result }` — the same shape as
|
|
178
|
+
* AnimateHandle. When `config.streaming` is true, the provider MAY yield
|
|
179
|
+
* output chunks as the session runs. When false (or when the provider
|
|
180
|
+
* does not support streaming), the chunks iterable completes immediately
|
|
181
|
+
* with no items. The Animator does not branch on streaming capability —
|
|
182
|
+
* it passes the flag through and trusts the provider to do the right thing.
|
|
183
|
+
*/
|
|
184
|
+
export interface AnimatorSessionProvider {
|
|
185
|
+
/** Human-readable name (e.g. 'claude-code'). */
|
|
186
|
+
name: string;
|
|
187
|
+
/**
|
|
188
|
+
* Launch a session. Returns `{ chunks, result }` synchronously.
|
|
189
|
+
*
|
|
190
|
+
* The `result` promise resolves when the AI process exits.
|
|
191
|
+
* The `chunks` async iterable yields output when `config.streaming`
|
|
192
|
+
* is true and the provider supports streaming; otherwise it completes
|
|
193
|
+
* immediately with no items.
|
|
194
|
+
*
|
|
195
|
+
* Providers that don't support streaming simply ignore the flag and
|
|
196
|
+
* return empty chunks — no separate method needed.
|
|
197
|
+
*/
|
|
198
|
+
launch(config: SessionProviderConfig): {
|
|
199
|
+
chunks: AsyncIterable<SessionChunk>;
|
|
200
|
+
result: Promise<SessionProviderResult>;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
export interface SessionProviderConfig {
|
|
204
|
+
/** System prompt for the AI process. May be undefined if composition is not yet implemented. */
|
|
205
|
+
systemPrompt?: string;
|
|
206
|
+
/** Initial user message (e.g. writ description). */
|
|
207
|
+
initialPrompt?: string;
|
|
208
|
+
/** Model to use (from guild settings). */
|
|
209
|
+
model: string;
|
|
210
|
+
/** Optional conversation id for resume. */
|
|
211
|
+
conversationId?: string;
|
|
212
|
+
/** Working directory for the session. */
|
|
213
|
+
cwd: string;
|
|
214
|
+
/**
|
|
215
|
+
* Enable streaming output. When true, the provider should yield output
|
|
216
|
+
* chunks as the session produces them. When false (default), the chunks
|
|
217
|
+
* iterable should complete immediately with no items.
|
|
218
|
+
*
|
|
219
|
+
* Providers that don't support streaming may ignore this flag.
|
|
220
|
+
*/
|
|
221
|
+
streaming?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Resolved tools for this session. When present, the provider should
|
|
224
|
+
* configure an MCP server with these tool definitions.
|
|
225
|
+
*
|
|
226
|
+
* The Loom resolves role → permissions → tools via the Instrumentarium.
|
|
227
|
+
* The Animator passes them through from the AnimaWeave.
|
|
228
|
+
*/
|
|
229
|
+
tools?: ResolvedTool[];
|
|
230
|
+
}
|
|
231
|
+
export interface SessionProviderResult {
|
|
232
|
+
/** Exit status. */
|
|
233
|
+
status: 'completed' | 'failed' | 'timeout';
|
|
234
|
+
/** Numeric exit code from the process. */
|
|
235
|
+
exitCode: number;
|
|
236
|
+
/** Error message if failed. */
|
|
237
|
+
error?: string;
|
|
238
|
+
/** Provider's session id (e.g. for --resume). */
|
|
239
|
+
providerSessionId?: string;
|
|
240
|
+
/** Token usage, if the provider can report it. */
|
|
241
|
+
tokenUsage?: TokenUsage;
|
|
242
|
+
/** Cost in USD, if the provider can report it. */
|
|
243
|
+
costUsd?: number;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The session document stored in The Stacks' `sessions` book.
|
|
247
|
+
* Includes all SessionResult fields plus the `id` required by BookEntry.
|
|
248
|
+
*/
|
|
249
|
+
export interface SessionDoc {
|
|
250
|
+
id: string;
|
|
251
|
+
/**
|
|
252
|
+
* Session status. Initially written as `'running'` when the session is
|
|
253
|
+
* launched (Step 2), then updated to a terminal status (`'completed'`,
|
|
254
|
+
* `'failed'`, or `'timeout'`) after the provider exits (Step 5).
|
|
255
|
+
* The `'running'` state is transient — it only exists between Steps 2 and 5.
|
|
256
|
+
* `SessionResult.status` only includes terminal states.
|
|
257
|
+
*/
|
|
258
|
+
status: 'running' | 'completed' | 'failed' | 'timeout';
|
|
259
|
+
startedAt: string;
|
|
260
|
+
endedAt?: string;
|
|
261
|
+
durationMs?: number;
|
|
262
|
+
provider: string;
|
|
263
|
+
exitCode?: number;
|
|
264
|
+
error?: string;
|
|
265
|
+
conversationId?: string;
|
|
266
|
+
providerSessionId?: string;
|
|
267
|
+
tokenUsage?: TokenUsage;
|
|
268
|
+
costUsd?: number;
|
|
269
|
+
metadata?: Record<string, unknown>;
|
|
270
|
+
/** Index signature required by BookEntry. */
|
|
271
|
+
[key: string]: unknown;
|
|
272
|
+
}
|
|
273
|
+
/** Plugin configuration stored at guild.json["animator"]. */
|
|
274
|
+
export interface AnimatorConfig {
|
|
275
|
+
/**
|
|
276
|
+
* Plugin id of the apparatus that implements AnimatorSessionProvider.
|
|
277
|
+
* The Animator looks this up via guild().apparatus() at animate-time.
|
|
278
|
+
* Defaults to 'claude-code' if not specified.
|
|
279
|
+
*/
|
|
280
|
+
sessionProvider?: string;
|
|
281
|
+
}
|
|
282
|
+
declare module '@shardworks/nexus-core' {
|
|
283
|
+
interface GuildConfig {
|
|
284
|
+
animator?: AnimatorConfig;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAIhE,gDAAgD;AAChD,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAI1C,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,OAAO,EAAE,UAAU,CAAC;IACpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,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AAC;IACjB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kDAAkD;IAClD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX;;;;;;OAMG;IACH,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,6CAA6C;IAC7C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAID,6DAA6D;AAC7D,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAID,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAU,WAAW;QACnB,QAAQ,CAAC,EAAE,cAAc,CAAC;KAC3B;CACF"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Animator — public types.
|
|
3
|
+
*
|
|
4
|
+
* These types form the contract between The Animator apparatus and all
|
|
5
|
+
* callers (summon relay, nsg consult, etc.). No implementation details.
|
|
6
|
+
*
|
|
7
|
+
* See: docs/specification.md (animator)
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shardworks/animator-apparatus",
|
|
3
|
+
"version": "0.1.101",
|
|
4
|
+
"license": "ISC",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/shardworks/nexus",
|
|
8
|
+
"directory": "packages/plugins/animator"
|
|
9
|
+
},
|
|
10
|
+
"description": "The Animator — session launch and telemetry recording apparatus",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"zod": "4.3.6",
|
|
20
|
+
"@shardworks/nexus-core": "0.1.101",
|
|
21
|
+
"@shardworks/loom-apparatus": "0.1.101",
|
|
22
|
+
"@shardworks/tools-apparatus": "0.1.101",
|
|
23
|
+
"@shardworks/stacks-apparatus": "0.1.101"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "25.5.0"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc",
|
|
33
|
+
"test": "node --disable-warning=ExperimentalWarning --experimental-transform-types --test 'src/**/*.test.ts'",
|
|
34
|
+
"typecheck": "tsc --noEmit"
|
|
35
|
+
}
|
|
36
|
+
}
|