@yeaft/webchat-agent 1.0.219 → 1.0.221

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "1.0.219",
3
+ "version": "1.0.221",
4
4
  "description": "Remote worker agent for Yeaft Web Code Agent — connects the native Yeaft engine, CLI providers, and workbench tools",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -6,6 +6,7 @@ function normalizeCriteria(value) {
6
6
  export function normalizeContractPatch(value) {
7
7
  if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
8
8
  const patch = {};
9
+ if (typeof value.title === 'string' && value.title.trim()) patch.title = value.title.trim().slice(0, 200);
9
10
  if (typeof value.goal === 'string' && value.goal.trim()) patch.goal = value.goal.trim();
10
11
  if (Object.hasOwn(value, 'acceptanceCriteria')) {
11
12
  const criteria = normalizeCriteria(value.acceptanceCriteria);
@@ -344,6 +344,7 @@ export class WorkflowController {
344
344
  const effective = result.contractPatch
345
345
  ? {
346
346
  ...current,
347
+ title: result.contractPatch.title ?? current.title,
347
348
  goal: result.contractPatch.goal ?? current.goal,
348
349
  acceptanceCriteria: result.contractPatch.acceptanceCriteria ?? current.acceptanceCriteria,
349
350
  }
@@ -461,6 +462,7 @@ export class WorkflowController {
461
462
  const effectiveWorkItem = contractPatch
462
463
  ? {
463
464
  ...workItem,
465
+ title: contractPatch.title ?? workItem.title,
464
466
  goal: contractPatch.goal ?? workItem.goal,
465
467
  acceptanceCriteria: contractPatch.acceptanceCriteria ?? workItem.acceptanceCriteria,
466
468
  revision: workItem.revision + 1,
@@ -319,12 +319,12 @@ export function createSubmitWorkItemPlanTool({
319
319
  parameters: {
320
320
  type: 'object',
321
321
  additionalProperties: false,
322
- required: ['summary', 'evidence', 'acceptanceChecks', 'workItemType', 'actions'],
322
+ required: ['summary', 'evidence', 'acceptanceChecks', 'contractPatch', 'workItemType', 'actions'],
323
323
  properties: {
324
324
  summary: { type: 'string', minLength: 1, maxLength: 2_000 },
325
325
  evidence: { type: 'array', minItems: 1, maxItems: 20, items: { type: 'string', minLength: 1, maxLength: 1_000 } },
326
326
  acceptanceChecks: { type: 'array', items: { type: 'object', additionalProperties: false, required: ['criterion', 'status', 'evidence'], properties: { criterion: { type: 'string' }, status: { type: 'string', enum: ['passed', 'deferred', 'not_applicable'] }, evidence: { type: 'string', minLength: 1, maxLength: 1_000 } } } },
327
- contractPatch: { type: 'object', additionalProperties: false, properties: { goal: { type: 'string', minLength: 1, maxLength: 8_000 }, acceptanceCriteria: { type: 'array', items: { type: 'string', minLength: 1, maxLength: 2_000 } } } },
327
+ contractPatch: { type: 'object', additionalProperties: false, required: ['title', 'goal', 'acceptanceCriteria'], properties: { title: { type: 'string', minLength: 1, maxLength: 200 }, goal: { type: 'string', minLength: 1, maxLength: 8_000 }, acceptanceCriteria: { type: 'array', minItems: 1, items: { type: 'string', minLength: 1, maxLength: 2_000 } } } },
328
328
  workItemType: { type: 'string', minLength: 1, maxLength: 64 },
329
329
  actions: { type: 'array', minItems: 1, maxItems: 8, items: { type: 'object', additionalProperties: false, required: ['id', 'name', 'type', 'objective', 'approach', 'expectedOutcome', 'candidateVpIds', 'assignmentReason', 'dependsOnActionIds', 'workspaceMode'], properties: {
330
330
  id: { type: 'string', minLength: 1, maxLength: 64 }, name: { type: 'string', minLength: 1, maxLength: 120 },
@@ -340,6 +340,9 @@ export function createSubmitWorkItemPlanTool({
340
340
  if (!isRunActive()) throw new Error('Work Center Run is no longer active');
341
341
  if (collector.value) throw new Error('WorkItem plan was already submitted for this Run');
342
342
  const contractPatch = normalizeContractPatch(input.contractPatch);
343
+ if (!contractPatch?.title || !contractPatch?.goal || !contractPatch?.acceptanceCriteria?.length) {
344
+ throw new Error('Initial WorkItem plan requires title, goal, and acceptanceCriteria');
345
+ }
343
346
  const proposedResult = {
344
347
  outcome: 'completed',
345
348
  evidence: normalizeEvidence(input.evidence),
@@ -350,6 +353,7 @@ export function createSubmitWorkItemPlanTool({
350
353
  if (proposedResult.outcome !== 'completed') throw new Error(proposedResult.error);
351
354
  const effectiveWorkItem = contractPatch ? {
352
355
  ...workItem,
356
+ title: contractPatch.title ?? workItem.title,
353
357
  goal: contractPatch.goal ?? workItem.goal,
354
358
  acceptanceCriteria: contractPatch.acceptanceCriteria ?? workItem.acceptanceCriteria,
355
359
  } : workItem;
@@ -548,7 +552,7 @@ function completionContract(action, workItem) {
548
552
  ? ',\n "reviewDecision": "approved|changes_requested"'
549
553
  : '';
550
554
  const triageField = action.type === 'triage'
551
- ? ',\n "contractPatch": { "goal": "optional refined goal", "acceptanceCriteria": ["optional refined criterion"] }'
555
+ ? ',\n "contractPatch": { "title": "concise AI-generated title", "goal": "precise AI-generated goal", "acceptanceCriteria": ["verifiable AI-generated criterion"] }'
552
556
  : '';
553
557
  const planField = action.type === 'triage'
554
558
  && !action.stageId?.startsWith('replan-')
@@ -2153,10 +2153,12 @@ export class WorkItemStore {
2153
2153
  let nextWorkItem = workItem;
2154
2154
  if (transition.contractPatch) {
2155
2155
  const patch = transition.contractPatch;
2156
+ const title = patch.title ?? workItem.title;
2156
2157
  const goal = patch.goal ?? workItem.goal;
2157
2158
  const criteria = patch.acceptanceCriteria ?? workItem.acceptanceCriteria;
2158
- this.db.prepare(`UPDATE work_items SET goal = ?, acceptance_criteria = ?,
2159
+ this.db.prepare(`UPDATE work_items SET title = ?, goal = ?, acceptance_criteria = ?,
2159
2160
  revision = revision + 1, updated_at = ? WHERE id = ?`).run(
2161
+ title,
2160
2162
  goal,
2161
2163
  stringify(criteria),
2162
2164
  now,