@praxisui/expansion 8.0.0-beta.33 → 8.0.0-beta.35

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.
@@ -244,7 +244,7 @@ class ExpansionAgenticAuthoringTurnFlow {
244
244
  const schemaFields = this.adapter.getSchemaFields?.()
245
245
  ?.map((field) => this.toAiJsonObject(field))
246
246
  .filter((field) => Object.keys(field).length > 0);
247
- const contextHints = this.optionalJsonObject(this.adapter.getAuthoringContext?.());
247
+ const contextHints = this.mergeJsonObjects(this.optionalJsonObject(this.adapter.getAuthoringContext?.()), this.optionalJsonObject(request.action?.contextHints));
248
248
  if (this.shouldRouteToGovernedDecision(prompt, contextHints)) {
249
249
  return this.toGovernedDecisionHandoff(prompt, request);
250
250
  }
@@ -300,6 +300,7 @@ class ExpansionAgenticAuthoringTurnFlow {
300
300
  state: 'clarification',
301
301
  phase: 'clarify',
302
302
  sessionId: response.sessionId ?? request.sessionId,
303
+ observationId: response.observationId ?? request.observationId ?? null,
303
304
  assistantMessage: response.message || 'Preciso de mais detalhes para continuar.',
304
305
  clarificationQuestions: this.toClarificationQuestions(response),
305
306
  quickReplies: this.toQuickReplies(response),
@@ -316,6 +317,7 @@ class ExpansionAgenticAuthoringTurnFlow {
316
317
  state: 'error',
317
318
  phase: 'capture',
318
319
  sessionId: response.sessionId ?? request.sessionId,
320
+ observationId: response.observationId ?? request.observationId ?? null,
319
321
  assistantMessage: message,
320
322
  errorText: message,
321
323
  diagnostics: response.warnings?.length ? { warnings: response.warnings } : undefined,
@@ -326,6 +328,7 @@ class ExpansionAgenticAuthoringTurnFlow {
326
328
  state: 'error',
327
329
  phase: 'review',
328
330
  sessionId: response.sessionId ?? request.sessionId,
331
+ observationId: response.observationId ?? request.observationId ?? null,
329
332
  assistantMessage: 'O expansion rejeitou patch livre. Gere um componentEditPlan validado pelo PRAXIS_EXPANSION_AUTHORING_MANIFEST antes de propor alteracao local.',
330
333
  errorText: 'Patch livre de expansion rejeitado.',
331
334
  canApply: false,
@@ -342,6 +345,7 @@ class ExpansionAgenticAuthoringTurnFlow {
342
345
  state: 'success',
343
346
  phase: 'summarize',
344
347
  sessionId: response.sessionId ?? request.sessionId,
348
+ observationId: response.observationId ?? request.observationId ?? null,
345
349
  assistantMessage: response.message || response.explanation || 'Nenhuma alteracao necessaria.',
346
350
  statusText: response.message || response.explanation || 'Nenhuma alteracao necessaria.',
347
351
  canApply: false,
@@ -372,7 +376,13 @@ class ExpansionAgenticAuthoringTurnFlow {
372
376
  const labels = response.questions?.length
373
377
  ? response.questions
374
378
  : response.message ? [response.message] : ['Qual ajuste voce quer aplicar nos paineis?'];
375
- const options = this.toQuickReplies(response).map((reply) => ({ id: reply.id, label: reply.label, value: reply.prompt }));
379
+ const options = this.toQuickReplies(response).map((reply) => ({
380
+ id: reply.id,
381
+ label: reply.label,
382
+ value: reply.prompt,
383
+ description: reply.description ?? undefined,
384
+ contextHints: reply.contextHints ? { ...reply.contextHints } : undefined,
385
+ }));
376
386
  return labels.map((label, index) => ({
377
387
  id: `expansion-clarification-${index + 1}`,
378
388
  type: options.length ? 'single-choice' : 'text',
@@ -386,8 +396,15 @@ class ExpansionAgenticAuthoringTurnFlow {
386
396
  if (payloads.length) {
387
397
  return payloads.map((option, index) => {
388
398
  const label = option.label?.trim() || option.value?.trim() || `Opcao ${index + 1}`;
389
- const prompt = option.example?.trim() || option.value?.trim() || label;
390
- return { id: `option-${index + 1}`, label, prompt, kind: 'clarification-option' };
399
+ const prompt = option.value?.trim() || option.example?.trim() || label;
400
+ return {
401
+ id: `option-${index + 1}`,
402
+ label,
403
+ prompt,
404
+ kind: 'clarification-option',
405
+ description: option.example?.trim() || undefined,
406
+ contextHints: this.optionalJsonObject(option.contextHints),
407
+ };
391
408
  });
392
409
  }
393
410
  return (response.options ?? [])
@@ -459,6 +476,16 @@ class ExpansionAgenticAuthoringTurnFlow {
459
476
  const object = this.toAiJsonObject(value);
460
477
  return Object.keys(object).length ? object : undefined;
461
478
  }
479
+ mergeJsonObjects(base, overlay) {
480
+ if (!base)
481
+ return overlay;
482
+ if (!overlay)
483
+ return base;
484
+ return {
485
+ ...base,
486
+ ...overlay,
487
+ };
488
+ }
462
489
  toAiJsonObject(value) {
463
490
  const record = this.toRecord(value);
464
491
  if (!record)
@@ -859,12 +886,21 @@ class PraxisExpansion {
859
886
  if (!controller)
860
887
  return;
861
888
  const state = controller.snapshot();
889
+ const contextHints = reply.contextHints ? { ...reply.contextHints } : undefined;
862
890
  const next$ = state.state === 'clarification'
863
- ? controller.answerClarification(reply.prompt)
891
+ ? controller.answerClarification({
892
+ id: reply.id,
893
+ label: reply.label,
894
+ value: reply.prompt,
895
+ description: reply.description ?? undefined,
896
+ contextHints,
897
+ })
864
898
  : controller.submitPrompt(reply.prompt, {
865
899
  kind: reply.kind || 'quick-reply',
866
900
  id: reply.id,
867
901
  value: reply.prompt,
902
+ displayPrompt: reply.label,
903
+ contextHints,
868
904
  });
869
905
  next$.subscribe((nextState) => {
870
906
  this.aiAssistantPrompt = '';
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@praxisui/expansion",
3
- "version": "8.0.0-beta.33",
3
+ "version": "8.0.0-beta.35",
4
4
  "description": "Expansion panel (accordion) components for Praxis UI with metadata configuration and editor integration.",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^21.0.0",
7
7
  "@angular/core": "^21.0.0",
8
8
  "@angular/material": "^21.0.0",
9
9
  "@angular/cdk": "^21.0.0",
10
- "@praxisui/core": "^8.0.0-beta.33",
11
- "@praxisui/dynamic-fields": "^8.0.0-beta.33",
12
- "@praxisui/settings-panel": "^8.0.0-beta.33",
10
+ "@praxisui/core": "^8.0.0-beta.35",
11
+ "@praxisui/dynamic-fields": "^8.0.0-beta.35",
12
+ "@praxisui/settings-panel": "^8.0.0-beta.35",
13
13
  "@angular/forms": "^21.0.0",
14
14
  "@angular/router": "^21.0.0",
15
- "@praxisui/ai": "^8.0.0-beta.33",
15
+ "@praxisui/ai": "^8.0.0-beta.35",
16
16
  "rxjs": "~7.8.0"
17
17
  },
18
18
  "dependencies": {