@shardworks/nexus-core 0.1.97 → 0.1.99
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 +243 -0
- package/dist/book.d.ts +110 -0
- package/dist/book.d.ts.map +1 -0
- package/dist/book.js +16 -0
- package/dist/book.js.map +1 -0
- package/dist/guild-config.d.ts +28 -41
- package/dist/guild-config.d.ts.map +1 -1
- package/dist/guild-config.js +13 -16
- package/dist/guild-config.js.map +1 -1
- package/dist/index.d.ts +30 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -25
- package/dist/index.js.map +1 -1
- package/dist/legacy/1/anima.d.ts.map +1 -0
- package/dist/legacy/1/anima.js.map +1 -0
- package/dist/legacy/1/audit.d.ts.map +1 -0
- package/dist/legacy/1/audit.js.map +1 -0
- package/dist/legacy/1/bundle.d.ts.map +1 -0
- package/dist/legacy/1/bundle.js.map +1 -0
- package/dist/legacy/1/clock-daemon.d.ts.map +1 -0
- package/dist/legacy/1/clock-daemon.js.map +1 -0
- package/dist/legacy/1/clockworks.d.ts.map +1 -0
- package/dist/legacy/1/clockworks.js.map +1 -0
- package/dist/legacy/1/conversation.d.ts.map +1 -0
- package/dist/legacy/1/conversation.js.map +1 -0
- package/dist/legacy/1/engine.d.ts.map +1 -0
- package/dist/legacy/1/engine.js.map +1 -0
- package/dist/legacy/1/events.d.ts.map +1 -0
- package/dist/legacy/1/events.js.map +1 -0
- package/dist/legacy/1/guild-config.d.ts +74 -0
- package/dist/legacy/1/guild-config.d.ts.map +1 -0
- package/dist/legacy/1/guild-config.js +51 -0
- package/dist/legacy/1/guild-config.js.map +1 -0
- package/dist/legacy/1/id.d.ts.map +1 -0
- package/dist/legacy/1/id.js.map +1 -0
- package/dist/legacy/1/index.d.ts +28 -0
- package/dist/legacy/1/index.d.ts.map +1 -0
- package/dist/legacy/1/index.js +32 -0
- package/dist/legacy/1/index.js.map +1 -0
- package/dist/legacy/1/init-guild.d.ts.map +1 -0
- package/dist/legacy/1/init-guild.js.map +1 -0
- package/dist/legacy/1/install-tool.d.ts.map +1 -0
- package/dist/legacy/1/install-tool.js.map +1 -0
- package/dist/legacy/1/instantiate.d.ts.map +1 -0
- package/dist/legacy/1/instantiate.js.map +1 -0
- package/dist/legacy/1/manifest.d.ts.map +1 -0
- package/dist/legacy/1/manifest.js.map +1 -0
- package/dist/legacy/1/migrate.d.ts.map +1 -0
- package/dist/{migrate.js → legacy/1/migrate.js} +6 -9
- package/dist/legacy/1/migrate.js.map +1 -0
- package/dist/legacy/1/nexus-home.d.ts +11 -0
- package/dist/legacy/1/nexus-home.d.ts.map +1 -0
- package/dist/legacy/1/nexus-home.js +16 -0
- package/dist/legacy/1/nexus-home.js.map +1 -0
- package/dist/legacy/1/plugin-descriptor.d.ts +3 -0
- package/dist/legacy/1/plugin-descriptor.d.ts.map +1 -0
- package/dist/legacy/1/plugin-descriptor.js +2 -0
- package/dist/legacy/1/plugin-descriptor.js.map +1 -0
- package/dist/legacy/1/preconditions.d.ts.map +1 -0
- package/dist/legacy/1/preconditions.js.map +1 -0
- package/dist/legacy/1/rehydrate.d.ts.map +1 -0
- package/dist/legacy/1/rehydrate.js.map +1 -0
- package/dist/legacy/1/remove-tool.d.ts.map +1 -0
- package/dist/legacy/1/remove-tool.js.map +1 -0
- package/dist/legacy/1/session.d.ts.map +1 -0
- package/dist/legacy/1/session.js.map +1 -0
- package/dist/legacy/1/tool-registry.d.ts.map +1 -0
- package/dist/legacy/1/tool-registry.js.map +1 -0
- package/dist/legacy/1/tool.d.ts +10 -0
- package/dist/legacy/1/tool.d.ts.map +1 -0
- package/dist/legacy/1/tool.js +2 -0
- package/dist/legacy/1/tool.js.map +1 -0
- package/dist/legacy/1/upgrade.d.ts.map +1 -0
- package/dist/legacy/1/upgrade.js.map +1 -0
- package/dist/legacy/1/workshop.d.ts.map +1 -0
- package/dist/legacy/1/workshop.js.map +1 -0
- package/dist/legacy/1/worktree.d.ts.map +1 -0
- package/dist/legacy/1/worktree.js.map +1 -0
- package/dist/legacy/1/writ.d.ts.map +1 -0
- package/dist/legacy/1/writ.js.map +1 -0
- package/dist/nexus-home.d.ts +0 -4
- package/dist/nexus-home.d.ts.map +1 -1
- package/dist/nexus-home.js +0 -8
- package/dist/nexus-home.js.map +1 -1
- package/dist/rig-context.d.ts +47 -0
- package/dist/rig-context.d.ts.map +1 -0
- package/dist/rig-context.js +11 -0
- package/dist/rig-context.js.map +1 -0
- package/dist/rig-descriptor.d.ts +39 -0
- package/dist/rig-descriptor.d.ts.map +1 -0
- package/dist/rig-descriptor.js +12 -0
- package/dist/rig-descriptor.js.map +1 -0
- package/dist/rig.d.ts +70 -0
- package/dist/rig.d.ts.map +1 -0
- package/dist/rig.js +14 -0
- package/dist/rig.js.map +1 -0
- package/dist/tool.d.ts +23 -11
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +11 -2
- package/dist/tool.js.map +1 -1
- package/package.json +5 -1
- package/dist/anima.d.ts.map +0 -1
- package/dist/anima.js.map +0 -1
- package/dist/audit.d.ts.map +0 -1
- package/dist/audit.js.map +0 -1
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js.map +0 -1
- package/dist/clock-daemon.d.ts.map +0 -1
- package/dist/clock-daemon.js.map +0 -1
- package/dist/clockworks.d.ts.map +0 -1
- package/dist/clockworks.js.map +0 -1
- package/dist/conversation.d.ts.map +0 -1
- package/dist/conversation.js.map +0 -1
- package/dist/engine.d.ts.map +0 -1
- package/dist/engine.js.map +0 -1
- package/dist/events.d.ts.map +0 -1
- package/dist/events.js.map +0 -1
- package/dist/id.d.ts.map +0 -1
- package/dist/id.js.map +0 -1
- package/dist/init-guild.d.ts.map +0 -1
- package/dist/init-guild.js.map +0 -1
- package/dist/install-tool.d.ts.map +0 -1
- package/dist/install-tool.js.map +0 -1
- package/dist/instantiate.d.ts.map +0 -1
- package/dist/instantiate.js.map +0 -1
- package/dist/manifest.d.ts.map +0 -1
- package/dist/manifest.js.map +0 -1
- package/dist/migrate.d.ts.map +0 -1
- package/dist/migrate.js.map +0 -1
- package/dist/preconditions.d.ts.map +0 -1
- package/dist/preconditions.js.map +0 -1
- package/dist/rehydrate.d.ts.map +0 -1
- package/dist/rehydrate.js.map +0 -1
- package/dist/remove-tool.d.ts.map +0 -1
- package/dist/remove-tool.js.map +0 -1
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js.map +0 -1
- package/dist/tool-registry.d.ts.map +0 -1
- package/dist/tool-registry.js.map +0 -1
- package/dist/upgrade.d.ts.map +0 -1
- package/dist/upgrade.js.map +0 -1
- package/dist/workshop.d.ts.map +0 -1
- package/dist/workshop.js.map +0 -1
- package/dist/worktree.d.ts.map +0 -1
- package/dist/worktree.js.map +0 -1
- package/dist/writ.d.ts.map +0 -1
- package/dist/writ.js.map +0 -1
- /package/dist/{anima.d.ts → legacy/1/anima.d.ts} +0 -0
- /package/dist/{anima.js → legacy/1/anima.js} +0 -0
- /package/dist/{audit.d.ts → legacy/1/audit.d.ts} +0 -0
- /package/dist/{audit.js → legacy/1/audit.js} +0 -0
- /package/dist/{bundle.d.ts → legacy/1/bundle.d.ts} +0 -0
- /package/dist/{bundle.js → legacy/1/bundle.js} +0 -0
- /package/dist/{clock-daemon.d.ts → legacy/1/clock-daemon.d.ts} +0 -0
- /package/dist/{clock-daemon.js → legacy/1/clock-daemon.js} +0 -0
- /package/dist/{clockworks.d.ts → legacy/1/clockworks.d.ts} +0 -0
- /package/dist/{clockworks.js → legacy/1/clockworks.js} +0 -0
- /package/dist/{conversation.d.ts → legacy/1/conversation.d.ts} +0 -0
- /package/dist/{conversation.js → legacy/1/conversation.js} +0 -0
- /package/dist/{engine.d.ts → legacy/1/engine.d.ts} +0 -0
- /package/dist/{engine.js → legacy/1/engine.js} +0 -0
- /package/dist/{events.d.ts → legacy/1/events.d.ts} +0 -0
- /package/dist/{events.js → legacy/1/events.js} +0 -0
- /package/dist/{id.d.ts → legacy/1/id.d.ts} +0 -0
- /package/dist/{id.js → legacy/1/id.js} +0 -0
- /package/dist/{init-guild.d.ts → legacy/1/init-guild.d.ts} +0 -0
- /package/dist/{init-guild.js → legacy/1/init-guild.js} +0 -0
- /package/dist/{install-tool.d.ts → legacy/1/install-tool.d.ts} +0 -0
- /package/dist/{install-tool.js → legacy/1/install-tool.js} +0 -0
- /package/dist/{instantiate.d.ts → legacy/1/instantiate.d.ts} +0 -0
- /package/dist/{instantiate.js → legacy/1/instantiate.js} +0 -0
- /package/dist/{manifest.d.ts → legacy/1/manifest.d.ts} +0 -0
- /package/dist/{manifest.js → legacy/1/manifest.js} +0 -0
- /package/dist/{migrate.d.ts → legacy/1/migrate.d.ts} +0 -0
- /package/dist/{preconditions.d.ts → legacy/1/preconditions.d.ts} +0 -0
- /package/dist/{preconditions.js → legacy/1/preconditions.js} +0 -0
- /package/dist/{rehydrate.d.ts → legacy/1/rehydrate.d.ts} +0 -0
- /package/dist/{rehydrate.js → legacy/1/rehydrate.js} +0 -0
- /package/dist/{remove-tool.d.ts → legacy/1/remove-tool.d.ts} +0 -0
- /package/dist/{remove-tool.js → legacy/1/remove-tool.js} +0 -0
- /package/dist/{session.d.ts → legacy/1/session.d.ts} +0 -0
- /package/dist/{session.js → legacy/1/session.js} +0 -0
- /package/dist/{tool-registry.d.ts → legacy/1/tool-registry.d.ts} +0 -0
- /package/dist/{tool-registry.js → legacy/1/tool-registry.js} +0 -0
- /package/dist/{upgrade.d.ts → legacy/1/upgrade.d.ts} +0 -0
- /package/dist/{upgrade.js → legacy/1/upgrade.js} +0 -0
- /package/dist/{workshop.d.ts → legacy/1/workshop.d.ts} +0 -0
- /package/dist/{workshop.js → legacy/1/workshop.js} +0 -0
- /package/dist/{worktree.d.ts → legacy/1/worktree.d.ts} +0 -0
- /package/dist/{worktree.js → legacy/1/worktree.js} +0 -0
- /package/dist/{writ.d.ts → legacy/1/writ.d.ts} +0 -0
- /package/dist/{writ.js → legacy/1/writ.js} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# `@shardworks/nexus-core`
|
|
2
|
+
|
|
3
|
+
The public SDK for Nexus Mk 2.1. Rig authors import from this package to define tools, declare books, and read guild configuration.
|
|
4
|
+
|
|
5
|
+
This package is a dependency of every rig. It does not depend on mainspring or the CLI — the dependency graph runs one way: rigs → core.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## `tool()` — Tool SDK
|
|
10
|
+
|
|
11
|
+
Define a Nexus tool. This is the primary authoring entry point for rig packages.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { tool } from '@shardworks/nexus-core';
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
|
|
17
|
+
export default tool({
|
|
18
|
+
name: 'greet',
|
|
19
|
+
description: 'Greet an anima by name',
|
|
20
|
+
params: {
|
|
21
|
+
name: z.string().describe('Anima name'),
|
|
22
|
+
},
|
|
23
|
+
handler: async ({ name }, ctx) => {
|
|
24
|
+
return `Hello, ${name}! Guild root: ${ctx.home}`;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
A rig package exports a `Rig` object, a single tool, or an array of tools as its default export. Mainspring discovers them automatically at install time.
|
|
30
|
+
|
|
31
|
+
### `ToolDefinition`
|
|
32
|
+
|
|
33
|
+
The return type of `tool()`. MCP, CLI, and engines all consume this shape.
|
|
34
|
+
|
|
35
|
+
### `ToolCaller`
|
|
36
|
+
|
|
37
|
+
`'cli' | 'mcp'` — controls which surfaces a tool appears on. Set via `callableFrom`:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
tool({
|
|
41
|
+
name: 'rig-install',
|
|
42
|
+
callableFrom: ['cli'], // CLI only — not exposed to animas via MCP
|
|
43
|
+
...
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Defaults to all callers if omitted.
|
|
48
|
+
|
|
49
|
+
### Resolution helpers
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
// Find one tool from a module's default export
|
|
53
|
+
resolveToolFromExport(moduleDefault, toolName?)
|
|
54
|
+
|
|
55
|
+
// Find all tools from a module's default export
|
|
56
|
+
resolveAllToolsFromExport(moduleDefault)
|
|
57
|
+
|
|
58
|
+
// Type guard
|
|
59
|
+
isToolDefinition(obj)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## `Rig` — Rig Export Type
|
|
65
|
+
|
|
66
|
+
The author-facing export type for a rig package. Rig packages export this as their default export. Mainspring reads it at load time to discover the rig's contributions.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { type Rig, tool } from '@shardworks/nexus-core';
|
|
70
|
+
|
|
71
|
+
const myTool = tool({ ... });
|
|
72
|
+
|
|
73
|
+
export default {
|
|
74
|
+
tools: [myTool],
|
|
75
|
+
books: {
|
|
76
|
+
writs: { indexes: ['status', 'createdAt', 'parent.id'] },
|
|
77
|
+
},
|
|
78
|
+
} satisfies Rig;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
| Field | Type | Description |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| `tools?` | `ToolDefinition[]` | Tools this rig contributes to the guild |
|
|
84
|
+
| `books?` | `Record<string, BookOptions>` | Named document collections — mainspring creates SQLite tables and indexes at startup |
|
|
85
|
+
|
|
86
|
+
Backward-compatible: rigs may still export a bare `ToolDefinition` or `ToolDefinition[]` directly.
|
|
87
|
+
|
|
88
|
+
### `BookOptions`
|
|
89
|
+
|
|
90
|
+
Schema declaration for a single book:
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
interface BookOptions {
|
|
94
|
+
indexes?: string[]; // field names to index (plain or dot-notation)
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### `isRig(obj)`
|
|
99
|
+
|
|
100
|
+
Type guard distinguishing a `Rig` export from a bare tool or array.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## `RigContext` — Handler Context
|
|
105
|
+
|
|
106
|
+
Injected into every tool and engine handler. Scoped to the rig that owns the handler.
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
interface RigContext {
|
|
110
|
+
home: string;
|
|
111
|
+
|
|
112
|
+
book<T extends { id: string }>(name: string): Book<T>;
|
|
113
|
+
rigBook<T extends { id: string }>(rigId: string, name: string): ReadOnlyBook<T>;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
| Member | Returns | Description |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| `home` | `string` | Absolute path to the guild root |
|
|
120
|
+
| `book(name)` | `Book<T>` | Read-write handle to one of this rig's declared books |
|
|
121
|
+
| `rigBook(rigId, name)` | `ReadOnlyBook<T>` | Read-only handle to another rig's book |
|
|
122
|
+
|
|
123
|
+
`ToolContext` is a deprecated alias for `RigContext`, re-exported from legacy for backward compatibility.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## `Book<T>` — Document Store
|
|
128
|
+
|
|
129
|
+
The NoSQL document store primitive for rig authors. `T` must extend `{ id: string }` — rig authors own ID generation.
|
|
130
|
+
|
|
131
|
+
| Method | Description |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `put(content)` | Upsert a document (creates or replaces entirely by `content.id`) |
|
|
134
|
+
| `get(id)` | Retrieve by id, or `null` |
|
|
135
|
+
| `delete(id)` | Remove by id (silent no-op if absent) |
|
|
136
|
+
| `find(query)` | Query with `where`, `orderBy`, `order`, `limit`, `offset` |
|
|
137
|
+
| `list(options?)` | List all documents, optionally paginated and sorted |
|
|
138
|
+
| `count(where?)` | Count documents matching an optional filter |
|
|
139
|
+
|
|
140
|
+
### `BookQuery`
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
type BookQuery = {
|
|
144
|
+
where?: Record<string, unknown>; // field equality filters, ANDed
|
|
145
|
+
orderBy?: string; // plain name or dot-notation
|
|
146
|
+
order?: 'asc' | 'desc';
|
|
147
|
+
limit?: number;
|
|
148
|
+
offset?: number; // requires limit
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### `ReadOnlyBook<T>`
|
|
153
|
+
|
|
154
|
+
Returned by `rigBook()` for cross-rig access. Same as `Book<T>` minus `put` and `delete`.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## `guild-config` — Guild Configuration
|
|
159
|
+
|
|
160
|
+
Read and write `guild.json`, the guild's central configuration file.
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
import { readGuildConfigV2, writeGuildConfigV2 } from '@shardworks/nexus-core';
|
|
164
|
+
|
|
165
|
+
const config = readGuildConfigV2(home);
|
|
166
|
+
config.baseTools.push('my-tool');
|
|
167
|
+
writeGuildConfigV2(home, config);
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### `GuildConfigV2`
|
|
171
|
+
|
|
172
|
+
The shape of `guild.json` for V2 guilds:
|
|
173
|
+
|
|
174
|
+
| Field | Type | Description |
|
|
175
|
+
|---|---|---|
|
|
176
|
+
| `name` | `string` | Guild name |
|
|
177
|
+
| `nexus` | `string` | Framework version at last init/upgrade |
|
|
178
|
+
| `rigs` | `string[]` | Installed rig keys (derived from npm package names) |
|
|
179
|
+
| `baseTools` | `string[]` | Tools available to all animas |
|
|
180
|
+
| `roles` | `Record<string, RoleDefinition>` | Guild roles with seats, tools, instructions |
|
|
181
|
+
| `workshops` | `Record<string, WorkshopEntry>` | Registered workshops |
|
|
182
|
+
| `settings?` | `GuildSettings` | Operational flags including default `model` |
|
|
183
|
+
| `clockworks?` | `ClockworksConfig` | Standing orders and custom events |
|
|
184
|
+
| `writTypes?` | `Record<string, WritTypeDeclaration>` | Custom writ type declarations |
|
|
185
|
+
|
|
186
|
+
### Other exports
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
guildConfigPath(home) // path to guild.json
|
|
190
|
+
createInitialGuildConfigV2(...) // default config for nsg init
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## `nexus-home` — Path Resolution
|
|
196
|
+
|
|
197
|
+
Resolve standard paths within a guild's `.nexus/` directory.
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
import { findGuildRoot, nexusDir } from '@shardworks/nexus-core';
|
|
201
|
+
|
|
202
|
+
const home = findGuildRoot(); // walks up from cwd to find guild.json
|
|
203
|
+
const dir = nexusDir(home); // .nexus/
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### All path helpers
|
|
207
|
+
|
|
208
|
+
| Function | Returns |
|
|
209
|
+
|---|---|
|
|
210
|
+
| `findGuildRoot(startDir?)` | Guild root (walks up from cwd, throws if not found) |
|
|
211
|
+
| `nexusDir(home)` | `.nexus/` |
|
|
212
|
+
| `worktreesPath(home)` | `.nexus/worktrees/` |
|
|
213
|
+
| `workshopsPath(home)` | `.nexus/workshops/` |
|
|
214
|
+
| `workshopBarePath(home, name)` | `.nexus/workshops/<name>.git` |
|
|
215
|
+
| `clockPidPath(home)` | `.nexus/clock.pid` |
|
|
216
|
+
| `clockLogPath(home)` | `.nexus/clock.log` |
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## `rig-descriptor` — Rig Descriptor Types
|
|
221
|
+
|
|
222
|
+
Types for `rig.json`, the optional descriptor a rig package can include at its root to declare dependencies on other rigs.
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
import type { RigDescriptor } from '@shardworks/nexus-core';
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### `RigDescriptor`
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
interface RigDescriptor {
|
|
232
|
+
description?: string;
|
|
233
|
+
dependencies?: RigDependency[];
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
interface RigDependency {
|
|
237
|
+
rig: string; // rig key, e.g. 'nexus-stdlib'
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Mainspring reads `rig.json` at install time. If declared dependencies aren't installed, `nsg rig install` fails with a clear error.
|
|
242
|
+
|
|
243
|
+
A rig with no dependencies needs no `rig.json` at all.
|
package/dist/book.d.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Book — the NoSQL document store primitive for rig authors.
|
|
3
|
+
*
|
|
4
|
+
* A Book is a named, schemaless collection of JSON documents. Content types
|
|
5
|
+
* must include `id: string` — rig authors own ID generation and include it
|
|
6
|
+
* as part of their domain type. No framework-managed envelope or timestamps.
|
|
7
|
+
*
|
|
8
|
+
* Books are declared in the rig's `Rig` export via `books?: Record<string, BookOptions>`.
|
|
9
|
+
* Mainspring creates the backing SQLite tables and indexes at startup.
|
|
10
|
+
*
|
|
11
|
+
* Rig authors access books through `RigContext.book()` and `RigContext.rigBook()`.
|
|
12
|
+
* The storage backend (SQLite) is an implementation detail — field names in
|
|
13
|
+
* indexes and queries use plain dot-notation, not JSONPath syntax.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Pagination options for `Book.find()` and `Book.list()`.
|
|
17
|
+
*
|
|
18
|
+
* `offset` requires `limit` — passing offset alone is a type error.
|
|
19
|
+
* This mirrors SQLite's requirement and makes the constraint explicit at
|
|
20
|
+
* the call site rather than silently patching it in the adapter.
|
|
21
|
+
*/
|
|
22
|
+
export type Pagination = {
|
|
23
|
+
limit: number;
|
|
24
|
+
offset?: number;
|
|
25
|
+
} | {
|
|
26
|
+
limit?: never;
|
|
27
|
+
offset?: never;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Query options for `Book.find()`.
|
|
31
|
+
*/
|
|
32
|
+
export type BookQuery = {
|
|
33
|
+
/**
|
|
34
|
+
* Field equality filters, ANDed together.
|
|
35
|
+
*
|
|
36
|
+
* Use plain field names or dot notation for nested fields.
|
|
37
|
+
* The storage adapter handles translation internally.
|
|
38
|
+
*
|
|
39
|
+
* @example { status: 'active', anima: 'vera' }
|
|
40
|
+
* @example { 'parent.id': '123' }
|
|
41
|
+
*/
|
|
42
|
+
where?: Record<string, unknown>;
|
|
43
|
+
/**
|
|
44
|
+
* Field to sort by. Plain name or dot notation for nested fields.
|
|
45
|
+
* @example 'createdAt'
|
|
46
|
+
* @example 'parent.id'
|
|
47
|
+
*/
|
|
48
|
+
orderBy?: string;
|
|
49
|
+
/** Sort direction. Defaults to 'asc'. */
|
|
50
|
+
order?: 'asc' | 'desc';
|
|
51
|
+
} & Pagination;
|
|
52
|
+
/** Options for `Book.list()` — pagination and sorting without a where clause. */
|
|
53
|
+
export type ListOptions = {
|
|
54
|
+
orderBy?: string;
|
|
55
|
+
order?: 'asc' | 'desc';
|
|
56
|
+
} & Pagination;
|
|
57
|
+
/**
|
|
58
|
+
* A document collection — the primary Books API surface for rig authors.
|
|
59
|
+
*
|
|
60
|
+
* `T` must extend `{ id: string }` — the id is part of the content type,
|
|
61
|
+
* not a framework-managed wrapper. Rig authors generate IDs (e.g. ULIDs)
|
|
62
|
+
* and include them in the content passed to `put()`.
|
|
63
|
+
*
|
|
64
|
+
* Obtained via `RigContext.book<T>(name)` for own-rig books or
|
|
65
|
+
* `RigContext.rigBook<T>(rigId, name)` for cross-rig read access.
|
|
66
|
+
*/
|
|
67
|
+
export interface Book<T extends {
|
|
68
|
+
id: string;
|
|
69
|
+
}> {
|
|
70
|
+
/**
|
|
71
|
+
* Upsert a document. Creates if `content.id` is new; replaces the stored
|
|
72
|
+
* document entirely if it already exists.
|
|
73
|
+
*/
|
|
74
|
+
put(content: T): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Get a document by id. Returns null if not found.
|
|
77
|
+
*/
|
|
78
|
+
get(id: string): Promise<T | null>;
|
|
79
|
+
/**
|
|
80
|
+
* Delete a document by id. Silent no-op if the document does not exist.
|
|
81
|
+
*/
|
|
82
|
+
delete(id: string): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Find documents matching a query.
|
|
85
|
+
*
|
|
86
|
+
* All `where` conditions are ANDed. Results are returned as `T[]` — no
|
|
87
|
+
* envelope, no metadata wrapper.
|
|
88
|
+
*/
|
|
89
|
+
find(query: BookQuery): Promise<T[]>;
|
|
90
|
+
/**
|
|
91
|
+
* List all documents, optionally paginated and sorted.
|
|
92
|
+
* Equivalent to `find()` with no `where` clause.
|
|
93
|
+
*/
|
|
94
|
+
list(options?: ListOptions): Promise<T[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Count documents matching an optional where clause.
|
|
97
|
+
* Efficient — does not fetch payloads.
|
|
98
|
+
*/
|
|
99
|
+
count(where?: BookQuery['where']): Promise<number>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Read-only view of a Book — returned by `RigContext.rigBook()` for cross-rig access.
|
|
103
|
+
*
|
|
104
|
+
* Omits write operations (`put`, `delete`). Rig authors should not write to
|
|
105
|
+
* another rig's books.
|
|
106
|
+
*/
|
|
107
|
+
export type ReadOnlyBook<T extends {
|
|
108
|
+
id: string;
|
|
109
|
+
}> = Pick<Book<T>, 'get' | 'find' | 'list' | 'count'>;
|
|
110
|
+
//# sourceMappingURL=book.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"book.d.ts","sourceRoot":"","sources":["../src/book.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEhC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,yCAAyC;IACzC,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB,GAAG,UAAU,CAAC;AAEf,iFAAiF;AACjF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB,GAAG,UAAU,CAAC;AAEf;;;;;;;;;GASG;AACH,MAAM,WAAW,IAAI,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;IAC5C;;;OAGG;IACH,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/B;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAEnC;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAErC;;;OAGG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAE1C;;;OAGG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACpD;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,IAAI,IAAI,CACvD,IAAI,CAAC,CAAC,CAAC,EACP,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAClC,CAAC"}
|
package/dist/book.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Book — the NoSQL document store primitive for rig authors.
|
|
3
|
+
*
|
|
4
|
+
* A Book is a named, schemaless collection of JSON documents. Content types
|
|
5
|
+
* must include `id: string` — rig authors own ID generation and include it
|
|
6
|
+
* as part of their domain type. No framework-managed envelope or timestamps.
|
|
7
|
+
*
|
|
8
|
+
* Books are declared in the rig's `Rig` export via `books?: Record<string, BookOptions>`.
|
|
9
|
+
* Mainspring creates the backing SQLite tables and indexes at startup.
|
|
10
|
+
*
|
|
11
|
+
* Rig authors access books through `RigContext.book()` and `RigContext.rigBook()`.
|
|
12
|
+
* The storage backend (SQLite) is an implementation detail — field names in
|
|
13
|
+
* indexes and queries use plain dot-notation, not JSONPath syntax.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=book.js.map
|
package/dist/book.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"book.js","sourceRoot":"","sources":["../src/book.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
package/dist/guild-config.d.ts
CHANGED
|
@@ -13,17 +13,6 @@ export interface RoleDefinition {
|
|
|
13
13
|
*/
|
|
14
14
|
instructions?: string;
|
|
15
15
|
}
|
|
16
|
-
/** A reference to a tool or engine registered in guild.json. */
|
|
17
|
-
export interface ToolEntry {
|
|
18
|
-
/** Upstream package identifier, e.g. "@shardworks/tool-commission@1.11.3". Null for locally-built tools. */
|
|
19
|
-
upstream: string | null;
|
|
20
|
-
/** ISO-8601 timestamp of when the tool was installed. */
|
|
21
|
-
installedAt: string;
|
|
22
|
-
/** npm package name for runtime resolution via node_modules. Omitted for script-only tools. */
|
|
23
|
-
package?: string;
|
|
24
|
-
/** Bundle that delivered this artifact, e.g. "@shardworks/guild-starter-kit@0.1.0". */
|
|
25
|
-
bundle?: string;
|
|
26
|
-
}
|
|
27
16
|
/** A custom event declaration in guild.json clockworks.events. */
|
|
28
17
|
export interface EventDeclaration {
|
|
29
18
|
/** Human-readable description of what this event means. */
|
|
@@ -55,15 +44,6 @@ export interface ClockworksConfig {
|
|
|
55
44
|
/** Standing orders — event → action mappings. */
|
|
56
45
|
standingOrders?: StandingOrder[];
|
|
57
46
|
}
|
|
58
|
-
/** A reference to a curriculum or temperament registered in guild.json. */
|
|
59
|
-
export interface TrainingEntry {
|
|
60
|
-
/** Upstream package identifier, or null for locally-authored content. */
|
|
61
|
-
upstream: string | null;
|
|
62
|
-
/** ISO-8601 timestamp of when the content was installed. */
|
|
63
|
-
installedAt: string;
|
|
64
|
-
/** Bundle that delivered this artifact, e.g. "@shardworks/guild-starter-kit@0.1.0". */
|
|
65
|
-
bundle?: string;
|
|
66
|
-
}
|
|
67
47
|
/** A registered workshop — a repository where the guild does its work. */
|
|
68
48
|
export interface WorkshopEntry {
|
|
69
49
|
/** Git remote URL (the clone source). */
|
|
@@ -73,6 +53,11 @@ export interface WorkshopEntry {
|
|
|
73
53
|
}
|
|
74
54
|
/** Guild-level settings — operational flags and preferences. */
|
|
75
55
|
export interface GuildSettings {
|
|
56
|
+
/**
|
|
57
|
+
* Default LLM model for anima sessions (e.g. 'sonnet', 'opus').
|
|
58
|
+
* Replaces the top-level `model` field from GuildConfig V1.
|
|
59
|
+
*/
|
|
60
|
+
model?: string;
|
|
76
61
|
/**
|
|
77
62
|
* Automatically apply pending database migrations when the Books are opened.
|
|
78
63
|
* Defaults to `true` when not specified. Set to `false` to require explicit
|
|
@@ -80,44 +65,46 @@ export interface GuildSettings {
|
|
|
80
65
|
*/
|
|
81
66
|
autoMigrate?: boolean;
|
|
82
67
|
}
|
|
83
|
-
/**
|
|
84
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Guild configuration — V2.
|
|
70
|
+
*
|
|
71
|
+
* The rig-centric model: rigs are npm packages; capabilities (tools, engines,
|
|
72
|
+
* training content) are declared by rigs and discovered dynamically at runtime.
|
|
73
|
+
* No per-capability registries — `config.rigs` + `node_modules` is the source
|
|
74
|
+
* of truth. The default model moves into `settings`.
|
|
75
|
+
*
|
|
76
|
+
* Breaking change from GuildConfig (V1): drops `tools`, `engines`, `curricula`,
|
|
77
|
+
* `temperaments`, and top-level `model`. Requires `rigs` (was optional).
|
|
78
|
+
*/
|
|
79
|
+
export interface GuildConfigV2 {
|
|
85
80
|
/** Guild name — used as the guildhall npm package name. */
|
|
86
81
|
name: string;
|
|
87
82
|
/** Installed Nexus framework version. */
|
|
88
83
|
nexus: string;
|
|
89
|
-
/** Default model for anima sessions. */
|
|
90
|
-
model: string;
|
|
91
84
|
/** Registered workshops indexed by name. */
|
|
92
85
|
workshops: Record<string, WorkshopEntry>;
|
|
93
86
|
/** Guild roles — structural positions that animas fill. */
|
|
94
87
|
roles: Record<string, RoleDefinition>;
|
|
95
|
-
/**
|
|
88
|
+
/** Tool names available to all animas regardless of role. */
|
|
96
89
|
baseTools: string[];
|
|
97
|
-
/**
|
|
98
|
-
|
|
99
|
-
/** Active engines indexed by name. */
|
|
100
|
-
engines: Record<string, ToolEntry>;
|
|
101
|
-
/** Available curricula indexed by name. */
|
|
102
|
-
curricula: Record<string, TrainingEntry>;
|
|
103
|
-
/** Available temperaments indexed by name. */
|
|
104
|
-
temperaments: Record<string, TrainingEntry>;
|
|
90
|
+
/** Installed rig keys (derived from npm package names). Always present; starts empty. */
|
|
91
|
+
rigs: string[];
|
|
105
92
|
/** Clockworks configuration — events, standing orders. */
|
|
106
93
|
clockworks?: ClockworksConfig;
|
|
107
94
|
/** Writ types declared by this guild. Built-in types (mandate, summon) are implicit. */
|
|
108
95
|
writTypes?: Record<string, WritTypeDeclaration>;
|
|
109
|
-
/** Guild-level settings — operational flags and preferences. */
|
|
96
|
+
/** Guild-level settings — operational flags and preferences. Includes default model. */
|
|
110
97
|
settings?: GuildSettings;
|
|
111
98
|
}
|
|
112
99
|
/**
|
|
113
|
-
* Create the default guild.json content for a new guild.
|
|
114
|
-
* All
|
|
100
|
+
* Create the default guild.json content for a new V2 guild.
|
|
101
|
+
* All collections start empty. The default model is stored in settings.
|
|
115
102
|
*/
|
|
116
|
-
export declare function
|
|
103
|
+
export declare function createInitialGuildConfigV2(name: string, nexusVersion: string, model: string): GuildConfigV2;
|
|
104
|
+
/** Read and parse a V2 guild.json from the guild root. */
|
|
105
|
+
export declare function readGuildConfigV2(home: string): GuildConfigV2;
|
|
106
|
+
/** Write a V2 guild.json to the guild root. */
|
|
107
|
+
export declare function writeGuildConfigV2(home: string, config: GuildConfigV2): void;
|
|
117
108
|
/** Resolve the path to guild.json in the guild root. */
|
|
118
109
|
export declare function guildConfigPath(home: string): string;
|
|
119
|
-
/** Read and parse guild.json from the guild root. */
|
|
120
|
-
export declare function readGuildConfig(home: string): GuildConfig;
|
|
121
|
-
/** Write guild.json to the guild root. */
|
|
122
|
-
export declare function writeGuildConfig(home: string, config: GuildConfig): void;
|
|
123
110
|
//# sourceMappingURL=guild-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guild-config.d.ts","sourceRoot":"","sources":["../src/guild-config.ts"],"names":[],"mappings":"AAGA,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,wEAAwE;IACxE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,
|
|
1
|
+
{"version":3,"file":"guild-config.d.ts","sourceRoot":"","sources":["../src/guild-config.ts"],"names":[],"mappings":"AAGA,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,wEAAwE;IACxE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,4DAA4D;AAC5D,MAAM,MAAM,aAAa,GACrB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC3B;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC1C,iDAAiD;IACjD,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,0EAA0E;AAC1E,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,gEAAgE;AAChE,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACzC,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACtC,6DAA6D;IAC7D,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,yFAAyF;IACzF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,0DAA0D;IAC1D,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAChD,wFAAwF;IACxF,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa,CAU3G;AAED,0DAA0D;AAC1D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAG7D;AAED,+CAA+C;AAC/C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAG5E;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
package/dist/guild-config.js
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
/**
|
|
4
|
-
* Create the default guild.json content for a new guild.
|
|
5
|
-
* All
|
|
4
|
+
* Create the default guild.json content for a new V2 guild.
|
|
5
|
+
* All collections start empty. The default model is stored in settings.
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
7
|
+
export function createInitialGuildConfigV2(name, nexusVersion, model) {
|
|
8
8
|
return {
|
|
9
9
|
name,
|
|
10
10
|
nexus: nexusVersion,
|
|
11
|
-
model,
|
|
12
11
|
workshops: {},
|
|
13
12
|
roles: {},
|
|
14
13
|
baseTools: [],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
curricula: {},
|
|
18
|
-
temperaments: {},
|
|
14
|
+
rigs: [],
|
|
15
|
+
settings: { model },
|
|
19
16
|
};
|
|
20
17
|
}
|
|
21
|
-
/**
|
|
22
|
-
export function
|
|
23
|
-
return path.join(home, 'guild.json');
|
|
24
|
-
}
|
|
25
|
-
/** Read and parse guild.json from the guild root. */
|
|
26
|
-
export function readGuildConfig(home) {
|
|
18
|
+
/** Read and parse a V2 guild.json from the guild root. */
|
|
19
|
+
export function readGuildConfigV2(home) {
|
|
27
20
|
const configFile = guildConfigPath(home);
|
|
28
21
|
return JSON.parse(fs.readFileSync(configFile, 'utf-8'));
|
|
29
22
|
}
|
|
30
|
-
/** Write guild.json to the guild root. */
|
|
31
|
-
export function
|
|
23
|
+
/** Write a V2 guild.json to the guild root. */
|
|
24
|
+
export function writeGuildConfigV2(home, config) {
|
|
32
25
|
const configFile = guildConfigPath(home);
|
|
33
26
|
fs.writeFileSync(configFile, JSON.stringify(config, null, 2) + '\n');
|
|
34
27
|
}
|
|
28
|
+
/** Resolve the path to guild.json in the guild root. */
|
|
29
|
+
export function guildConfigPath(home) {
|
|
30
|
+
return path.join(home, 'guild.json');
|
|
31
|
+
}
|
|
35
32
|
//# sourceMappingURL=guild-config.js.map
|
package/dist/guild-config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guild-config.js","sourceRoot":"","sources":["../src/guild-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"guild-config.js","sourceRoot":"","sources":["../src/guild-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAqG7B;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,IAAY,EAAE,YAAoB,EAAE,KAAa;IAC1F,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,YAAY;QACnB,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,EAAE;QACb,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,EAAE,KAAK,EAAE;KACpB,CAAC;AACJ,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAkB,CAAC;AAC3E,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,MAAqB;IACpE,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACzC,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AACvE,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
export declare const VERSION: string;
|
|
2
|
-
export { type
|
|
3
|
-
export { type
|
|
4
|
-
export {
|
|
5
|
-
export { type
|
|
6
|
-
export { type
|
|
7
|
-
export { findGuildRoot, nexusDir,
|
|
8
|
-
export { type
|
|
9
|
-
export { type
|
|
10
|
-
export { type
|
|
11
|
-
export {
|
|
12
|
-
export { type
|
|
13
|
-
export { type
|
|
14
|
-
export { type
|
|
15
|
-
export { type
|
|
16
|
-
export {
|
|
17
|
-
export { type
|
|
18
|
-
export { type
|
|
19
|
-
export { type
|
|
20
|
-
export { type
|
|
21
|
-
export { type
|
|
22
|
-
export {
|
|
23
|
-
export { type
|
|
24
|
-
export { type
|
|
25
|
-
export { type
|
|
26
|
-
export { type
|
|
2
|
+
export { type Rig, type BookOptions, isRig, } from './rig.ts';
|
|
3
|
+
export { type Book, type ReadOnlyBook, type BookQuery, type ListOptions, type Pagination, } from './book.ts';
|
|
4
|
+
export { type RigContext, } from './rig-context.ts';
|
|
5
|
+
export { type ToolCaller, type ToolDefinition, tool, isToolDefinition, resolveToolFromExport, resolveAllToolsFromExport, } from './tool.ts';
|
|
6
|
+
export { type ToolContext } from './legacy/1/tool.ts';
|
|
7
|
+
export { findGuildRoot, nexusDir, worktreesPath, workshopsPath, workshopBarePath, clockPidPath, clockLogPath, } from './nexus-home.ts';
|
|
8
|
+
export { type GuildConfigV2, createInitialGuildConfigV2, readGuildConfigV2, writeGuildConfigV2, type RoleDefinition, type WorkshopEntry, type EventDeclaration, type StandingOrder, type ClockworksConfig, type WritTypeDeclaration, type GuildSettings, guildConfigPath, } from './guild-config.ts';
|
|
9
|
+
export { type RigDescriptor, type RigDependency, } from './rig-descriptor.ts';
|
|
10
|
+
export { type GuildEvent, type EngineContext, type EngineDefinition, engine, isClockworkEngine, resolveEngineFromExport, } from './legacy/1/engine.ts';
|
|
11
|
+
export { signalEvent, validateCustomEvent, isFrameworkEvent, readPendingEvents, readEvent, markEventProcessed, recordDispatch, type ListEventsOptions, type DispatchRecord, type ListDispatchesOptions, listEvents, listDispatches, } from './legacy/1/events.ts';
|
|
12
|
+
export { type TickResult, type DispatchSummary, type ClockRunResult, type ClockStartOptions, type ClockStartResult, type ClockStopResult, type ClockStatus, clockTick, clockRun, clockStart, clockStop, clockStatus, desugarOrder, extractParams, } from './legacy/1/clockworks.ts';
|
|
13
|
+
export { type InstallToolOptions, type InstallResult, type SourceKind, classifySource, installTool, } from './legacy/1/install-tool.ts';
|
|
14
|
+
export { type RemoveToolOptions, type RemoveResult, removeTool, } from './legacy/1/remove-tool.ts';
|
|
15
|
+
export { type InstantiateOptions, type InstantiateResult, instantiate, } from './legacy/1/instantiate.ts';
|
|
16
|
+
export { initGuild } from './legacy/1/init-guild.ts';
|
|
17
|
+
export { type BundleManifest, type BundlePackageEntry, type BundleContentEntry, type BundleMigrationEntry, type InstallBundleOptions, type InstallBundleResult, readBundleManifest, installBundle, isBundleDir, } from './legacy/1/bundle.ts';
|
|
18
|
+
export { type RehydrateResult, rehydrate, } from './legacy/1/rehydrate.ts';
|
|
19
|
+
export { type AddWorkshopOptions, type AddWorkshopResult, type RemoveWorkshopOptions, type WorkshopInfo, type WorkshopDetail, type CreateWorkshopOptions, addWorkshop, removeWorkshop, listWorkshops, showWorkshop, createWorkshop, checkGhAuth, deriveWorkshopName, } from './legacy/1/workshop.ts';
|
|
20
|
+
export { type Precondition, type CommandPrecondition, type CommandOutputPrecondition, type EnvPrecondition, type PreconditionCheckResult, type ToolPreconditionResult, readPreconditions, checkOne, checkPreconditions, checkAllPreconditions, checkToolPreconditions, } from './legacy/1/preconditions.ts';
|
|
21
|
+
export { type WorktreeConfig, type WorktreeResult, setupWorktree, teardownWorktree, listWorktrees, } from './legacy/1/worktree.ts';
|
|
22
|
+
export { type MigrationFile, type MigrationProvenance, type MigrateResult, discoverMigrations, applyMigrations, applyCoreMigrations, ensureBooks, } from './legacy/1/migrate.ts';
|
|
23
|
+
export { type AnimaRecord, type ResolvedTool, type UnavailableTool, type ManifestResult, readAnima, resolveTools, readCodex, readRoleInstructions, assembleSystemPrompt, manifest, } from './legacy/1/manifest.ts';
|
|
24
|
+
export { type SessionProvider, type SessionProviderLaunchOptions, type SessionProviderResult, type SessionLaunchOptions, type SessionResult, type SessionChunk, type WorkspaceContext, type ResolvedWorkspace, type SessionRecord, type SessionSummary, type SessionDetail, type ListSessionsOptions, registerSessionProvider, getSessionProvider, resolveWorkspace, createTempWorktree, removeTempWorktree, launchSession, listSessions, countSessionsForWrit, showSession, } from './legacy/1/session.ts';
|
|
25
|
+
export { type ConversationChunk, type CreateConversationOptions, type CreateConversationResult, type ConversationSummary, type ConversationDetail, type ListConversationsOptions, createConversation, takeTurn, endConversation, nextParticipant, listConversations, showConversation, formatConveneMessage, } from './legacy/1/conversation.ts';
|
|
26
|
+
export { type UpgradePlan, type UpgradeResult, type ApplyUpgradeOptions, type MigrationPlanEntry, type ContentUpdateEntry, type ToolPlanEntry, type StaleAnimaEntry, planUpgrade, applyUpgrade, } from './legacy/1/upgrade.ts';
|
|
27
|
+
export { generateId } from './legacy/1/id.ts';
|
|
28
|
+
export { type AnimaSummary, type AnimaDetail, type ListAnimasOptions, type UpdateAnimaOptions, type AnimaStaleness, type StalenessInfo, resolveAnimaByRole, listAnimas, showAnima, updateAnima, removeAnima, checkAnimaStaleness, checkAllAnimaStaleness, } from './legacy/1/anima.ts';
|
|
29
|
+
export { type ToolSummary, listTools, } from './legacy/1/tool-registry.ts';
|
|
30
|
+
export { type WritRecord, type WritStatus, type CreateWritOptions, type ListWritsOptions, type WritChildSummary, BUILTIN_WRIT_TYPES, validateWritType, createWrit, readWrit, listWrits, activateWrit, completeWrit, adminCompleteWrit, failWrit, cancelWrit, interruptWrit, reopenFailedWrit, rollupParent, getWritChildren, buildProgressAppendix, hydratePromptTemplate, } from './legacy/1/writ.ts';
|
|
31
|
+
export { type AuditEntry, type ListAuditLogOptions, listAuditLog, } from './legacy/1/audit.ts';
|
|
27
32
|
//# sourceMappingURL=index.d.ts.map
|