@arcforge/platform 2.0.173 → 2.0.175
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/package.json +10 -10
- package/src/build/project/tree.ts +46 -6
- package/src/services/running/running.ts +20 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcforge/platform",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.175",
|
|
4
4
|
"description": "The Axon developer platform — headless project discovery, blueprint scanning, typegen, agent lifecycle, registry, benches and tests. Shared by the CLI/TUI and the Fleet extension.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -44,20 +44,20 @@
|
|
|
44
44
|
"deploy": "echo \"This package is published ONLY by apps/tui/scripts/release.ts, which pins workspace:* deps to concrete versions first. Publishing it directly ships an unresolvable dependency.\" && exit 1"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@arcforge/session": "2.0.
|
|
48
|
-
"@arcforge/engines": "2.0.
|
|
49
|
-
"@arcforge/err": "2.0.
|
|
50
|
-
"@arcforge/types": "2.0.
|
|
51
|
-
"@arcforge/cloud": "2.0.
|
|
52
|
-
"@arcforge/capsule": "2.0.
|
|
53
|
-
"@arcforge/core": "2.0.
|
|
54
|
-
"@arcforge/vstr": "2.0.
|
|
47
|
+
"@arcforge/session": "2.0.175",
|
|
48
|
+
"@arcforge/engines": "2.0.175",
|
|
49
|
+
"@arcforge/err": "2.0.175",
|
|
50
|
+
"@arcforge/types": "2.0.175",
|
|
51
|
+
"@arcforge/cloud": "2.0.175",
|
|
52
|
+
"@arcforge/capsule": "2.0.175",
|
|
53
|
+
"@arcforge/core": "2.0.175",
|
|
54
|
+
"@arcforge/vstr": "2.0.175",
|
|
55
55
|
"fft.js": "^4.0.4",
|
|
56
56
|
"h3": "^1.15.11",
|
|
57
57
|
"semver": "^7.7.4",
|
|
58
58
|
"sharp": "^0.35.3",
|
|
59
59
|
"typescript": "5.9.2",
|
|
60
|
-
"@arcforge/link": "2.0.
|
|
60
|
+
"@arcforge/link": "2.0.175"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@arcforge/air": "2.0.167",
|
|
@@ -561,11 +561,52 @@ async function linkFramework(root: string): Promise<void> {
|
|
|
561
561
|
* claim the specifier, so a moved or renamed package fails to link instead of
|
|
562
562
|
* linking the wrong directory.
|
|
563
563
|
*/
|
|
564
|
+
/**
|
|
565
|
+
* Every package.json under `root`, to `depth` levels, skipping node_modules.
|
|
566
|
+
*
|
|
567
|
+
* Walked in-process rather than shelled out to `find`. Two reasons, and the
|
|
568
|
+
* second is the one that matters:
|
|
569
|
+
*
|
|
570
|
+
* - `find` does not exist on Windows, so the spawn produced no output there.
|
|
571
|
+
* - `spawnSync` reports a missing binary as EMPTY STDOUT, which is exactly what
|
|
572
|
+
* a successful search with no matches looks like. Both call sites then looped
|
|
573
|
+
* over nothing and returned null — so "this machine has no `find`" was
|
|
574
|
+
* indistinguishable from "this workspace has no framework packages", and a
|
|
575
|
+
* developer on a Mac or Windows box silently linked against the published
|
|
576
|
+
* copy while believing they were testing their own checkout.
|
|
577
|
+
*
|
|
578
|
+
* A directory walk cannot fail that way: an unreadable directory is skipped
|
|
579
|
+
* explicitly, and there is no binary to be absent.
|
|
580
|
+
*/
|
|
581
|
+
function manifestsUnder(root: string, depth: number): string[] {
|
|
582
|
+
const out: string[] = []
|
|
583
|
+
|
|
584
|
+
const walk = (dir: string, remaining: number): void => {
|
|
585
|
+
if (remaining < 0) return
|
|
586
|
+
let entries
|
|
587
|
+
try {
|
|
588
|
+
entries = readdirSync(dir, { withFileTypes: true })
|
|
589
|
+
} catch {
|
|
590
|
+
// Unreadable directory — a permission fault or a broken symlink.
|
|
591
|
+
// Skipped rather than fatal: it is one branch of a search, and the
|
|
592
|
+
// caller's question is "is this package here", not "is every
|
|
593
|
+
// directory readable".
|
|
594
|
+
return
|
|
595
|
+
}
|
|
596
|
+
for (const entry of entries) {
|
|
597
|
+
if (entry.name === "node_modules") continue
|
|
598
|
+
const path = join(dir, entry.name)
|
|
599
|
+
if (entry.isDirectory()) walk(path, remaining - 1)
|
|
600
|
+
else if (entry.name === "package.json") out.push(path)
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
walk(root, depth)
|
|
605
|
+
return out
|
|
606
|
+
}
|
|
607
|
+
|
|
564
608
|
function frameworkDir(workspace: string, name: string): string | null {
|
|
565
|
-
const found =
|
|
566
|
-
"find", join(workspace, "libs"), "-maxdepth", "5", "-name", "package.json",
|
|
567
|
-
"-not", "-path", "*/node_modules/*",
|
|
568
|
-
]).stdout.toString().trim().split("\n")
|
|
609
|
+
const found = manifestsUnder(join(workspace, "libs"), 5)
|
|
569
610
|
|
|
570
611
|
for (const candidate of found) {
|
|
571
612
|
if (!candidate) continue
|
|
@@ -586,8 +627,7 @@ function findWorkspacePackage(from: string, name: string): string | null {
|
|
|
586
627
|
try {
|
|
587
628
|
const pkg = JSON.parse(readFileSync(manifest, "utf8")) as { workspaces?: string[] }
|
|
588
629
|
if (pkg.workspaces) {
|
|
589
|
-
const found =
|
|
590
|
-
"-not", "-path", "*/node_modules/*"]).stdout.toString().trim().split("\n")
|
|
630
|
+
const found = manifestsUnder(dir, 4)
|
|
591
631
|
for (const candidate of found) {
|
|
592
632
|
if (!candidate) continue
|
|
593
633
|
try {
|
|
@@ -53,6 +53,20 @@ function read(path: string): AxonInstance | null {
|
|
|
53
53
|
type RunningOpts = {
|
|
54
54
|
/** Where THIS process registers itself. Readers still see every root. */
|
|
55
55
|
root?: string
|
|
56
|
+
/**
|
|
57
|
+
* Read ONLY `root`, rather than every well-known store.
|
|
58
|
+
*
|
|
59
|
+
* The default is deliberately wide: an observer must see an agent booted by
|
|
60
|
+
* the installed binary and one booted from a source checkout alike, or it
|
|
61
|
+
* reports an idle machine while work is running. That is right in
|
|
62
|
+
* production and wrong under test, where sweeping the real `~/.axon` means
|
|
63
|
+
* a developer with an agent open fails an assertion about an empty store —
|
|
64
|
+
* and, worse, a test can DELETE a real record (`remove` sweeps every root).
|
|
65
|
+
*
|
|
66
|
+
* The daemon's Registry already carries this exact flag; naming it the same
|
|
67
|
+
* way here keeps one idea with one spelling.
|
|
68
|
+
*/
|
|
69
|
+
isolated?: boolean
|
|
56
70
|
/** Coalesce a burst of fs events (several agents booting at once) into one callback. */
|
|
57
71
|
debounceMs?: number
|
|
58
72
|
/** How often to re-check without an fs event — catches a crashed pid, which touches no file. */
|
|
@@ -79,6 +93,8 @@ type RunningOpts = {
|
|
|
79
93
|
*/
|
|
80
94
|
export function Running(opts: RunningOpts = {}) {
|
|
81
95
|
const writeRoot = opts.root ?? ROOTS[0]!
|
|
96
|
+
/** Every directory this instance reads and prunes. See `isolated`. */
|
|
97
|
+
const roots = opts.isolated === true ? [writeRoot] : [...new Set([...ROOTS, writeRoot])]
|
|
82
98
|
const debounceMs = opts.debounceMs ?? 100
|
|
83
99
|
const pollMs = opts.pollMs ?? 5000
|
|
84
100
|
|
|
@@ -96,7 +112,7 @@ export function Running(opts: RunningOpts = {}) {
|
|
|
96
112
|
// stale record in one root must never shadow the live one in another.
|
|
97
113
|
const live = new Map<string, AxonInstance>()
|
|
98
114
|
|
|
99
|
-
for (const root of
|
|
115
|
+
for (const root of roots) {
|
|
100
116
|
if (!existsSync(root)) continue
|
|
101
117
|
|
|
102
118
|
for (const name of readdirSync(root)) {
|
|
@@ -124,7 +140,7 @@ export function Running(opts: RunningOpts = {}) {
|
|
|
124
140
|
|
|
125
141
|
return {
|
|
126
142
|
/** Every root read by list()/watch(). Exposed for diagnostics, not for callers to walk. */
|
|
127
|
-
roots:
|
|
143
|
+
roots: roots,
|
|
128
144
|
|
|
129
145
|
/** Register this process. Called once, immediately after the runtime is up. */
|
|
130
146
|
start(instance: AxonInstance): void {
|
|
@@ -141,7 +157,7 @@ export function Running(opts: RunningOpts = {}) {
|
|
|
141
157
|
|
|
142
158
|
/** Deregister. Called first thing on shutdown — a reader must never see "alive" for a session mid-teardown. */
|
|
143
159
|
stop(sessionId: string): void {
|
|
144
|
-
for (const root of
|
|
160
|
+
for (const root of roots) rmSync(fileOf(root, sessionId), { force: true })
|
|
145
161
|
},
|
|
146
162
|
|
|
147
163
|
/** Every currently-live instance, pid-checked fresh. Dead records are GC'd as a side effect. */
|
|
@@ -165,7 +181,7 @@ export function Running(opts: RunningOpts = {}) {
|
|
|
165
181
|
*/
|
|
166
182
|
watch(listener: (instances: AxonInstance[]) => void): () => void {
|
|
167
183
|
if (!watchers.length) {
|
|
168
|
-
for (const root of
|
|
184
|
+
for (const root of roots) {
|
|
169
185
|
mkdirSync(root, { recursive: true }) // fs.watch throws on a missing directory
|
|
170
186
|
watchers.push(watch(root, () => notify()))
|
|
171
187
|
}
|