@arke-institute/rhiza 0.4.0 → 0.4.1
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/dist/__tests__/unit/handoff/per-item-routing.test.d.ts +8 -0
- package/dist/__tests__/unit/handoff/per-item-routing.test.d.ts.map +1 -0
- package/dist/__tests__/unit/handoff/per-item-routing.test.js +209 -0
- package/dist/__tests__/unit/handoff/per-item-routing.test.js.map +1 -0
- package/dist/handoff/interpret.d.ts +12 -5
- package/dist/handoff/interpret.d.ts.map +1 -1
- package/dist/handoff/interpret.js +448 -75
- package/dist/handoff/interpret.js.map +1 -1
- package/dist/handoff/invoke.d.ts +5 -0
- package/dist/handoff/invoke.d.ts.map +1 -1
- package/dist/handoff/invoke.js +2 -1
- package/dist/handoff/invoke.js.map +1 -1
- package/dist/handoff/scatter-api.d.ts +2 -0
- package/dist/handoff/scatter-api.d.ts.map +1 -1
- package/dist/handoff/scatter-api.js +9 -1
- package/dist/handoff/scatter-api.js.map +1 -1
- package/dist/handoff/scatter-delegate.d.ts +76 -0
- package/dist/handoff/scatter-delegate.d.ts.map +1 -0
- package/dist/handoff/scatter-delegate.js +72 -0
- package/dist/handoff/scatter-delegate.js.map +1 -0
- package/dist/handoff/target.d.ts +31 -1
- package/dist/handoff/target.d.ts.map +1 -1
- package/dist/handoff/target.js +48 -0
- package/dist/handoff/target.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/logging/writer.d.ts +21 -0
- package/dist/logging/writer.d.ts.map +1 -1
- package/dist/logging/writer.js +69 -35
- package/dist/logging/writer.js.map +1 -1
- package/dist/types/config.d.ts +33 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +10 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/log.d.ts +15 -1
- package/dist/types/log.d.ts.map +1 -1
- package/dist/types/request.d.ts +6 -0
- package/dist/types/request.d.ts.map +1 -1
- package/dist/types/rhiza.d.ts +28 -0
- package/dist/types/rhiza.d.ts.map +1 -1
- package/dist/validation/validate-rhiza.d.ts.map +1 -1
- package/dist/validation/validate-rhiza.js +10 -3
- package/dist/validation/validate-rhiza.js.map +1 -1
- package/dist/worker/job.d.ts +26 -9
- package/dist/worker/job.d.ts.map +1 -1
- package/dist/worker/job.js +24 -7
- package/dist/worker/job.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"per-item-routing.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/unit/handoff/per-item-routing.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-Item Routing Tests
|
|
3
|
+
*
|
|
4
|
+
* Tests for normalizeOutput and groupOutputsByTarget functions
|
|
5
|
+
* that enable per-item routing for scatter/pass handoffs.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, it, expect } from 'vitest';
|
|
8
|
+
import { normalizeOutput, groupOutputsByTarget } from '../../../handoff/target';
|
|
9
|
+
describe('Per-Item Routing', () => {
|
|
10
|
+
describe('normalizeOutput', () => {
|
|
11
|
+
it('converts string to OutputItem', () => {
|
|
12
|
+
const output = 'ent_abc123';
|
|
13
|
+
const result = normalizeOutput(output);
|
|
14
|
+
expect(result).toEqual({ entity_id: 'ent_abc123' });
|
|
15
|
+
});
|
|
16
|
+
it('returns OutputItem unchanged', () => {
|
|
17
|
+
const output = { entity_id: 'ent_abc123', entity_class: 'canonical' };
|
|
18
|
+
const result = normalizeOutput(output);
|
|
19
|
+
expect(result).toEqual({ entity_id: 'ent_abc123', entity_class: 'canonical' });
|
|
20
|
+
});
|
|
21
|
+
it('preserves all properties on OutputItem', () => {
|
|
22
|
+
const output = {
|
|
23
|
+
entity_id: 'ent_abc123',
|
|
24
|
+
entity_class: 'canonical',
|
|
25
|
+
custom_prop: 'value',
|
|
26
|
+
nested: { data: 1 },
|
|
27
|
+
};
|
|
28
|
+
const result = normalizeOutput(output);
|
|
29
|
+
expect(result).toEqual(output);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
describe('groupOutputsByTarget', () => {
|
|
33
|
+
describe('without routes', () => {
|
|
34
|
+
it('groups all outputs to default target', () => {
|
|
35
|
+
const outputs = ['ent_1', 'ent_2', 'ent_3'];
|
|
36
|
+
const then = { scatter: 'process' };
|
|
37
|
+
const groups = groupOutputsByTarget(outputs, then);
|
|
38
|
+
expect(groups.size).toBe(1);
|
|
39
|
+
expect(groups.get('process')).toHaveLength(3);
|
|
40
|
+
expect(groups.get('process')[0].entity_id).toBe('ent_1');
|
|
41
|
+
});
|
|
42
|
+
it('handles OutputItem objects', () => {
|
|
43
|
+
const outputs = [
|
|
44
|
+
{ entity_id: 'ent_1', type: 'file' },
|
|
45
|
+
{ entity_id: 'ent_2', type: 'folder' },
|
|
46
|
+
];
|
|
47
|
+
const then = { pass: 'handler' };
|
|
48
|
+
const groups = groupOutputsByTarget(outputs, then);
|
|
49
|
+
expect(groups.size).toBe(1);
|
|
50
|
+
expect(groups.get('handler')).toHaveLength(2);
|
|
51
|
+
});
|
|
52
|
+
it('handles done ThenSpec', () => {
|
|
53
|
+
const outputs = ['ent_1', 'ent_2'];
|
|
54
|
+
const then = { done: true };
|
|
55
|
+
const groups = groupOutputsByTarget(outputs, then);
|
|
56
|
+
// For done ThenSpec, resolveTarget returns null, which becomes 'done'
|
|
57
|
+
expect(groups.size).toBe(1);
|
|
58
|
+
expect(groups.get('done')).toHaveLength(2);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
describe('with routes', () => {
|
|
62
|
+
it('routes items based on properties', () => {
|
|
63
|
+
const outputs = [
|
|
64
|
+
{ entity_id: 'ent_1', entity_class: 'canonical' },
|
|
65
|
+
{ entity_id: 'ent_2', entity_class: 'mention' },
|
|
66
|
+
{ entity_id: 'ent_3', entity_class: 'canonical' },
|
|
67
|
+
];
|
|
68
|
+
const then = {
|
|
69
|
+
scatter: 'default_handler',
|
|
70
|
+
route: [
|
|
71
|
+
{ where: { property: 'entity_class', equals: 'canonical' }, target: 'describe' },
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
const groups = groupOutputsByTarget(outputs, then);
|
|
75
|
+
expect(groups.size).toBe(2);
|
|
76
|
+
expect(groups.get('describe')).toHaveLength(2);
|
|
77
|
+
expect(groups.get('default_handler')).toHaveLength(1);
|
|
78
|
+
});
|
|
79
|
+
it('routes to "done" target', () => {
|
|
80
|
+
const outputs = [
|
|
81
|
+
{ entity_id: 'ent_1', entity_class: 'canonical' },
|
|
82
|
+
{ entity_id: 'ent_2', entity_class: 'mention' },
|
|
83
|
+
];
|
|
84
|
+
const then = {
|
|
85
|
+
scatter: 'describe',
|
|
86
|
+
route: [
|
|
87
|
+
{ where: { property: 'entity_class', equals: 'mention' }, target: 'done' },
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
const groups = groupOutputsByTarget(outputs, then);
|
|
91
|
+
expect(groups.size).toBe(2);
|
|
92
|
+
expect(groups.get('describe')).toHaveLength(1);
|
|
93
|
+
expect(groups.get('describe')[0].entity_id).toBe('ent_1');
|
|
94
|
+
expect(groups.get('done')).toHaveLength(1);
|
|
95
|
+
expect(groups.get('done')[0].entity_id).toBe('ent_2');
|
|
96
|
+
});
|
|
97
|
+
it('applies first matching rule (if-else-if)', () => {
|
|
98
|
+
const outputs = [
|
|
99
|
+
{ entity_id: 'ent_1', type: 'pdf', priority: 'high' },
|
|
100
|
+
];
|
|
101
|
+
const then = {
|
|
102
|
+
pass: 'default',
|
|
103
|
+
route: [
|
|
104
|
+
{ where: { property: 'priority', equals: 'high' }, target: 'priority_handler' },
|
|
105
|
+
{ where: { property: 'type', equals: 'pdf' }, target: 'pdf_handler' },
|
|
106
|
+
],
|
|
107
|
+
};
|
|
108
|
+
const groups = groupOutputsByTarget(outputs, then);
|
|
109
|
+
// First matching rule wins
|
|
110
|
+
expect(groups.size).toBe(1);
|
|
111
|
+
expect(groups.get('priority_handler')).toHaveLength(1);
|
|
112
|
+
});
|
|
113
|
+
it('routes string outputs to default (no properties for matching)', () => {
|
|
114
|
+
const outputs = ['ent_1', 'ent_2'];
|
|
115
|
+
const then = {
|
|
116
|
+
scatter: 'default',
|
|
117
|
+
route: [
|
|
118
|
+
{ where: { property: 'entity_class', equals: 'canonical' }, target: 'describe' },
|
|
119
|
+
],
|
|
120
|
+
};
|
|
121
|
+
const groups = groupOutputsByTarget(outputs, then);
|
|
122
|
+
// String outputs have no properties, so no route matches -> default
|
|
123
|
+
expect(groups.size).toBe(1);
|
|
124
|
+
expect(groups.get('default')).toHaveLength(2);
|
|
125
|
+
});
|
|
126
|
+
it('handles complex AND/OR routing conditions', () => {
|
|
127
|
+
const outputs = [
|
|
128
|
+
{ entity_id: 'ent_1', type: 'file', format: 'pdf' },
|
|
129
|
+
{ entity_id: 'ent_2', type: 'file', format: 'docx' },
|
|
130
|
+
{ entity_id: 'ent_3', type: 'folder' },
|
|
131
|
+
];
|
|
132
|
+
const then = {
|
|
133
|
+
scatter: 'default',
|
|
134
|
+
route: [
|
|
135
|
+
{
|
|
136
|
+
where: {
|
|
137
|
+
and: [
|
|
138
|
+
{ property: 'type', equals: 'file' },
|
|
139
|
+
{ property: 'format', equals: 'pdf' },
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
target: 'pdf_handler',
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
const groups = groupOutputsByTarget(outputs, then);
|
|
147
|
+
expect(groups.get('pdf_handler')).toHaveLength(1);
|
|
148
|
+
expect(groups.get('pdf_handler')[0].entity_id).toBe('ent_1');
|
|
149
|
+
expect(groups.get('default')).toHaveLength(2);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
describe('mixed string and object outputs', () => {
|
|
153
|
+
it('handles mix of string and OutputItem', () => {
|
|
154
|
+
const outputs = [
|
|
155
|
+
'ent_1',
|
|
156
|
+
{ entity_id: 'ent_2', entity_class: 'canonical' },
|
|
157
|
+
'ent_3',
|
|
158
|
+
];
|
|
159
|
+
const then = {
|
|
160
|
+
scatter: 'default',
|
|
161
|
+
route: [
|
|
162
|
+
{ where: { property: 'entity_class', equals: 'canonical' }, target: 'describe' },
|
|
163
|
+
],
|
|
164
|
+
};
|
|
165
|
+
const groups = groupOutputsByTarget(outputs, then);
|
|
166
|
+
expect(groups.get('describe')).toHaveLength(1);
|
|
167
|
+
expect(groups.get('describe')[0].entity_id).toBe('ent_2');
|
|
168
|
+
expect(groups.get('default')).toHaveLength(2);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
describe('edge cases', () => {
|
|
172
|
+
it('handles empty outputs array', () => {
|
|
173
|
+
const outputs = [];
|
|
174
|
+
const then = { scatter: 'process' };
|
|
175
|
+
const groups = groupOutputsByTarget(outputs, then);
|
|
176
|
+
expect(groups.size).toBe(0);
|
|
177
|
+
});
|
|
178
|
+
it('handles all outputs routed to "done"', () => {
|
|
179
|
+
const outputs = [
|
|
180
|
+
{ entity_id: 'ent_1', skip: true },
|
|
181
|
+
{ entity_id: 'ent_2', skip: true },
|
|
182
|
+
];
|
|
183
|
+
const then = {
|
|
184
|
+
scatter: 'process',
|
|
185
|
+
route: [
|
|
186
|
+
{ where: { property: 'skip', equals: true }, target: 'done' },
|
|
187
|
+
],
|
|
188
|
+
};
|
|
189
|
+
const groups = groupOutputsByTarget(outputs, then);
|
|
190
|
+
expect(groups.size).toBe(1);
|
|
191
|
+
expect(groups.get('done')).toHaveLength(2);
|
|
192
|
+
});
|
|
193
|
+
it('handles gather handoff type', () => {
|
|
194
|
+
const outputs = [
|
|
195
|
+
{ entity_id: 'ent_1', priority: 'high' },
|
|
196
|
+
];
|
|
197
|
+
const then = {
|
|
198
|
+
gather: 'aggregator',
|
|
199
|
+
route: [
|
|
200
|
+
{ where: { property: 'priority', equals: 'high' }, target: 'priority_aggregator' },
|
|
201
|
+
],
|
|
202
|
+
};
|
|
203
|
+
const groups = groupOutputsByTarget(outputs, then);
|
|
204
|
+
expect(groups.get('priority_aggregator')).toHaveLength(1);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
//# sourceMappingURL=per-item-routing.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"per-item-routing.test.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/handoff/per-item-routing.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGhF,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;YACvC,MAAM,MAAM,GAAG,YAAY,CAAC;YAC5B,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;YAEvC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,MAAM,MAAM,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;YACtE,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;YAEvC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC;QACjF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wCAA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;qBACnF;iBACF,CAAC;gBAEF,MAAM,MAAM,GAAG,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAEnD,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* Combines pure logic (routing, target resolution) with SDK utilities (invocation).
|
|
6
6
|
*/
|
|
7
7
|
import type { ArkeClient } from '@arke-institute/sdk';
|
|
8
|
-
import type { ThenSpec, FlowStep, BatchContext, BatchEntity, HandoffRecord, InvocationRecord } from '../types';
|
|
8
|
+
import type { ThenSpec, FlowStep, BatchContext, BatchEntity, HandoffRecord, InvocationRecord, Output } from '../types';
|
|
9
|
+
import { type RhizaRuntimeConfig } from '../types/config';
|
|
9
10
|
/**
|
|
10
11
|
* Handoff action types
|
|
11
12
|
*/
|
|
@@ -28,9 +29,12 @@ export interface InterpretContext {
|
|
|
28
29
|
jobCollectionId: string;
|
|
29
30
|
/** The rhiza flow definition */
|
|
30
31
|
flow: Record<string, FlowStep>;
|
|
31
|
-
/** Output
|
|
32
|
-
outputs:
|
|
33
|
-
/**
|
|
32
|
+
/** Output entities from current klados (string IDs or OutputItem objects) */
|
|
33
|
+
outputs: Output[];
|
|
34
|
+
/**
|
|
35
|
+
* Properties of the primary output (for routing)
|
|
36
|
+
* @deprecated Use OutputItem objects in outputs array for per-item routing
|
|
37
|
+
*/
|
|
34
38
|
outputProperties?: Record<string, unknown>;
|
|
35
39
|
/** Current log entry ID (for chain building) */
|
|
36
40
|
fromLogId: string;
|
|
@@ -44,6 +48,8 @@ export interface InterpretContext {
|
|
|
44
48
|
network: 'test' | 'main';
|
|
45
49
|
/** Batch context if part of scatter/gather */
|
|
46
50
|
batchContext?: BatchContext;
|
|
51
|
+
/** Auth token for scatter-utility delegation (optional - needed for automatic delegation) */
|
|
52
|
+
authToken?: string;
|
|
47
53
|
}
|
|
48
54
|
/**
|
|
49
55
|
* Result of interpreting a handoff
|
|
@@ -75,7 +81,8 @@ export interface InterpretResult {
|
|
|
75
81
|
*
|
|
76
82
|
* @param then - The ThenSpec to interpret
|
|
77
83
|
* @param context - The interpretation context
|
|
84
|
+
* @param config - Optional rhiza runtime configuration (for scatter utility delegation)
|
|
78
85
|
* @returns The interpretation result
|
|
79
86
|
*/
|
|
80
|
-
export declare function interpretThen(then: ThenSpec, context: InterpretContext): Promise<InterpretResult>;
|
|
87
|
+
export declare function interpretThen(then: ThenSpec, context: InterpretContext, config?: RhizaRuntimeConfig): Promise<InterpretResult>;
|
|
81
88
|
//# sourceMappingURL=interpret.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interpret.d.ts","sourceRoot":"","sources":["../../src/handoff/interpret.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,aAAa,EACb,gBAAgB,
|
|
1
|
+
{"version":3,"file":"interpret.d.ts","sourceRoot":"","sources":["../../src/handoff/interpret.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,MAAM,EACP,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,iBAAiB,CAAC;AAQzB;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,MAAM,GACN,SAAS,GACT,aAAa,GACb,gBAAgB,CAAC;AAErB;;GAEG;AACH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