@semacode/cli 2.2.0 → 2.3.1
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/LICENSE +39 -39
- package/README.md +251 -141
- package/dist/agentContext.d.ts +1 -1
- package/dist/agentContextPack.js +6 -1
- package/dist/agentContextTipos.d.ts +4 -2
- package/dist/agentContextTipos.js +7 -0
- package/dist/agentEntryPoints.js +551 -499
- package/dist/angular-consumer-standalone.d.ts +3 -1
- package/dist/angular-consumer-standalone.js +12 -8
- package/dist/comandos.js +4 -0
- package/dist/discovery/catalog.d.ts +11 -0
- package/dist/discovery/catalog.js +521 -0
- package/dist/discovery/command.d.ts +11 -0
- package/dist/discovery/command.js +226 -0
- package/dist/discovery/index.d.ts +5 -0
- package/dist/discovery/index.js +8 -0
- package/dist/discovery/ranker.d.ts +3 -0
- package/dist/discovery/ranker.js +310 -0
- package/dist/discovery/redaction.d.ts +2 -0
- package/dist/discovery/redaction.js +21 -0
- package/dist/discovery/render.d.ts +2 -0
- package/dist/discovery/render.js +100 -0
- package/dist/discovery/types.d.ts +119 -0
- package/dist/discovery/types.js +13 -0
- package/dist/drift.part01.d.ts +32 -2
- package/dist/drift.part01.js +2 -0
- package/dist/drift.part04.d.ts +3 -2
- package/dist/drift.part04.js +6 -3
- package/dist/drift.part05.d.ts +2 -1
- package/dist/drift.part05.js +4 -3
- package/dist/drift.part06.d.ts +2 -1
- package/dist/drift.part06.js +9 -5
- package/dist/drift.part07.d.ts +11 -10
- package/dist/drift.part07.js +40 -30
- package/dist/drift.part08.d.ts +2 -1
- package/dist/drift.part08.js +4 -3
- package/dist/drift.part11.js +71 -6
- package/dist/drift.part12.js +14 -1
- package/dist/drift.part13.d.ts +42 -7
- package/dist/drift.part13.js +660 -36
- package/dist/driftCache.d.ts +49 -0
- package/dist/driftCache.js +311 -0
- package/dist/driftCacheIncremental.d.ts +98 -0
- package/dist/driftCacheIncremental.js +596 -0
- package/dist/driftCatalogo.d.ts +91 -0
- package/dist/driftCatalogo.js +657 -0
- package/dist/driftCatalogoPersistente.d.ts +8 -0
- package/dist/driftCatalogoPersistente.js +77 -0
- package/dist/driftEscopo.d.ts +23 -0
- package/dist/driftEscopo.js +563 -0
- package/dist/driftEscopoReferencias.d.ts +4 -0
- package/dist/driftEscopoReferencias.js +265 -0
- package/dist/driftOrcamento.d.ts +12 -0
- package/dist/driftOrcamento.js +19 -3
- package/dist/execucoesExternas.js +5 -19
- package/dist/exemplosOficiais.js +29 -8
- package/dist/iaPrompts.d.ts +1 -1
- package/dist/iaPrompts.js +310 -307
- package/dist/index.d.ts +2 -0
- package/dist/index.js +23 -5
- package/dist/index.part01.d.ts +17 -2
- package/dist/index.part01.js +119 -8
- package/dist/index.part02.js +21 -21
- package/dist/index.part03.d.ts +2 -2
- package/dist/index.part03.js +14 -3
- package/dist/index.part04.d.ts +2 -2
- package/dist/index.part04.js +113 -101
- package/dist/index.part05.d.ts +1 -1
- package/dist/index.part05.js +99 -22
- package/dist/index.part06.js +6 -2
- package/dist/index.part07.js +24 -24
- package/dist/index.part08.js +1 -1
- package/dist/init/templates.part01.js +393 -393
- package/dist/init/templates.part02.js +189 -189
- package/dist/initTemplatesBackend.js +73 -73
- package/dist/initTemplatesBase.js +81 -80
- package/dist/initTemplatesFlutter.js +137 -137
- package/dist/initTemplatesRuntime.js +350 -350
- package/dist/initTemplatesWeb.js +309 -309
- package/dist/pipelineConteudo/command.js +1 -36
- package/dist/profileArtefatoValidadores.d.ts +3 -2
- package/dist/profileArtefatoValidadores.js +81 -0
- package/dist/profileAuthorTipos.d.ts +4 -3
- package/dist/profileCatalogo.d.ts +5 -5
- package/dist/profileCatalogo.js +30 -0
- package/dist/profileCommand.d.ts +8 -2
- package/dist/profileCommand.js +15 -5
- package/dist/profileRegras.d.ts +5 -5
- package/dist/profileRegras.js +13 -1
- package/dist/profileRulePacks.js +68 -0
- package/dist/projeto.d.ts +1 -1
- package/dist/projetoCarregar.d.ts +2 -2
- package/dist/projetoCarregar.js +47 -24
- package/dist/projetoCatalogo.d.ts +7 -0
- package/dist/projetoCatalogo.js +125 -0
- package/dist/projetoTipos.d.ts +14 -5
- package/dist/sistemasInterativos/adapterProtocol.d.ts +3 -0
- package/dist/sistemasInterativos/adapterProtocol.js +240 -0
- package/dist/sistemasInterativos/advancedCatalog.d.ts +5 -0
- package/dist/sistemasInterativos/advancedCatalog.js +442 -0
- package/dist/sistemasInterativos/autonomy.d.ts +230 -0
- package/dist/sistemasInterativos/autonomy.js +753 -0
- package/dist/sistemasInterativos/canonical.d.ts +3 -0
- package/dist/sistemasInterativos/canonical.js +43 -0
- package/dist/sistemasInterativos/catalog.d.ts +116 -0
- package/dist/sistemasInterativos/catalog.js +543 -0
- package/dist/sistemasInterativos/command.d.ts +7 -0
- package/dist/sistemasInterativos/command.js +311 -0
- package/dist/sistemasInterativos/controlRun.d.ts +56 -0
- package/dist/sistemasInterativos/controlRun.js +391 -0
- package/dist/sistemasInterativos/evidence.d.ts +5 -0
- package/dist/sistemasInterativos/evidence.js +306 -0
- package/dist/sistemasInterativos/experienceIr.d.ts +12 -0
- package/dist/sistemasInterativos/experienceIr.js +895 -0
- package/dist/sistemasInterativos/experienceIrSemantics.d.ts +30 -0
- package/dist/sistemasInterativos/experienceIrSemantics.js +368 -0
- package/dist/sistemasInterativos/experienceIrTypes.d.ts +370 -0
- package/dist/sistemasInterativos/experienceIrTypes.js +5 -0
- package/dist/sistemasInterativos/extensionCommand.d.ts +391 -0
- package/dist/sistemasInterativos/extensionCommand.js +383 -0
- package/dist/sistemasInterativos/index.d.ts +19 -0
- package/dist/sistemasInterativos/index.js +22 -0
- package/dist/sistemasInterativos/operations.d.ts +40 -0
- package/dist/sistemasInterativos/operations.js +1167 -0
- package/dist/sistemasInterativos/operationsTypes.d.ts +297 -0
- package/dist/sistemasInterativos/operationsTypes.js +11 -0
- package/dist/sistemasInterativos/planner.d.ts +2 -0
- package/dist/sistemasInterativos/planner.js +159 -0
- package/dist/sistemasInterativos/portability.d.ts +164 -0
- package/dist/sistemasInterativos/portability.js +539 -0
- package/dist/sistemasInterativos/render.d.ts +3 -0
- package/dist/sistemasInterativos/render.js +179 -0
- package/dist/sistemasInterativos/temporal.d.ts +183 -0
- package/dist/sistemasInterativos/temporal.js +543 -0
- package/dist/sistemasInterativos/types.d.ts +215 -0
- package/dist/sistemasInterativos/types.js +4 -0
- package/dist/sistemasInterativos/validator.d.ts +2 -0
- package/dist/sistemasInterativos/validator.js +305 -0
- package/dist/sync/index.js +35 -35
- package/docs/README.md +34 -28
- package/docs/ai-onboarding.md +62 -62
- package/docs/ai-workflow.md +9 -4
- package/docs/auth.md +26 -26
- package/docs/cli.md +79 -79
- package/docs/commands.md +47 -2
- package/docs/database.md +15 -15
- package/docs/deploy.md +41 -41
- package/docs/descoberta-capacidades.md +106 -0
- package/docs/documentation.md +39 -39
- package/docs/env.md +16 -16
- package/docs/frontend.md +41 -41
- package/docs/getting-started.md +57 -57
- package/docs/i18n.md +15 -15
- package/docs/pipeline-conteudo.md +246 -246
- package/docs/profiles.md +54 -45
- package/docs/repositories.md +43 -43
- package/docs/rollback.md +31 -31
- package/docs/security.md +32 -32
- package/docs/sistemas-interativos.md +376 -0
- package/docs/support.md +8 -8
- package/docs/testing.md +51 -35
- package/docs/vocabulary.md +29 -29
- package/exemplos/agendamento.sema +1 -1
- package/exemplos/assinatura.sema +1 -1
- package/exemplos/auditoria.sema +1 -1
- package/exemplos/autenticacao.sema +1 -1
- package/exemplos/author_obra_comum.sema +1 -1
- package/exemplos/author_tema_sensivel.sema +1 -1
- package/exemplos/automacao.sema +1 -1
- package/exemplos/cadastro_usuario.sema +1 -1
- package/exemplos/calculadora.sema +1 -1
- package/exemplos/crud_simples.sema +1 -1
- package/exemplos/estoque.sema +1 -1
- package/exemplos/exportacao.sema +1 -1
- package/exemplos/fila.sema +1 -1
- package/exemplos/integracao_externa.sema +1 -1
- package/exemplos/multi_tenant.sema +1 -1
- package/exemplos/notificacao.sema +1 -1
- package/exemplos/operacao_estrategia.sema +132 -132
- package/exemplos/operacao_estrategia_discovery.sema +220 -220
- package/exemplos/operacao_estrategia_fluxo.sema +114 -114
- package/exemplos/operacao_estrategia_gates.sema +106 -106
- package/exemplos/operacao_estrategia_quarentena.sema +133 -133
- package/exemplos/operacao_estrategia_rollout.sema +124 -124
- package/exemplos/pagamento.sema +1 -1
- package/exemplos/pagamento_dominio.sema +1 -1
- package/exemplos/pedido.sema +1 -1
- package/exemplos/permissao.sema +1 -1
- package/exemplos/persistencia_vendor_first.sema +1 -1
- package/exemplos/pipeline-conteudo/README.md +44 -44
- package/exemplos/pipeline-conteudo/alvos.json +23 -23
- package/exemplos/pipeline-conteudo/definicao.json +136 -136
- package/exemplos/profile_conversas.sema +165 -165
- package/exemplos/profile_game.sema +1 -1
- package/exemplos/profile_legal.sema +1 -1
- package/exemplos/profile_ops.sema +1 -1
- package/exemplos/profile_research.sema +1 -1
- package/exemplos/profile_simulation.sema +211 -0
- package/exemplos/profile_software.sema +1 -1
- package/exemplos/profile_workflow_n8n.sema +1 -1
- package/exemplos/relatorio.sema +1 -1
- package/exemplos/replica_analitica_erp.sema +1 -1
- package/exemplos/sistemas-interativos/README.md +100 -0
- package/exemplos/sistemas-interativos/advanced/acceptance-context-evaluate-valid.json +5 -0
- package/exemplos/sistemas-interativos/advanced/acceptance-lock-valid.json +16 -0
- package/exemplos/sistemas-interativos/advanced/asset-provenance-valid.json +32 -0
- package/exemplos/sistemas-interativos/advanced/autonomy-repair-valid.json +93 -0
- package/exemplos/sistemas-interativos/advanced/control-run-definition-valid.json +78 -0
- package/exemplos/sistemas-interativos/advanced/control-run-valid.json +27 -0
- package/exemplos/sistemas-interativos/advanced/distributed-workers-valid.json +79 -0
- package/exemplos/sistemas-interativos/advanced/editor-state-valid.json +42 -0
- package/exemplos/sistemas-interativos/advanced/engine-snapshot-after-valid.json +32 -0
- package/exemplos/sistemas-interativos/advanced/engine-snapshot-before-valid.json +23 -0
- package/exemplos/sistemas-interativos/advanced/job-orchestration-valid.json +39 -0
- package/exemplos/sistemas-interativos/advanced/multimodal-evidence-valid.json +46 -0
- package/exemplos/sistemas-interativos/advanced/multiplayer-authority-valid.json +39 -0
- package/exemplos/sistemas-interativos/advanced/playtest-fuzz-valid.json +37 -0
- package/exemplos/sistemas-interativos/advanced/portability-valid.json +104 -0
- package/exemplos/sistemas-interativos/advanced/temporal-evidence-valid.json +27 -0
- package/exemplos/sistemas-interativos/advanced/temporal-valid.json +118 -0
- package/exemplos/sistemas-interativos/experience-ir-valid.json +459 -0
- package/exemplos/sistemas-interativos/game-2d.json +83 -0
- package/exemplos/sistemas-interativos/game-3d-human.json +81 -0
- package/exemplos/sistemas-interativos/game-pixel-16-bit.json +97 -0
- package/exemplos/sistemas-interativos/game-pixel-8-bit.json +94 -0
- package/exemplos/sistemas-interativos/game-xr-human.json +80 -0
- package/exemplos/sistemas-interativos/hybrid-2-5d.json +108 -0
- package/exemplos/sistemas-interativos/protocol-mutating-rollback-valid.json +75 -0
- package/exemplos/sistemas-interativos/protocol-read-only-valid.json +58 -0
- package/exemplos/sistemas-interativos/simulation-2d-controlled.json +97 -0
- package/exemplos/sistemas-interativos/simulation-3d-calibrated-autonomous.json +141 -0
- package/exemplos/sistemas-interativos/simulation-headless-autonomous-batch.json +112 -0
- package/exemplos/sistemas-interativos/simulation-pixel-16-bit.json +103 -0
- package/exemplos/sistemas-interativos/simulation-text-controlled.json +95 -0
- package/exemplos/testes_embutidos.sema +1 -1
- package/exemplos/tratamento_erro.sema +1 -1
- package/exemplos/upload_arquivo.sema +1 -1
- package/exemplos/webhook.sema +1 -1
- package/node_modules/@sema/gerador-cpp/dist/index.js +176 -176
- package/node_modules/@sema/gerador-cpp/package.json +1 -1
- package/node_modules/@sema/gerador-css/dist/index.part01.js +10 -10
- package/node_modules/@sema/gerador-css/dist/index.part02.js +460 -460
- package/node_modules/@sema/gerador-dotnet/dist/index.js +169 -169
- package/node_modules/@sema/gerador-dotnet/package.json +1 -1
- package/node_modules/@sema/gerador-html/dist/index.js +17 -17
- package/node_modules/@sema/gerador-lua/dist/index.js +76 -47
- package/node_modules/@sema/gerador-lua/dist/index.js.map +1 -1
- package/node_modules/@sema/gerador-php/dist/index.js +113 -113
- package/node_modules/@sema/gerador-python/dist/index.part02.js +3 -3
- package/node_modules/@sema/gerador-typescript/dist/index.part02.js +11 -11
- package/node_modules/@sema/nucleo/dist/diagnosticos/melhorador.js +42 -42
- package/package.json +3 -3
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
1
2
|
export interface SuperficieAngularStandaloneConsumer {
|
|
2
3
|
rota: string;
|
|
3
4
|
arquivo: string;
|
|
4
5
|
tipoArquivo: "app" | "component";
|
|
5
6
|
}
|
|
6
|
-
export
|
|
7
|
+
export type LeitorTextoAngularConsumer = (arquivo: string) => Promise<string>;
|
|
8
|
+
export declare function coletarSuperficiesAngularStandaloneConsumer(baseProjeto: string, arquivos: string[], leitorTexto?: LeitorTextoAngularConsumer, sourceFiles?: ReadonlyMap<string, ts.SourceFile>): Promise<SuperficieAngularStandaloneConsumer[]>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SEMA-GOVERNED: sema.produto.governanca_ia.drift
|
|
2
|
+
// Descricao: extrai superficies Angular usando o leitor compartilhado do plano de drift quando disponivel.
|
|
1
3
|
import { readFile } from "node:fs/promises";
|
|
2
4
|
import path from "node:path";
|
|
3
5
|
import ts from "typescript";
|
|
@@ -134,7 +136,7 @@ function extrairIdentificadorImportado(expressao) {
|
|
|
134
136
|
}
|
|
135
137
|
return undefined;
|
|
136
138
|
}
|
|
137
|
-
async function extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, metadata) {
|
|
139
|
+
async function extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, metadata, leitorTexto) {
|
|
138
140
|
const templateInline = extrairTextoLiteral(obterExpressaoPropriedade(metadata, "template"));
|
|
139
141
|
if (templateInline) {
|
|
140
142
|
return templateInline;
|
|
@@ -148,19 +150,21 @@ async function extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, met
|
|
|
148
150
|
return "";
|
|
149
151
|
}
|
|
150
152
|
try {
|
|
151
|
-
|
|
153
|
+
const arquivo = path.join(baseProjeto, templateRelativo);
|
|
154
|
+
return leitorTexto ? await leitorTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
152
155
|
}
|
|
153
156
|
catch {
|
|
154
157
|
return "";
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
|
-
async function indexarComponenteAngularStandalone(baseProjeto, arquivo) {
|
|
160
|
+
async function indexarComponenteAngularStandalone(baseProjeto, arquivo, leitorTexto, sourceFiles) {
|
|
158
161
|
const relacaoArquivo = normalizarCaminhoConsumer(path.relative(baseProjeto, arquivo));
|
|
159
162
|
if (!arquivoEhComponenteAngularStandalone(relacaoArquivo)) {
|
|
160
163
|
return undefined;
|
|
161
164
|
}
|
|
162
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
163
|
-
const sourceFile =
|
|
165
|
+
const codigo = leitorTexto ? await leitorTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
166
|
+
const sourceFile = sourceFiles?.get(path.resolve(arquivo))
|
|
167
|
+
?? ts.createSourceFile(arquivo, codigo, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
164
168
|
const imports = extrairImportsTypeScriptAngular(relacaoArquivo, codigo);
|
|
165
169
|
for (const statement of sourceFile.statements) {
|
|
166
170
|
if (!ts.isClassDeclaration(statement)) {
|
|
@@ -192,7 +196,7 @@ async function indexarComponenteAngularStandalone(baseProjeto, arquivo) {
|
|
|
192
196
|
arquivo: relacaoArquivo,
|
|
193
197
|
selector: extrairTextoLiteral(obterExpressaoPropriedade(metadata, "selector")),
|
|
194
198
|
imports: [...importsArquivos],
|
|
195
|
-
template: await extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, metadata),
|
|
199
|
+
template: await extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, metadata, leitorTexto),
|
|
196
200
|
raiz: arquivoEhRaizAngularStandalone(relacaoArquivo),
|
|
197
201
|
};
|
|
198
202
|
}
|
|
@@ -205,10 +209,10 @@ function templateReferenciaSelector(template, selector) {
|
|
|
205
209
|
const escapado = selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
206
210
|
return new RegExp(`<${escapado}(?:\\s|>)`, "i").test(template);
|
|
207
211
|
}
|
|
208
|
-
export async function coletarSuperficiesAngularStandaloneConsumer(baseProjeto, arquivos) {
|
|
212
|
+
export async function coletarSuperficiesAngularStandaloneConsumer(baseProjeto, arquivos, leitorTexto, sourceFiles) {
|
|
209
213
|
const componentes = new Map();
|
|
210
214
|
for (const arquivo of arquivos) {
|
|
211
|
-
const componente = await indexarComponenteAngularStandalone(baseProjeto, arquivo);
|
|
215
|
+
const componente = await indexarComponenteAngularStandalone(baseProjeto, arquivo, leitorTexto, sourceFiles);
|
|
212
216
|
if (componente) {
|
|
213
217
|
componentes.set(componente.arquivo, componente);
|
|
214
218
|
}
|
package/dist/comandos.js
CHANGED
|
@@ -4,6 +4,8 @@ import { comandoDev } from "./dev/index.js";
|
|
|
4
4
|
import { comandoInit } from "./init/index.js";
|
|
5
5
|
import { comandoSyncPrisma } from "./sync/index.js";
|
|
6
6
|
import { comandoPipelineConteudo } from "./pipelineConteudo/command.js";
|
|
7
|
+
import { REGISTRO_HANDLERS_DESCOBERTA } from "./discovery/index.js";
|
|
8
|
+
import { comandoSistemasInterativos } from "./sistemasInterativos/command.js";
|
|
7
9
|
async function comandoInitHandler(posicionais, args, _emJson) {
|
|
8
10
|
try {
|
|
9
11
|
await comandoInit([...posicionais, ...args]);
|
|
@@ -61,5 +63,7 @@ export const REGISTRO_COMANDOS = {
|
|
|
61
63
|
dev: comandoDevHandler,
|
|
62
64
|
sync: comandoSyncPrismaHandler,
|
|
63
65
|
conteudo: comandoPipelineConteudo,
|
|
66
|
+
interativo: comandoSistemasInterativos,
|
|
67
|
+
...REGISTRO_HANDLERS_DESCOBERTA,
|
|
64
68
|
};
|
|
65
69
|
//# sourceMappingURL=comandos.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type DiscoveryCatalogFilters, type DiscoveryCatalogPayload, type DiscoveryCommandTemplate, type DiscoveryEntry, type DiscoveryKind, type ResumoDescobertaAgentContext } from "./types.js";
|
|
2
|
+
export declare function normalizarDiscoveryKind(valor: string | null | undefined): DiscoveryKind | null;
|
|
3
|
+
export interface SuperficieCliPipelineInterativo {
|
|
4
|
+
readonly command: string;
|
|
5
|
+
readonly requiredInputs: readonly string[];
|
|
6
|
+
readonly effectClass: DiscoveryCommandTemplate["effectClass"];
|
|
7
|
+
}
|
|
8
|
+
export declare const SUPERFICIES_CLI_PIPELINES_AVANCADOS: Readonly<Record<string, SuperficieCliPipelineInterativo>>;
|
|
9
|
+
export declare function montarCatalogoCapacidades(filtros?: DiscoveryCatalogFilters): DiscoveryCatalogPayload;
|
|
10
|
+
export declare function obterEntradaDescoberta(id: string): DiscoveryEntry | null;
|
|
11
|
+
export declare function criarResumoDescobertaAgentContext(): ResumoDescobertaAgentContext;
|
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
// SEMA-GOVERNED: sema.produto.descoberta_capacidades
|
|
2
|
+
// Descrição: registro canônico derivado de profiles, conteúdo e sistemas interativos.
|
|
3
|
+
import { ALIASES_PROFILE, CAPABILITY_MATRIX_GOVERNANCA, PRESETS_PROFILE, } from "../profileCatalogo.js";
|
|
4
|
+
import { CAPABILITIES_CONTEUDO_PADRAO } from "../pipelineConteudo/adapters.js";
|
|
5
|
+
import { CATALOGO_ADAPTADORES_INTERATIVOS, CATALOGO_CAPABILITIES_INTERATIVAS, CATALOGO_PIPELINES_INTERATIVOS, } from "../sistemasInterativos/catalog.js";
|
|
6
|
+
import { DISCOVERY_KINDS, DISCOVERY_SCHEMA_VERSION, } from "./types.js";
|
|
7
|
+
import { redigirTextoControladoDescoberta } from "./redaction.js";
|
|
8
|
+
const PROFILE_LABELS = {
|
|
9
|
+
software: "Software",
|
|
10
|
+
workflow: "Workflow",
|
|
11
|
+
ops: "Operações",
|
|
12
|
+
game: "Game",
|
|
13
|
+
simulation: "Simulação",
|
|
14
|
+
legal: "Legal",
|
|
15
|
+
research: "Pesquisa",
|
|
16
|
+
redacao: "Redação",
|
|
17
|
+
propostas: "Propostas comerciais",
|
|
18
|
+
conversas: "Conversas",
|
|
19
|
+
};
|
|
20
|
+
const ALVOS_GERACAO = [
|
|
21
|
+
"typescript",
|
|
22
|
+
"python",
|
|
23
|
+
"dart",
|
|
24
|
+
"lua",
|
|
25
|
+
"javascript",
|
|
26
|
+
"html",
|
|
27
|
+
"css",
|
|
28
|
+
"php",
|
|
29
|
+
"dotnet",
|
|
30
|
+
"cpp",
|
|
31
|
+
];
|
|
32
|
+
const CONTEUDO_METADATA = {
|
|
33
|
+
"content.topic.plan": {
|
|
34
|
+
label: "Planejamento de pauta",
|
|
35
|
+
summary: "Planeja tema, público, objetivo e entregáveis antes da produção.",
|
|
36
|
+
signals: ["pauta", "tema", "briefing", "planejar conteúdo"],
|
|
37
|
+
},
|
|
38
|
+
"content.research.collect": {
|
|
39
|
+
label: "Pesquisa de conteúdo",
|
|
40
|
+
summary: "Coleta evidências e fontes para sustentar o conteúdo mestre.",
|
|
41
|
+
signals: ["pesquisar fontes", "coletar evidências", "pesquisa editorial"],
|
|
42
|
+
},
|
|
43
|
+
"content.master.compose": {
|
|
44
|
+
label: "Composição mestre",
|
|
45
|
+
summary: "Compõe o artefato mestre do qual deriva a adaptação por destino.",
|
|
46
|
+
signals: ["conteúdo mestre", "roteiro mestre", "compor conteúdo"],
|
|
47
|
+
},
|
|
48
|
+
"content.target.adapt": {
|
|
49
|
+
label: "Adaptação por destino",
|
|
50
|
+
summary: "Adapta o conteúdo mestre para cada canal, formato e conta isolada.",
|
|
51
|
+
signals: ["adaptar por canal", "multicanal", "multi-formato", "formato por destino"],
|
|
52
|
+
},
|
|
53
|
+
"content.qa.deterministic": {
|
|
54
|
+
label: "QA determinístico",
|
|
55
|
+
summary: "Verifica limites e propriedades observáveis sem decisão subjetiva.",
|
|
56
|
+
signals: ["qa determinístico", "limite de duração", "tamanho do artefato"],
|
|
57
|
+
},
|
|
58
|
+
"content.qa.semantic": {
|
|
59
|
+
label: "QA semântico",
|
|
60
|
+
summary: "Representa avaliação semântica especializada com evidência e atestação.",
|
|
61
|
+
signals: ["qa semântico", "avaliar qualidade", "avaliação especializada"],
|
|
62
|
+
},
|
|
63
|
+
"content.target.deliver": {
|
|
64
|
+
label: "Entrega por destino",
|
|
65
|
+
summary: "Representa a entrega externa isolada por destino e conta.",
|
|
66
|
+
signals: ["entregar", "publicar", "enviar por canal", "delivery"],
|
|
67
|
+
},
|
|
68
|
+
"content.target.confirm": {
|
|
69
|
+
label: "Confirmação de entrega",
|
|
70
|
+
summary: "Confirma entrega por evidência externa, sem confiar apenas no executor.",
|
|
71
|
+
signals: ["confirmar publicação", "confirmar entrega", "atestar entrega"],
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
const EXECUTION_BOUNDARY = {
|
|
75
|
+
executed: false,
|
|
76
|
+
workspaceMutated: false,
|
|
77
|
+
externalCalls: false,
|
|
78
|
+
requiresExplicitRun: true,
|
|
79
|
+
};
|
|
80
|
+
function unicos(valores) {
|
|
81
|
+
return [...new Set(valores.filter((valor) => typeof valor === "string").map((valor) => valor.trim()).filter(Boolean))];
|
|
82
|
+
}
|
|
83
|
+
function normalizar(valor) {
|
|
84
|
+
return valor
|
|
85
|
+
.normalize("NFD")
|
|
86
|
+
.replace(/[\u0300-\u036f]/gu, "")
|
|
87
|
+
.toLowerCase()
|
|
88
|
+
.replace(/[^a-z0-9.]+/gu, "_")
|
|
89
|
+
.replace(/^_+|_+$/gu, "");
|
|
90
|
+
}
|
|
91
|
+
export function normalizarDiscoveryKind(valor) {
|
|
92
|
+
if (!valor)
|
|
93
|
+
return null;
|
|
94
|
+
const chave = normalizar(valor).replace(/\./gu, "_").toUpperCase();
|
|
95
|
+
return DISCOVERY_KINDS.find((kind) => kind === chave) ?? null;
|
|
96
|
+
}
|
|
97
|
+
function template(id, command, effectClass, mutatesWorkspace = false, executesExternalRuntime = false) {
|
|
98
|
+
return { id, command, effectClass, mutatesWorkspace, executesExternalRuntime };
|
|
99
|
+
}
|
|
100
|
+
function entradasGovernanca() {
|
|
101
|
+
return [
|
|
102
|
+
{
|
|
103
|
+
id: "flow.governed-change",
|
|
104
|
+
kind: "GOVERNANCE_FLOW",
|
|
105
|
+
domains: ["governanca", "mudanca"],
|
|
106
|
+
label: "Mudança governada",
|
|
107
|
+
summary: "Descobre contrato, documentação, drift e impacto antes de alterar comportamento.",
|
|
108
|
+
useWhen: ["editar código, contrato, workflow, profile, documentação operacional ou deploy"],
|
|
109
|
+
avoidWhen: ["a solicitação é apenas informativa e não altera o workspace"],
|
|
110
|
+
intentSignals: ["alterar código", "editar contrato", "drift", "impacto", "mudança governada"],
|
|
111
|
+
negativeSignals: ["somente explicar", "sem alteração"],
|
|
112
|
+
requiredInputs: ["<intenção>", "<contrato.sema>"],
|
|
113
|
+
commandTemplates: [
|
|
114
|
+
template("docs-impacto", "sema docs-impacto --intencao <intenção> --arquivo <contrato.sema> --json", "WORKSPACE_VERIFICATION", true),
|
|
115
|
+
template("inspecionar", "sema inspecionar <contrato.sema> --json", "READ_ONLY_VALIDATION"),
|
|
116
|
+
template("drift", "sema drift <contrato.sema> --escopo modulo --json", "READ_ONLY_VALIDATION"),
|
|
117
|
+
template("impacto", "sema impacto <contrato.sema> --alvo <token> --mudanca <descrição> --json", "READ_ONLY_VALIDATION"),
|
|
118
|
+
template("finalizar", "sema finalizar-mudanca --intencao <intenção> --doc-lida <documento> --json", "WORKSPACE_VERIFICATION"),
|
|
119
|
+
],
|
|
120
|
+
related: ["flow.contract-verification"],
|
|
121
|
+
source: "contratos/sema/governanca_ia.sema",
|
|
122
|
+
extensible: false,
|
|
123
|
+
aliases: ["mudanca", "change", "governanca"],
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "flow.contract-verification",
|
|
127
|
+
kind: "GOVERNANCE_FLOW",
|
|
128
|
+
domains: ["governanca", "validacao"],
|
|
129
|
+
label: "Verificação de contrato",
|
|
130
|
+
summary: "Valida contrato, implementação vinculada e testes locais antes do fechamento.",
|
|
131
|
+
useWhen: ["validar um contrato ou verificar a aderência final da implementação"],
|
|
132
|
+
avoidWhen: ["ainda não existe contrato aplicável"],
|
|
133
|
+
intentSignals: ["validar contrato", "verificar projeto", "testar contrato", "fechar mudança"],
|
|
134
|
+
negativeSignals: ["iniciar projeto sem contrato"],
|
|
135
|
+
requiredInputs: ["<contrato.sema>"],
|
|
136
|
+
commandTemplates: [
|
|
137
|
+
template("validar", "sema validar <contrato.sema> --json", "READ_ONLY_VALIDATION"),
|
|
138
|
+
template("verificar", "sema verificar <contrato.sema> --saida <diretório-temporário> --json", "WORKSPACE_VERIFICATION", true),
|
|
139
|
+
],
|
|
140
|
+
related: ["flow.governed-change"],
|
|
141
|
+
source: "contratos/sema/governanca_ia_qualidade_contrato.sema",
|
|
142
|
+
extensible: false,
|
|
143
|
+
aliases: ["validacao", "verification", "checks"],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: "flow.project-adoption",
|
|
147
|
+
kind: "GOVERNANCE_FLOW",
|
|
148
|
+
domains: ["governanca", "adocao"],
|
|
149
|
+
label: "Adoção do Sema",
|
|
150
|
+
summary: "Inicializa a governança local e materializa o entrypoint oficial para agentes.",
|
|
151
|
+
useWhen: ["o projeto ainda não possui contrato Sema ou AGENTS.md gerado"],
|
|
152
|
+
avoidWhen: ["o workspace já está governado e a tarefa é uma mudança comum"],
|
|
153
|
+
intentSignals: ["iniciar sema", "semantizar projeto", "sync codex", "criar primeiro contrato"],
|
|
154
|
+
negativeSignals: ["projeto ja governado", "validar contrato existente"],
|
|
155
|
+
requiredInputs: [],
|
|
156
|
+
commandTemplates: [
|
|
157
|
+
template("iniciar", "sema iniciar --template base", "WORKSPACE_BOOTSTRAP", true),
|
|
158
|
+
template("sync-codex", "sema sync-codex --json", "WORKSPACE_BOOTSTRAP", true),
|
|
159
|
+
],
|
|
160
|
+
related: ["flow.governed-change"],
|
|
161
|
+
source: "contratos/sema/cli_init_templates.sema",
|
|
162
|
+
extensible: false,
|
|
163
|
+
aliases: ["bootstrap", "adocao", "iniciar"],
|
|
164
|
+
},
|
|
165
|
+
];
|
|
166
|
+
}
|
|
167
|
+
function entradasProfiles() {
|
|
168
|
+
return Object.values(CAPABILITY_MATRIX_GOVERNANCA)
|
|
169
|
+
.filter((capability) => capability.profile !== "author")
|
|
170
|
+
.map((capability) => {
|
|
171
|
+
const profile = capability.profile;
|
|
172
|
+
const aliases = Object.entries(ALIASES_PROFILE)
|
|
173
|
+
.filter(([, destino]) => destino === profile)
|
|
174
|
+
.map(([alias]) => alias);
|
|
175
|
+
const sinais = unicos([
|
|
176
|
+
profile,
|
|
177
|
+
PROFILE_LABELS[profile],
|
|
178
|
+
...aliases,
|
|
179
|
+
...PRESETS_PROFILE[profile],
|
|
180
|
+
...capability.rulePacksSugeridos,
|
|
181
|
+
]);
|
|
182
|
+
return {
|
|
183
|
+
id: `profile.${profile}`,
|
|
184
|
+
kind: "PROFILE_GATE",
|
|
185
|
+
domains: [profile],
|
|
186
|
+
label: `Profile ${PROFILE_LABELS[profile]}`,
|
|
187
|
+
summary: `Gate semântico para validar contrato e artefato no domínio ${PROFILE_LABELS[profile]}.`,
|
|
188
|
+
useWhen: [`validar aderência de contrato ou artefato de ${PROFILE_LABELS[profile]}`],
|
|
189
|
+
avoidWhen: ["a intenção exige uma orquestração multietapas, execução ou publicação"],
|
|
190
|
+
intentSignals: sinais,
|
|
191
|
+
negativeSignals: ["pipeline multietapas", "executar ferramenta", "publicar multicanal"],
|
|
192
|
+
requiredInputs: ["<contrato.sema>"],
|
|
193
|
+
commandTemplates: [
|
|
194
|
+
template("validar", `sema profile validar ${profile} <contrato.sema> --json`, "READ_ONLY_VALIDATION"),
|
|
195
|
+
],
|
|
196
|
+
related: ["flow.governed-change"],
|
|
197
|
+
source: "CAPABILITY_MATRIX_GOVERNANCA",
|
|
198
|
+
extensible: false,
|
|
199
|
+
aliases: unicos([`profile.${profile}`, `profile ${profile}`, ...aliases, ...PRESETS_PROFILE[profile]]),
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function entradaAuthor() {
|
|
204
|
+
const capability = CAPABILITY_MATRIX_GOVERNANCA.author;
|
|
205
|
+
return {
|
|
206
|
+
id: "workflow.author",
|
|
207
|
+
kind: "SPECIALIZED_WORKFLOW",
|
|
208
|
+
domains: ["author", "narrativa", "escrita"],
|
|
209
|
+
label: "Author",
|
|
210
|
+
summary: "Workflow especializado para briefing, continuidade e validação narrativa de obras autorais.",
|
|
211
|
+
useWhen: ["escrever ou validar conto, romance, roteiro, lore, campanha ou continuidade de capítulos"],
|
|
212
|
+
avoidWhen: ["validar código, game loop ou conteúdo editorial multicanal"],
|
|
213
|
+
intentSignals: unicos([
|
|
214
|
+
"author", "autoria", "conto", "romance", "roteiro", "lore", "campanha narrativa",
|
|
215
|
+
"capitulos", "continuidade", "personagem", ...capability.rulePacksSugeridos,
|
|
216
|
+
]),
|
|
217
|
+
negativeSignals: ["profile validar author", "playtest", "multicanal", "deploy"],
|
|
218
|
+
requiredInputs: ["<contrato.sema>"],
|
|
219
|
+
commandTemplates: [
|
|
220
|
+
template("briefing", "sema author briefing <contrato.sema> --json", "READ_ONLY_VALIDATION"),
|
|
221
|
+
template("validar", "sema author validar <contrato.sema> --json", "READ_ONLY_VALIDATION"),
|
|
222
|
+
template("revisar", "sema author revisar-cliches <contrato.sema> --texto-arquivo <texto> --json", "READ_ONLY_VALIDATION"),
|
|
223
|
+
],
|
|
224
|
+
related: ["flow.governed-change", "profile.redacao"],
|
|
225
|
+
source: "CAPABILITY_MATRIX_GOVERNANCA.author",
|
|
226
|
+
extensible: false,
|
|
227
|
+
aliases: ["author", "autoria", "escrita autoral", "narrativa longa"],
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
export const SUPERFICIES_CLI_PIPELINES_AVANCADOS = Object.freeze({
|
|
231
|
+
"interactive.experience_ir": { command: "sema interativo validar-ir <experience-ir.json> --json", requiredInputs: ["<experience-ir.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
232
|
+
"interactive.observe": { command: "sema interativo validar-engine-snapshot <engine-snapshot.json> --json", requiredInputs: ["<engine-snapshot.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
233
|
+
"interactive.asset_provenance": { command: "sema interativo validar-asset-provenance <asset-provenance.json> --json", requiredInputs: ["<asset-provenance.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
234
|
+
"interactive.editor_state": { command: "sema interativo validar-editor-state <editor-state.json> --json", requiredInputs: ["<editor-state.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
235
|
+
"interactive.evidence_capture": { command: "sema interativo validar-multimodal <multimodal-evidence.json> --json", requiredInputs: ["<multimodal-evidence.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
236
|
+
"interactive.job_recovery": { command: "sema interativo planejar-jobs <job-orchestration.json> --json", requiredInputs: ["<job-orchestration.json>"], effectClass: "DECLARATIVE_PLANNING" },
|
|
237
|
+
"interactive.acceptance_lock": { command: "sema interativo validar-acceptance <acceptance-lock.json> --json", requiredInputs: ["<acceptance-lock.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
238
|
+
"interactive.temporal_validate": { command: "sema interativo validar-temporal <temporal-contract.json> --json", requiredInputs: ["<temporal-contract.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
239
|
+
"interactive.shot_validate": { command: "sema interativo validar-temporal <temporal-contract.json> --json", requiredInputs: ["<temporal-contract.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
240
|
+
"interactive.physics_validate": { command: "sema interativo validar-temporal <temporal-contract.json> --json", requiredInputs: ["<temporal-contract.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
241
|
+
"interactive.temporal_qa": { command: "sema interativo validar-evidencia-temporal <temporal-contract.json> --bundle-arquivo <temporal-evidence.json> --json", requiredInputs: ["<temporal-contract.json>", "<temporal-evidence.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
242
|
+
"interactive.clean_install_smoke": { command: "sema interativo validar-evidencia-temporal <temporal-contract.json> --bundle-arquivo <temporal-evidence.json> --json", requiredInputs: ["<temporal-contract.json>", "<temporal-evidence.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
243
|
+
"interactive.hardware_budget": { command: "sema interativo validar-evidencia-temporal <temporal-contract.json> --bundle-arquivo <temporal-evidence.json> --json", requiredInputs: ["<temporal-contract.json>", "<temporal-evidence.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
244
|
+
"interactive.autonomous_repair": { command: "sema interativo validar-autonomia <autonomy-repair.json> --json", requiredInputs: ["<autonomy-repair.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
245
|
+
"interactive.bot_playtest": { command: "sema interativo validar-playtest-fuzz <playtest-fuzz.json> --json", requiredInputs: ["<playtest-fuzz.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
246
|
+
"interactive.state_fuzz": { command: "sema interativo validar-playtest-fuzz <playtest-fuzz.json> --json", requiredInputs: ["<playtest-fuzz.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
247
|
+
"interactive.multiplayer_authority": { command: "sema interativo validar-multiplayer <multiplayer-authority.json> --json", requiredInputs: ["<multiplayer-authority.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
248
|
+
"interactive.engine_migration": { command: "sema interativo analisar-portabilidade <portability-plan.json> --json", requiredInputs: ["<portability-plan.json>"], effectClass: "DECLARATIVE_PLANNING" },
|
|
249
|
+
"interactive.portability": { command: "sema interativo analisar-portabilidade <portability-plan.json> --json", requiredInputs: ["<portability-plan.json>"], effectClass: "DECLARATIVE_PLANNING" },
|
|
250
|
+
"interactive.distributed_jobs": { command: "sema interativo validar-workers <distributed-workers.json> --json", requiredInputs: ["<distributed-workers.json>"], effectClass: "READ_ONLY_VALIDATION" },
|
|
251
|
+
});
|
|
252
|
+
function entradasConteudo() {
|
|
253
|
+
const pipeline = {
|
|
254
|
+
id: "pipeline.content",
|
|
255
|
+
kind: "ORCHESTRATION_PIPELINE",
|
|
256
|
+
domains: ["conteudo", "editorial", "multicanal"],
|
|
257
|
+
label: "Pipeline de conteúdo",
|
|
258
|
+
summary: "Orquestra declarativamente conteúdo multicanal e multi-formato com DAG, gates, ledger e adapters externos.",
|
|
259
|
+
useWhen: ["produzir, adaptar, avaliar e confirmar vários artefatos ou destinos como uma única execução governada"],
|
|
260
|
+
avoidWhen: ["a necessidade é somente validar um contrato por profile ou executar uma ferramenta isolada"],
|
|
261
|
+
intentSignals: [
|
|
262
|
+
"pipeline de conteudo", "multicanal", "multi-formato", "dag", "trailer", "thumbnail", "post",
|
|
263
|
+
"publicacao", "publicar por canal", "adaptar por destino", "ledger de conteudo",
|
|
264
|
+
],
|
|
265
|
+
negativeSignals: ["somente validar contrato", "playtest", "balanceamento", "romance com capitulos"],
|
|
266
|
+
requiredInputs: ["<definicao.json>"],
|
|
267
|
+
commandTemplates: [
|
|
268
|
+
template("validar", "sema conteudo validar <definicao.json> --json", "READ_ONLY_VALIDATION"),
|
|
269
|
+
template("planejar", "sema conteudo planejar <definicao.json> --alvos-arquivo <alvos.json> --json", "DECLARATIVE_PLANNING"),
|
|
270
|
+
],
|
|
271
|
+
related: CAPABILITIES_CONTEUDO_PADRAO,
|
|
272
|
+
source: "CAPABILITIES_CONTEUDO_PADRAO",
|
|
273
|
+
extensible: true,
|
|
274
|
+
aliases: ["pipeline conteudo", "content pipeline", "conteudo multicanal"],
|
|
275
|
+
};
|
|
276
|
+
const capabilities = CAPABILITIES_CONTEUDO_PADRAO.map((capability) => {
|
|
277
|
+
const metadata = CONTEUDO_METADATA[capability];
|
|
278
|
+
return {
|
|
279
|
+
id: capability,
|
|
280
|
+
kind: "CAPABILITY_TOKEN",
|
|
281
|
+
domains: ["conteudo"],
|
|
282
|
+
label: metadata.label,
|
|
283
|
+
summary: metadata.summary,
|
|
284
|
+
useWhen: [metadata.summary],
|
|
285
|
+
avoidWhen: ["a capability isolada está sendo tratada como pipeline completo ou autorização de execução"],
|
|
286
|
+
intentSignals: unicos([capability, ...capability.split("."), ...metadata.signals]),
|
|
287
|
+
negativeSignals: ["executar automaticamente", "aprovar sem evidencia"],
|
|
288
|
+
requiredInputs: ["<definicao.json>"],
|
|
289
|
+
commandTemplates: [
|
|
290
|
+
template("planejar", "sema conteudo planejar <definicao.json> --alvos-arquivo <alvos.json> --json", "DECLARATIVE_PLANNING"),
|
|
291
|
+
],
|
|
292
|
+
related: ["pipeline.content"],
|
|
293
|
+
source: "CAPABILITIES_CONTEUDO_PADRAO",
|
|
294
|
+
extensible: true,
|
|
295
|
+
aliases: [capability],
|
|
296
|
+
};
|
|
297
|
+
});
|
|
298
|
+
return [pipeline, ...capabilities];
|
|
299
|
+
}
|
|
300
|
+
function entradasInterativas() {
|
|
301
|
+
const pipelines = CATALOGO_PIPELINES_INTERATIVOS.map((pipeline) => {
|
|
302
|
+
const superficie = SUPERFICIES_CLI_PIPELINES_AVANCADOS[pipeline.pipelineId];
|
|
303
|
+
return {
|
|
304
|
+
id: pipeline.pipelineId,
|
|
305
|
+
kind: "ORCHESTRATION_PIPELINE",
|
|
306
|
+
domains: unicos(["sistemas-interativos", ...pipeline.kinds]),
|
|
307
|
+
label: pipeline.label,
|
|
308
|
+
summary: pipeline.summary,
|
|
309
|
+
useWhen: [...pipeline.useWhen],
|
|
310
|
+
avoidWhen: [...pipeline.avoidWhen],
|
|
311
|
+
intentSignals: unicos([
|
|
312
|
+
pipeline.pipelineId,
|
|
313
|
+
pipeline.label,
|
|
314
|
+
pipeline.summary,
|
|
315
|
+
...pipeline.kinds,
|
|
316
|
+
...pipeline.spatialModels,
|
|
317
|
+
...pipeline.renderModes,
|
|
318
|
+
...pipeline.controlModes,
|
|
319
|
+
...pipeline.capabilities,
|
|
320
|
+
...pipeline.useWhen,
|
|
321
|
+
]),
|
|
322
|
+
negativeSignals: [...pipeline.avoidWhen],
|
|
323
|
+
requiredInputs: superficie?.requiredInputs ?? [`<definition.json> with pipelines including ${pipeline.pipelineId}`],
|
|
324
|
+
commandTemplates: [
|
|
325
|
+
superficie
|
|
326
|
+
? template("operar-local", superficie.command, superficie.effectClass)
|
|
327
|
+
: template("planejar", "sema interativo planejar <definition.json> --json", "DECLARATIVE_PLANNING"),
|
|
328
|
+
template("descrever", `sema descobrir pipeline descrever ${pipeline.pipelineId} --json`, "READ_ONLY_DISCOVERY"),
|
|
329
|
+
],
|
|
330
|
+
related: [...pipeline.capabilities],
|
|
331
|
+
source: "CATALOGO_PIPELINES_INTERATIVOS",
|
|
332
|
+
extensible: false,
|
|
333
|
+
aliases: [pipeline.pipelineId, pipeline.label],
|
|
334
|
+
};
|
|
335
|
+
});
|
|
336
|
+
const porCapability = new Map();
|
|
337
|
+
for (const pipeline of CATALOGO_PIPELINES_INTERATIVOS) {
|
|
338
|
+
for (const capability of pipeline.capabilities) {
|
|
339
|
+
const atuais = porCapability.get(capability) ?? [];
|
|
340
|
+
atuais.push(pipeline);
|
|
341
|
+
porCapability.set(capability, atuais);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const idsPipelines = new Set(CATALOGO_PIPELINES_INTERATIVOS.map((pipeline) => pipeline.pipelineId));
|
|
345
|
+
const metadataCapabilities = new Map(CATALOGO_CAPABILITIES_INTERATIVAS.map((capability) => [capability.capability, capability]));
|
|
346
|
+
const capabilities = [...porCapability.entries()]
|
|
347
|
+
.filter(([capability]) => !idsPipelines.has(capability))
|
|
348
|
+
.map(([capability, donos]) => {
|
|
349
|
+
const metadata = metadataCapabilities.get(capability);
|
|
350
|
+
return {
|
|
351
|
+
id: capability,
|
|
352
|
+
kind: "CAPABILITY_TOKEN",
|
|
353
|
+
domains: unicos(["sistemas-interativos", ...donos.flatMap((pipeline) => pipeline.kinds)]),
|
|
354
|
+
label: metadata?.label ?? capability.split(".").map((parte) => parte.charAt(0).toUpperCase() + parte.slice(1)).join(" "),
|
|
355
|
+
summary: metadata?.summary ?? `Capability declarada por ${donos.map((pipeline) => pipeline.label).join(", ")}.`,
|
|
356
|
+
useWhen: unicos(donos.flatMap((pipeline) => pipeline.useWhen)),
|
|
357
|
+
avoidWhen: unicos(donos.flatMap((pipeline) => pipeline.avoidWhen)),
|
|
358
|
+
intentSignals: unicos([
|
|
359
|
+
capability,
|
|
360
|
+
metadata?.label,
|
|
361
|
+
metadata?.summary,
|
|
362
|
+
]),
|
|
363
|
+
negativeSignals: unicos(donos.flatMap((pipeline) => pipeline.avoidWhen)),
|
|
364
|
+
requiredInputs: ["<definition.json> with a related pipeline selected"],
|
|
365
|
+
commandTemplates: [
|
|
366
|
+
template("planejar", "sema interativo planejar <definition.json> --json", "DECLARATIVE_PLANNING"),
|
|
367
|
+
...donos.map((pipeline) => template(`descrever-${pipeline.pipelineId}`, `sema descobrir pipeline descrever ${pipeline.pipelineId} --json`, "READ_ONLY_DISCOVERY")),
|
|
368
|
+
],
|
|
369
|
+
related: donos.map((pipeline) => pipeline.pipelineId),
|
|
370
|
+
source: "CATALOGO_PIPELINES_INTERATIVOS.capabilities",
|
|
371
|
+
extensible: false,
|
|
372
|
+
aliases: [capability],
|
|
373
|
+
};
|
|
374
|
+
});
|
|
375
|
+
const adapters = CATALOGO_ADAPTADORES_INTERATIVOS.map((adapter) => ({
|
|
376
|
+
id: adapter.adapterId,
|
|
377
|
+
kind: "ADAPTER",
|
|
378
|
+
domains: unicos([
|
|
379
|
+
"sistemas-interativos",
|
|
380
|
+
adapter.role,
|
|
381
|
+
adapter.engine,
|
|
382
|
+
...adapter.kinds,
|
|
383
|
+
...adapter.spatialModels,
|
|
384
|
+
...adapter.renderModes,
|
|
385
|
+
]),
|
|
386
|
+
label: `Adapter ${adapter.engine}`,
|
|
387
|
+
summary: `Adapter externo ${adapter.role.toLowerCase()} para modelos espaciais ${adapter.spatialModels.join(", ")} e render ${adapter.renderModes.join(", ")}.`,
|
|
388
|
+
useWhen: [`selecionar runtime ou ferramenta externa compatível com ${adapter.engine}`],
|
|
389
|
+
avoidWhen: ["o adapter está sendo tratado como autorização ou execução implícita"],
|
|
390
|
+
intentSignals: unicos([
|
|
391
|
+
adapter.adapterId,
|
|
392
|
+
adapter.engine,
|
|
393
|
+
adapter.role,
|
|
394
|
+
...adapter.kinds,
|
|
395
|
+
...adapter.spatialModels,
|
|
396
|
+
...adapter.renderModes,
|
|
397
|
+
...adapter.capabilities,
|
|
398
|
+
]),
|
|
399
|
+
negativeSignals: ["executar automaticamente", "plugin instalado"],
|
|
400
|
+
requiredInputs: [],
|
|
401
|
+
commandTemplates: [
|
|
402
|
+
template("explicar", `sema descobrir explicar ${adapter.adapterId} --json`, "READ_ONLY_DISCOVERY"),
|
|
403
|
+
],
|
|
404
|
+
related: [...adapter.capabilities],
|
|
405
|
+
source: "CATALOGO_ADAPTADORES_INTERATIVOS",
|
|
406
|
+
extensible: false,
|
|
407
|
+
aliases: [adapter.adapterId, adapter.engine],
|
|
408
|
+
}));
|
|
409
|
+
return [...pipelines, ...capabilities, ...adapters];
|
|
410
|
+
}
|
|
411
|
+
function entradasGeradores() {
|
|
412
|
+
return ALVOS_GERACAO.map((alvo) => ({
|
|
413
|
+
id: `generator.${alvo}`,
|
|
414
|
+
kind: "GENERATOR",
|
|
415
|
+
domains: ["codigo", "geracao", alvo],
|
|
416
|
+
label: `Gerador ${alvo}`,
|
|
417
|
+
summary: `Gera artefatos ${alvo} derivados de contrato Sema validado.`,
|
|
418
|
+
useWhen: [`materializar código ${alvo} a partir de um contrato aplicável`],
|
|
419
|
+
avoidWhen: ["o contrato ainda não foi validado ou a intenção é editar código vivo manualmente"],
|
|
420
|
+
intentSignals: [alvo, `gerar ${alvo}`, `compilar ${alvo}`, "gerar codigo"],
|
|
421
|
+
negativeSignals: ["sem contrato", "editar manualmente"],
|
|
422
|
+
requiredInputs: ["<contrato.sema>", "<diretório>"],
|
|
423
|
+
commandTemplates: [
|
|
424
|
+
template("compilar", `sema compilar <contrato.sema> --alvo ${alvo} --saida <diretório>`, "WORKSPACE_GENERATION", true),
|
|
425
|
+
],
|
|
426
|
+
related: ["flow.contract-verification"],
|
|
427
|
+
source: "@sema/padroes.AlvoGeracao",
|
|
428
|
+
extensible: false,
|
|
429
|
+
aliases: [`gerador ${alvo}`, `generator ${alvo}`],
|
|
430
|
+
}));
|
|
431
|
+
}
|
|
432
|
+
function criarRegistro() {
|
|
433
|
+
const entries = [
|
|
434
|
+
...entradasGovernanca(),
|
|
435
|
+
...entradasProfiles(),
|
|
436
|
+
entradaAuthor(),
|
|
437
|
+
...entradasConteudo(),
|
|
438
|
+
...entradasInterativas(),
|
|
439
|
+
...entradasGeradores(),
|
|
440
|
+
].sort((a, b) => a.id.localeCompare(b.id));
|
|
441
|
+
const ids = new Set();
|
|
442
|
+
for (const entry of entries) {
|
|
443
|
+
if (ids.has(entry.id))
|
|
444
|
+
throw new Error(`discovery_id_duplicado:${entry.id}`);
|
|
445
|
+
ids.add(entry.id);
|
|
446
|
+
}
|
|
447
|
+
return entries;
|
|
448
|
+
}
|
|
449
|
+
const REGISTRO_DESCOBERTA = criarRegistro();
|
|
450
|
+
function clonarEntrada(entry) {
|
|
451
|
+
return {
|
|
452
|
+
...entry,
|
|
453
|
+
domains: [...entry.domains],
|
|
454
|
+
useWhen: [...entry.useWhen],
|
|
455
|
+
avoidWhen: [...entry.avoidWhen],
|
|
456
|
+
intentSignals: [...entry.intentSignals],
|
|
457
|
+
negativeSignals: [...entry.negativeSignals],
|
|
458
|
+
requiredInputs: [...entry.requiredInputs],
|
|
459
|
+
commandTemplates: entry.commandTemplates.map((item) => ({ ...item })),
|
|
460
|
+
related: [...entry.related],
|
|
461
|
+
aliases: entry.aliases ? [...entry.aliases] : undefined,
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
export function montarCatalogoCapacidades(filtros = {}) {
|
|
465
|
+
const kind = normalizarDiscoveryKind(filtros.kind);
|
|
466
|
+
if (filtros.kind && !kind)
|
|
467
|
+
throw new TypeError("discovery_kind_invalido");
|
|
468
|
+
const id = filtros.id?.trim() || null;
|
|
469
|
+
const domain = filtros.domain?.trim() || null;
|
|
470
|
+
const idNormalizado = id ? normalizar(id) : null;
|
|
471
|
+
const dominioNormalizado = domain ? normalizar(domain) : null;
|
|
472
|
+
const entries = REGISTRO_DESCOBERTA
|
|
473
|
+
.filter((entry) => !kind || entry.kind === kind)
|
|
474
|
+
.filter((entry) => !idNormalizado || normalizar(entry.id) === idNormalizado)
|
|
475
|
+
.filter((entry) => !dominioNormalizado || entry.domains.some((item) => normalizar(item) === dominioNormalizado))
|
|
476
|
+
.map(clonarEntrada);
|
|
477
|
+
return {
|
|
478
|
+
schemaVersion: DISCOVERY_SCHEMA_VERSION,
|
|
479
|
+
command: "descobrir catalogo",
|
|
480
|
+
success: true,
|
|
481
|
+
mode: "catalog",
|
|
482
|
+
...EXECUTION_BOUNDARY,
|
|
483
|
+
filters: {
|
|
484
|
+
kind,
|
|
485
|
+
id: redigirTextoControladoDescoberta(id),
|
|
486
|
+
domain: redigirTextoControladoDescoberta(domain),
|
|
487
|
+
},
|
|
488
|
+
entries,
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
export function obterEntradaDescoberta(id) {
|
|
492
|
+
const idNormalizado = normalizar(id);
|
|
493
|
+
const entry = REGISTRO_DESCOBERTA.find((item) => normalizar(item.id) === idNormalizado);
|
|
494
|
+
if (entry)
|
|
495
|
+
return clonarEntrada(entry);
|
|
496
|
+
const porAlias = REGISTRO_DESCOBERTA.filter((item) => ((item.aliases ?? []).some((alias) => normalizar(alias) === idNormalizado)));
|
|
497
|
+
return porAlias.length === 1 ? clonarEntrada(porAlias[0]) : null;
|
|
498
|
+
}
|
|
499
|
+
export function criarResumoDescobertaAgentContext() {
|
|
500
|
+
const entries = montarCatalogoCapacidades().entries;
|
|
501
|
+
const kinds = DISCOVERY_KINDS.filter((kind) => entries.some((entry) => entry.kind === kind));
|
|
502
|
+
const pipelinesPrincipais = entries
|
|
503
|
+
.filter((entry) => entry.kind === "ORCHESTRATION_PIPELINE")
|
|
504
|
+
.map((entry) => ({
|
|
505
|
+
id: entry.id,
|
|
506
|
+
label: entry.label,
|
|
507
|
+
command: entry.commandTemplates[0]?.command ?? `sema descobrir explicar ${entry.id} --json`,
|
|
508
|
+
}));
|
|
509
|
+
return {
|
|
510
|
+
schemaVersion: DISCOVERY_SCHEMA_VERSION,
|
|
511
|
+
command: "sema descobrir catalogo --json",
|
|
512
|
+
kinds,
|
|
513
|
+
pipelinesPrincipais,
|
|
514
|
+
commands: {
|
|
515
|
+
catalogo: "sema descobrir catalogo --json",
|
|
516
|
+
recomendar: "sema descobrir recomendar --intencao <texto> --json",
|
|
517
|
+
explicar: "sema descobrir explicar <id> --json",
|
|
518
|
+
},
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type DiscoveryCommandResult } from "./types.js";
|
|
2
|
+
export declare function comandoDescobertaCapacidades(subcomando: string | undefined, argumentos?: readonly string[]): DiscoveryCommandResult;
|
|
3
|
+
export type DiscoveryCliHandler = (posicionais: string[], args: string[], emJson: boolean) => Promise<number>;
|
|
4
|
+
export declare const comandoDescobrirHandler: DiscoveryCliHandler;
|
|
5
|
+
export declare const comandoPipelineDescobertaHandler: DiscoveryCliHandler;
|
|
6
|
+
export declare const comandoCapabilitiesDescobertaHandler: DiscoveryCliHandler;
|
|
7
|
+
export declare const REGISTRO_HANDLERS_DESCOBERTA: {
|
|
8
|
+
readonly descobrir: DiscoveryCliHandler;
|
|
9
|
+
readonly pipeline: DiscoveryCliHandler;
|
|
10
|
+
readonly capabilities: DiscoveryCliHandler;
|
|
11
|
+
};
|