@orkastery/cli 0.2.0 → 0.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/LICENSE +1 -1
- package/README.md +86 -65
- package/adapters/README.md +30 -15
- package/adapters/claude-code/.claude-plugin/plugin.json +11 -5
- package/adapters/claude-code/README.md +110 -8
- package/adapters/claude-code/commands/onboarding.md +21 -0
- package/adapters/claude-code/commands/ork.md +99 -27
- package/adapters/claude-code/hooks/hooks.json +6 -1
- package/adapters/claude-code/hooks/ork-sensor.js +66 -0
- package/adapters/codex/skills/ork/SKILL.md +57 -0
- package/adapters/hermes/README.md +163 -0
- package/adapters/hermes/bin/ork-abrir-thread.sh +2 -0
- package/adapters/hermes/bin/ork-brain.sh +4 -0
- package/adapters/hermes/bin/ork-hitl-answer.py +82 -0
- package/adapters/hermes/bin/ork-maestro.sh +6 -0
- package/adapters/hermes/bin/ork-master-enviar.py +84 -0
- package/adapters/hermes/bin/ork-objective-message.sh +17 -0
- package/adapters/hermes/bin/ork-objective-status.sh +12 -0
- package/adapters/hermes/bin/ork-pulse-enviar.py +47 -0
- package/adapters/hermes/hermes.plugin.json +26 -4
- package/adapters/hermes/hitl-ingress/__init__.py +356 -0
- package/adapters/hermes/hitl-ingress/plugin.yaml +4 -0
- package/adapters/hermes/skills/orkastery-devmaster/SKILL.md +75 -22
- package/adapters/openclaw/README.md +135 -26
- package/adapters/openclaw/bin/ork-brain.sh +4 -0
- package/adapters/openclaw/construir.sh +19 -0
- package/adapters/openclaw/dist/hitl-ingress.js +199 -0
- package/adapters/openclaw/dist/index.js +437 -0
- package/adapters/openclaw/openclaw.plugin.json +39 -134
- package/adapters/openclaw/package.json +26 -0
- package/adapters/openclaw/src/hitl-ingress.ts +180 -0
- package/adapters/openclaw/src/index.ts +458 -0
- package/adapters/openclaw/src/tipos-openclaw.d.ts +58 -0
- package/adapters/openclaw/tsconfig.json +15 -0
- package/assets/docs/markdownlint-cli2.jsonc +22 -0
- package/assets/docs/padroes/documentacao-de-produto.md +133 -0
- package/assets/docs/padroes/roadmap-de-produto.md +98 -0
- package/assets/docs/produto/README.md +14 -0
- package/assets/docs/produto/_modelo-feature.md +59 -0
- package/assets/docs/roadmap/README.md +14 -0
- package/assets/docs/roadmap/_modelo-item.md +73 -0
- package/assets/orkmind-native-schema.json +32 -0
- package/assets/orkmind_bridge.py +357 -0
- package/assets/orkmind_fixture.py +67 -0
- package/assets/orkmind_prospective.py +138 -0
- package/assets/reference-tariffs-i07.json +23 -0
- package/dist/adapters/claude-bg.js +488 -39
- package/dist/adapters/codex-controller-sensor.js +449 -0
- package/dist/adapters/codex-controller-worker.js +361 -0
- package/dist/adapters/codex-controller.js +252 -0
- package/dist/adapters/codex-events.js +205 -0
- package/dist/adapters/codex-question.js +26 -0
- package/dist/adapters/codex-runner.js +133 -0
- package/dist/adapters/codex.js +394 -0
- package/dist/agents-md.js +84 -0
- package/dist/auditoria.js +11 -8
- package/dist/auditrun.js +5 -4
- package/dist/board.js +173 -22
- package/dist/branch-de-estado.js +136 -0
- package/dist/canarios-hitl.js +177 -0
- package/dist/canarios-i43.js +543 -0
- package/dist/canarios-pulse.js +147 -0
- package/dist/canarios-sensores.js +129 -0
- package/dist/canarios.js +111 -2
- package/dist/catalogo.js +9 -0
- package/dist/ci.js +216 -0
- package/dist/ciclos.js +2 -1
- package/dist/claim-lint.js +64 -0
- package/dist/claims.js +60 -0
- package/dist/company-brain-capture.js +195 -0
- package/dist/company-brain-cli.js +123 -0
- package/dist/company-brain-client.js +61 -0
- package/dist/company-brain-contract.js +166 -0
- package/dist/company-brain-journal.js +192 -0
- package/dist/company-brain-mcp.js +33 -0
- package/dist/company-brain-migration.js +60 -0
- package/dist/company-brain-source.js +177 -0
- package/dist/company-brain-worker.js +18 -0
- package/dist/conducao-texto.js +61 -0
- package/dist/conducao.js +876 -0
- package/dist/contrato-publico.js +39 -0
- package/dist/creation-operation-store.js +251 -0
- package/dist/creation-operation.js +148 -0
- package/dist/decisao-autonoma.js +183 -0
- package/dist/delegation.js +79 -0
- package/dist/demo.js +120 -0
- package/dist/docs.js +828 -0
- package/dist/doctor.js +183 -24
- package/dist/entrega-pr.js +117 -0
- package/dist/escopo-escrita.js +71 -0
- package/dist/estado-thread.js +222 -0
- package/dist/evalrunner.js +12 -0
- package/dist/fabrica-estado.js +329 -0
- package/dist/fabrica-publicar.js +76 -0
- package/dist/fix.js +21 -0
- package/dist/gates.js +55 -9
- package/dist/handoff.js +39 -23
- package/dist/hitl-canais.js +333 -0
- package/dist/hitl-classificacao.js +131 -0
- package/dist/hitl-contract.js +465 -0
- package/dist/hitl-estado.js +136 -0
- package/dist/hitl-gates.js +554 -0
- package/dist/hitl-ingress-receipt.js +382 -0
- package/dist/hitl-local-atestado.js +57 -0
- package/dist/hitl-local-receipt.js +328 -0
- package/dist/hitl-local.js +143 -0
- package/dist/hitl-lock.js +139 -0
- package/dist/hitl-lote.js +223 -0
- package/dist/hitl-native-offer.js +97 -0
- package/dist/hitl-native.js +65 -0
- package/dist/hitl-presentation.js +209 -0
- package/dist/hitl-public-receipt.js +176 -0
- package/dist/hitl-resumo.js +209 -0
- package/dist/hitl-sessions.js +475 -0
- package/dist/hitl.js +711 -0
- package/dist/horario.js +269 -0
- package/dist/hosts.js +198 -22
- package/dist/index.js +1736 -93
- package/dist/indice.js +99 -0
- package/dist/init.js +28 -3
- package/dist/integracoes-locais.js +17 -0
- package/dist/leases.js +65 -21
- package/dist/ledger-stats.js +272 -0
- package/dist/ledger.js +107 -2
- package/dist/licoes.js +215 -0
- package/dist/liveness.js +218 -0
- package/dist/maestro-actions.js +51 -0
- package/dist/maestro-authority.js +152 -0
- package/dist/maestro-cli.js +97 -0
- package/dist/maestro-contract.js +55 -0
- package/dist/maestro-discovery.js +132 -0
- package/dist/maestro-runtime.js +268 -0
- package/dist/maestro-snapshot.js +86 -0
- package/dist/maestro-sources.js +224 -0
- package/dist/manifest.js +165 -6
- package/dist/maquina.js +102 -0
- package/dist/master-audit.js +101 -0
- package/dist/master-batch.js +43 -0
- package/dist/master-digest.js +149 -0
- package/dist/master-migracao.js +155 -0
- package/dist/master.js +361 -77
- package/dist/mcp-artifacts.js +234 -0
- package/dist/mcp-git.js +433 -0
- package/dist/mcp-install.js +310 -0
- package/dist/mcp-maestro.js +25 -0
- package/dist/mcp-server.js +469 -0
- package/dist/mcp-ship.js +436 -0
- package/dist/mcp-verify.js +173 -0
- package/dist/memoria-humana.js +207 -0
- package/dist/memoria.js +314 -78
- package/dist/memory-migration.js +279 -0
- package/dist/memory-prospective.js +148 -0
- package/dist/modos-migracao.js +191 -0
- package/dist/modos.js +151 -15
- package/dist/monitor-lock.js +110 -0
- package/dist/objective.js +449 -0
- package/dist/ocupacao.js +267 -0
- package/dist/onboarding.js +303 -0
- package/dist/orkmind.js +389 -90
- package/dist/orquestracao.js +96 -69
- package/dist/phase.js +596 -150
- package/dist/playbook-capabilities.js +150 -0
- package/dist/playbook-contracts.js +188 -0
- package/dist/portfolio-context.js +61 -0
- package/dist/portfolio.js +180 -0
- package/dist/preflight.js +207 -0
- package/dist/process-audit.js +112 -0
- package/dist/project-state.js +93 -0
- package/dist/prompts.js +25 -5
- package/dist/prova-minima.js +112 -0
- package/dist/pulse-cadencia.js +163 -0
- package/dist/pulse-consentimento.js +260 -0
- package/dist/pulse-delivery.js +323 -0
- package/dist/pulse-resposta.js +542 -0
- package/dist/pulse.js +262 -0
- package/dist/ratelimit.js +35 -2
- package/dist/recall.js +80 -3
- package/dist/redacao-saida.js +45 -0
- package/dist/redacao-url.js +66 -0
- package/dist/retry.js +637 -115
- package/dist/roadmap-reservas.js +243 -0
- package/dist/runtime-ambiente.js +38 -0
- package/dist/runtime-context.js +215 -0
- package/dist/runtime-profiles.js +869 -0
- package/dist/runtimes.js +103 -0
- package/dist/sandbox.js +9 -0
- package/dist/session-events.js +203 -0
- package/dist/session-watcher-claude.js +637 -0
- package/dist/session-watcher.js +683 -0
- package/dist/sessoes-adopt.js +154 -0
- package/dist/sessoes-inventario.js +159 -0
- package/dist/sessoes.js +16 -35
- package/dist/setup.js +691 -0
- package/dist/ship.js +150 -15
- package/dist/slug.js +1 -1
- package/dist/thread-close.js +115 -0
- package/dist/thread.js +142 -28
- package/dist/tokens.js +1 -1
- package/dist/util.js +4 -2
- package/dist/verify-sandbox.js +265 -0
- package/dist/verify.js +270 -25
- package/dist/versao.js +60 -0
- package/dist/worktree.js +31 -2
- package/dist/write-activation.js +291 -0
- package/dist/yaml.js +2 -0
- package/eval/casos/onboarding.json +102 -0
- package/eval/casos/orkastery-bootstrap.json +35 -1
- package/eval/casos/scope-check-capability-map.json +45 -7
- package/eval/casos/ship-release.json +2 -2
- package/eval/fixtures/b0-slug-e-modos/caso.json +35 -22
- package/eval/fixtures/b2-master-log/caso.json +1 -1
- package/eval/fixtures/fx-adapter-editado-detectado/caso.json +19 -0
- package/eval/fixtures/fx-auto-quiet/caso.json +11 -0
- package/eval/fixtures/fx-blanket-approve/caso.json +10 -0
- package/eval/fixtures/fx-check-runtime-cruzado/caso.json +20 -0
- package/eval/fixtures/fx-codex-dry/caso.json +18 -0
- package/eval/fixtures/fx-donewhen-executavel/caso.json +15 -0
- package/eval/fixtures/fx-estado-dividido/caso.json +15 -0
- package/eval/fixtures/fx-fase-orfa/caso.json +116 -0
- package/eval/fixtures/fx-happy/caso.json +6 -4
- package/eval/fixtures/fx-hitl-latency/caso.json +20 -0
- package/eval/fixtures/fx-indice-reversao/caso.json +25 -0
- package/eval/fixtures/fx-listagem-abertas/caso.json +16 -0
- package/eval/fixtures/fx-maestro-bootstrap/caso.json +21 -0
- package/eval/fixtures/fx-modo-aposentado-escritor/caso.json +21 -0
- package/eval/fixtures/fx-modo-aposentado-leitor/caso.json +16 -0
- package/eval/fixtures/fx-objective-oscillation/caso.json +14 -0
- package/eval/fixtures/fx-omnicanal/caso.json +17 -0
- package/eval/fixtures/fx-sensores-runtime/caso.json +17 -0
- package/monitor/company-brain.cjs +17 -0
- package/monitor/pulse-scope.cjs +45 -0
- package/monitor/pulse.cron +18 -0
- package/monitor/varredura-pulse.sh +27 -0
- package/package.json +25 -4
- package/schemas/claims.schema.json +25 -0
- package/schemas/company-brain.schema.json +1158 -0
- package/schemas/creation-operation.schema.json +365 -0
- package/schemas/maestro-snapshot.schema.json +2716 -0
- package/skills/core/onboarding/SKILL.md +50 -0
- package/skills/core/orkastery-bootstrap/SKILL.md +95 -65
- package/skills/core/thread-state/SKILL.md +3 -1
- package/skills/governance/scope-check-capability-map/SKILL.md +17 -7
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.validarDelegacao = validarDelegacao;
|
|
37
|
+
exports.conteudoDePremissas = conteudoDePremissas;
|
|
38
|
+
exports.avaliarDelegacao = avaliarDelegacao;
|
|
39
|
+
const fs = __importStar(require("node:fs"));
|
|
40
|
+
const path = __importStar(require("node:path"));
|
|
41
|
+
const thread_1 = require("./thread");
|
|
42
|
+
function validarDelegacao(v) {
|
|
43
|
+
if (!v || typeof v !== 'object' || Array.isArray(v))
|
|
44
|
+
return false;
|
|
45
|
+
const d = v;
|
|
46
|
+
return typeof d.thread === 'string' && /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$/.test(d.thread) && d.escopo === 'premissas' &&
|
|
47
|
+
typeof d.prazo === 'string' && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/.test(d.prazo) && Number.isFinite(Date.parse(d.prazo)) &&
|
|
48
|
+
typeof d.evidencia === 'string' && !!d.evidencia.trim() && d.evidencia.length <= 1000 &&
|
|
49
|
+
typeof d.delegado === 'string' && /^[a-zA-Z0-9][a-zA-Z0-9:._-]{0,99}$/.test(d.delegado);
|
|
50
|
+
}
|
|
51
|
+
/** A guarda lê o artefato canônico, sem aceitar que o chamador omita um [GATE]. */
|
|
52
|
+
function conteudoDePremissas(raiz, thread) {
|
|
53
|
+
const dir = fs.realpathSync((0, thread_1.dirThread)(raiz, thread));
|
|
54
|
+
const partes = [];
|
|
55
|
+
for (const nome of ['GOAL.md', 'PLAN.md', 'docs/goal.md', 'docs/plan.md']) {
|
|
56
|
+
const file = path.join(dir, nome);
|
|
57
|
+
if (!fs.existsSync(file))
|
|
58
|
+
continue;
|
|
59
|
+
const real = fs.realpathSync(file);
|
|
60
|
+
if (!real.startsWith(dir + path.sep) || fs.statSync(real).size > 128 * 1024)
|
|
61
|
+
return '[GATE] artefato não inspecionável';
|
|
62
|
+
partes.push(fs.readFileSync(real, 'utf8'));
|
|
63
|
+
}
|
|
64
|
+
return partes.length ? partes.join('\n') : '[GATE] premissas sem artefato';
|
|
65
|
+
}
|
|
66
|
+
function avaliarDelegacao(manifesto, entrada) {
|
|
67
|
+
const d = manifesto.conduction.delegation;
|
|
68
|
+
if (!validarDelegacao(d))
|
|
69
|
+
return { permitida: false, razao: 'delegação não configurada com escopo, prazo e evidência' };
|
|
70
|
+
if (entrada.modo !== 'maestro' || !['GOAL', 'PLAN'].includes(entrada.fase) || entrada.escopo !== 'premissas' || d.thread !== entrada.thread) {
|
|
71
|
+
return { permitida: false, razao: 'somente premissas da thread Maestro declarada são delegáveis; push e score são excluídos' };
|
|
72
|
+
}
|
|
73
|
+
if (/\[GATE\]/i.test(entrada.conteudo ?? ''))
|
|
74
|
+
return { permitida: false, razao: '[GATE] exige humano' };
|
|
75
|
+
const quando = Date.parse(entrada.quando ?? new Date().toISOString());
|
|
76
|
+
if (!Number.isFinite(quando) || quando >= Date.parse(d.prazo))
|
|
77
|
+
return { permitida: false, razao: 'delegação expirada ou relógio inválido; não autoriza' };
|
|
78
|
+
return { permitida: true, delegado: d.delegado, evidencia: d.evidencia, razao: 'delegação explícita de premissas vigente' };
|
|
79
|
+
}
|
package/dist/demo.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.executarDemo = executarDemo;
|
|
37
|
+
/**
|
|
38
|
+
* I-56 (RM-046, fase 2): `ork demo`, a promessa do produto em trinta segundos.
|
|
39
|
+
*
|
|
40
|
+
* O agente diz "pronto"; o `ork` reexecuta a prova no commit real e recusa a afirmacao falsa. A
|
|
41
|
+
* demonstracao roda offline, sem runtime, sem conta e sem modelo: um repositorio temporario, uma
|
|
42
|
+
* funcao com defeito, uma claim com o comando que a julga, e o `ork verify` de verdade, antes e
|
|
43
|
+
* depois da correcao. Nada toca o projeto de quem roda, o registro de contas nem remoto nenhum.
|
|
44
|
+
*/
|
|
45
|
+
const fs = __importStar(require("node:fs"));
|
|
46
|
+
const os = __importStar(require("node:os"));
|
|
47
|
+
const path = __importStar(require("node:path"));
|
|
48
|
+
const claims_1 = require("./claims");
|
|
49
|
+
const init_1 = require("./init");
|
|
50
|
+
const manifest_1 = require("./manifest");
|
|
51
|
+
const thread_1 = require("./thread");
|
|
52
|
+
const util_1 = require("./util");
|
|
53
|
+
const verify_1 = require("./verify");
|
|
54
|
+
const PROVA = "node -e \"process.exit(require('./soma').soma(2, 2) === 4 ? 0 : 1)\"";
|
|
55
|
+
function git(dir, args) {
|
|
56
|
+
const r = (0, util_1.exec)('git', args, dir);
|
|
57
|
+
if (!r.ok)
|
|
58
|
+
throw new Error(`demo: git ${args[0]} falhou: ${r.stderr.trim().split('\n').pop() ?? ''}`);
|
|
59
|
+
}
|
|
60
|
+
function commit(dir, arquivo, conteudo, mensagem) {
|
|
61
|
+
fs.writeFileSync(path.join(dir, arquivo), conteudo, 'utf8');
|
|
62
|
+
git(dir, ['add', '--', arquivo]);
|
|
63
|
+
git(dir, ['commit', '-q', '-m', mensagem]);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Roda a demonstracao inteira e devolve os dois veredictos. `escrever` recebe a narracao, linha a
|
|
67
|
+
* linha; sem ele, a demo e silenciosa (testes).
|
|
68
|
+
*/
|
|
69
|
+
function executarDemo(opcoes = {}) {
|
|
70
|
+
const diga = opcoes.escrever ?? (() => undefined);
|
|
71
|
+
// Diretorio dado por quem roda: so vazio ou inexistente, e nunca e apagado no fim.
|
|
72
|
+
if (opcoes.dir && fs.existsSync(opcoes.dir) && fs.readdirSync(opcoes.dir).length > 0) {
|
|
73
|
+
throw new Error(`demo: ${opcoes.dir} nao esta vazio; a demo cria o proprio repositorio`);
|
|
74
|
+
}
|
|
75
|
+
const temporario = !opcoes.dir;
|
|
76
|
+
const dir = opcoes.dir ? path.resolve(opcoes.dir) : fs.mkdtempSync(path.join(os.tmpdir(), 'ork-demo-'));
|
|
77
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
78
|
+
// A demo nunca publica estado da fabrica, mesmo numa maquina que entrou nela.
|
|
79
|
+
const publicarAntes = process.env.ORK_FABRICA_PUBLICAR;
|
|
80
|
+
process.env.ORK_FABRICA_PUBLICAR = '0';
|
|
81
|
+
try {
|
|
82
|
+
git(dir, ['init', '-q', '-b', 'main']);
|
|
83
|
+
git(dir, ['config', 'user.name', 'ork demo']);
|
|
84
|
+
git(dir, ['config', 'user.email', 'demo@orkastery.local']);
|
|
85
|
+
git(dir, ['config', 'commit.gpgsign', 'false']);
|
|
86
|
+
commit(dir, 'soma.js', '// Soma dois numeros.\nexports.soma = (a, b) => a - b;\n', 'funcao soma');
|
|
87
|
+
(0, init_1.init)(dir, { nome: 'demo', abbrev: 'dmo' });
|
|
88
|
+
const carregado = (0, manifest_1.exigirManifesto)(dir);
|
|
89
|
+
const { thread } = (0, thread_1.novaThread)(carregado, { nome: 'demo', modo: 'auto' });
|
|
90
|
+
diga('ork demo: a afirmacao do agente contra a prova');
|
|
91
|
+
diga('');
|
|
92
|
+
diga(' 1. O agente entrega soma.js e diz: "soma(2, 2) devolve 4. Pronto."');
|
|
93
|
+
(0, claims_1.adicionarClaim)(dir, thread.id, { arquivo: 'soma.js', alegacao: 'soma(2, 2) devolve 4', verificar: [PROVA] });
|
|
94
|
+
diga(' 2. O ork nao aceita relato: reexecuta a prova no commit real.');
|
|
95
|
+
diga(` ${PROVA}`);
|
|
96
|
+
const antes = (0, verify_1.verificar)(carregado, thread.id, { soClaims: true });
|
|
97
|
+
diga(` Veredito: ${antes.ok ? 'VERDADE SUSTENTADA' : `REPROVADO (${antes.motivos.join(', ')})`}. A funcao faz a - b.`);
|
|
98
|
+
diga(' 3. O agente corrige soma.js e faz commit.');
|
|
99
|
+
commit(dir, 'soma.js', '// Soma dois numeros.\nexports.soma = (a, b) => a + b;\n', 'corrige a soma');
|
|
100
|
+
diga(' 4. O ork reexecuta a MESMA prova no commit novo.');
|
|
101
|
+
const depois = (0, verify_1.verificar)(carregado, thread.id, { soClaims: true });
|
|
102
|
+
diga(` Veredito: ${depois.ok ? 'VERDADE SUSTENTADA' : `REPROVADO (${depois.motivos.join(', ')})`}.`);
|
|
103
|
+
diga('');
|
|
104
|
+
diga('Nenhuma afirmacao vale sem o comando que a julga, reexecutado no commit real.');
|
|
105
|
+
diga('No seu projeto: ork init, depois ork thread new "<pedido>" --modo auto.');
|
|
106
|
+
const ok = !antes.ok && antes.motivos.includes('claims.failed') && depois.ok;
|
|
107
|
+
const mantido = !temporario || opcoes.manter === true;
|
|
108
|
+
if (mantido)
|
|
109
|
+
diga(`(o repositorio da demo ficou em ${dir})`);
|
|
110
|
+
return { dir, antes, depois, ok, mantido };
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
if (publicarAntes === undefined)
|
|
114
|
+
delete process.env.ORK_FABRICA_PUBLICAR;
|
|
115
|
+
else
|
|
116
|
+
process.env.ORK_FABRICA_PUBLICAR = publicarAntes;
|
|
117
|
+
if (temporario && !opcoes.manter)
|
|
118
|
+
fs.rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
|
|
119
|
+
}
|
|
120
|
+
}
|