@shardworks/astrolabe-apparatus 0.1.240 → 0.1.242
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 +37 -22
- package/dist/astrolabe.d.ts +11 -1
- package/dist/astrolabe.d.ts.map +1 -1
- package/dist/astrolabe.js +45 -13
- package/dist/astrolabe.js.map +1 -1
- package/dist/engines/decision-review.js +3 -3
- package/dist/engines/decision-review.js.map +1 -1
- package/dist/engines/index.d.ts +2 -0
- package/dist/engines/index.d.ts.map +1 -1
- package/dist/engines/index.js +2 -0
- package/dist/engines/index.js.map +1 -1
- package/dist/engines/inventory-check.d.ts +1 -1
- package/dist/engines/inventory-check.js +1 -1
- package/dist/engines/observation-lift.d.ts +38 -0
- package/dist/engines/observation-lift.d.ts.map +1 -0
- package/dist/engines/observation-lift.js +79 -0
- package/dist/engines/observation-lift.js.map +1 -0
- package/dist/engines/patron-anima.d.ts +28 -25
- package/dist/engines/patron-anima.d.ts.map +1 -1
- package/dist/engines/patron-anima.js +40 -37
- package/dist/engines/patron-anima.js.map +1 -1
- package/dist/engines/reader-analyst.d.ts +46 -0
- package/dist/engines/reader-analyst.d.ts.map +1 -0
- package/dist/engines/reader-analyst.js +76 -0
- package/dist/engines/reader-analyst.js.map +1 -0
- package/dist/plan-and-ship.d.ts +19 -4
- package/dist/plan-and-ship.d.ts.map +1 -1
- package/dist/plan-and-ship.js +27 -7
- package/dist/plan-and-ship.js.map +1 -1
- package/dist/three-phase-planning.d.ts +13 -3
- package/dist/three-phase-planning.d.ts.map +1 -1
- package/dist/three-phase-planning.js +22 -6
- package/dist/three-phase-planning.js.map +1 -1
- package/dist/two-phase-planning.d.ts +16 -4
- package/dist/two-phase-planning.d.ts.map +1 -1
- package/dist/two-phase-planning.js +24 -7
- package/dist/two-phase-planning.js.map +1 -1
- package/dist/types.d.ts +40 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -12
- package/pages/astrolabe/astrolabe.js +22 -1
- package/pages/astrolabe/astrolabe.test.js +123 -1
- package/patron-anima-prompt.md +90 -54
- package/sage-primer-attended.md +223 -0
- package/{sage-reader.md → sage-primer-reader.md} +5 -5
- package/{sage-analyst.md → sage-primer-scoping.md} +14 -7
- package/{sage-reading-analyst.md → sage-primer-solo.md} +20 -9
- package/sage-writer.md +6 -4
package/README.md
CHANGED
|
@@ -56,20 +56,31 @@ A `PlanDoc` is keyed by the brief writ ID and tracks the full planning lifecycle
|
|
|
56
56
|
|
|
57
57
|
```typescript
|
|
58
58
|
interface PlanDoc {
|
|
59
|
-
id: string;
|
|
60
|
-
codex: string;
|
|
61
|
-
status: PlanStatus;
|
|
62
|
-
inventory?: string;
|
|
63
|
-
observations?:
|
|
64
|
-
scope?: ScopeItem[];
|
|
65
|
-
decisions?: Decision[];
|
|
66
|
-
spec?: string;
|
|
59
|
+
id: string; // Brief writ ID
|
|
60
|
+
codex: string; // Target codex
|
|
61
|
+
status: PlanStatus; // 'reading' | 'analyzing' | 'reviewing' | 'writing' | 'completed' | 'failed'
|
|
62
|
+
inventory?: string; // Markdown: affected files, types, interfaces, patterns
|
|
63
|
+
observations?: Observation[]; // Atomic, commissionable concerns (see Observation below)
|
|
64
|
+
scope?: ScopeItem[]; // What's in and what's out
|
|
65
|
+
decisions?: Decision[]; // Architectural/design decisions with options
|
|
66
|
+
spec?: string; // The generated specification (implementation brief + task manifest)
|
|
67
67
|
generatedWritId?: string; // ID of the generated mandate
|
|
68
68
|
createdAt: string;
|
|
69
69
|
updatedAt: string;
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
interface Observation {
|
|
73
|
+
/** Plandoc-local identifier assigned by the sage (convention: obs-1, obs-2, …). */
|
|
74
|
+
id: string;
|
|
75
|
+
/** One-line commission-title-style phrase (~10 words, no trailing punctuation). */
|
|
76
|
+
title: string;
|
|
77
|
+
/** Tactical markdown — file paths, symbols, preconditions, etc. */
|
|
78
|
+
body: string;
|
|
79
|
+
}
|
|
71
80
|
```
|
|
72
81
|
|
|
82
|
+
Each `Observation` names one concern — a refactoring opportunity, risk, convention drift, or bug — that the sage noticed but that sits outside the brief's scope. The `astrolabe.observation-lift` engine lifts each record into a draft child `brief` writ under the originating brief so a curator (human or automated) can promote it.
|
|
83
|
+
|
|
73
84
|
### `PlanFilters`
|
|
74
85
|
|
|
75
86
|
```typescript
|
|
@@ -95,7 +106,7 @@ Add an `astrolabe` section to `guild.json` to configure behaviour:
|
|
|
95
106
|
|
|
96
107
|
| Field | Type | Default | Description |
|
|
97
108
|
|---|---|---|---|
|
|
98
|
-
| `patronRole` | `string` | `""` (unset) | Qualified role name of the Patron Anima consulted before decision-review. When set, the `patron-anima` engine launches an anima in
|
|
109
|
+
| `patronRole` | `string` | `""` (unset) | Qualified role name of the Patron Anima consulted before decision-review. When set (non-empty string), the `astrolabe.reader-analyst` engine selects the `sage-primer-attended` role (every decision is pre-filled so the patron-anima principle-checks them all) and the `patron-anima` engine launches an anima in the configured role under a tailored operational prompt (see `patron-anima-prompt.md`) that encodes the engine's mode discipline — one option per decision, principle-structural confidence calibration (`high`/`med`/`low`-confirm), narrow abstention reserved for irresolvable principle conflict or broken decision frame, and an out-of-lane prohibition on codebase audit work. When unset, empty, or whitespace-only, `astrolabe.reader-analyst` selects the `sage-primer-solo` role (the primer carries the razor itself) and the `patron-anima` engine no-ops; `decision-review` behaves exactly as it did before the engine existed. |
|
|
99
110
|
|
|
100
111
|
## Support Kit
|
|
101
112
|
|
|
@@ -117,10 +128,11 @@ The Astrolabe declares one book in Stacks:
|
|
|
117
128
|
|
|
118
129
|
| Role | Qualified Name | Permissions | Strict | Used In |
|
|
119
130
|
|---|---|---|---|---|
|
|
120
|
-
| `sage-reader` | `astrolabe.sage-reader` | `astrolabe:read`, `astrolabe:write`, `clerk:read`, `ratchet:read` | `true` | three-phase reader stage |
|
|
121
|
-
| `sage-
|
|
122
|
-
| `sage-writer` | `astrolabe.sage-writer` | `astrolabe:read`, `astrolabe:write`, `clerk:read`, `ratchet:read` | `true` | spec-writer stage (
|
|
123
|
-
| `sage-
|
|
131
|
+
| `sage-primer-reader` | `astrolabe.sage-primer-reader` | `astrolabe:read`, `astrolabe:write`, `clerk:read`, `ratchet:read` | `true` | three-phase reader stage |
|
|
132
|
+
| `sage-primer-scoping` | `astrolabe.sage-primer-scoping` | `astrolabe:read`, `astrolabe:write`, `clerk:read`, `ratchet:read` | `true` | three-phase scoping-primer stage (`analyst` slot id) |
|
|
133
|
+
| `sage-writer` | `astrolabe.sage-writer` | `astrolabe:read`, `astrolabe:write`, `clerk:read`, `ratchet:read` | `true` | spec-writer stage (all templates) |
|
|
134
|
+
| `sage-primer-solo` | `astrolabe.sage-primer-solo` | `astrolabe:read`, `astrolabe:write`, `clerk:read`, `ratchet:read` | `true` | `reader-analyst` slot in two-phase / plan-and-ship, when `astrolabe.patronRole` is unset — primer carries the razor itself |
|
|
135
|
+
| `sage-primer-attended` | `astrolabe.sage-primer-attended` | `astrolabe:read`, `astrolabe:write`, `clerk:read`, `ratchet:read` | `true` | `reader-analyst` slot in two-phase / plan-and-ship, when `astrolabe.patronRole` is non-empty — primer pre-fills every decision, patron-anima principle-checks them all |
|
|
124
136
|
|
|
125
137
|
### Engines (contributed to Fabricator)
|
|
126
138
|
|
|
@@ -128,24 +140,26 @@ The Astrolabe declares one book in Stacks:
|
|
|
128
140
|
|---|---|
|
|
129
141
|
| `astrolabe.plan-init` | Creates a PlanDoc from the brief writ; validates codex presence |
|
|
130
142
|
| `astrolabe.inventory-check` | Validates that the reader produced a non-empty inventory |
|
|
131
|
-
| `astrolabe.
|
|
132
|
-
| `astrolabe.
|
|
143
|
+
| `astrolabe.reader-analyst` | Selects the primer role at engine-run time from live guild config: `sage-primer-attended` when `astrolabe.patronRole` is non-empty (every decision gets pre-filled so the downstream patron-anima principle-checks them all), `sage-primer-solo` otherwise (the primer carries the razor itself and only leaves razor-matched decisions unset for the patron). Mirrors the `anima-session` surface — same givens (`prompt`, `cwd`, `writ`, `metadata`) minus the `role` given, which the engine chooses. Run-time selection (per writ, not per guild startup) means the patron can reconfigure `astrolabe.patronRole` mid-experiment and the next brief behaves according to the live config. |
|
|
144
|
+
| `astrolabe.patron-anima` | Consults a configured Patron Anima to principle-check every decision the primer produced, under a tailored operational prompt that encodes the engine's mode discipline — one option per decision, principle-structural confidence calibration (`high` = one principle fires cleanly; `med` = multiple principles conflict and the anima resolves; `low` = no principle speaks, confirm the primer), narrow abstention by omission reserved for *irresolvable principle conflict* and *broken decision frame* only, and an explicit out-of-lane prohibition on codebase audit work. Reads the plan's reviewable decisions (those without `selected` already set — empty when the attended primer ran, non-empty when the solo primer surfaced razor matches), launches the configured `patronRole` via a single-pass anima session, parses a single structured emission, and applies each valid verdict to `Decision.selected` (plus records the full verdict — confirm / override / fill-in with selection, confidence, rationale — on `Decision.patron`). No-ops when `astrolabe.patronRole` is unset or empty, or when no reviewable decisions remain. Unparseable output, invalid verdicts, and abstained decisions are left unfilled — decision-review surfaces the remainder to the patron in the normal flow. |
|
|
145
|
+
| `astrolabe.decision-review` | Two-pass engine: blocks for patron review, then reconciles answers. Decisions with `selected` already pre-set by the primer or the patron anima are auto-accepted — they are excluded from the InputRequestDoc, and if nothing remains reviewable the engine fast-paths to `writing` without opening the gate. |
|
|
133
146
|
| `astrolabe.plan-finalize` | Transitions the plan to `completed` and yields the written `spec` downstream. Does not post any writ. Used inside `plan-and-ship` to hand the spec off to the implement engine on the same brief rig. |
|
|
134
147
|
| `astrolabe.spec-publish` | Publishes the generated specification as a new mandate writ. Used only by the legacy two-phase / three-phase rigs that split planning from implementation across two writs. |
|
|
148
|
+
| `astrolabe.observation-lift` | Walks `plan.observations` after the planning-terminator engine has transitioned the plan to `completed` and calls `clerk.post({ type: 'brief', title, body, codex, parentId, draft: true })` once per record. Each created writ enters `new` (draft) phase, invisible to the Spider until a curator publishes it. Silently no-ops when `observations` is empty, absent, or a legacy string; fails fast on the first `clerk.post` error. Does not mutate the plan — the parent-child relationship on the Clerk side is the sole audit trail. Wired unconditionally into all three rig templates. |
|
|
135
149
|
|
|
136
150
|
### Rig Templates (contributed to Spider)
|
|
137
151
|
|
|
138
152
|
| Template | Mapped Writ Type | Engines |
|
|
139
153
|
|---|---|---|
|
|
140
|
-
| `astrolabe.plan-and-ship` | `brief` (default) | plan-init → draft → reader-analyst → inventory-check → patron-anima → decision-review → spec-writer → plan-finalize → implement → review → revise → seal |
|
|
141
|
-
| `astrolabe.two-phase-planning` | — (opt-in) | plan-init → draft → reader-analyst → inventory-check → decision-review → spec-writer → spec-publish → seal |
|
|
142
|
-
| `astrolabe.three-phase-planning` | — (opt-in) | plan-init → draft → reader → inventory-check → analyst → decision-review → spec-writer → spec-publish → seal |
|
|
154
|
+
| `astrolabe.plan-and-ship` | `brief` (default) | plan-init → draft → reader-analyst → inventory-check → patron-anima → decision-review → spec-writer → plan-finalize → observation-lift → implement → review → revise → seal |
|
|
155
|
+
| `astrolabe.two-phase-planning` | — (opt-in) | plan-init → draft → reader-analyst → inventory-check → decision-review → spec-writer → spec-publish → observation-lift → seal |
|
|
156
|
+
| `astrolabe.three-phase-planning` | — (opt-in) | plan-init → draft → reader → inventory-check → analyst → decision-review → spec-writer → spec-publish → observation-lift → seal |
|
|
143
157
|
|
|
144
158
|
The `resolutionEngine` is `seal` for `plan-and-ship` (brief completes when implementation seals) and `spec-writer` for the two legacy planning-only templates (where the brief's rig terminates at spec-writer and a follow-up mandate writ carries the implementation separately).
|
|
145
159
|
|
|
146
160
|
#### Rig Template Selection
|
|
147
161
|
|
|
148
|
-
The `brief` writ type maps to `astrolabe.plan-and-ship` by default. This single combined rig carries the brief through planning and implementation on one writ — the `plan-finalize` engine hands the written spec directly to the downstream `implement` engine via `${yields.plan-finalize.spec}`, and no separate mandate writ is posted. The optional `patron-anima` stage between `inventory-check` and `decision-review` consults the configured `patronRole` under a tailored operational prompt (see `patron-anima-prompt.md` packaged with the plugin) whenever `astrolabe.patronRole` is set
|
|
162
|
+
The `brief` writ type maps to `astrolabe.plan-and-ship` by default. This single combined rig carries the brief through planning and implementation on one writ — the `plan-finalize` engine hands the written spec directly to the downstream `implement` engine via `${yields.plan-finalize.spec}`, and no separate mandate writ is posted. The `reader-analyst` slot is driven by the astrolabe-owned `astrolabe.reader-analyst` engine, which selects between the `sage-primer-attended` and `sage-primer-solo` roles at engine-run time from live guild config. The optional `patron-anima` stage between `inventory-check` and `decision-review` consults the configured `patronRole` under a tailored operational prompt (see `patron-anima-prompt.md` packaged with the plugin) whenever `astrolabe.patronRole` is set. The anima principle-checks every decision the primer produced and confirms (including first-class `low`-confidence confirms when no principle speaks), overrides, fills in, or abstains. Abstention is narrow — reserved for *irresolvable principle conflict* and *broken decision frame* only. Abstained decisions are left unfilled and flow through to decision-review in the normal path. The brief reaches `completed` only when the final seal engine completes.
|
|
149
163
|
|
|
150
164
|
To use a legacy planning-only template (which posts a separate mandate writ and ends the brief's lifecycle at spec-writer), add a rig template mapping override in `guild.json`:
|
|
151
165
|
|
|
@@ -159,7 +173,7 @@ To use a legacy planning-only template (which posts a separate mandate writ and
|
|
|
159
173
|
}
|
|
160
174
|
```
|
|
161
175
|
|
|
162
|
-
Substitute `astrolabe.three-phase-planning` for the split reader / analyst
|
|
176
|
+
Substitute `astrolabe.three-phase-planning` for the split reader / scoping-primer variant (the `analyst` slot id is preserved for backward compatibility; the role it summons is `sage-primer-scoping`).
|
|
163
177
|
|
|
164
178
|
### Tools
|
|
165
179
|
|
|
@@ -170,7 +184,7 @@ Substitute `astrolabe.three-phase-planning` for the split reader / analyst varia
|
|
|
170
184
|
| `inventory-write` | `astrolabe:write` | Write or replace the codebase inventory |
|
|
171
185
|
| `scope-write` | `astrolabe:write` | Write or replace the scope items array |
|
|
172
186
|
| `decisions-write` | `astrolabe:write` | Write or replace the decisions array |
|
|
173
|
-
| `observations-write` | `astrolabe:write` | Write or replace
|
|
187
|
+
| `observations-write` | `astrolabe:write` | Write or replace primer observations (strict `Observation[]` array — `{ id, title, body }` records with non-empty strings; legacy prose-string payloads are rejected at zod validation) |
|
|
174
188
|
| `spec-write` | `astrolabe:write` | Write or replace the generated specification |
|
|
175
189
|
|
|
176
190
|
Write tools only update their artifact field plus `updatedAt`. Status transitions are the exclusive responsibility of the clockwork engines.
|
|
@@ -185,6 +199,7 @@ The Astrolabe page provides a list/detail dashboard for PlanDoc records:
|
|
|
185
199
|
|
|
186
200
|
- **List view** — filterable by status, paginated (20 per page), showing status badge, codex, brief writ title, plan ID, and creation date.
|
|
187
201
|
- **Detail view** — metadata card with plan ID, status, codex, cross-links to brief and mandate writs (linking to the Clerk writs page via `?writ=ID`), per-step AI cost breakdowns (input/output tokens and USD cost for each anima-session engine), and tabbed content sections for Inventory, Scope, Decisions, Observations, and Spec.
|
|
202
|
+
- **Observations tab** — renders the `Observation[]` array as a card-per-record list (id, title, markdown body). Card bodies flow through the same markdown renderer used by inventory and spec. An empty or absent array renders as an empty tab. A legacy prose-string payload renders as empty rather than corrupting the tab.
|
|
188
203
|
- **Deep linking** — supports `?plan=ID` query parameter to open directly to a plan's detail view.
|
|
189
204
|
|
|
190
|
-
Markdown fields (inventory,
|
|
205
|
+
Markdown fields (inventory, spec, and each observation body) are rendered client-side with a minimal renderer supporting headings, bold, italic, inline code, fenced code blocks, and lists. All content is HTML-escaped before rendering to prevent XSS.
|
package/dist/astrolabe.d.ts
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
import type { Plugin } from '@shardworks/nexus-core';
|
|
11
11
|
import type { AstrolabeConfig } from './types.ts';
|
|
12
12
|
declare function resolveAstrolabeConfig(): AstrolabeConfig;
|
|
13
|
+
/**
|
|
14
|
+
* Resolves the configured Patron Anima role name to a trimmed string, or
|
|
15
|
+
* returns the empty string when unset / whitespace-only. Callers branch on
|
|
16
|
+
* `=== ''` to distinguish the "no patron configured" case from the normal
|
|
17
|
+
* one. Shared by `astrolabe.patron-anima` (skip-when-unset no-op) and
|
|
18
|
+
* `astrolabe.reader-analyst` (selects between the solo and attended primer
|
|
19
|
+
* variants at engine-run time). Keeping the trim-and-check logic in one
|
|
20
|
+
* place avoids silent drift between the two call sites.
|
|
21
|
+
*/
|
|
22
|
+
declare function resolvePatronRole(): string;
|
|
13
23
|
export declare function createAstrolabe(): Plugin;
|
|
14
|
-
export { resolveAstrolabeConfig };
|
|
24
|
+
export { resolveAstrolabeConfig, resolvePatronRole };
|
|
15
25
|
//# sourceMappingURL=astrolabe.d.ts.map
|
package/dist/astrolabe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astrolabe.d.ts","sourceRoot":"","sources":["../src/astrolabe.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,wBAAwB,CAAC;AAQrE,OAAO,KAAK,EAEV,eAAe,EAGhB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"astrolabe.d.ts","sourceRoot":"","sources":["../src/astrolabe.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,wBAAwB,CAAC;AAQrE,OAAO,KAAK,EAEV,eAAe,EAGhB,MAAM,YAAY,CAAC;AAmBpB,iBAAS,sBAAsB,IAAI,eAAe,CAEjD;AAED;;;;;;;;GAQG;AACH,iBAAS,iBAAiB,IAAI,MAAM,CAGnC;AAID,wBAAgB,eAAe,IAAI,MAAM,CAySxC;AAGD,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/astrolabe.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { guild } from '@shardworks/nexus-core';
|
|
11
11
|
import { tool } from '@shardworks/tools-apparatus';
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
-
import { createPlanInitEngine, createInventoryCheckEngine, createPatronAnimaEngine, createDecisionReviewEngine, createSpecPublishEngine, createPlanFinalizeEngine, } from "./engines/index.js";
|
|
13
|
+
import { createPlanInitEngine, createInventoryCheckEngine, createPatronAnimaEngine, createDecisionReviewEngine, createSpecPublishEngine, createPlanFinalizeEngine, createObservationLiftEngine, createReaderAnalystEngine, } from "./engines/index.js";
|
|
14
14
|
import { twoPhaseRigTemplate } from "./two-phase-planning.js";
|
|
15
15
|
import { threePhaseRigTemplate } from "./three-phase-planning.js";
|
|
16
16
|
import { planAndShipRigTemplate } from "./plan-and-ship.js";
|
|
@@ -18,6 +18,19 @@ import { planAndShipRigTemplate } from "./plan-and-ship.js";
|
|
|
18
18
|
function resolveAstrolabeConfig() {
|
|
19
19
|
return guild().guildConfig().astrolabe ?? {};
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolves the configured Patron Anima role name to a trimmed string, or
|
|
23
|
+
* returns the empty string when unset / whitespace-only. Callers branch on
|
|
24
|
+
* `=== ''` to distinguish the "no patron configured" case from the normal
|
|
25
|
+
* one. Shared by `astrolabe.patron-anima` (skip-when-unset no-op) and
|
|
26
|
+
* `astrolabe.reader-analyst` (selects between the solo and attended primer
|
|
27
|
+
* variants at engine-run time). Keeping the trim-and-check logic in one
|
|
28
|
+
* place avoids silent drift between the two call sites.
|
|
29
|
+
*/
|
|
30
|
+
function resolvePatronRole() {
|
|
31
|
+
const config = resolveAstrolabeConfig();
|
|
32
|
+
return typeof config.patronRole === 'string' ? config.patronRole.trim() : '';
|
|
33
|
+
}
|
|
21
34
|
// ── Factory ──────────────────────────────────────────────────────────
|
|
22
35
|
export function createAstrolabe() {
|
|
23
36
|
let plansBook;
|
|
@@ -28,6 +41,8 @@ export function createAstrolabe() {
|
|
|
28
41
|
const decisionReviewEngine = createDecisionReviewEngine(() => plansBook);
|
|
29
42
|
const specPublishEngine = createSpecPublishEngine(() => plansBook);
|
|
30
43
|
const planFinalizeEngine = createPlanFinalizeEngine(() => plansBook);
|
|
44
|
+
const observationLiftEngine = createObservationLiftEngine(() => plansBook);
|
|
45
|
+
const readerAnalystEngine = createReaderAnalystEngine();
|
|
31
46
|
// ── API ────────────────────────────────────────────────────────
|
|
32
47
|
const api = {
|
|
33
48
|
async show(planId) {
|
|
@@ -165,12 +180,22 @@ export function createAstrolabe() {
|
|
|
165
180
|
});
|
|
166
181
|
const observationsWriteTool = tool({
|
|
167
182
|
name: 'observations-write',
|
|
168
|
-
description: 'Write
|
|
169
|
-
instructions: 'Writes or replaces the observations field. The observations
|
|
170
|
-
'
|
|
183
|
+
description: 'Write primer observations for a plan',
|
|
184
|
+
instructions: 'Writes or replaces the observations field. The observations array carries one record ' +
|
|
185
|
+
'per atomic concern noticed during the planning pass. Each record has a plandoc-local ' +
|
|
186
|
+
'id (convention: obs-1, obs-2, ...), a one-line commission-title style title, and a ' +
|
|
187
|
+
'markdown body with tactical detail (file paths, symbols, preconditions). Downstream ' +
|
|
188
|
+
'the astrolabe.observation-lift engine creates one draft brief writ per record as a ' +
|
|
189
|
+
'child of the originating brief, ready for a curator to promote.',
|
|
171
190
|
params: {
|
|
172
191
|
planId: z.string().describe('Plan id'),
|
|
173
|
-
observations: z
|
|
192
|
+
observations: z
|
|
193
|
+
.array(z.object({
|
|
194
|
+
id: z.string().min(1),
|
|
195
|
+
title: z.string().min(1),
|
|
196
|
+
body: z.string().min(1),
|
|
197
|
+
}))
|
|
198
|
+
.describe('Observation records'),
|
|
174
199
|
},
|
|
175
200
|
permission: 'write',
|
|
176
201
|
handler: async ({ planId, observations }) => {
|
|
@@ -205,25 +230,30 @@ export function createAstrolabe() {
|
|
|
205
230
|
{ name: 'piece', description: 'An atomic task piece within a mandate, executed sequentially' },
|
|
206
231
|
],
|
|
207
232
|
roles: {
|
|
208
|
-
'sage-reader': {
|
|
233
|
+
'sage-primer-reader': {
|
|
209
234
|
permissions: ['astrolabe:read', 'astrolabe:write', 'clerk:read', 'ratchet:read'],
|
|
210
235
|
strict: true,
|
|
211
|
-
instructionsFile: 'sage-reader.md',
|
|
236
|
+
instructionsFile: 'sage-primer-reader.md',
|
|
212
237
|
},
|
|
213
|
-
'sage-
|
|
238
|
+
'sage-primer-scoping': {
|
|
214
239
|
permissions: ['astrolabe:read', 'astrolabe:write', 'clerk:read', 'ratchet:read'],
|
|
215
240
|
strict: true,
|
|
216
|
-
instructionsFile: 'sage-
|
|
241
|
+
instructionsFile: 'sage-primer-scoping.md',
|
|
217
242
|
},
|
|
218
243
|
'sage-writer': {
|
|
219
244
|
permissions: ['astrolabe:read', 'astrolabe:write', 'clerk:read', 'ratchet:read'],
|
|
220
245
|
strict: true,
|
|
221
246
|
instructionsFile: 'sage-writer.md',
|
|
222
247
|
},
|
|
223
|
-
'sage-
|
|
248
|
+
'sage-primer-solo': {
|
|
249
|
+
permissions: ['astrolabe:read', 'astrolabe:write', 'clerk:read', 'ratchet:read'],
|
|
250
|
+
strict: true,
|
|
251
|
+
instructionsFile: 'sage-primer-solo.md',
|
|
252
|
+
},
|
|
253
|
+
'sage-primer-attended': {
|
|
224
254
|
permissions: ['astrolabe:read', 'astrolabe:write', 'clerk:read', 'ratchet:read'],
|
|
225
255
|
strict: true,
|
|
226
|
-
instructionsFile: 'sage-
|
|
256
|
+
instructionsFile: 'sage-primer-attended.md',
|
|
227
257
|
},
|
|
228
258
|
},
|
|
229
259
|
engines: {
|
|
@@ -233,6 +263,8 @@ export function createAstrolabe() {
|
|
|
233
263
|
'astrolabe.decision-review': decisionReviewEngine,
|
|
234
264
|
'astrolabe.spec-publish': specPublishEngine,
|
|
235
265
|
'astrolabe.plan-finalize': planFinalizeEngine,
|
|
266
|
+
'astrolabe.observation-lift': observationLiftEngine,
|
|
267
|
+
'astrolabe.reader-analyst': readerAnalystEngine,
|
|
236
268
|
},
|
|
237
269
|
rigTemplates: {
|
|
238
270
|
'two-phase-planning': twoPhaseRigTemplate,
|
|
@@ -263,6 +295,6 @@ export function createAstrolabe() {
|
|
|
263
295
|
},
|
|
264
296
|
};
|
|
265
297
|
}
|
|
266
|
-
// Export resolveAstrolabeConfig for external use (lazy config access)
|
|
267
|
-
export { resolveAstrolabeConfig };
|
|
298
|
+
// Export resolveAstrolabeConfig / resolvePatronRole for external use (lazy config access)
|
|
299
|
+
export { resolveAstrolabeConfig, resolvePatronRole };
|
|
268
300
|
//# sourceMappingURL=astrolabe.js.map
|
package/dist/astrolabe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astrolabe.js","sourceRoot":"","sources":["../src/astrolabe.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAInD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"astrolabe.js","sourceRoot":"","sources":["../src/astrolabe.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAInD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,wEAAwE;AAExE,SAAS,sBAAsB;IAC7B,OAAO,KAAK,EAAE,CAAC,WAAW,EAAE,CAAC,SAAS,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,iBAAiB;IACxB,MAAM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,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,iBAAiB,EAAE;iBAChE;aACF;YAED,QAAQ,EAAE,GAAG;YAEb,KAAK,CAAC,IAAoB;gBACxB,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC,SAAS,CAAY,QAAQ,CAAC,CAAC;gBACtD,SAAS,GAAG,MAAM,CAAC,IAAI,CAAU,WAAW,EAAE,OAAO,CAAC,CAAC;YACzD,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAED,0FAA0F;AAC1F,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -69,13 +69,13 @@ export function createDecisionReviewEngine(getPlansBook) {
|
|
|
69
69
|
if (plan.status === 'analyzing') {
|
|
70
70
|
const decisions = plan.decisions ?? [];
|
|
71
71
|
const scopeItems = plan.scope ?? [];
|
|
72
|
-
// Reviewable decisions are those the
|
|
73
|
-
// leaving `selected` unset. Pre-decided decisions (where the
|
|
72
|
+
// Reviewable decisions are those the primer left for the patron by
|
|
73
|
+
// leaving `selected` unset. Pre-decided decisions (where the primer
|
|
74
74
|
// already pre-filled `selected`) are auto-accepted — they skip the
|
|
75
75
|
// InputRequestDoc entirely and flow through reconcile unchanged.
|
|
76
76
|
const reviewableDecisions = decisions.filter(d => d.selected === undefined);
|
|
77
77
|
// Fast-path: nothing is reviewable. Scope items are implicitly
|
|
78
|
-
// auto-accepted in that case — the
|
|
78
|
+
// auto-accepted in that case — the primer has settled everything.
|
|
79
79
|
if (reviewableDecisions.length === 0) {
|
|
80
80
|
await book.patch(planId, {
|
|
81
81
|
status: 'writing',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision-review.js","sourceRoot":"","sources":["../../src/engines/decision-review.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAc3D,wEAAwE;AAExE,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CAAC,CAAC;oBACnD,MAAM,IAAI,KAAK,CACb,4EAA4E;wBAC1E,6BAA6B,GAAG,EAAE,CACrC,CAAC;gBACJ,CAAC;gBAED,MAAM,eAAe,GAAG,oBAAoB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;gBAEpE,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;gBACrC,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;oBACvB,SAAS;oBACT,KAAK,EAAE,UAAU;oBACjB,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,GAAG;iBACf,CAAC,CAAC;gBAEH,OAAO;oBACL,MAAM,EAAE,WAAW;oBACnB,MAAM,EAAE,EAAE,eAAe,EAAE;iBAC5B,CAAC;YACJ,CAAC;YAED,MAAM,IAAI,KAAK,CACb,4CAA4C,IAAI,CAAC,MAAM,eAAe,MAAM,KAAK;gBAC/E,sCAAsC,CACzC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/engines/index.d.ts
CHANGED
|
@@ -4,4 +4,6 @@ export { createPatronAnimaEngine } from './patron-anima.ts';
|
|
|
4
4
|
export { createDecisionReviewEngine } from './decision-review.ts';
|
|
5
5
|
export { createSpecPublishEngine } from './spec-publish.ts';
|
|
6
6
|
export { createPlanFinalizeEngine } from './plan-finalize.ts';
|
|
7
|
+
export { createObservationLiftEngine } from './observation-lift.ts';
|
|
8
|
+
export { createReaderAnalystEngine, selectPrimerRole, PRIMER_ATTENDED_ROLE, PRIMER_SOLO_ROLE, } from './reader-analyst.ts';
|
|
7
9
|
//# 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,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
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,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC"}
|
package/dist/engines/index.js
CHANGED
|
@@ -4,4 +4,6 @@ export { createPatronAnimaEngine } from "./patron-anima.js";
|
|
|
4
4
|
export { createDecisionReviewEngine } from "./decision-review.js";
|
|
5
5
|
export { createSpecPublishEngine } from "./spec-publish.js";
|
|
6
6
|
export { createPlanFinalizeEngine } from "./plan-finalize.js";
|
|
7
|
+
export { createObservationLiftEngine } from "./observation-lift.js";
|
|
8
|
+
export { createReaderAnalystEngine, selectPrimerRole, PRIMER_ATTENDED_ROLE, PRIMER_SOLO_ROLE, } from "./reader-analyst.js";
|
|
7
9
|
//# 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,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
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,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Validates that the reader stage produced a non-empty inventory on the PlanDoc.
|
|
5
5
|
* Throws if the plan is missing or has no inventory content.
|
|
6
6
|
* On success, transitions the plan status from 'reading' to 'analyzing' so the
|
|
7
|
-
*
|
|
7
|
+
* scoping-primer stage and subsequent decision-review engine can proceed.
|
|
8
8
|
*/
|
|
9
9
|
import type { EngineDesign } from '@shardworks/fabricator-apparatus';
|
|
10
10
|
import type { Book } from '@shardworks/stacks-apparatus';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Validates that the reader stage produced a non-empty inventory on the PlanDoc.
|
|
5
5
|
* Throws if the plan is missing or has no inventory content.
|
|
6
6
|
* On success, transitions the plan status from 'reading' to 'analyzing' so the
|
|
7
|
-
*
|
|
7
|
+
* scoping-primer stage and subsequent decision-review engine can proceed.
|
|
8
8
|
*/
|
|
9
9
|
export function createInventoryCheckEngine(getPlansBook) {
|
|
10
10
|
return {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* observation-lift clockwork engine.
|
|
3
|
+
*
|
|
4
|
+
* Walks the plan's `observations` array once it has reached its final
|
|
5
|
+
* state and creates one draft brief writ per record as a child of the
|
|
6
|
+
* originating brief. This turns the sage's "things we noticed but
|
|
7
|
+
* didn't action" output from an inert note into commissionable drafts
|
|
8
|
+
* visible in the same writ surfaces as any other brief — a downstream
|
|
9
|
+
* curator (human or automated) promotes each draft to `open` by hand
|
|
10
|
+
* or via writ-publish.
|
|
11
|
+
*
|
|
12
|
+
* Behavior:
|
|
13
|
+
* - Validates that the plan exists and its status is `completed`.
|
|
14
|
+
* (Placement inside each rig guarantees this — observation-lift
|
|
15
|
+
* runs after plan-finalize / spec-publish, which transition the
|
|
16
|
+
* plan to `completed`.)
|
|
17
|
+
* - Silently no-ops if `plan.observations` is not an array (legacy
|
|
18
|
+
* string-shaped plandocs) or is an empty array.
|
|
19
|
+
* - Otherwise, iterates the array in order and calls
|
|
20
|
+
* `clerk.post({ type: 'brief', title, body, codex, parentId, draft })`
|
|
21
|
+
* once per record. The brief writ must still be in a non-terminal
|
|
22
|
+
* phase at this point — in all three rigs the engine runs before
|
|
23
|
+
* seal, which is what finally transitions the brief to `completed`.
|
|
24
|
+
* - Fails fast on the first `clerk.post` error. Already-created
|
|
25
|
+
* drafts persist as `new`-status writs under the brief; they are
|
|
26
|
+
* invisible to the Spider until a curator publishes them.
|
|
27
|
+
* - Does not mutate the plandoc — the parentId relationship on the
|
|
28
|
+
* created writs is the sole audit trail.
|
|
29
|
+
*
|
|
30
|
+
* Yields:
|
|
31
|
+
* `{ writIds }` — the ids of the draft writs created, in the same
|
|
32
|
+
* order as the observation records. Empty when the engine no-ops.
|
|
33
|
+
*/
|
|
34
|
+
import type { EngineDesign } from '@shardworks/fabricator-apparatus';
|
|
35
|
+
import type { Book } from '@shardworks/stacks-apparatus';
|
|
36
|
+
import type { PlanDoc } from '../types.ts';
|
|
37
|
+
export declare function createObservationLiftEngine(getPlansBook: () => Book<PlanDoc>): EngineDesign;
|
|
38
|
+
//# sourceMappingURL=observation-lift.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observation-lift.d.ts","sourceRoot":"","sources":["../../src/engines/observation-lift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;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,2BAA2B,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,YAAY,CAuD3F"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* observation-lift clockwork engine.
|
|
3
|
+
*
|
|
4
|
+
* Walks the plan's `observations` array once it has reached its final
|
|
5
|
+
* state and creates one draft brief writ per record as a child of the
|
|
6
|
+
* originating brief. This turns the sage's "things we noticed but
|
|
7
|
+
* didn't action" output from an inert note into commissionable drafts
|
|
8
|
+
* visible in the same writ surfaces as any other brief — a downstream
|
|
9
|
+
* curator (human or automated) promotes each draft to `open` by hand
|
|
10
|
+
* or via writ-publish.
|
|
11
|
+
*
|
|
12
|
+
* Behavior:
|
|
13
|
+
* - Validates that the plan exists and its status is `completed`.
|
|
14
|
+
* (Placement inside each rig guarantees this — observation-lift
|
|
15
|
+
* runs after plan-finalize / spec-publish, which transition the
|
|
16
|
+
* plan to `completed`.)
|
|
17
|
+
* - Silently no-ops if `plan.observations` is not an array (legacy
|
|
18
|
+
* string-shaped plandocs) or is an empty array.
|
|
19
|
+
* - Otherwise, iterates the array in order and calls
|
|
20
|
+
* `clerk.post({ type: 'brief', title, body, codex, parentId, draft })`
|
|
21
|
+
* once per record. The brief writ must still be in a non-terminal
|
|
22
|
+
* phase at this point — in all three rigs the engine runs before
|
|
23
|
+
* seal, which is what finally transitions the brief to `completed`.
|
|
24
|
+
* - Fails fast on the first `clerk.post` error. Already-created
|
|
25
|
+
* drafts persist as `new`-status writs under the brief; they are
|
|
26
|
+
* invisible to the Spider until a curator publishes them.
|
|
27
|
+
* - Does not mutate the plandoc — the parentId relationship on the
|
|
28
|
+
* created writs is the sole audit trail.
|
|
29
|
+
*
|
|
30
|
+
* Yields:
|
|
31
|
+
* `{ writIds }` — the ids of the draft writs created, in the same
|
|
32
|
+
* order as the observation records. Empty when the engine no-ops.
|
|
33
|
+
*/
|
|
34
|
+
import { guild } from '@shardworks/nexus-core';
|
|
35
|
+
export function createObservationLiftEngine(getPlansBook) {
|
|
36
|
+
return {
|
|
37
|
+
id: 'astrolabe.observation-lift',
|
|
38
|
+
async run(givens, _context) {
|
|
39
|
+
const planId = givens.planId;
|
|
40
|
+
const book = getPlansBook();
|
|
41
|
+
const plan = await book.get(planId);
|
|
42
|
+
if (!plan) {
|
|
43
|
+
throw new Error(`Plan "${planId}" not found.`);
|
|
44
|
+
}
|
|
45
|
+
if (plan.status !== 'completed') {
|
|
46
|
+
throw new Error(`observation-lift: expected plan status "completed" but got "${plan.status}" for plan "${planId}".`);
|
|
47
|
+
}
|
|
48
|
+
const observations = plan.observations;
|
|
49
|
+
if (!Array.isArray(observations) || observations.length === 0) {
|
|
50
|
+
// Legacy string-shaped plandocs or empty arrays: no-op.
|
|
51
|
+
return {
|
|
52
|
+
status: 'completed',
|
|
53
|
+
yields: { writIds: [] },
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const clerk = guild().apparatus('clerk');
|
|
57
|
+
const writIds = [];
|
|
58
|
+
for (const observation of observations) {
|
|
59
|
+
// Fail-fast: any clerk.post error propagates immediately.
|
|
60
|
+
// Previously-created drafts persist (invisible to Spider) and
|
|
61
|
+
// a curator can reconcile manually — rollback is not attempted.
|
|
62
|
+
const writ = await clerk.post({
|
|
63
|
+
type: 'brief',
|
|
64
|
+
title: observation.title,
|
|
65
|
+
body: observation.body,
|
|
66
|
+
codex: plan.codex,
|
|
67
|
+
parentId: planId,
|
|
68
|
+
draft: true,
|
|
69
|
+
});
|
|
70
|
+
writIds.push(writ.id);
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
status: 'completed',
|
|
74
|
+
yields: { writIds },
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=observation-lift.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observation-lift.js","sourceRoot":"","sources":["../../src/engines/observation-lift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAM/C,MAAM,UAAU,2BAA2B,CAAC,YAAiC;IAC3E,OAAO;QACL,EAAE,EAAE,4BAA4B;QAEhC,KAAK,CAAC,GAAG,CACP,MAA+B,EAC/B,QAA0B;YAE1B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAgB,CAAC;YACvC,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;YAE5B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACpC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CAAC,SAAS,MAAM,cAAc,CAAC,CAAC;YACjD,CAAC;YAED,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW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