@shardworks/astrolabe-apparatus 0.1.213 → 0.1.215
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 +1 -1
- package/dist/engines/index.d.ts +1 -1
- package/dist/engines/index.d.ts.map +1 -1
- package/dist/engines/index.js +1 -1
- package/dist/engines/index.js.map +1 -1
- package/dist/engines/spec-publish.d.ts +6 -16
- package/dist/engines/spec-publish.d.ts.map +1 -1
- package/dist/engines/spec-publish.js +7 -76
- package/dist/engines/spec-publish.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -159,7 +159,7 @@ The Astrolabe declares one book in Stacks:
|
|
|
159
159
|
| `astrolabe.plan-init` | Creates a PlanDoc from the brief writ; validates codex presence |
|
|
160
160
|
| `astrolabe.inventory-check` | Validates that the reader produced a non-empty inventory |
|
|
161
161
|
| `astrolabe.decision-review` | Two-pass engine: blocks for patron review, then reconciles answers. Decisions with `selected` already pre-set by the analyst are auto-accepted — they are excluded from the InputRequestDoc, and if nothing remains reviewable the engine fast-paths to `writing` without opening the gate. |
|
|
162
|
-
| `astrolabe.spec-publish` | Publishes the generated specification as a new writ |
|
|
162
|
+
| `astrolabe.spec-publish` | Publishes the generated specification as a new writ. Posts the spec body verbatim — any `<task-manifest>` block is preserved and is not fanned out into child `piece` writs. |
|
|
163
163
|
|
|
164
164
|
### Rig Templates (contributed to Spider)
|
|
165
165
|
|
package/dist/engines/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createPlanInitEngine } from './plan-init.ts';
|
|
2
2
|
export { createInventoryCheckEngine } from './inventory-check.ts';
|
|
3
3
|
export { createDecisionReviewEngine } from './decision-review.ts';
|
|
4
|
-
export { createSpecPublishEngine
|
|
4
|
+
export { createSpecPublishEngine } from './spec-publish.ts';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engines/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engines/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/engines/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createPlanInitEngine } from "./plan-init.js";
|
|
2
2
|
export { createInventoryCheckEngine } from "./inventory-check.js";
|
|
3
3
|
export { createDecisionReviewEngine } from "./decision-review.js";
|
|
4
|
-
export { createSpecPublishEngine
|
|
4
|
+
export { createSpecPublishEngine } from "./spec-publish.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engines/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engines/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
* the originating brief via a 'refines' link, records generatedWritId on
|
|
6
6
|
* the PlanDoc, and transitions the plan to 'completed'.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* The engine always posts the full spec verbatim — including any
|
|
9
|
+
* `<task-manifest>` block the spec-writer produced. The planning pipeline
|
|
10
|
+
* does not fan the manifest out into child `piece` writs; the implementing
|
|
11
|
+
* artificer (or a downstream tool) is responsible for acting on the
|
|
12
|
+
* manifest if it chooses to. This keeps spec-publish a pure "publish what
|
|
13
|
+
* was written" step with no hidden surgery on the mandate body.
|
|
13
14
|
*
|
|
14
15
|
* Preconditions:
|
|
15
16
|
* - plan.status must be 'writing'
|
|
@@ -18,16 +19,5 @@
|
|
|
18
19
|
import type { EngineDesign } from '@shardworks/fabricator-apparatus';
|
|
19
20
|
import type { Book } from '@shardworks/stacks-apparatus';
|
|
20
21
|
import type { PlanDoc } from '../types.ts';
|
|
21
|
-
/**
|
|
22
|
-
* Parse the `<task-manifest>` block from the spec string.
|
|
23
|
-
* Returns the individual `<task ...>...</task>` fragments and the spec
|
|
24
|
-
* with the manifest block removed.
|
|
25
|
-
*
|
|
26
|
-
* If no manifest is found, returns null.
|
|
27
|
-
*/
|
|
28
|
-
export declare function parseTaskManifest(spec: string): {
|
|
29
|
-
tasks: string[];
|
|
30
|
-
strippedSpec: string;
|
|
31
|
-
} | null;
|
|
32
22
|
export declare function createSpecPublishEngine(getPlansBook: () => Book<PlanDoc>): EngineDesign;
|
|
33
23
|
//# sourceMappingURL=spec-publish.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec-publish.d.ts","sourceRoot":"","sources":["../../src/engines/spec-publish.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"spec-publish.d.ts","sourceRoot":"","sources":["../../src/engines/spec-publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAqC,MAAM,kCAAkC,CAAC;AACxG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,YAAY,CA+DvF"}
|
|
@@ -5,44 +5,18 @@
|
|
|
5
5
|
* the originating brief via a 'refines' link, records generatedWritId on
|
|
6
6
|
* the PlanDoc, and transitions the plan to 'completed'.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* The engine always posts the full spec verbatim — including any
|
|
9
|
+
* `<task-manifest>` block the spec-writer produced. The planning pipeline
|
|
10
|
+
* does not fan the manifest out into child `piece` writs; the implementing
|
|
11
|
+
* artificer (or a downstream tool) is responsible for acting on the
|
|
12
|
+
* manifest if it chooses to. This keeps spec-publish a pure "publish what
|
|
13
|
+
* was written" step with no hidden surgery on the mandate body.
|
|
13
14
|
*
|
|
14
15
|
* Preconditions:
|
|
15
16
|
* - plan.status must be 'writing'
|
|
16
17
|
* - plan.spec must be a non-empty string
|
|
17
18
|
*/
|
|
18
19
|
import { guild } from '@shardworks/nexus-core';
|
|
19
|
-
/**
|
|
20
|
-
* Parse the `<task-manifest>` block from the spec string.
|
|
21
|
-
* Returns the individual `<task ...>...</task>` fragments and the spec
|
|
22
|
-
* with the manifest block removed.
|
|
23
|
-
*
|
|
24
|
-
* If no manifest is found, returns null.
|
|
25
|
-
*/
|
|
26
|
-
export function parseTaskManifest(spec) {
|
|
27
|
-
// Match the full <task-manifest>...</task-manifest> block (greedy, single match)
|
|
28
|
-
const manifestMatch = spec.match(/<task-manifest>([\s\S]*?)<\/task-manifest>/);
|
|
29
|
-
if (!manifestMatch)
|
|
30
|
-
return null;
|
|
31
|
-
const manifestBlock = manifestMatch[0];
|
|
32
|
-
const manifestInner = manifestMatch[1];
|
|
33
|
-
// Extract individual <task ...>...</task> elements
|
|
34
|
-
const taskRegex = /<task\b[^>]*>[\s\S]*?<\/task>/g;
|
|
35
|
-
const tasks = [];
|
|
36
|
-
let match;
|
|
37
|
-
while ((match = taskRegex.exec(manifestInner)) !== null) {
|
|
38
|
-
tasks.push(match[0].trim());
|
|
39
|
-
}
|
|
40
|
-
if (tasks.length === 0)
|
|
41
|
-
return null;
|
|
42
|
-
// Strip the manifest block from the spec
|
|
43
|
-
const strippedSpec = spec.replace(manifestBlock, '').trim();
|
|
44
|
-
return { tasks, strippedSpec };
|
|
45
|
-
}
|
|
46
20
|
export function createSpecPublishEngine(getPlansBook) {
|
|
47
21
|
return {
|
|
48
22
|
id: 'astrolabe.spec-publish',
|
|
@@ -66,50 +40,7 @@ export function createSpecPublishEngine(getPlansBook) {
|
|
|
66
40
|
const briefWrit = await clerk.show(planId);
|
|
67
41
|
// Resolve generated writ type from config
|
|
68
42
|
const generatedWritType = guild().guildConfig().astrolabe?.generatedWritType ?? 'mandate';
|
|
69
|
-
//
|
|
70
|
-
const manifestResult = parseTaskManifest(plan.spec);
|
|
71
|
-
if (manifestResult) {
|
|
72
|
-
// ── Piece-aware path: manifest found ──
|
|
73
|
-
const { tasks, strippedSpec } = manifestResult;
|
|
74
|
-
// 1. Post mandate in draft state (pieces need parent to exist)
|
|
75
|
-
const generatedWrit = await clerk.post({
|
|
76
|
-
type: generatedWritType,
|
|
77
|
-
title: briefWrit.title,
|
|
78
|
-
body: strippedSpec,
|
|
79
|
-
codex: plan.codex,
|
|
80
|
-
draft: true,
|
|
81
|
-
});
|
|
82
|
-
// 2. Create child piece writs (one per task, in manifest order)
|
|
83
|
-
for (const taskXml of tasks) {
|
|
84
|
-
// Extract task id for a meaningful title
|
|
85
|
-
const idMatch = taskXml.match(/<task\s+id="([^"]+)"/);
|
|
86
|
-
const taskId = idMatch?.[1] ?? 'task';
|
|
87
|
-
const nameMatch = taskXml.match(/<name>([\s\S]*?)<\/name>/);
|
|
88
|
-
const taskName = nameMatch?.[1]?.trim() ?? taskId;
|
|
89
|
-
await clerk.post({
|
|
90
|
-
type: 'piece',
|
|
91
|
-
title: taskName,
|
|
92
|
-
body: taskXml,
|
|
93
|
-
parentId: generatedWrit.id,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
// 3. Link: mandate (source) → brief (target), type 'refines'
|
|
97
|
-
await clerk.link(generatedWrit.id, planId, 'refines');
|
|
98
|
-
// 4. Transition mandate from draft to open (ready for dispatch)
|
|
99
|
-
await clerk.transition(generatedWrit.id, 'open');
|
|
100
|
-
// 5. Update PlanDoc
|
|
101
|
-
const now = new Date().toISOString();
|
|
102
|
-
await book.patch(planId, {
|
|
103
|
-
generatedWritId: generatedWrit.id,
|
|
104
|
-
status: 'completed',
|
|
105
|
-
updatedAt: now,
|
|
106
|
-
});
|
|
107
|
-
return {
|
|
108
|
-
status: 'completed',
|
|
109
|
-
yields: { generatedWritId: generatedWrit.id },
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
// ── Legacy path: no manifest ──
|
|
43
|
+
// Post the mandate with the full spec verbatim (task-manifest included if present).
|
|
113
44
|
const generatedWrit = await clerk.post({
|
|
114
45
|
type: generatedWritType,
|
|
115
46
|
title: briefWrit.title,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec-publish.js","sourceRoot":"","sources":["../../src/engines/spec-publish.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"spec-publish.js","sourceRoot":"","sources":["../../src/engines/spec-publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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,SAAS,CAAC,KAAK;gBACtB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAC;YAEH,0DAA0D;YAC1D,MAAM,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;YAEtD,iBAAiB;YACjB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YACrC,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBACvB,eAAe,EAAE,aAAa,CAAC,EAAE;gBACjC,MAAM,EAAE,WAAW;gBACnB,SAAS,EAAE,GAAG;aACf,CAAC,CAAC;YAEH,OAAO;gBACL,MAAM,EAAE,WAAW;gBACnB,MAAM,EAAE,EAAE,eAAe,EAAE,aAAa,CAAC,EAAE,EAAE;aAC9C,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shardworks/astrolabe-apparatus",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.215",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"zod": "4.3.6",
|
|
23
|
-
"@shardworks/stacks-apparatus": "0.1.
|
|
24
|
-
"@shardworks/tools-apparatus": "0.1.
|
|
25
|
-
"@shardworks/clerk-apparatus": "0.1.
|
|
26
|
-
"@shardworks/spider-apparatus": "0.1.
|
|
27
|
-
"@shardworks/loom-apparatus": "0.1.
|
|
28
|
-
"@shardworks/fabricator-apparatus": "0.1.
|
|
23
|
+
"@shardworks/stacks-apparatus": "0.1.215",
|
|
24
|
+
"@shardworks/tools-apparatus": "0.1.215",
|
|
25
|
+
"@shardworks/clerk-apparatus": "0.1.215",
|
|
26
|
+
"@shardworks/spider-apparatus": "0.1.215",
|
|
27
|
+
"@shardworks/loom-apparatus": "0.1.215",
|
|
28
|
+
"@shardworks/fabricator-apparatus": "0.1.215"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "25.5.0",
|
|
32
|
-
"@shardworks/nexus-core": "0.1.
|
|
32
|
+
"@shardworks/nexus-core": "0.1.215"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist",
|