@semacode/cli 2.1.0 → 2.2.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 +16 -0
- package/dist/comandos.js +2 -0
- package/dist/execucoesExternas.js +19 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.part01.d.ts +1 -1
- package/dist/index.part01.js +10 -1
- package/dist/pipelineConteudo/adapters.d.ts +84 -0
- package/dist/pipelineConteudo/adapters.js +449 -0
- package/dist/pipelineConteudo/canonical.d.ts +18 -0
- package/dist/pipelineConteudo/canonical.js +107 -0
- package/dist/pipelineConteudo/command.d.ts +3 -0
- package/dist/pipelineConteudo/command.js +572 -0
- package/dist/pipelineConteudo/index.d.ts +9 -0
- package/dist/pipelineConteudo/index.js +12 -0
- package/dist/pipelineConteudo/ledger.d.ts +68 -0
- package/dist/pipelineConteudo/ledger.js +732 -0
- package/dist/pipelineConteudo/planner.d.ts +12 -0
- package/dist/pipelineConteudo/planner.js +366 -0
- package/dist/pipelineConteudo/projection.d.ts +16 -0
- package/dist/pipelineConteudo/projection.js +57 -0
- package/dist/pipelineConteudo/state.d.ts +23 -0
- package/dist/pipelineConteudo/state.js +615 -0
- package/dist/pipelineConteudo/trust.d.ts +17 -0
- package/dist/pipelineConteudo/trust.js +750 -0
- package/dist/pipelineConteudo/types.d.ts +331 -0
- package/dist/pipelineConteudo/types.js +4 -0
- package/docs/README.md +3 -0
- package/docs/pipeline-conteudo.md +246 -0
- package/docs/testing.md +1 -1
- package/exemplos/pipeline-conteudo/README.md +44 -0
- package/exemplos/pipeline-conteudo/alvos.json +23 -0
- package/exemplos/pipeline-conteudo/definicao.json +136 -0
- package/node_modules/@sema/gerador-lua/dist/index.js +48 -3
- package/node_modules/@sema/gerador-lua/dist/index.js.map +1 -1
- package/node_modules/@sema/gerador-php/dist/index.js +8 -0
- package/node_modules/@sema/gerador-php/dist/index.js.map +1 -1
- package/package.json +8 -1
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
export type JsonPrimitivo = string | number | boolean | null;
|
|
2
|
+
export type JsonValor = JsonPrimitivo | JsonObjeto | readonly JsonValor[];
|
|
3
|
+
export interface JsonObjeto {
|
|
4
|
+
readonly [chave: string]: JsonValor;
|
|
5
|
+
}
|
|
6
|
+
export interface MetadataPublicaConteudo {
|
|
7
|
+
readonly [chave: string]: JsonPrimitivo;
|
|
8
|
+
}
|
|
9
|
+
export type VereditoConteudo = "NAO_AVALIADO" | "APROVADO" | "REPROVADO" | "INCONCLUSIVO";
|
|
10
|
+
export type EstadoEvidenciaConteudo = "DECLARADA" | "ACEITA" | "REJEITADA" | "EXPIRADA" | "REVOGADA" | "SUPERADA";
|
|
11
|
+
export type ModoAvaliacaoConteudo = "DETERMINISTICA" | "IA_ESPECIALIZADA" | "HIBRIDA";
|
|
12
|
+
export type CondicaoOperacionalConteudo = "PENDENTE" | "PRONTA" | "EXECUTANDO" | "AGUARDANDO_EVIDENCIA" | "AGUARDANDO_EVENTO_EXTERNO" | "FERRAMENTA_INDISPONIVEL" | "CAPACIDADE_AUSENTE" | "AUTORIZACAO_AUSENTE" | "FALHA_TRANSITORIA" | "FALHA_TERMINAL" | "EXECUCAO_ENCERRADA";
|
|
13
|
+
export type EscopoEtapaConteudo = "GLOBAL" | "POR_ALVO";
|
|
14
|
+
export type ResultadoAvaliacaoConteudo = "APROVADO" | "REPROVADO" | "INCONCLUSIVO";
|
|
15
|
+
export interface PrincipalConteudo {
|
|
16
|
+
readonly principalId: string;
|
|
17
|
+
readonly keyId: string;
|
|
18
|
+
readonly controlDomain: string;
|
|
19
|
+
readonly papeis: readonly string[];
|
|
20
|
+
readonly capabilities: readonly string[];
|
|
21
|
+
readonly scopes: readonly string[];
|
|
22
|
+
readonly publicKeyPem: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Raiz publica de confianca. Chaves privadas nunca pertencem a esta configuracao
|
|
26
|
+
* nem ao workspace canonico do pipeline.
|
|
27
|
+
*/
|
|
28
|
+
export interface ConfiguracaoConfiancaConteudo {
|
|
29
|
+
readonly trustDomainId: string;
|
|
30
|
+
readonly principals: readonly PrincipalConteudo[];
|
|
31
|
+
readonly revokedKeyIds: readonly string[];
|
|
32
|
+
readonly maxEnvelopeAgeMs?: number;
|
|
33
|
+
readonly maxFutureSkewMs?: number;
|
|
34
|
+
readonly schemaVersionsAceitas?: readonly string[];
|
|
35
|
+
}
|
|
36
|
+
export interface ResultadoValidacaoConfiguracaoConfiancaConteudo {
|
|
37
|
+
readonly valida: boolean;
|
|
38
|
+
readonly trustRootDigest: string;
|
|
39
|
+
readonly revocationDigest: string;
|
|
40
|
+
readonly fingerprints: readonly string[];
|
|
41
|
+
readonly bloqueios: readonly string[];
|
|
42
|
+
}
|
|
43
|
+
export interface EnvelopeAssinavelConteudo<TPayload = JsonValor> {
|
|
44
|
+
readonly schemaVersion: string;
|
|
45
|
+
readonly payloadType: string;
|
|
46
|
+
readonly payload: TPayload;
|
|
47
|
+
readonly principalId: string;
|
|
48
|
+
readonly keyId: string;
|
|
49
|
+
readonly issuedAt: string;
|
|
50
|
+
readonly nonce: string;
|
|
51
|
+
readonly signatureAlgorithm: "Ed25519";
|
|
52
|
+
}
|
|
53
|
+
export interface EnvelopeAssinadoConteudo<TPayload = JsonValor> extends EnvelopeAssinavelConteudo<TPayload> {
|
|
54
|
+
/** Assinatura Ed25519 em base64 do JSON canonico de EnvelopeAssinavelConteudo. */
|
|
55
|
+
readonly signature: string;
|
|
56
|
+
}
|
|
57
|
+
export interface OpcoesVerificacaoEnvelopeConteudo {
|
|
58
|
+
/** Pins fornecidos por uma fronteira externa; nunca podem ser derivados da configuracao recebida. */
|
|
59
|
+
readonly trustRootDigestEsperado: string;
|
|
60
|
+
readonly revocationDigestEsperado: string;
|
|
61
|
+
readonly payloadTypeEsperado: string;
|
|
62
|
+
readonly capabilityRequerida?: string;
|
|
63
|
+
readonly scopeRequerido?: string;
|
|
64
|
+
readonly papelRequerido?: string;
|
|
65
|
+
readonly papeisPermitidos?: readonly string[];
|
|
66
|
+
readonly agora?: string | Date | number;
|
|
67
|
+
readonly maxEnvelopeAgeMs?: number;
|
|
68
|
+
readonly maxFutureSkewMs?: number;
|
|
69
|
+
/** Nonces ja observados. A verificacao e pura e nao altera este conjunto. */
|
|
70
|
+
readonly noncesUsados?: ReadonlySet<string>;
|
|
71
|
+
}
|
|
72
|
+
export interface EnvelopeVerificadoConteudo<TPayload = JsonValor> {
|
|
73
|
+
readonly estado: "ACEITA";
|
|
74
|
+
readonly digest: string;
|
|
75
|
+
readonly principal: PrincipalConteudo;
|
|
76
|
+
readonly envelope: EnvelopeAssinadoConteudo<TPayload>;
|
|
77
|
+
readonly payload: TPayload;
|
|
78
|
+
}
|
|
79
|
+
export interface ResultadoVerificacaoEnvelopeConteudo<TPayload = JsonValor> {
|
|
80
|
+
readonly valido: boolean;
|
|
81
|
+
readonly digest: string;
|
|
82
|
+
readonly principal?: PrincipalConteudo;
|
|
83
|
+
readonly envelopeVerificado?: EnvelopeVerificadoConteudo<TPayload>;
|
|
84
|
+
readonly bloqueios: readonly string[];
|
|
85
|
+
}
|
|
86
|
+
/** Contexto anti-replay que faz parte do payload assinado de todo evento. */
|
|
87
|
+
export interface ContextoAssinadoEventoConteudo {
|
|
88
|
+
readonly runId: string;
|
|
89
|
+
readonly trustDomainId: string;
|
|
90
|
+
readonly trustRootDigest: string;
|
|
91
|
+
readonly ledgerId: string;
|
|
92
|
+
readonly policyDigest: string;
|
|
93
|
+
readonly definitionDigest: string;
|
|
94
|
+
}
|
|
95
|
+
/** Eventos ligados a um alvo/conta carregam tambem o escopo derivado pelo planner. */
|
|
96
|
+
export interface ContextoAutorizadoEventoConteudo extends ContextoAssinadoEventoConteudo {
|
|
97
|
+
readonly authorizationScope: string;
|
|
98
|
+
}
|
|
99
|
+
/** Declaracao do runner/produtor. So vira evidencia depois de um atestado confiavel. */
|
|
100
|
+
export interface AlegacaoEvidenciaConteudo extends ContextoAutorizadoEventoConteudo {
|
|
101
|
+
readonly kind: "EVIDENCE_CLAIMED";
|
|
102
|
+
readonly claimId: string;
|
|
103
|
+
readonly stageId: string;
|
|
104
|
+
readonly targetId?: string;
|
|
105
|
+
readonly artifactDigest: string;
|
|
106
|
+
readonly evidenceType: string;
|
|
107
|
+
readonly producerId: string;
|
|
108
|
+
readonly claimedAt: string;
|
|
109
|
+
readonly data?: JsonObjeto;
|
|
110
|
+
}
|
|
111
|
+
/** Observacao assinada por um verificador/adapter autorizado, nunca pelo recibo em si. */
|
|
112
|
+
export interface AtestadoEvidenciaConteudo extends ContextoAutorizadoEventoConteudo {
|
|
113
|
+
readonly kind: "EVIDENCE_ATTESTED";
|
|
114
|
+
readonly evidenceId: string;
|
|
115
|
+
readonly claimId?: string;
|
|
116
|
+
readonly gateId: string;
|
|
117
|
+
readonly stageId: string;
|
|
118
|
+
readonly targetId?: string;
|
|
119
|
+
readonly artifactDigest: string;
|
|
120
|
+
readonly evidenceType: string;
|
|
121
|
+
readonly producerId: string;
|
|
122
|
+
readonly attesterId: string;
|
|
123
|
+
readonly result: ResultadoAvaliacaoConteudo;
|
|
124
|
+
readonly observedAt: string;
|
|
125
|
+
readonly data?: JsonObjeto;
|
|
126
|
+
}
|
|
127
|
+
export interface ParecerIAConteudo extends ContextoAutorizadoEventoConteudo {
|
|
128
|
+
readonly kind: "AI_ASSESSMENT";
|
|
129
|
+
readonly assessmentId: string;
|
|
130
|
+
readonly gateId: string;
|
|
131
|
+
readonly targetId?: string;
|
|
132
|
+
readonly artifactDigest: string;
|
|
133
|
+
readonly rubricDigest: string;
|
|
134
|
+
readonly evaluatorId: string;
|
|
135
|
+
/** Capability especializada concreta exercida neste parecer. */
|
|
136
|
+
readonly capability: string;
|
|
137
|
+
readonly result: ResultadoAvaliacaoConteudo;
|
|
138
|
+
readonly assessedAt: string;
|
|
139
|
+
readonly rationaleDigest?: string;
|
|
140
|
+
readonly data?: JsonObjeto;
|
|
141
|
+
}
|
|
142
|
+
export interface PoliticaGateConteudo {
|
|
143
|
+
readonly gateId: string;
|
|
144
|
+
readonly stageId: string;
|
|
145
|
+
readonly scope: EscopoEtapaConteudo;
|
|
146
|
+
readonly evaluationMode: ModoAvaliacaoConteudo;
|
|
147
|
+
readonly requiredEvidence: readonly string[];
|
|
148
|
+
readonly evaluatorCapabilities: readonly string[];
|
|
149
|
+
/** Quorum independente exigido para cada tipo de evidencia deterministica. */
|
|
150
|
+
readonly minAttestationsPerEvidence: number;
|
|
151
|
+
readonly minDistinctAttesterControlDomains: number;
|
|
152
|
+
readonly minApprovals: number;
|
|
153
|
+
readonly minDistinctControlDomains: number;
|
|
154
|
+
readonly producerDisjoint: boolean;
|
|
155
|
+
readonly rejectionIsBinding: boolean;
|
|
156
|
+
readonly rubricDigest: string;
|
|
157
|
+
}
|
|
158
|
+
export interface PoliticaConfiancaConteudo {
|
|
159
|
+
readonly policyId: string;
|
|
160
|
+
readonly version: string;
|
|
161
|
+
readonly runId: string;
|
|
162
|
+
readonly trustDomainId: string;
|
|
163
|
+
readonly trustRootDigest: string;
|
|
164
|
+
readonly definitionDigest: string;
|
|
165
|
+
readonly targetSetDigest: string;
|
|
166
|
+
readonly ledgerId: string;
|
|
167
|
+
readonly gates: readonly PoliticaGateConteudo[];
|
|
168
|
+
readonly issuedAt: string;
|
|
169
|
+
readonly expiresAt: string;
|
|
170
|
+
}
|
|
171
|
+
export interface EntradaAvaliacaoGateConteudo {
|
|
172
|
+
/** Politica assinada que vincula o gate base; requisitos adicionais so podem endurece-lo. */
|
|
173
|
+
readonly envelopePolitica: EnvelopeAssinadoConteudo<PoliticaConfiancaConteudo>;
|
|
174
|
+
readonly gate: PoliticaGateConteudo;
|
|
175
|
+
readonly requiredEvidenceAdicional?: readonly string[];
|
|
176
|
+
/** Requisitos adicionais derivados do adapter; so endurecem a policy assinada. */
|
|
177
|
+
readonly attesterCapabilitiesAdicionais?: Readonly<Record<string, string>>;
|
|
178
|
+
readonly artifactDigest: string;
|
|
179
|
+
readonly targetId?: string;
|
|
180
|
+
readonly runId: string;
|
|
181
|
+
readonly trustDomainId: string;
|
|
182
|
+
readonly trustRootDigest: string;
|
|
183
|
+
readonly revocationDigestEsperado: string;
|
|
184
|
+
readonly ledgerId: string;
|
|
185
|
+
readonly policyDigest: string;
|
|
186
|
+
readonly definitionDigest: string;
|
|
187
|
+
readonly authorizationScope: string;
|
|
188
|
+
readonly producerId: string;
|
|
189
|
+
readonly producerLineageIds: readonly string[];
|
|
190
|
+
readonly evidenciasAceitas: readonly EnvelopeVerificadoConteudo<AtestadoEvidenciaConteudo>[];
|
|
191
|
+
readonly pareceresIa: readonly EnvelopeVerificadoConteudo<ParecerIAConteudo>[];
|
|
192
|
+
readonly configuracaoConfianca: ConfiguracaoConfiancaConteudo;
|
|
193
|
+
}
|
|
194
|
+
export interface ResultadoAvaliacaoGateConteudo {
|
|
195
|
+
readonly veredito: VereditoConteudo;
|
|
196
|
+
readonly aprovacoesValidas: number;
|
|
197
|
+
readonly controlDomainsDistintos: number;
|
|
198
|
+
readonly evidenceIds: readonly string[];
|
|
199
|
+
readonly assessmentIds: readonly string[];
|
|
200
|
+
readonly bloqueios: readonly string[];
|
|
201
|
+
}
|
|
202
|
+
export interface RestricaoDeterministicaConteudo {
|
|
203
|
+
readonly constraintId: string;
|
|
204
|
+
readonly kind: string;
|
|
205
|
+
readonly config?: JsonObjeto;
|
|
206
|
+
}
|
|
207
|
+
export interface AdaptadorConteudo {
|
|
208
|
+
readonly adapterId: string;
|
|
209
|
+
readonly version: string;
|
|
210
|
+
readonly capabilities: readonly string[];
|
|
211
|
+
readonly acceptedMediaTypes: readonly string[];
|
|
212
|
+
readonly formatProfiles: readonly string[];
|
|
213
|
+
readonly deterministicConstraints: readonly RestricaoDeterministicaConteudo[];
|
|
214
|
+
readonly requiredMetadata: readonly string[];
|
|
215
|
+
readonly optionalMetadata: readonly string[];
|
|
216
|
+
readonly confirmationPredicates: readonly string[];
|
|
217
|
+
}
|
|
218
|
+
export interface AlvoConteudo {
|
|
219
|
+
readonly targetId: string;
|
|
220
|
+
readonly adapterId: string;
|
|
221
|
+
readonly accountScope: string;
|
|
222
|
+
readonly formatProfileId: string;
|
|
223
|
+
readonly locale: string;
|
|
224
|
+
readonly metadata: MetadataPublicaConteudo;
|
|
225
|
+
}
|
|
226
|
+
export interface EtapaPipelineConteudo {
|
|
227
|
+
readonly stageId: string;
|
|
228
|
+
readonly capability: string;
|
|
229
|
+
readonly scope: EscopoEtapaConteudo;
|
|
230
|
+
readonly adapterPolicy: "NONE" | "CONSTRAINTS" | "CONFIRMATION";
|
|
231
|
+
readonly dependsOn: readonly string[];
|
|
232
|
+
readonly produces: readonly string[];
|
|
233
|
+
readonly gateIds: readonly string[];
|
|
234
|
+
}
|
|
235
|
+
export interface DefinicaoPipelineConteudo {
|
|
236
|
+
readonly schemaVersion: string;
|
|
237
|
+
readonly pipelineId: string;
|
|
238
|
+
readonly version: string;
|
|
239
|
+
readonly stages: readonly EtapaPipelineConteudo[];
|
|
240
|
+
readonly gates: readonly PoliticaGateConteudo[];
|
|
241
|
+
readonly adapters: readonly AdaptadorConteudo[];
|
|
242
|
+
readonly requiredCompletionGates: readonly string[];
|
|
243
|
+
}
|
|
244
|
+
export interface InstanciaEtapaConteudo {
|
|
245
|
+
readonly stageInstanceId: string;
|
|
246
|
+
readonly stageId: string;
|
|
247
|
+
readonly targetId?: string;
|
|
248
|
+
readonly capability: string;
|
|
249
|
+
readonly dependsOn: readonly string[];
|
|
250
|
+
readonly produces: readonly string[];
|
|
251
|
+
readonly gateIds: readonly string[];
|
|
252
|
+
}
|
|
253
|
+
export interface SlotArtefatoConteudo {
|
|
254
|
+
readonly slotId: string;
|
|
255
|
+
readonly stageInstanceId: string;
|
|
256
|
+
readonly artifactType: string;
|
|
257
|
+
readonly targetId?: string;
|
|
258
|
+
}
|
|
259
|
+
export interface InstanciaGateConteudo {
|
|
260
|
+
readonly gateInstanceId: string;
|
|
261
|
+
readonly gateId: string;
|
|
262
|
+
readonly stageInstanceId: string;
|
|
263
|
+
readonly targetId?: string;
|
|
264
|
+
}
|
|
265
|
+
export interface PlanoPipelineConteudo {
|
|
266
|
+
readonly pipelineId: string;
|
|
267
|
+
readonly definitionDigest: string;
|
|
268
|
+
readonly targetIds: readonly string[];
|
|
269
|
+
readonly stageInstances: readonly InstanciaEtapaConteudo[];
|
|
270
|
+
readonly artifactSlots: readonly SlotArtefatoConteudo[];
|
|
271
|
+
readonly gateInstances: readonly InstanciaGateConteudo[];
|
|
272
|
+
readonly nextActions: readonly string[];
|
|
273
|
+
}
|
|
274
|
+
export interface ArtefatoConteudo extends ContextoAutorizadoEventoConteudo {
|
|
275
|
+
readonly kind: "ARTIFACT_REGISTERED";
|
|
276
|
+
readonly artifactId: string;
|
|
277
|
+
readonly stageId: string;
|
|
278
|
+
readonly targetId?: string;
|
|
279
|
+
readonly producerId: string;
|
|
280
|
+
readonly producerLineageIds: readonly string[];
|
|
281
|
+
readonly version: string;
|
|
282
|
+
readonly artifactType: string;
|
|
283
|
+
readonly mediaType: string;
|
|
284
|
+
readonly digest: string;
|
|
285
|
+
readonly lineageDigests: readonly string[];
|
|
286
|
+
}
|
|
287
|
+
export interface InicioExecucaoConteudo extends ContextoAssinadoEventoConteudo {
|
|
288
|
+
readonly kind: "RUN_STARTED";
|
|
289
|
+
readonly targets: readonly AlvoConteudo[];
|
|
290
|
+
readonly startedAt: string;
|
|
291
|
+
}
|
|
292
|
+
export interface CondicaoOperacionalReportadaConteudo extends ContextoAutorizadoEventoConteudo {
|
|
293
|
+
readonly kind: "OPERATIONAL_CONDITION";
|
|
294
|
+
readonly gateId: string;
|
|
295
|
+
readonly targetId?: string;
|
|
296
|
+
readonly condition: CondicaoOperacionalConteudo;
|
|
297
|
+
readonly reason: string;
|
|
298
|
+
readonly reportedAt: string;
|
|
299
|
+
}
|
|
300
|
+
export type EventoPayloadConteudo = InicioExecucaoConteudo | CondicaoOperacionalReportadaConteudo | ArtefatoConteudo | AlegacaoEvidenciaConteudo | AtestadoEvidenciaConteudo | ParecerIAConteudo;
|
|
301
|
+
export interface EventoLedgerConteudo<TPayload = JsonValor> {
|
|
302
|
+
readonly schemaVersion: string;
|
|
303
|
+
readonly ledgerId: string;
|
|
304
|
+
readonly sequence: number;
|
|
305
|
+
readonly eventId: string;
|
|
306
|
+
readonly recordedAt: string;
|
|
307
|
+
readonly previousHash: string;
|
|
308
|
+
readonly envelope: EnvelopeAssinadoConteudo<TPayload>;
|
|
309
|
+
readonly hash: string;
|
|
310
|
+
}
|
|
311
|
+
export interface EstadoGateConteudo {
|
|
312
|
+
readonly gateId: string;
|
|
313
|
+
readonly targetId?: string;
|
|
314
|
+
readonly artifactDigest: string;
|
|
315
|
+
readonly veredito: VereditoConteudo;
|
|
316
|
+
readonly condition: CondicaoOperacionalConteudo;
|
|
317
|
+
readonly evidenceIds: readonly string[];
|
|
318
|
+
readonly assessmentIds: readonly string[];
|
|
319
|
+
readonly blockers: readonly string[];
|
|
320
|
+
}
|
|
321
|
+
export interface ProjecaoPipelineConteudo {
|
|
322
|
+
readonly authoritative: false;
|
|
323
|
+
readonly ledgerId: string;
|
|
324
|
+
readonly ledgerHead: string;
|
|
325
|
+
readonly runId: string;
|
|
326
|
+
readonly generatedAt: string;
|
|
327
|
+
readonly gates: readonly EstadoGateConteudo[];
|
|
328
|
+
readonly targets: readonly AlvoConteudo[];
|
|
329
|
+
readonly artifacts: readonly ArtefatoConteudo[];
|
|
330
|
+
readonly nextActions: readonly string[];
|
|
331
|
+
}
|
package/docs/README.md
CHANGED
|
@@ -17,6 +17,9 @@ Start here:
|
|
|
17
17
|
- [Commands](./commands.md)
|
|
18
18
|
- [Syntax](./syntax.md)
|
|
19
19
|
- [Profiles](./profiles.md)
|
|
20
|
+
- [AI-native Content Pipeline](./pipeline-conteudo.md) — signed-policy,
|
|
21
|
+
multi-channel and multi-format orchestration for external AI runners, with
|
|
22
|
+
canonical ledger replay and no native human-review path.
|
|
20
23
|
- [Documentation Governance](./documentation.md)
|
|
21
24
|
- [Repository Boundary](./repositories.md)
|
|
22
25
|
- [Security](./security.md)
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# AI-native Content Pipeline
|
|
2
|
+
|
|
3
|
+
Sema Content Pipeline is a contract-first control plane for creating content
|
|
4
|
+
with AI agents across arbitrary destinations and formats. It plans work,
|
|
5
|
+
verifies signed evidence, evaluates policy, derives canonical state, and tells
|
|
6
|
+
an external runner what can happen next. It does not execute agents, call
|
|
7
|
+
creative tools, publish content, or provide a native human-review path.
|
|
8
|
+
|
|
9
|
+
Brands, channels, accounts, and formats are configuration. They are never
|
|
10
|
+
closed enums in the pipeline core. A video channel, a site, a newsletter, an
|
|
11
|
+
RSS feed, or a future destination all use the same target and adapter model.
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
.sema contracts, target set, and signed policy
|
|
17
|
+
-> Sema creates a declarative plan
|
|
18
|
+
-> external runner invokes producer agents and tools
|
|
19
|
+
-> producers submit signed claims and immutable artifacts
|
|
20
|
+
-> independent adapters/verifiers attest observable facts
|
|
21
|
+
-> specialized AI evaluators submit signed semantic assessments
|
|
22
|
+
-> Sema verifies identity, scope, independence, quorum, and deterministic rules
|
|
23
|
+
-> state is replayed from the canonical ledger
|
|
24
|
+
-> the external runner receives nextActions
|
|
25
|
+
-> manifests and dashboards are regenerated projections
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Existing Author, research, writing, copy, image, video, creative-QA, and
|
|
29
|
+
publication profiles are optional capabilities used by a pipeline definition.
|
|
30
|
+
They are not the pipeline state machine and they do not become universal
|
|
31
|
+
requirements for every kind of content.
|
|
32
|
+
|
|
33
|
+
## Trust boundary
|
|
34
|
+
|
|
35
|
+
A hash proves the identity and integrity of bytes. It does not prove that a
|
|
36
|
+
claim is true. A JSON receipt produced by the runner therefore remains a claim.
|
|
37
|
+
It becomes accepted evidence only when an authorized, independent principal
|
|
38
|
+
attests it with an Ed25519 signature and the attestation matches the exact run,
|
|
39
|
+
artifact digest, target, evidence type, policy, and validity window.
|
|
40
|
+
|
|
41
|
+
The trust configuration accepts only Ed25519 SPKI public material
|
|
42
|
+
(`-----BEGIN PUBLIC KEY-----`). PKCS#8 private PEM is rejected even though the
|
|
43
|
+
crypto runtime could derive a public key from it. Private keys must stay in the
|
|
44
|
+
producer, evaluator, adapter, or independent verification service that owns
|
|
45
|
+
them. If the executor controls every private key and the canonical store, the
|
|
46
|
+
signatures provide no meaningful separation.
|
|
47
|
+
|
|
48
|
+
For high assurance, keep trust anchors outside the runner workspace and store
|
|
49
|
+
the ledger in an independently controlled append-only service, WORM store, or
|
|
50
|
+
transparency log. Every trusted operation requires a canonical trust-root digest
|
|
51
|
+
retained by that external boundary; reading `trust.json` and trusting a digest
|
|
52
|
+
from the same file would merely let the executor nominate its own authority.
|
|
53
|
+
|
|
54
|
+
The signed policy is bound to the exact execution, pipeline definition, trust
|
|
55
|
+
root, ledger, and complete target set through `runId`, `definitionDigest`,
|
|
56
|
+
`trustRootDigest`, `ledgerId`, and `targetSetDigest`. Its `issuedAt` and
|
|
57
|
+
`expiresAt` define the complete authorization window: the trusted `recordedAt`
|
|
58
|
+
of `RUN_STARTED` must satisfy the configured maximum envelope age, and every
|
|
59
|
+
event must be recorded inclusively between those policy bounds. Once
|
|
60
|
+
`expiresAt` passes, the policy cannot authorize another append. It cannot be
|
|
61
|
+
replayed as authorization for another run, and a controller cannot silently
|
|
62
|
+
remove a channel to make a run appear complete.
|
|
63
|
+
|
|
64
|
+
The trust-root digest and revocation digest are separate external pins. The
|
|
65
|
+
trust root identifies the immutable authority set and its verification rules;
|
|
66
|
+
`revocationDigest` identifies the current revocation overlay. Rotating that
|
|
67
|
+
overlay must not redefine historical signatures, while revoked credentials no
|
|
68
|
+
longer count as active evidence, authorization, or quorum.
|
|
69
|
+
An authority key in the current revocation overlay cannot authorize a policy;
|
|
70
|
+
historical ledger verification remains a separate operation.
|
|
71
|
+
|
|
72
|
+
Public-key fingerprints, principal IDs, and key IDs must be unique, so one key
|
|
73
|
+
cannot masquerade as several independent voters.
|
|
74
|
+
|
|
75
|
+
The local file backend is useful for development and portable replay, but it is
|
|
76
|
+
not advertised as a strong append-only root. A trusted external checkpoint
|
|
77
|
+
(`expectedHead`) is required on ledger reads and writes to detect a truncated
|
|
78
|
+
or concurrently replaced local ledger. A trust file
|
|
79
|
+
inside the current workspace is rejected unless
|
|
80
|
+
`--development-local-trust` is explicit; that flag relaxes file placement only
|
|
81
|
+
and never removes digest pinning.
|
|
82
|
+
|
|
83
|
+
## Evidence and semantic evaluation
|
|
84
|
+
|
|
85
|
+
The pipeline separates three things:
|
|
86
|
+
|
|
87
|
+
- a producer or runner claim (`EVIDENCE_CLAIMED`);
|
|
88
|
+
- an independently signed observation (`EVIDENCE_ATTESTED`);
|
|
89
|
+
- a specialized AI assessment (`AI_ASSESSMENT`).
|
|
90
|
+
|
|
91
|
+
Sema evaluates deterministic constraints directly. Artifact metadata and
|
|
92
|
+
producer claims never prove those constraints by themselves: observable facts
|
|
93
|
+
must come from independently signed adapter/verifier observations bound to the
|
|
94
|
+
artifact digest, run, target, policy, and trust context. This includes
|
|
95
|
+
`observedMediaType`, obtained through independent sniffing; an artifact's
|
|
96
|
+
producer-declared `mediaType` cannot satisfy adapter acceptance on its own.
|
|
97
|
+
Semantic questions such as
|
|
98
|
+
factual quality, narrative quality, channel fit, brand voice, accessibility,
|
|
99
|
+
or audiovisual coherence require assessments from principals with the declared
|
|
100
|
+
capability. Sema verifies those assessments against policy; it does not invent
|
|
101
|
+
their semantic judgment.
|
|
102
|
+
|
|
103
|
+
Critical gates can require multiple approvals, distinct principals, distinct
|
|
104
|
+
control domains, and producer/evaluator separation. Deterministic attestations
|
|
105
|
+
use `minAttestationsPerEvidence` and
|
|
106
|
+
`minDistinctAttesterControlDomains` for every required evidence type; semantic
|
|
107
|
+
AI opinions use `minApprovals` and `minDistinctControlDomains`. Multiple agent
|
|
108
|
+
names under one credential or control domain do not create an independent
|
|
109
|
+
quorum.
|
|
110
|
+
Every gate that contributes to canonical completion must set
|
|
111
|
+
`producerDisjoint: true`; self-approval cannot be configured as a completion
|
|
112
|
+
shortcut.
|
|
113
|
+
|
|
114
|
+
A generic `content.evidence.attest` capability never authorizes evidence. Base
|
|
115
|
+
evidence requires `content.evidence.attest:<evidenceType>`. Adapter evidence is
|
|
116
|
+
stricter: the externally pinned trust root must grant
|
|
117
|
+
`content.adapter.attest:<adapterId>@<version>:<evidenceType>`, and the signed
|
|
118
|
+
data must name the exact adapter and version. Delivery confirmation also carries
|
|
119
|
+
an `observationDigest`; it is not a bare success receipt from the runner.
|
|
120
|
+
|
|
121
|
+
## Canonical state
|
|
122
|
+
|
|
123
|
+
Ledger events are hash-chained and carry signed envelopes. The state engine
|
|
124
|
+
replays the ledger deterministically. It never reads `concluido`, `approved`, or
|
|
125
|
+
similar fields from a hand-edited manifest.
|
|
126
|
+
|
|
127
|
+
Event and envelope wrappers are exact schemas: unsigned extra fields are
|
|
128
|
+
rejected. Every append requires the signed policy envelope and a complete
|
|
129
|
+
expected context derived from it. The genesis event is anchored to the
|
|
130
|
+
externally pinned trust domain, trust root, ledger ID, policy, definition, and
|
|
131
|
+
complete target set; none of those values are accepted merely because
|
|
132
|
+
`RUN_STARTED` declared them. During append, envelope freshness is measured
|
|
133
|
+
against the platform clock; caller-controlled `recordedAt` cannot backdate an
|
|
134
|
+
expired signature.
|
|
135
|
+
|
|
136
|
+
Gate verdicts are independent from operational conditions:
|
|
137
|
+
|
|
138
|
+
- verdict: `NAO_AVALIADO`, `APROVADO`, `REPROVADO`, `INCONCLUSIVO`;
|
|
139
|
+
- condition: `PENDENTE`, `PRONTA`, `EXECUTANDO`,
|
|
140
|
+
`AGUARDANDO_EVIDENCIA`, `AGUARDANDO_EVENTO_EXTERNO`,
|
|
141
|
+
`FERRAMENTA_INDISPONIVEL`, `CAPACIDADE_AUSENTE`,
|
|
142
|
+
`AUTORIZACAO_AUSENTE`, `FALHA_TRANSITORIA`, `FALHA_TERMINAL`, or
|
|
143
|
+
`EXECUCAO_ENCERRADA`.
|
|
144
|
+
|
|
145
|
+
For example, a content-quality gate may be `APROVADO` while a publication gate
|
|
146
|
+
is `NAO_AVALIADO` and its operational condition is
|
|
147
|
+
`AGUARDANDO_EVENTO_EXTERNO`. Tool unavailability never approves or rejects a
|
|
148
|
+
gate. Missing semantic capacity becomes `CAPACIDADE_AUSENTE`; the runner can
|
|
149
|
+
route the task to another authorized AI evaluator.
|
|
150
|
+
|
|
151
|
+
Changing an artifact creates a new digest. Evidence and assessments bound to
|
|
152
|
+
the previous digest become superseded for gate calculation. Targets also evolve
|
|
153
|
+
independently: failure for one destination does not invalidate another.
|
|
154
|
+
|
|
155
|
+
Every generated manifest declares:
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"authoritative": false,
|
|
160
|
+
"ledgerHead": "sha256:..."
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
It is a read model, not an input to canonical state.
|
|
165
|
+
|
|
166
|
+
The isolated gate calculator is internal. The public authoritative surface is
|
|
167
|
+
canonical state derivation after the ledger replay has independently derived
|
|
168
|
+
the producer, authorization scope, target, and complete producer lineage.
|
|
169
|
+
The npm package exposes only its root entrypoint; `dist/pipelineConteudo/*`
|
|
170
|
+
deep imports are blocked by the package `exports` map, including in the
|
|
171
|
+
generated public tarball.
|
|
172
|
+
|
|
173
|
+
## Open adapters and targets
|
|
174
|
+
|
|
175
|
+
An adapter declares an opaque `adapterId`, immutable version, accepted media
|
|
176
|
+
types, format profiles, deterministic constraints, required public metadata,
|
|
177
|
+
optional public metadata, and externally verifiable confirmation predicates.
|
|
178
|
+
`requiredMetadata + optionalMetadata` is the exact top-level allowlist signed
|
|
179
|
+
through the definition digest. Target metadata accepts only declared keys and
|
|
180
|
+
scalar public values. `accountScope` is a strict `account:<alias>` reference;
|
|
181
|
+
credentials and tokens remain outside the ledger and are resolved by the
|
|
182
|
+
external runner from that alias. Artifact metadata is prohibited in v1 until a
|
|
183
|
+
separate signed schema exists. Recursive DLP checks additionally reject common
|
|
184
|
+
secret key names, private-key material, JWTs, provider-token prefixes, and
|
|
185
|
+
authorization headers without echoing the detected value.
|
|
186
|
+
Deterministic-constraint configuration has an exact one-field numeric schema;
|
|
187
|
+
extra, ambiguous, or sensitive fields block the adapter before its constraints
|
|
188
|
+
can be copied into a public plan. Free-form operational `reason` text passes
|
|
189
|
+
the same credential detector before it can enter the signed ledger.
|
|
190
|
+
|
|
191
|
+
Public CLI failures expose static error codes and a sanitized command label;
|
|
192
|
+
filesystem exceptions, unknown subcommands, rejected schema field names, and
|
|
193
|
+
invalid trust identifiers are not echoed. Domain identifiers that belong to a
|
|
194
|
+
valid definition or signed ledger (such as stage, target, evidence, and
|
|
195
|
+
assessment IDs) remain public because they are required for planning,
|
|
196
|
+
traceability, and remediation; they are never credential storage.
|
|
197
|
+
|
|
198
|
+
Each stage declares an `adapterPolicy`:
|
|
199
|
+
|
|
200
|
+
- `NONE`: no adapter gate is introduced by the stage;
|
|
201
|
+
- `CONSTRAINTS`: require independently signed observations for the adapter's
|
|
202
|
+
deterministic format constraints;
|
|
203
|
+
- `CONFIRMATION`: require the target adapter's externally verifiable
|
|
204
|
+
confirmation predicates.
|
|
205
|
+
|
|
206
|
+
Pipeline definition v1 requires exactly one declared output per stage. A stage
|
|
207
|
+
that needs several artifacts must split them into semantically distinct stages,
|
|
208
|
+
preserving explicit lineage and dependency edges.
|
|
209
|
+
|
|
210
|
+
No platform literal is required by the core. A project-specific experience is
|
|
211
|
+
just a pipeline definition plus target configuration and can coexist with any
|
|
212
|
+
number of other channels and formats.
|
|
213
|
+
|
|
214
|
+
## CLI
|
|
215
|
+
|
|
216
|
+
The public surface is `sema conteudo`:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
sema conteudo capabilities --json
|
|
220
|
+
sema conteudo validar <definition.json> --json
|
|
221
|
+
sema conteudo planejar <definition.json> --alvos-arquivo <targets.json> --json
|
|
222
|
+
sema conteudo validar-envelope --envelope-arquivo <envelope.json> --confianca-arquivo <trust.json> --trust-root-digest <sha256:...> --revocation-digest <sha256:...> --payload-type <type> --json
|
|
223
|
+
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
|
|
224
|
+
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
|
|
225
|
+
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
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
`--trust-root-digest` and `--revocation-digest` may also come from the
|
|
229
|
+
externally controlled `SEMA_CONTENT_TRUST_ROOT_DIGEST` and
|
|
230
|
+
`SEMA_CONTENT_REVOCATION_DIGEST` environment variables. If a value is present
|
|
231
|
+
in both sources, the values must match. `registrar`, `status`, and `projetar` also require the
|
|
232
|
+
externally retained `expectedHead`, including the genesis head for a new
|
|
233
|
+
ledger. This protects against stale concurrent append and detects truncation;
|
|
234
|
+
it does not turn a runner-controlled file into protected storage.
|
|
235
|
+
|
|
236
|
+
## External runner protocol
|
|
237
|
+
|
|
238
|
+
The runner may schedule, execute, retry, resume, and request more AI capacity.
|
|
239
|
+
It may submit signed envelopes and report operational conditions. It may not
|
|
240
|
+
write calculated verdicts, mark an execution complete, edit canonical history,
|
|
241
|
+
or promote its own claim to accepted evidence.
|
|
242
|
+
|
|
243
|
+
The runner advances only from `nextActions` derived by Sema. There is no native
|
|
244
|
+
human-approval transition. Organizations may build an external policy adapter
|
|
245
|
+
for human input if they need one, but that is outside this AI-native pipeline
|
|
246
|
+
and never a hidden fallback.
|
package/docs/testing.md
CHANGED
|
@@ -26,7 +26,7 @@ encoding in every published document. The plugin smoke must validate the repo
|
|
|
26
26
|
marketplace, manifest version, installed skill copy, and absence of Sema MCP.
|
|
27
27
|
After push and npm publication, `npm run release:verificar-distribuicao` must
|
|
28
28
|
repeat that installation from the remote `gerlanss/Sema` marketplace and prove
|
|
29
|
-
that GitHub HEAD, the installed skill, and npm 2.
|
|
29
|
+
that GitHub HEAD, the installed skill, and npm 2.2.0 all describe the same
|
|
30
30
|
release.
|
|
31
31
|
|
|
32
32
|
Native generator evidence is mandatory when changing C#/.NET or C++ support.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Content pipeline example
|
|
2
|
+
|
|
3
|
+
This fixture proves that the pipeline core is independent from a platform,
|
|
4
|
+
brand, or media type. One definition creates a global editorial core and two
|
|
5
|
+
isolated target branches: a long-form document and a spoken audio episode.
|
|
6
|
+
The same AI-native plan can add any number of channels and formats without
|
|
7
|
+
making this experience the only delivery path.
|
|
8
|
+
|
|
9
|
+
Definition v1 declares exactly one output per stage. Each stage also selects an
|
|
10
|
+
`adapterPolicy`: `NONE`, `CONSTRAINTS`, or `CONFIRMATION`. Constraint gates are
|
|
11
|
+
satisfied only by independently signed observations bound to the produced
|
|
12
|
+
artifact, including an independently observed media type; producer metadata
|
|
13
|
+
is not evidence of its own correctness.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
sema conteudo validar exemplos/pipeline-conteudo/definicao.json --json
|
|
17
|
+
sema conteudo planejar exemplos/pipeline-conteudo/definicao.json --alvos-arquivo exemplos/pipeline-conteudo/alvos.json --json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The example intentionally contains no private keys, signed policy, trust pins,
|
|
21
|
+
ledger checkpoint, or signed events. In a live run, an authorized policy
|
|
22
|
+
authority must sign a policy bound to the execution and complete target set
|
|
23
|
+
through `runId` and `targetSetDigest`, with explicit `issuedAt` and `expiresAt`
|
|
24
|
+
authorization bounds. Every event must be recorded within that interval, and
|
|
25
|
+
every append also supplies that policy envelope. Keep the
|
|
26
|
+
trust-root digest, current `revocationDigest`, and
|
|
27
|
+
required `expectedHead` outside the runner-controlled workspace. Generate
|
|
28
|
+
events in independently controlled producer, evaluator, and adapter processes;
|
|
29
|
+
never commit production private keys to a Sema workspace. The adapter's
|
|
30
|
+
`requiredMetadata + optionalMetadata` is the exact scalar public allowlist;
|
|
31
|
+
artifact metadata is unavailable in v1. The runner resolves credentials
|
|
32
|
+
externally from a strict `account:<alias>` reference.
|
|
33
|
+
|
|
34
|
+
Every gate declares separate deterministic-attester and semantic-AI quorums.
|
|
35
|
+
Use `content.evidence.attest:<evidenceType>` for ordinary attestations. Adapter
|
|
36
|
+
observations use the stricter
|
|
37
|
+
`content.adapter.attest:<adapterId>@<version>:<evidenceType>` capability and
|
|
38
|
+
signed adapter/version binding; a generic receipt capability is intentionally
|
|
39
|
+
insufficient.
|
|
40
|
+
|
|
41
|
+
The runner executes and resumes work from Sema's derived `nextActions`. It does
|
|
42
|
+
not calculate verdicts or edit completion state. Operational conditions remain
|
|
43
|
+
separate from gate verdicts, and every generated manifest is a non-authoritative
|
|
44
|
+
projection of the canonical ledger. There is no native human-review fallback.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"targetId": "documento-principal",
|
|
4
|
+
"adapterId": "destination.document",
|
|
5
|
+
"accountScope": "account:publisher.site-a",
|
|
6
|
+
"formatProfileId": "long-form",
|
|
7
|
+
"locale": "pt-BR",
|
|
8
|
+
"metadata": {
|
|
9
|
+
"title": "Exemplo de conteúdo multiformato"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"targetId": "episodio-audio",
|
|
14
|
+
"adapterId": "destination.audio-feed",
|
|
15
|
+
"accountScope": "account:publisher.feed-a",
|
|
16
|
+
"formatProfileId": "spoken-episode",
|
|
17
|
+
"locale": "pt-BR",
|
|
18
|
+
"metadata": {
|
|
19
|
+
"title": "Exemplo de conteúdo multiformato",
|
|
20
|
+
"description": "A mesma intenção editorial em um destino de áudio independente."
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|