@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
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
export type JsonPrimitivoSistemaInterativo = string | number | boolean | null;
|
|
2
|
+
export type JsonValorSistemaInterativo = JsonPrimitivoSistemaInterativo | JsonObjetoSistemaInterativo | readonly JsonValorSistemaInterativo[];
|
|
3
|
+
export interface JsonObjetoSistemaInterativo {
|
|
4
|
+
readonly [chave: string]: JsonValorSistemaInterativo;
|
|
5
|
+
}
|
|
6
|
+
export type KindSistemaInterativo = "GAME" | "SIMULATION" | "HYBRID";
|
|
7
|
+
export type ModeloEspacialSistemaInterativo = "NON_SPATIAL" | "TWO_D" | "TWO_POINT_FIVE_D" | "THREE_D";
|
|
8
|
+
export type ModoRenderSistemaInterativo = "HEADLESS" | "TEXT" | "VISUAL" | "XR";
|
|
9
|
+
export type PerfilVisualSistemaInterativo = "NONE" | "PIXEL_8_BIT" | "PIXEL_16_BIT" | "RASTER" | "VECTOR" | "STYLIZED" | "REALISTIC";
|
|
10
|
+
export type FidelidadeSistemaInterativo = "ARCADE" | "STYLIZED" | "SYSTEMIC" | "REALISTIC" | "CALIBRATED";
|
|
11
|
+
export type ModoControleSistemaInterativo = "HUMAN" | "SCRIPTED" | "AI" | "HYBRID" | "AUTONOMOUS" | "UNCONTROLLED";
|
|
12
|
+
export type ModeloTempoSistemaInterativo = "TURN_BASED" | "FIXED_STEP" | "VARIABLE_STEP" | "REAL_TIME" | "EVENT_DRIVEN" | "BATCH" | "ACCELERATED";
|
|
13
|
+
export type DeterminismoSistemaInterativo = "NONE" | "BEST_EFFORT" | "STOCHASTIC" | "SEEDED" | "STRICT";
|
|
14
|
+
export interface DefinicaoSistemaInterativo {
|
|
15
|
+
readonly schemaVersion: string;
|
|
16
|
+
readonly systemId: string;
|
|
17
|
+
readonly version: string;
|
|
18
|
+
readonly kind: KindSistemaInterativo;
|
|
19
|
+
readonly spatialModel: ModeloEspacialSistemaInterativo;
|
|
20
|
+
readonly renderMode: ModoRenderSistemaInterativo;
|
|
21
|
+
readonly visualProfile: PerfilVisualSistemaInterativo;
|
|
22
|
+
readonly fidelity: FidelidadeSistemaInterativo;
|
|
23
|
+
readonly controlModes: readonly ModoControleSistemaInterativo[];
|
|
24
|
+
readonly timeModel: ModeloTempoSistemaInterativo;
|
|
25
|
+
readonly determinism: DeterminismoSistemaInterativo;
|
|
26
|
+
readonly capabilities: readonly string[];
|
|
27
|
+
readonly pipelines: readonly string[];
|
|
28
|
+
readonly adapterTargets: readonly string[];
|
|
29
|
+
readonly world: JsonObjetoSistemaInterativo;
|
|
30
|
+
readonly budgets?: JsonObjetoSistemaInterativo;
|
|
31
|
+
readonly acceptance: JsonObjetoSistemaInterativo;
|
|
32
|
+
}
|
|
33
|
+
export interface ResultadoValidacaoDefinicaoSistemaInterativo {
|
|
34
|
+
readonly valida: boolean;
|
|
35
|
+
readonly definitionDigest: string;
|
|
36
|
+
readonly capabilitiesRequeridas: readonly string[];
|
|
37
|
+
readonly bloqueios: readonly string[];
|
|
38
|
+
}
|
|
39
|
+
export interface EtapaPipelineSistemaInterativo {
|
|
40
|
+
readonly stageId: string;
|
|
41
|
+
readonly capability: string;
|
|
42
|
+
readonly dependsOn: readonly string[];
|
|
43
|
+
readonly produces: readonly string[];
|
|
44
|
+
readonly requiredEvidence: readonly string[];
|
|
45
|
+
}
|
|
46
|
+
export interface PipelineSistemaInterativo {
|
|
47
|
+
readonly pipelineId: string;
|
|
48
|
+
readonly version: string;
|
|
49
|
+
readonly label: string;
|
|
50
|
+
readonly summary: string;
|
|
51
|
+
readonly kinds: readonly KindSistemaInterativo[];
|
|
52
|
+
readonly spatialModels: readonly ModeloEspacialSistemaInterativo[];
|
|
53
|
+
readonly renderModes: readonly ModoRenderSistemaInterativo[];
|
|
54
|
+
readonly visualProfiles: readonly PerfilVisualSistemaInterativo[];
|
|
55
|
+
readonly controlModes: readonly ModoControleSistemaInterativo[];
|
|
56
|
+
readonly fidelities: readonly FidelidadeSistemaInterativo[];
|
|
57
|
+
readonly capabilities: readonly string[];
|
|
58
|
+
readonly stages: readonly EtapaPipelineSistemaInterativo[];
|
|
59
|
+
readonly requiredEvidence: readonly string[];
|
|
60
|
+
readonly useWhen: readonly string[];
|
|
61
|
+
readonly avoidWhen: readonly string[];
|
|
62
|
+
}
|
|
63
|
+
export interface CapabilitySistemaInterativo {
|
|
64
|
+
readonly capability: string;
|
|
65
|
+
readonly label: string;
|
|
66
|
+
readonly summary: string;
|
|
67
|
+
readonly kinds: readonly KindSistemaInterativo[];
|
|
68
|
+
}
|
|
69
|
+
export type PapelAdaptadorSistemaInterativo = "ENGINE" | "RUNTIME" | "EDITOR" | "ASSET" | "BUILD" | "TELEMETRY" | "VALIDATOR" | "CUSTOM";
|
|
70
|
+
export type FaseProtocoloAdaptador = "DETECT" | "PROBE" | "SNAPSHOT" | "PLAN" | "APPLY" | "VALIDATE" | "EVIDENCE" | "ROLLBACK";
|
|
71
|
+
export interface AdaptadorSistemaInterativo {
|
|
72
|
+
readonly adapterId: string;
|
|
73
|
+
readonly version: string;
|
|
74
|
+
readonly role: PapelAdaptadorSistemaInterativo;
|
|
75
|
+
readonly engine: string;
|
|
76
|
+
readonly kinds: readonly KindSistemaInterativo[];
|
|
77
|
+
readonly spatialModels: readonly ModeloEspacialSistemaInterativo[];
|
|
78
|
+
readonly renderModes: readonly ModoRenderSistemaInterativo[];
|
|
79
|
+
readonly visualProfiles: readonly PerfilVisualSistemaInterativo[];
|
|
80
|
+
readonly controlModes: readonly ModoControleSistemaInterativo[];
|
|
81
|
+
readonly timeModels: readonly ModeloTempoSistemaInterativo[];
|
|
82
|
+
readonly fidelities: readonly FidelidadeSistemaInterativo[];
|
|
83
|
+
readonly capabilities: readonly string[];
|
|
84
|
+
readonly protocol: readonly FaseProtocoloAdaptador[];
|
|
85
|
+
readonly readOnlyProbe: true;
|
|
86
|
+
readonly mutatesWorkspace: boolean;
|
|
87
|
+
readonly supportsRollback: boolean;
|
|
88
|
+
readonly executionBoundary: "EXTERNAL";
|
|
89
|
+
}
|
|
90
|
+
export interface FiltrosAdaptadoresSistemasInterativos {
|
|
91
|
+
readonly kind?: KindSistemaInterativo;
|
|
92
|
+
readonly spatialModel?: ModeloEspacialSistemaInterativo;
|
|
93
|
+
readonly renderMode?: ModoRenderSistemaInterativo;
|
|
94
|
+
readonly visualProfile?: PerfilVisualSistemaInterativo;
|
|
95
|
+
readonly role?: PapelAdaptadorSistemaInterativo;
|
|
96
|
+
readonly controlMode?: ModoControleSistemaInterativo;
|
|
97
|
+
readonly timeModel?: ModeloTempoSistemaInterativo;
|
|
98
|
+
readonly fidelity?: FidelidadeSistemaInterativo;
|
|
99
|
+
}
|
|
100
|
+
export interface ResultadoListagemAdaptadoresSistemasInterativos {
|
|
101
|
+
readonly adapters: readonly AdaptadorSistemaInterativo[];
|
|
102
|
+
readonly filtrosAplicados: FiltrosAdaptadoresSistemasInterativos;
|
|
103
|
+
readonly executed: false;
|
|
104
|
+
}
|
|
105
|
+
export interface ResultadoValidacaoAdaptadorSistemaInterativo {
|
|
106
|
+
readonly valido: boolean;
|
|
107
|
+
readonly bloqueios: readonly string[];
|
|
108
|
+
}
|
|
109
|
+
export interface FaseExecutadaProtocoloAdapter {
|
|
110
|
+
readonly phaseId: string;
|
|
111
|
+
readonly phase: FaseProtocoloAdaptador;
|
|
112
|
+
readonly semanticTargetId: string;
|
|
113
|
+
readonly inputDigest: string;
|
|
114
|
+
readonly outputDigest: string;
|
|
115
|
+
readonly success: boolean;
|
|
116
|
+
}
|
|
117
|
+
export interface RegistroProtocoloAdapter {
|
|
118
|
+
readonly runId: string;
|
|
119
|
+
readonly adapterId: string;
|
|
120
|
+
readonly adapterVersion: string;
|
|
121
|
+
readonly semanticTargetId: string;
|
|
122
|
+
readonly phases: readonly FaseExecutadaProtocoloAdapter[];
|
|
123
|
+
readonly mutated: boolean;
|
|
124
|
+
readonly success: boolean;
|
|
125
|
+
readonly rollbackEvidenceId?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface ResultadoValidacaoProtocoloAdapter {
|
|
128
|
+
readonly valido: boolean;
|
|
129
|
+
readonly faseAtual: FaseProtocoloAdaptador | "NOT_STARTED";
|
|
130
|
+
readonly bloqueios: readonly string[];
|
|
131
|
+
readonly exigeRollback: boolean;
|
|
132
|
+
}
|
|
133
|
+
export interface InstanciaEtapaSistemaInterativo extends EtapaPipelineSistemaInterativo {
|
|
134
|
+
readonly pipelineId: string;
|
|
135
|
+
readonly stageInstanceId: string;
|
|
136
|
+
}
|
|
137
|
+
export interface InstanciaPipelineSistemaInterativo {
|
|
138
|
+
readonly pipelineId: string;
|
|
139
|
+
readonly version: string;
|
|
140
|
+
readonly stageInstanceIds: readonly string[];
|
|
141
|
+
readonly requiredEvidence: readonly string[];
|
|
142
|
+
}
|
|
143
|
+
export interface ProvedorEtapaSistemaInterativo {
|
|
144
|
+
readonly stageInstanceId: string;
|
|
145
|
+
readonly capability: string;
|
|
146
|
+
readonly candidateAdapterIds: readonly string[];
|
|
147
|
+
readonly selectedAdapterIds: readonly string[];
|
|
148
|
+
readonly coveredBySelection: boolean;
|
|
149
|
+
}
|
|
150
|
+
export interface PlanoSistemaInterativo {
|
|
151
|
+
readonly systemId: string;
|
|
152
|
+
readonly definitionDigest: string;
|
|
153
|
+
readonly planDigest: string;
|
|
154
|
+
readonly capabilitiesRequeridas: readonly string[];
|
|
155
|
+
readonly capabilitiesAusentes: readonly string[];
|
|
156
|
+
readonly pipelines: readonly InstanciaPipelineSistemaInterativo[];
|
|
157
|
+
readonly adaptersCompativeis: readonly string[];
|
|
158
|
+
readonly adaptersSelecionados: readonly string[];
|
|
159
|
+
readonly adapterSelectionExplicit: boolean;
|
|
160
|
+
readonly adapterCoverageComplete: boolean;
|
|
161
|
+
readonly capabilitiesSemAdapter: readonly string[];
|
|
162
|
+
readonly stageProviderMap: readonly ProvedorEtapaSistemaInterativo[];
|
|
163
|
+
readonly stages: readonly InstanciaEtapaSistemaInterativo[];
|
|
164
|
+
readonly nextActions: readonly string[];
|
|
165
|
+
readonly executed: false;
|
|
166
|
+
}
|
|
167
|
+
export interface ResultadoPlanejamentoSistemaInterativo {
|
|
168
|
+
readonly plano: PlanoSistemaInterativo;
|
|
169
|
+
readonly bloqueios: readonly string[];
|
|
170
|
+
}
|
|
171
|
+
export interface ObservacaoSistemaInterativo {
|
|
172
|
+
readonly evidenceId: string;
|
|
173
|
+
readonly evidenceType: string;
|
|
174
|
+
readonly stageId: string;
|
|
175
|
+
readonly semanticTargetId: string;
|
|
176
|
+
readonly producerAdapterId: string;
|
|
177
|
+
readonly producerAdapterVersion: string;
|
|
178
|
+
readonly artifactDigest: string;
|
|
179
|
+
readonly observedAt: string;
|
|
180
|
+
readonly source: string;
|
|
181
|
+
readonly data: JsonObjetoSistemaInterativo;
|
|
182
|
+
}
|
|
183
|
+
export interface BundleEvidenciasSistemaInterativo {
|
|
184
|
+
readonly schemaVersion: string;
|
|
185
|
+
readonly runId: string;
|
|
186
|
+
readonly systemId: string;
|
|
187
|
+
readonly definitionDigest: string;
|
|
188
|
+
readonly planDigest: string;
|
|
189
|
+
readonly observations: readonly ObservacaoSistemaInterativo[];
|
|
190
|
+
}
|
|
191
|
+
export interface ResultadoValidacaoBundleEvidenciasSistemaInterativo {
|
|
192
|
+
readonly valido: boolean;
|
|
193
|
+
readonly evidenciasAceitas: readonly string[];
|
|
194
|
+
readonly evidenciasAusentes: readonly string[];
|
|
195
|
+
readonly bloqueios: readonly string[];
|
|
196
|
+
}
|
|
197
|
+
export type StatusSistemaInterativo = "INVALID" | "PLANNED" | "READY" | "RUNNING" | "WAITING_EVIDENCE" | "BLOCKED" | "STRUCTURALLY_COMPLETE";
|
|
198
|
+
export interface EstadoEtapaSistemaInterativo {
|
|
199
|
+
readonly stageId: string;
|
|
200
|
+
readonly status: "WAITING_EVIDENCE" | "STRUCTURALLY_COMPLETE";
|
|
201
|
+
readonly evidenciasAusentes: readonly string[];
|
|
202
|
+
}
|
|
203
|
+
export interface EstadoSistemaInterativo {
|
|
204
|
+
readonly status: StatusSistemaInterativo;
|
|
205
|
+
readonly stages: readonly EstadoEtapaSistemaInterativo[];
|
|
206
|
+
readonly evidenciasAceitas: readonly string[];
|
|
207
|
+
readonly evidenciasAusentes: readonly string[];
|
|
208
|
+
readonly bloqueios: readonly string[];
|
|
209
|
+
readonly nextActions: readonly string[];
|
|
210
|
+
readonly completed: false;
|
|
211
|
+
readonly localCoverageComplete: boolean;
|
|
212
|
+
readonly awaitingExternalAttestation: true;
|
|
213
|
+
readonly completionScope: "STRUCTURAL_LOCAL";
|
|
214
|
+
readonly authoritative: false;
|
|
215
|
+
}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
// SEMA-GOVERNED: sema.produto.sistemas_interativos
|
|
2
|
+
// Descricao: validacao deterministica de definicoes sem executar engine, editor, runner ou adapter.
|
|
3
|
+
import { digestJsonSistemaInterativo } from "./canonical.js";
|
|
4
|
+
import { MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS, obterAdaptadorSistemaInterativo, obterPipelineSistemaInterativo, } from "./catalog.js";
|
|
5
|
+
const VERSOES_FLUTUANTES = new Set(["latest", "next", "dev", "main", "master", "*"]);
|
|
6
|
+
const VALOR_SENSIVEL = /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----|\bBearer\s+[A-Za-z0-9._~+/=-]+|\b(?:sk|ghp|github_pat)_[A-Za-z0-9_-]{12,}/i;
|
|
7
|
+
function adicionar(bloqueios, valor) {
|
|
8
|
+
if (!bloqueios.includes(valor))
|
|
9
|
+
bloqueios.push(valor);
|
|
10
|
+
}
|
|
11
|
+
function textoOpaco(valor) {
|
|
12
|
+
return typeof valor === "string" && valor.trim().length > 0 && !/[\u0000-\u001f\u007f]/.test(valor);
|
|
13
|
+
}
|
|
14
|
+
function identificadorSeguro(valor) {
|
|
15
|
+
return textoOpaco(valor)
|
|
16
|
+
&& valor.length <= 128
|
|
17
|
+
&& /^[A-Za-z0-9][A-Za-z0-9._:-]*$/.test(valor)
|
|
18
|
+
&& !VALOR_SENSIVEL.test(valor);
|
|
19
|
+
}
|
|
20
|
+
function objeto(valor) {
|
|
21
|
+
return valor !== null && typeof valor === "object" && !Array.isArray(valor);
|
|
22
|
+
}
|
|
23
|
+
function valorDeclarado(valor) {
|
|
24
|
+
if (typeof valor === "string")
|
|
25
|
+
return valor.trim().length > 0;
|
|
26
|
+
if (Array.isArray(valor))
|
|
27
|
+
return valor.length > 0;
|
|
28
|
+
if (objeto(valor))
|
|
29
|
+
return Object.keys(valor).length > 0;
|
|
30
|
+
return valor !== undefined && valor !== null;
|
|
31
|
+
}
|
|
32
|
+
function campoDeclarado(alvo, campo) {
|
|
33
|
+
return valorDeclarado(alvo[campo]);
|
|
34
|
+
}
|
|
35
|
+
function inteiroPositivo(valor) {
|
|
36
|
+
return typeof valor === "number" && Number.isSafeInteger(valor) && valor > 0;
|
|
37
|
+
}
|
|
38
|
+
function dimensaoPixelValida(valor) {
|
|
39
|
+
if (inteiroPositivo(valor))
|
|
40
|
+
return true;
|
|
41
|
+
if (typeof valor === "string") {
|
|
42
|
+
return /^[1-9]\d{0,4}x[1-9]\d{0,4}(?:\s+(?:and|to)\s+[1-9]\d{0,4}x[1-9]\d{0,4})?$/i.test(valor);
|
|
43
|
+
}
|
|
44
|
+
if (Array.isArray(valor))
|
|
45
|
+
return valor.length === 2 && valor.every(inteiroPositivo);
|
|
46
|
+
if (objeto(valor))
|
|
47
|
+
return inteiroPositivo(valor.width) && inteiroPositivo(valor.height);
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
function listaTextosUnicos(valor, permiteVazia = true) {
|
|
51
|
+
if (!Array.isArray(valor) || (!permiteVazia && valor.length === 0))
|
|
52
|
+
return false;
|
|
53
|
+
if (!valor.every(textoOpaco))
|
|
54
|
+
return false;
|
|
55
|
+
return new Set(valor).size === valor.length;
|
|
56
|
+
}
|
|
57
|
+
function slugCapability(valor) {
|
|
58
|
+
return valor.toLowerCase().replace(/two_point_five/g, "2_5").replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
59
|
+
}
|
|
60
|
+
function capabilitiesEstruturais(definicao) {
|
|
61
|
+
const capabilities = ["interactive.world.model", "interactive.state.model"];
|
|
62
|
+
const eixos = [
|
|
63
|
+
["kind", definicao.kind, MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.kinds],
|
|
64
|
+
["spatial", definicao.spatialModel, MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.spatialModels],
|
|
65
|
+
["render", definicao.renderMode, MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.renderModes],
|
|
66
|
+
["visual", definicao.visualProfile, MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.visualProfiles],
|
|
67
|
+
["fidelity", definicao.fidelity, MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.fidelities],
|
|
68
|
+
["time", definicao.timeModel, MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.timeModels],
|
|
69
|
+
["determinism", definicao.determinism, MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.determinisms],
|
|
70
|
+
];
|
|
71
|
+
for (const [eixo, valor, permitidos] of eixos) {
|
|
72
|
+
if (typeof valor === "string" && permitidos.includes(valor))
|
|
73
|
+
capabilities.push(`interactive.${eixo}.${slugCapability(valor)}`);
|
|
74
|
+
}
|
|
75
|
+
for (const modo of Array.isArray(definicao.controlModes) ? definicao.controlModes : []) {
|
|
76
|
+
if (!MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.controlModes.includes(modo))
|
|
77
|
+
continue;
|
|
78
|
+
capabilities.push(`interactive.control.${slugCapability(modo)}`);
|
|
79
|
+
}
|
|
80
|
+
for (const pipelineId of Array.isArray(definicao.pipelines) ? definicao.pipelines : []) {
|
|
81
|
+
const pipeline = obterPipelineSistemaInterativo(pipelineId);
|
|
82
|
+
if (pipeline)
|
|
83
|
+
capabilities.push(...pipeline.capabilities);
|
|
84
|
+
}
|
|
85
|
+
return [...new Set(capabilities)].sort();
|
|
86
|
+
}
|
|
87
|
+
function validarBase(definicao, bloqueios) {
|
|
88
|
+
if (definicao.schemaVersion !== "1.0")
|
|
89
|
+
adicionar(bloqueios, "schema_version_nao_suportada");
|
|
90
|
+
if (!identificadorSeguro(definicao.systemId))
|
|
91
|
+
adicionar(bloqueios, "system_id_invalido");
|
|
92
|
+
if (!textoOpaco(definicao.version) || VERSOES_FLUTUANTES.has(definicao.version.toLowerCase())) {
|
|
93
|
+
adicionar(bloqueios, "version_nao_fixada");
|
|
94
|
+
}
|
|
95
|
+
if (!MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.kinds.includes(definicao.kind))
|
|
96
|
+
adicionar(bloqueios, "kind_invalido");
|
|
97
|
+
if (!MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.spatialModels.includes(definicao.spatialModel))
|
|
98
|
+
adicionar(bloqueios, "spatial_model_invalido");
|
|
99
|
+
if (!MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.renderModes.includes(definicao.renderMode))
|
|
100
|
+
adicionar(bloqueios, "render_mode_invalido");
|
|
101
|
+
if (!MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.visualProfiles.includes(definicao.visualProfile))
|
|
102
|
+
adicionar(bloqueios, "visual_profile_invalido");
|
|
103
|
+
if (!MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.fidelities.includes(definicao.fidelity))
|
|
104
|
+
adicionar(bloqueios, "fidelity_invalida");
|
|
105
|
+
if (!MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.timeModels.includes(definicao.timeModel))
|
|
106
|
+
adicionar(bloqueios, "time_model_invalido");
|
|
107
|
+
if (!MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.determinisms.includes(definicao.determinism))
|
|
108
|
+
adicionar(bloqueios, "determinism_invalido");
|
|
109
|
+
if (!listaTextosUnicos(definicao.controlModes, false))
|
|
110
|
+
adicionar(bloqueios, "control_modes_invalidos");
|
|
111
|
+
else if (!definicao.controlModes.every((modo) => MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.controlModes.includes(modo))) {
|
|
112
|
+
adicionar(bloqueios, "control_mode_fora_do_vocabulario");
|
|
113
|
+
}
|
|
114
|
+
if (!listaTextosUnicos(definicao.capabilities))
|
|
115
|
+
adicionar(bloqueios, "capabilities_invalidas");
|
|
116
|
+
if (!listaTextosUnicos(definicao.pipelines, false))
|
|
117
|
+
adicionar(bloqueios, "pipelines_invalidos_ou_ausentes");
|
|
118
|
+
if (!listaTextosUnicos(definicao.adapterTargets))
|
|
119
|
+
adicionar(bloqueios, "adapter_targets_invalidos");
|
|
120
|
+
if (!objeto(definicao.world))
|
|
121
|
+
adicionar(bloqueios, "world_invalido");
|
|
122
|
+
if (!objeto(definicao.acceptance))
|
|
123
|
+
adicionar(bloqueios, "acceptance_invalida");
|
|
124
|
+
if (definicao.budgets !== undefined && !objeto(definicao.budgets))
|
|
125
|
+
adicionar(bloqueios, "budgets_invalidos");
|
|
126
|
+
}
|
|
127
|
+
function validarEixos(definicao, bloqueios) {
|
|
128
|
+
const visual = definicao.visualProfile;
|
|
129
|
+
if ((definicao.renderMode === "HEADLESS" || definicao.renderMode === "TEXT") && visual !== "NONE") {
|
|
130
|
+
adicionar(bloqueios, "render_nao_visual_exige_visual_profile_none");
|
|
131
|
+
}
|
|
132
|
+
if ((definicao.renderMode === "VISUAL" || definicao.renderMode === "XR") && visual === "NONE") {
|
|
133
|
+
adicionar(bloqueios, "render_visual_exige_visual_profile");
|
|
134
|
+
}
|
|
135
|
+
if (definicao.renderMode === "XR" && definicao.spatialModel !== "THREE_D") {
|
|
136
|
+
adicionar(bloqueios, "render_xr_exige_spatial_model_three_d");
|
|
137
|
+
}
|
|
138
|
+
if (visual === "PIXEL_8_BIT" || visual === "PIXEL_16_BIT") {
|
|
139
|
+
const budgets = definicao.budgets;
|
|
140
|
+
if (!objeto(budgets)) {
|
|
141
|
+
adicionar(bloqueios, "pixel_profile_exige_budgets");
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
for (const campo of ["paletteColors", "baseResolution", "tileSize", "spriteSize", "memoryBudgetBytes", "audioProfile"]) {
|
|
145
|
+
if (!campoDeclarado(budgets, campo))
|
|
146
|
+
adicionar(bloqueios, `pixel_budget_ausente:${campo}`);
|
|
147
|
+
}
|
|
148
|
+
const paletteColors = budgets.paletteColors;
|
|
149
|
+
if (typeof paletteColors !== "number" || !Number.isInteger(paletteColors) || paletteColors <= 0) {
|
|
150
|
+
adicionar(bloqueios, "pixel_palette_invalida");
|
|
151
|
+
}
|
|
152
|
+
else if (visual === "PIXEL_8_BIT" && paletteColors > 256) {
|
|
153
|
+
adicionar(bloqueios, "pixel_8_bit_palette_excede_256");
|
|
154
|
+
}
|
|
155
|
+
else if (visual === "PIXEL_16_BIT" && paletteColors > 65_536) {
|
|
156
|
+
adicionar(bloqueios, "pixel_16_bit_palette_excede_65536");
|
|
157
|
+
}
|
|
158
|
+
if (!dimensaoPixelValida(budgets.baseResolution))
|
|
159
|
+
adicionar(bloqueios, "pixel_base_resolution_invalida");
|
|
160
|
+
if (!dimensaoPixelValida(budgets.tileSize))
|
|
161
|
+
adicionar(bloqueios, "pixel_tile_size_invalido");
|
|
162
|
+
if (!dimensaoPixelValida(budgets.spriteSize))
|
|
163
|
+
adicionar(bloqueios, "pixel_sprite_size_invalido");
|
|
164
|
+
if (!inteiroPositivo(budgets.memoryBudgetBytes))
|
|
165
|
+
adicionar(bloqueios, "pixel_memory_budget_invalido");
|
|
166
|
+
if (!textoOpaco(budgets.audioProfile))
|
|
167
|
+
adicionar(bloqueios, "pixel_audio_profile_invalido");
|
|
168
|
+
}
|
|
169
|
+
if (objeto(definicao.world) && definicao.spatialModel === "THREE_D") {
|
|
170
|
+
for (const campo of ["units", "scale", "coordinateSystem"]) {
|
|
171
|
+
if (!campoDeclarado(definicao.world, campo))
|
|
172
|
+
adicionar(bloqueios, `world_3d_ausente:${campo}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (objeto(definicao.world) && (definicao.spatialModel === "TWO_D" || definicao.spatialModel === "TWO_POINT_FIVE_D")) {
|
|
176
|
+
if (!campoDeclarado(definicao.world, "grid") && !campoDeclarado(definicao.world, "coordinateSystem")) {
|
|
177
|
+
adicionar(bloqueios, "world_2d_exige_grid_ou_coordinate_system");
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function validarWorld(definicao, bloqueios) {
|
|
182
|
+
if (!objeto(definicao.world))
|
|
183
|
+
return;
|
|
184
|
+
for (const campo of ["identity", "state", "time", "events", "initialConditions"]) {
|
|
185
|
+
if (!campoDeclarado(definicao.world, campo))
|
|
186
|
+
adicionar(bloqueios, `world_campo_ausente:${campo}`);
|
|
187
|
+
}
|
|
188
|
+
if (definicao.kind === "GAME" || definicao.kind === "HYBRID") {
|
|
189
|
+
for (const campo of ["loop", "objective", "successConditions", "failureConditions", "rules"]) {
|
|
190
|
+
if (!campoDeclarado(definicao.world, campo))
|
|
191
|
+
adicionar(bloqueios, `game_world_ausente:${campo}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (definicao.kind === "SIMULATION" || definicao.kind === "HYBRID") {
|
|
195
|
+
for (const campo of ["model", "assumptions", "boundaryConditions", "outputs", "validation"]) {
|
|
196
|
+
if (!campoDeclarado(definicao.world, campo))
|
|
197
|
+
adicionar(bloqueios, `simulation_world_ausente:${campo}`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (definicao.determinism === "SEEDED" || definicao.determinism === "STRICT") {
|
|
201
|
+
for (const campo of ["seed", "snapshot", "replay", "step"]) {
|
|
202
|
+
if (!campoDeclarado(definicao.world, campo))
|
|
203
|
+
adicionar(bloqueios, `determinism_world_ausente:${campo}`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (Array.isArray(definicao.controlModes) && definicao.controlModes.some((modo) => modo === "AUTONOMOUS" || modo === "UNCONTROLLED")) {
|
|
207
|
+
for (const campo of ["stopCriteria", "safetyConstraints"]) {
|
|
208
|
+
if (!campoDeclarado(definicao.world, campo))
|
|
209
|
+
adicionar(bloqueios, `autonomia_world_ausente:${campo}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function validarAceitacao(definicao, bloqueios) {
|
|
214
|
+
if (!objeto(definicao.acceptance))
|
|
215
|
+
return;
|
|
216
|
+
if (definicao.fidelity === "REALISTIC" || definicao.fidelity === "CALIBRATED") {
|
|
217
|
+
for (const campo of ["reference", "calibration", "tolerances", "uncertainty", "telemetry"]) {
|
|
218
|
+
if (!campoDeclarado(definicao.acceptance, campo))
|
|
219
|
+
adicionar(bloqueios, `realistic_acceptance_ausente:${campo}`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function validarPipelinesEAdapters(definicao, bloqueios) {
|
|
224
|
+
const pipelines = Array.isArray(definicao.pipelines) ? definicao.pipelines : [];
|
|
225
|
+
for (const [indice, pipelineId] of pipelines.entries()) {
|
|
226
|
+
const pipeline = obterPipelineSistemaInterativo(pipelineId);
|
|
227
|
+
if (!pipeline) {
|
|
228
|
+
adicionar(bloqueios, `pipeline_desconhecido_indice:${indice}`);
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
if (!pipeline.kinds.includes(definicao.kind))
|
|
232
|
+
adicionar(bloqueios, `pipeline_kind_incompativel_indice:${indice}`);
|
|
233
|
+
if (!pipeline.spatialModels.includes(definicao.spatialModel))
|
|
234
|
+
adicionar(bloqueios, `pipeline_spatial_model_incompativel_indice:${indice}`);
|
|
235
|
+
if (!pipeline.renderModes.includes(definicao.renderMode))
|
|
236
|
+
adicionar(bloqueios, `pipeline_render_mode_incompativel_indice:${indice}`);
|
|
237
|
+
if (!pipeline.visualProfiles.includes(definicao.visualProfile))
|
|
238
|
+
adicionar(bloqueios, `pipeline_visual_profile_incompativel_indice:${indice}`);
|
|
239
|
+
const modos = Array.isArray(definicao.controlModes) ? definicao.controlModes : [];
|
|
240
|
+
if (!modos.some((modo) => pipeline.controlModes.includes(modo)))
|
|
241
|
+
adicionar(bloqueios, `pipeline_control_mode_incompativel_indice:${indice}`);
|
|
242
|
+
if (!pipeline.fidelities.includes(definicao.fidelity))
|
|
243
|
+
adicionar(bloqueios, `pipeline_fidelity_incompativel_indice:${indice}`);
|
|
244
|
+
}
|
|
245
|
+
for (const [indice, adapterId] of (Array.isArray(definicao.adapterTargets) ? definicao.adapterTargets : []).entries()) {
|
|
246
|
+
if (!obterAdaptadorSistemaInterativo(adapterId))
|
|
247
|
+
adicionar(bloqueios, `adapter_target_desconhecido_indice:${indice}`);
|
|
248
|
+
}
|
|
249
|
+
const exigeSafety = Array.isArray(definicao.controlModes)
|
|
250
|
+
&& definicao.controlModes.some((modo) => modo === "AUTONOMOUS" || modo === "UNCONTROLLED");
|
|
251
|
+
const pipelinesSafety = definicao.kind === "GAME"
|
|
252
|
+
? ["interactive.safety"]
|
|
253
|
+
: ["interactive.safety", "simulation.safety"];
|
|
254
|
+
if (exigeSafety && !pipelinesSafety.some((pipelineId) => pipelines.includes(pipelineId))) {
|
|
255
|
+
adicionar(bloqueios, "autonomia_exige_pipeline_safety_compativel");
|
|
256
|
+
}
|
|
257
|
+
const exigeCalibracao = definicao.fidelity === "REALISTIC" || definicao.fidelity === "CALIBRATED";
|
|
258
|
+
const pipelinesCalibracao = definicao.kind === "GAME"
|
|
259
|
+
? ["interactive.calibrate"]
|
|
260
|
+
: ["interactive.calibrate", "simulation.calibrate"];
|
|
261
|
+
if (exigeCalibracao && !pipelinesCalibracao.some((pipelineId) => pipelines.includes(pipelineId))) {
|
|
262
|
+
adicionar(bloqueios, "fidelity_exige_pipeline_calibrate_compativel");
|
|
263
|
+
}
|
|
264
|
+
if ((definicao.determinism === "SEEDED" || definicao.determinism === "STRICT")
|
|
265
|
+
&& !pipelines.includes("interactive.replay")) {
|
|
266
|
+
adicionar(bloqueios, "determinism_exige_pipeline_interactive_replay");
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function validarCapabilitiesControle(definicao, bloqueios) {
|
|
270
|
+
const declaradas = new Set(Array.isArray(definicao.capabilities) ? definicao.capabilities : []);
|
|
271
|
+
for (const modo of Array.isArray(definicao.controlModes) ? definicao.controlModes : []) {
|
|
272
|
+
if (!MATRIZ_DOMINIO_SISTEMAS_INTERATIVOS.controlModes.includes(modo))
|
|
273
|
+
continue;
|
|
274
|
+
const capability = `interactive.control.${slugCapability(modo)}`;
|
|
275
|
+
if (!declaradas.has(capability))
|
|
276
|
+
adicionar(bloqueios, "capability_controle_ausente");
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
export function validarDefinicaoSistemaInterativo(definicao) {
|
|
280
|
+
const bloqueios = [];
|
|
281
|
+
let definitionDigest;
|
|
282
|
+
try {
|
|
283
|
+
definitionDigest = digestJsonSistemaInterativo(definicao);
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
definitionDigest = digestJsonSistemaInterativo({ definicaoInvalida: true });
|
|
287
|
+
adicionar(bloqueios, "definicao_nao_canonica");
|
|
288
|
+
}
|
|
289
|
+
const entrada = objeto(definicao) ? definicao : {};
|
|
290
|
+
if (entrada !== definicao)
|
|
291
|
+
adicionar(bloqueios, "definicao_invalida");
|
|
292
|
+
validarBase(entrada, bloqueios);
|
|
293
|
+
validarEixos(entrada, bloqueios);
|
|
294
|
+
validarWorld(entrada, bloqueios);
|
|
295
|
+
validarAceitacao(entrada, bloqueios);
|
|
296
|
+
validarPipelinesEAdapters(entrada, bloqueios);
|
|
297
|
+
validarCapabilitiesControle(entrada, bloqueios);
|
|
298
|
+
return {
|
|
299
|
+
valida: bloqueios.length === 0,
|
|
300
|
+
definitionDigest,
|
|
301
|
+
capabilitiesRequeridas: capabilitiesEstruturais(entrada),
|
|
302
|
+
bloqueios: [...bloqueios].sort(),
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=validator.js.map
|
package/dist/sync/index.js
CHANGED
|
@@ -46,25 +46,25 @@ export async function gerarSchemaPrisma(pastaContratos, saidaSchema, datasourceP
|
|
|
46
46
|
for (const contrato of contratos) {
|
|
47
47
|
const nomeModel = path.basename(contrato, '.sema').replace(/\./g, '_');
|
|
48
48
|
// Schema simplificado - em producao, fazer parsing real do contrato
|
|
49
|
-
models += `\nmodel ${nomeModel.charAt(0).toUpperCase() + nomeModel.slice(1)} {
|
|
50
|
-
id String @id @default(uuid())
|
|
51
|
-
criadoEm DateTime @default(now())
|
|
52
|
-
// Gerado a partir de: ${contrato}
|
|
53
|
-
// TODO: Adicionar campos do contrato Sema
|
|
49
|
+
models += `\nmodel ${nomeModel.charAt(0).toUpperCase() + nomeModel.slice(1)} {
|
|
50
|
+
id String @id @default(uuid())
|
|
51
|
+
criadoEm DateTime @default(now())
|
|
52
|
+
// Gerado a partir de: ${contrato}
|
|
53
|
+
// TODO: Adicionar campos do contrato Sema
|
|
54
54
|
}\n`;
|
|
55
55
|
modelCount++;
|
|
56
56
|
}
|
|
57
|
-
const schema = `// Gerado automaticamente pelo Sema
|
|
58
|
-
// Fonte: ${pastaContratos}
|
|
59
|
-
|
|
60
|
-
generator client {
|
|
61
|
-
provider = "prisma-client-js"
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
datasource db {
|
|
65
|
-
provider = "${datasourceProvider}"
|
|
66
|
-
url = env("SEMA_PRISMA_URL")
|
|
67
|
-
}
|
|
57
|
+
const schema = `// Gerado automaticamente pelo Sema
|
|
58
|
+
// Fonte: ${pastaContratos}
|
|
59
|
+
|
|
60
|
+
generator client {
|
|
61
|
+
provider = "prisma-client-js"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
datasource db {
|
|
65
|
+
provider = "${datasourceProvider}"
|
|
66
|
+
url = env("SEMA_PRISMA_URL")
|
|
67
|
+
}
|
|
68
68
|
${models}`;
|
|
69
69
|
// Salvar
|
|
70
70
|
fs.writeFileSync(saidaSchema, schema, 'utf-8');
|
|
@@ -90,25 +90,25 @@ export async function importarSchemaPrisma(caminhoSchema, pastaSaida, nomeModulo
|
|
|
90
90
|
const nomeContrato = `${nomeModel.toLowerCase()}.sema`;
|
|
91
91
|
const caminhoContrato = path.join(pastaSaida, nomeContrato);
|
|
92
92
|
// Gerar contrato basico
|
|
93
|
-
const conteudo = `module ${nomeModulo}.${nomeModel.toLowerCase()} {
|
|
94
|
-
entity ${nomeModel} {
|
|
95
|
-
fields {
|
|
96
|
-
id: Id
|
|
97
|
-
// TODO: Mapear campos do schema Prisma
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
task criar_${nomeModel.toLowerCase()} {
|
|
102
|
-
input {
|
|
103
|
-
// TODO: Definir inputs
|
|
104
|
-
}
|
|
105
|
-
output {
|
|
106
|
-
${nomeModel.toLowerCase()}: ${nomeModel}
|
|
107
|
-
}
|
|
108
|
-
effects {
|
|
109
|
-
persistencia ${nomeModel}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
93
|
+
const conteudo = `module ${nomeModulo}.${nomeModel.toLowerCase()} {
|
|
94
|
+
entity ${nomeModel} {
|
|
95
|
+
fields {
|
|
96
|
+
id: Id
|
|
97
|
+
// TODO: Mapear campos do schema Prisma
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
task criar_${nomeModel.toLowerCase()} {
|
|
102
|
+
input {
|
|
103
|
+
// TODO: Definir inputs
|
|
104
|
+
}
|
|
105
|
+
output {
|
|
106
|
+
${nomeModel.toLowerCase()}: ${nomeModel}
|
|
107
|
+
}
|
|
108
|
+
effects {
|
|
109
|
+
persistencia ${nomeModel}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
112
|
}`;
|
|
113
113
|
fs.writeFileSync(caminhoContrato, conteudo, 'utf-8');
|
|
114
114
|
contratos.push(caminhoContrato);
|