@shardworks/spider-apparatus 0.1.270 → 0.1.271
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 +58 -25
- package/dist/block-types/animator-paused.d.ts.map +1 -1
- package/dist/block-types/animator-paused.js +15 -10
- package/dist/block-types/animator-paused.js.map +1 -1
- package/dist/engines/anima-session.d.ts.map +1 -1
- package/dist/engines/anima-session.js +4 -0
- package/dist/engines/anima-session.js.map +1 -1
- package/dist/engines/implement-loop.d.ts +6 -6
- package/dist/engines/implement-loop.js +26 -26
- package/dist/engines/implement-loop.js.map +1 -1
- package/dist/engines/implement.d.ts.map +1 -1
- package/dist/engines/implement.js +3 -0
- package/dist/engines/implement.js.map +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/review.d.ts.map +1 -1
- package/dist/engines/review.js +3 -0
- package/dist/engines/review.js.map +1 -1
- package/dist/engines/revise.d.ts.map +1 -1
- package/dist/engines/revise.js +3 -0
- package/dist/engines/revise.js.map +1 -1
- package/dist/engines/step-session.d.ts +32 -0
- package/dist/engines/step-session.d.ts.map +1 -0
- package/dist/engines/{piece-session.js → step-session.js} +70 -62
- package/dist/engines/step-session.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/rig-view.d.ts +5 -0
- package/dist/rig-view.d.ts.map +1 -1
- package/dist/rig-view.js +11 -2
- package/dist/rig-view.js.map +1 -1
- package/dist/spider-test-fixture.d.ts +116 -0
- package/dist/spider-test-fixture.d.ts.map +1 -0
- package/dist/spider-test-fixture.js +386 -0
- package/dist/spider-test-fixture.js.map +1 -0
- package/dist/spider.d.ts.map +1 -1
- package/dist/spider.js +913 -540
- package/dist/spider.js.map +1 -1
- package/dist/tools/crawl-continual.d.ts +10 -0
- package/dist/tools/crawl-continual.d.ts.map +1 -1
- package/dist/tools/crawl-continual.js +24 -9
- package/dist/tools/crawl-continual.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/rig-list.d.ts +2 -1
- package/dist/tools/rig-list.d.ts.map +1 -1
- package/dist/tools/rig-list.js +9 -2
- package/dist/tools/rig-list.js.map +1 -1
- package/dist/tools/rig-show.d.ts +9 -3
- package/dist/tools/rig-show.d.ts.map +1 -1
- package/dist/tools/rig-show.js +84 -5
- package/dist/tools/rig-show.js.map +1 -1
- package/dist/tools/writ-rescue-stuck.d.ts +40 -0
- package/dist/tools/writ-rescue-stuck.d.ts.map +1 -0
- package/dist/tools/writ-rescue-stuck.js +362 -0
- package/dist/tools/writ-rescue-stuck.js.map +1 -0
- package/dist/types.d.ts +233 -92
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/static/index.html +6 -5
- package/src/static/spider-ui.test.ts +437 -28
- package/src/static/spider.js +238 -80
- package/dist/engines/piece-session.d.ts +0 -32
- package/dist/engines/piece-session.d.ts.map +0 -1
- package/dist/engines/piece-session.js.map +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Step-session engine — quick (Animator-backed).
|
|
3
3
|
*
|
|
4
|
-
* Launches an anima session for a single
|
|
5
|
-
* the mandate body with the
|
|
4
|
+
* Launches an anima session for a single step writ. The prompt combines
|
|
5
|
+
* the mandate body with the step body and step-specific execution
|
|
6
6
|
* instructions.
|
|
7
7
|
*
|
|
8
8
|
* Custom collect():
|
|
9
|
-
* - On session completion → transitions the
|
|
10
|
-
* - After collecting, checks for dynamically added child
|
|
11
|
-
* mandate and grafts new
|
|
9
|
+
* - On session completion → transitions the step writ to 'completed'.
|
|
10
|
+
* - After collecting, checks for dynamically added child steps of the
|
|
11
|
+
* mandate and grafts new step-session engines for them.
|
|
12
12
|
*
|
|
13
13
|
* Note on failure: Spider's tryCollect() calls failEngine() directly for
|
|
14
|
-
* failed/timeout sessions and never invokes collect().
|
|
14
|
+
* failed/timeout sessions and never invokes collect(). Step writ failure
|
|
15
15
|
* relies on Clerk's parent/child cascade when the mandate reaches a
|
|
16
|
-
* terminal state (stuck → child
|
|
16
|
+
* terminal state (stuck → child steps get cancelled).
|
|
17
17
|
*
|
|
18
18
|
* Givens:
|
|
19
19
|
* - writ: WritDoc (the mandate writ)
|
|
20
|
-
* -
|
|
20
|
+
* - step: WritDoc (the step writ for this task)
|
|
21
21
|
* - role: string
|
|
22
22
|
* - cwd: string (draft worktree path)
|
|
23
23
|
*/
|
|
@@ -28,42 +28,50 @@ import { guild } from '@shardworks/nexus-core';
|
|
|
28
28
|
* failed) — in which case the failed transition is expected (the cascade or
|
|
29
29
|
* another path beat us to it) and should be swallowed silently.
|
|
30
30
|
*
|
|
31
|
-
* Matches the wording produced by Clerk's `transition()` guard
|
|
32
|
-
*
|
|
31
|
+
* Matches the wording produced by Clerk's `transition()` guard. Both the
|
|
32
|
+
* pre-T2 and post-T2 error shapes are recognised so this classifier keeps
|
|
33
|
+
* working across the writ-type-config refactor:
|
|
34
|
+
* pre-T2: `Cannot transition writ "…" to "completed": phase is "cancelled", …`
|
|
35
|
+
* post-T2: `Cannot transition writ "…" from "cancelled" to "completed": legal transitions from "cancelled" are none (terminal state).`
|
|
33
36
|
* Also tolerates future phrasing like "already terminal".
|
|
34
37
|
*/
|
|
35
38
|
function isAlreadyTerminalTransitionError(err) {
|
|
36
39
|
const message = err instanceof Error ? err.message : String(err);
|
|
37
40
|
if (message.includes('already terminal'))
|
|
38
41
|
return true;
|
|
42
|
+
// Post-T2 strict-transition wording — `none (terminal state)` is emitted
|
|
43
|
+
// exactly when the writ's current state is terminal and has no outbound
|
|
44
|
+
// transitions, which is the race condition this guard is meant to swallow.
|
|
45
|
+
if (message.includes('none (terminal state)'))
|
|
46
|
+
return true;
|
|
39
47
|
return (message.includes('phase is "cancelled"') ||
|
|
40
48
|
message.includes('phase is "completed"') ||
|
|
41
49
|
message.includes('phase is "failed"'));
|
|
42
50
|
}
|
|
43
51
|
/**
|
|
44
|
-
* Execution instructions for
|
|
45
|
-
* task — no manifest traversal, commit-per-
|
|
52
|
+
* Execution instructions for step sessions. Focuses the anima on a single
|
|
53
|
+
* task — no manifest traversal, commit-per-step guidance.
|
|
46
54
|
*/
|
|
47
|
-
export const
|
|
55
|
+
export const STEP_EXECUTION_EPILOGUE = `
|
|
48
56
|
You are working on a single task from a larger mandate. Focus exclusively on this task.
|
|
49
57
|
|
|
50
58
|
Instructions:
|
|
51
59
|
1. Complete the task described in the <task> element below the specification.
|
|
52
60
|
2. If the task has a <verify> command, run it after completing the work and confirm the <done> criterion is met.
|
|
53
61
|
3. The <files> element (if present) is the planner's predicted blast radius — useful for orientation, but verify scope independently.
|
|
54
|
-
4. If you discover additional work needed beyond this task, use the
|
|
62
|
+
4. If you discover additional work needed beyond this task, use the step-add tool to create new tasks rather than doing them inline.
|
|
55
63
|
5. Commit all changes before ending your session.`;
|
|
56
|
-
const
|
|
57
|
-
id: '
|
|
64
|
+
const stepSessionEngine = {
|
|
65
|
+
id: 'step-session',
|
|
58
66
|
async run(givens, context) {
|
|
59
67
|
const animator = guild().apparatus('animator');
|
|
60
68
|
const mandateWrit = givens.writ;
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
63
|
-
throw new Error('
|
|
69
|
+
const step = givens.step;
|
|
70
|
+
if (!step) {
|
|
71
|
+
throw new Error('step-session engine requires a "step" given (WritDoc).');
|
|
64
72
|
}
|
|
65
|
-
// Assemble prompt: mandate body +
|
|
66
|
-
const prompt = `${mandateWrit.body}\n\n---\n\n## Current Task\n\nMandate ID: ${mandateWrit.id}\n\n${
|
|
73
|
+
// Assemble prompt: mandate body + step body + step-specific epilogue
|
|
74
|
+
const prompt = `${mandateWrit.body}\n\n---\n\n## Current Task\n\nMandate ID: ${mandateWrit.id}\n\n${step.body}\n${STEP_EXECUTION_EPILOGUE}`;
|
|
67
75
|
const handle = animator.summon({
|
|
68
76
|
role: givens.role,
|
|
69
77
|
prompt,
|
|
@@ -72,7 +80,7 @@ const pieceSessionEngine = {
|
|
|
72
80
|
metadata: {
|
|
73
81
|
engineId: context.engineId,
|
|
74
82
|
writId: mandateWrit.id,
|
|
75
|
-
|
|
83
|
+
stepId: step.id,
|
|
76
84
|
},
|
|
77
85
|
});
|
|
78
86
|
return { status: 'launched', sessionId: handle.sessionId };
|
|
@@ -84,86 +92,86 @@ const pieceSessionEngine = {
|
|
|
84
92
|
const clerk = guild().apparatus('clerk');
|
|
85
93
|
const sessionsBook = stacks.readBook('animator', 'sessions');
|
|
86
94
|
const session = await sessionsBook.get(sessionId);
|
|
87
|
-
const
|
|
95
|
+
const step = givens.step;
|
|
88
96
|
const mandateWrit = givens.writ;
|
|
89
|
-
if (!
|
|
97
|
+
if (!step || !mandateWrit) {
|
|
90
98
|
// Fallback: return generic yields if givens are missing
|
|
91
99
|
return {
|
|
92
100
|
sessionId,
|
|
93
101
|
sessionStatus: session?.status ?? 'completed',
|
|
94
102
|
};
|
|
95
103
|
}
|
|
96
|
-
// Completed session → mark
|
|
104
|
+
// Completed session → mark step completed.
|
|
97
105
|
//
|
|
98
|
-
// The transition may fail if the
|
|
106
|
+
// The transition may fail if the step writ is already in a terminal
|
|
99
107
|
// state (e.g. Clerk's downward cascade beat us to it after a sibling
|
|
100
108
|
// failure). Classify the error: already-terminal is expected and silent;
|
|
101
109
|
// anything else is a genuine bookkeeping failure that must be surfaced
|
|
102
110
|
// via a warning so the race is visible in logs.
|
|
103
111
|
try {
|
|
104
|
-
await clerk.transition(
|
|
112
|
+
await clerk.transition(step.id, 'completed', {
|
|
105
113
|
resolution: 'Task completed',
|
|
106
114
|
});
|
|
107
115
|
}
|
|
108
116
|
catch (err) {
|
|
109
117
|
if (!isAlreadyTerminalTransitionError(err)) {
|
|
110
118
|
const message = err instanceof Error ? err.message : String(err);
|
|
111
|
-
console.warn(`[
|
|
119
|
+
console.warn(`[step-session] Unexpected error transitioning step "${step.id}" ` +
|
|
112
120
|
`to completed: ${message}`);
|
|
113
121
|
}
|
|
114
|
-
// Swallow — collect() must not throw. The current
|
|
122
|
+
// Swallow — collect() must not throw. The current step writ status
|
|
115
123
|
// will be observed below and included in yields so downstream
|
|
116
124
|
// consumers can see the actual outcome.
|
|
117
125
|
}
|
|
118
|
-
// Re-read the
|
|
126
|
+
// Re-read the step writ after the transition attempt so yields reflect
|
|
119
127
|
// the observed, authoritative phase — whether the transition succeeded
|
|
120
128
|
// or was caught as already-terminal.
|
|
121
|
-
let
|
|
129
|
+
let observedStepPhase;
|
|
122
130
|
try {
|
|
123
|
-
const
|
|
124
|
-
|
|
131
|
+
const observedStep = await clerk.show(step.id);
|
|
132
|
+
observedStepPhase = observedStep.phase;
|
|
125
133
|
}
|
|
126
134
|
catch {
|
|
127
135
|
// Writ lookup failure should not propagate out of collect(). Leave
|
|
128
|
-
//
|
|
136
|
+
// observedStepPhase undefined so yields omit the field entirely.
|
|
129
137
|
}
|
|
130
|
-
// ── Dynamic
|
|
131
|
-
// Check for dynamically added child
|
|
132
|
-
// Graft new
|
|
138
|
+
// ── Dynamic step pickup ──────────────────────────────────────────
|
|
139
|
+
// Check for dynamically added child steps that don't yet have engines.
|
|
140
|
+
// Graft new step-session engines for them so they run after this step.
|
|
133
141
|
const openChildren = await clerk.list({
|
|
134
142
|
parentId: mandateWrit.id,
|
|
135
|
-
type: '
|
|
143
|
+
type: 'step',
|
|
136
144
|
phase: 'open',
|
|
137
145
|
limit: 50,
|
|
138
146
|
});
|
|
139
|
-
// Determine which
|
|
147
|
+
// Determine which step IDs already have engines in the rig
|
|
140
148
|
const rigsBook = stacks.readBook('spider', 'rigs');
|
|
141
149
|
const rig = await rigsBook.get(context.rigId);
|
|
142
|
-
const
|
|
150
|
+
const existingStepIds = new Set();
|
|
143
151
|
if (rig) {
|
|
144
152
|
for (const engine of rig.engines) {
|
|
145
|
-
//
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
|
|
153
|
+
// Step engines have a literal step object in givensSpec
|
|
154
|
+
const engineStep = engine.givensSpec?.step;
|
|
155
|
+
if (engineStep?.id) {
|
|
156
|
+
existingStepIds.add(engineStep.id);
|
|
149
157
|
}
|
|
150
158
|
}
|
|
151
159
|
}
|
|
152
|
-
// Filter to
|
|
153
|
-
const
|
|
154
|
-
// Build graft entries for new
|
|
160
|
+
// Filter to steps that don't already have engines
|
|
161
|
+
const newSteps = openChildren.filter(c => !existingStepIds.has(c.id));
|
|
162
|
+
// Build graft entries for new steps with sequential dependencies
|
|
155
163
|
const graft = [];
|
|
156
164
|
let previousEngineId = context.engineId; // chain starts after this engine
|
|
157
|
-
for (let i = 0; i <
|
|
158
|
-
const
|
|
159
|
-
const engineId = `
|
|
165
|
+
for (let i = 0; i < newSteps.length; i++) {
|
|
166
|
+
const newStep = newSteps[i];
|
|
167
|
+
const engineId = `step-${newStep.id}`;
|
|
160
168
|
graft.push({
|
|
161
169
|
id: engineId,
|
|
162
|
-
designId: '
|
|
170
|
+
designId: 'step-session',
|
|
163
171
|
upstream: [previousEngineId],
|
|
164
172
|
givens: {
|
|
165
173
|
writ: '${writ}',
|
|
166
|
-
|
|
174
|
+
step: newStep, // literal WritDoc — survives resolveGivens/resolveYieldRefs
|
|
167
175
|
role: givens.role,
|
|
168
176
|
cwd: `\${yields.draft.path}`,
|
|
169
177
|
},
|
|
@@ -173,20 +181,20 @@ const pieceSessionEngine = {
|
|
|
173
181
|
const yields = {
|
|
174
182
|
sessionId,
|
|
175
183
|
sessionStatus: session?.status ?? 'completed',
|
|
176
|
-
|
|
177
|
-
...(
|
|
184
|
+
stepId: step.id,
|
|
185
|
+
...(observedStepPhase !== undefined ? { stepStatus: observedStepPhase } : {}),
|
|
178
186
|
...(session?.output !== undefined ? { output: session.output } : {}),
|
|
179
|
-
...(
|
|
187
|
+
...(newSteps.length > 0 ? { dynamicStepIds: newSteps.map(p => p.id) } : {}),
|
|
180
188
|
};
|
|
181
189
|
if (graft.length > 0) {
|
|
182
|
-
// graftTail ensures engines downstream of this
|
|
183
|
-
// next
|
|
184
|
-
// also wait for all dynamically added
|
|
185
|
-
const graftTail = `
|
|
190
|
+
// graftTail ensures engines downstream of this step-session (e.g. the
|
|
191
|
+
// next step in the original chain, or seal via the original graftTail)
|
|
192
|
+
// also wait for all dynamically added steps to complete.
|
|
193
|
+
const graftTail = `step-${newSteps[newSteps.length - 1].id}`;
|
|
186
194
|
return { yields, graft, graftTail };
|
|
187
195
|
}
|
|
188
196
|
return yields;
|
|
189
197
|
},
|
|
190
198
|
};
|
|
191
|
-
export default
|
|
192
|
-
//# sourceMappingURL=
|
|
199
|
+
export default stepSessionEngine;
|
|
200
|
+
//# sourceMappingURL=step-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-session.js","sourceRoot":"","sources":["../../src/engines/step-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAO/C;;;;;;;;;;;;GAYG;AACH,SAAS,gCAAgC,CAAC,GAAY;IACpD,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,IAAI,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,yEAAyE;IACzE,wEAAwE;IACxE,2EAA2E;IAC3E,IAAI,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3D,OAAO,CACL,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACxC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACxC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,C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;YACzD,MAAM,SAAS,GAAG,QAAQ,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,EAAE,EAAE,CAAC;YAC9D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAgC,CAAC;QACpE,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Public types (RigDoc, EngineInstance, CrawlResult, SpiderApi, etc.) are
|
|
8
8
|
* re-exported for consumers that inspect walk results or rig state.
|
|
9
9
|
*/
|
|
10
|
-
export type { EngineStatus, EngineInstance, RigStatus, RigDoc, RigView, RigCostSummary, EngineCostSummary, RigFilters, CrawlResult, SpiderApi, SpiderConfig,
|
|
10
|
+
export type { EngineStatus, EngineAttempt, EngineInstance, EngineRetryConfig, EngineRetryBackoffConfig, RigStatus, RigDoc, RigView, RigCostSummary, EngineCostSummary, RigFilters, CrawlResult, SpiderApi, SpiderConfig, BlockType, BlockTypeInfo, CheckResult, DraftYields, SealYields, RigTemplate, RigTemplateEngine, RigTemplateInfo, SpiderEngineRunResult, SpiderCollectResult, InputRequestStatus, InputRequestDoc, ChoiceQuestionSpec, BooleanQuestionSpec, TextQuestionSpec, QuestionSpec, ChoiceAnswer, AnswerValue, SpiderStuckCause, SpiderWritStatus, } from './types.ts';
|
|
11
11
|
export type { SpiderKit } from './spider.ts';
|
|
12
12
|
/**
|
|
13
13
|
* Create a fresh Spider apparatus plugin instance.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,YAAY,EACV,YAAY,EACZ,cAAc,EACd,SAAS,EACT,MAAM,EACN,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,YAAY,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,SAAS,EACT,MAAM,EACN,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,SAAS,EACT,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;;AAI3C,wBAA8B"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA2C3C,yEAAyE;AAEzE;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,yEAAyE;AAEzE,eAAe,YAAY,EAAE,CAAC"}
|
package/dist/rig-view.d.ts
CHANGED
|
@@ -26,6 +26,11 @@ import type { RigDoc, RigView } from './types.ts';
|
|
|
26
26
|
* snapshots of every engine's session (if any) and summing across them.
|
|
27
27
|
*
|
|
28
28
|
* Does not mutate the rig. Safe to call on every read.
|
|
29
|
+
*
|
|
30
|
+
* Per-engine `sessionId` is read from the engine's latest attempt
|
|
31
|
+
* (`attempts[-1].sessionId`) — the engine no longer carries a scalar
|
|
32
|
+
* `sessionId` field. Earlier attempts' sessions (pre-retry) are not
|
|
33
|
+
* currently aggregated; that is a deferred follow-up decision.
|
|
29
34
|
*/
|
|
30
35
|
export declare function enrichRigView(rig: RigDoc): Promise<RigView>;
|
|
31
36
|
/**
|
package/dist/rig-view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rig-view.d.ts","sourceRoot":"","sources":["../src/rig-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH,OAAO,KAAK,EACV,MAAM,EACN,OAAO,EAGR,MAAM,YAAY,CAAC;AAEpB
|
|
1
|
+
{"version":3,"file":"rig-view.d.ts","sourceRoot":"","sources":["../src/rig-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH,OAAO,KAAK,EACV,MAAM,EACN,OAAO,EAGR,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAmFjE;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAEvE"}
|
package/dist/rig-view.js
CHANGED
|
@@ -26,6 +26,11 @@ import { guild } from '@shardworks/nexus-core';
|
|
|
26
26
|
* snapshots of every engine's session (if any) and summing across them.
|
|
27
27
|
*
|
|
28
28
|
* Does not mutate the rig. Safe to call on every read.
|
|
29
|
+
*
|
|
30
|
+
* Per-engine `sessionId` is read from the engine's latest attempt
|
|
31
|
+
* (`attempts[-1].sessionId`) — the engine no longer carries a scalar
|
|
32
|
+
* `sessionId` field. Earlier attempts' sessions (pre-retry) are not
|
|
33
|
+
* currently aggregated; that is a deferred follow-up decision.
|
|
29
34
|
*/
|
|
30
35
|
export async function enrichRigView(rig) {
|
|
31
36
|
// Look up the writ title from the clerk/writs book. Direct book read —
|
|
@@ -39,8 +44,12 @@ export async function enrichRigView(rig) {
|
|
|
39
44
|
// Collect (engineId, sessionId) pairs to look up.
|
|
40
45
|
const pairs = [];
|
|
41
46
|
for (const engine of rig.engines || []) {
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
const attempts = engine.attempts ?? [];
|
|
48
|
+
if (attempts.length === 0)
|
|
49
|
+
continue;
|
|
50
|
+
const tail = attempts[attempts.length - 1];
|
|
51
|
+
if (tail.sessionId) {
|
|
52
|
+
pairs.push({ engineId: engine.id, sessionId: tail.sessionId });
|
|
44
53
|
}
|
|
45
54
|
}
|
|
46
55
|
// No engines with sessions: no cost data to report — but still attach
|
package/dist/rig-view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rig-view.js","sourceRoot":"","sources":["../src/rig-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAW/C
|
|
1
|
+
{"version":3,"file":"rig-view.js","sourceRoot":"","sources":["../src/rig-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAW/C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAW;IAC7C,uEAAuE;IACvE,yEAAyE;IACzE,uEAAuE;IACvE,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC,SAAS,CAAY,QAAQ,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ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S,EAAE,CAAC;YAC/B,iBAAiB,IAAI,YAAY,CAAC;YAClC,aAAa,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC;IAED,MAAM,WAAW,GAAmB,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;IAC9D,IAAI,aAAa,EAAE,CAAC;QAClB,WAAW,CAAC,WAAW,GAAG,gBAAgB,CAAC;QAC3C,WAAW,CAAC,YAAY,GAAG,iBAAiB,CAAC;IAC/C,CAAC;IAED,MAAM,IAAI,GAAY;QACpB,GAAG,GAAG;QACN,WAAW;QACX,WAAW;KACZ,CAAC;IACF,IAAI,SAAS,KAAK,SAAS;QAAE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IACxD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAc;IACjD,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared fixture module for Spider unit tests.
|
|
3
|
+
*
|
|
4
|
+
* Houses the canonical `buildFixture` integration harness and its
|
|
5
|
+
* module-scope helper dependencies, originally co-located with the
|
|
6
|
+
* monolithic `spider.test.ts`. The split into per-feature test files
|
|
7
|
+
* relocates these helpers here so each split file imports only the
|
|
8
|
+
* helpers it actually uses.
|
|
9
|
+
*
|
|
10
|
+
* The file name does not match the `*.test.ts` glob, so the test runner
|
|
11
|
+
* never picks it up directly. Production source is imported directly
|
|
12
|
+
* from the original packages — this module deliberately does NOT
|
|
13
|
+
* re-export production symbols (no barrel pattern).
|
|
14
|
+
*/
|
|
15
|
+
import type { GuildConfig, LoadedKit, LoadedApparatus, StartupContext, KitEntry } from '@shardworks/nexus-core';
|
|
16
|
+
import { MemoryBackend } from '@shardworks/stacks-apparatus/testing';
|
|
17
|
+
import type { StacksApi } from '@shardworks/stacks-apparatus';
|
|
18
|
+
import type { ClerkApi, WritDoc, WritTypeConfig } from '@shardworks/clerk-apparatus';
|
|
19
|
+
import type { FabricatorApi } from '@shardworks/fabricator-apparatus';
|
|
20
|
+
import type { SummonRequest } from '@shardworks/animator-apparatus';
|
|
21
|
+
import type { SpiderApi, RigDoc, EngineInstance, EngineAttempt, RigTemplate } from './types.ts';
|
|
22
|
+
/**
|
|
23
|
+
* Return the latest attempt row (tail of `attempts[]`) for the given engine,
|
|
24
|
+
* or undefined if the engine has never been dispatched. Tests read
|
|
25
|
+
* session id / yields / error / timestamps from this row (the scalar
|
|
26
|
+
* engine-level fields no longer exist).
|
|
27
|
+
*/
|
|
28
|
+
export declare function latestAttempt(engine: EngineInstance): EngineAttempt | undefined;
|
|
29
|
+
export declare const STANDARD_TEMPLATE: RigTemplate;
|
|
30
|
+
export declare const FRAMEWORK_KIT_FIELDS: Set<string>;
|
|
31
|
+
export declare function buildKitEntries(kits: LoadedKit[], apparatuses: LoadedApparatus[]): KitEntry[];
|
|
32
|
+
/**
|
|
33
|
+
* Build a minimal StartupContext that captures and fires events.
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildCtx(kitEntries?: KitEntry[]): {
|
|
36
|
+
ctx: StartupContext;
|
|
37
|
+
fire: (event: string, ...args: unknown[]) => Promise<void>;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Splice test-supplied custom engines into a copy of Spider's apparatus
|
|
41
|
+
* supportKit. Matching is by engine id — if `customEngines` contains an
|
|
42
|
+
* engine whose id matches one of Spider's built-in engines, that built-in is
|
|
43
|
+
* replaced rather than registered alongside (which would violate the
|
|
44
|
+
* Fabricator's kit-vs-kit uniqueness rule). Engines with new ids are
|
|
45
|
+
* appended. Returns the same apparatus object unmodified when there are no
|
|
46
|
+
* custom engines.
|
|
47
|
+
*/
|
|
48
|
+
export declare function mergeCustomEnginesIntoSpider(spiderApparatus: LoadedApparatus['apparatus'], customEngines: Record<string, unknown> | undefined): LoadedApparatus['apparatus'];
|
|
49
|
+
/**
|
|
50
|
+
* Full integration fixture: starts Stacks (memory), Clerk, Fabricator,
|
|
51
|
+
* and Spider. Returns handles to each API plus mock animator controls.
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildFixture(guildConfig?: Partial<GuildConfig>, initialSessionOutcome?: {
|
|
54
|
+
status: 'completed' | 'failed';
|
|
55
|
+
error?: string;
|
|
56
|
+
output?: string;
|
|
57
|
+
}, extra?: {
|
|
58
|
+
kits?: LoadedKit[];
|
|
59
|
+
apparatuses?: LoadedApparatus[];
|
|
60
|
+
customEngines?: Record<string, unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* Additional writ-type configs to register with the Clerk after its
|
|
63
|
+
* `start()` returns. The legacy `clerk.writTypes` guild-config channel
|
|
64
|
+
* and kit-channel scan have both been retired; tests that need
|
|
65
|
+
* non-mandate writ types register them here. Each config is a full
|
|
66
|
+
* `WritTypeConfig`; common test types (`triage`, `audit`) clone
|
|
67
|
+
* mandate's six-state machine.
|
|
68
|
+
*/
|
|
69
|
+
extraWritTypes?: WritTypeConfig[];
|
|
70
|
+
}): {
|
|
71
|
+
stacks: StacksApi;
|
|
72
|
+
clerk: ClerkApi;
|
|
73
|
+
realClerk: ClerkApi;
|
|
74
|
+
fabricator: FabricatorApi;
|
|
75
|
+
spider: SpiderApi;
|
|
76
|
+
memBackend: InstanceType<typeof MemoryBackend>;
|
|
77
|
+
fire: (event: string, ...args: unknown[]) => Promise<void>;
|
|
78
|
+
spiderFire: (event: string, ...args: unknown[]) => Promise<void>;
|
|
79
|
+
summonCalls: SummonRequest[];
|
|
80
|
+
cancelCalls: Array<{
|
|
81
|
+
sessionId: string;
|
|
82
|
+
options?: {
|
|
83
|
+
reason?: string;
|
|
84
|
+
};
|
|
85
|
+
}>;
|
|
86
|
+
setSessionOutcome: (outcome: {
|
|
87
|
+
status: 'completed' | 'failed';
|
|
88
|
+
error?: string;
|
|
89
|
+
output?: string;
|
|
90
|
+
}) => void;
|
|
91
|
+
};
|
|
92
|
+
/** Get the rigs book. */
|
|
93
|
+
export declare function rigsBook(stacks: StacksApi): import("@shardworks/stacks-apparatus").Book<RigDoc>;
|
|
94
|
+
/**
|
|
95
|
+
* Build a `WritTypeConfig` that clones mandate's six-state machine under a
|
|
96
|
+
* different name. Used by tests that previously declared throwaway writ
|
|
97
|
+
* types via the legacy `clerk.writTypes` guild-config channel.
|
|
98
|
+
*/
|
|
99
|
+
export declare function mandateLikeWritType(name: string): WritTypeConfig;
|
|
100
|
+
/**
|
|
101
|
+
* Post a mandate writ. The fixture's clerk wrapper auto-publishes mandate
|
|
102
|
+
* writs to `open`, so this helper is now a thin convenience that just sets
|
|
103
|
+
* a default title and body. (The auto-publish lives in the wrapper, not
|
|
104
|
+
* this helper, so callers that go through `fix.clerk.post(...)` directly
|
|
105
|
+
* get the same `open`-on-arrival behaviour.)
|
|
106
|
+
*/
|
|
107
|
+
export declare function postWrit(clerk: ClerkApi, title?: string, codex?: string): Promise<WritDoc>;
|
|
108
|
+
/**
|
|
109
|
+
* Assert that a rig's terminalAt field is a valid ISO timestamp. Used by
|
|
110
|
+
* rig terminal-transition tests to pin the invariant that any rig reaching
|
|
111
|
+
* a terminal status also records the terminal-event timestamp.
|
|
112
|
+
*/
|
|
113
|
+
export declare function assertTerminalAt(rig: {
|
|
114
|
+
terminalAt?: string;
|
|
115
|
+
} | null | undefined, msg?: string): void;
|
|
116
|
+
//# sourceMappingURL=spider-test-fixture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spider-test-fixture.d.ts","sourceRoot":"","sources":["../src/spider-test-fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EAAS,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGvH,OAAO,EAAE,aAAa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