@pellux/goodvibes-sdk 0.33.19 → 0.33.20
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/contracts/artifacts/operator-contract.json +1 -1
- package/dist/platform/tools/agent/index.d.ts.map +1 -1
- package/dist/platform/tools/agent/index.js +40 -0
- package/dist/platform/tools/agent/manager.d.ts.map +1 -1
- package/dist/platform/tools/agent/manager.js +4 -0
- package/dist/platform/tools/agent/schema.js +2 -2
- package/dist/platform/tools/agent/wrfc-batch-policy.d.ts +13 -0
- package/dist/platform/tools/agent/wrfc-batch-policy.d.ts.map +1 -0
- package/dist/platform/tools/agent/wrfc-batch-policy.js +108 -0
- package/dist/platform/version.js +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/platform/tools/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAmB,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/platform/tools/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAmB,YAAY,EAAE,MAAM,cAAc,CAAC;AAK7D,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAqB7D,wBAAgB,eAAe,CAAC,MAAM,EAAE;IACtC,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,aAAa,GAAG,MAAM,CAAC,CAAC;IAC1D,cAAc,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,GAAG,SAAS,CAAC;IAChE,eAAe,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,GAAG,SAAS,CAAC;IACrE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;CAC3C,GAAG,IAAI,CAwmBP"}
|
|
@@ -5,6 +5,7 @@ import { AGENT_TEMPLATES, AgentManager } from './manager.js';
|
|
|
5
5
|
import { evaluateOrchestrationSpawn } from '../../runtime/orchestration/spawn-policy.js';
|
|
6
6
|
import { summarizeError } from '../../utils/error-display.js';
|
|
7
7
|
import { toRecord } from '../../utils/record-coerce.js';
|
|
8
|
+
import { evaluateWrfcBatchPolicy, isRootReviewRoleTask } from './wrfc-batch-policy.js';
|
|
8
9
|
export { AGENT_TEMPLATES, AgentManager } from './manager.js';
|
|
9
10
|
// ---------------------------------------------------------------------------
|
|
10
11
|
// Tool implementation
|
|
@@ -49,6 +50,12 @@ export function createAgentTool(config) {
|
|
|
49
50
|
if (!input.task || typeof input.task !== 'string' || input.task.trim() === '') {
|
|
50
51
|
return { success: false, error: 'Missing required parameter for spawn: task' };
|
|
51
52
|
}
|
|
53
|
+
if (!input.parentAgentId && input.dangerously_disable_wrfc && isRootReviewRoleTask({ task: input.task, template: input.template })) {
|
|
54
|
+
return {
|
|
55
|
+
success: false,
|
|
56
|
+
error: 'Root reviewer/tester/verifier agents are not valid independent roots. Start one WRFC owner chain for the deliverable, or spawn genuinely independent sidecar research/implementation tasks.',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
52
59
|
if (input.template && !AGENT_TEMPLATES[input.template]) {
|
|
53
60
|
// Also allow custom archetypes loaded from .goodvibes/agents/*.md
|
|
54
61
|
const customArchetype = archetypeLoader.loadArchetype(input.template);
|
|
@@ -374,6 +381,39 @@ export function createAgentTool(config) {
|
|
|
374
381
|
if (input.tasks.length > 20) {
|
|
375
382
|
return { success: false, error: 'batch-spawn limited to 20 tasks per batch.' };
|
|
376
383
|
}
|
|
384
|
+
const batchPolicy = evaluateWrfcBatchPolicy(input);
|
|
385
|
+
if (batchPolicy.kind === 'collapse-to-wrfc') {
|
|
386
|
+
let record;
|
|
387
|
+
try {
|
|
388
|
+
record = manager.spawn(batchPolicy.ownerInput);
|
|
389
|
+
}
|
|
390
|
+
catch (error) {
|
|
391
|
+
return {
|
|
392
|
+
success: false,
|
|
393
|
+
error: `Failed to collapse role-decomposition batch into a WRFC owner chain: ${summarizeError(error)}`,
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
return {
|
|
397
|
+
success: true,
|
|
398
|
+
output: JSON.stringify({
|
|
399
|
+
agents: [{
|
|
400
|
+
id: record.id,
|
|
401
|
+
task: record.task.slice(0, 80),
|
|
402
|
+
template: record.template,
|
|
403
|
+
cohort: record.cohort,
|
|
404
|
+
wrfcId: record.wrfcId ?? null,
|
|
405
|
+
wrfcRole: record.wrfcRole ?? null,
|
|
406
|
+
}],
|
|
407
|
+
count: 1,
|
|
408
|
+
cohort: input.cohort,
|
|
409
|
+
skipped: 0,
|
|
410
|
+
collapsedToWrfc: true,
|
|
411
|
+
collapsedTaskCount: input.tasks.length,
|
|
412
|
+
reason: batchPolicy.reason,
|
|
413
|
+
roleTaskIndexes: batchPolicy.roleTaskIndexes ?? [],
|
|
414
|
+
}),
|
|
415
|
+
};
|
|
416
|
+
}
|
|
377
417
|
const currentCount = manager.list().filter(a => a.status === 'pending' || a.status === 'running').length;
|
|
378
418
|
const spawnDecision = evaluateOrchestrationSpawn({
|
|
379
419
|
configManager: config.configManager,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../src/platform/tools/agent/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAcrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../src/platform/tools/agent/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAcrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,MAAM,MAAM,aAAa,GAA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E,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAIzC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAkC3B,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE;IAI3C,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE;IAkB5C,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAQtC,IAAI,IAAI,WAAW,EAAE;IAIrB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE;IAI3C,KAAK,IAAI,IAAI;IAKb,WAAW,IAAI,WAAW,EAAE;IAU5B,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI;IAOzC,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI;IAIjD,iBAAiB,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,GAAG,IAAI,GAAG,IAAI;CAGpF"}
|
|
@@ -7,6 +7,7 @@ import { evaluateOrchestrationSpawn } from '../../runtime/orchestration/spawn-po
|
|
|
7
7
|
import { logger } from '../../utils/logger.js';
|
|
8
8
|
import { summarizeError } from '../../utils/error-display.js';
|
|
9
9
|
import { splitModelRegistryKey } from '../../providers/registry-helpers.js';
|
|
10
|
+
import { isRootReviewRoleTask } from './wrfc-batch-policy.js';
|
|
10
11
|
export const AGENT_TEMPLATES = {
|
|
11
12
|
engineer: {
|
|
12
13
|
description: 'Full-stack implementation agent',
|
|
@@ -98,6 +99,9 @@ export class AgentManager {
|
|
|
98
99
|
throw new Error('AgentManager requires configManager');
|
|
99
100
|
}
|
|
100
101
|
const template = input.template ?? 'general';
|
|
102
|
+
if (!input.parentAgentId && input.dangerously_disable_wrfc && isRootReviewRoleTask({ task, template })) {
|
|
103
|
+
throw new Error('Root reviewer/tester/verifier agents are not valid independent roots. Start one WRFC owner chain for the deliverable, or spawn genuinely independent sidecar research/implementation tasks.');
|
|
104
|
+
}
|
|
101
105
|
const archetype = this.archetypeLoader.loadArchetype(template);
|
|
102
106
|
const templateDef = AGENT_TEMPLATES[template] ?? AGENT_TEMPLATES.general;
|
|
103
107
|
const defaultTools = archetype ? archetype.tools : templateDef.defaultTools;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export const AGENT_TOOL_SCHEMA = {
|
|
6
6
|
name: 'agent',
|
|
7
7
|
description: 'Manages in-process subagents. Modes: spawn (create a new agent task), ' +
|
|
8
|
-
'batch-spawn (spawn multiple agents at once from a tasks array), ' +
|
|
8
|
+
'batch-spawn (spawn multiple genuinely independent sidecar agents at once from a tasks array; review/test/verification role decomposition is WRFC and is collapsed to one owner chain), ' +
|
|
9
9
|
'status (check agent progress by ID), cancel (stop a running agent), ' +
|
|
10
10
|
'list (show all agents and their status), ' +
|
|
11
11
|
'templates (list available agent templates with default tool sets), ' +
|
|
@@ -194,7 +194,7 @@ export const AGENT_TOOL_SCHEMA = {
|
|
|
194
194
|
dangerously_disable_wrfc: { type: 'boolean', description: 'Skip WRFC review.' },
|
|
195
195
|
},
|
|
196
196
|
},
|
|
197
|
-
description: 'Array of tasks to spawn as agents (mode: batch-spawn). Max 20.',
|
|
197
|
+
description: 'Array of genuinely independent tasks to spawn as agents (mode: batch-spawn). Max 20. Do not place tester/reviewer/verifier role phases here for one deliverable; those are WRFC lifecycle children owned by one owner chain.',
|
|
198
198
|
},
|
|
199
199
|
// mode: spawn, batch-spawn, list, cohort-status, cohort-report
|
|
200
200
|
cohort: {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AgentInput } from './schema.js';
|
|
2
|
+
type BatchTask = NonNullable<AgentInput['tasks']>[number];
|
|
3
|
+
export interface WrfcBatchPolicyDecision {
|
|
4
|
+
readonly kind: 'independent' | 'collapse-to-wrfc';
|
|
5
|
+
readonly reason?: string | undefined;
|
|
6
|
+
readonly ownerInput?: AgentInput | undefined;
|
|
7
|
+
readonly roleTaskIndexes?: readonly number[] | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function isRootReviewRoleTemplate(template: string | undefined): boolean;
|
|
10
|
+
export declare function isRootReviewRoleTask(task: Pick<BatchTask, 'task' | 'template'>): boolean;
|
|
11
|
+
export declare function evaluateWrfcBatchPolicy(input: AgentInput): WrfcBatchPolicyDecision;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=wrfc-batch-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrfc-batch-policy.d.ts","sourceRoot":"","sources":["../../../../src/platform/tools/agent/wrfc-batch-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,KAAK,SAAS,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAsB1D,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,kBAAkB,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC1D;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAE9E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC,GAAG,OAAO,CAIxF;AA8BD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,uBAAuB,CAoElF"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
const ROOT_REVIEW_ROLE_TEMPLATES = new Set([
|
|
2
|
+
'reviewer',
|
|
3
|
+
'tester',
|
|
4
|
+
'verifier',
|
|
5
|
+
'review',
|
|
6
|
+
'test',
|
|
7
|
+
'qa',
|
|
8
|
+
]);
|
|
9
|
+
const IMPLEMENTATION_TEMPLATES = new Set(['engineer', 'general']);
|
|
10
|
+
const ROLE_PREFIX_RE = /^\s*(?:\[?\s*)?(?:reviewer|tester|verifier|qa|quality\s+assurance|test|review|verify|validator)\b[\]\s:;-]*/i;
|
|
11
|
+
const ROLE_ACTION_RE = /\b(?:test|tests|testing|review|reviews|reviewing|verify|verifies|verifying|verification|validate|validates|validating|validation|qa)\s+(?:the|this|that|implementation|solution|feature|deliverable|code|changes|work|output|result|patch|diff)\b/i;
|
|
12
|
+
const IMPLEMENTATION_ACTION_RE = /\b(?:build|implement|create|add|write|fix|repair|update|refactor|change|modify|deliver|make)\b/i;
|
|
13
|
+
export function isRootReviewRoleTemplate(template) {
|
|
14
|
+
return ROOT_REVIEW_ROLE_TEMPLATES.has((template ?? '').trim().toLowerCase());
|
|
15
|
+
}
|
|
16
|
+
export function isRootReviewRoleTask(task) {
|
|
17
|
+
if (isRootReviewRoleTemplate(task.template))
|
|
18
|
+
return true;
|
|
19
|
+
const text = task.task.trim();
|
|
20
|
+
return ROLE_PREFIX_RE.test(text) || ROLE_ACTION_RE.test(text);
|
|
21
|
+
}
|
|
22
|
+
function isImplementationLikeTask(task) {
|
|
23
|
+
const template = (task.template ?? '').trim().toLowerCase();
|
|
24
|
+
return IMPLEMENTATION_TEMPLATES.has(template) || IMPLEMENTATION_ACTION_RE.test(task.task);
|
|
25
|
+
}
|
|
26
|
+
function uniqueStrings(values) {
|
|
27
|
+
const unique = [...new Set(values.flatMap((value) => value ?? []).filter((value) => value.trim().length > 0))];
|
|
28
|
+
return unique.length > 0 ? unique : undefined;
|
|
29
|
+
}
|
|
30
|
+
function formatTask(task, index) {
|
|
31
|
+
const template = task.template ?? 'general';
|
|
32
|
+
return `${index + 1}. [${template}] ${task.task}`;
|
|
33
|
+
}
|
|
34
|
+
function buildCollapsedContext(input, tasks, roleTaskIndexes) {
|
|
35
|
+
const roleIndexText = roleTaskIndexes.map((index) => index + 1).join(', ');
|
|
36
|
+
const existing = input.context?.trim();
|
|
37
|
+
return [
|
|
38
|
+
existing ? `Caller context:\n${existing}` : null,
|
|
39
|
+
'SDK WRFC topology enforcement collapsed this batch because root review/test/verification tasks are lifecycle phases, not independent root agents.',
|
|
40
|
+
`Collapsed role-task indexes: ${roleIndexText}.`,
|
|
41
|
+
'The WRFC owner must keep one root chain for the original deliverable. The controller owns engineer, reviewer, tester/verifier, and fixer child lifecycle agents after owner output exists.',
|
|
42
|
+
'Original batch:',
|
|
43
|
+
...tasks.map(formatTask),
|
|
44
|
+
].filter((line) => Boolean(line)).join('\n');
|
|
45
|
+
}
|
|
46
|
+
export function evaluateWrfcBatchPolicy(input) {
|
|
47
|
+
const tasks = input.tasks ?? [];
|
|
48
|
+
if (input.mode !== 'batch-spawn' || tasks.length <= 1) {
|
|
49
|
+
return { kind: 'independent' };
|
|
50
|
+
}
|
|
51
|
+
const roleTaskIndexes = tasks
|
|
52
|
+
.map((task, index) => isRootReviewRoleTask(task) ? index : -1)
|
|
53
|
+
.filter((index) => index >= 0);
|
|
54
|
+
if (roleTaskIndexes.length === 0) {
|
|
55
|
+
return { kind: 'independent' };
|
|
56
|
+
}
|
|
57
|
+
const primaryIndex = tasks.findIndex((task, index) => !roleTaskIndexes.includes(index) && isImplementationLikeTask(task));
|
|
58
|
+
const ownerTask = tasks[primaryIndex >= 0 ? primaryIndex : 0];
|
|
59
|
+
const ownerTemplate = isRootReviewRoleTemplate(ownerTask.template)
|
|
60
|
+
? 'engineer'
|
|
61
|
+
: ownerTask.template ?? input.template ?? 'engineer';
|
|
62
|
+
const template = isRootReviewRoleTemplate(ownerTemplate) ? 'engineer' : ownerTemplate;
|
|
63
|
+
const ownerInput = {
|
|
64
|
+
mode: 'spawn',
|
|
65
|
+
task: ownerTask.task,
|
|
66
|
+
template,
|
|
67
|
+
model: ownerTask.model ?? input.model,
|
|
68
|
+
provider: ownerTask.provider ?? input.provider,
|
|
69
|
+
fallbackModels: ownerTask.fallbackModels ?? input.fallbackModels,
|
|
70
|
+
routing: ownerTask.routing ?? input.routing,
|
|
71
|
+
executionIntent: ownerTask.executionIntent ?? input.executionIntent,
|
|
72
|
+
reasoningEffort: ownerTask.reasoningEffort ?? input.reasoningEffort,
|
|
73
|
+
tools: ownerTask.tools ?? input.tools,
|
|
74
|
+
restrictTools: ownerTask.restrictTools ?? input.restrictTools,
|
|
75
|
+
context: buildCollapsedContext(input, tasks, roleTaskIndexes),
|
|
76
|
+
successCriteria: uniqueStrings([
|
|
77
|
+
ownerTask.successCriteria,
|
|
78
|
+
input.successCriteria,
|
|
79
|
+
...tasks.map((task) => task.successCriteria),
|
|
80
|
+
['Keep the WRFC work as one owner chain; review, test, verification, and fix work must be WRFC lifecycle children, not sibling root agents.'],
|
|
81
|
+
]),
|
|
82
|
+
requiredEvidence: uniqueStrings([
|
|
83
|
+
ownerTask.requiredEvidence,
|
|
84
|
+
input.requiredEvidence,
|
|
85
|
+
...tasks.map((task) => task.requiredEvidence),
|
|
86
|
+
]),
|
|
87
|
+
writeScope: uniqueStrings([
|
|
88
|
+
ownerTask.writeScope,
|
|
89
|
+
input.writeScope,
|
|
90
|
+
...tasks.map((task) => task.writeScope),
|
|
91
|
+
]),
|
|
92
|
+
executionProtocol: ownerTask.executionProtocol ?? input.executionProtocol,
|
|
93
|
+
reviewMode: 'wrfc',
|
|
94
|
+
communicationLane: ownerTask.communicationLane ?? input.communicationLane,
|
|
95
|
+
parentAgentId: ownerTask.parentAgentId ?? input.parentAgentId,
|
|
96
|
+
orchestrationGraphId: ownerTask.orchestrationGraphId ?? input.orchestrationGraphId,
|
|
97
|
+
orchestrationNodeId: ownerTask.orchestrationNodeId ?? input.orchestrationNodeId,
|
|
98
|
+
parentNodeId: ownerTask.parentNodeId ?? input.parentNodeId,
|
|
99
|
+
dangerously_disable_wrfc: false,
|
|
100
|
+
cohort: input.cohort,
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
kind: 'collapse-to-wrfc',
|
|
104
|
+
reason: 'batch-spawn contained root review/test/verification role tasks for the same deliverable',
|
|
105
|
+
ownerInput,
|
|
106
|
+
roleTaskIndexes,
|
|
107
|
+
};
|
|
108
|
+
}
|
package/dist/platform/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
let version = '0.33.
|
|
3
|
+
let version = '0.33.20';
|
|
4
4
|
try {
|
|
5
5
|
const pkg = JSON.parse(readFileSync(join(import.meta.dir, '..', '..', 'package.json'), 'utf-8'));
|
|
6
6
|
version = pkg.version ?? version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pellux/goodvibes-sdk",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.20",
|
|
4
4
|
"description": "TypeScript SDK for building GoodVibes operator, peer, web, mobile, and daemon-connected apps with typed contracts, auth, realtime events, and transport layers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"goodvibes",
|
|
@@ -449,14 +449,14 @@
|
|
|
449
449
|
"sideEffects": false,
|
|
450
450
|
"type": "module",
|
|
451
451
|
"dependencies": {
|
|
452
|
-
"@pellux/goodvibes-contracts": "0.33.
|
|
453
|
-
"@pellux/goodvibes-daemon-sdk": "0.33.
|
|
454
|
-
"@pellux/goodvibes-errors": "0.33.
|
|
455
|
-
"@pellux/goodvibes-operator-sdk": "0.33.
|
|
456
|
-
"@pellux/goodvibes-peer-sdk": "0.33.
|
|
457
|
-
"@pellux/goodvibes-transport-core": "0.33.
|
|
458
|
-
"@pellux/goodvibes-transport-http": "0.33.
|
|
459
|
-
"@pellux/goodvibes-transport-realtime": "0.33.
|
|
452
|
+
"@pellux/goodvibes-contracts": "0.33.20",
|
|
453
|
+
"@pellux/goodvibes-daemon-sdk": "0.33.20",
|
|
454
|
+
"@pellux/goodvibes-errors": "0.33.20",
|
|
455
|
+
"@pellux/goodvibes-operator-sdk": "0.33.20",
|
|
456
|
+
"@pellux/goodvibes-peer-sdk": "0.33.20",
|
|
457
|
+
"@pellux/goodvibes-transport-core": "0.33.20",
|
|
458
|
+
"@pellux/goodvibes-transport-http": "0.33.20",
|
|
459
|
+
"@pellux/goodvibes-transport-realtime": "0.33.20"
|
|
460
460
|
},
|
|
461
461
|
"optionalDependencies": {
|
|
462
462
|
"@agentclientprotocol/sdk": "^0.21.0",
|