agentera 3.0.0-dev.27 → 3.0.0-dev.29
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 +7 -5
- package/bundle/CHANGELOG.md +17 -2
- package/bundle/DESIGN.md +3 -7
- package/bundle/README.md +8 -10
- package/bundle/UPGRADE.md +60 -16
- package/bundle/fixtures/routing/hybrid-corpus.yaml +154 -0
- package/bundle/references/adapters/package-registry.yaml +2 -0
- package/bundle/references/adapters/package-surface-characterization.md +2 -3
- package/bundle/references/adapters/runtime-lifecycle-authority.yaml +2 -3
- package/bundle/references/adapters/runtime-retired-resources.yaml +78 -14
- package/bundle/references/analysis/benchmark.md +2 -9
- package/bundle/references/artifacts/state-storage-authority.yaml +308 -14
- package/bundle/references/cli/audience-namespace-cli-migration.yaml +1 -1
- package/bundle/references/cli/bundle-skill-vocabulary.yaml +1 -1
- package/bundle/references/cli/capability-instruction-contract.yaml +0 -3
- package/bundle/references/cli/capability-instruction-structure.md +2 -2
- package/bundle/references/cli/hybrid-route-contract.yaml +416 -0
- package/bundle/references/cli/prime-consumer-compatibility.yaml +12 -11
- package/bundle/references/cli/routing-execution-vocabulary.yaml +0 -4
- package/bundle/references/cli/routing-model.md +136 -91
- package/bundle/references/cli/trigger-schema-enrichment.md +50 -46
- package/bundle/references/cli/vocabulary.md +8 -11
- package/bundle/references/meta/documentation-inventory.md +1 -3
- package/bundle/skills/agentera/SKILL.md +50 -18
- package/bundle/skills/agentera/capabilities/audit/schemas/triggers.yaml +13 -35
- package/bundle/skills/agentera/capabilities/build/schemas/triggers.yaml +14 -36
- package/bundle/skills/agentera/capabilities/design/schemas/triggers.yaml +5 -34
- package/bundle/skills/agentera/capabilities/discuss/schemas/triggers.yaml +6 -40
- package/bundle/skills/agentera/capabilities/document/schemas/triggers.yaml +5 -34
- package/bundle/skills/agentera/capabilities/optimize/schemas/triggers.yaml +4 -35
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/artifacts.yaml +10 -6
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/exit.yaml +3 -2
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/triggers.yaml +5 -37
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/validation.yaml +6 -5
- package/bundle/skills/agentera/capabilities/plan/schemas/triggers.yaml +8 -31
- package/bundle/skills/agentera/capabilities/profile/schemas/triggers.yaml +8 -37
- package/bundle/skills/agentera/capabilities/research/schemas/triggers.yaml +5 -29
- package/bundle/skills/agentera/capabilities/status/schemas/triggers.yaml +7 -47
- package/bundle/skills/agentera/capabilities/vision/schemas/triggers.yaml +7 -39
- package/bundle/skills/agentera/capability_schema_contract.yaml +29 -29
- package/bundle/skills/agentera/route-phrases.yaml +81 -0
- package/bundle/skills/agentera/schemas/artifacts/health.yaml +25 -7
- package/bundle/skills/agentera/schemas/artifacts/plan.yaml +1 -2
- package/dist/capabilities/discuss/instructions.js +1 -1
- package/dist/capabilities/discuss/instructions.js.map +1 -1
- package/dist/capabilities/orchestrate/instructions.js +22 -2
- package/dist/capabilities/orchestrate/instructions.js.map +1 -1
- package/dist/capabilities/plan/instructions.js +1 -1
- package/dist/capabilities/plan/instructions.js.map +1 -1
- package/dist/cli/capabilityContext/evidence.js +1 -1
- package/dist/cli/capabilityContext/evidence.js.map +1 -1
- package/dist/cli/capabilityContext/startup.js +2 -0
- package/dist/cli/capabilityContext/startup.js.map +1 -1
- package/dist/cli/commands/entityMigrate.js +7 -3
- package/dist/cli/commands/entityMigrate.js.map +1 -1
- package/dist/cli/commands/prime/briefOrientation.js +10 -3
- package/dist/cli/commands/prime/briefOrientation.js.map +1 -1
- package/dist/cli/commands/prime/collectEntityOrientation.js +64 -4
- package/dist/cli/commands/prime/collectEntityOrientation.js.map +1 -1
- package/dist/cli/commands/prime/orientationOutput.js +41 -15
- package/dist/cli/commands/prime/orientationOutput.js.map +1 -1
- package/dist/cli/commands/prime.js +4 -3
- package/dist/cli/commands/prime.js.map +1 -1
- package/dist/cli/commands/route.js +142 -0
- package/dist/cli/commands/route.js.map +1 -0
- package/dist/cli/commands/schema.js +21 -23
- package/dist/cli/commands/schema.js.map +1 -1
- package/dist/cli/commands/state/write.js +19 -0
- package/dist/cli/commands/state/write.js.map +1 -1
- package/dist/cli/commands/upgrade.js +1 -1
- package/dist/cli/commands/upgrade.js.map +1 -1
- package/dist/cli/commands/validate.js +2 -119
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/commands/verify.js +17 -1
- package/dist/cli/commands/verify.js.map +1 -1
- package/dist/cli/dispatch/check.js +2 -7
- package/dist/cli/dispatch/check.js.map +1 -1
- package/dist/cli/dispatch/index.js +18 -0
- package/dist/cli/dispatch/index.js.map +1 -1
- package/dist/cli/dispatch/lifecycle.js +7 -5
- package/dist/cli/dispatch/lifecycle.js.map +1 -1
- package/dist/cli/errors.js +2 -2
- package/dist/cli/errors.js.map +1 -1
- package/dist/cli/help.js +24 -5
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/migrationRequired.js +1 -1
- package/dist/cli/migrationRequired.js.map +1 -1
- package/dist/eval/hybridRouteEvaluation.js +156 -0
- package/dist/eval/hybridRouteEvaluation.js.map +1 -0
- package/dist/registries/capabilityContract.js +5 -20
- package/dist/registries/capabilityContract.js.map +1 -1
- package/dist/registries/hybridRoute.js +203 -0
- package/dist/registries/hybridRoute.js.map +1 -0
- package/dist/registries/hybridRouteReceipt.js +221 -0
- package/dist/registries/hybridRouteReceipt.js.map +1 -0
- package/dist/registries/triggerLoader.js +7 -43
- package/dist/registries/triggerLoader.js.map +1 -1
- package/dist/release/releaseMetadata.js +2 -0
- package/dist/release/releaseMetadata.js.map +1 -1
- package/dist/runtime/lifecycleAuthority.js +10 -11
- package/dist/runtime/lifecycleAuthority.js.map +1 -1
- package/dist/runtime/nativeResourceCleanup.js +317 -0
- package/dist/runtime/nativeResourceCleanup.js.map +1 -0
- package/dist/setup/codex/cli.js +9 -40
- package/dist/setup/codex/cli.js.map +1 -1
- package/dist/setup/codex/configToml.js +2 -83
- package/dist/setup/codex/configToml.js.map +1 -1
- package/dist/setup/codex/constants.js +0 -15
- package/dist/setup/codex/constants.js.map +1 -1
- package/dist/setup/codex/state.js +2 -20
- package/dist/setup/codex/state.js.map +1 -1
- package/dist/setup/codex.js +2 -4
- package/dist/setup/codex.js.map +1 -1
- package/dist/state/archiveDiscovery.js +24 -35
- package/dist/state/archiveDiscovery.js.map +1 -1
- package/dist/state/canonicalMigrationRecord.js +37 -0
- package/dist/state/canonicalMigrationRecord.js.map +1 -0
- package/dist/state/decisionEntities.js +73 -33
- package/dist/state/decisionEntities.js.map +1 -1
- package/dist/state/decisionLegacyValidation.js +31 -0
- package/dist/state/decisionLegacyValidation.js.map +1 -1
- package/dist/state/decisionMigrationProvenance.js +117 -0
- package/dist/state/decisionMigrationProvenance.js.map +1 -0
- package/dist/state/durability.js +24 -5
- package/dist/state/durability.js.map +1 -1
- package/dist/state/entityCutover.js +2 -2
- package/dist/state/entityCutover.js.map +1 -1
- package/dist/state/entityMigrationCausality.js +99 -0
- package/dist/state/entityMigrationCausality.js.map +1 -0
- package/dist/state/entityMigrationPreview.js +138 -77
- package/dist/state/entityMigrationPreview.js.map +1 -1
- package/dist/state/entityStorage.js +59 -24
- package/dist/state/entityStorage.js.map +1 -1
- package/dist/state/healthEntities.js +69 -33
- package/dist/state/healthEntities.js.map +1 -1
- package/dist/state/healthEntityValidation.js +14 -1
- package/dist/state/healthEntityValidation.js.map +1 -1
- package/dist/state/legacySummaryRecord.js +7 -0
- package/dist/state/legacySummaryRecord.js.map +1 -0
- package/dist/state/listCursor.js +43 -0
- package/dist/state/listCursor.js.map +1 -0
- package/dist/state/migrationSourceBinding.js +29 -0
- package/dist/state/migrationSourceBinding.js.map +1 -0
- package/dist/state/progressEntities.js +35 -59
- package/dist/state/progressEntities.js.map +1 -1
- package/dist/state/retrievalAuthority.js +10 -0
- package/dist/state/retrievalAuthority.js.map +1 -1
- package/dist/state/summaryEntityRead.js +26 -0
- package/dist/state/summaryEntityRead.js.map +1 -0
- package/dist/state/summaryMigrationProvenance.js +67 -0
- package/dist/state/summaryMigrationProvenance.js.map +1 -0
- package/dist/state/summarySourceRowAuthority.js +37 -0
- package/dist/state/summarySourceRowAuthority.js.map +1 -0
- package/dist/state/write/explain.js +2 -1
- package/dist/state/write/explain.js.map +1 -1
- package/dist/upgrade/lifecycleUpgrade.js +14 -14
- package/dist/upgrade/lifecycleUpgrade.js.map +1 -1
- package/dist/upgrade/upgradeOrchestrator.js +12 -12
- package/dist/upgrade/upgradeOrchestrator.js.map +1 -1
- package/dist/validate/capability.js +11 -2
- package/dist/validate/capability.js.map +1 -1
- package/package.json +2 -2
- package/bundle/references/analysis/analytics-boundary-proportional-2026-07-20.yaml +0 -74
- package/bundle/references/analysis/evidence/analytics-boundary-proportional-2026-07-20/source-focused-1.json.gz +0 -0
- package/bundle/references/analysis/evidence/analytics-boundary-proportional-2026-07-20/source-focused-2.json.gz +0 -0
- package/bundle/references/analysis/evidence/analytics-boundary-proportional-2026-07-20/source-focused-3.json.gz +0 -0
- package/bundle/references/analysis/evidence/migration-pagination-proportional-2026-07-20/source-focused-1.json.gz +0 -0
- package/bundle/references/analysis/evidence/migration-pagination-proportional-2026-07-20/source-focused-2.json.gz +0 -0
- package/bundle/references/analysis/evidence/migration-pagination-proportional-2026-07-20/source-focused-3.json.gz +0 -0
- package/bundle/references/analysis/evidence/verification-baseline-2026-07-20/precommit-cli-route.log.gz +0 -0
- package/bundle/references/analysis/evidence/verification-baseline-2026-07-20/precommit-cli.log.gz +0 -0
- package/bundle/references/analysis/evidence/verification-baseline-2026-07-20/precommit-documentation.log.gz +0 -0
- package/bundle/references/analysis/evidence/verification-baseline-2026-07-20/recompute.mjs +0 -98
- package/bundle/references/analysis/evidence/verification-baseline-2026-07-20/source-1.json.gz +0 -0
- package/bundle/references/analysis/evidence/verification-baseline-2026-07-20/source-2.json.gz +0 -0
- package/bundle/references/analysis/evidence/verification-baseline-2026-07-20/source-3.json.gz +0 -0
- package/bundle/references/analysis/migration-pagination-proportional-2026-07-20.yaml +0 -64
- package/bundle/references/analysis/verification-baseline-2026-07-20.yaml +0 -313
- package/bundle/references/analysis/verification-final-proof-2026-07-21.yaml +0 -340
- package/bundle/references/analysis/worker-policy-2026-07-21.yaml +0 -207
- package/bundle/skills/agentera/agents/audit.toml +0 -6
- package/bundle/skills/agentera/agents/build.toml +0 -6
- package/bundle/skills/agentera/agents/design.toml +0 -6
- package/bundle/skills/agentera/agents/discuss.toml +0 -6
- package/bundle/skills/agentera/agents/document.toml +0 -6
- package/bundle/skills/agentera/agents/optimize.toml +0 -6
- package/bundle/skills/agentera/agents/orchestrate.toml +0 -6
- package/bundle/skills/agentera/agents/plan.toml +0 -6
- package/bundle/skills/agentera/agents/profile.toml +0 -6
- package/bundle/skills/agentera/agents/research.toml +0 -6
- package/bundle/skills/agentera/agents/status.toml +0 -6
- package/bundle/skills/agentera/agents/vision.toml +0 -6
- package/dist/runtime/retiredRuntimeCleanup.js +0 -238
- package/dist/runtime/retiredRuntimeCleanup.js.map +0 -1
- package/dist/setup/codex/agents.js +0 -96
- package/dist/setup/codex/agents.js.map +0 -1
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { loadYamlMapping } from "../core/yaml.js";
|
|
4
|
-
import { resolveSourceRoot } from "../core/sourceRoot.js";
|
|
5
|
-
import { LIFECYCLE_OPERATION_CONTRACT_RELATIVE_PATH, LIFECYCLE_MANUAL_REVIEW_GUIDANCE, applyLifecycleOperations, createLifecycleOwnershipManifest, emptyLifecycleOwnershipLedger, planLifecycleOperations, validateLifecycleOwnershipLedger, } from "./lifecycleOperations.js";
|
|
6
|
-
import { LIFECYCLE_AUTHORITY_RELATIVE_PATH, RETIRED_RUNTIME_CLEANUP_CONTRACT_RELATIVE_PATH, } from "./lifecycleAuthority.js";
|
|
7
|
-
function isMapping(value) {
|
|
8
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
9
|
-
}
|
|
10
|
-
function stringList(value) {
|
|
11
|
-
return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : [];
|
|
12
|
-
}
|
|
13
|
-
export function validateRetiredRuntimeCleanupContractData(value) {
|
|
14
|
-
if (!isMapping(value))
|
|
15
|
-
return ["retired runtime cleanup contract must be a YAML object"];
|
|
16
|
-
const errors = [];
|
|
17
|
-
if (value.schema_version !== "agentera.retiredRuntimeResources.v1") {
|
|
18
|
-
errors.push("schema_version must be agentera.retiredRuntimeResources.v1");
|
|
19
|
-
}
|
|
20
|
-
if (value.status !== "retired_migration_contract")
|
|
21
|
-
errors.push("status must be retired_migration_contract");
|
|
22
|
-
if (value.decision !== 92)
|
|
23
|
-
errors.push("decision must cite approved Decision 92");
|
|
24
|
-
if (value.authority !== LIFECYCLE_AUTHORITY_RELATIVE_PATH) {
|
|
25
|
-
errors.push(`authority must point to ${LIFECYCLE_AUTHORITY_RELATIVE_PATH}`);
|
|
26
|
-
}
|
|
27
|
-
if (value.operation_contract !== LIFECYCLE_OPERATION_CONTRACT_RELATIVE_PATH) {
|
|
28
|
-
errors.push(`operation_contract must point to ${LIFECYCLE_OPERATION_CONTRACT_RELATIVE_PATH}`);
|
|
29
|
-
}
|
|
30
|
-
const policy = isMapping(value.policy) ? value.policy : {};
|
|
31
|
-
if (policy.active_inventory_exposure !== "forbidden"
|
|
32
|
-
|| policy.preview !== "strictly_read_only"
|
|
33
|
-
|| policy.apply_requires !== "explicit_approval"
|
|
34
|
-
|| policy.ownership !== "matching_whole_resource_legacy_ledger_identity_and_fingerprint"
|
|
35
|
-
|| policy.unsupported_platform_result !== "action_required") {
|
|
36
|
-
errors.push("policy must fail closed with pure preview, explicit approval, and legacy ledger ownership");
|
|
37
|
-
}
|
|
38
|
-
const runtimes = value.retired_runtimes;
|
|
39
|
-
if (!Array.isArray(runtimes) || runtimes.length !== 1 || !isMapping(runtimes[0])) {
|
|
40
|
-
return [...errors, "retired_runtimes must contain exactly one Claude migration record"];
|
|
41
|
-
}
|
|
42
|
-
const claude = runtimes[0];
|
|
43
|
-
if (claude.id !== "claude"
|
|
44
|
-
|| claude.active_runtime !== false
|
|
45
|
-
|| claude.source_product !== "claude-code") {
|
|
46
|
-
errors.push("retired Claude record must be inactive with source_product claude-code");
|
|
47
|
-
}
|
|
48
|
-
const resources = claude.resources;
|
|
49
|
-
if (!Array.isArray(resources) || resources.length !== 1 || !isMapping(resources[0])) {
|
|
50
|
-
errors.push("Claude cleanup must declare exactly one legacy Agentera resource");
|
|
51
|
-
}
|
|
52
|
-
else if (resources[0].id !== "claude.agentera-skill-link"
|
|
53
|
-
|| resources[0].kind !== "symlink"
|
|
54
|
-
|| resources[0].intent !== "remove"
|
|
55
|
-
|| resources[0].destination !== "{home}/.claude/skills/agentera"
|
|
56
|
-
|| resources[0].ledger_status !== "legacy") {
|
|
57
|
-
errors.push("Claude cleanup resource must be the legacy-ledger Agentera skill symlink removal");
|
|
58
|
-
}
|
|
59
|
-
const neverTouch = stringList(claude.never_touch);
|
|
60
|
-
for (const required of ["projects", "settings", "credentials", "conversations", "cache", "stats"]) {
|
|
61
|
-
if (!neverTouch.some((entry) => entry.toLowerCase().includes(required))) {
|
|
62
|
-
errors.push(`Claude never_touch must cover ${required}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return errors;
|
|
66
|
-
}
|
|
67
|
-
export function loadRetiredRuntimeCleanupContract(contractPath = path.join(resolveSourceRoot(), RETIRED_RUNTIME_CLEANUP_CONTRACT_RELATIVE_PATH)) {
|
|
68
|
-
const data = loadYamlMapping(fs.readFileSync(contractPath, "utf8"));
|
|
69
|
-
const errors = validateRetiredRuntimeCleanupContractData(data);
|
|
70
|
-
if (errors.length > 0)
|
|
71
|
-
throw new Error(`Retired runtime cleanup contract validation failed: ${errors.join("; ")}`);
|
|
72
|
-
const runtimes = data.retired_runtimes.map((runtime) => ({
|
|
73
|
-
id: runtime.id,
|
|
74
|
-
displayName: runtime.display_name,
|
|
75
|
-
sourceProduct: runtime.source_product,
|
|
76
|
-
resources: runtime.resources.map((resource) => ({
|
|
77
|
-
id: resource.id,
|
|
78
|
-
kind: resource.kind,
|
|
79
|
-
destination: resource.destination,
|
|
80
|
-
ledgerStatus: resource.ledger_status,
|
|
81
|
-
})),
|
|
82
|
-
neverTouch: runtime.never_touch,
|
|
83
|
-
safetyNote: runtime.safety_note,
|
|
84
|
-
}));
|
|
85
|
-
return { sourcePath: contractPath, runtimes };
|
|
86
|
-
}
|
|
87
|
-
export function validateRetiredRuntimeCleanupContractRoot(root = resolveSourceRoot()) {
|
|
88
|
-
const contractPath = path.join(root, RETIRED_RUNTIME_CLEANUP_CONTRACT_RELATIVE_PATH);
|
|
89
|
-
if (!fs.existsSync(contractPath)) {
|
|
90
|
-
return [`${RETIRED_RUNTIME_CLEANUP_CONTRACT_RELATIVE_PATH}: missing retired runtime cleanup contract`];
|
|
91
|
-
}
|
|
92
|
-
try {
|
|
93
|
-
return validateRetiredRuntimeCleanupContractData(loadYamlMapping(fs.readFileSync(contractPath, "utf8"))).map((error) => `${RETIRED_RUNTIME_CLEANUP_CONTRACT_RELATIVE_PATH}: ${error}`);
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
return [`${RETIRED_RUNTIME_CLEANUP_CONTRACT_RELATIVE_PATH}: could not parse contract: ${error.message}`];
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function expandHome(template, home) {
|
|
100
|
-
if (!template.startsWith("{home}/") || template.includes("..")) {
|
|
101
|
-
throw new Error(`unsafe retired runtime destination template: ${template}`);
|
|
102
|
-
}
|
|
103
|
-
return path.join(path.resolve(home), template.slice("{home}/".length));
|
|
104
|
-
}
|
|
105
|
-
function legacyLedgerDiagnostics(plan) {
|
|
106
|
-
const ledger = plan.request.ledger ?? emptyLifecycleOwnershipLedger();
|
|
107
|
-
const diagnostics = [];
|
|
108
|
-
for (const operation of plan.request.operations) {
|
|
109
|
-
const planned = plan.operations.find((candidate) => candidate.id === operation.id);
|
|
110
|
-
const records = ledger.records.filter((record) => record.resourceId === operation.id);
|
|
111
|
-
if (records.length === 0 && planned?.action === "noop")
|
|
112
|
-
continue;
|
|
113
|
-
if (records.length !== 1) {
|
|
114
|
-
diagnostics.push(`${operation.id}: retired cleanup requires exactly one ownership ledger record`);
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
const record = records[0];
|
|
118
|
-
if (record.status !== "legacy"
|
|
119
|
-
|| record.scope !== "whole"
|
|
120
|
-
|| path.resolve(record.destination) !== path.resolve(operation.destination)
|
|
121
|
-
|| record.kind !== operation.kind
|
|
122
|
-
|| record.identity === null
|
|
123
|
-
|| record.fingerprint === null) {
|
|
124
|
-
diagnostics.push(`${operation.id}: retired cleanup requires matching whole-resource ledger status legacy with identity and fingerprint`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return diagnostics;
|
|
128
|
-
}
|
|
129
|
-
function blockedRetiredPlan(plan, diagnostics) {
|
|
130
|
-
const reason = `${diagnostics.join("; ")} ${LIFECYCLE_MANUAL_REVIEW_GUIDANCE}`;
|
|
131
|
-
return {
|
|
132
|
-
...plan,
|
|
133
|
-
operations: plan.operations.map((operation) => operation.action === "noop"
|
|
134
|
-
? operation
|
|
135
|
-
: operation.action === "remove" && operation.ownership === "managed"
|
|
136
|
-
? {
|
|
137
|
-
...operation,
|
|
138
|
-
state: "ambiguous_ownership",
|
|
139
|
-
ownership: "ambiguous",
|
|
140
|
-
action: "blocked_unowned",
|
|
141
|
-
reason,
|
|
142
|
-
}
|
|
143
|
-
: {
|
|
144
|
-
...operation,
|
|
145
|
-
reason: `${operation.reason}; ${reason}`,
|
|
146
|
-
}),
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
export function previewRetiredRuntimeCleanup(opts) {
|
|
150
|
-
const contract = opts.contract ?? loadRetiredRuntimeCleanupContract();
|
|
151
|
-
const runtime = contract.runtimes.find((candidate) => candidate.id === opts.runtimeId);
|
|
152
|
-
if (!runtime)
|
|
153
|
-
throw new Error(`unknown retired runtime cleanup id: ${opts.runtimeId}`);
|
|
154
|
-
const operations = runtime.resources.map((resource) => ({
|
|
155
|
-
id: resource.id,
|
|
156
|
-
destination: expandHome(resource.destination, opts.home),
|
|
157
|
-
kind: resource.kind,
|
|
158
|
-
intent: "remove",
|
|
159
|
-
required: true,
|
|
160
|
-
}));
|
|
161
|
-
const suppliedLedger = opts.ledger ?? emptyLifecycleOwnershipLedger();
|
|
162
|
-
const ledgerErrors = validateLifecycleOwnershipLedger(suppliedLedger);
|
|
163
|
-
const plan = planLifecycleOperations({
|
|
164
|
-
allowedRoots: [path.resolve(opts.home)],
|
|
165
|
-
operations,
|
|
166
|
-
manifest: createLifecycleOwnershipManifest(operations),
|
|
167
|
-
ledger: ledgerErrors.length === 0 ? suppliedLedger : emptyLifecycleOwnershipLedger(),
|
|
168
|
-
});
|
|
169
|
-
const ledgerDiagnostics = ledgerErrors.length > 0
|
|
170
|
-
? ledgerErrors.map((error) => `invalid ownership ledger: ${error}`)
|
|
171
|
-
: legacyLedgerDiagnostics(plan);
|
|
172
|
-
const authorizedPlan = ledgerDiagnostics.length === 0
|
|
173
|
-
? plan
|
|
174
|
-
: blockedRetiredPlan(plan, ledgerDiagnostics);
|
|
175
|
-
return {
|
|
176
|
-
schemaVersion: "agentera.retiredRuntimeCleanupPreview.v1",
|
|
177
|
-
mode: "preview",
|
|
178
|
-
runtimeId: runtime.id,
|
|
179
|
-
activeRuntime: false,
|
|
180
|
-
sourceProduct: runtime.sourceProduct,
|
|
181
|
-
approvalRequired: true,
|
|
182
|
-
ownershipRequirement: "matching_whole_resource_legacy_ledger",
|
|
183
|
-
ledgerAuthorization: ledgerDiagnostics.length === 0 ? "legacy_match_or_absent_noop" : "blocked",
|
|
184
|
-
ledgerDiagnostics,
|
|
185
|
-
plan: authorizedPlan,
|
|
186
|
-
neverTouch: runtime.neverTouch.map((entry) => expandHome(entry, opts.home)),
|
|
187
|
-
safetyNote: runtime.safetyNote,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
function approvalRequiredResult(preview) {
|
|
191
|
-
const operations = preview.plan.operations.map((operation) => ({
|
|
192
|
-
...operation,
|
|
193
|
-
action: operation.action === "noop" || operation.action === "blocked_unowned"
|
|
194
|
-
? operation.action
|
|
195
|
-
: "action_required",
|
|
196
|
-
status: operation.action === "noop"
|
|
197
|
-
? "noop"
|
|
198
|
-
: operation.action === "blocked_unowned"
|
|
199
|
-
? "blocked_unowned"
|
|
200
|
-
: "action_required",
|
|
201
|
-
dependencyCauses: [],
|
|
202
|
-
reason: operation.action === "noop" || operation.action === "blocked_unowned"
|
|
203
|
-
? operation.reason
|
|
204
|
-
: "explicit cleanup approval is required",
|
|
205
|
-
}));
|
|
206
|
-
const summary = {
|
|
207
|
-
applied: 0,
|
|
208
|
-
noop: operations.filter((item) => item.status === "noop").length,
|
|
209
|
-
failed: 0,
|
|
210
|
-
blocked_unowned: operations.filter((item) => item.status === "blocked_unowned").length,
|
|
211
|
-
skipped_dependency: 0,
|
|
212
|
-
action_required: operations.filter((item) => item.status === "action_required").length,
|
|
213
|
-
};
|
|
214
|
-
return {
|
|
215
|
-
schemaVersion: "agentera.lifecycleApplyResult.v1",
|
|
216
|
-
status: operations.every((item) => item.status === "noop") ? "success" : "non_success",
|
|
217
|
-
operations,
|
|
218
|
-
summary,
|
|
219
|
-
requiredUnmet: operations.filter((item) => item.required && item.status !== "noop").map((item) => item.id),
|
|
220
|
-
ownershipLedger: preview.plan.request.ledger ?? emptyLifecycleOwnershipLedger(),
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
export function applyRetiredRuntimeCleanup(preview, options) {
|
|
224
|
-
const currentLedgerDiagnostics = legacyLedgerDiagnostics(preview.plan);
|
|
225
|
-
const authorized = preview.ledgerAuthorization === "legacy_match_or_absent_noop"
|
|
226
|
-
&& currentLedgerDiagnostics.length === 0;
|
|
227
|
-
const result = options.approved && authorized
|
|
228
|
-
? applyLifecycleOperations(preview.plan, options)
|
|
229
|
-
: approvalRequiredResult(preview);
|
|
230
|
-
return {
|
|
231
|
-
...result,
|
|
232
|
-
runtimeId: preview.runtimeId,
|
|
233
|
-
activeRuntime: false,
|
|
234
|
-
sourceProduct: preview.sourceProduct,
|
|
235
|
-
approval: options.approved ? "approved" : "required",
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
//# sourceMappingURL=retiredRuntimeCleanup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retiredRuntimeCleanup.js","sourceRoot":"","sources":["../../../../../home/jgabor/git/agentera/packages/cli/src/runtime/retiredRuntimeCleanup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,0CAA0C,EAC1C,gCAAgC,EAChC,wBAAwB,EACxB,gCAAgC,EAChC,6BAA6B,EAC7B,uBAAuB,EACvB,gCAAgC,GAQjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,iCAAiC,EACjC,8CAA8C,GAC/C,MAAM,yBAAyB,CAAC;AA6CjC,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9F,CAAC;AAED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
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { expanduser, isFile, pathExists } from "../../core/paths.js";
|
|
4
|
-
import { CAPABILITY_AGENT_NAMES } from "./constants.js";
|
|
5
|
-
export function codexAgentSourceDir(installRoot) {
|
|
6
|
-
const candidates = [
|
|
7
|
-
path.join(installRoot, "app", "skills", "agentera", "agents"),
|
|
8
|
-
path.join(installRoot, "skills", "agentera", "agents"),
|
|
9
|
-
];
|
|
10
|
-
for (const candidate of candidates) {
|
|
11
|
-
try {
|
|
12
|
-
if (fs.statSync(candidate).isDirectory())
|
|
13
|
-
return candidate;
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
/* not a dir */
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return candidates[0];
|
|
20
|
-
}
|
|
21
|
-
export function defaultAgentsDirForConfig(configPath) {
|
|
22
|
-
const expanded = expanduser(configPath);
|
|
23
|
-
if (path.basename(expanded) === "config.toml" && path.basename(path.dirname(expanded)) === ".codex") {
|
|
24
|
-
return path.join(path.dirname(expanded), "agents");
|
|
25
|
-
}
|
|
26
|
-
throw new Error("Codex agent descriptors can be inferred only for documented config layouts: " +
|
|
27
|
-
"~/.codex/config.toml or <project>/.codex/config.toml. " +
|
|
28
|
-
"Pass --agents-dir for nonstandard --config-file paths.");
|
|
29
|
-
}
|
|
30
|
-
function codexDescriptorManaged(text) {
|
|
31
|
-
const lines = text.split(/\r\n|\r|\n/).slice(0, 5);
|
|
32
|
-
return lines.some((line) => line.trim() === "# agentera_managed: true");
|
|
33
|
-
}
|
|
34
|
-
export function planAgentDescriptorChanges(installRoot, agentsDir, opts) {
|
|
35
|
-
const sourceDir = codexAgentSourceDir(installRoot);
|
|
36
|
-
const changes = [];
|
|
37
|
-
for (const name of CAPABILITY_AGENT_NAMES) {
|
|
38
|
-
const source = path.join(sourceDir, `${name}.toml`);
|
|
39
|
-
const target = path.join(agentsDir, `${name}.toml`);
|
|
40
|
-
let sourceText;
|
|
41
|
-
try {
|
|
42
|
-
sourceText = fs.readFileSync(source, "utf8");
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
changes.push({ action: "blocked", name, source, target, message: "source descriptor is missing", content: "" });
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (!pathExists(target)) {
|
|
49
|
-
changes.push({ action: "pending", name, source, target, message: "would install Codex agent descriptor", content: sourceText });
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
if (!isFile(target)) {
|
|
53
|
-
changes.push({ action: "blocked", name, source, target, message: "target exists but is not a regular file", content: sourceText });
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
let targetText;
|
|
57
|
-
try {
|
|
58
|
-
targetText = fs.readFileSync(target, "utf8");
|
|
59
|
-
}
|
|
60
|
-
catch (exc) {
|
|
61
|
-
changes.push({ action: "blocked", name, source, target, message: `cannot read target descriptor: ${exc.message}`, content: sourceText });
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
if (targetText === sourceText) {
|
|
65
|
-
changes.push({ action: "noop", name, source, target, message: "Codex agent descriptor is current", content: sourceText });
|
|
66
|
-
}
|
|
67
|
-
else if (opts.force || codexDescriptorManaged(targetText)) {
|
|
68
|
-
changes.push({ action: "pending", name, source, target, message: "would refresh Codex agent descriptor", content: sourceText });
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
changes.push({
|
|
72
|
-
action: "blocked",
|
|
73
|
-
name,
|
|
74
|
-
source,
|
|
75
|
-
target,
|
|
76
|
-
message: "target exists without Agentera ownership proof; treating it as user-owned",
|
|
77
|
-
content: sourceText,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return changes;
|
|
82
|
-
}
|
|
83
|
-
export function writeAgentDescriptorChanges(changes) {
|
|
84
|
-
for (const change of changes) {
|
|
85
|
-
if (change.action !== "pending")
|
|
86
|
-
continue;
|
|
87
|
-
fs.mkdirSync(path.dirname(change.target), { recursive: true });
|
|
88
|
-
fs.writeFileSync(change.target, change.content, "utf8");
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
function readTextOrNull(p) {
|
|
92
|
-
if (!pathExists(p))
|
|
93
|
-
return null;
|
|
94
|
-
return fs.readFileSync(p, "utf8");
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=agents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../../../../../home/jgabor/git/agentera/packages/cli/src/setup/codex/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAWxD,MAAM,UAAU,mBAAmB,CAAC,WAAmB;IACrD,MAAM,UAAU,GAAG;QACjB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC;QAC7D,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC;KACvD,CAAC;IACF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,CAAC;YACH,IAAI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;gBAAE,OAAO,SAAS,CAAC;QAC7D,CAAC;QAAC,MAAM,CAAC;YACP,eAAe;QACjB,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,UAAkB;IAC1D,MAAM,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACxC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAA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