@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
package/README.md
CHANGED
|
@@ -109,6 +109,22 @@ sema testar contratos/app.sema --alvo cpp --saida .tmp/app-cpp-tests
|
|
|
109
109
|
sema verificar contratos/app.sema --saida .tmp/app-check --json
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
+
## AI-native Content Pipeline
|
|
113
|
+
|
|
114
|
+
`sema conteudo` validates and plans multi-channel, multi-format content work,
|
|
115
|
+
verifies signed policies and evidence, replays canonical state, and projects
|
|
116
|
+
non-authoritative manifests. Producer agents, specialized AI evaluators,
|
|
117
|
+
creative tools, and delivery adapters run in an external runner; there is no
|
|
118
|
+
native human-review transition.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
sema conteudo validar exemplos/pipeline-conteudo/definicao.json --json
|
|
122
|
+
sema conteudo planejar exemplos/pipeline-conteudo/definicao.json --alvos-arquivo exemplos/pipeline-conteudo/alvos.json --json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
See `docs/pipeline-conteudo.md` for the signed trust, quorum, ledger, target,
|
|
126
|
+
adapter, and projection model.
|
|
127
|
+
|
|
112
128
|
## Public Boundary
|
|
113
129
|
|
|
114
130
|
The npm package is for local CLI usage only. It must not contain private or
|
package/dist/comandos.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { comandoDev } from "./dev/index.js";
|
|
4
4
|
import { comandoInit } from "./init/index.js";
|
|
5
5
|
import { comandoSyncPrisma } from "./sync/index.js";
|
|
6
|
+
import { comandoPipelineConteudo } from "./pipelineConteudo/command.js";
|
|
6
7
|
async function comandoInitHandler(posicionais, args, _emJson) {
|
|
7
8
|
try {
|
|
8
9
|
await comandoInit([...posicionais, ...args]);
|
|
@@ -59,5 +60,6 @@ export const REGISTRO_COMANDOS = {
|
|
|
59
60
|
init: comandoInitHandler,
|
|
60
61
|
dev: comandoDevHandler,
|
|
61
62
|
sync: comandoSyncPrismaHandler,
|
|
63
|
+
conteudo: comandoPipelineConteudo,
|
|
62
64
|
};
|
|
63
65
|
//# sourceMappingURL=comandos.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
// SEMA-GOVERNED
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// Descri??o: detec??o de comandos externos usados por doctor, testes gerados e runners opcionais.
|
|
1
|
+
// SEMA-GOVERNED: sema.produto.cli_toolchain_local
|
|
2
|
+
// Contrato: contratos/sema/cli_toolchain_local.sema
|
|
3
|
+
// Descrição: detecção de comandos externos usados por doctor, testes gerados e runners opcionais.
|
|
5
4
|
import { spawnSync } from "node:child_process";
|
|
6
5
|
import { createRequire } from "node:module";
|
|
7
6
|
const requireRuntimeCli = createRequire(import.meta.url);
|
|
@@ -16,14 +15,29 @@ function resolverImportadorNodeOpcional(especificador) {
|
|
|
16
15
|
export const TSX_IMPORTADOR_CLI = resolverImportadorNodeOpcional("tsx");
|
|
17
16
|
export const TSX_EXECUTOR_CLI = resolverImportadorNodeOpcional("tsx/cli");
|
|
18
17
|
const TIMEOUT_CHECAGEM_COMANDO_MS = 5_000;
|
|
18
|
+
const disponibilidadeComandosNoProcesso = new Map();
|
|
19
19
|
export function comandoDisponivel(comando, argumentos = ["--version"]) {
|
|
20
|
+
const chaveSondagem = JSON.stringify({
|
|
21
|
+
comando,
|
|
22
|
+
argumentos,
|
|
23
|
+
cwd: process.cwd(),
|
|
24
|
+
path: process.env.PATH ?? "",
|
|
25
|
+
pathExt: process.env.PATHEXT ?? "",
|
|
26
|
+
comSpec: process.env.COMSPEC ?? "",
|
|
27
|
+
});
|
|
28
|
+
const resultadoMemorizado = disponibilidadeComandosNoProcesso.get(chaveSondagem);
|
|
29
|
+
if (resultadoMemorizado !== undefined) {
|
|
30
|
+
return resultadoMemorizado;
|
|
31
|
+
}
|
|
20
32
|
const execucao = spawnSync(comando, argumentos, {
|
|
21
33
|
stdio: "ignore",
|
|
22
34
|
shell: process.platform === "win32",
|
|
23
35
|
timeout: TIMEOUT_CHECAGEM_COMANDO_MS,
|
|
24
36
|
windowsHide: true,
|
|
25
37
|
});
|
|
26
|
-
|
|
38
|
+
const disponivel = !execucao.error && execucao.signal === null && (execucao.status ?? 1) === 0;
|
|
39
|
+
disponibilidadeComandosNoProcesso.set(chaveSondagem, disponivel);
|
|
40
|
+
return disponivel;
|
|
27
41
|
}
|
|
28
42
|
export function resolverExecucaoPython() {
|
|
29
43
|
if (comandoDisponivel("python")) {
|
package/dist/index.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export { iniciarProfileAuthor, comandoAuthor, criarAuthorBriefing, revisarCliche
|
|
|
5
5
|
export { validarProfileSemantico } from "./profileCommand.js";
|
|
6
6
|
export { materializarExemplosOficiais } from "./exemplosOficiais.js";
|
|
7
7
|
export { expandirIntencaoSemanticaProfile, sugerirStarterPresetProfile, validarPipelineProfiles, exigirQaCriativoQuandoPublicavel, catalogoDropdownOnboarding } from "./profileOrquestracao.js";
|
|
8
|
+
export * from "./pipelineConteudo/index.js";
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { iniciarProfileAuthor, comandoAuthor, criarAuthorBriefing, revisarCliche
|
|
|
8
8
|
export { validarProfileSemantico } from "./profileCommand.js";
|
|
9
9
|
export { materializarExemplosOficiais } from "./exemplosOficiais.js";
|
|
10
10
|
export { expandirIntencaoSemanticaProfile, sugerirStarterPresetProfile, validarPipelineProfiles, exigirQaCriativoQuandoPublicavel, catalogoDropdownOnboarding } from "./profileOrquestracao.js";
|
|
11
|
+
export * from "./pipelineConteudo/index.js";
|
|
11
12
|
principal().catch((erro) => {
|
|
12
13
|
console.error("Falha ao executar a CLI da Sema.");
|
|
13
14
|
console.error(erro instanceof Error ? erro.stack ?? erro.message : erro);
|
package/dist/index.part01.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { compilarCodigo, type IrModulo } from "@sema/nucleo";
|
|
|
2
2
|
import { analisarDriftLegado, type OpcoesDriftLegado } from "./drift.js";
|
|
3
3
|
import { type GuiaCapacidadeIaMap } from './agentContextTipos.js';
|
|
4
4
|
import { criarBriefingAgente, resumirDriftPorModulo } from "./index.part03.js";
|
|
5
|
-
export type Comando = "iniciar" | "init" | "dev" | "sync" | "author" | "profile" | "validar" | "ast" | "ir" | "compilar" | "gerar" | "testar" | "diagnosticos" | "verificar" | "inspecionar" | "drift" | "impacto" | "renomear-semantico" | "importar" | "doctor" | "formatar" | "ajuda-ia" | "starter-ia" | "sync-codex" | "instalar-exemplos" | "rule-packs" | "docs-impacto" | "finalizar-mudanca" | "resumo" | "prompt-curto" | "prompt-ia" | "prompt-ia-ui" | "prompt-ia-react" | "prompt-ia-sema-primeiro" | "exemplos-prompt-ia" | "contexto-ia";
|
|
5
|
+
export type Comando = "iniciar" | "init" | "dev" | "sync" | "author" | "profile" | "conteudo" | "validar" | "ast" | "ir" | "compilar" | "gerar" | "testar" | "diagnosticos" | "verificar" | "inspecionar" | "drift" | "impacto" | "renomear-semantico" | "importar" | "doctor" | "formatar" | "ajuda-ia" | "starter-ia" | "sync-codex" | "instalar-exemplos" | "rule-packs" | "docs-impacto" | "finalizar-mudanca" | "resumo" | "prompt-curto" | "prompt-ia" | "prompt-ia-ui" | "prompt-ia-react" | "prompt-ia-sema-primeiro" | "exemplos-prompt-ia" | "contexto-ia";
|
|
6
6
|
export interface ResultadoFormatacaoArquivo {
|
|
7
7
|
caminho: string;
|
|
8
8
|
alterado: boolean;
|
package/dist/index.part01.js
CHANGED
|
@@ -66,7 +66,14 @@ export function ajuda() {
|
|
|
66
66
|
"sema profile capabilities --json",
|
|
67
67
|
"sema rule-packs --profile legal --json",
|
|
68
68
|
"",
|
|
69
|
-
"[5]
|
|
69
|
+
"[5] Orquestrar criação de conteúdo por IA",
|
|
70
|
+
"sema conteudo capabilities --json",
|
|
71
|
+
"sema conteudo validar <definition.json> --json",
|
|
72
|
+
"sema conteudo planejar <definition.json> --alvos-arquivo <targets.json> --json",
|
|
73
|
+
"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",
|
|
74
|
+
"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",
|
|
75
|
+
"",
|
|
76
|
+
"[6] Adotar Sema em projeto que ainda não usa",
|
|
70
77
|
"sema importar <fonte> <diretorio> --saida <diretorio> --json",
|
|
71
78
|
"sema formatar <arquivo-ou-pasta>",
|
|
72
79
|
"sema validar <arquivo-ou-pasta> --json",
|
|
@@ -95,6 +102,7 @@ export function ajuda() {
|
|
|
95
102
|
"author: sema author <iniciar|validar|briefing|revisar-cliches|validar-narrativa|validar-proibicoes> [arquivo] [--tema-sensivel] [--preset conto|romance|roteiro|lore|campanha] [--saida <arquivo>] [--texto <texto>] [--json]",
|
|
96
103
|
"profile: sema profile validar <software|workflow|ops|game|legal|research|redacao|propostas|conversas> <arquivo-ou-pasta> [--maturidade draft|prototype|production|critical] [--preset <preset>] [--artefato <texto>|--artefato-arquivo <arquivo>] [--json]",
|
|
97
104
|
"capabilities: sema profile capabilities [--json]",
|
|
105
|
+
"conteúdo: sema conteudo <capabilities|validar|planejar|validar-envelope|registrar|status|projetar> [--trust-root-digest <sha256:...>] [--revocation-digest <sha256:...>] [--expected-head <sha256:...>] [opções] [--json]",
|
|
98
106
|
"rule packs: sema rule-packs [--profile <author|software|workflow|ops|game|legal|research|redacao|propostas|conversas>] [--json]",
|
|
99
107
|
]),
|
|
100
108
|
"",
|
|
@@ -119,6 +127,7 @@ export function ajuda() {
|
|
|
119
127
|
"sema author validar-proibicoes <arquivo.sema> [--texto <texto>|--texto-arquivo <arquivo>] [--json]",
|
|
120
128
|
"sema profile validar <profile> <arquivo.sema> [--maturidade draft|prototype|production|critical] [--preset <preset>] [--artefato <texto>|--artefato-arquivo <arquivo>] [--json]",
|
|
121
129
|
"sema profile capabilities [--json]",
|
|
130
|
+
"sema conteudo <capabilities|validar|planejar|validar-envelope|registrar|status|projetar> [--trust-root-digest <sha256:...>] [--revocation-digest <sha256:...>] [--expected-head <sha256:...>] [opções] [--json]",
|
|
122
131
|
"sema rule-packs [--profile <profile>] [--json]",
|
|
123
132
|
]),
|
|
124
133
|
"",
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { AdaptadorConteudo, AlvoConteudo, ArtefatoConteudo, MetadataPublicaConteudo, RestricaoDeterministicaConteudo } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Vocabulário inicial para definições usuais. O validador aceita qualquer
|
|
4
|
+
* capability opaca não vazia; esta lista não é uma whitelist.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CAPABILITIES_CONTEUDO_PADRAO: readonly ["content.topic.plan", "content.research.collect", "content.master.compose", "content.target.adapt", "content.qa.deterministic", "content.qa.semantic", "content.target.deliver", "content.target.confirm"];
|
|
7
|
+
export declare const CONSTRAINTS_DETERMINISTICAS_SUPORTADAS: readonly ["artifact.bytes.min", "artifact.bytes.max", "media.duration.min", "media.duration.max", "text.length.min", "text.length.max"];
|
|
8
|
+
export interface ObservacoesDeterministicasArtefatoConteudo {
|
|
9
|
+
/** Media type observado por sniffing/verificador independente. */
|
|
10
|
+
readonly observedMediaType?: string;
|
|
11
|
+
/** Tamanho materializado do artefato, em bytes. */
|
|
12
|
+
readonly artifactBytes?: number;
|
|
13
|
+
/** Duração observada da mídia, em segundos. */
|
|
14
|
+
readonly mediaDuration?: number;
|
|
15
|
+
/** Comprimento textual observado, em pontos de código Unicode. */
|
|
16
|
+
readonly textLength?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ResultadoConstraintDeterministicaConteudo {
|
|
19
|
+
readonly constraintId: string;
|
|
20
|
+
readonly kind: string;
|
|
21
|
+
readonly observed: number | null;
|
|
22
|
+
readonly limit: number | null;
|
|
23
|
+
readonly passed: boolean;
|
|
24
|
+
readonly bloqueios: readonly string[];
|
|
25
|
+
}
|
|
26
|
+
export interface ResultadoAvaliacaoConstraintsConteudo {
|
|
27
|
+
readonly valido: boolean;
|
|
28
|
+
readonly artifactDigest: string;
|
|
29
|
+
readonly constraintsDigest: string;
|
|
30
|
+
readonly resultsDigest: string;
|
|
31
|
+
readonly resultados: readonly ResultadoConstraintDeterministicaConteudo[];
|
|
32
|
+
readonly bloqueios: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
export interface ResultadoValidacaoAdaptadorConteudo {
|
|
35
|
+
readonly valido: boolean;
|
|
36
|
+
readonly bloqueios: readonly string[];
|
|
37
|
+
}
|
|
38
|
+
export interface PlanoAdaptacaoConteudo {
|
|
39
|
+
readonly targetId: string;
|
|
40
|
+
readonly adapterId: string;
|
|
41
|
+
readonly adapterVersion: string;
|
|
42
|
+
readonly accountScope: string;
|
|
43
|
+
readonly isolationKey: string;
|
|
44
|
+
readonly formatProfileId: string;
|
|
45
|
+
readonly locale: string;
|
|
46
|
+
readonly capabilities: readonly string[];
|
|
47
|
+
readonly acceptedMediaTypes: readonly string[];
|
|
48
|
+
readonly deterministicConstraints: readonly RestricaoDeterministicaConteudo[];
|
|
49
|
+
readonly requiredMetadata: readonly string[];
|
|
50
|
+
readonly optionalMetadata: readonly string[];
|
|
51
|
+
readonly confirmationPredicates: readonly string[];
|
|
52
|
+
readonly metadata: MetadataPublicaConteudo;
|
|
53
|
+
readonly masterArtifacts: readonly unknown[];
|
|
54
|
+
}
|
|
55
|
+
export interface BloqueioAlvoConteudo {
|
|
56
|
+
readonly targetId: string;
|
|
57
|
+
readonly codigo: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ResultadoPlanejamentoAlvosConteudo {
|
|
60
|
+
readonly planosAdaptacao: readonly PlanoAdaptacaoConteudo[];
|
|
61
|
+
readonly bloqueiosPorAlvo: readonly BloqueioAlvoConteudo[];
|
|
62
|
+
}
|
|
63
|
+
export declare function validarReferenciaAccountScopeConteudo(valor: unknown): readonly string[];
|
|
64
|
+
/** Metadata de target e publica no plano/ledger/projecao; segredos sao sempre externos. */
|
|
65
|
+
export declare function validarMetadataPublicaConteudo(valor: unknown): readonly string[];
|
|
66
|
+
/**
|
|
67
|
+
* Escopo exato e injetivo para autorização target-bound. Alterar execução,
|
|
68
|
+
* target ou conta sempre altera o escopo.
|
|
69
|
+
*/
|
|
70
|
+
export declare function escopoAutorizacaoAlvo(runId: string, alvo: AlvoConteudo): string;
|
|
71
|
+
export declare function escopoAutorizacaoGlobal(runId: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* Avalia somente medições fornecidas. Não lê arquivos, não chama ferramentas e
|
|
74
|
+
* nunca trata um kind desconhecido como aprovação implícita.
|
|
75
|
+
*/
|
|
76
|
+
export declare function avaliarConstraintsDeterministicasConteudo(artefato: ArtefatoConteudo, constraints: readonly RestricaoDeterministicaConteudo[], observacoes?: ObservacoesDeterministicasArtefatoConteudo): ResultadoAvaliacaoConstraintsConteudo;
|
|
77
|
+
/** Valida somente propriedades declarativas; nenhuma capability é executada. */
|
|
78
|
+
export declare function validarAdaptadorConteudo(adapter: AdaptadorConteudo): ResultadoValidacaoAdaptadorConteudo;
|
|
79
|
+
/**
|
|
80
|
+
* Materializa um plano isolado por targetId/accountScope. Os planos carregam
|
|
81
|
+
* instruções e referências; credenciais e chamadas de ferramenta ficam no
|
|
82
|
+
* runner externo.
|
|
83
|
+
*/
|
|
84
|
+
export declare function planejarAlvosConteudo(alvos: readonly AlvoConteudo[], adapters: readonly AdaptadorConteudo[], artefatosMestre: readonly unknown[]): ResultadoPlanejamentoAlvosConteudo;
|