@semacode/cli 2.2.0 → 2.3.0
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/README.md +91 -4
- 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 +70 -19
- 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/exemplosOficiais.js +29 -8
- package/dist/iaPrompts.d.ts +1 -1
- package/dist/iaPrompts.js +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +23 -5
- package/dist/index.part01.d.ts +1 -1
- package/dist/index.part01.js +39 -4
- package/dist/index.part06.js +3 -0
- package/dist/initTemplatesBase.js +3 -2
- 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/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/docs/README.md +6 -0
- package/docs/ai-integration.md +7 -1
- package/docs/ai-workflow.md +5 -4
- package/docs/commands.md +43 -1
- package/docs/descoberta-capacidades.md +106 -0
- package/docs/documentation.md +11 -2
- package/docs/profiles.md +11 -2
- package/docs/sistemas-interativos.md +381 -0
- package/docs/testing.md +11 -2
- package/exemplos/profile_simulation.sema +211 -0
- 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/node_modules/@sema/gerador-lua/dist/index.js +31 -2
- package/node_modules/@sema/gerador-lua/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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/docs/README.md
CHANGED
|
@@ -17,6 +17,12 @@ Start here:
|
|
|
17
17
|
- [Commands](./commands.md)
|
|
18
18
|
- [Syntax](./syntax.md)
|
|
19
19
|
- [Profiles](./profiles.md)
|
|
20
|
+
- [Capability Discovery](./descoberta-capacidades.md) — one explainable catalog
|
|
21
|
+
for governance flows, profiles, specialized workflows, pipelines, generators,
|
|
22
|
+
capability tokens, and adapters.
|
|
23
|
+
- [AI-native Interactive Systems](./sistemas-interativos.md) — declarative
|
|
24
|
+
control plane for games, simulations, and hybrids across 3D, 2D, retro,
|
|
25
|
+
text, XR, and headless execution.
|
|
20
26
|
- [AI-native Content Pipeline](./pipeline-conteudo.md) — signed-policy,
|
|
21
27
|
multi-channel and multi-format orchestration for external AI runners, with
|
|
22
28
|
canonical ledger replay and no native human-review path.
|
package/docs/ai-integration.md
CHANGED
|
@@ -73,6 +73,12 @@ Generated or governed code should keep a short `SEMA-GOVERNED` marker that
|
|
|
73
73
|
points back to the applicable contract. The marker is not a substitute for
|
|
74
74
|
validation, drift, impact, or finalization gates.
|
|
75
75
|
|
|
76
|
+
Generated Lua tests preserve the contract's failure shape. A case whose only
|
|
77
|
+
expectation is `sucesso: falso` may terminate without an output, while a case
|
|
78
|
+
that also declares observable output fields must return a structured failure
|
|
79
|
+
result. The generator keeps these paths distinct instead of forcing every
|
|
80
|
+
failure into one representation.
|
|
81
|
+
|
|
76
82
|
Governed code above 1000 lines requires a
|
|
77
83
|
split plan. Governed code above 2000
|
|
78
84
|
lines blocks closure. Markdown documentation is not counted as governed code
|
|
@@ -106,4 +112,4 @@ user-facing experience, closure requires evidence:
|
|
|
106
112
|
## Platform Policy
|
|
107
113
|
|
|
108
114
|
Sema governs contract, scope, drift, evidence, and quality. It does not bypass
|
|
109
|
-
platform policies, terms of use, permissions, security controls, or laws.
|
|
115
|
+
platform policies, terms of use, permissions, security controls, or laws.
|
package/docs/ai-workflow.md
CHANGED
|
@@ -9,10 +9,11 @@ This is the minimum workflow for Codex in a local workspace.
|
|
|
9
9
|
4. Run `sema docs-impacto --intencao "<change>" --json`.
|
|
10
10
|
5. Read every required document returned by the command.
|
|
11
11
|
6. Read `docs/commands.md` before selecting a command or interpreting `--saida`.
|
|
12
|
-
7.
|
|
13
|
-
8.
|
|
14
|
-
9. Run `sema
|
|
15
|
-
10. Run `sema
|
|
12
|
+
7. If the right capability is unclear, run `sema descobrir recomendar --intencao "<goal>" --json`; do not auto-run ambiguous recommendations.
|
|
13
|
+
8. Use `exemplos/` and `docs/syntax.md` before creating or editing a contract.
|
|
14
|
+
9. Run `sema drift` and `sema impacto` before editing existing code.
|
|
15
|
+
10. Run `sema formatar` and `sema validar` after changing a `.sema` contract.
|
|
16
|
+
11. Run `sema finalizar-mudanca` with the documents read before closure.
|
|
16
17
|
|
|
17
18
|
Contract edit rule: `.sema` has its own size budget. Above 300 lines, plan a split by domain/capability; above 500, do not create or edit before splitting. Do not use parte_1/parte_2 and do not force a 1:1 contract-to-file relationship; several contracts can govern the same file through `vinculos`.
|
|
18
19
|
|
package/docs/commands.md
CHANGED
|
@@ -22,6 +22,10 @@ Then read every required doc returned by `docs-impacto`.
|
|
|
22
22
|
- `sema inspecionar <arquivo-ou-pasta> --json`: shows modules, tasks, routes, entities, links, and expected files.
|
|
23
23
|
- `sema ast <arquivo.sema> --json`: shows AST for syntax debugging.
|
|
24
24
|
- `sema ir <arquivo.sema> --json`: shows the IR used by gates and generators.
|
|
25
|
+
- `sema descobrir catalogo --json`: lists governance flows, profiles, specialized workflows, pipelines, generators, capability tokens, and adapters from their canonical registries.
|
|
26
|
+
- `sema descobrir recomendar --intencao "<goal>" --json`: ranks compatible capabilities deterministically without executing the selected command.
|
|
27
|
+
- `sema descobrir explicar <id> --json`: explains inputs, boundaries, reasons, and the command template for one capability.
|
|
28
|
+
- `sema pipeline listar|descrever <id> --json` and `sema capabilities --json`: compact projections of the same discovery catalog.
|
|
25
29
|
|
|
26
30
|
## Change and Closure
|
|
27
31
|
|
|
@@ -67,10 +71,48 @@ Ready UI rule: if the task generates an app, site, dashboard, form, or static HT
|
|
|
67
71
|
## Profiles and Author
|
|
68
72
|
|
|
69
73
|
- `sema author iniciar|validar|briefing|revisar-cliches|validar-narrativa|validar-proibicoes`: governs authorial writing.
|
|
70
|
-
- `sema profile validar <software|workflow|ops|game|legal|research|redacao|propostas|conversas> <arquivo> --json`: validates an artifact by profile.
|
|
74
|
+
- `sema profile validar <software|workflow|ops|game|simulation|legal|research|redacao|propostas|conversas> <arquivo> --json`: validates an artifact by profile.
|
|
71
75
|
- `sema profile capabilities --json`: lists profiles/capabilities.
|
|
72
76
|
- `sema rule-packs --profile <profile> --json`: lists rule packs.
|
|
73
77
|
|
|
78
|
+
`author` is a specialized `sema author` workflow, not a `profile validar` alias. Discovery exposes that distinction explicitly.
|
|
79
|
+
|
|
80
|
+
## AI-native Content Pipeline
|
|
81
|
+
|
|
82
|
+
- `sema conteudo capabilities --json`: lists generic producer, evaluator, and adapter capabilities without fixing a platform.
|
|
83
|
+
- `sema conteudo validar <definition.json> --json`: validates the content DAG, gates, and open adapters.
|
|
84
|
+
- `sema conteudo planejar <definition.json> --alvos-arquivo <targets.json> --json`: creates a declarative multi-target plan for an external runner.
|
|
85
|
+
- `sema conteudo validar-envelope --envelope-arquivo <envelope.json> --confianca-arquivo <trust.json> --trust-root-digest <sha256:...> --revocation-digest <sha256:...> --payload-type <type> --json`: verifies Ed25519 identity, authorization, freshness, scope, and the separately pinned trust root and current revocation overlay.
|
|
86
|
+
- `sema conteudo registrar <ledger.ndjson> --envelope-arquivo <envelope.json> --politica-arquivo <policy-envelope.json> --confianca-arquivo <trust.json> --trust-root-digest <sha256:...> --revocation-digest <sha256:...> --ledger-id <id> --expected-head <sha256:...> --json`: appends a verified envelope under the signed run policy to the local replay ledger at an externally retained head.
|
|
87
|
+
- `sema conteudo status <definition.json> --politica-arquivo <policy-envelope.json> --confianca-arquivo <trust.json> --trust-root-digest <sha256:...> --revocation-digest <sha256:...> --ledger-arquivo <ledger.ndjson> --expected-head <sha256:...> --json`: verifies the signed policy and its `targetSetDigest`, then derives verdicts, operational conditions, completion, and next actions from canonical events.
|
|
88
|
+
- `sema conteudo projetar <definition.json> --politica-arquivo <policy-envelope.json> --confianca-arquivo <trust.json> --trust-root-digest <sha256:...> --revocation-digest <sha256:...> --ledger-arquivo <ledger.ndjson> --expected-head <sha256:...> --saida <manifest.json> --json`: regenerates a non-authoritative manifest bound to the ledger head.
|
|
89
|
+
|
|
90
|
+
The content command is an AI-native, multi-channel, multi-format control plane. It never runs producers, evaluators, creative tools, or publication adapters; those belong to an external runner. It has no native human-review transition. A signed policy binds `runId`, definition, ledger, trust root, gates, complete target set, and the full `issuedAt`/`expiresAt` authorization window; no event may be recorded outside it. Stages select `adapterPolicy` as `NONE`, `CONSTRAINTS`, or `CONFIRMATION`; definition v1 accepts one output per stage. Constraint results must come from independent signed observations, including independently observed media type, not artifact metadata or executor claims. Target metadata is an exact scalar allowlist from `requiredMetadata + optionalMetadata`; `accountScope` is a credential-free `account:<alias>` reference, and artifact metadata is prohibited in v1. Deterministic evidence and AI opinions have separate quorum fields. Evidence requires an exact `content.evidence.attest:<evidenceType>` capability; adapter evidence requires `content.adapter.attest:<adapterId>@<version>:<evidenceType>` plus signed adapter binding.
|
|
91
|
+
|
|
92
|
+
Verdicts such as `APROVADO`, `REPROVADO`, and `INCONCLUSIVO` remain separate from operational conditions such as `AGUARDANDO_EVENTO_EXTERNO` and `FERRAMENTA_INDISPONIVEL`. A generated manifest is only a projection and cannot alter canonical state.
|
|
93
|
+
|
|
94
|
+
Local NDJSON plus a hash chain is portable evidence for replay, not a strong append-only trust boundary. Retain `expectedHead`, the canonical trust-root digest, and the current revocation digest externally, or use protected storage for high assurance. The trust-root pin identifies the authority snapshot independently from the revocation overlay. A workspace-local trust file additionally requires `--development-local-trust`; the flag does not disable digest pinning. Append freshness uses the platform clock rather than caller-provided `recordedAt`, and an authority in the current revocation overlay cannot sign an accepted policy.
|
|
95
|
+
|
|
96
|
+
## AI-native Interactive Systems
|
|
97
|
+
|
|
98
|
+
- `sema interativo capabilities --json`: lists the canonical interactive capability vocabulary.
|
|
99
|
+
- `sema interativo schema --json`: exposes the stable read-only definition schema, enum matrix, constraints, extension-command and data-schema shapes, plus canonical example paths for AI clients.
|
|
100
|
+
- `sema interativo pipelines --json`: lists reusable game, simulation, and hybrid pipelines.
|
|
101
|
+
- `sema interativo adapters [--spatial-model <NON_SPATIAL|TWO_D|TWO_POINT_FIVE_D|THREE_D>] [--render-mode <HEADLESS|TEXT|VISUAL|XR>] --json`: lists compatible external adapter descriptors.
|
|
102
|
+
- `sema interativo validar <definition.json> --json`: validates independent kind, spatial model, render mode, visual profile, fidelity, control, time, world, budget, pipeline, and acceptance axes.
|
|
103
|
+
- `sema interativo planejar <definition.json> --json`: expands compatible stages and required evidence without running an engine.
|
|
104
|
+
- `sema interativo validar-evidencias|status <definition.json> [--plano-arquivo <plan.json>] --bundle-arquivo <bundle.json> --json`: validates a portable evidence bundle or derives non-authoritative status; `--evidencias-arquivo` is an alias and an omitted plan is recomputed deterministically.
|
|
105
|
+
- `sema interativo validar-protocolo <adapter-run.json> --json`: checks DETECT/PROBE/SNAPSHOT/PLAN/APPLY/VALIDATE/EVIDENCE/ROLLBACK ordering and stable target binding.
|
|
106
|
+
- Experience IR: `validar-ir`, `indexar-ir`, `consultar-ir --semantic-id <id>`, `chunk-ir --semantic-id <id> [--raso]`, and `descrever-ir`.
|
|
107
|
+
- Operational state: `validar-engine-snapshot`, `diff-engine-snapshots`, `validar-asset-provenance`, `validar-editor-state`, `planejar-jobs`, `validar-acceptance`, `operar-acceptance --operation <VALIDATE|EVALUATE|INVALIDATE> --context-file <file>`, and `validar-multimodal`.
|
|
108
|
+
- Temporal, autonomy, and testing: `validar-temporal`, `validar-evidencia-temporal --bundle-arquivo <file>`, `validar-autonomia`, `validar-playtest-fuzz`, and `validar-multiplayer`.
|
|
109
|
+
- Portability and workers: `analisar-portabilidade` and `validar-workers`.
|
|
110
|
+
- `sema interativo validar-control-run <control-run.json> --definition-arquivo <definition.json> --plano-arquivo <plan.json> --contrato-arquivo <validation-contract.json> --entrada-arquivo <input.json> [--entrada-auxiliar-arquivo <supporting-input.json>] --evidencia-arquivo <evidence.json> --resultado-arquivo <result.json> --json`: binds one advanced validation to its complete local digest chain instead of trusting a standalone result.
|
|
111
|
+
|
|
112
|
+
The control-run command recomputes the canonical plan and selected pure validator, then verifies the definition, pipeline descriptor, validation contract, schema-declared inputs, evidence, and result digests. Prefix advanced items with `sema interativo` and pass the documented JSON file as the positional argument; an agent does not have to infer the validator or payload shape from a filename or visual style. The machine-readable schema publishes command maps, input/output schema links, required top-level fields, `outputTargets` path segments from the payload root, at least one real output shape per command, and official fixtures for all 20 advanced commands. Validation-result shapes describe `payload.resultado`; projected IR values use `indice`, `entry`, `chunk`, or `descriptor`; operation projections such as `engineDiff` and `jobOrchestrationPlan` live under `payload.resultado.value`; the job plan's ordered `queue` is the assignment list and exposes kind, priority, adapter, dependencies, locks, budgets, heartbeat, checkpoint, and recovery data.
|
|
113
|
+
|
|
114
|
+
Spatial model and render mode are orthogonal: `THREE_D + HEADLESS` is valid, while XR requires `THREE_D`. `PIXEL_8_BIT` and `PIXEL_16_BIT` are independent visual profiles available to games and simulations. Every command above rejects unknown, duplicate, missing-value, or invalid-enum arguments, remains local, read-only, and non-authoritative, and leaves engine/editor execution, authorization, mutation, rollback, migration, rendering, playtest, and worker scheduling to external runners. Full local coverage is `STRUCTURALLY_COMPLETE`, never authoritative completion, and a local evidence bundle is never presented as authoritative trust.
|
|
115
|
+
|
|
74
116
|
## Operational
|
|
75
117
|
|
|
76
118
|
- `sema doctor`: diagnoses local installation.
|