@shardworks/clerk-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 +209 -0
- package/dist/clerk.d.ts +16 -0
- package/dist/clerk.d.ts.map +1 -0
- package/dist/clerk.js +149 -0
- package/dist/clerk.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/commission-post.d.ts +9 -0
- package/dist/tools/commission-post.d.ts.map +1 -0
- package/dist/tools/commission-post.js +27 -0
- package/dist/tools/commission-post.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/writ-accept.d.ts +6 -0
- package/dist/tools/writ-accept.d.ts.map +1 -0
- package/dist/tools/writ-accept.js +19 -0
- package/dist/tools/writ-accept.js.map +1 -0
- package/dist/tools/writ-cancel.d.ts +7 -0
- package/dist/tools/writ-cancel.d.ts.map +1 -0
- package/dist/tools/writ-cancel.js +20 -0
- package/dist/tools/writ-cancel.js.map +1 -0
- package/dist/tools/writ-complete.d.ts +7 -0
- package/dist/tools/writ-complete.d.ts.map +1 -0
- package/dist/tools/writ-complete.js +20 -0
- package/dist/tools/writ-complete.js.map +1 -0
- package/dist/tools/writ-fail.d.ts +7 -0
- package/dist/tools/writ-fail.d.ts.map +1 -0
- package/dist/tools/writ-fail.js +20 -0
- package/dist/tools/writ-fail.js.map +1 -0
- package/dist/tools/writ-list.d.ts +15 -0
- package/dist/tools/writ-list.d.ts.map +1 -0
- package/dist/tools/writ-list.js +29 -0
- package/dist/tools/writ-list.js.map +1 -0
- package/dist/tools/writ-show.d.ts +6 -0
- package/dist/tools/writ-show.d.ts.map +1 -0
- package/dist/tools/writ-show.js +17 -0
- package/dist/tools/writ-show.js.map +1 -0
- package/dist/types.d.ts +126 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +35 -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,209 @@
|
|
|
1
|
+
# `@shardworks/clerk-apparatus`
|
|
2
|
+
|
|
3
|
+
The Clerk manages the lifecycle of **writs** — lightweight work orders that flow through a fixed status machine. Writs are created as commissions and ultimately completed, failed, or cancelled.
|
|
4
|
+
|
|
5
|
+
The Clerk sits downstream of The Stacks: `stacks ← clerk`.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Add to your package's dependencies:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"@shardworks/clerk-apparatus": "workspace:*"
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The Clerk requires The Stacks to be installed in the guild.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
The Clerk exposes a `ClerkApi` via its `provides` interface, retrieved at runtime:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import type { ClerkApi } from '@shardworks/clerk-apparatus';
|
|
29
|
+
|
|
30
|
+
const clerk = guild().apparatus<ClerkApi>('clerk');
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### `post(request): Promise<WritDoc>`
|
|
34
|
+
|
|
35
|
+
Post a new commission, creating a writ in `ready` status.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const writ = await clerk.post({
|
|
39
|
+
title: 'Refactor the session layer',
|
|
40
|
+
body: 'Move all session logic into a dedicated module',
|
|
41
|
+
type: 'mandate', // optional, defaults to guild defaultType or "mandate"
|
|
42
|
+
codex: 'artificer', // optional target codex
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
| Parameter | Type | Description |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| `title` | `string` | Short human-readable title |
|
|
49
|
+
| `body` | `string` | Detail text (required) |
|
|
50
|
+
| `type` | `string` | Writ type — must be declared or built-in (optional) |
|
|
51
|
+
| `codex` | `string` | Target codex name (optional) |
|
|
52
|
+
|
|
53
|
+
Throws if the writ type is not declared in the guild config and is not a built-in type (`mandate`, `summon`).
|
|
54
|
+
|
|
55
|
+
### `show(id): Promise<WritDoc>`
|
|
56
|
+
|
|
57
|
+
Show a writ by id. Throws if not found.
|
|
58
|
+
|
|
59
|
+
### `list(filters?): Promise<WritDoc[]>`
|
|
60
|
+
|
|
61
|
+
List writs with optional filters, ordered by `createdAt` descending (newest first).
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
const activeWrits = await clerk.list({ status: 'active', limit: 10 });
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| Filter | Type | Description |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `status` | `WritStatus` | Filter by status |
|
|
70
|
+
| `type` | `string` | Filter by writ type |
|
|
71
|
+
| `limit` | `number` | Maximum results (default: 20) |
|
|
72
|
+
| `offset` | `number` | Number of results to skip |
|
|
73
|
+
|
|
74
|
+
### `count(filters?): Promise<number>`
|
|
75
|
+
|
|
76
|
+
Count writs matching optional filters. Accepts the same filters as `list()` (except `limit` and `offset`).
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
const total = await clerk.count({ status: 'ready' });
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### `transition(id, to, fields?): Promise<WritDoc>`
|
|
83
|
+
|
|
84
|
+
Transition a writ to a new status, optionally setting additional fields atomically.
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
// Accept
|
|
88
|
+
await clerk.transition(id, 'active');
|
|
89
|
+
|
|
90
|
+
// Complete with resolution
|
|
91
|
+
await clerk.transition(id, 'completed', { resolution: 'Shipped to production' });
|
|
92
|
+
|
|
93
|
+
// Fail with resolution
|
|
94
|
+
await clerk.transition(id, 'failed', { resolution: 'Build pipeline broke' });
|
|
95
|
+
|
|
96
|
+
// Cancel (resolution optional)
|
|
97
|
+
await clerk.transition(id, 'cancelled', { resolution: 'No longer needed' });
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Throws if the transition is not legal for the writ's current status.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Status Machine
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
ready ──────► active ──────► completed
|
|
108
|
+
│ │
|
|
109
|
+
│ └──────────► failed
|
|
110
|
+
│
|
|
111
|
+
└──────────────────────────► cancelled
|
|
112
|
+
(from ready or active)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`completed`, `failed`, and `cancelled` are **terminal** — no transitions out.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Configuration
|
|
120
|
+
|
|
121
|
+
Configure The Clerk under the `"clerk"` key in your guild config:
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"clerk": {
|
|
126
|
+
"defaultType": "mandate"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Writ types are declared at the top level of the guild config:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"writTypes": {
|
|
136
|
+
"quest": { "description": "A significant multi-step task" },
|
|
137
|
+
"errand": { "description": "A small one-off task" }
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The built-in types `mandate` and `summon` are always available without declaration.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Support Kit
|
|
147
|
+
|
|
148
|
+
The Clerk contributes one book and seven tools to the guild:
|
|
149
|
+
|
|
150
|
+
### Books
|
|
151
|
+
|
|
152
|
+
| Book | Indexes | Contents |
|
|
153
|
+
|---|---|---|
|
|
154
|
+
| `writs` | `status`, `type`, `createdAt`, `[status, type]`, `[status, createdAt]` | Writ documents |
|
|
155
|
+
|
|
156
|
+
### Tools
|
|
157
|
+
|
|
158
|
+
| Tool | Permission | Description |
|
|
159
|
+
|---|---|---|
|
|
160
|
+
| `commission-post` | `clerk:write` | Post a new commission (create a writ) |
|
|
161
|
+
| `writ-show` | `clerk:read` | Show full detail for a writ |
|
|
162
|
+
| `writ-list` | `clerk:read` | List writs with optional filters |
|
|
163
|
+
| `writ-accept` | `clerk:write` | Accept a writ (ready → active) |
|
|
164
|
+
| `writ-complete` | `clerk:write` | Complete a writ (active → completed) |
|
|
165
|
+
| `writ-fail` | `clerk:write` | Fail a writ (active → failed) |
|
|
166
|
+
| `writ-cancel` | `clerk:write` | Cancel a writ (ready\|active → cancelled) |
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Key Types
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
type WritStatus = 'ready' | 'active' | 'completed' | 'failed' | 'cancelled';
|
|
174
|
+
|
|
175
|
+
interface WritDoc {
|
|
176
|
+
id: string; // ULID-like, prefixed "writ-"
|
|
177
|
+
type: string; // declared or built-in type
|
|
178
|
+
status: WritStatus;
|
|
179
|
+
title: string;
|
|
180
|
+
body: string;
|
|
181
|
+
codex?: string; // target codex name
|
|
182
|
+
createdAt: string; // ISO timestamp
|
|
183
|
+
updatedAt: string; // ISO timestamp, updated on every mutation
|
|
184
|
+
acceptedAt?: string; // ISO timestamp, set when transitioning to active
|
|
185
|
+
resolvedAt?: string; // ISO timestamp, set on any terminal transition
|
|
186
|
+
resolution?: string; // summary of how the writ resolved
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
interface PostCommissionRequest {
|
|
190
|
+
title: string;
|
|
191
|
+
body: string; // required
|
|
192
|
+
type?: string; // defaults to guild defaultType or "mandate"
|
|
193
|
+
codex?: string;
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
See `src/types.ts` for the complete type definitions.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Exports
|
|
202
|
+
|
|
203
|
+
The package exports all public types and the `createClerk()` factory:
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
import clerkPlugin, { createClerk, type ClerkApi } from '@shardworks/clerk-apparatus';
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The default export is a pre-built plugin instance, ready for guild installation.
|
package/dist/clerk.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Clerk — writ lifecycle management apparatus.
|
|
3
|
+
*
|
|
4
|
+
* The Clerk manages the lifecycle of writs: lightweight work orders that flow
|
|
5
|
+
* through a fixed status machine (ready → active → completed/failed, or
|
|
6
|
+
* ready/active → cancelled). Each writ has a type, a title, a body, and
|
|
7
|
+
* optional codex and resolution fields.
|
|
8
|
+
*
|
|
9
|
+
* Writ types are validated against the guild config's writTypes field plus the
|
|
10
|
+
* built-in type ('mandate'). An unknown type is rejected at post time.
|
|
11
|
+
*
|
|
12
|
+
* See: docs/architecture/apparatus/clerk.md
|
|
13
|
+
*/
|
|
14
|
+
import type { Plugin } from '@shardworks/nexus-core';
|
|
15
|
+
export declare function createClerk(): Plugin;
|
|
16
|
+
//# sourceMappingURL=clerk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clerk.d.ts","sourceRoot":"","sources":["../src/clerk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,wBAAwB,CAAC;AAyCrE,wBAAgB,WAAW,IAAI,MAAM,CAsJpC"}
|
package/dist/clerk.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Clerk — writ lifecycle management apparatus.
|
|
3
|
+
*
|
|
4
|
+
* The Clerk manages the lifecycle of writs: lightweight work orders that flow
|
|
5
|
+
* through a fixed status machine (ready → active → completed/failed, or
|
|
6
|
+
* ready/active → cancelled). Each writ has a type, a title, a body, and
|
|
7
|
+
* optional codex and resolution fields.
|
|
8
|
+
*
|
|
9
|
+
* Writ types are validated against the guild config's writTypes field plus the
|
|
10
|
+
* built-in type ('mandate'). An unknown type is rejected at post time.
|
|
11
|
+
*
|
|
12
|
+
* See: docs/architecture/apparatus/clerk.md
|
|
13
|
+
*/
|
|
14
|
+
import { guild, generateId } from '@shardworks/nexus-core';
|
|
15
|
+
import { commissionPost, writShow, writList, writAccept, writComplete, writFail, writCancel, } from "./tools/index.js";
|
|
16
|
+
// ── Built-in writ types ──────────────────────────────────────────────
|
|
17
|
+
const BUILTIN_TYPES = new Set(['mandate']);
|
|
18
|
+
// ── Status machine ───────────────────────────────────────────────────
|
|
19
|
+
const ALLOWED_FROM = {
|
|
20
|
+
active: ['ready'],
|
|
21
|
+
completed: ['active'],
|
|
22
|
+
failed: ['active'],
|
|
23
|
+
cancelled: ['ready', 'active'],
|
|
24
|
+
ready: [],
|
|
25
|
+
};
|
|
26
|
+
const TERMINAL_STATUSES = new Set(['completed', 'failed', 'cancelled']);
|
|
27
|
+
// ── Factory ──────────────────────────────────────────────────────────
|
|
28
|
+
export function createClerk() {
|
|
29
|
+
let writs;
|
|
30
|
+
// ── Helpers ──────────────────────────────────────────────────────
|
|
31
|
+
function resolveClerkConfig() {
|
|
32
|
+
return guild().guildConfig().clerk ?? {};
|
|
33
|
+
}
|
|
34
|
+
function resolveWritTypes() {
|
|
35
|
+
const config = resolveClerkConfig();
|
|
36
|
+
const declared = (config.writTypes ?? []).map((entry) => entry.name);
|
|
37
|
+
return new Set([...BUILTIN_TYPES, ...declared]);
|
|
38
|
+
}
|
|
39
|
+
function resolveDefaultType() {
|
|
40
|
+
const config = resolveClerkConfig();
|
|
41
|
+
return config.defaultType ?? 'mandate';
|
|
42
|
+
}
|
|
43
|
+
function buildWhereClause(filters) {
|
|
44
|
+
const conditions = [];
|
|
45
|
+
if (filters?.status) {
|
|
46
|
+
conditions.push(['status', '=', filters.status]);
|
|
47
|
+
}
|
|
48
|
+
if (filters?.type) {
|
|
49
|
+
conditions.push(['type', '=', filters.type]);
|
|
50
|
+
}
|
|
51
|
+
return conditions.length > 0 ? conditions : undefined;
|
|
52
|
+
}
|
|
53
|
+
// ── API ──────────────────────────────────────────────────────────
|
|
54
|
+
const api = {
|
|
55
|
+
async post(request) {
|
|
56
|
+
const type = request.type ?? resolveDefaultType();
|
|
57
|
+
const validTypes = resolveWritTypes();
|
|
58
|
+
if (!validTypes.has(type)) {
|
|
59
|
+
throw new Error(`Unknown writ type "${type}". Declared types: ${[...validTypes].join(', ')}.`);
|
|
60
|
+
}
|
|
61
|
+
const now = new Date().toISOString();
|
|
62
|
+
const writ = {
|
|
63
|
+
id: generateId('w', 6),
|
|
64
|
+
type,
|
|
65
|
+
status: 'ready',
|
|
66
|
+
title: request.title,
|
|
67
|
+
body: request.body,
|
|
68
|
+
...(request.codex !== undefined ? { codex: request.codex } : {}),
|
|
69
|
+
createdAt: now,
|
|
70
|
+
updatedAt: now,
|
|
71
|
+
};
|
|
72
|
+
await writs.put(writ);
|
|
73
|
+
return writ;
|
|
74
|
+
},
|
|
75
|
+
async show(id) {
|
|
76
|
+
const writ = await writs.get(id);
|
|
77
|
+
if (!writ) {
|
|
78
|
+
throw new Error(`Writ "${id}" not found.`);
|
|
79
|
+
}
|
|
80
|
+
return writ;
|
|
81
|
+
},
|
|
82
|
+
async list(filters) {
|
|
83
|
+
const where = buildWhereClause(filters);
|
|
84
|
+
const limit = filters?.limit ?? 20;
|
|
85
|
+
const offset = filters?.offset;
|
|
86
|
+
return writs.find({
|
|
87
|
+
where,
|
|
88
|
+
orderBy: ['createdAt', 'desc'],
|
|
89
|
+
limit,
|
|
90
|
+
...(offset !== undefined ? { offset } : {}),
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
async count(filters) {
|
|
94
|
+
const where = buildWhereClause(filters);
|
|
95
|
+
return writs.count(where);
|
|
96
|
+
},
|
|
97
|
+
async transition(id, to, fields) {
|
|
98
|
+
const writ = await writs.get(id);
|
|
99
|
+
if (!writ) {
|
|
100
|
+
throw new Error(`Writ "${id}" not found.`);
|
|
101
|
+
}
|
|
102
|
+
const allowedFrom = ALLOWED_FROM[to];
|
|
103
|
+
if (!allowedFrom.includes(writ.status)) {
|
|
104
|
+
throw new Error(`Cannot transition writ "${id}" to "${to}": status is "${writ.status}", expected one of: ${allowedFrom.join(', ')}.`);
|
|
105
|
+
}
|
|
106
|
+
const now = new Date().toISOString();
|
|
107
|
+
const isTerminal = TERMINAL_STATUSES.has(to);
|
|
108
|
+
// Strip managed fields — callers cannot override id, status, or timestamps
|
|
109
|
+
// controlled by the status machine.
|
|
110
|
+
const { id: _id, status: _status, createdAt: _c, updatedAt: _u, acceptedAt: _a, resolvedAt: _r, ...safeFields } = (fields ?? {});
|
|
111
|
+
const patch = {
|
|
112
|
+
status: to,
|
|
113
|
+
updatedAt: now,
|
|
114
|
+
...(to === 'active' ? { acceptedAt: now } : {}),
|
|
115
|
+
...(isTerminal ? { resolvedAt: now } : {}),
|
|
116
|
+
...safeFields,
|
|
117
|
+
};
|
|
118
|
+
return writs.patch(id, patch);
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
// ── Apparatus ────────────────────────────────────────────────────
|
|
122
|
+
return {
|
|
123
|
+
apparatus: {
|
|
124
|
+
requires: ['stacks'],
|
|
125
|
+
supportKit: {
|
|
126
|
+
books: {
|
|
127
|
+
writs: {
|
|
128
|
+
indexes: ['status', 'type', 'createdAt', ['status', 'type'], ['status', 'createdAt']],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
tools: [
|
|
132
|
+
commissionPost,
|
|
133
|
+
writShow,
|
|
134
|
+
writList,
|
|
135
|
+
writAccept,
|
|
136
|
+
writComplete,
|
|
137
|
+
writFail,
|
|
138
|
+
writCancel,
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
provides: api,
|
|
142
|
+
start(_ctx) {
|
|
143
|
+
const stacks = guild().apparatus('stacks');
|
|
144
|
+
writs = stacks.book('clerk', 'writs');
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=clerk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clerk.js","sourceRoot":"","sources":["../src/clerk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAY3D,OAAO,EACL,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,UAAU,GACX,MAAM,kBAAkB,CAAC;AAE1B,wEAAwE;AAExE,MAAM,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AK,EAAE;oBACL,cAAc;oBACd,QAAQ;oBACR,QAAQ;oBACR,UAAU;oBACV,YAAY;oBACZ,QAAQ;oBACR,UAAU;iBACX;aACF;YAED,QAAQ,EAAE,GAAG;YAEb,KAAK,CAAC,IAAoB;gBACxB,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC,SAAS,CAAY,QAAQ,CAAC,CAAC;gBACtD,KAAK,GAAG,MAAM,CAAC,IAAI,CAAU,OAAO,EAAE,OAAO,CAAC,CAAC;YACjD,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @shardworks/clerk-apparatus — The Clerk.
|
|
3
|
+
*
|
|
4
|
+
* Writ lifecycle management: post commissions, accept work, complete or fail
|
|
5
|
+
* writs, and cancel them at any pre-terminal stage. Writs flow through a fixed
|
|
6
|
+
* status machine and are persisted in The Stacks.
|
|
7
|
+
*
|
|
8
|
+
* See: docs/architecture/apparatus/clerk.md
|
|
9
|
+
*/
|
|
10
|
+
export { type ClerkApi, type ClerkConfig, type WritTypeEntry, type WritDoc, type WritStatus, type PostCommissionRequest, type WritFilters, } from './types.ts';
|
|
11
|
+
export { createClerk } from './clerk.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,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;;AAIzC,wBAA6B"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @shardworks/clerk-apparatus — The Clerk.
|
|
3
|
+
*
|
|
4
|
+
* Writ lifecycle management: post commissions, accept work, complete or fail
|
|
5
|
+
* writs, and cancel them at any pre-terminal stage. Writs flow through a fixed
|
|
6
|
+
* status machine and are persisted in The Stacks.
|
|
7
|
+
*
|
|
8
|
+
* See: docs/architecture/apparatus/clerk.md
|
|
9
|
+
*/
|
|
10
|
+
import { createClerk } from "./clerk.js";
|
|
11
|
+
// ── Clerk API ─────────────────────────────────────────────────────────
|
|
12
|
+
export {} from "./types.js";
|
|
13
|
+
export { createClerk } from "./clerk.js";
|
|
14
|
+
// ── Default export: the apparatus plugin ──────────────────────────────
|
|
15
|
+
export default createClerk();
|
|
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,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,yEAAyE;AAEzE,OAAO,EAQN,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,yEAAyE;AAEzE,eAAe,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const _default: import("@shardworks/tools-apparatus").ToolDefinition<{
|
|
3
|
+
title: z.ZodString;
|
|
4
|
+
body: z.ZodString;
|
|
5
|
+
type: z.ZodOptional<z.ZodString>;
|
|
6
|
+
codex: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}>;
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=commission-post.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commission-post.d.ts","sourceRoot":"","sources":["../../src/tools/commission-post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;;;AAKxB,wBAuBG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { guild } from '@shardworks/nexus-core';
|
|
3
|
+
import { tool } from '@shardworks/tools-apparatus';
|
|
4
|
+
export default tool({
|
|
5
|
+
name: 'commission-post',
|
|
6
|
+
description: 'Post a new commission, creating a writ in ready status',
|
|
7
|
+
instructions: 'Creates a new writ and places it in ready status awaiting acceptance. ' +
|
|
8
|
+
'The writ type must be a type declared in the guild config, or the built-in type "mandate". ' +
|
|
9
|
+
'If type is omitted, the guild\'s configured default type is used (defaults to "mandate").',
|
|
10
|
+
params: {
|
|
11
|
+
title: z.string().describe('Short human-readable title describing the work'),
|
|
12
|
+
body: z.string().describe('Detail text or description'),
|
|
13
|
+
type: z.string().optional().describe('Writ type (default: guild defaultType or "mandate")'),
|
|
14
|
+
codex: z.string().optional().describe('Target codex name'),
|
|
15
|
+
},
|
|
16
|
+
permission: 'clerk:write',
|
|
17
|
+
handler: async (params) => {
|
|
18
|
+
const clerk = guild().apparatus('clerk');
|
|
19
|
+
return clerk.post({
|
|
20
|
+
title: params.title,
|
|
21
|
+
body: params.body,
|
|
22
|
+
type: params.type,
|
|
23
|
+
codex: params.codex,
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=commission-post.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commission-post.js","sourceRoot":"","sources":["../../src/tools/commission-post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGnD,eAAe,IAAI,CAAC;IAClB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,wDAAwD;IACrE,YAAY,EACV,wEAAwE;QACxE,6FAA6F;QAC7F,2FAA2F;IAC7F,MAAM,EAAE;QACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;QAC5E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;QACvD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;QAC3F,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;KAC3D;IACD,UAAU,EAAE,aAAa;IACzB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC,SAAS,CAAW,OAAO,CAAC,CAAC;QACnD,OAAO,KAAK,CAAC,IAAI,CAAC;YAChB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as commissionPost } from './commission-post.ts';
|
|
2
|
+
export { default as writShow } from './writ-show.ts';
|
|
3
|
+
export { default as writList } from './writ-list.ts';
|
|
4
|
+
export { default as writAccept } from './writ-accept.ts';
|
|
5
|
+
export { default as writComplete } from './writ-complete.ts';
|
|
6
|
+
export { default as writFail } from './writ-fail.ts';
|
|
7
|
+
export { default as writCancel } from './writ-cancel.ts';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as commissionPost } from "./commission-post.js";
|
|
2
|
+
export { default as writShow } from "./writ-show.js";
|
|
3
|
+
export { default as writList } from "./writ-list.js";
|
|
4
|
+
export { default as writAccept } from "./writ-accept.js";
|
|
5
|
+
export { default as writComplete } from "./writ-complete.js";
|
|
6
|
+
export { default as writFail } from "./writ-fail.js";
|
|
7
|
+
export { default as writCancel } from "./writ-cancel.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writ-accept.d.ts","sourceRoot":"","sources":["../../src/tools/writ-accept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;AAKxB,wBAeG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { guild } from '@shardworks/nexus-core';
|
|
3
|
+
import { tool } from '@shardworks/tools-apparatus';
|
|
4
|
+
export default tool({
|
|
5
|
+
name: 'writ-accept',
|
|
6
|
+
description: 'Accept a writ, transitioning it from ready to active',
|
|
7
|
+
instructions: 'Accepts the writ, signalling that work has begun. ' +
|
|
8
|
+
'Only writs in ready status can be accepted. ' +
|
|
9
|
+
'Returns the updated writ.',
|
|
10
|
+
params: {
|
|
11
|
+
id: z.string().describe('Writ id'),
|
|
12
|
+
},
|
|
13
|
+
permission: 'clerk:write',
|
|
14
|
+
handler: async (params) => {
|
|
15
|
+
const clerk = guild().apparatus('clerk');
|
|
16
|
+
return clerk.transition(params.id, 'active');
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=writ-accept.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writ-accept.js","sourceRoot":"","sources":["../../src/tools/writ-accept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGnD,eAAe,IAAI,CAAC;IAClB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,sDAAsD;IACnE,YAAY,EACV,oDAAoD;QACpD,8CAA8C;QAC9C,2BAA2B;IAC7B,MAAM,EAAE;QACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;KACnC;IACD,UAAU,EAAE,aAAa;IACzB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC,SAAS,CAAW,OAAO,CAAC,CAAC;QACnD,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writ-cancel.d.ts","sourceRoot":"","sources":["../../src/tools/writ-cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;AAKxB,wBAoBG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { guild } from '@shardworks/nexus-core';
|
|
3
|
+
import { tool } from '@shardworks/tools-apparatus';
|
|
4
|
+
export default tool({
|
|
5
|
+
name: 'writ-cancel',
|
|
6
|
+
description: 'Cancel a writ, transitioning it from ready or active to cancelled',
|
|
7
|
+
instructions: 'Cancels the writ. Both ready and active writs can be cancelled. ' +
|
|
8
|
+
'Optionally record a resolution explaining why. ' +
|
|
9
|
+
'Returns the updated writ.',
|
|
10
|
+
params: {
|
|
11
|
+
id: z.string().describe('Writ id'),
|
|
12
|
+
resolution: z.string().optional().describe('Optional summary of why the writ was cancelled'),
|
|
13
|
+
},
|
|
14
|
+
permission: 'clerk:write',
|
|
15
|
+
handler: async (params) => {
|
|
16
|
+
const clerk = guild().apparatus('clerk');
|
|
17
|
+
return clerk.transition(params.id, 'cancelled', params.resolution !== undefined ? { resolution: params.resolution } : undefined);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=writ-cancel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writ-cancel.js","sourceRoot":"","sources":["../../src/tools/writ-cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGnD,eAAe,IAAI,CAAC;IAClB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,mEAAmE;IAChF,YAAY,EACV,kEAAkE;QAClE,iDAAiD;QACjD,2BAA2B;IAC7B,MAAM,EAAE;QACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;QAClC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;KAC7F;IACD,UAAU,EAAE,aAAa;IACzB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC,SAAS,CAAW,OAAO,CAAC,CAAC;QACnD,OAAO,KAAK,CAAC,UAAU,CACrB,MAAM,CAAC,EAAE,EACT,WAAW,EACX,MAAM,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAChF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writ-complete.d.ts","sourceRoot":"","sources":["../../src/tools/writ-complete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;AAKxB,wBAgBG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { guild } from '@shardworks/nexus-core';
|
|
3
|
+
import { tool } from '@shardworks/tools-apparatus';
|
|
4
|
+
export default tool({
|
|
5
|
+
name: 'writ-complete',
|
|
6
|
+
description: 'Complete a writ, transitioning it from active to completed',
|
|
7
|
+
instructions: 'Marks the writ as successfully completed. ' +
|
|
8
|
+
'Only writs in active status can be completed. ' +
|
|
9
|
+
'Returns the updated writ.',
|
|
10
|
+
params: {
|
|
11
|
+
id: z.string().describe('Writ id'),
|
|
12
|
+
resolution: z.string().describe('Summary of how the writ was completed'),
|
|
13
|
+
},
|
|
14
|
+
permission: 'clerk:write',
|
|
15
|
+
handler: async (params) => {
|
|
16
|
+
const clerk = guild().apparatus('clerk');
|
|
17
|
+
return clerk.transition(params.id, 'completed', { resolution: params.resolution });
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=writ-complete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writ-complete.js","sourceRoot":"","sources":["../../src/tools/writ-complete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGnD,eAAe,IAAI,CAAC;IAClB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,4DAA4D;IACzE,YAAY,EACV,4CAA4C;QAC5C,gDAAgD;QAChD,2BAA2B;IAC7B,MAAM,EAAE;QACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;QAClC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;KACzE;IACD,UAAU,EAAE,aAAa;IACzB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC,SAAS,CAAW,OAAO,CAAC,CAAC;QACnD,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IACrF,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writ-fail.d.ts","sourceRoot":"","sources":["../../src/tools/writ-fail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;AAKxB,wBAgBG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { guild } from '@shardworks/nexus-core';
|
|
3
|
+
import { tool } from '@shardworks/tools-apparatus';
|
|
4
|
+
export default tool({
|
|
5
|
+
name: 'writ-fail',
|
|
6
|
+
description: 'Fail a writ, transitioning it from active to failed',
|
|
7
|
+
instructions: 'Marks the writ as failed. Record a resolution explaining why it failed. ' +
|
|
8
|
+
'Only writs in active status can be failed. ' +
|
|
9
|
+
'Returns the updated writ.',
|
|
10
|
+
params: {
|
|
11
|
+
id: z.string().describe('Writ id'),
|
|
12
|
+
resolution: z.string().describe('Summary of why the writ failed'),
|
|
13
|
+
},
|
|
14
|
+
permission: 'clerk:write',
|
|
15
|
+
handler: async (params) => {
|
|
16
|
+
const clerk = guild().apparatus('clerk');
|
|
17
|
+
return clerk.transition(params.id, 'failed', { resolution: params.resolution });
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=writ-fail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writ-fail.js","sourceRoot":"","sources":["../../src/tools/writ-fail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGnD,eAAe,IAAI,CAAC;IAClB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,qDAAqD;IAClE,YAAY,EACV,0EAA0E;QAC1E,6CAA6C;QAC7C,2BAA2B;IAC7B,MAAM,EAAE;QACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;QAClC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;KAClE;IACD,UAAU,EAAE,aAAa;IACzB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC,SAAS,CAAW,OAAO,CAAC,CAAC;QACnD,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAClF,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const _default: import("@shardworks/tools-apparatus").ToolDefinition<{
|
|
3
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
4
|
+
ready: "ready";
|
|
5
|
+
active: "active";
|
|
6
|
+
completed: "completed";
|
|
7
|
+
failed: "failed";
|
|
8
|
+
cancelled: "cancelled";
|
|
9
|
+
}>>;
|
|
10
|
+
type: z.ZodOptional<z.ZodString>;
|
|
11
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
12
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
}>;
|
|
14
|
+
export default _default;
|
|
15
|
+
//# sourceMappingURL=writ-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writ-list.d.ts","sourceRoot":"","sources":["../../src/tools/writ-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;;;;;;;;;AAKxB,wBAyBG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { guild } from '@shardworks/nexus-core';
|
|
3
|
+
import { tool } from '@shardworks/tools-apparatus';
|
|
4
|
+
export default tool({
|
|
5
|
+
name: 'writ-list',
|
|
6
|
+
description: 'List writs with optional filters',
|
|
7
|
+
instructions: 'Returns writ summaries ordered by createdAt descending (newest first). ' +
|
|
8
|
+
'Filter by status or type to narrow results.',
|
|
9
|
+
params: {
|
|
10
|
+
status: z
|
|
11
|
+
.enum(['ready', 'active', 'completed', 'failed', 'cancelled'])
|
|
12
|
+
.optional()
|
|
13
|
+
.describe('Filter by writ status'),
|
|
14
|
+
type: z.string().optional().describe('Filter by writ type'),
|
|
15
|
+
limit: z.number().optional().default(20).describe('Maximum results (default: 20)'),
|
|
16
|
+
offset: z.number().optional().describe('Number of results to skip'),
|
|
17
|
+
},
|
|
18
|
+
permission: 'clerk:read',
|
|
19
|
+
handler: async (params) => {
|
|
20
|
+
const clerk = guild().apparatus('clerk');
|
|
21
|
+
return clerk.list({
|
|
22
|
+
status: params.status,
|
|
23
|
+
type: params.type,
|
|
24
|
+
limit: params.limit,
|
|
25
|
+
offset: params.offset,
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=writ-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writ-list.js","sourceRoot":"","sources":["../../src/tools/writ-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGnD,eAAe,IAAI,CAAC;IAClB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,kCAAkC;IAC/C,YAAY,EACV,yEAAyE;QACzE,6CAA6C;IAC/C,MAAM,EAAE;QACN,MAAM,EAAE,CAAC;aACN,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;aAC7D,QAAQ,EAAE;aACV,QAAQ,CAAC,uBAAuB,CAAC;QACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QAC3D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC;QAClF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;KACpE;IACD,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC,SAAS,CAAW,OAAO,CAAC,CAAC;QACnD,OAAO,KAAK,CAAC,IAAI,CAAC;YAChB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writ-show.d.ts","sourceRoot":"","sources":["../../src/tools/writ-show.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;AAKxB,wBAYG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { guild } from '@shardworks/nexus-core';
|
|
3
|
+
import { tool } from '@shardworks/tools-apparatus';
|
|
4
|
+
export default tool({
|
|
5
|
+
name: 'writ-show',
|
|
6
|
+
description: 'Show full detail for a writ',
|
|
7
|
+
instructions: 'Returns the complete writ record including its current status, timestamps, body text, and resolution.',
|
|
8
|
+
params: {
|
|
9
|
+
id: z.string().describe('Writ id'),
|
|
10
|
+
},
|
|
11
|
+
permission: 'clerk:read',
|
|
12
|
+
handler: async (params) => {
|
|
13
|
+
const clerk = guild().apparatus('clerk');
|
|
14
|
+
return clerk.show(params.id);
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=writ-show.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writ-show.js","sourceRoot":"","sources":["../../src/tools/writ-show.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGnD,eAAe,IAAI,CAAC;IAClB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,6BAA6B;IAC1C,YAAY,EAAE,uGAAuG;IACrH,MAAM,EAAE;QACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;KACnC;IACD,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC,SAAS,CAAW,OAAO,CAAC,CAAC;QACnD,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;CACF,CAAC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clerk public types.
|
|
3
|
+
*
|
|
4
|
+
* All types exported from @shardworks/clerk-apparatus.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A writ's position in its lifecycle.
|
|
8
|
+
*
|
|
9
|
+
* Transitions:
|
|
10
|
+
* ready → active (accept)
|
|
11
|
+
* active → completed (complete)
|
|
12
|
+
* active → failed (fail)
|
|
13
|
+
* ready | active → cancelled (cancel)
|
|
14
|
+
*
|
|
15
|
+
* completed, failed, cancelled are terminal — no further transitions.
|
|
16
|
+
*/
|
|
17
|
+
export type WritStatus = 'ready' | 'active' | 'completed' | 'failed' | 'cancelled';
|
|
18
|
+
/**
|
|
19
|
+
* A writ document as stored in The Stacks.
|
|
20
|
+
*/
|
|
21
|
+
export interface WritDoc {
|
|
22
|
+
/** Index signature required to satisfy BookEntry constraint. */
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
/** Unique writ id (`w-{base36_timestamp}{hex_random}`). Sortable by creation time. */
|
|
25
|
+
id: string;
|
|
26
|
+
/** Writ type — must be a type declared in guild config, or a built-in type. */
|
|
27
|
+
type: string;
|
|
28
|
+
/** Current lifecycle status. */
|
|
29
|
+
status: WritStatus;
|
|
30
|
+
/** Short human-readable title. */
|
|
31
|
+
title: string;
|
|
32
|
+
/** Detail text. */
|
|
33
|
+
body: string;
|
|
34
|
+
/** Target codex name. */
|
|
35
|
+
codex?: string;
|
|
36
|
+
/** ISO timestamp when the writ was created. */
|
|
37
|
+
createdAt: string;
|
|
38
|
+
/** ISO timestamp of the last mutation. */
|
|
39
|
+
updatedAt: string;
|
|
40
|
+
/** ISO timestamp when the writ was accepted (transitioned to active). */
|
|
41
|
+
acceptedAt?: string;
|
|
42
|
+
/** ISO timestamp when the writ reached a terminal state. */
|
|
43
|
+
resolvedAt?: string;
|
|
44
|
+
/** Summary of how the writ resolved (set on any terminal transition). */
|
|
45
|
+
resolution?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Request to post a new commission (create a writ).
|
|
49
|
+
*/
|
|
50
|
+
export interface PostCommissionRequest {
|
|
51
|
+
/**
|
|
52
|
+
* Writ type. Defaults to the guild's configured defaultType, or "mandate"
|
|
53
|
+
* if no default is configured. Must be a valid declared type.
|
|
54
|
+
*/
|
|
55
|
+
type?: string;
|
|
56
|
+
/** Short human-readable title describing the work. */
|
|
57
|
+
title: string;
|
|
58
|
+
/** Detail text. */
|
|
59
|
+
body: string;
|
|
60
|
+
/** Optional target codex name. */
|
|
61
|
+
codex?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Filters for listing writs.
|
|
65
|
+
*/
|
|
66
|
+
export interface WritFilters {
|
|
67
|
+
/** Filter by status. */
|
|
68
|
+
status?: WritStatus;
|
|
69
|
+
/** Filter by writ type. */
|
|
70
|
+
type?: string;
|
|
71
|
+
/** Maximum number of results (default: 20). */
|
|
72
|
+
limit?: number;
|
|
73
|
+
/** Number of results to skip. */
|
|
74
|
+
offset?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A writ type entry declared in clerk config.
|
|
78
|
+
*/
|
|
79
|
+
export interface WritTypeEntry {
|
|
80
|
+
/** The writ type name (e.g. "mandate", "task", "bug"). */
|
|
81
|
+
name: string;
|
|
82
|
+
/** Optional human-readable description of this writ type. */
|
|
83
|
+
description?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Clerk apparatus configuration — lives under the `clerk` key in guild.json.
|
|
87
|
+
*/
|
|
88
|
+
export interface ClerkConfig {
|
|
89
|
+
/** Additional writ type declarations. The built-in type "mandate" is always valid. */
|
|
90
|
+
writTypes?: WritTypeEntry[];
|
|
91
|
+
/** Default writ type when commission-post is called without a type (default: "mandate"). */
|
|
92
|
+
defaultType?: string;
|
|
93
|
+
}
|
|
94
|
+
declare module '@shardworks/nexus-core' {
|
|
95
|
+
interface GuildConfig {
|
|
96
|
+
clerk?: ClerkConfig;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The Clerk's runtime API — retrieved via guild().apparatus<ClerkApi>('clerk').
|
|
101
|
+
*/
|
|
102
|
+
export interface ClerkApi {
|
|
103
|
+
/**
|
|
104
|
+
* Post a new commission, creating a writ in 'ready' status.
|
|
105
|
+
* Validates the writ type against declared types in guild config.
|
|
106
|
+
*/
|
|
107
|
+
post(request: PostCommissionRequest): Promise<WritDoc>;
|
|
108
|
+
/**
|
|
109
|
+
* Show a writ by id. Throws if not found.
|
|
110
|
+
*/
|
|
111
|
+
show(id: string): Promise<WritDoc>;
|
|
112
|
+
/**
|
|
113
|
+
* List writs with optional filters, ordered by createdAt descending.
|
|
114
|
+
*/
|
|
115
|
+
list(filters?: WritFilters): Promise<WritDoc[]>;
|
|
116
|
+
/**
|
|
117
|
+
* Count writs matching optional filters.
|
|
118
|
+
*/
|
|
119
|
+
count(filters?: WritFilters): Promise<number>;
|
|
120
|
+
/**
|
|
121
|
+
* Transition a writ to a new status, optionally setting additional fields.
|
|
122
|
+
* Validates that the transition is legal.
|
|
123
|
+
*/
|
|
124
|
+
transition(id: string, to: WritStatus, fields?: Partial<WritDoc>): Promise<WritDoc>;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAInF;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,gEAAgE;IAChE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,sFAAsF;IACtF,EAAE,EAAE,MAAM,CAAC;IACX,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,MAAM,EAAE,UAAU,CAAC;IACnB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,SAAS,EAAE,MAAM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AC;IAEnC;;OAEG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEhD;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9C;;;OAGG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACrF"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shardworks/clerk-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/clerk"
|
|
9
|
+
},
|
|
10
|
+
"description": "The Clerk — writ lifecycle management 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/tools-apparatus": "0.1.101",
|
|
22
|
+
"@shardworks/stacks-apparatus": "0.1.101"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "25.5.0"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"test": "node --disable-warning=ExperimentalWarning --experimental-transform-types --test 'src/**/*.test.ts'",
|
|
33
|
+
"typecheck": "tsc --noEmit"
|
|
34
|
+
}
|
|
35
|
+
}
|