@trismegisto/angular 3.3.9 → 3.3.11
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/fesm2022/trismegisto-angular-agent.mjs +458 -73
- package/fesm2022/trismegisto-angular-agent.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-api-exchange.mjs +1 -1
- package/fesm2022/trismegisto-angular-api-exchange.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-attachment.mjs +6 -2
- package/fesm2022/trismegisto-angular-attachment.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-bubble.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-code-viewer.mjs +78 -5
- package/fesm2022/trismegisto-angular-code-viewer.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-data-grid.mjs +51 -7
- package/fesm2022/trismegisto-angular-data-grid.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-icon.mjs +2 -1
- package/fesm2022/trismegisto-angular-icon.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-message-divider.mjs +14 -6
- package/fesm2022/trismegisto-angular-message-divider.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-message-scroller.mjs +14 -0
- package/fesm2022/trismegisto-angular-message-scroller.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-prompt-input.mjs +251 -0
- package/fesm2022/trismegisto-angular-prompt-input.mjs.map +1 -0
- package/fesm2022/trismegisto-angular-prompt-suggestions.mjs +10 -3
- package/fesm2022/trismegisto-angular-prompt-suggestions.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-questionnaire.mjs +420 -0
- package/fesm2022/trismegisto-angular-questionnaire.mjs.map +1 -0
- package/fesm2022/trismegisto-angular-trace.mjs +38 -9
- package/fesm2022/trismegisto-angular-trace.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-webhook.mjs +1 -1
- package/fesm2022/trismegisto-angular-webhook.mjs.map +1 -1
- package/fesm2022/trismegisto-angular.mjs +4 -2
- package/fesm2022/trismegisto-angular.mjs.map +1 -1
- package/package.json +13 -5
- package/types/trismegisto-angular-agent.d.ts +103 -4
- package/types/trismegisto-angular-agent.d.ts.map +1 -1
- package/types/trismegisto-angular-attachment.d.ts +5 -2
- package/types/trismegisto-angular-attachment.d.ts.map +1 -1
- package/types/trismegisto-angular-bubble.d.ts +1 -1
- package/types/trismegisto-angular-code-viewer.d.ts +40 -3
- package/types/trismegisto-angular-code-viewer.d.ts.map +1 -1
- package/types/trismegisto-angular-data-grid.d.ts +27 -2
- package/types/trismegisto-angular-data-grid.d.ts.map +1 -1
- package/types/trismegisto-angular-icon.d.ts +2 -1
- package/types/trismegisto-angular-icon.d.ts.map +1 -1
- package/types/trismegisto-angular-message-divider.d.ts +4 -2
- package/types/trismegisto-angular-message-divider.d.ts.map +1 -1
- package/types/trismegisto-angular-message-scroller.d.ts +5 -0
- package/types/trismegisto-angular-message-scroller.d.ts.map +1 -1
- package/types/trismegisto-angular-prompt-input.d.ts +100 -0
- package/types/trismegisto-angular-prompt-input.d.ts.map +1 -0
- package/types/trismegisto-angular-prompt-suggestions.d.ts +3 -1
- package/types/trismegisto-angular-prompt-suggestions.d.ts.map +1 -1
- package/types/trismegisto-angular-questionnaire.d.ts +97 -0
- package/types/trismegisto-angular-questionnaire.d.ts.map +1 -0
- package/types/trismegisto-angular-trace.d.ts +11 -4
- package/types/trismegisto-angular-trace.d.ts.map +1 -1
- package/types/trismegisto-angular.d.ts +5 -3
- package/types/trismegisto-angular.d.ts.map +1 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, computed, input, model, ChangeDetectionStrategy, Component, booleanAttribute, output, signal, effect } from '@angular/core';
|
|
3
3
|
import { ButtonComponent } from '@trismegisto/angular/button';
|
|
4
|
-
import { ICON_ANGLE, ICON_CHECK_CIRCLE, ICON_CIRCLE, ICON_DETAILS, ICON_FILE, ICON_FOLDER, ICON_LAMP_SPARK, ICON_LINK,
|
|
4
|
+
import { ICON_ANGLE, ICON_CHECK_CIRCLE, ICON_CIRCLE, ICON_DETAILS, ICON_FILE, ICON_FOLDER, ICON_LAMP_SPARK, ICON_LINK, ICON_REDO, ICON_TASKS, ICON_TIMES_CIRCLE, ICON_WRENCH, useHermesIcons, IconComponent } from '@trismegisto/angular/icon';
|
|
5
5
|
import { HermesI18nService } from '@trismegisto/angular/i18n';
|
|
6
|
+
import { TRACE_MESSAGES, TRACE_MESSAGES_PT_BR, TraceComponent, TraceItemComponent } from '@trismegisto/angular/trace';
|
|
6
7
|
import { PopoverComponent, PopoverTriggerDirective } from '@trismegisto/angular/popover';
|
|
7
8
|
import { pluralMessage, formatMessage } from '@trismegisto/primitives/i18n';
|
|
8
9
|
import { ProgressComponent } from '@trismegisto/angular/progress';
|
|
9
|
-
import {
|
|
10
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
10
11
|
import * as i1 from '@angular/forms';
|
|
11
12
|
import { FormsModule } from '@angular/forms';
|
|
12
13
|
import { CodeViewerComponent } from '@trismegisto/angular/code-viewer';
|
|
13
14
|
import { SelectComponent } from '@trismegisto/angular/select';
|
|
14
15
|
import { TreeComponent, TreeNodeTemplateDirective } from '@trismegisto/angular/tree';
|
|
16
|
+
import { CODE_LANGUAGE_TEXT } from '@trismegisto/primitives/code-syntax';
|
|
15
17
|
|
|
16
18
|
const AGENT_MESSAGES_PT_BR = {
|
|
17
19
|
approve: 'Aprovar',
|
|
@@ -45,6 +47,15 @@ const AGENT_MESSAGES_PT_BR = {
|
|
|
45
47
|
testsFailed: { one: '{count} falhou', other: '{count} falharam' },
|
|
46
48
|
testsSkipped: { one: '{count} ignorado', other: '{count} ignorados' },
|
|
47
49
|
frames: { one: '{count} chamada', other: '{count} chamadas' },
|
|
50
|
+
taskFailed: 'Com falha',
|
|
51
|
+
subagentDetails: 'Modelo e ferramentas',
|
|
52
|
+
testsOther: 'Outros testes',
|
|
53
|
+
internalFrames: { one: '{count} chamada interna', other: '{count} chamadas internas' },
|
|
54
|
+
opensInNewTab: '(abre em nova aba)',
|
|
55
|
+
searchResultsLabel: 'Resultados da busca',
|
|
56
|
+
toolInput: 'Parâmetros',
|
|
57
|
+
toolOutput: 'Resultado',
|
|
58
|
+
toolError: 'Erro',
|
|
48
59
|
};
|
|
49
60
|
const AGENT_MESSAGES_EN = {
|
|
50
61
|
approve: 'Approve',
|
|
@@ -78,6 +89,15 @@ const AGENT_MESSAGES_EN = {
|
|
|
78
89
|
testsFailed: { one: '{count} failed', other: '{count} failed' },
|
|
79
90
|
testsSkipped: { one: '{count} skipped', other: '{count} skipped' },
|
|
80
91
|
frames: { one: '{count} call', other: '{count} calls' },
|
|
92
|
+
taskFailed: 'Failed',
|
|
93
|
+
subagentDetails: 'Model and tools',
|
|
94
|
+
testsOther: 'Other tests',
|
|
95
|
+
internalFrames: { one: '{count} internal call', other: '{count} internal calls' },
|
|
96
|
+
opensInNewTab: '(opens in a new tab)',
|
|
97
|
+
searchResultsLabel: 'Search results',
|
|
98
|
+
toolInput: 'Input',
|
|
99
|
+
toolOutput: 'Output',
|
|
100
|
+
toolError: 'Error',
|
|
81
101
|
};
|
|
82
102
|
const AGENT_MESSAGES_ES = {
|
|
83
103
|
approve: 'Aprobar',
|
|
@@ -111,6 +131,15 @@ const AGENT_MESSAGES_ES = {
|
|
|
111
131
|
testsFailed: { one: '{count} falló', other: '{count} fallaron' },
|
|
112
132
|
testsSkipped: { one: '{count} omitida', other: '{count} omitidas' },
|
|
113
133
|
frames: { one: '{count} llamada', other: '{count} llamadas' },
|
|
134
|
+
taskFailed: 'Con fallos',
|
|
135
|
+
subagentDetails: 'Modelo y herramientas',
|
|
136
|
+
testsOther: 'Otras pruebas',
|
|
137
|
+
internalFrames: { one: '{count} llamada interna', other: '{count} llamadas internas' },
|
|
138
|
+
opensInNewTab: '(se abre en una pestaña nueva)',
|
|
139
|
+
searchResultsLabel: 'Resultados de la búsqueda',
|
|
140
|
+
toolInput: 'Parámetros',
|
|
141
|
+
toolOutput: 'Resultado',
|
|
142
|
+
toolError: 'Error',
|
|
114
143
|
};
|
|
115
144
|
/** Catálogos por idioma, para `HermesI18nService.pick`. */
|
|
116
145
|
const AGENT_MESSAGES = {
|
|
@@ -119,7 +148,7 @@ const AGENT_MESSAGES = {
|
|
|
119
148
|
es: AGENT_MESSAGES_ES,
|
|
120
149
|
};
|
|
121
150
|
|
|
122
|
-
const AGENT_ICONS = [ICON_ANGLE, ICON_CHECK_CIRCLE, ICON_CIRCLE, ICON_DETAILS, ICON_FILE, ICON_FOLDER, ICON_LAMP_SPARK, ICON_LINK,
|
|
151
|
+
const AGENT_ICONS = [ICON_ANGLE, ICON_CHECK_CIRCLE, ICON_CIRCLE, ICON_DETAILS, ICON_FILE, ICON_FOLDER, ICON_LAMP_SPARK, ICON_LINK, ICON_REDO, ICON_TASKS, ICON_TIMES_CIRCLE, ICON_WRENCH];
|
|
123
152
|
|
|
124
153
|
let sequence$1 = 0;
|
|
125
154
|
/** Os textos da família, com a sobrescrita do input `texts` da peça. */
|
|
@@ -133,10 +162,17 @@ class AgentDisclosureComponent {
|
|
|
133
162
|
heading = input.required(...(ngDevMode ? [{ debugName: "heading" }] : /* istanbul ignore next */ []));
|
|
134
163
|
detail = input('', ...(ngDevMode ? [{ debugName: "detail" }] : /* istanbul ignore next */ []));
|
|
135
164
|
icon = input('', ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
165
|
+
/** Estado do trabalho, no lugar do ícone. */
|
|
166
|
+
status = input(null, ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
136
167
|
open = model(false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
137
168
|
panelId = `hm-agent-disclosure-${++sequence$1}`;
|
|
169
|
+
#i18n = inject(HermesI18nService);
|
|
170
|
+
statusText = computed(() => {
|
|
171
|
+
const status = this.status();
|
|
172
|
+
return status ? this.#i18n.pick(TRACE_MESSAGES, TRACE_MESSAGES_PT_BR)[status] : '';
|
|
173
|
+
}, ...(ngDevMode ? [{ debugName: "statusText" }] : /* istanbul ignore next */ []));
|
|
138
174
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AgentDisclosureComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
139
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: AgentDisclosureComponent, isStandalone: true, selector: "hm-agent-disclosure", inputs: { heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: true, transformFunction: null }, detail: { classPropertyName: "detail", publicName: "detail", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange" }, host: { classAttribute: "hm-agent-disclosure" }, ngImport: i0, template: `
|
|
175
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: AgentDisclosureComponent, isStandalone: true, selector: "hm-agent-disclosure", inputs: { heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: true, transformFunction: null }, detail: { classPropertyName: "detail", publicName: "detail", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange" }, host: { classAttribute: "hm-agent-disclosure" }, ngImport: i0, template: `
|
|
140
176
|
<button
|
|
141
177
|
type="button"
|
|
142
178
|
class="hm-agent-disclosure__trigger"
|
|
@@ -144,7 +180,17 @@ class AgentDisclosureComponent {
|
|
|
144
180
|
[attr.aria-controls]="panelId"
|
|
145
181
|
(click)="open.set(!open())"
|
|
146
182
|
>
|
|
147
|
-
@if (
|
|
183
|
+
@if (status(); as current) {
|
|
184
|
+
<span class="hm-agent-disclosure__mark" [attr.data-status]="current" aria-hidden="true">
|
|
185
|
+
@switch (current) {
|
|
186
|
+
@case ('running') { <span class="hm-spinner"></span> }
|
|
187
|
+
@case ('done') { <hm-icon shape="check-circle" /> }
|
|
188
|
+
@case ('error') { <hm-icon shape="times-circle" /> }
|
|
189
|
+
@default { <hm-icon shape="circle" /> }
|
|
190
|
+
}
|
|
191
|
+
</span>
|
|
192
|
+
<span class="hm-visually-hidden">{{ statusText() }}</span>
|
|
193
|
+
} @else if (icon()) {
|
|
148
194
|
<hm-icon class="hm-agent-disclosure__icon" [shape]="icon()" aria-hidden="true" />
|
|
149
195
|
}
|
|
150
196
|
<span class="hm-agent-disclosure__heading">{{ heading() }}</span>
|
|
@@ -171,7 +217,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
171
217
|
[attr.aria-controls]="panelId"
|
|
172
218
|
(click)="open.set(!open())"
|
|
173
219
|
>
|
|
174
|
-
@if (
|
|
220
|
+
@if (status(); as current) {
|
|
221
|
+
<span class="hm-agent-disclosure__mark" [attr.data-status]="current" aria-hidden="true">
|
|
222
|
+
@switch (current) {
|
|
223
|
+
@case ('running') { <span class="hm-spinner"></span> }
|
|
224
|
+
@case ('done') { <hm-icon shape="check-circle" /> }
|
|
225
|
+
@case ('error') { <hm-icon shape="times-circle" /> }
|
|
226
|
+
@default { <hm-icon shape="circle" /> }
|
|
227
|
+
}
|
|
228
|
+
</span>
|
|
229
|
+
<span class="hm-visually-hidden">{{ statusText() }}</span>
|
|
230
|
+
} @else if (icon()) {
|
|
175
231
|
<hm-icon class="hm-agent-disclosure__icon" [shape]="icon()" aria-hidden="true" />
|
|
176
232
|
}
|
|
177
233
|
<span class="hm-agent-disclosure__heading">{{ heading() }}</span>
|
|
@@ -183,7 +239,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
183
239
|
<div class="hm-agent-disclosure__panel" [id]="panelId" [hidden]="!open()"><ng-content /></div>
|
|
184
240
|
`,
|
|
185
241
|
}]
|
|
186
|
-
}], propDecorators: { heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: true }] }], detail: [{ type: i0.Input, args: [{ isSignal: true, alias: "detail", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }] } });
|
|
242
|
+
}], propDecorators: { heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: true }] }], detail: [{ type: i0.Input, args: [{ isSignal: true, alias: "detail", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }] } });
|
|
187
243
|
|
|
188
244
|
let sequence = 0;
|
|
189
245
|
/**
|
|
@@ -268,7 +324,7 @@ class AgentSourcesComponent {
|
|
|
268
324
|
<ul class="hm-agent-sources__list">
|
|
269
325
|
@for (source of sources(); track source.url) {
|
|
270
326
|
<li>
|
|
271
|
-
<a class="hm-agent-sources__link" [href]="source.url" target="_blank" rel="noopener noreferrer">{{ source.title }}</a>
|
|
327
|
+
<a class="hm-agent-sources__link" [href]="source.url" target="_blank" rel="noopener noreferrer">{{ source.title }}<span class="hm-visually-hidden"> {{ text().opensInNewTab }}</span></a>
|
|
272
328
|
@if (source.description) {
|
|
273
329
|
<p class="hm-agent-sources__description">{{ source.description }}</p>
|
|
274
330
|
}
|
|
@@ -277,7 +333,7 @@ class AgentSourcesComponent {
|
|
|
277
333
|
</ul>
|
|
278
334
|
</hm-agent-disclosure>
|
|
279
335
|
}
|
|
280
|
-
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "open"], outputs: ["openChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
336
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "status", "open"], outputs: ["openChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
281
337
|
}
|
|
282
338
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AgentSourcesComponent, decorators: [{
|
|
283
339
|
type: Component,
|
|
@@ -292,7 +348,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
292
348
|
<ul class="hm-agent-sources__list">
|
|
293
349
|
@for (source of sources(); track source.url) {
|
|
294
350
|
<li>
|
|
295
|
-
<a class="hm-agent-sources__link" [href]="source.url" target="_blank" rel="noopener noreferrer">{{ source.title }}</a>
|
|
351
|
+
<a class="hm-agent-sources__link" [href]="source.url" target="_blank" rel="noopener noreferrer">{{ source.title }}<span class="hm-visually-hidden"> {{ text().opensInNewTab }}</span></a>
|
|
296
352
|
@if (source.description) {
|
|
297
353
|
<p class="hm-agent-sources__description">{{ source.description }}</p>
|
|
298
354
|
}
|
|
@@ -319,7 +375,7 @@ class InlineCitationComponent {
|
|
|
319
375
|
@if (source().description) {
|
|
320
376
|
<p class="hm-agent-sources__description">{{ source().description }}</p>
|
|
321
377
|
}
|
|
322
|
-
<a class="hm-agent-sources__link" [href]="source().url" target="_blank" rel="noopener noreferrer">{{ source().url }}</a>
|
|
378
|
+
<a class="hm-agent-sources__link" [href]="source().url" target="_blank" rel="noopener noreferrer">{{ source().url }}<span class="hm-visually-hidden"> {{ text().opensInNewTab }}</span></a>
|
|
323
379
|
</hm-popover>
|
|
324
380
|
`, isInline: true, dependencies: [{ kind: "component", type: PopoverComponent, selector: "hm-popover", inputs: ["open", "heading", "headingLevel", "label", "describedBy", "side", "align", "arrow", "closable", "closeLabel", "closeOnOutsideClick", "openOn", "openDelay", "closeDelay"], outputs: ["openChange"] }, { kind: "directive", type: PopoverTriggerDirective, selector: "[hmPopoverTrigger]", inputs: ["hmPopoverTrigger"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
325
381
|
}
|
|
@@ -336,7 +392,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
336
392
|
@if (source().description) {
|
|
337
393
|
<p class="hm-agent-sources__description">{{ source().description }}</p>
|
|
338
394
|
}
|
|
339
|
-
<a class="hm-agent-sources__link" [href]="source().url" target="_blank" rel="noopener noreferrer">{{ source().url }}</a>
|
|
395
|
+
<a class="hm-agent-sources__link" [href]="source().url" target="_blank" rel="noopener noreferrer">{{ source().url }}<span class="hm-visually-hidden"> {{ text().opensInNewTab }}</span></a>
|
|
340
396
|
</hm-popover>
|
|
341
397
|
`,
|
|
342
398
|
}]
|
|
@@ -367,7 +423,7 @@ class ReasoningComponent {
|
|
|
367
423
|
<hm-agent-disclosure icon="lamp-spark" [heading]="heading()" [open]="open()" (openChange)="open.set($event)">
|
|
368
424
|
<div class="hm-reasoning__content"><ng-content /></div>
|
|
369
425
|
</hm-agent-disclosure>
|
|
370
|
-
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "open"], outputs: ["openChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
426
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "status", "open"], outputs: ["openChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
371
427
|
}
|
|
372
428
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: ReasoningComponent, decorators: [{
|
|
373
429
|
type: Component,
|
|
@@ -387,21 +443,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
387
443
|
class AgentPlanComponent {
|
|
388
444
|
#icons = useHermesIcons(AGENT_ICONS);
|
|
389
445
|
heading = input.required(...(ngDevMode ? [{ debugName: "heading" }] : /* istanbul ignore next */ []));
|
|
446
|
+
/** O que o plano resolve, acima das etapas. */
|
|
447
|
+
description = input('', ...(ngDevMode ? [{ debugName: "description" }] : /* istanbul ignore next */ []));
|
|
390
448
|
steps = input([], ...(ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []));
|
|
391
449
|
texts = input({}, ...(ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []));
|
|
392
450
|
text = useAgentMessages(this.texts);
|
|
393
451
|
done = computed(() => this.steps().filter((step) => step.status === 'done').length, ...(ngDevMode ? [{ debugName: "done" }] : /* istanbul ignore next */ []));
|
|
394
452
|
progress = computed(() => formatMessage(this.text().planProgress, { done: this.done(), total: this.steps().length }), ...(ngDevMode ? [{ debugName: "progress" }] : /* istanbul ignore next */ []));
|
|
395
453
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AgentPlanComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
396
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: AgentPlanComponent, isStandalone: true, selector: "hm-agent-plan", inputs: { heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: true, transformFunction: null }, steps: { classPropertyName: "steps", publicName: "steps", isSignal: true, isRequired: false, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "hm-agent-card hm-agent-card--column hm-agent-plan" }, ngImport: i0, template: `
|
|
454
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: AgentPlanComponent, isStandalone: true, selector: "hm-agent-plan", inputs: { heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: true, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, steps: { classPropertyName: "steps", publicName: "steps", isSignal: true, isRequired: false, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "hm-agent-card hm-agent-card--column hm-agent-plan" }, ngImport: i0, template: `
|
|
397
455
|
<p class="hm-agent-card__heading">{{ heading() }}</p>
|
|
456
|
+
@if (description()) { <p class="hm-agent-card__description">{{ description() }}</p> }
|
|
398
457
|
<hm-progress size="small" [value]="done()" [max]="steps().length || 1" [label]="progress()" [showValue]="false" />
|
|
399
458
|
<hm-trace [label]="text().stepsLabel">
|
|
400
459
|
@for (step of steps(); track step.id) {
|
|
401
460
|
<hm-trace-item [heading]="step.label" [status]="step.status" />
|
|
402
461
|
}
|
|
403
462
|
</hm-trace>
|
|
404
|
-
`, isInline: true, dependencies: [{ kind: "component", type: ProgressComponent, selector: "hm-progress", inputs: ["value", "max", "label", "labelHidden", "showValue", "indeterminate", "intent", "size", "hint", "shape"] }, { kind: "component", type: TraceComponent, selector: "hm-trace", inputs: ["label"] }, { kind: "component", type: TraceItemComponent, selector: "hm-trace-item", inputs: ["heading", "detail", "status", "expandable", "texts"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
463
|
+
`, isInline: true, dependencies: [{ kind: "component", type: ProgressComponent, selector: "hm-progress", inputs: ["value", "max", "label", "labelHidden", "showValue", "indeterminate", "intent", "size", "hint", "shape"] }, { kind: "component", type: TraceComponent, selector: "hm-trace", inputs: ["label"] }, { kind: "component", type: TraceItemComponent, selector: "hm-trace-item", inputs: ["heading", "detail", "status", "expandable", "open", "href", "external", "texts"], outputs: ["openChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
405
464
|
}
|
|
406
465
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AgentPlanComponent, decorators: [{
|
|
407
466
|
type: Component,
|
|
@@ -412,6 +471,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
412
471
|
host: { class: 'hm-agent-card hm-agent-card--column hm-agent-plan' },
|
|
413
472
|
template: `
|
|
414
473
|
<p class="hm-agent-card__heading">{{ heading() }}</p>
|
|
474
|
+
@if (description()) { <p class="hm-agent-card__description">{{ description() }}</p> }
|
|
415
475
|
<hm-progress size="small" [value]="done()" [max]="steps().length || 1" [label]="progress()" [showValue]="false" />
|
|
416
476
|
<hm-trace [label]="text().stepsLabel">
|
|
417
477
|
@for (step of steps(); track step.id) {
|
|
@@ -420,7 +480,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
420
480
|
</hm-trace>
|
|
421
481
|
`,
|
|
422
482
|
}]
|
|
423
|
-
}], propDecorators: { heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: true }] }], steps: [{ type: i0.Input, args: [{ isSignal: true, alias: "steps", required: false }] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }] } });
|
|
483
|
+
}], propDecorators: { heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: true }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], steps: [{ type: i0.Input, args: [{ isSignal: true, alias: "steps", required: false }] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }] } });
|
|
424
484
|
/** Uma tarefa de um agente, com os passos conforme ele os executa. */
|
|
425
485
|
class AgentTaskComponent {
|
|
426
486
|
#icons = useHermesIcons(AGENT_ICONS);
|
|
@@ -430,23 +490,37 @@ class AgentTaskComponent {
|
|
|
430
490
|
texts = input({}, ...(ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []));
|
|
431
491
|
text = useAgentMessages(this.texts);
|
|
432
492
|
open = signal(false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
493
|
+
/** Resume os passos: uma falha pesa mais que o andamento; sem passos, fica o ícone. */
|
|
494
|
+
status = computed(() => {
|
|
495
|
+
const steps = this.steps();
|
|
496
|
+
if (!steps.length)
|
|
497
|
+
return null;
|
|
498
|
+
if (steps.some((step) => step.status === 'error'))
|
|
499
|
+
return 'error';
|
|
500
|
+
if (steps.some((step) => step.status === 'running'))
|
|
501
|
+
return 'running';
|
|
502
|
+
return steps.every((step) => step.status === 'done') ? 'done' : 'pending';
|
|
503
|
+
}, ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
504
|
+
detail = computed(() => {
|
|
505
|
+
const progress = formatMessage(this.text().planProgress, {
|
|
506
|
+
done: this.steps().filter((step) => step.status === 'done').length,
|
|
507
|
+
total: this.steps().length,
|
|
508
|
+
});
|
|
509
|
+
return this.status() === 'error' ? `${progress} · ${this.text().taskFailed}` : progress;
|
|
510
|
+
}, ...(ngDevMode ? [{ debugName: "detail" }] : /* istanbul ignore next */ []));
|
|
437
511
|
constructor() {
|
|
438
512
|
effect(() => this.open.set(this.expanded()));
|
|
439
513
|
}
|
|
440
514
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AgentTaskComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
441
515
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: AgentTaskComponent, isStandalone: true, selector: "hm-agent-task", inputs: { heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: true, transformFunction: null }, steps: { classPropertyName: "steps", publicName: "steps", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "hm-agent-task" }, ngImport: i0, template: `
|
|
442
|
-
<hm-agent-disclosure icon="tasks" [heading]="heading()" [detail]="detail()" [open]="open()" (openChange)="open.set($event)">
|
|
516
|
+
<hm-agent-disclosure icon="tasks" [status]="status()" [heading]="heading()" [detail]="detail()" [open]="open()" (openChange)="open.set($event)">
|
|
443
517
|
<hm-trace [label]="text().stepsLabel">
|
|
444
518
|
@for (step of steps(); track step.id) {
|
|
445
519
|
<hm-trace-item [heading]="step.label" [status]="step.status" />
|
|
446
520
|
}
|
|
447
521
|
</hm-trace>
|
|
448
522
|
</hm-agent-disclosure>
|
|
449
|
-
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "open"], outputs: ["openChange"] }, { kind: "component", type: TraceComponent, selector: "hm-trace", inputs: ["label"] }, { kind: "component", type: TraceItemComponent, selector: "hm-trace-item", inputs: ["heading", "detail", "status", "expandable", "texts"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
523
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "status", "open"], outputs: ["openChange"] }, { kind: "component", type: TraceComponent, selector: "hm-trace", inputs: ["label"] }, { kind: "component", type: TraceItemComponent, selector: "hm-trace-item", inputs: ["heading", "detail", "status", "expandable", "open", "href", "external", "texts"], outputs: ["openChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
450
524
|
}
|
|
451
525
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AgentTaskComponent, decorators: [{
|
|
452
526
|
type: Component,
|
|
@@ -456,7 +530,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
456
530
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
457
531
|
host: { class: 'hm-agent-task' },
|
|
458
532
|
template: `
|
|
459
|
-
<hm-agent-disclosure icon="tasks" [heading]="heading()" [detail]="detail()" [open]="open()" (openChange)="open.set($event)">
|
|
533
|
+
<hm-agent-disclosure icon="tasks" [status]="status()" [heading]="heading()" [detail]="detail()" [open]="open()" (openChange)="open.set($event)">
|
|
460
534
|
<hm-trace [label]="text().stepsLabel">
|
|
461
535
|
@for (step of steps(); track step.id) {
|
|
462
536
|
<hm-trace-item [heading]="step.label" [status]="step.status" />
|
|
@@ -480,7 +554,13 @@ class AgentQueueComponent {
|
|
|
480
554
|
<p class="hm-agent-queue__title">{{ text().queuePending }} ({{ pending().length }})</p>
|
|
481
555
|
<ul class="hm-agent-queue__list">
|
|
482
556
|
@for (item of pending(); track item.id) {
|
|
483
|
-
<li class="hm-agent-queue__item"
|
|
557
|
+
<li class="hm-agent-queue__item">
|
|
558
|
+
@if (item.description) {
|
|
559
|
+
<hm-agent-disclosure icon="circle" [heading]="item.label">{{ item.description }}</hm-agent-disclosure>
|
|
560
|
+
} @else {
|
|
561
|
+
<hm-icon shape="circle" aria-hidden="true" />{{ item.label }}
|
|
562
|
+
}
|
|
563
|
+
</li>
|
|
484
564
|
}
|
|
485
565
|
</ul>
|
|
486
566
|
}
|
|
@@ -488,17 +568,23 @@ class AgentQueueComponent {
|
|
|
488
568
|
<p class="hm-agent-queue__title">{{ text().queueDone }} ({{ completed().length }})</p>
|
|
489
569
|
<ul class="hm-agent-queue__list">
|
|
490
570
|
@for (item of completed(); track item.id) {
|
|
491
|
-
<li class="hm-agent-queue__item hm-agent-queue__item--done"
|
|
571
|
+
<li class="hm-agent-queue__item hm-agent-queue__item--done">
|
|
572
|
+
@if (item.description) {
|
|
573
|
+
<hm-agent-disclosure icon="check-circle" [heading]="item.label">{{ item.description }}</hm-agent-disclosure>
|
|
574
|
+
} @else {
|
|
575
|
+
<hm-icon shape="check-circle" aria-hidden="true" />{{ item.label }}
|
|
576
|
+
}
|
|
577
|
+
</li>
|
|
492
578
|
}
|
|
493
579
|
</ul>
|
|
494
580
|
}
|
|
495
|
-
`, isInline: true, dependencies: [{ kind: "component", type: IconComponent, selector: "hm-icon", inputs: ["shape", "direction", "size", "solid", "badge", "status", "flip", "inverse", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
581
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "status", "open"], outputs: ["openChange"] }, { kind: "component", type: IconComponent, selector: "hm-icon", inputs: ["shape", "direction", "size", "solid", "badge", "status", "flip", "inverse", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
496
582
|
}
|
|
497
583
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AgentQueueComponent, decorators: [{
|
|
498
584
|
type: Component,
|
|
499
585
|
args: [{
|
|
500
586
|
selector: 'hm-agent-queue',
|
|
501
|
-
imports: [IconComponent],
|
|
587
|
+
imports: [AgentDisclosureComponent, IconComponent],
|
|
502
588
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
503
589
|
host: { class: 'hm-agent-card hm-agent-card--column hm-agent-queue', role: 'group', '[attr.aria-label]': 'text().queueLabel' },
|
|
504
590
|
template: `
|
|
@@ -506,7 +592,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
506
592
|
<p class="hm-agent-queue__title">{{ text().queuePending }} ({{ pending().length }})</p>
|
|
507
593
|
<ul class="hm-agent-queue__list">
|
|
508
594
|
@for (item of pending(); track item.id) {
|
|
509
|
-
<li class="hm-agent-queue__item"
|
|
595
|
+
<li class="hm-agent-queue__item">
|
|
596
|
+
@if (item.description) {
|
|
597
|
+
<hm-agent-disclosure icon="circle" [heading]="item.label">{{ item.description }}</hm-agent-disclosure>
|
|
598
|
+
} @else {
|
|
599
|
+
<hm-icon shape="circle" aria-hidden="true" />{{ item.label }}
|
|
600
|
+
}
|
|
601
|
+
</li>
|
|
510
602
|
}
|
|
511
603
|
</ul>
|
|
512
604
|
}
|
|
@@ -514,7 +606,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
514
606
|
<p class="hm-agent-queue__title">{{ text().queueDone }} ({{ completed().length }})</p>
|
|
515
607
|
<ul class="hm-agent-queue__list">
|
|
516
608
|
@for (item of completed(); track item.id) {
|
|
517
|
-
<li class="hm-agent-queue__item hm-agent-queue__item--done"
|
|
609
|
+
<li class="hm-agent-queue__item hm-agent-queue__item--done">
|
|
610
|
+
@if (item.description) {
|
|
611
|
+
<hm-agent-disclosure icon="check-circle" [heading]="item.label">{{ item.description }}</hm-agent-disclosure>
|
|
612
|
+
} @else {
|
|
613
|
+
<hm-icon shape="check-circle" aria-hidden="true" />{{ item.label }}
|
|
614
|
+
}
|
|
615
|
+
</li>
|
|
518
616
|
}
|
|
519
617
|
</ul>
|
|
520
618
|
}
|
|
@@ -525,14 +623,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
525
623
|
class ChainOfThoughtComponent {
|
|
526
624
|
#icons = useHermesIcons(AGENT_ICONS);
|
|
527
625
|
summary = input.required(...(ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []));
|
|
626
|
+
/** Começa aberto (os passos à vista). */
|
|
627
|
+
expanded = input(false, { ...(ngDevMode ? { debugName: "expanded" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
528
628
|
texts = input({}, ...(ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []));
|
|
529
629
|
text = useAgentMessages(this.texts);
|
|
630
|
+
open = signal(false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
631
|
+
constructor() {
|
|
632
|
+
effect(() => this.open.set(this.expanded()));
|
|
633
|
+
}
|
|
530
634
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: ChainOfThoughtComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
531
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.24", type: ChainOfThoughtComponent, isStandalone: true, selector: "hm-chain-of-thought", inputs: { summary: { classPropertyName: "summary", publicName: "summary", isSignal: true, isRequired: true, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "hm-chain-of-thought" }, ngImport: i0, template: `
|
|
532
|
-
<hm-agent-disclosure icon="lamp-spark" [heading]="summary()">
|
|
635
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.24", type: ChainOfThoughtComponent, isStandalone: true, selector: "hm-chain-of-thought", inputs: { summary: { classPropertyName: "summary", publicName: "summary", isSignal: true, isRequired: true, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "hm-chain-of-thought" }, ngImport: i0, template: `
|
|
636
|
+
<hm-agent-disclosure icon="lamp-spark" [heading]="summary()" [open]="open()" (openChange)="open.set($event)">
|
|
533
637
|
<hm-trace [label]="text().stepsLabel"><ng-content /></hm-trace>
|
|
534
638
|
</hm-agent-disclosure>
|
|
535
|
-
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "open"], outputs: ["openChange"] }, { kind: "component", type: TraceComponent, selector: "hm-trace", inputs: ["label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
639
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "status", "open"], outputs: ["openChange"] }, { kind: "component", type: TraceComponent, selector: "hm-trace", inputs: ["label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
536
640
|
}
|
|
537
641
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: ChainOfThoughtComponent, decorators: [{
|
|
538
642
|
type: Component,
|
|
@@ -542,12 +646,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
542
646
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
543
647
|
host: { class: 'hm-chain-of-thought' },
|
|
544
648
|
template: `
|
|
545
|
-
<hm-agent-disclosure icon="lamp-spark" [heading]="summary()">
|
|
649
|
+
<hm-agent-disclosure icon="lamp-spark" [heading]="summary()" [open]="open()" (openChange)="open.set($event)">
|
|
546
650
|
<hm-trace [label]="text().stepsLabel"><ng-content /></hm-trace>
|
|
547
651
|
</hm-agent-disclosure>
|
|
548
652
|
`,
|
|
549
653
|
}]
|
|
550
|
-
}], propDecorators: { summary: [{ type: i0.Input, args: [{ isSignal: true, alias: "summary", required: true }] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }] } });
|
|
654
|
+
}], ctorParameters: () => [], propDecorators: { summary: [{ type: i0.Input, args: [{ isSignal: true, alias: "summary", required: true }] }], expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }] } });
|
|
551
655
|
/** O trabalho de um agente auxiliar: título, estado e o que ele fez (`hm-trace-item` ou resultado projetados). */
|
|
552
656
|
class SubagentComponent {
|
|
553
657
|
#icons = useHermesIcons(AGENT_ICONS);
|
|
@@ -555,12 +659,35 @@ class SubagentComponent {
|
|
|
555
659
|
/** O que o auxiliar faz, ou a duração. */
|
|
556
660
|
detail = input('', ...(ngDevMode ? [{ debugName: "detail" }] : /* istanbul ignore next */ []));
|
|
557
661
|
status = input('running', ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
662
|
+
/** O pedido que o auxiliar recebeu, no alto do conteúdo. */
|
|
663
|
+
task = input('', ...(ngDevMode ? [{ debugName: "task" }] : /* istanbul ignore next */ []));
|
|
664
|
+
/** O modelo que ele usa. */
|
|
665
|
+
model = input('', ...(ngDevMode ? [{ debugName: "model" }] : /* istanbul ignore next */ []));
|
|
666
|
+
/** As ferramentas que ele pode chamar. */
|
|
667
|
+
tools = input([], ...(ngDevMode ? [{ debugName: "tools" }] : /* istanbul ignore next */ []));
|
|
668
|
+
texts = input({}, ...(ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []));
|
|
669
|
+
text = useAgentMessages(this.texts);
|
|
670
|
+
open = signal(false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
671
|
+
constructor() {
|
|
672
|
+
// Aberto enquanto trabalha, para acompanhar; ao terminar, fica como a pessoa deixou.
|
|
673
|
+
effect(() => {
|
|
674
|
+
if (this.status() === 'running')
|
|
675
|
+
this.open.set(true);
|
|
676
|
+
});
|
|
677
|
+
}
|
|
558
678
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: SubagentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
559
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
560
|
-
<hm-agent-disclosure
|
|
679
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: SubagentComponent, isStandalone: true, selector: "hm-subagent", inputs: { heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: true, transformFunction: null }, detail: { classPropertyName: "detail", publicName: "detail", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, task: { classPropertyName: "task", publicName: "task", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, tools: { classPropertyName: "tools", publicName: "tools", isSignal: true, isRequired: false, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-status": "status()" }, classAttribute: "hm-subagent" }, ngImport: i0, template: `
|
|
680
|
+
<hm-agent-disclosure [status]="status()" [heading]="heading()" [detail]="detail()" [open]="open()" (openChange)="open.set($event)">
|
|
681
|
+
@if (task()) { <p class="hm-subagent__task">{{ task() }}</p> }
|
|
682
|
+
@if (model() || tools().length) {
|
|
683
|
+
<ul class="hm-agent-chips" [attr.aria-label]="text().subagentDetails">
|
|
684
|
+
@if (model()) { <li class="hm-agent-chip">{{ model() }}</li> }
|
|
685
|
+
@for (tool of tools(); track tool) { <li class="hm-agent-chip">{{ tool }}</li> }
|
|
686
|
+
</ul>
|
|
687
|
+
}
|
|
561
688
|
<ng-content />
|
|
562
689
|
</hm-agent-disclosure>
|
|
563
|
-
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "open"], outputs: ["openChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
690
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "status", "open"], outputs: ["openChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
564
691
|
}
|
|
565
692
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: SubagentComponent, decorators: [{
|
|
566
693
|
type: Component,
|
|
@@ -570,12 +697,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
570
697
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
571
698
|
host: { class: 'hm-subagent', '[attr.data-status]': 'status()' },
|
|
572
699
|
template: `
|
|
573
|
-
<hm-agent-disclosure
|
|
700
|
+
<hm-agent-disclosure [status]="status()" [heading]="heading()" [detail]="detail()" [open]="open()" (openChange)="open.set($event)">
|
|
701
|
+
@if (task()) { <p class="hm-subagent__task">{{ task() }}</p> }
|
|
702
|
+
@if (model() || tools().length) {
|
|
703
|
+
<ul class="hm-agent-chips" [attr.aria-label]="text().subagentDetails">
|
|
704
|
+
@if (model()) { <li class="hm-agent-chip">{{ model() }}</li> }
|
|
705
|
+
@for (tool of tools(); track tool) { <li class="hm-agent-chip">{{ tool }}</li> }
|
|
706
|
+
</ul>
|
|
707
|
+
}
|
|
574
708
|
<ng-content />
|
|
575
709
|
</hm-agent-disclosure>
|
|
576
710
|
`,
|
|
577
711
|
}]
|
|
578
|
-
}], propDecorators: { heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: true }] }], detail: [{ type: i0.Input, args: [{ isSignal: true, alias: "detail", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }] } });
|
|
712
|
+
}], ctorParameters: () => [], propDecorators: { heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: true }] }], detail: [{ type: i0.Input, args: [{ isSignal: true, alias: "detail", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], task: [{ type: i0.Input, args: [{ isSignal: true, alias: "task", required: false }] }], model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }], tools: [{ type: i0.Input, args: [{ isSignal: true, alias: "tools", required: false }] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }] } });
|
|
579
713
|
/** Quanto do contexto do modelo a conversa já usou. Avisa em cor quando está perto do limite. */
|
|
580
714
|
class ContextUsageComponent {
|
|
581
715
|
#icons = useHermesIcons(AGENT_ICONS);
|
|
@@ -760,7 +894,7 @@ class AgentTerminalComponent {
|
|
|
760
894
|
@if (status()) {
|
|
761
895
|
<p class="hm-agent-terminal__status" role="status" [attr.data-failed]="failed() ? '' : null">{{ status() }}</p>
|
|
762
896
|
}
|
|
763
|
-
`, isInline: true, dependencies: [{ kind: "component", type: CodeViewerComponent, selector: "hm-code-viewer", inputs: ["code", "language", "filename", "label", "showLineNumbers", "firstLineNumber", "highlightLines", "wrap", "tabSize", "copyable", "header", "virtualize", "virtualizeThreshold", "revealInvisibles"], outputs: ["copied", "tokenized"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
897
|
+
`, isInline: true, dependencies: [{ kind: "component", type: CodeViewerComponent, selector: "hm-code-viewer", inputs: ["code", "language", "filename", "label", "showLineNumbers", "firstLineNumber", "highlightLines", "wrap", "tabSize", "copyable", "header", "virtualize", "virtualizeThreshold", "revealInvisibles", "addedLines", "removedLines", "size", "variant", "maxHeight", "collapsedLines", "texts"], outputs: ["copied", "tokenized"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
764
898
|
}
|
|
765
899
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AgentTerminalComponent, decorators: [{
|
|
766
900
|
type: Component,
|
|
@@ -794,6 +928,23 @@ class TestResultsComponent {
|
|
|
794
928
|
[count('skipped'), this.text().testsSkipped],
|
|
795
929
|
].filter(([total]) => total > 0).map(([total, message]) => pluralMessage(message, total, locale));
|
|
796
930
|
}, ...(ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []));
|
|
931
|
+
/** Vazia quando nenhum teste diz a que arquivo pertence: aí a lista sai corrida. */
|
|
932
|
+
suites = computed(() => {
|
|
933
|
+
if (!this.tests().some((test) => test.suite))
|
|
934
|
+
return [];
|
|
935
|
+
const groups = new Map();
|
|
936
|
+
for (const test of this.tests()) {
|
|
937
|
+
const name = test.suite || this.text().testsOther;
|
|
938
|
+
groups.set(name, [...(groups.get(name) ?? []), test]);
|
|
939
|
+
}
|
|
940
|
+
return [...groups].map(([name, tests]) => ({ name, tests, failed: tests.filter((test) => test.status === 'failed').length }));
|
|
941
|
+
}, ...(ngDevMode ? [{ debugName: "suites" }] : /* istanbul ignore next */ []));
|
|
942
|
+
suiteDetail(suite) {
|
|
943
|
+
const locale = this.#i18n.formatLocale();
|
|
944
|
+
if (suite.failed)
|
|
945
|
+
return pluralMessage(this.text().testsFailed, suite.failed, locale);
|
|
946
|
+
return pluralMessage(this.text().testsPassed, suite.tests.filter((test) => test.status === 'passed').length, locale);
|
|
947
|
+
}
|
|
797
948
|
traceStatus(test) {
|
|
798
949
|
return TEST_STATUS[test.status];
|
|
799
950
|
}
|
|
@@ -802,33 +953,61 @@ class TestResultsComponent {
|
|
|
802
953
|
<p class="hm-test-results__summary">
|
|
803
954
|
@for (part of summary(); track part) { <span>{{ part }}</span> }
|
|
804
955
|
</p>
|
|
805
|
-
<
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
956
|
+
<ng-template #list let-tests let-label="label">
|
|
957
|
+
<hm-trace [label]="label">
|
|
958
|
+
@for (test of tests; track test.id) {
|
|
959
|
+
<hm-trace-item [heading]="test.name" [status]="traceStatus(test)" [expandable]="!!test.detail">
|
|
960
|
+
@if (test.detail) { <pre class="hm-agent-pre">{{ test.detail }}</pre> }
|
|
961
|
+
</hm-trace-item>
|
|
962
|
+
}
|
|
963
|
+
</hm-trace>
|
|
964
|
+
</ng-template>
|
|
965
|
+
@if (suites().length) {
|
|
966
|
+
<hm-trace [label]="text().testsLabel">
|
|
967
|
+
@for (suite of suites(); track suite.name) {
|
|
968
|
+
<!-- Abre de início só o arquivo com falha: é ali que a pessoa vai olhar. -->
|
|
969
|
+
<hm-trace-item [heading]="suite.name" [status]="suite.failed ? 'error' : 'done'" [detail]="suiteDetail(suite)" expandable [open]="suite.failed > 0">
|
|
970
|
+
<ng-container *ngTemplateOutlet="list; context: { $implicit: suite.tests, label: suite.name }" />
|
|
971
|
+
</hm-trace-item>
|
|
972
|
+
}
|
|
973
|
+
</hm-trace>
|
|
974
|
+
} @else {
|
|
975
|
+
<ng-container *ngTemplateOutlet="list; context: { $implicit: tests(), label: text().testsLabel }" />
|
|
976
|
+
}
|
|
977
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TraceComponent, selector: "hm-trace", inputs: ["label"] }, { kind: "component", type: TraceItemComponent, selector: "hm-trace-item", inputs: ["heading", "detail", "status", "expandable", "open", "href", "external", "texts"], outputs: ["openChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
813
978
|
}
|
|
814
979
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: TestResultsComponent, decorators: [{
|
|
815
980
|
type: Component,
|
|
816
981
|
args: [{
|
|
817
982
|
selector: 'hm-test-results',
|
|
818
|
-
imports: [TraceComponent, TraceItemComponent],
|
|
983
|
+
imports: [NgTemplateOutlet, TraceComponent, TraceItemComponent],
|
|
819
984
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
820
985
|
host: { class: 'hm-agent-card hm-agent-card--column hm-test-results' },
|
|
821
986
|
template: `
|
|
822
987
|
<p class="hm-test-results__summary">
|
|
823
988
|
@for (part of summary(); track part) { <span>{{ part }}</span> }
|
|
824
989
|
</p>
|
|
825
|
-
<
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
990
|
+
<ng-template #list let-tests let-label="label">
|
|
991
|
+
<hm-trace [label]="label">
|
|
992
|
+
@for (test of tests; track test.id) {
|
|
993
|
+
<hm-trace-item [heading]="test.name" [status]="traceStatus(test)" [expandable]="!!test.detail">
|
|
994
|
+
@if (test.detail) { <pre class="hm-agent-pre">{{ test.detail }}</pre> }
|
|
995
|
+
</hm-trace-item>
|
|
996
|
+
}
|
|
997
|
+
</hm-trace>
|
|
998
|
+
</ng-template>
|
|
999
|
+
@if (suites().length) {
|
|
1000
|
+
<hm-trace [label]="text().testsLabel">
|
|
1001
|
+
@for (suite of suites(); track suite.name) {
|
|
1002
|
+
<!-- Abre de início só o arquivo com falha: é ali que a pessoa vai olhar. -->
|
|
1003
|
+
<hm-trace-item [heading]="suite.name" [status]="suite.failed ? 'error' : 'done'" [detail]="suiteDetail(suite)" expandable [open]="suite.failed > 0">
|
|
1004
|
+
<ng-container *ngTemplateOutlet="list; context: { $implicit: suite.tests, label: suite.name }" />
|
|
1005
|
+
</hm-trace-item>
|
|
1006
|
+
}
|
|
1007
|
+
</hm-trace>
|
|
1008
|
+
} @else {
|
|
1009
|
+
<ng-container *ngTemplateOutlet="list; context: { $implicit: tests(), label: text().testsLabel }" />
|
|
1010
|
+
}
|
|
832
1011
|
`,
|
|
833
1012
|
}]
|
|
834
1013
|
}], propDecorators: { tests: [{ type: i0.Input, args: [{ isSignal: true, alias: "tests", required: false }] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }] } });
|
|
@@ -842,46 +1021,252 @@ class StackTraceComponent {
|
|
|
842
1021
|
#i18n = inject(HermesI18nService);
|
|
843
1022
|
text = useAgentMessages(this.texts);
|
|
844
1023
|
framesLabel = computed(() => pluralMessage(this.text().frames, this.frames().length, this.#i18n.formatLocale()), ...(ngDevMode ? [{ debugName: "framesLabel" }] : /* istanbul ignore next */ []));
|
|
1024
|
+
ownFrames = computed(() => this.frames().filter((frame) => !frame.internal), ...(ngDevMode ? [{ debugName: "ownFrames" }] : /* istanbul ignore next */ []));
|
|
1025
|
+
internalFrames = computed(() => this.frames().filter((frame) => frame.internal), ...(ngDevMode ? [{ debugName: "internalFrames" }] : /* istanbul ignore next */ []));
|
|
1026
|
+
internalLabel = computed(() => pluralMessage(this.text().internalFrames, this.internalFrames().length, this.#i18n.formatLocale()), ...(ngDevMode ? [{ debugName: "internalLabel" }] : /* istanbul ignore next */ []));
|
|
845
1027
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: StackTraceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
846
1028
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: StackTraceComponent, isStandalone: true, selector: "hm-stack-trace", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: true, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, frames: { classPropertyName: "frames", publicName: "frames", isSignal: true, isRequired: false, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "hm-agent-card hm-agent-card--column hm-stack-trace" }, ngImport: i0, template: `
|
|
847
1029
|
<p class="hm-stack-trace__error"><strong>{{ name() }}</strong>@if (message()) {: {{ message() }}}</p>
|
|
848
1030
|
@if (frames().length) {
|
|
849
1031
|
<hm-agent-disclosure [heading]="framesLabel()">
|
|
850
|
-
<
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
1032
|
+
<ng-template #list let-rows>
|
|
1033
|
+
<ol class="hm-stack-trace__frames">
|
|
1034
|
+
@for (frame of rows; track $index) {
|
|
1035
|
+
<li><code>{{ frame.fn }}</code>
|
|
1036
|
+
@if (frame.file) {
|
|
1037
|
+
@if (frame.href) {
|
|
1038
|
+
<a class="hm-stack-trace__file hm-stack-trace__file--link" [href]="frame.href">{{ frame.file }}@if (frame.line) {:{{ frame.line }}}</a>
|
|
1039
|
+
} @else {
|
|
1040
|
+
<span class="hm-stack-trace__file">{{ frame.file }}@if (frame.line) {:{{ frame.line }}}</span>
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
</li>
|
|
1044
|
+
}
|
|
1045
|
+
</ol>
|
|
1046
|
+
</ng-template>
|
|
1047
|
+
<!-- As chamadas do próprio código vêm primeiro; as do framework ficam recolhidas. -->
|
|
1048
|
+
<ng-container *ngTemplateOutlet="list; context: { $implicit: ownFrames() }" />
|
|
1049
|
+
@if (internalFrames().length) {
|
|
1050
|
+
<hm-agent-disclosure [heading]="internalLabel()">
|
|
1051
|
+
<ng-container *ngTemplateOutlet="list; context: { $implicit: internalFrames() }" />
|
|
1052
|
+
</hm-agent-disclosure>
|
|
1053
|
+
}
|
|
857
1054
|
</hm-agent-disclosure>
|
|
858
1055
|
}
|
|
859
|
-
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "open"], outputs: ["openChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1056
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AgentDisclosureComponent, selector: "hm-agent-disclosure", inputs: ["heading", "detail", "icon", "status", "open"], outputs: ["openChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
860
1057
|
}
|
|
861
1058
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: StackTraceComponent, decorators: [{
|
|
862
1059
|
type: Component,
|
|
863
1060
|
args: [{
|
|
864
1061
|
selector: 'hm-stack-trace',
|
|
865
|
-
imports: [AgentDisclosureComponent],
|
|
1062
|
+
imports: [AgentDisclosureComponent, NgTemplateOutlet],
|
|
866
1063
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
867
1064
|
host: { class: 'hm-agent-card hm-agent-card--column hm-stack-trace' },
|
|
868
1065
|
template: `
|
|
869
1066
|
<p class="hm-stack-trace__error"><strong>{{ name() }}</strong>@if (message()) {: {{ message() }}}</p>
|
|
870
1067
|
@if (frames().length) {
|
|
871
1068
|
<hm-agent-disclosure [heading]="framesLabel()">
|
|
872
|
-
<
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
1069
|
+
<ng-template #list let-rows>
|
|
1070
|
+
<ol class="hm-stack-trace__frames">
|
|
1071
|
+
@for (frame of rows; track $index) {
|
|
1072
|
+
<li><code>{{ frame.fn }}</code>
|
|
1073
|
+
@if (frame.file) {
|
|
1074
|
+
@if (frame.href) {
|
|
1075
|
+
<a class="hm-stack-trace__file hm-stack-trace__file--link" [href]="frame.href">{{ frame.file }}@if (frame.line) {:{{ frame.line }}}</a>
|
|
1076
|
+
} @else {
|
|
1077
|
+
<span class="hm-stack-trace__file">{{ frame.file }}@if (frame.line) {:{{ frame.line }}}</span>
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
</li>
|
|
1081
|
+
}
|
|
1082
|
+
</ol>
|
|
1083
|
+
</ng-template>
|
|
1084
|
+
<!-- As chamadas do próprio código vêm primeiro; as do framework ficam recolhidas. -->
|
|
1085
|
+
<ng-container *ngTemplateOutlet="list; context: { $implicit: ownFrames() }" />
|
|
1086
|
+
@if (internalFrames().length) {
|
|
1087
|
+
<hm-agent-disclosure [heading]="internalLabel()">
|
|
1088
|
+
<ng-container *ngTemplateOutlet="list; context: { $implicit: internalFrames() }" />
|
|
1089
|
+
</hm-agent-disclosure>
|
|
1090
|
+
}
|
|
879
1091
|
</hm-agent-disclosure>
|
|
880
1092
|
}
|
|
881
1093
|
`,
|
|
882
1094
|
}]
|
|
883
1095
|
}], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: true }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], frames: [{ type: i0.Input, args: [{ isSignal: true, alias: "frames", required: false }] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }] } });
|
|
884
1096
|
|
|
1097
|
+
/** Texto pronto para o leitor de código: string vai como veio; o resto, como JSON indentado. */
|
|
1098
|
+
function toCode(value) {
|
|
1099
|
+
if (value === undefined || value === null || value === '')
|
|
1100
|
+
return '';
|
|
1101
|
+
if (typeof value === 'string')
|
|
1102
|
+
return value;
|
|
1103
|
+
try {
|
|
1104
|
+
return JSON.stringify(value, null, 2) ?? '';
|
|
1105
|
+
}
|
|
1106
|
+
catch {
|
|
1107
|
+
return String(value);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Uma ferramenta que o agente chamou (rodar um comando, ler um arquivo, consultar uma API), do pedido ao resultado.
|
|
1112
|
+
* Enquanto roda é uma linha com o estado; quando há parâmetros, resultado ou erro, a linha abre e mostra cada um.
|
|
1113
|
+
* Dentro de um `hm-trace` vira uma das etapas dele; sozinha, monta a própria lista.
|
|
1114
|
+
*
|
|
1115
|
+
* Pedido de aprovação não é etapa: fica fora, num `hm-tool-confirmation`, até a pessoa responder.
|
|
1116
|
+
*
|
|
1117
|
+
* ```html
|
|
1118
|
+
* <hm-trace label="Etapas da resposta">
|
|
1119
|
+
* <hm-agent-tool heading="Consultou os servidores" detail="Produção" status="done" [parameters]="{ env: 'prod' }" [result]="servers" />
|
|
1120
|
+
* </hm-trace>
|
|
1121
|
+
* ```
|
|
1122
|
+
*/
|
|
1123
|
+
class AgentToolComponent {
|
|
1124
|
+
#icons = useHermesIcons(AGENT_ICONS);
|
|
1125
|
+
/** O que a ferramenta faz, no tempo certo ("Consultando os servidores", "Consultou os servidores"). */
|
|
1126
|
+
heading = input.required(...(ngDevMode ? [{ debugName: "heading" }] : /* istanbul ignore next */ []));
|
|
1127
|
+
/** Texto curto ao lado (o alvo, a duração). */
|
|
1128
|
+
detail = input('', ...(ngDevMode ? [{ debugName: "detail" }] : /* istanbul ignore next */ []));
|
|
1129
|
+
status = input('running', ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
1130
|
+
/** O que o agente mandou para a ferramenta. Texto vai como veio; objeto vira JSON. */
|
|
1131
|
+
parameters = input(undefined, ...(ngDevMode ? [{ debugName: "parameters" }] : /* istanbul ignore next */ []));
|
|
1132
|
+
/** O que a ferramenta devolveu. */
|
|
1133
|
+
result = input(undefined, ...(ngDevMode ? [{ debugName: "result" }] : /* istanbul ignore next */ []));
|
|
1134
|
+
/** Por que falhou (texto pronto). */
|
|
1135
|
+
error = input('', ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
1136
|
+
/** Se o conteúdo está aberto. */
|
|
1137
|
+
open = model(false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
1138
|
+
texts = input({}, ...(ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []));
|
|
1139
|
+
text = useAgentMessages(this.texts);
|
|
1140
|
+
inTrace = !!inject(TraceComponent, { optional: true });
|
|
1141
|
+
parametersCode = computed(() => toCode(this.parameters()), ...(ngDevMode ? [{ debugName: "parametersCode" }] : /* istanbul ignore next */ []));
|
|
1142
|
+
resultCode = computed(() => toCode(this.result()), ...(ngDevMode ? [{ debugName: "resultCode" }] : /* istanbul ignore next */ []));
|
|
1143
|
+
hasBody = computed(() => !!(this.parametersCode() || this.resultCode() || this.error()), ...(ngDevMode ? [{ debugName: "hasBody" }] : /* istanbul ignore next */ []));
|
|
1144
|
+
languageOf(value) {
|
|
1145
|
+
return typeof value === 'string' ? CODE_LANGUAGE_TEXT.id : 'json';
|
|
1146
|
+
}
|
|
1147
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AgentToolComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1148
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: AgentToolComponent, isStandalone: true, selector: "hm-agent-tool", inputs: { heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: true, transformFunction: null }, detail: { classPropertyName: "detail", publicName: "detail", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, parameters: { classPropertyName: "parameters", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null }, result: { classPropertyName: "result", publicName: "result", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange" }, host: { properties: { "attr.data-status": "status()" }, classAttribute: "hm-agent-tool" }, ngImport: i0, template: `
|
|
1149
|
+
<ng-template #item>
|
|
1150
|
+
<hm-trace-item [heading]="heading()" [detail]="detail()" [status]="status()" [expandable]="hasBody()" [(open)]="open">
|
|
1151
|
+
@if (parametersCode()) {
|
|
1152
|
+
<div class="hm-agent-tool__section">
|
|
1153
|
+
<p class="hm-agent-tool__label">{{ text().toolInput }}</p>
|
|
1154
|
+
<hm-code-viewer [code]="parametersCode()" [language]="languageOf(parameters())" [label]="text().toolInput" size="small" [showLineNumbers]="false" [wrap]="true" header="hide" />
|
|
1155
|
+
</div>
|
|
1156
|
+
}
|
|
1157
|
+
@if (resultCode()) {
|
|
1158
|
+
<div class="hm-agent-tool__section">
|
|
1159
|
+
<p class="hm-agent-tool__label">{{ text().toolOutput }}</p>
|
|
1160
|
+
<hm-code-viewer [code]="resultCode()" [language]="languageOf(result())" [label]="text().toolOutput" size="small" [showLineNumbers]="false" [wrap]="true" header="hide" />
|
|
1161
|
+
</div>
|
|
1162
|
+
}
|
|
1163
|
+
@if (error()) {
|
|
1164
|
+
<div class="hm-agent-tool__section">
|
|
1165
|
+
<p class="hm-agent-tool__label">{{ text().toolError }}</p>
|
|
1166
|
+
<p class="hm-agent-tool__error">{{ error() }}</p>
|
|
1167
|
+
</div>
|
|
1168
|
+
}
|
|
1169
|
+
</hm-trace-item>
|
|
1170
|
+
</ng-template>
|
|
1171
|
+
@if (inTrace) {
|
|
1172
|
+
<ng-container *ngTemplateOutlet="item" />
|
|
1173
|
+
} @else {
|
|
1174
|
+
<hm-trace [label]="heading()"><ng-container *ngTemplateOutlet="item" /></hm-trace>
|
|
1175
|
+
}
|
|
1176
|
+
`, isInline: true, dependencies: [{ kind: "component", type: CodeViewerComponent, selector: "hm-code-viewer", inputs: ["code", "language", "filename", "label", "showLineNumbers", "firstLineNumber", "highlightLines", "wrap", "tabSize", "copyable", "header", "virtualize", "virtualizeThreshold", "revealInvisibles", "addedLines", "removedLines", "size", "variant", "maxHeight", "collapsedLines", "texts"], outputs: ["copied", "tokenized"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TraceComponent, selector: "hm-trace", inputs: ["label"] }, { kind: "component", type: TraceItemComponent, selector: "hm-trace-item", inputs: ["heading", "detail", "status", "expandable", "open", "href", "external", "texts"], outputs: ["openChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1177
|
+
}
|
|
1178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AgentToolComponent, decorators: [{
|
|
1179
|
+
type: Component,
|
|
1180
|
+
args: [{
|
|
1181
|
+
selector: 'hm-agent-tool',
|
|
1182
|
+
imports: [CodeViewerComponent, NgTemplateOutlet, TraceComponent, TraceItemComponent],
|
|
1183
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1184
|
+
host: { class: 'hm-agent-tool', '[attr.data-status]': 'status()' },
|
|
1185
|
+
template: `
|
|
1186
|
+
<ng-template #item>
|
|
1187
|
+
<hm-trace-item [heading]="heading()" [detail]="detail()" [status]="status()" [expandable]="hasBody()" [(open)]="open">
|
|
1188
|
+
@if (parametersCode()) {
|
|
1189
|
+
<div class="hm-agent-tool__section">
|
|
1190
|
+
<p class="hm-agent-tool__label">{{ text().toolInput }}</p>
|
|
1191
|
+
<hm-code-viewer [code]="parametersCode()" [language]="languageOf(parameters())" [label]="text().toolInput" size="small" [showLineNumbers]="false" [wrap]="true" header="hide" />
|
|
1192
|
+
</div>
|
|
1193
|
+
}
|
|
1194
|
+
@if (resultCode()) {
|
|
1195
|
+
<div class="hm-agent-tool__section">
|
|
1196
|
+
<p class="hm-agent-tool__label">{{ text().toolOutput }}</p>
|
|
1197
|
+
<hm-code-viewer [code]="resultCode()" [language]="languageOf(result())" [label]="text().toolOutput" size="small" [showLineNumbers]="false" [wrap]="true" header="hide" />
|
|
1198
|
+
</div>
|
|
1199
|
+
}
|
|
1200
|
+
@if (error()) {
|
|
1201
|
+
<div class="hm-agent-tool__section">
|
|
1202
|
+
<p class="hm-agent-tool__label">{{ text().toolError }}</p>
|
|
1203
|
+
<p class="hm-agent-tool__error">{{ error() }}</p>
|
|
1204
|
+
</div>
|
|
1205
|
+
}
|
|
1206
|
+
</hm-trace-item>
|
|
1207
|
+
</ng-template>
|
|
1208
|
+
@if (inTrace) {
|
|
1209
|
+
<ng-container *ngTemplateOutlet="item" />
|
|
1210
|
+
} @else {
|
|
1211
|
+
<hm-trace [label]="heading()"><ng-container *ngTemplateOutlet="item" /></hm-trace>
|
|
1212
|
+
}
|
|
1213
|
+
`,
|
|
1214
|
+
}]
|
|
1215
|
+
}], propDecorators: { heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: true }] }], detail: [{ type: i0.Input, args: [{ isSignal: true, alias: "detail", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], parameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "parameters", required: false }] }], result: [{ type: i0.Input, args: [{ isSignal: true, alias: "result", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }] } });
|
|
1216
|
+
/** O endereço de cada resultado de uma busca, como etiqueta que abre a página. Vai dentro de uma etapa. */
|
|
1217
|
+
class AgentSearchResultsComponent {
|
|
1218
|
+
#icons = useHermesIcons(AGENT_ICONS);
|
|
1219
|
+
sources = input([], ...(ngDevMode ? [{ debugName: "sources" }] : /* istanbul ignore next */ []));
|
|
1220
|
+
/** Nome acessível da lista. Padrão: "Resultados da busca". */
|
|
1221
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1222
|
+
texts = input({}, ...(ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []));
|
|
1223
|
+
text = useAgentMessages(this.texts);
|
|
1224
|
+
/** Só o domínio, sem o `www.`; endereço que não abre como URL aparece inteiro. */
|
|
1225
|
+
hostOf(url) {
|
|
1226
|
+
try {
|
|
1227
|
+
return new URL(url).hostname.replace(/^www\./, '');
|
|
1228
|
+
}
|
|
1229
|
+
catch {
|
|
1230
|
+
return url;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AgentSearchResultsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1234
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: AgentSearchResultsComponent, isStandalone: true, selector: "hm-agent-search-results", inputs: { sources: { classPropertyName: "sources", publicName: "sources", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "hm-agent-search-results" }, ngImport: i0, template: `
|
|
1235
|
+
@if (sources().length) {
|
|
1236
|
+
<ul class="hm-agent-chips" [attr.aria-label]="label() || text().searchResultsLabel">
|
|
1237
|
+
@for (source of sources(); track source.url) {
|
|
1238
|
+
<li>
|
|
1239
|
+
<a class="hm-agent-chip" [href]="source.url" target="_blank" rel="noopener noreferrer" [attr.title]="source.title">
|
|
1240
|
+
{{ hostOf(source.url) }}<span class="hm-visually-hidden">: {{ source.title }} {{ text().opensInNewTab }}</span>
|
|
1241
|
+
</a>
|
|
1242
|
+
</li>
|
|
1243
|
+
}
|
|
1244
|
+
</ul>
|
|
1245
|
+
}
|
|
1246
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1247
|
+
}
|
|
1248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AgentSearchResultsComponent, decorators: [{
|
|
1249
|
+
type: Component,
|
|
1250
|
+
args: [{
|
|
1251
|
+
selector: 'hm-agent-search-results',
|
|
1252
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1253
|
+
host: { class: 'hm-agent-search-results' },
|
|
1254
|
+
template: `
|
|
1255
|
+
@if (sources().length) {
|
|
1256
|
+
<ul class="hm-agent-chips" [attr.aria-label]="label() || text().searchResultsLabel">
|
|
1257
|
+
@for (source of sources(); track source.url) {
|
|
1258
|
+
<li>
|
|
1259
|
+
<a class="hm-agent-chip" [href]="source.url" target="_blank" rel="noopener noreferrer" [attr.title]="source.title">
|
|
1260
|
+
{{ hostOf(source.url) }}<span class="hm-visually-hidden">: {{ source.title }} {{ text().opensInNewTab }}</span>
|
|
1261
|
+
</a>
|
|
1262
|
+
</li>
|
|
1263
|
+
}
|
|
1264
|
+
</ul>
|
|
1265
|
+
}
|
|
1266
|
+
`,
|
|
1267
|
+
}]
|
|
1268
|
+
}], propDecorators: { sources: [{ type: i0.Input, args: [{ isSignal: true, alias: "sources", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }] } });
|
|
1269
|
+
|
|
885
1270
|
// Ponto de import `@trismegisto/angular/agent` (secundário do ng-packagr): o que o public-api e as outras pastas usam
|
|
886
1271
|
// daqui. Ao criar arquivo público novo na pasta, acrescente a linha.
|
|
887
1272
|
|
|
@@ -889,5 +1274,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
|
|
|
889
1274
|
* Generated bundle index. Do not edit.
|
|
890
1275
|
*/
|
|
891
1276
|
|
|
892
|
-
export { AGENT_MESSAGES, AGENT_MESSAGES_EN, AGENT_MESSAGES_ES, AGENT_MESSAGES_PT_BR, AgentPlanComponent, AgentQueueComponent, AgentSourcesComponent, AgentTaskComponent, AgentTerminalComponent, ChainOfThoughtComponent, CheckpointComponent, ContextUsageComponent, FileTreeComponent, InlineCitationComponent, ModelSelectorComponent, ReasoningComponent, StackTraceComponent, SubagentComponent, TestResultsComponent, ToolConfirmationComponent };
|
|
1277
|
+
export { AGENT_MESSAGES, AGENT_MESSAGES_EN, AGENT_MESSAGES_ES, AGENT_MESSAGES_PT_BR, AgentPlanComponent, AgentQueueComponent, AgentSearchResultsComponent, AgentSourcesComponent, AgentTaskComponent, AgentTerminalComponent, AgentToolComponent, ChainOfThoughtComponent, CheckpointComponent, ContextUsageComponent, FileTreeComponent, InlineCitationComponent, ModelSelectorComponent, ReasoningComponent, StackTraceComponent, SubagentComponent, TestResultsComponent, ToolConfirmationComponent };
|
|
893
1278
|
//# sourceMappingURL=trismegisto-angular-agent.mjs.map
|