orkeon-code 1.0.0-rc.2 → 1.0.0-rc.3
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/.orkeon-runtime +3 -2
- package/.orkeon-version +1 -1
- package/README.fr.md +1 -1
- package/README.md +1 -1
- package/orkeon-code +307 -74
- package/orkeon-code.ps1 +20 -4
- package/package.json +2 -1
- package/scripts/dev-run.sh +139 -0
- package/src/commands/_lib/status/messages.ts +2 -1
- package/src/commands/_lib/status/meta.ts +5 -4
- package/src/crews/.orkeon/orkeon.d.ts +1 -1
- package/src/crews/_probe-shared-memory/probe.ork.ts +3 -3
- package/src/crews/advisor/crew.ork.ts +1 -1
- package/src/crews/agent-run/crew.ork.ts +1 -1
- package/src/crews/code-review/crew.ork.ts +1 -1
- package/src/crews/dev-batches/crew.ork.ts +1 -1
- package/src/crews/dev-change/domain/change-render.ts +1 -1
- package/src/crews/dev-learn/application/messages.ts +5 -0
- package/src/crews/dev-learn/application/prompts.ts +13 -16
- package/src/crews/dev-learn/application/run-dev-learn.ts +15 -12
- package/src/crews/dev-learn/crew.ork.ts +1 -1
- package/src/crews/dev-learn/domain/learn-answer.ts +38 -13
- package/src/crews/dev-learn/domain/markers.ts +10 -0
- package/src/crews/dev-learn/domain/messages.ts +13 -4
- package/src/crews/dev-plan/crew.ork.ts +1 -1
- package/src/crews/dev-plan/domain/plan-render.ts +3 -3
- package/src/crews/dev-spec/domain/spec-render.ts +3 -3
- package/src/crews/dev-verify/crew.ork.ts +1 -1
- package/src/crews/git-commit/application/draft.ts +22 -18
- package/src/crews/git-commit/application/messages.ts +2 -0
- package/src/crews/git-commit/application/run-git-commit.ts +4 -2
- package/src/crews/git-commit/crew.ork.ts +1 -1
- package/src/crews/init-verifiers/crew.ork.ts +1 -1
- package/src/crews/main-loop/application/run-main-loop.ts +1 -1
- package/src/crews/project-init/crew.ork.ts +1 -1
- package/src/crews/session-compact/crew.ork.ts +1 -1
- package/src/crews/shared-memory-admit/crew.ork.ts +1 -1
- package/src/shared/application/dev/messages.ts +3 -0
- package/src/shared/application/dev/preflight.ts +9 -4
- package/src/shared/domain/dev/learn-proposals.ts +48 -10
- package/src/shared/domain/dev/markers.ts +20 -0
- package/src/shared/domain/dev/messages.ts +12 -0
- package/src/shared/domain/dev/plan-format.ts +1 -1
- package/src/shared/domain/dev/work-folder.ts +2 -1
- package/src/shared/domain/git/close.ts +10 -8
- package/src/shared/domain/git/messages.ts +21 -0
package/.orkeon-runtime
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# The Orkeon runtime the launcher downloads at the first start when the machine has none (ADR 0028).
|
|
2
2
|
# id: the seven characters of the pin the archives were built from; url: the folder holding
|
|
3
|
-
# orkeon-runtime-<id>-<platform>.tar.gz; then one SHA-256 per platform.
|
|
4
|
-
#
|
|
3
|
+
# orkeon-runtime-<id>-<platform>.tar.gz; then one SHA-256 per platform. A release that publishes runtime archives
|
|
4
|
+
# fills this file; none does yet (ADR 0028), so every package and every checkout leaves the id empty, and nothing
|
|
5
|
+
# is downloaded.
|
|
5
6
|
id=
|
|
6
7
|
url=
|
|
7
8
|
linux-x64=
|
package/.orkeon-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d81bfab393ce1f9235ed2711dd770b87398b4345
|
package/README.fr.md
CHANGED
|
@@ -107,7 +107,7 @@ Le REPL est une façon de lancer les crews, pas la seule.
|
|
|
107
107
|
`/mode` pour la session ; en mode `default`, le runtime vous demande avant une modification, une commande ou un
|
|
108
108
|
appel réseau.
|
|
109
109
|
- **Autonome** : en `bypassPermissions`, la boucle mène une tâche jusqu'au bout sans poser de question, sous un budget
|
|
110
|
-
(200 appels d'outils, 30 minutes, 700k tokens de contexte) et la garde du runtime. `
|
|
110
|
+
(200 appels d'outils, 30 minutes, 700k tokens de contexte) et la garde du runtime. `orkeon-code run main-loop` lance le même crew en un
|
|
111
111
|
coup depuis un shell, une ligne de cron ou un job de CI, et imprime son résultat en JSON.
|
|
112
112
|
- **Embarqué** : une application lance l'outil `orkeon` (nuget.org) ou l'image `orkeon` sur un crew et lit le
|
|
113
113
|
JSON ; le démon `orkeon-host` d'Orkeon peut héberger les crews derrière un canal de chat ou un point d'accès A2A.
|
package/README.md
CHANGED
|
@@ -101,7 +101,7 @@ The REPL is one way to run the crews, not the only one.
|
|
|
101
101
|
- **Interactive**: `./orkeon-code` on your project. `plan:` to ask, `acceptEdits:` to let it edit, `/mode` for the
|
|
102
102
|
session; in `default` mode the runtime asks you before an edit, a command or a network call.
|
|
103
103
|
- **Autonomous**: in `bypassPermissions` the loop runs a task to the end without a question, under a budget (200 tool
|
|
104
|
-
calls, 30 minutes, 700k context tokens) and the host gate. `
|
|
104
|
+
calls, 30 minutes, 700k context tokens) and the host gate. `orkeon-code run main-loop` runs the same crew in one shot from a shell, a
|
|
105
105
|
cron line or a CI job, and prints its result as JSON.
|
|
106
106
|
- **Embedded**: an application starts the `orkeon` tool (nuget.org) or the `orkeon` image on a crew and reads
|
|
107
107
|
the JSON; Orkeon's `orkeon-host` daemon can host the crews behind a chat channel or an A2A endpoint. In-process
|
package/orkeon-code
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
# ./orkeon-code --resume [<n> | <id>] # list the saved sessions of this project and pick one
|
|
12
12
|
# ./orkeon-code trust list | add <path> | remove <path> | check <path> [--trust] # check: exit 0, 3 or 4
|
|
13
13
|
# ./orkeon-code setup # write ~/.orkeon-code/appsettings.json (never the key)
|
|
14
|
+
# ./orkeon-code run <crew> [--inputs JSON] [--workspace DIR | --demo] [--trust] [-- orkeon run args]
|
|
15
|
+
# # one crew headless, through `orkeon run` (docs/headless.md)
|
|
14
16
|
#
|
|
15
17
|
# Folder trust: the first start in a folder asks whether you trust it, before anything of it is read
|
|
16
18
|
# or mounted; `y` stores it in ~/.orkeon-code/trusted-folders.json, and every folder below it starts
|
|
@@ -36,13 +38,15 @@
|
|
|
36
38
|
# /resume lists them inside the REPL. A bare --llm-log after -- goes to <state>/llm-logs.
|
|
37
39
|
#
|
|
38
40
|
# Modes (auto-detected in this order, or forced with --mode / ORKEON_CODE_MODE):
|
|
39
|
-
# tool orkeon-repl on PATH (from the orkeon Debian package
|
|
40
|
-
#
|
|
41
|
+
# tool orkeon-repl on PATH (from the orkeon Debian package or the full Orkeon release archive: the dotnet
|
|
42
|
+
# tool installs `orkeon` alone, which `run` uses), or ORKEON_REPL="<command line>"
|
|
43
|
+
# (e.g. "dotnet /opt/orkeon/Orkeon.ConsoleApp.dll")
|
|
41
44
|
# docker ghcr.io/orkeon/orkeon:latest (the last release, not the pin), nothing else to install
|
|
42
45
|
# source an Orkeon checkout named by ORKEON_SOURCE, built there with `dotnet build`, run from the project
|
|
43
|
-
# With none of them, an install
|
|
44
|
-
# (tool mode from then on): `orkeon-code runtime install` does it without starting,
|
|
45
|
-
# answers yes where there is no terminal, `orkeon-code runtime remove` deletes it.
|
|
46
|
+
# With none of them, an install whose package names a runtime (.orkeon-runtime) downloads it once, after asking,
|
|
47
|
+
# into ~/.orkeon-code/runtime (tool mode from then on): `orkeon-code runtime install` does it without starting,
|
|
48
|
+
# ORKEON_CODE_RUNTIME_DOWNLOAD=1 answers yes where there is no terminal, `orkeon-code runtime remove` deletes it.
|
|
49
|
+
# The packages published so far name none: put the orkeon-repl of the full Orkeon release archive of your platform on PATH instead.
|
|
46
50
|
#
|
|
47
51
|
# Settings: --settings, else ORKEON_CODE_SETTINGS, else config/appsettings.local.json (a clone),
|
|
48
52
|
# else ~/.orkeon-code/appsettings.json, else ${XDG_CONFIG_HOME:-~/.config}/orkeon-code/appsettings.json
|
|
@@ -55,6 +59,13 @@
|
|
|
55
59
|
# mounted on /audio (read-only), <state>/transcripts on /transcripts (read-only), and the
|
|
56
60
|
# Whisper MCP server of mcp/whisper is declared to the REPL, run by uv (mcp/whisper/README.md).
|
|
57
61
|
# ORKEON_CODE_VOICE=1 also opens the microphone (/voice) and the speaker (/say, voice.reply).
|
|
62
|
+
#
|
|
63
|
+
# run: <crew> is a name of src/crews (main-loop, git-commit...) or the path of a crew.ork.ts. The project, the trust,
|
|
64
|
+
# the settings and the mounts are the REPL's (/workspace, /output, /tmp, /user-config); the runner is `orkeon run`:
|
|
65
|
+
# tool mode ORKEON_CLI="<command line>", else orkeon on PATH, else the downloaded runtime's bin/orkeon, else in a
|
|
66
|
+
# clone the dotnet tool of .config/dotnet-tools.json; then docker (the image's orkeon entry point); then source
|
|
67
|
+
# (Orkeon.Scripting.Cli of ORKEON_SOURCE); then the runtime the package names, downloaded as for the REPL. The log
|
|
68
|
+
# lines go to stderr, the crew's result to stdout; the exit code is the runner's (0, 1, 2, 130, 75).
|
|
58
69
|
set -euo pipefail
|
|
59
70
|
# A CDPATH from the caller would make cd print the folder it enters, into the paths read from it.
|
|
60
71
|
unset CDPATH
|
|
@@ -72,6 +83,8 @@ resolve_links() { # <path>
|
|
|
72
83
|
# Follow symlinks, so a link from ~/.local/bin still finds the checkout or the install's version folder.
|
|
73
84
|
SELF="$(resolve_links "${BASH_SOURCE[0]}")"
|
|
74
85
|
ROOT="$(cd "$(dirname "$SELF")" && pwd -P)"
|
|
86
|
+
# The folder the launcher was started from: the relative value of a path option given to `run` after -- is read from there.
|
|
87
|
+
CALLER_DIR="$PWD"
|
|
75
88
|
# The pin is a commit of Orkeon's main (.orkeon-version, ADR 0013): the source mode runs it; the tool and docker
|
|
76
89
|
# modes run a release, which the pin never names.
|
|
77
90
|
ORKEON_REF="$(tr -d '[:space:]' < "$ROOT/.orkeon-version")"
|
|
@@ -88,7 +101,8 @@ warn() { echo "orkeon-code: warning: $*" >&2; }
|
|
|
88
101
|
|
|
89
102
|
# ── The runtime downloaded at the first start (ADR 0028) ───────────────────
|
|
90
103
|
# .orkeon-runtime names the archives published for this package: an id, their folder, a SHA-256 per platform. An
|
|
91
|
-
# empty id (a checkout) means there is none. The archive is
|
|
104
|
+
# empty id (a checkout, or a package whose release published none) means there is none. The archive is
|
|
105
|
+
# extracted where it is kept and runs from there.
|
|
92
106
|
RUNTIME_HOME="$CODE_HOME/runtime"
|
|
93
107
|
runtime_field() { # <key>
|
|
94
108
|
[ -f "$ROOT/.orkeon-runtime" ] || return 0
|
|
@@ -112,7 +126,10 @@ sha256() { if command -v sha256sum >/dev/null 2>&1; then sha256sum "$1"; else sh
|
|
|
112
126
|
# and removes the runtimes of earlier packages. Nothing is asked: the callers do.
|
|
113
127
|
download_runtime() {
|
|
114
128
|
local platform sum name work found other
|
|
115
|
-
[ -
|
|
129
|
+
if [ -z "$RUNTIME_ID" ]; then
|
|
130
|
+
[ "$KIND" = install ] || die "this checkout names no runtime to download (.orkeon-runtime): use Docker, orkeon-repl or ORKEON_SOURCE (see docs/getting-started.md)."
|
|
131
|
+
die "this package names no runtime to download (its .orkeon-runtime is empty: its release published none): put the orkeon-repl of the full archive of an Orkeon release (orkeon-<version>-<platform>) on PATH, or use Docker or ORKEON_SOURCE (see docs/getting-started.md)."
|
|
132
|
+
fi
|
|
116
133
|
platform="$(runtime_platform)" && sum="$(runtime_field "$platform")" && [ -n "$sum" ] \
|
|
117
134
|
|| die "no Orkeon runtime is published for this platform ($(uname -s) $(uname -m)): install Docker, or the orkeon-repl tool (see docs/getting-started.md)."
|
|
118
135
|
name="orkeon-runtime-$RUNTIME_ID-$platform.tar.gz"
|
|
@@ -450,7 +467,7 @@ if [ "${1:-}" = trust ]; then
|
|
|
450
467
|
die "$target is not a trusted folder."
|
|
451
468
|
fi
|
|
452
469
|
printf '%s\n' "$kept" | write_trust_store; echo "orkeon-code: $target is no longer trusted."; exit 0 ;;
|
|
453
|
-
check) # 0: it may start; 3: refused, no terminal; 4: declined in the terminal (scripts/run
|
|
470
|
+
check) # 0: it may start; 3: refused, no terminal; 4: declined in the terminal (scripts/dev-run.sh).
|
|
454
471
|
DECLINED=4
|
|
455
472
|
folder="$(canonical_dir "${2:?trust check needs a folder}")" || die "not a folder: $2"
|
|
456
473
|
ensure_trusted "$folder" "$([ "${3:-}" = --trust ] && echo 1 || echo 0)"; exit 0 ;;
|
|
@@ -491,6 +508,19 @@ if [ "${1:-}" = runtime ]; then
|
|
|
491
508
|
case "${2:-}" in
|
|
492
509
|
install)
|
|
493
510
|
if runtime_downloaded; then echo "orkeon-code: Orkeon $RUNTIME_ID is already in $RUNTIME_HOME/$RUNTIME_ID."; exit 0; fi
|
|
511
|
+
# No runtime named, and a REPL of the user's on PATH: there is nothing to download, the start runs that one.
|
|
512
|
+
# ORKEON_REPL names the command line of the user's REPL: its program must be found, and its assembly or script
|
|
513
|
+
# (a path as its second word, `dotnet /path/Orkeon.ConsoleApp.dll`) must be there, or it is no runtime.
|
|
514
|
+
installed_repl=orkeon-repl; repl_target=""; repl_found=1
|
|
515
|
+
if [ -n "${ORKEON_REPL:-}" ]; then read -r installed_repl repl_target _ <<< "$ORKEON_REPL"; fi
|
|
516
|
+
command -v "$installed_repl" >/dev/null 2>&1 || repl_found=0
|
|
517
|
+
case "$repl_target" in */*) [ -e "$repl_target" ] || repl_found=0 ;; esac
|
|
518
|
+
if [ -z "$RUNTIME_ID" ] && [ -n "${ORKEON_REPL:-}" ] && [ "$repl_found" = 0 ]; then
|
|
519
|
+
die "nothing to download (.orkeon-runtime names no runtime), and ORKEON_REPL names no runtime found here ($ORKEON_REPL): fix ORKEON_REPL, or unset it and put the orkeon-repl of the full archive of an Orkeon release on PATH (see docs/getting-started.md)."
|
|
520
|
+
fi
|
|
521
|
+
if [ -z "$RUNTIME_ID" ] && [ "$repl_found" = 1 ]; then
|
|
522
|
+
echo "orkeon-code: nothing to download (.orkeon-runtime names no runtime): the runtime used is $(runtime_found tool)."; exit 0
|
|
523
|
+
fi
|
|
494
524
|
download_runtime; exit 0 ;;
|
|
495
525
|
remove)
|
|
496
526
|
rm -rf "$RUNTIME_HOME"; echo "orkeon-code: no downloaded runtime left in $RUNTIME_HOME."; exit 0 ;;
|
|
@@ -577,6 +607,35 @@ if [ "${1:-}" = setup ]; then
|
|
|
577
607
|
exit 0
|
|
578
608
|
fi
|
|
579
609
|
|
|
610
|
+
# ── run: one crew, headless ────────────────────────────────────────────────
|
|
611
|
+
# The crew's script: a name of src/crews, or the path of a crew.ork.ts (a probe of a clone). The start then goes
|
|
612
|
+
# through the project, the trust and the settings as for the REPL, and `run_crew` execs `orkeon run` at the mode.
|
|
613
|
+
RUN_CREW=""
|
|
614
|
+
RUN_INPUTS=""
|
|
615
|
+
RUN_USAGE="usage: orkeon-code run <crew | path/to/crew.ork.ts> [--inputs JSON] [--workspace DIR | --demo] [--trust] [--settings FILE] [--mode docker|tool|source] [-- orkeon run args]"
|
|
616
|
+
crew_names() {
|
|
617
|
+
local f n out=""
|
|
618
|
+
for f in "$ROOT"/src/crews/*/crew.ork.ts; do
|
|
619
|
+
n="${f%/crew.ork.ts}"; n="${n##*/}"
|
|
620
|
+
case "$n" in _*|'*') ;; *) out="${out:+$out, }$n" ;; esac
|
|
621
|
+
done
|
|
622
|
+
printf '%s' "$out"
|
|
623
|
+
}
|
|
624
|
+
if [ "${1:-}" = run ]; then
|
|
625
|
+
case "${2:-}" in -h|--help) echo "$RUN_USAGE"; exit 0 ;; ''|-*) die "$RUN_USAGE" ;; esac
|
|
626
|
+
case "$2" in
|
|
627
|
+
*/*|*.ts)
|
|
628
|
+
[ -f "$2" ] || die "crew not found: $2"
|
|
629
|
+
RUN_CREW="$(cd "$(dirname "$2")" && pwd -P)/$(basename "$2")" ;;
|
|
630
|
+
*)
|
|
631
|
+
name_ok=1
|
|
632
|
+
case "$2" in *[!a-z0-9_-]*) name_ok=0 ;; esac
|
|
633
|
+
if [ "$name_ok" = 1 ] && [ -f "$ROOT/src/crews/$2/crew.ork.ts" ]; then RUN_CREW="$ROOT/src/crews/$2/crew.ork.ts"
|
|
634
|
+
else die "no crew '$2' in $ROOT/src/crews (the crews: $(crew_names))."; fi ;;
|
|
635
|
+
esac
|
|
636
|
+
shift 2
|
|
637
|
+
fi
|
|
638
|
+
|
|
580
639
|
MODE="${ORKEON_CODE_MODE:-}"
|
|
581
640
|
WORKSPACE=""
|
|
582
641
|
SETTINGS="${ORKEON_CODE_SETTINGS:-}"
|
|
@@ -587,6 +646,7 @@ CONTINUE=0
|
|
|
587
646
|
RESUME=0
|
|
588
647
|
RESUME_CHOICE=""
|
|
589
648
|
EXTRA=()
|
|
649
|
+
# How many words of EXTRA came before --: `orkeon-code run` reads the words after it as `orkeon run`'s.
|
|
590
650
|
while [ $# -gt 0 ]; do
|
|
591
651
|
case "$1" in
|
|
592
652
|
--mode) MODE="${2:?--mode needs docker|tool|source}"; shift 2 ;;
|
|
@@ -598,17 +658,26 @@ while [ $# -gt 0 ]; do
|
|
|
598
658
|
--demo) DEMO=1; shift ;;
|
|
599
659
|
--version) VERSION_ONLY=1; shift ;;
|
|
600
660
|
--trust) TRUST_FLAG=1; shift ;;
|
|
661
|
+
--inputs) RUN_INPUTS="${2:?--inputs needs a JSON object}"; shift 2 ;;
|
|
662
|
+
--inputs=*) RUN_INPUTS="${1#*=}"; shift ;;
|
|
601
663
|
-c|--continue) CONTINUE=1; shift ;;
|
|
602
664
|
--resume=*) RESUME=1; RESUME_CHOICE="${1#*=}"; shift ;;
|
|
603
665
|
--resume)
|
|
604
666
|
RESUME=1; shift
|
|
605
667
|
case "${1:-}" in ''|-*) ;; *) RESUME_CHOICE="$1"; shift ;; esac ;;
|
|
606
|
-
-h|--help)
|
|
607
|
-
|
|
668
|
+
-h|--help)
|
|
669
|
+
if [ -n "$RUN_CREW" ]; then echo "$RUN_USAGE"; exit 0; fi
|
|
670
|
+
awk 'NR > 1 && /^set -euo pipefail/ { exit } NR > 1' "$SELF" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
|
671
|
+
--) shift; EXTRA+=("$@"); break ;;
|
|
608
672
|
*) EXTRA+=("$1"); shift ;;
|
|
609
673
|
esac
|
|
610
674
|
done
|
|
611
675
|
|
|
676
|
+
if [ -n "$RUN_CREW" ]; then
|
|
677
|
+
[ "$CONTINUE" = 0 ] && [ "$RESUME" = 0 ] && [ "$VERSION_ONLY" = 0 ] \
|
|
678
|
+
|| die "--continue, --resume and --version are the REPL's: a run is one turn, with no session ($RUN_USAGE)."
|
|
679
|
+
elif [ -n "$RUN_INPUTS" ]; then die "--inputs belongs to 'orkeon-code run <crew>': the REPL reads no inputs."
|
|
680
|
+
fi
|
|
612
681
|
if [ "$CONTINUE" = 1 ] && [ "$RESUME" = 1 ]; then die "--continue and --resume do not go together: one brings the last session back, the other the one you pick."; fi
|
|
613
682
|
|
|
614
683
|
if [ "$VERSION_ONLY" = 1 ]; then
|
|
@@ -668,6 +737,225 @@ if [ -n "${ORKEON_CODE_MODEL:-}" ]; then export ORKEON_Llm__Model="$ORKEON_CODE_
|
|
|
668
737
|
# is checked. On by default here; a settings file can still turn it off.
|
|
669
738
|
export Orkeon__Security__PermissionGate__Enabled="${Orkeon__Security__PermissionGate__Enabled:-true}"
|
|
670
739
|
|
|
740
|
+
# The identity of a commit made in the container (/commit, the close of a dev step): the image sets none and reads no
|
|
741
|
+
# ~/.gitconfig of the host (HOME=/tmp), and Orkeon 1.3.0 hands GIT_AUTHOR_* and GIT_COMMITTER_* to shell_command
|
|
742
|
+
# (Orkeon #404). Each variable already exported is kept; one unset takes the user.name or user.email git gives on
|
|
743
|
+
# the host for the workspace, when git is there and gives one. Sets GIT_IDENTITY_VARS, the names to hand over.
|
|
744
|
+
GIT_IDENTITY_VARS=(GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL)
|
|
745
|
+
git_identity_env() {
|
|
746
|
+
local name="" email=""
|
|
747
|
+
if command -v git >/dev/null 2>&1; then
|
|
748
|
+
name="$(git -C "$WORKSPACE" config --get user.name 2>/dev/null || true)"
|
|
749
|
+
email="$(git -C "$WORKSPACE" config --get user.email 2>/dev/null || true)"
|
|
750
|
+
fi
|
|
751
|
+
[ -n "${GIT_AUTHOR_NAME:-}" ] || { [ -z "$name" ] || export GIT_AUTHOR_NAME="$name"; }
|
|
752
|
+
[ -n "${GIT_COMMITTER_NAME:-}" ] || { [ -z "$name" ] || export GIT_COMMITTER_NAME="$name"; }
|
|
753
|
+
[ -n "${GIT_AUTHOR_EMAIL:-}" ] || { [ -z "$email" ] || export GIT_AUTHOR_EMAIL="$email"; }
|
|
754
|
+
[ -n "${GIT_COMMITTER_EMAIL:-}" ] || { [ -z "$email" ] || export GIT_COMMITTER_EMAIL="$email"; }
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
# ── What the REPL and run share: the state, the user's settings, esbuild, the source build ──
|
|
758
|
+
# Sets SLUG, STATE, PROJECT_REL and PROJECT_STATE, and makes STATE's output/ and tmp/.
|
|
759
|
+
project_state() {
|
|
760
|
+
SLUG="$(project_slug "$WORKSPACE")"
|
|
761
|
+
if [ -n "${ORKEON_CODE_STATE:-}" ]; then STATE="$ORKEON_CODE_STATE"; PROJECT_REL="projects/$SLUG"
|
|
762
|
+
elif [ "$KIND" = clone ]; then STATE="$ROOT/.crew-output"; PROJECT_REL="projects/$SLUG"
|
|
763
|
+
else STATE="$CODE_HOME/projects/$SLUG"; PROJECT_REL=""; fi
|
|
764
|
+
mkdir -p "$STATE/output" "$STATE/tmp"
|
|
765
|
+
STATE="$(cd "$STATE" && pwd)"
|
|
766
|
+
PROJECT_STATE="$STATE${PROJECT_REL:+/$PROJECT_REL}"
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
# The user's orkeonCode block, handed to the scripts as a read-only file: they read no settings and no
|
|
770
|
+
# environment (V-04). Written afresh at each start; no block, or no node to read it (said), leaves the
|
|
771
|
+
# folder empty, and no user setting applies. The key is matched case for case, as in the .ps1. Sets USER_CONFIG_DIR.
|
|
772
|
+
write_user_config() {
|
|
773
|
+
USER_CONFIG_DIR="$STATE/user-config"
|
|
774
|
+
mkdir -p "$USER_CONFIG_DIR"
|
|
775
|
+
rm -f "$USER_CONFIG_DIR/config.json"
|
|
776
|
+
if command -v node >/dev/null 2>&1; then
|
|
777
|
+
node -e 'const fs=require("fs");const s=JSON.parse(fs.readFileSync(process.argv[1],"utf8"));if(s&&typeof s.orkeonCode==="object"&&s.orkeonCode&&!Array.isArray(s.orkeonCode))fs.writeFileSync(process.argv[2],JSON.stringify(s.orkeonCode,null,2)+"\n")' "$SETTINGS" "$USER_CONFIG_DIR/config.json" \
|
|
778
|
+
|| warn "the orkeonCode block of $SETTINGS could not be read: no user setting applies."
|
|
779
|
+
elif grep -q '"orkeonCode"' "$SETTINGS"; then
|
|
780
|
+
warn "node is not on PATH: the orkeonCode block of $SETTINGS is not read, no user setting applies."
|
|
781
|
+
fi
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
# The runtime bundles each command and crew with esbuild. The Debian package and a release-archive install carry
|
|
785
|
+
# their own: /usr/bin/orkeon-repl (and orkeon) is a script that points the runtime at /usr/lib/orkeon/esbuild-bin,
|
|
786
|
+
# and an archive's wrapper at its libexec/esbuild-bin. The dotnet tool and a source build carry none: for them, use
|
|
787
|
+
# the one npm installed for this checkout (or, for the npm package, beside it). Exports ORKEON_ESBUILD_PATH then.
|
|
788
|
+
use_esbuild() { # <the runtime's program, as on PATH; empty for a source build>
|
|
789
|
+
local bin bundled="" found
|
|
790
|
+
if [ -n "$1" ] && bin="$(command -v "$1")"; then
|
|
791
|
+
bin="$(resolve_links "$bin")"
|
|
792
|
+
if [ -x "$(dirname "$(dirname "$bin")")/libexec/esbuild-bin/esbuild" ]; then bundled=1
|
|
793
|
+
# A launcher script that sets ORKEON_ESBUILD_PATH itself (the Debian package's).
|
|
794
|
+
elif [ "$(head -c 2 "$bin" 2>/dev/null)" = '#!' ] && grep -q ORKEON_ESBUILD_PATH "$bin" 2>/dev/null; then
|
|
795
|
+
bundled=1
|
|
796
|
+
fi
|
|
797
|
+
fi
|
|
798
|
+
if [ -z "$bundled" ] && [ -z "${ORKEON_ESBUILD_PATH:-}" ] && ! command -v esbuild >/dev/null 2>&1; then
|
|
799
|
+
found="$(find "$ROOT/node_modules/@esbuild" -path '*/bin/esbuild' -type f 2>/dev/null | head -n 1 || true)"
|
|
800
|
+
if [ -z "$found" ] && [ "$KIND" = clone ]; then die "esbuild not found: run 'npm ci' in $ROOT, or set ORKEON_ESBUILD_PATH."; fi
|
|
801
|
+
[ -n "$found" ] \
|
|
802
|
+
|| die "esbuild not found: install Orkeon from its package or archive (it carries esbuild), or set ORKEON_ESBUILD_PATH."
|
|
803
|
+
export ORKEON_ESBUILD_PATH="$found"
|
|
804
|
+
fi
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
# Builds <project> of the Orkeon checkout ORKEON_SOURCE names and sets BUILT_DLL, its <assembly> in bin/Debug.
|
|
808
|
+
# The checkout should sit at the pin: one behind it is moved there (follow_pin), another commit runs, with a
|
|
809
|
+
# warning, never a refusal. The SDK runs in the Orkeon checkout, under its global.json, never in the project, whose
|
|
810
|
+
# global.json may pin another SDK ("A compatible .NET SDK was not found"). The program then starts as the built
|
|
811
|
+
# assembly: `dotnet <dll>` is a host command, which reads no global.json. A checkout just moved is restored by its
|
|
812
|
+
# build. The build is quiet and takes a minute after a move: say it runs, or it looks stuck.
|
|
813
|
+
build_source() { # <project> <assembly>
|
|
814
|
+
local restore=--no-restore head
|
|
815
|
+
[ -n "${ORKEON_SOURCE:-}" ] && [ -d "$ORKEON_SOURCE/$1" ] \
|
|
816
|
+
|| die "ORKEON_SOURCE must name an Orkeon checkout ($1 not found)."
|
|
817
|
+
ORKEON_SOURCE="$(cd "$ORKEON_SOURCE" && pwd)"
|
|
818
|
+
if head="$(git -C "$ORKEON_SOURCE" rev-parse HEAD 2>/dev/null)" && [ "$head" != "$ORKEON_REF" ]; then
|
|
819
|
+
if follow_pin "$head"; then restore=""
|
|
820
|
+
else warn "ORKEON_SOURCE is at ${head:0:7}, the pin of .orkeon-version is $ORKEON_PIN: the commands were checked against the pin."
|
|
821
|
+
fi
|
|
822
|
+
fi
|
|
823
|
+
echo "orkeon-code: building Orkeon in $ORKEON_SOURCE..." >&2
|
|
824
|
+
(cd "$ORKEON_SOURCE" && dotnet build "$1" -c Debug ${restore:+"$restore"} -nologo -v quiet) >&2 \
|
|
825
|
+
|| die "building $1 in $ORKEON_SOURCE failed (restore it once: dotnet restore Orkeon.sln)."
|
|
826
|
+
BUILT_DLL="$ORKEON_SOURCE/$1/bin/Debug/net10.0/$2"
|
|
827
|
+
[ -f "$BUILT_DLL" ] || die "$BUILT_DLL not found after the build."
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
# ── run: the crew through `orkeon run` ─────────────────────────────────────
|
|
831
|
+
# The orkeon tool of the clone's .config/dotnet-tools.json (Orkeon.Scripting.Cli from nuget.org), with dotnet.
|
|
832
|
+
clone_tool() { [ "$KIND" = clone ] && [ -f "$ROOT/.config/dotnet-tools.json" ] && command -v dotnet >/dev/null 2>&1; }
|
|
833
|
+
|
|
834
|
+
# The options of `orkeon run` (the pin's RunCommand) whose value is a file or a folder.
|
|
835
|
+
RUN_PATH_OPTIONS=" --llm-mock --llm-record --llm-replay --llm-log-path --inputs-file "
|
|
836
|
+
|
|
837
|
+
# Sets RUN_PATH to the value of a path option of `orkeon run`, as the runner must read it. The runner starts in the
|
|
838
|
+
# project, the clone or the container: a relative path that names a file or a folder of the caller's folder is made
|
|
839
|
+
# absolute, as the caller meant it. In docker mode, a path under the checkout or the project is named as the
|
|
840
|
+
# container sees it (the checkout is its /work/agent, the project its /work/project), and a file of the host
|
|
841
|
+
# elsewhere stops the run: the container does not see it.
|
|
842
|
+
run_path() { # <path> <mode>
|
|
843
|
+
local inside="" at_root=0 at_project=0
|
|
844
|
+
RUN_PATH="$1"
|
|
845
|
+
case "$1" in
|
|
846
|
+
''|/*) ;;
|
|
847
|
+
*) if [ -e "$CALLER_DIR/$1" ]; then RUN_PATH="$(cd "$(dirname "$CALLER_DIR/$1")" && pwd -P)/$(basename "$1")"; fi ;;
|
|
848
|
+
esac
|
|
849
|
+
[ "$2" = docker ] || return 0
|
|
850
|
+
case "$RUN_PATH" in "$ROOT"/*) at_root=1 ;; esac
|
|
851
|
+
case "$RUN_PATH" in "$WORKSPACE"/*) at_project=1 ;; esac
|
|
852
|
+
# A project inside the checkout, or the checkout inside the project: the nearer folder names it.
|
|
853
|
+
if [ "$at_project" = 1 ] && { [ "$at_root" = 0 ] || [ "${#WORKSPACE}" -gt "${#ROOT}" ]; }; then
|
|
854
|
+
inside="/work/project/${RUN_PATH#"$WORKSPACE"/}"
|
|
855
|
+
elif [ "$at_root" = 1 ]; then inside="/work/agent/${RUN_PATH#"$ROOT"/}"
|
|
856
|
+
fi
|
|
857
|
+
if [ -n "$inside" ]; then RUN_PATH="$inside"
|
|
858
|
+
elif [ "${RUN_PATH#/}" != "$RUN_PATH" ] && [ -e "$RUN_PATH" ]; then
|
|
859
|
+
die "in docker mode the container sees only the project and the checkout: $1, given after --, lies outside both; put it under the project ($WORKSPACE) and name it from there."
|
|
860
|
+
fi
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
# Sets RUN_EXTRA to the words given to `orkeon run`, before or after --: the value of a path option (--llm-mock FILE,
|
|
864
|
+
# --llm-mock=FILE) goes through run_path, every other word is passed as given.
|
|
865
|
+
run_extra() { # <mode>
|
|
866
|
+
local v value=0
|
|
867
|
+
RUN_EXTRA=()
|
|
868
|
+
for v in ${EXTRA[@]+"${EXTRA[@]}"}; do
|
|
869
|
+
if [ "$value" = 1 ]; then run_path "$v" "$1"; RUN_EXTRA+=("$RUN_PATH")
|
|
870
|
+
else
|
|
871
|
+
case "$v" in
|
|
872
|
+
--*=*)
|
|
873
|
+
case "$RUN_PATH_OPTIONS" in
|
|
874
|
+
*" ${v%%=*} "*) run_path "${v#*=}" "$1"; RUN_EXTRA+=("${v%%=*}=$RUN_PATH") ;;
|
|
875
|
+
*) RUN_EXTRA+=("$v") ;;
|
|
876
|
+
esac ;;
|
|
877
|
+
*) RUN_EXTRA+=("$v") ;;
|
|
878
|
+
esac
|
|
879
|
+
fi
|
|
880
|
+
value=0
|
|
881
|
+
case "$RUN_PATH_OPTIONS" in *" $v "*) value=1 ;; esac
|
|
882
|
+
done
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
# Runs RUN_CREW on the project with the REPL's settings and mounts, in the mode found as the header says; never
|
|
886
|
+
# returns. A plain `orkeon run` writes its log lines on stdout, before the result: the console logger is sent to
|
|
887
|
+
# stderr, so that stdout carries the crew's result alone.
|
|
888
|
+
run_crew() {
|
|
889
|
+
local mode="$MODE" cli=() own="$RUNTIME_HOME/${RUNTIME_ID:-none}/bin/orkeon" rel v env_args user_args
|
|
890
|
+
if [ -z "$mode" ]; then
|
|
891
|
+
if [ -n "${ORKEON_CLI:-}" ] || command -v orkeon >/dev/null 2>&1 || [ -x "$own" ] || clone_tool; then mode=tool
|
|
892
|
+
elif command -v docker >/dev/null 2>&1; then mode=docker
|
|
893
|
+
elif [ -n "${ORKEON_SOURCE:-}" ]; then mode=source
|
|
894
|
+
elif [ -n "$RUNTIME_ID" ]; then mode=tool
|
|
895
|
+
else die "no Orkeon runtime found to run a crew: put the orkeon of the full archive of an Orkeon release (orkeon-<version>-<platform>) on PATH, or use Docker or ORKEON_SOURCE (see docs/headless.md)."
|
|
896
|
+
fi
|
|
897
|
+
fi
|
|
898
|
+
export Orkeon__Embeddings__FingerprintPath="${Orkeon__Embeddings__FingerprintPath:-/output/rag/embedding-fingerprint.json}"
|
|
899
|
+
export Logging__Console__LogToStandardErrorThreshold="${Logging__Console__LogToStandardErrorThreshold:-Trace}"
|
|
900
|
+
case "$mode" in
|
|
901
|
+
tool)
|
|
902
|
+
if [ -n "${ORKEON_CLI:-}" ]; then read -r -a cli <<< "$ORKEON_CLI"
|
|
903
|
+
elif command -v orkeon >/dev/null 2>&1; then cli=(orkeon)
|
|
904
|
+
elif [ -x "$own" ]; then cli=("$own")
|
|
905
|
+
elif clone_tool; then cli=(dotnet tool run orkeon)
|
|
906
|
+
elif [ -n "$RUNTIME_ID" ]; then
|
|
907
|
+
ensure_runtime
|
|
908
|
+
[ -x "$own" ] || die "the runtime in $RUNTIME_HOME/$RUNTIME_ID carries no bin/orkeon: install the orkeon tool, or use Docker."
|
|
909
|
+
cli=("$own")
|
|
910
|
+
else die "orkeon not found: set ORKEON_CLI, or put the orkeon of the full archive of an Orkeon release (orkeon-<version>-<platform>) on PATH (see docs/headless.md)."
|
|
911
|
+
fi
|
|
912
|
+
command -v "${cli[0]}" >/dev/null 2>&1 || die "${cli[0]} not found (see docs/headless.md)."
|
|
913
|
+
if [ "${cli[*]}" = "dotnet tool run orkeon" ]; then
|
|
914
|
+
use_esbuild ""
|
|
915
|
+
(cd "$ROOT" && dotnet tool restore) >&2 || die "dotnet tool restore failed in $ROOT (.config/dotnet-tools.json)."
|
|
916
|
+
else use_esbuild "${cli[0]}"; fi ;;
|
|
917
|
+
source)
|
|
918
|
+
build_source src/scripting/Orkeon.Scripting.Cli orkeon.dll
|
|
919
|
+
cli=(dotnet "$BUILT_DLL")
|
|
920
|
+
use_esbuild "" ;;
|
|
921
|
+
docker)
|
|
922
|
+
command -v docker >/dev/null 2>&1 || die "docker not found."
|
|
923
|
+
docker version --format '{{.Server.Version}}' >/dev/null 2>&1 \
|
|
924
|
+
|| die "the Docker engine does not answer: start Docker Desktop or the Docker service, then run orkeon-code again. Without Docker, install the orkeon tool (docs/headless.md)."
|
|
925
|
+
rel="${RUN_CREW#"$ROOT"/}"
|
|
926
|
+
[ "$rel" != "$RUN_CREW" ] || die "in docker mode the crew must lie under $ROOT, the folder the container sees: $RUN_CREW"
|
|
927
|
+
;;
|
|
928
|
+
*) die "unknown mode '$mode' (expected docker, tool or source)" ;;
|
|
929
|
+
esac
|
|
930
|
+
run_extra "$mode"
|
|
931
|
+
project_state
|
|
932
|
+
write_user_config
|
|
933
|
+
if [ "$mode" = docker ]; then
|
|
934
|
+
env_args=(-e ORKEON_ENTRYPOINT=orkeon -e HOME=/tmp -e DOTNET_CLI_HOME=/tmp
|
|
935
|
+
-e "Orkeon__Security__PermissionGate__Enabled=$Orkeon__Security__PermissionGate__Enabled"
|
|
936
|
+
-e "Orkeon__Embeddings__FingerprintPath=$Orkeon__Embeddings__FingerprintPath"
|
|
937
|
+
-e "Logging__Console__LogToStandardErrorThreshold=$Logging__Console__LogToStandardErrorThreshold")
|
|
938
|
+
git_identity_env
|
|
939
|
+
for v in ORKEON_Llm__ApiKey ORKEON_Llm__Model "$KEY_VAR" GITHUB_TOKEN GH_TOKEN \
|
|
940
|
+
Orkeon__Tools__GitHub__TokenVariable "${Orkeon__Tools__GitHub__TokenVariable:-}" "${GIT_IDENTITY_VARS[@]}"; do
|
|
941
|
+
if [ -n "$v" ] && [ -n "${!v:-}" ]; then env_args+=(-e "$v"); fi
|
|
942
|
+
done
|
|
943
|
+
user_args=()
|
|
944
|
+
if [ "$(uname -s)" = Linux ]; then user_args=(--user "$(id -u):$(id -g)"); fi
|
|
945
|
+
exec docker run --rm -i ${user_args[@]+"${user_args[@]}"} "${env_args[@]}" -w /work \
|
|
946
|
+
-v "$WORKSPACE:/work/project" -v "$ROOT:/work/agent:ro" -v "$SETTINGS:/work/settings.json:ro" -v "$STATE:/work/state" \
|
|
947
|
+
"$IMAGE" run "/work/agent/$rel" -s /work/settings.json \
|
|
948
|
+
-m /work/project:/workspace:rw /work/state/output:/output:rw /work/state/tmp:/tmp:rw /work/state/user-config:/user-config:ro \
|
|
949
|
+
--allow-external-mounts ${RUN_INPUTS:+--inputs "$RUN_INPUTS"} ${RUN_EXTRA[@]+"${RUN_EXTRA[@]}"}
|
|
950
|
+
fi
|
|
951
|
+
# The dotnet tool of the clone is found from its manifest, in the clone; every other runner runs from the project.
|
|
952
|
+
if [ "${cli[*]}" = "dotnet tool run orkeon" ]; then cd "$ROOT"; else cd "$WORKSPACE"; fi
|
|
953
|
+
exec "${cli[@]}" run "$RUN_CREW" -s "$SETTINGS" \
|
|
954
|
+
-m "$WORKSPACE:/workspace:rw" "$STATE/output:/output:rw" "$STATE/tmp:/tmp:rw" "$USER_CONFIG_DIR:/user-config:ro" \
|
|
955
|
+
--allow-external-mounts ${RUN_INPUTS:+--inputs "$RUN_INPUTS"} ${RUN_EXTRA[@]+"${RUN_EXTRA[@]}"}
|
|
956
|
+
}
|
|
957
|
+
if [ -n "$RUN_CREW" ]; then run_crew; fi
|
|
958
|
+
|
|
671
959
|
# ── Mode ───────────────────────────────────────────────────────────────────
|
|
672
960
|
if [ -z "$MODE" ]; then
|
|
673
961
|
if [ -n "${ORKEON_REPL:-}" ] || command -v orkeon-repl >/dev/null 2>&1 || runtime_downloaded; then MODE=tool
|
|
@@ -689,13 +977,7 @@ fi
|
|
|
689
977
|
# An install keeps one folder per project, ~/.orkeon-code/projects/<slug>; a clone's .crew-output and an
|
|
690
978
|
# ORKEON_CODE_STATE may serve several projects, so their per-project part goes under projects/<slug>.
|
|
691
979
|
# Either way PROJECT_STATE lies inside STATE, which docker mode mounts on /work/state.
|
|
692
|
-
|
|
693
|
-
if [ -n "${ORKEON_CODE_STATE:-}" ]; then STATE="$ORKEON_CODE_STATE"; PROJECT_REL="projects/$SLUG"
|
|
694
|
-
elif [ "$KIND" = clone ]; then STATE="$ROOT/.crew-output"; PROJECT_REL="projects/$SLUG"
|
|
695
|
-
else STATE="$CODE_HOME/projects/$SLUG"; PROJECT_REL=""; fi
|
|
696
|
-
mkdir -p "$STATE/output" "$STATE/tmp"
|
|
697
|
-
STATE="$(cd "$STATE" && pwd)"
|
|
698
|
-
PROJECT_STATE="$STATE${PROJECT_REL:+/$PROJECT_REL}"
|
|
980
|
+
project_state
|
|
699
981
|
# The runtime saves the session in <SessionsDirectory>/<its slug of the project>/last.json when the REPL ends
|
|
700
982
|
# (FileSessionBufferService), and reloads it at the next start. The folder is the launcher's /sessions mount,
|
|
701
983
|
# outside the project; the launcher keeps its own files beside it: history/ and project.json.
|
|
@@ -880,18 +1162,8 @@ if [ -n "$AUDIO" ]; then
|
|
|
880
1162
|
echo " audio : $AUDIO -> /audio (transcripts: $STATE/transcripts, model $model$([ "$(lowered "${WHISPER_DEVICE:-}")" = cuda ] && echo ' on the GPU')$([ "${ORKEON_CODE_VOICE:-}" = 1 ] && echo ', microphone and speaker on'))"
|
|
881
1163
|
fi
|
|
882
1164
|
|
|
883
|
-
# The user's orkeonCode block
|
|
884
|
-
|
|
885
|
-
# folder empty, and no user setting applies. The key is matched case for case, as in the .ps1.
|
|
886
|
-
USER_CONFIG_DIR="$STATE/user-config"
|
|
887
|
-
mkdir -p "$USER_CONFIG_DIR"
|
|
888
|
-
rm -f "$USER_CONFIG_DIR/config.json"
|
|
889
|
-
if command -v node >/dev/null 2>&1; then
|
|
890
|
-
node -e 'const fs=require("fs");const s=JSON.parse(fs.readFileSync(process.argv[1],"utf8"));if(s&&typeof s.orkeonCode==="object"&&s.orkeonCode&&!Array.isArray(s.orkeonCode))fs.writeFileSync(process.argv[2],JSON.stringify(s.orkeonCode,null,2)+"\n")' "$SETTINGS" "$USER_CONFIG_DIR/config.json" \
|
|
891
|
-
|| warn "the orkeonCode block of $SETTINGS could not be read: no user setting applies."
|
|
892
|
-
elif grep -q '"orkeonCode"' "$SETTINGS"; then
|
|
893
|
-
warn "node is not on PATH: the orkeonCode block of $SETTINGS is not read, no user setting applies."
|
|
894
|
-
fi
|
|
1165
|
+
# The user's orkeonCode block on /user-config (write_user_config).
|
|
1166
|
+
write_user_config
|
|
895
1167
|
|
|
896
1168
|
# Sets ARGS. A function filling an array rather than mapfile: macOS ships bash 3.2.
|
|
897
1169
|
# An empty <settings> passes none: the REPL then reads Orkeon's own file.
|
|
@@ -1003,8 +1275,9 @@ case "$MODE" in
|
|
|
1003
1275
|
-e "Orkeon__Embeddings__FingerprintPath=$Orkeon__Embeddings__FingerprintPath")
|
|
1004
1276
|
# The github tool's token (Orkeon #222): GITHUB_TOKEN, GH_TOKEN, or the variable Orkeon__Tools__GitHub__TokenVariable
|
|
1005
1277
|
# names, each handed over only when set, with the setting itself so the runtime reads the same variable.
|
|
1278
|
+
git_identity_env
|
|
1006
1279
|
for v in ORKEON_Llm__ApiKey ORKEON_Llm__Model "$KEY_VAR" GITHUB_TOKEN GH_TOKEN \
|
|
1007
|
-
Orkeon__Tools__GitHub__TokenVariable "${Orkeon__Tools__GitHub__TokenVariable:-}"; do
|
|
1280
|
+
Orkeon__Tools__GitHub__TokenVariable "${Orkeon__Tools__GitHub__TokenVariable:-}" "${GIT_IDENTITY_VARS[@]}"; do
|
|
1008
1281
|
if [ -n "$v" ] && [ -n "${!v:-}" ]; then env_args+=(-e "$v"); fi
|
|
1009
1282
|
done
|
|
1010
1283
|
# Files the agent writes in the project belong to the caller, not to root.
|
|
@@ -1030,51 +1303,11 @@ case "$MODE" in
|
|
|
1030
1303
|
else REPL=(orkeon-repl); fi
|
|
1031
1304
|
command -v "${REPL[0]}" >/dev/null 2>&1 || die "${REPL[0]} not found (see docs/getting-started.md, 'Tool mode')."
|
|
1032
1305
|
else
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
ORKEON_SOURCE="$(cd "$ORKEON_SOURCE" && pwd)"
|
|
1036
|
-
# The checkout should sit at the pin: one behind it is moved there (follow_pin), another commit runs, with a
|
|
1037
|
-
# warning, never a refusal.
|
|
1038
|
-
restore=--no-restore
|
|
1039
|
-
if head="$(git -C "$ORKEON_SOURCE" rev-parse HEAD 2>/dev/null)" && [ "$head" != "$ORKEON_REF" ]; then
|
|
1040
|
-
if follow_pin "$head"; then restore=""
|
|
1041
|
-
else warn "ORKEON_SOURCE is at ${head:0:7}, the pin of .orkeon-version is $ORKEON_PIN: the commands were checked against the pin."
|
|
1042
|
-
fi
|
|
1043
|
-
fi
|
|
1044
|
-
# The SDK runs in the Orkeon checkout, under its global.json, never in the
|
|
1045
|
-
# project, whose global.json may pin another SDK ("A compatible .NET SDK was
|
|
1046
|
-
# not found"). The REPL then starts as the built assembly: `dotnet <dll>`
|
|
1047
|
-
# is a host command, which reads no global.json. A checkout just moved is restored by its build.
|
|
1048
|
-
# The build is quiet and takes a minute after a move: say it runs, or it looks stuck.
|
|
1049
|
-
echo "orkeon-code: building Orkeon in $ORKEON_SOURCE..." >&2
|
|
1050
|
-
(cd "$ORKEON_SOURCE" && dotnet build src/apps/Orkeon.ConsoleApp -c Debug ${restore:+"$restore"} -nologo -v quiet) >&2 \
|
|
1051
|
-
|| die "building src/apps/Orkeon.ConsoleApp in $ORKEON_SOURCE failed (restore it once: dotnet restore Orkeon.sln)."
|
|
1052
|
-
dll="$ORKEON_SOURCE/src/apps/Orkeon.ConsoleApp/bin/Debug/net10.0/Orkeon.ConsoleApp.dll"
|
|
1053
|
-
[ -f "$dll" ] || die "$dll not found after the build."
|
|
1054
|
-
REPL=(dotnet "$dll")
|
|
1055
|
-
fi
|
|
1056
|
-
# The runtime bundles each command and crew with esbuild. The Debian package
|
|
1057
|
-
# and a release-archive install carry their own: /usr/bin/orkeon-repl is a
|
|
1058
|
-
# script that points the runtime at /usr/lib/orkeon/esbuild-bin, and an
|
|
1059
|
-
# archive's wrapper at its libexec/esbuild-bin. The dotnet tool and a source
|
|
1060
|
-
# build carry none: for them, use the one npm installed for this checkout (or, for
|
|
1061
|
-
# the npm package, beside it).
|
|
1062
|
-
bundled=""
|
|
1063
|
-
if [ "$MODE" = tool ] && repl_bin="$(command -v "${REPL[0]}")"; then
|
|
1064
|
-
repl_bin="$(resolve_links "$repl_bin")"
|
|
1065
|
-
if [ -x "$(dirname "$(dirname "$repl_bin")")/libexec/esbuild-bin/esbuild" ]; then bundled=1
|
|
1066
|
-
# A launcher script that sets ORKEON_ESBUILD_PATH itself (the Debian package's).
|
|
1067
|
-
elif [ "$(head -c 2 "$repl_bin" 2>/dev/null)" = '#!' ] && grep -q ORKEON_ESBUILD_PATH "$repl_bin" 2>/dev/null; then
|
|
1068
|
-
bundled=1
|
|
1069
|
-
fi
|
|
1070
|
-
fi
|
|
1071
|
-
if [ -z "$bundled" ] && [ -z "${ORKEON_ESBUILD_PATH:-}" ] && ! command -v esbuild >/dev/null 2>&1; then
|
|
1072
|
-
found="$(find "$ROOT/node_modules/@esbuild" -path '*/bin/esbuild' -type f 2>/dev/null | head -n 1 || true)"
|
|
1073
|
-
if [ -z "$found" ] && [ "$KIND" = clone ]; then die "esbuild not found: run 'npm ci' in $ROOT, or set ORKEON_ESBUILD_PATH."; fi
|
|
1074
|
-
[ -n "$found" ] \
|
|
1075
|
-
|| die "esbuild not found: install Orkeon from its package or archive (it carries esbuild), or set ORKEON_ESBUILD_PATH."
|
|
1076
|
-
export ORKEON_ESBUILD_PATH="$found"
|
|
1306
|
+
build_source src/apps/Orkeon.ConsoleApp Orkeon.ConsoleApp.dll
|
|
1307
|
+
REPL=(dotnet "$BUILT_DLL")
|
|
1077
1308
|
fi
|
|
1309
|
+
# The esbuild the runtime bundles with: its own, else the one npm installed (use_esbuild).
|
|
1310
|
+
use_esbuild "$([ "$MODE" = tool ] && printf '%s' "${REPL[0]}")"
|
|
1078
1311
|
# The REPL runs from the project. It reads its --commands-dir and --crews-dir
|
|
1079
1312
|
# wherever they are, and a --mount outside its working directory (here /output,
|
|
1080
1313
|
# /tmp, /user-config, /sessions, /session-history and /memory, in the state directory,
|
package/orkeon-code.ps1
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
.\orkeon-code.ps1 setup # write %USERPROFILE%\.orkeon-code\appsettings.json (never the key)
|
|
15
15
|
|
|
16
16
|
.NOTES
|
|
17
|
-
Modes: tool (orkeon-repl on PATH, from the full Orkeon release .zip (the .msi has no orkeon-repl
|
|
18
|
-
|
|
17
|
+
Modes: tool (orkeon-repl on PATH, from the full Orkeon release .zip (the .msi has no orkeon-repl, the
|
|
18
|
+
dotnet tool installs orkeon alone) or the Debian package, or $env:ORKEON_REPL) and docker
|
|
19
19
|
(ghcr.io/orkeon/orkeon:latest, the last release, not the pin). The source mode is only in the
|
|
20
20
|
bash launcher. Folder trust, per-project state, sessions, settings, API key, model and $env:ORKEON_CODE_AUDIO_DIR (speech-to-text,
|
|
21
21
|
tool mode): see the header of ./orkeon-code.
|
|
@@ -35,6 +35,11 @@ param(
|
|
|
35
35
|
$ErrorActionPreference = 'Stop'
|
|
36
36
|
|
|
37
37
|
# A subcommand of ./orkeon-code (trust, setup) is the first argument, and takes the rest as its own.
|
|
38
|
+
# `run` (one crew, headless) and `runtime` (the downloaded runtime) are the bash launcher's alone for now.
|
|
39
|
+
if ($Extra.Count -gt 0 -and $Extra[0] -cin @('run', 'runtime')) {
|
|
40
|
+
[Console]::Error.WriteLine("orkeon-code: '$($Extra[0])' is not available in orkeon-code.ps1 yet: run the bash launcher (./orkeon-code $($Extra[0]) ...) from Git Bash or WSL (docs/headless.md, docs/getting-started.md).")
|
|
41
|
+
exit 1
|
|
42
|
+
}
|
|
38
43
|
$Sub = $null
|
|
39
44
|
$SubArgs = @()
|
|
40
45
|
if ($Extra.Count -gt 0 -and $Extra[0] -cin @('trust', 'setup')) {
|
|
@@ -387,7 +392,8 @@ foreach ($name in @('ORKEON_Llm__Model', 'Orkeon__Security__PermissionGate__Enab
|
|
|
387
392
|
'ORKEON_MCP__Servers__whisper__Args__8', 'ORKEON_MCP__Servers__whisper__Args__9',
|
|
388
393
|
'ORKEON_MCP__Servers__whisper__Args__10', 'ORKEON_MCP__Servers__whisper__Args__11',
|
|
389
394
|
'ORKEON_MCP__Servers__whisper__Args__12',
|
|
390
|
-
'WHISPER_MICROPHONE', 'WHISPER_SPEAKER', 'UV_PROJECT_ENVIRONMENT'
|
|
395
|
+
'WHISPER_MICROPHONE', 'WHISPER_SPEAKER', 'UV_PROJECT_ENVIRONMENT',
|
|
396
|
+
'GIT_AUTHOR_NAME', 'GIT_AUTHOR_EMAIL', 'GIT_COMMITTER_NAME', 'GIT_COMMITTER_EMAIL')) {
|
|
391
397
|
$savedEnv[$name] = [Environment]::GetEnvironmentVariable($name)
|
|
392
398
|
}
|
|
393
399
|
try {
|
|
@@ -871,7 +877,17 @@ try {
|
|
|
871
877
|
# The github tool's token (Orkeon #222): GITHUB_TOKEN, GH_TOKEN, or the variable Orkeon__Tools__GitHub__TokenVariable
|
|
872
878
|
# names, each handed over only when set, with the setting itself so the runtime reads the same variable.
|
|
873
879
|
$tokenVar = [Environment]::GetEnvironmentVariable('Orkeon__Tools__GitHub__TokenVariable')
|
|
874
|
-
|
|
880
|
+
# The identity of a commit made in the container (the image sets none, Orkeon #404): each of the four variables
|
|
881
|
+
# already set is kept, one unset takes the user.name or user.email git gives on the host for the workspace.
|
|
882
|
+
if (Get-Command git -ErrorAction SilentlyContinue) {
|
|
883
|
+
$gitName = (& git -C $Workspace config --get user.name 2>$null)
|
|
884
|
+
$gitEmail = (& git -C $Workspace config --get user.email 2>$null)
|
|
885
|
+
foreach ($pair in @(@('GIT_AUTHOR_NAME', $gitName), @('GIT_COMMITTER_NAME', $gitName), @('GIT_AUTHOR_EMAIL', $gitEmail), @('GIT_COMMITTER_EMAIL', $gitEmail))) {
|
|
886
|
+
if (-not [Environment]::GetEnvironmentVariable($pair[0]) -and $pair[1]) { [Environment]::SetEnvironmentVariable($pair[0], [string]$pair[1]) }
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
foreach ($v in @('ORKEON_Llm__ApiKey', 'ORKEON_Llm__Model', $keyVar, 'GITHUB_TOKEN', 'GH_TOKEN', 'Orkeon__Tools__GitHub__TokenVariable', $tokenVar,
|
|
890
|
+
'GIT_AUTHOR_NAME', 'GIT_AUTHOR_EMAIL', 'GIT_COMMITTER_NAME', 'GIT_COMMITTER_EMAIL')) {
|
|
875
891
|
if ($v -and [Environment]::GetEnvironmentVariable($v)) { $envArgs += @('-e', $v) }
|
|
876
892
|
}
|
|
877
893
|
$inState = if ($projectRel) { "/work/state/$projectRel" } else { '/work/state' }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orkeon-code",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.3",
|
|
4
4
|
"description": "Agentic coding assistant in TypeScript on the Orkeon runtime. Pair with it in the terminal under permission modes, run it fully autonomous in a pipeline, or call its crews from your own application. Every command, crew and prompt is a source file you can change or add to.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Orkeon Contributors",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"src/",
|
|
24
24
|
"config/*.example.json",
|
|
25
25
|
"scripts/setup-fixture.sh",
|
|
26
|
+
"scripts/dev-run.sh",
|
|
26
27
|
"scripts/session-start.sh",
|
|
27
28
|
"scripts/session-start.ork.ts",
|
|
28
29
|
"scripts/install.sh",
|