@halcyonlabs/app 0.47.0-halcyon.179 → 0.47.0-halcyon.180

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/dist/index.d.ts CHANGED
@@ -16261,17 +16261,17 @@ declare const threadTimelineResponseSchema: z$1.ZodObject<{
16261
16261
  timeUsedSeconds: z$1.ZodNumber;
16262
16262
  }, z$1.core.$strip>>;
16263
16263
  providerCommands: z$1.ZodNullable<z$1.ZodArray<z$1.ZodObject<{
16264
- source: z$1.ZodEnum<{
16265
- command: "command";
16266
- skill: "skill";
16267
- }>;
16268
- name: z$1.ZodString;
16269
16264
  origin: z$1.ZodEnum<{
16270
16265
  project: "project";
16271
16266
  builtin: "builtin";
16272
16267
  user: "user";
16273
16268
  }>;
16274
16269
  description: z$1.ZodNullable<z$1.ZodString>;
16270
+ source: z$1.ZodEnum<{
16271
+ command: "command";
16272
+ skill: "skill";
16273
+ }>;
16274
+ name: z$1.ZodString;
16275
16275
  argumentHint: z$1.ZodNullable<z$1.ZodString>;
16276
16276
  }, z$1.core.$strip>>>;
16277
16277
  sessionOptions: z$1.ZodNullable<z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
@@ -23585,10 +23585,10 @@ declare function createApiClient(baseUrl: string, options?: PublicApiClientOptio
23585
23585
  timeUsedSeconds: number;
23586
23586
  } | null;
23587
23587
  providerCommands: {
23588
- source: "command" | "skill";
23589
- name: string;
23590
23588
  origin: "project" | "builtin" | "user";
23591
23589
  description: string | null;
23590
+ source: "command" | "skill";
23591
+ name: string;
23592
23592
  argumentHint: string | null;
23593
23593
  }[] | null;
23594
23594
  sessionOptions: ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halcyonlabs/app",
3
- "version": "0.47.0-halcyon.179",
3
+ "version": "0.47.0-halcyon.180",
4
4
  "description": "bb app launcher for npx",
5
5
  "keywords": [
6
6
  "bb",
@@ -10,8 +10,76 @@ case "$(uname -s):$(uname -m)" in
10
10
  *) echo 'Codex is not packaged for this station.' >&2; exit 1 ;;
11
11
  esac
12
12
  export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
