@weaveio/weave-adapter-opencode 0.0.0-preview-20260715084847 → 0.0.0-preview-20260716213903
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/index.js +225 -62
- package/dist/opencode-client.d.ts.map +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +292 -363
- package/dist/projection-helpers.d.ts.map +1 -1
- package/dist/reconcile-agent.d.ts.map +1 -1
- package/dist/runtime-command-projection.d.ts.map +1 -1
- package/dist/start-plan-execution.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20173,6 +20173,28 @@ When to delegate to each specialist:
|
|
|
20173
20173
|
|
|
20174
20174
|
Delegate aggressively to keep your context lean. Thread and Spindle are cheap (read-only); use them liberally for evidence gathering before routing to implementation agents.
|
|
20175
20175
|
|
|
20176
|
+
{{#reviewRouting}}
|
|
20177
|
+
|
|
20178
|
+
## Adversarial Review Routing
|
|
20179
|
+
|
|
20180
|
+
When a review is requested for any of the following agents, run the base reviewer AND all listed variants in parallel, then collate their findings into a unified verdict.
|
|
20181
|
+
|
|
20182
|
+
{{#groups}}
|
|
20183
|
+
### {{sourceAgent}}
|
|
20184
|
+
|
|
20185
|
+
Run all of the following reviewers:
|
|
20186
|
+
- \`{{sourceAgent}}\` (base reviewer)
|
|
20187
|
+
{{#variants}}
|
|
20188
|
+
- \`{{name}}\` (model: {{{model}}})
|
|
20189
|
+
{{/variants}}
|
|
20190
|
+
{{/groups}}
|
|
20191
|
+
|
|
20192
|
+
**Rules:**
|
|
20193
|
+
- Always run the base reviewer AND all listed variants. Do not replace the base reviewer with a variant.
|
|
20194
|
+
- Run all reviewers in parallel when possible.
|
|
20195
|
+
- Collate results strictly: if all approve, report Approve. If any rejects or blocks, report that. Surface disagreements between reviewers.
|
|
20196
|
+
{{/reviewRouting}}
|
|
20197
|
+
|
|
20176
20198
|
## Category Shuttles
|
|
20177
20199
|
|
|
20178
20200
|
Category shuttles are domain-scoped specialists generated from your project's category definitions. They appear in the list above with names like \`shuttle-{category}\`. **Prefer a category shuttle over the generic shuttle whenever the task clearly falls within a category's domain.**
|
|
@@ -20578,6 +20600,29 @@ Available specialists:
|
|
|
20578
20600
|
{{/delegation.targets}}
|
|
20579
20601
|
|
|
20580
20602
|
Route implementation tasks to \`shuttle-{category}\` agents when file patterns match. Fall back to \`shuttle\` when no category matches.
|
|
20603
|
+
|
|
20604
|
+
{{#reviewRouting}}
|
|
20605
|
+
|
|
20606
|
+
## Adversarial Review Routing
|
|
20607
|
+
|
|
20608
|
+
When delegating review tasks from a plan, run the base reviewer AND all listed variants for adversarial coverage.
|
|
20609
|
+
|
|
20610
|
+
{{#groups}}
|
|
20611
|
+
### {{sourceAgent}}
|
|
20612
|
+
|
|
20613
|
+
Run all of the following reviewers:
|
|
20614
|
+
- \`{{sourceAgent}}\` (base reviewer)
|
|
20615
|
+
{{#variants}}
|
|
20616
|
+
- \`{{name}}\` (model: {{{model}}})
|
|
20617
|
+
{{/variants}}
|
|
20618
|
+
{{/groups}}
|
|
20619
|
+
|
|
20620
|
+
**Rules:**
|
|
20621
|
+
- Always run the base reviewer AND all listed variants. Do not replace the base reviewer with a variant.
|
|
20622
|
+
- Run all reviewers in parallel when possible.
|
|
20623
|
+
- Collate results strictly: all must approve for the review to pass. Any rejection or block means the review fails.
|
|
20624
|
+
- Surface disagreements between reviewers to the user.
|
|
20625
|
+
{{/reviewRouting}}
|
|
20581
20626
|
</Delegation>
|
|
20582
20627
|
|
|
20583
20628
|
<Routing>
|
|
@@ -21511,6 +21556,12 @@ var ALLOWED_TEMPLATE_PATHS = new Set([
|
|
|
21511
21556
|
"delegation.targets.isCategory",
|
|
21512
21557
|
"delegation.targets.isCategory.name",
|
|
21513
21558
|
"delegation.targets.isCategory.description",
|
|
21559
|
+
"reviewRouting",
|
|
21560
|
+
"reviewRouting.groups",
|
|
21561
|
+
"reviewRouting.groups.sourceAgent",
|
|
21562
|
+
"reviewRouting.groups.variants",
|
|
21563
|
+
"reviewRouting.groups.variants.name",
|
|
21564
|
+
"reviewRouting.groups.variants.model",
|
|
21514
21565
|
"."
|
|
21515
21566
|
]);
|
|
21516
21567
|
function projectDelegationTarget(target) {
|
|
@@ -21551,7 +21602,8 @@ function buildTemplateContext(input) {
|
|
|
21551
21602
|
skills,
|
|
21552
21603
|
category,
|
|
21553
21604
|
effectiveToolPolicy,
|
|
21554
|
-
delegationTargets
|
|
21605
|
+
delegationTargets,
|
|
21606
|
+
reviewRouting
|
|
21555
21607
|
} = input;
|
|
21556
21608
|
const agentEntry = {
|
|
21557
21609
|
name: agentName,
|
|
@@ -21590,6 +21642,9 @@ function buildTemplateContext(input) {
|
|
|
21590
21642
|
if (categoryEntry !== undefined) {
|
|
21591
21643
|
context.category = categoryEntry;
|
|
21592
21644
|
}
|
|
21645
|
+
if (reviewRouting !== undefined) {
|
|
21646
|
+
context.reviewRouting = reviewRouting;
|
|
21647
|
+
}
|
|
21593
21648
|
log.debug({
|
|
21594
21649
|
agentName,
|
|
21595
21650
|
hasCategory: category !== undefined,
|
|
@@ -22421,8 +22476,40 @@ function loadAppendSourceFromInput(contextLabel, input) {
|
|
|
22421
22476
|
fileErrorMessage: cause instanceof Error ? cause.message : String(cause)
|
|
22422
22477
|
})).map((content) => ({ content, fromFile: true }));
|
|
22423
22478
|
}
|
|
22424
|
-
function
|
|
22479
|
+
function buildReviewRoutingContext(reviewVariants, delegationTargetNames) {
|
|
22480
|
+
const delegationSet = new Set(delegationTargetNames);
|
|
22481
|
+
const variants = reviewVariants.filter((a) => a.source === "review-variant");
|
|
22482
|
+
const groups = new Map;
|
|
22483
|
+
for (const variant of variants) {
|
|
22484
|
+
const sourceAgentName = variant.reviewMeta?.sourceAgentName;
|
|
22485
|
+
if (sourceAgentName === undefined)
|
|
22486
|
+
continue;
|
|
22487
|
+
if (!delegationSet.has(sourceAgentName))
|
|
22488
|
+
continue;
|
|
22489
|
+
const existing = groups.get(sourceAgentName);
|
|
22490
|
+
const entry = {
|
|
22491
|
+
name: variant.agentName,
|
|
22492
|
+
model: variant.reviewMeta?.reviewModel ?? ""
|
|
22493
|
+
};
|
|
22494
|
+
if (existing !== undefined) {
|
|
22495
|
+
existing.push(entry);
|
|
22496
|
+
} else {
|
|
22497
|
+
groups.set(sourceAgentName, [entry]);
|
|
22498
|
+
}
|
|
22499
|
+
}
|
|
22500
|
+
if (groups.size === 0)
|
|
22501
|
+
return;
|
|
22502
|
+
return {
|
|
22503
|
+
groups: Array.from(groups.entries()).map(([sourceAgent, variantList]) => ({
|
|
22504
|
+
sourceAgent,
|
|
22505
|
+
variants: variantList
|
|
22506
|
+
}))
|
|
22507
|
+
};
|
|
22508
|
+
}
|
|
22509
|
+
function composeAgentDescriptor(agentName, agentConfig, config2, allAgents, category, materializedReviewVariants) {
|
|
22425
22510
|
const delegationTargets = buildDelegationTargets(agentName, agentConfig, config2, allAgents);
|
|
22511
|
+
const delegationTargetNames = delegationTargets.map((t) => t.name);
|
|
22512
|
+
const reviewRouting = buildReviewRoutingContext(materializedReviewVariants ?? [], delegationTargetNames);
|
|
22426
22513
|
const effectiveToolPolicy = evaluateEffectiveToolPolicy(agentConfig.tool_policy);
|
|
22427
22514
|
const contextResult = buildTemplateContext({
|
|
22428
22515
|
agentName,
|
|
@@ -22431,7 +22518,8 @@ function composeAgentDescriptor(agentName, agentConfig, config2, allAgents, cate
|
|
|
22431
22518
|
skills: agentConfig.skills ?? [],
|
|
22432
22519
|
category,
|
|
22433
22520
|
effectiveToolPolicy,
|
|
22434
|
-
delegationTargets
|
|
22521
|
+
delegationTargets,
|
|
22522
|
+
reviewRouting
|
|
22435
22523
|
});
|
|
22436
22524
|
if (contextResult.isErr()) {
|
|
22437
22525
|
return errAsync({
|
|
@@ -22888,13 +22976,8 @@ function buildLegacyRunAgentEffect(stepName) {
|
|
|
22888
22976
|
resolvedSkills: []
|
|
22889
22977
|
};
|
|
22890
22978
|
}
|
|
22891
|
-
function buildConfiguredRunAgentEffect(step, promptMetadata
|
|
22979
|
+
function buildConfiguredRunAgentEffect(step, promptMetadata) {
|
|
22892
22980
|
const effectivePolicy = evaluateEffectiveToolPolicy(undefined);
|
|
22893
|
-
const isGateReviewVerdict = step.type === "gate" && step.completion.method === "review_verdict";
|
|
22894
|
-
const reviewFanOutIntent = isGateReviewVerdict && agentConfig?.review_models && agentConfig.review_models.length > 0 ? {
|
|
22895
|
-
agentName: step.agent,
|
|
22896
|
-
reviewModels: agentConfig.review_models
|
|
22897
|
-
} : undefined;
|
|
22898
22981
|
return {
|
|
22899
22982
|
kind: "run-agent",
|
|
22900
22983
|
agentName: step.agent,
|
|
@@ -22914,8 +22997,7 @@ function buildConfiguredRunAgentEffect(step, promptMetadata, agentConfig) {
|
|
|
22914
22997
|
completionMethod: step.completion.method,
|
|
22915
22998
|
stepType: step.type,
|
|
22916
22999
|
correlationId: crypto.randomUUID(),
|
|
22917
|
-
promptMetadata
|
|
22918
|
-
...reviewFanOutIntent !== undefined ? { reviewFanOutIntent } : {}
|
|
23000
|
+
promptMetadata
|
|
22919
23001
|
};
|
|
22920
23002
|
}
|
|
22921
23003
|
function resolveWorkflowStep(workflowConfig, stepName) {
|
|
@@ -22994,7 +23076,7 @@ function dispatchStep(input, store) {
|
|
|
22994
23076
|
effects: [
|
|
22995
23077
|
{
|
|
22996
23078
|
kind: "dispatch-agent",
|
|
22997
|
-
runAgent: buildConfiguredRunAgentEffect(step, promptMetadata
|
|
23079
|
+
runAgent: buildConfiguredRunAgentEffect(step, promptMetadata)
|
|
22998
23080
|
}
|
|
22999
23081
|
],
|
|
23000
23082
|
...hasInputs ? { artifactInputSummary } : {}
|
|
@@ -23416,6 +23498,64 @@ function startExecution(input, store) {
|
|
|
23416
23498
|
effects: []
|
|
23417
23499
|
}));
|
|
23418
23500
|
}
|
|
23501
|
+
// ../../engine/src/review-variants.ts
|
|
23502
|
+
function reviewVariantName(agentName, model) {
|
|
23503
|
+
const safeModel = model.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
23504
|
+
return `${agentName}-${safeModel}`;
|
|
23505
|
+
}
|
|
23506
|
+
function generateReviewVariants(config2) {
|
|
23507
|
+
const result = {};
|
|
23508
|
+
for (const [agentName, agent] of Object.entries(config2.agents)) {
|
|
23509
|
+
if (!agent.review_models || agent.review_models.length === 0)
|
|
23510
|
+
continue;
|
|
23511
|
+
if (config2.disabled.agents.includes(agentName))
|
|
23512
|
+
continue;
|
|
23513
|
+
for (const reviewModel of agent.review_models) {
|
|
23514
|
+
const variantName = reviewVariantName(agentName, reviewModel);
|
|
23515
|
+
if (config2.agents[variantName] !== undefined) {
|
|
23516
|
+
return err({
|
|
23517
|
+
type: "ReviewVariantConflictError",
|
|
23518
|
+
variantName,
|
|
23519
|
+
agentName,
|
|
23520
|
+
reviewModel,
|
|
23521
|
+
message: `Agent "${variantName}" is explicitly declared and would also be ` + `generated as a review variant of "${agentName}" for model "${reviewModel}". ` + "Remove the explicit agent declaration or rename the agent."
|
|
23522
|
+
});
|
|
23523
|
+
}
|
|
23524
|
+
if (result[variantName] !== undefined) {
|
|
23525
|
+
return err({
|
|
23526
|
+
type: "ReviewVariantConflictError",
|
|
23527
|
+
variantName,
|
|
23528
|
+
agentName,
|
|
23529
|
+
reviewModel,
|
|
23530
|
+
message: `Review variant name "${variantName}" would be generated more than once. ` + `Two agents produce the same variant name for model "${reviewModel}". ` + "Ensure no two agents produce the same variant name."
|
|
23531
|
+
});
|
|
23532
|
+
}
|
|
23533
|
+
if (config2.disabled.agents.includes(variantName))
|
|
23534
|
+
continue;
|
|
23535
|
+
const readOnlyPolicy = {
|
|
23536
|
+
read: "allow",
|
|
23537
|
+
write: "deny",
|
|
23538
|
+
execute: "deny",
|
|
23539
|
+
delegate: "deny",
|
|
23540
|
+
network: "deny"
|
|
23541
|
+
};
|
|
23542
|
+
result[variantName] = {
|
|
23543
|
+
config: {
|
|
23544
|
+
...agent,
|
|
23545
|
+
name: variantName,
|
|
23546
|
+
mode: "subagent",
|
|
23547
|
+
models: [reviewModel],
|
|
23548
|
+
tool_policy: readOnlyPolicy,
|
|
23549
|
+
review_models: undefined
|
|
23550
|
+
},
|
|
23551
|
+
sourceAgentName: agentName,
|
|
23552
|
+
reviewModel
|
|
23553
|
+
};
|
|
23554
|
+
}
|
|
23555
|
+
}
|
|
23556
|
+
return ok(result);
|
|
23557
|
+
}
|
|
23558
|
+
|
|
23419
23559
|
// ../../engine/src/materialization.ts
|
|
23420
23560
|
function filterDisabled(entries, disabled) {
|
|
23421
23561
|
return entries.filter(([agentName]) => !disabled.includes(agentName));
|
|
@@ -23431,16 +23571,56 @@ function materializeAgents(input) {
|
|
|
23431
23571
|
conflict: generatedShuttlesResult.error
|
|
23432
23572
|
}
|
|
23433
23573
|
] : [];
|
|
23434
|
-
const
|
|
23435
|
-
const
|
|
23436
|
-
const
|
|
23574
|
+
const generatedReviewVariantsResult = generateReviewVariants(config2);
|
|
23575
|
+
const generatedReviewVariants = generatedReviewVariantsResult.isOk() ? generatedReviewVariantsResult.value : {};
|
|
23576
|
+
const reviewVariantErrors = generatedReviewVariantsResult.isErr() ? [
|
|
23577
|
+
{
|
|
23578
|
+
type: "ReviewVariantConflict",
|
|
23579
|
+
conflict: generatedReviewVariantsResult.error
|
|
23580
|
+
}
|
|
23581
|
+
] : [];
|
|
23582
|
+
const explicitEntries = filterDisabled(Object.entries(config2.agents), disabled).map(([agentName, agentConfig]) => ({
|
|
23583
|
+
agentName,
|
|
23584
|
+
agentConfig,
|
|
23585
|
+
entrySource: { source: "explicit" }
|
|
23586
|
+
}));
|
|
23587
|
+
const generatedEntries = filterDisabled(Object.entries(generatedShuttles).map(([agentName, generated]) => [agentName, generated.config]), disabled).map(([agentName, agentConfig]) => ({
|
|
23588
|
+
agentName,
|
|
23589
|
+
agentConfig,
|
|
23590
|
+
entrySource: { source: "category-shuttle" }
|
|
23591
|
+
}));
|
|
23592
|
+
const reviewVariantEntries = Object.entries(generatedReviewVariants).filter(([agentName]) => !disabled.includes(agentName)).map(([agentName, generated]) => ({
|
|
23593
|
+
agentName,
|
|
23594
|
+
agentConfig: generated.config,
|
|
23595
|
+
entrySource: {
|
|
23596
|
+
source: "review-variant",
|
|
23597
|
+
sourceAgentName: generated.sourceAgentName,
|
|
23598
|
+
reviewModel: generated.reviewModel
|
|
23599
|
+
}
|
|
23600
|
+
}));
|
|
23601
|
+
const allTypedEntries = [
|
|
23437
23602
|
...explicitEntries,
|
|
23438
|
-
...generatedEntries
|
|
23603
|
+
...generatedEntries,
|
|
23604
|
+
...reviewVariantEntries
|
|
23439
23605
|
];
|
|
23606
|
+
const allEntries = allTypedEntries.map(({ agentName, agentConfig }) => [agentName, agentConfig]);
|
|
23440
23607
|
const allAgents = Object.fromEntries(allEntries);
|
|
23441
|
-
const
|
|
23608
|
+
const prebuiltReviewVariants = reviewVariantEntries.map(({ agentName: rvName, agentConfig: _rvConfig, entrySource: rvSource }) => {
|
|
23609
|
+
const rv = rvSource;
|
|
23610
|
+
return {
|
|
23611
|
+
agentName: rvName,
|
|
23612
|
+
descriptor: null,
|
|
23613
|
+
source: "review-variant",
|
|
23614
|
+
reviewMeta: {
|
|
23615
|
+
sourceAgentName: rv.sourceAgentName,
|
|
23616
|
+
reviewModel: rv.reviewModel
|
|
23617
|
+
}
|
|
23618
|
+
};
|
|
23619
|
+
});
|
|
23620
|
+
const compositionPromises = allTypedEntries.map(({ agentName, agentConfig, entrySource }) => {
|
|
23442
23621
|
const category = generatedShuttles[agentName]?.categoryMeta;
|
|
23443
|
-
|
|
23622
|
+
const isPrimary = agentConfig.mode === "primary";
|
|
23623
|
+
return composeAgentDescriptor(agentName, agentConfig, config2, allAgents, category, isPrimary ? prebuiltReviewVariants : undefined).match((descriptor) => ({ ok: true, agentName, descriptor, entrySource }), (cause) => ({
|
|
23444
23624
|
ok: false,
|
|
23445
23625
|
error: { type: "DescriptorCompositionFailure", agentName, cause }
|
|
23446
23626
|
}));
|
|
@@ -23450,16 +23630,25 @@ function materializeAgents(input) {
|
|
|
23450
23630
|
const compositionErrors = [];
|
|
23451
23631
|
for (const result of composed) {
|
|
23452
23632
|
if (result.ok) {
|
|
23453
|
-
|
|
23633
|
+
const agent = {
|
|
23454
23634
|
agentName: result.agentName,
|
|
23455
|
-
descriptor: result.descriptor
|
|
23456
|
-
|
|
23635
|
+
descriptor: result.descriptor,
|
|
23636
|
+
source: result.entrySource.source
|
|
23637
|
+
};
|
|
23638
|
+
if (result.entrySource.source === "review-variant") {
|
|
23639
|
+
agent.reviewMeta = {
|
|
23640
|
+
sourceAgentName: result.entrySource.sourceAgentName,
|
|
23641
|
+
reviewModel: result.entrySource.reviewModel
|
|
23642
|
+
};
|
|
23643
|
+
}
|
|
23644
|
+
agents.push(agent);
|
|
23457
23645
|
} else {
|
|
23458
23646
|
compositionErrors.push(result.error);
|
|
23459
23647
|
}
|
|
23460
23648
|
}
|
|
23461
23649
|
const errors3 = [
|
|
23462
23650
|
...conflictErrors,
|
|
23651
|
+
...reviewVariantErrors,
|
|
23463
23652
|
...compositionErrors
|
|
23464
23653
|
];
|
|
23465
23654
|
return okAsync({ agents, errors: errors3 });
|
|
@@ -24446,16 +24635,20 @@ function resolveNextStepName(workflowConfig, completedStepName) {
|
|
|
24446
24635
|
return;
|
|
24447
24636
|
return workflowConfig.steps[currentIndex + 1]?.name;
|
|
24448
24637
|
}
|
|
24449
|
-
function completeAndAdvance(stepName, state) {
|
|
24638
|
+
function completeAndAdvance(stepName, state, dispatchEffect) {
|
|
24450
24639
|
const stepConfig = state.workflowConfig.steps.find((s) => s.name === stepName);
|
|
24451
24640
|
const completionMethod = stepConfig?.completion.method ?? "agent_signal";
|
|
24641
|
+
const isReviewVerdict = dispatchEffect?.runAgent.completionMethod === "review_verdict";
|
|
24642
|
+
const outcome = "success";
|
|
24643
|
+
const approved = isReviewVerdict ? true : undefined;
|
|
24452
24644
|
return completeStep({
|
|
24453
24645
|
workflowInstanceId: state.workflowInstanceId,
|
|
24454
24646
|
leaseId: state.leaseId,
|
|
24455
24647
|
stepName,
|
|
24456
24648
|
completionSignal: {
|
|
24457
|
-
outcome
|
|
24458
|
-
method: completionMethod
|
|
24649
|
+
outcome,
|
|
24650
|
+
method: completionMethod,
|
|
24651
|
+
...approved !== undefined ? { approved } : {}
|
|
24459
24652
|
},
|
|
24460
24653
|
context: state.context,
|
|
24461
24654
|
planStateProvider: state.planStateProvider
|
|
@@ -24513,9 +24706,9 @@ function completeAndAdvance(stepName, state) {
|
|
|
24513
24706
|
});
|
|
24514
24707
|
}
|
|
24515
24708
|
log8.info({ nextStepName, stepsDispatched: state.stepsDispatched }, "Auto-advancing to next step");
|
|
24516
|
-
return state.projectEffect(nextDispatch).andThen(() => completeAndAdvance(nextStepName, state));
|
|
24709
|
+
return state.projectEffect(nextDispatch).andThen(() => completeAndAdvance(nextStepName, state, nextDispatch));
|
|
24517
24710
|
}
|
|
24518
|
-
log8.warn({ stepName, effectKinds: completionEffects.map((e) => e.kind) }, "completeStep returned no terminal or advance effect \u2014
|
|
24711
|
+
log8.warn({ stepName, effectKinds: completionEffects.map((e) => e.kind) }, "completeStep returned no terminal or advance effect \u2014 treated as completed");
|
|
24519
24712
|
return okAsync({
|
|
24520
24713
|
workflowInstanceId: state.workflowInstanceId,
|
|
24521
24714
|
leaseId: state.leaseId,
|
|
@@ -24549,8 +24742,7 @@ function runWorkflowLifecycle(input) {
|
|
|
24549
24742
|
workflowName,
|
|
24550
24743
|
goal,
|
|
24551
24744
|
slug,
|
|
24552
|
-
workflows
|
|
24553
|
-
...input.agentConfigs !== undefined ? { agentConfigs: input.agentConfigs } : {}
|
|
24745
|
+
workflows
|
|
24554
24746
|
};
|
|
24555
24747
|
log8.info({ workflowName, goal, slug, workflowInstanceId }, "Starting workflow lifecycle");
|
|
24556
24748
|
return startExecution({
|
|
@@ -24571,7 +24763,8 @@ function runWorkflowLifecycle(input) {
|
|
|
24571
24763
|
effects,
|
|
24572
24764
|
stepsDispatched: 0,
|
|
24573
24765
|
maxSteps,
|
|
24574
|
-
projectEffect
|
|
24766
|
+
projectEffect,
|
|
24767
|
+
goal
|
|
24575
24768
|
};
|
|
24576
24769
|
return dispatchStep({
|
|
24577
24770
|
workflowInstanceId,
|
|
@@ -24585,7 +24778,8 @@ function runWorkflowLifecycle(input) {
|
|
|
24585
24778
|
}
|
|
24586
24779
|
const dispatchAgentEffects = dispatchEffects.filter((e) => e.kind === "dispatch-agent");
|
|
24587
24780
|
const applyAll = dispatchAgentEffects.reduce((chain, effect) => chain.andThen(() => projectEffect(effect)), okAsync(undefined));
|
|
24588
|
-
|
|
24781
|
+
const firstDispatch = dispatchAgentEffects[0];
|
|
24782
|
+
return applyAll.andThen(() => completeAndAdvance(stepName, state, firstDispatch));
|
|
24589
24783
|
});
|
|
24590
24784
|
});
|
|
24591
24785
|
}
|
|
@@ -26020,7 +26214,7 @@ var log18 = logger.child({ module: "adapter-opencode/plugin" });
|
|
|
26020
26214
|
var DEFAULT_PLUGIN_LOG_SUBPATH = ".weave/weave.log";
|
|
26021
26215
|
function createWeavePlugin(options = {}) {
|
|
26022
26216
|
return async (input) => {
|
|
26023
|
-
const {
|
|
26217
|
+
const { directory } = input;
|
|
26024
26218
|
if (!env.WEAVE_LOG_FILE) {
|
|
26025
26219
|
const dirExists = await Bun.file(directory).stat().then(() => true).catch(() => false);
|
|
26026
26220
|
if (dirExists) {
|
|
@@ -26064,37 +26258,6 @@ function createWeavePlugin(options = {}) {
|
|
|
26064
26258
|
log18.debug({ agent: agentName }, "Agent translated for config hook");
|
|
26065
26259
|
}
|
|
26066
26260
|
log18.info({ agentCount: translatedMap.size }, "Agents translated for config hook injection");
|
|
26067
|
-
const agentDescriptors = plan.agents.map(({ agentName, descriptor }) => ({
|
|
26068
|
-
agentName,
|
|
26069
|
-
descriptor
|
|
26070
|
-
}));
|
|
26071
|
-
const clientFacade = options.clientFacade ?? new SdkOpenCodeClient(sdkClient);
|
|
26072
|
-
let reconciled = false;
|
|
26073
|
-
async function runReconciliation() {
|
|
26074
|
-
if (reconciled)
|
|
26075
|
-
return;
|
|
26076
|
-
reconciled = true;
|
|
26077
|
-
log18.info({ agentCount: agentDescriptors.length }, "Running deferred SDK reconciliation (session.created)");
|
|
26078
|
-
const adapter = new OpenCodeAdapter({
|
|
26079
|
-
projectRoot: directory,
|
|
26080
|
-
client: clientFacade
|
|
26081
|
-
});
|
|
26082
|
-
try {
|
|
26083
|
-
await adapter.init();
|
|
26084
|
-
} catch (initErr) {
|
|
26085
|
-
log18.error({ error: initErr }, "adapter.init() failed \u2014 aborting deferred SDK reconciliation");
|
|
26086
|
-
return;
|
|
26087
|
-
}
|
|
26088
|
-
for (const { agentName, descriptor } of agentDescriptors) {
|
|
26089
|
-
const spawnResult = await adapter.spawnSubagent(descriptor);
|
|
26090
|
-
if (spawnResult.isErr()) {
|
|
26091
|
-
log18.error({ agent: agentName, error: spawnResult.error }, "Failed to materialize agent \u2014 continuing with remaining agents");
|
|
26092
|
-
} else {
|
|
26093
|
-
log18.info({ agent: agentName }, "Agent materialized via SDK");
|
|
26094
|
-
}
|
|
26095
|
-
}
|
|
26096
|
-
log18.info({ agentCount: agentDescriptors.length }, "Deferred SDK reconciliation complete");
|
|
26097
|
-
}
|
|
26098
26261
|
log18.info("Weave plugin hooks ready \u2014 returning immediately");
|
|
26099
26262
|
return {
|
|
26100
26263
|
config: async (cfg) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opencode-client.d.ts","sourceRoot":"","sources":["../src/opencode-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"opencode-client.d.ts","sourceRoot":"","sources":["../src/opencode-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,cAAc,EACf,MAAM,gBAAgB,CAAC;AAMxB;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IACE,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GACD;IACE,IAAI,EAAE,kBAAkB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GACD;IACE,IAAI,EAAE,kBAAkB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAMN;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,UAAU,IAAI,WAAW,CAAC,aAAa,EAAE,EAAE,mBAAmB,CAAC,CAAC;IAEhE;;;;;;;;OAQG;IACH,WAAW,CACT,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,mBAAmB,GAC1B,WAAW,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IAE1C;;;;;;;;;;;OAWG;IACH,WAAW,CACT,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,mBAAmB,GAC1B,WAAW,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;CAC3C;AAMD;;;;;GAKG;AACH,qBAAa,iBAAkB,YAAW,oBAAoB;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAEnD,UAAU,IAAI,WAAW,CAAC,aAAa,EAAE,EAAE,mBAAmB,CAAC;IAkB/D,WAAW,CACT,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,mBAAmB,GAC1B,WAAW,CAAC,IAAI,EAAE,mBAAmB,CAAC;IAoBzC,WAAW,CACT,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,mBAAmB,GAC1B,WAAW,CAAC,IAAI,EAAE,mBAAmB,CAAC;CAmB1C"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
*/
|
|
88
88
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
89
89
|
import { type FileReader } from "@weaveio/weave-config";
|
|
90
|
-
import {
|
|
90
|
+
import type { OpenCodeClientFacade } from "./opencode-client.js";
|
|
91
91
|
/**
|
|
92
92
|
* Options for `createWeavePlugin`.
|
|
93
93
|
*
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAGH,OAAO,KAAK,EAAS,MAAM,EAAe,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,KAAK,UAAU,EAAc,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAGH,OAAO,KAAK,EAAS,MAAM,EAAe,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,KAAK,UAAU,EAAc,MAAM,uBAAuB,CAAC;AAapE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAuBjE;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IAEjC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAkL1E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,EAAE,MAA4B,CAAC;AAEvD;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,QAAc,CAAC;AAElC,eAAe,WAAW,CAAC"}
|