refactor(monorepo): extract inbox and orch runtimes

This commit is contained in:
2026-03-20 13:08:33 +08:00
parent 1938eb8f07
commit 9b8e886289
78 changed files with 10516 additions and 77 deletions
+44 -2
View File
@@ -5,15 +5,17 @@ set -euo pipefail
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
readonly MANIFEST_PATH="${REPO_ROOT}/scripts/skill-bundles.json"
BUILD_DIR=""
usage() {
cat <<'EOF'
Usage:
package_skill_runtimes.sh plan
package_skill_runtimes.sh validate
package_skill_runtimes.sh package
Phase 1 only bootstraps declarative bundle metadata.
Actual runtime packaging will be added once package-owned entrypoints exist.
The bundle manifest is package-oriented. Bundles in state=planned are skipped by
the package command until their package-owned entrypoints exist.
EOF
}
@@ -44,6 +46,12 @@ emit_bundles() {
' "${MANIFEST_PATH}"
}
cleanup() {
if [[ -n "${BUILD_DIR}" && -d "${BUILD_DIR}" ]]; then
rm -rf "${BUILD_DIR}"
fi
}
plan() {
printf 'skill bundle plan from %s\n' "${MANIFEST_PATH}"
while IFS=$'\t' read -r skill type runtime_package entrypoint output build_state; do
@@ -98,6 +106,37 @@ validate() {
printf 'skill bundle manifest validated\n'
}
package_bundles() {
validate
require_command go
require_command install
require_command mktemp
BUILD_DIR="$(mktemp -d "${TMPDIR:-/tmp}/skill-runtimes.XXXXXX")"
trap cleanup EXIT INT TERM
while IFS=$'\t' read -r skill type runtime_package entrypoint output build_state; do
if [[ "${build_state}" != "ready" ]]; then
printf 'skipping %s (%s)\n' "${skill}" "${build_state}"
continue
fi
local output_path="${REPO_ROOT}/${output}"
local artifact_path="${BUILD_DIR}/${skill}"
printf 'building %s from %s\n' "${skill}" "${entrypoint}"
(
cd "${REPO_ROOT}"
go build -trimpath -o "${artifact_path}" "${entrypoint}"
)
mkdir -p "$(dirname "${output_path}")"
install -m 0755 "${artifact_path}" "${output_path}"
printf 'installed %s\n' "${output}"
done < <(emit_bundles)
}
main() {
require_command node
@@ -109,6 +148,9 @@ main() {
validate)
validate
;;
package)
package_bundles
;;
""|-h|--help|help)
usage
;;