13
+ codex_processes() {
14
+ if pids=$(pgrep -u orbit -x codex); then
15
+ [ -n "$pids" ] || { echo 'Cannot read the Codex process list; leaving the old files in place.' >&2; return 1; }
16
+ else
17
+ status=$?
18
+ [ "$status" = 1 ] && return 0
19
+ echo 'Cannot read the Codex process list; leaving the old files in place.' >&2
20
+ return 1
21
+ fi
22
+ for pid in $pids; do
23
+ case "$pid" in
24
+ ''|*[!0-9]*) echo 'Cannot read the Codex process list; leaving the old files in place.' >&2; return 1 ;;
25
+ esac
26
+ if executable=$(case "$(uname -s)" in Linux) readlink "/proc/$pid/exe" ;; Darwin) lsof -a -p "$pid" -d txt -Fn | sed -n "s/^n//p" ;; *) return 1 ;; esac); then
27
+ while IFS= read -r path; do
28
+ case "$path" in
29
+ /*) printf '%s\n' "$path" ;;
30
+ *) echo "Cannot read the executable path for Codex process $pid; leaving the old files in place." >&2; return 1 ;;
31
+ esac
32
+ done <<< "$executable"
33
+ else
34
+ echo "Cannot read the executable path for Codex process $pid; leaving the old files in place." >&2
35
+ return 1
36
+ fi
37
+ done
38
+ }
39
+
40
+ codex_release_in_use() {
41
+ while IFS= read -r executable; do
42
+ case "$executable" in
43
+ "$1"/*) return 0 ;;
44
+ "$package"/*) case "$1" in "$versions"/legacy.*) return 0 ;; esac ;;
45
+ esac
46
+ done <<< "$executables"
47
+ return 1
48
+ }
49
+
13
50
  prefix="$HOME/.local"
14
51
  package="$prefix/lib/node_modules/@openai/codex"
52
+ versions="$prefix/lib/codex-versions"
53
+ codex_cleanup() {
54
+ current=$(node - "$prefix/bin/codex" "$versions" <<'JS'
55
+ const fs = require('node:fs');
56
+ const path = require('node:path');
57
+ const executable = fs.realpathSync(process.argv[2]);
58
+ const relative = path.relative(process.argv[3], executable).split(path.sep);
59
+ if (relative[0] !== '..' && relative.length > 1) console.log(path.join(process.argv[3], relative[0]));
60
+ JS
61
+ )
62
+ if executables=$(codex_processes); then
63
+ count=0
64
+ has_legacy=0
65
+ for previous in "$versions"/legacy.*; do
66
+ if [ -d "$previous" ] && [ ! -L "$previous" ]; then has_legacy=1; fi
67
+ done
68
+ while IFS= read -r executable; do
69
+ case "$executable" in
70
+ "$versions"/*) case "$executable" in "$current"/*) ;; *) count=$((count + 1)) ;; esac ;;
71
+ "$package"/*) if [ "$has_legacy" = 1 ]; then count=$((count + 1)); fi ;;
72
+ esac
73
+ done <<< "$executables"
74
+ echo "$count Codex processes still run an old version; they will switch at their next restart."
75
+ for previous in "$versions"/install.* "$versions"/legacy.*; do
76
+ [ -d "$previous" ] && [ ! -L "$previous" ] && [ "$previous" != "$current" ] || continue
77
+ codex_release_in_use "$previous" || rm -rf "$previous"
78
+ done
79
+ else
80
+ echo 'Codex upgraded; old processes will switch at their next restart. Old files are kept because their use could not be checked.'
81
+ fi
82
+ }
15
83
  mkdir -p "$prefix/bin"
16
84
  npm config set prefix "$prefix"
17
85
  if node - "$package/package.json" "$codex_version" <<'JS'
@@ -27,17 +95,11 @@ try {
27
95
  } catch { process.exit(1); }
28
96
  JS
29
97
  then
30
- if [ -x "$prefix/bin/codex" ] && "$prefix/bin/codex" --version >/dev/null 2>&1; then exit 0; fi
31
- fi
32
- if pgrep -u "$(id -u)" -f "$package/|$prefix/bin/codex" >/dev/null; then
33
- echo 'Codex is running. Retry the station update after its runs finish.' >&2
34
- exit 1
35
- else
36
- status=$?
37
- [ "$status" = 1 ] || { echo 'Cannot check active Codex runs; leaving the installation alone.' >&2; exit 1; }
98
+ if [ -x "$prefix/bin/codex" ] && "$prefix/bin/codex" --version >/dev/null 2>&1; then codex_cleanup; exit 0; fi
38
99
  fi
39
- tmp=$(mktemp -d)
40
- trap 'rm -rf "$tmp"' EXIT
100
+ mkdir -p "$versions"
101
+ tmp=$(mktemp -d "$versions/install.XXXXXXXX")
102
+ trap 'if [ "${published:-0}" = 0 ]; then rm -rf "$tmp"; else rm -f "$tmp/launcher.tgz" "$tmp/native.tgz" "$tmp/bin-next" "$tmp/package-next"; fi' EXIT
41
103
  for part in launcher native; do
42
104
  if [ "$part" = launcher ]; then version="$codex_version"; integrity="$launcher_integrity"; else version="$codex_version-$platform"; integrity="$native_integrity"; fi
43
105
  curl -fsSL --retry 3 -o "$tmp/$part.tgz" "https://registry.npmjs.org/@openai/codex/-/codex-$version.tgz"
@@ -48,8 +110,25 @@ const actual = crypto.createHash('sha512').update(fs.readFileSync(process.argv[2
48
110
  if (actual !== process.argv[3]) throw new Error('Codex package integrity check failed');
49
111
  JS
50
112
  done
51
- npm install --global --prefix "$prefix" --ignore-scripts --omit=optional "$tmp/launcher.tgz"
52
- native="$package/node_modules/@openai/codex-$platform"
113
+ npm install --global --prefix "$tmp" --ignore-scripts --omit=optional "$tmp/launcher.tgz"
114
+ new_package="$tmp/lib/node_modules/@openai/codex"
115
+ native="$new_package/node_modules/@openai/codex-$platform"
53
116
  mkdir -p "$native"
54
117
  tar -xzf "$tmp/native.tgz" -C "$native" --strip-components=1
55
- "$prefix/bin/codex" --version
118
+ actual=$("$tmp/bin/codex" --version)
119
+ [ "$actual" = "codex-cli $codex_version" ] || { echo 'The new Codex did not report the expected version; leaving the installation alone.' >&2; exit 1; }
120
+ ln -s "$tmp/bin/codex" "$tmp/bin-next"
121
+ node - "$tmp/bin-next" "$prefix/bin/codex" <<'JS'
122
+ require('node:fs').renameSync(process.argv[2], process.argv[3]);
123
+ JS
124
+ published=1
125
+ mkdir -p "$prefix/lib/node_modules/@openai"
126
+ if [ -d "$package" ] && [ ! -L "$package" ]; then
127
+ legacy=$(mktemp -d "$versions/legacy.XXXXXXXX")
128
+ mv "$package" "$legacy/package"
129
+ fi
130
+ ln -s "$new_package" "$tmp/package-next"
131
+ node - "$tmp/package-next" "$package" <<'JS'
132
+ require('node:fs').renameSync(process.argv[2], process.argv[3]);
133
+ JS
134
+ codex_cleanup
@@ -1 +1 @@
1
- db83f973a2a7dca3e95c316795d41f7739a55dd8
1
+ 1307e09121b6c840cc2a9cc6bde4f3139758b7bd