@syntesseraai/opencode-feature-factory 0.2.39 → 0.2.40

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.
@@ -13,4 +13,14 @@ export declare function sanitizeOutput(output: string): string;
13
13
  * Adds a header indicating truncation if the output was longer than the limit.
14
14
  */
15
15
  export declare function truncateOutput(output: string, maxLines?: number): string;
16
+ export declare function extractAgentNameFromPart(part: unknown): string | undefined;
17
+ type PromptBody = {
18
+ parts: Array<{
19
+ type: 'text';
20
+ text: string;
21
+ }>;
22
+ agent?: string;
23
+ };
24
+ export declare function buildQualityGatePromptBody(message: string, agent?: string): PromptBody;
16
25
  export declare const StopQualityGateHooksPlugin: Plugin;
26
+ export {};
@@ -87,6 +87,31 @@ export function truncateOutput(output, maxLines = 20) {
87
87
  const omittedCount = lines.length - maxLines;
88
88
  return `... (${omittedCount} lines omitted)\n${truncatedLines.join('\n')}`;
89
89
  }
90
+ export function extractAgentNameFromPart(part) {
91
+ if (!part || typeof part !== 'object')
92
+ return undefined;
93
+ const candidate = part;
94
+ if (candidate.type !== 'agent')
95
+ return undefined;
96
+ if (typeof candidate.name !== 'string')
97
+ return undefined;
98
+ const trimmed = candidate.name.trim();
99
+ return trimmed.length > 0 ? trimmed : undefined;
100
+ }
101
+ export function buildQualityGatePromptBody(message, agent) {
102
+ const body = {
103
+ parts: [
104
+ {
105
+ type: 'text',
106
+ text: message,
107
+ },
108
+ ],
109
+ };
110
+ if (agent) {
111
+ body.agent = agent;
112
+ }
113
+ return body;
114
+ }
90
115
  const sessions = new Map();
91
116
  let cleanupIntervalId = null;
92
117
  /**
@@ -299,14 +324,7 @@ If the failure details are missing or truncated, run "ff-ci.sh" to get the full
299
324
  : `❌ Quality gate failed\n\nThe CI checks did not pass. Please review the output below and fix the issues:\n\n\`\`\`\n${sanitizedOutput}\n\`\`\`${instructions}`;
300
325
  await client.session.prompt({
301
326
  path: { id: sessionId },
302
- body: {
303
- parts: [
304
- {
305
- type: 'text',
306
- text: message,
307
- },
308
- ],
309
- },
327
+ body: buildQualityGatePromptBody(message, state.lastAgent),
310
328
  });
311
329
  await log(client, 'debug', timedOut ? 'quality-gate.timeout-reported' : 'quality-gate.failed', { sessionId });
312
330
  }
@@ -350,6 +368,16 @@ If the failure details are missing or truncated, run "ff-ci.sh" to get the full
350
368
  sessions.delete(sessionId);
351
369
  await log(client, 'debug', 'session.deleted', { sessionId });
352
370
  }
371
+ if (event.type === 'message.part.updated') {
372
+ const partSessionId = sessionId ?? event.properties?.part?.sessionID;
373
+ if (partSessionId) {
374
+ const state = getSessionState(partSessionId);
375
+ const agentName = extractAgentNameFromPart(event.properties?.part);
376
+ if (agentName) {
377
+ state.lastAgent = agentName;
378
+ }
379
+ }
380
+ }
353
381
  if (event.type === 'session.idle' && sessionId) {
354
382
  const state = getSessionState(sessionId);
355
383
  if (state.parentID) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@syntesseraai/opencode-feature-factory",
4
- "version": "0.2.39",
4
+ "version": "0.2.40",
5
5
  "type": "module",
6
6
  "description": "OpenCode plugin for Feature Factory agents - provides sub-agents and skills for validation, review, security, and architecture assessment",
7
7
  "license": "MIT",