@adhdev/daemon-core 0.9.82-rc.414 → 0.9.82-rc.416

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.
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Pick the best launch target from `where`'s match list on win32.
3
+ *
4
+ * `where npm` on a typical install returns BOTH the extensionless Unix wrapper
5
+ * (e.g. `C:\Program Files\nodejs\npm`, a bash shell script) AND the `npm.cmd`
6
+ * shim. The extensionless wrapper is NOT a win32 executable — handing it to a
7
+ * spawn boundary ENOENTs (errno -4058). So:
8
+ * 1. Prefer a directly-launchable `.exe`/`.com`.
9
+ * 2. Otherwise take a `.cmd`/`.bat` shim (absolute → works for ConPTY, and for
10
+ * execFile once wrapped via buildWin32ExecFileSpawn).
11
+ * 3. NEVER fall back to an extensionless match — return null so the caller can
12
+ * try other resolution strategies (global-bin scan) rather than emit a
13
+ * path that cannot be exec'd.
14
+ */
15
+ export declare function selectWin32ExecutableMatch(matches: string[]): string | null;
1
16
  /**
2
17
  * Resolve a launch command to an absolute executable path on Windows.
3
18
  *
@@ -12,3 +27,43 @@
12
27
  * or cannot be resolved (caller keeps the original behaviour).
13
28
  */
14
29
  export declare function resolveWin32Executable(command: string): string;
30
+ /**
31
+ * Quote one argument for a cmd.exe command line using the standard
32
+ * CommandLineToArgvW rules (the same algorithm Node uses internally): wrap in
33
+ * double quotes only when needed, double up the backslashes that precede a
34
+ * quote, and escape embedded quotes. We do per-argument quoting ourselves
35
+ * (rather than `{ shell: true }`) because Node's shell mode joins argv with bare
36
+ * spaces and applies NO quoting — any argument containing a space (a path, a
37
+ * test name) would split. Inputs here are repo-mesh validation/bootstrap command
38
+ * tokens (trusted config, not network data), so argv-quoting for spaces/quotes
39
+ * is sufficient; we deliberately do not attempt full cmd.exe metacharacter
40
+ * (& | < > ^ %) escaping.
41
+ */
42
+ export declare function quoteWin32CmdArg(arg: string): string;
43
+ export interface Win32ExecFileSpawn {
44
+ file: string;
45
+ args: string[];
46
+ /** Set when the args are pre-quoted for cmd.exe and must not be re-quoted. */
47
+ windowsVerbatimArguments?: boolean;
48
+ }
49
+ /**
50
+ * Build child_process.execFile/spawn parameters for an already-resolved command.
51
+ *
52
+ * On win32 a `.cmd`/`.bat` shim (what `npm`/`npx`/`tsc`/`vitest` resolve to)
53
+ * cannot be launched by execFile directly — modern Node refuses it (CVE-2024-27980
54
+ * mitigation) and CreateProcess cannot exec a batch file. So wrap it in
55
+ * `cmd.exe /d /s /c "<quoted command line>"` with `windowsVerbatimArguments` so
56
+ * our own per-argument quoting is preserved. `.exe`/`.com` (and every non-win32
57
+ * platform, and any already-cmd.exe target) pass through unchanged — this is a
58
+ * strict no-op off win32, guarding against regressions on linux/macOS.
59
+ */
60
+ export declare function buildWin32ExecFileSpawn(resolvedCommand: string, args: string[]): Win32ExecFileSpawn;
61
+ /**
62
+ * Convenience: resolve a bare command to an absolute win32 path AND build the
63
+ * execFile spawn parameters (cmd.exe-wrapping a .cmd/.bat shim). Returns the
64
+ * resolved command alongside the spawn spec so callers can still surface the
65
+ * resolved path in diagnostics.
66
+ */
67
+ export declare function resolveWin32ExecFileSpawn(command: string, args: string[]): Win32ExecFileSpawn & {
68
+ resolvedCommand: string;
69
+ };
@@ -6,6 +6,7 @@
6
6
  * uses this file as the single source of truth.
7
7
  */
8
8
  import type { LocalMeshEntry, LocalMeshNodeEntry, RepoMeshPolicy, RepoMeshNodePolicy, RepoMeshNodeCapabilities, RepoMeshCoordinatorConfig, RepoMeshHostMetadata, RepoMeshDaemonRole } from '../repo-mesh-types.js';
9
+ import type { MagiPanel } from '@adhdev/mesh-shared';
9
10
  /**
10
11
  * Normalize a Git remote URL into a stable identity string.
11
12
  * e.g. "git@github.com:user/repo.git" → "github.com/user/repo"
@@ -125,3 +126,25 @@ export declare function updateNode(meshId: string, nodeId: string, opts: {
125
126
  reportedPlatform?: string;
126
127
  reportedArch?: string;
127
128
  }): LocalMeshNodeEntry | undefined;
129
+ /**
130
+ * Validate + normalize a panel config before persisting. Mirrors the node-config
131
+ * normalization style (mesh-config addNode/updateNode): trims strings, drops
132
+ * empties, requires a provider per member, clamps replica counts. Throws on
133
+ * structurally invalid input so the calling tool returns a clear error rather than
134
+ * writing a malformed panel.
135
+ */
136
+ export declare function normalizeMagiPanel(config: unknown): MagiPanel;
137
+ /** All configured MAGI panels (machine-local), keyed by name. Empty when none. */
138
+ export declare function listMagiPanels(): Record<string, MagiPanel>;
139
+ /** A single panel by name, or undefined when not configured. */
140
+ export declare function getMagiPanel(name: string): MagiPanel | undefined;
141
+ /**
142
+ * Upsert a named panel into meshes.json. Defaults to refusing to clobber an
143
+ * existing panel (overwrite=false) — mirrors the mesh_init write/overwrite
144
+ * precedent. Returns the normalized, persisted panel.
145
+ */
146
+ export declare function upsertMagiPanel(name: string, config: unknown, opts?: {
147
+ overwrite?: boolean;
148
+ }): MagiPanel;
149
+ /** Remove a named panel. Returns true when a panel was removed. */
150
+ export declare function removeMagiPanel(name: string): boolean;
package/dist/index.d.ts CHANGED
@@ -28,8 +28,9 @@ export { appendRecentActivity, getRecentActivity } from './config/recent-activit
28
28
  export type { RecentActivityEntry } from './config/recent-activity.js';
29
29
  export { getSavedProviderSessions, upsertSavedProviderSession } from './config/saved-sessions.js';
30
30
  export type { SavedProviderSessionEntry } from './config/saved-sessions.js';
31
- export { listMeshes, getMesh, getMeshByRepo, createMesh, updateMesh, deleteMesh, addNode, removeNode, updateNode, normalizeRepoIdentity, } from './config/mesh-config.js';
31
+ export { listMeshes, getMesh, getMeshByRepo, createMesh, updateMesh, deleteMesh, addNode, removeNode, updateNode, normalizeRepoIdentity, listMagiPanels, getMagiPanel, upsertMagiPanel, removeMagiPanel, normalizeMagiPanel, } from './config/mesh-config.js';
32
32
  export type { CreateMeshOptions, UpdateMeshOptions, AddNodeOptions } from './config/mesh-config.js';
33
+ export type { MagiPanel, MagiPanelMember, MagiPanelMap, MagiMode, MagiClaim, MagiClaimStance, MagiAgentResponse, MagiResponseSource, MagiReplicaGitRef, MagiGitSkew, MagiSynthesizedResponse, MagiClusterCategory, MagiClusterMember, MagiClaimCluster, MagiSynthesis, } from '@adhdev/mesh-shared';
33
34
  export { expandDaemonIdForms, daemonIdsEquivalent, machineCoreFromDaemonId, canonicalDaemonId } from '@adhdev/mesh-shared';
34
35
  export { normalizeMeshNodeId, meshNodeIdMatches } from '@adhdev/mesh-shared';
35
36
  export { buildCoordinatorSystemPrompt } from './mesh/coordinator-prompt.js';
@@ -60,6 +61,8 @@ export type { StaleDirectPruneClassification, StaleDirectPruneResult, PruneStale
60
61
  export type { MeshActiveWorkRecord, MeshActiveWorkStatus, MeshActiveWorkSummary, MeshActiveWorkSource, MeshStaleDirectWorkSummary } from './mesh/mesh-active-work.js';
61
62
  export { buildMeshAsyncRefineJobs, summarizeMeshAsyncRefineJobs, STALE_TERMINAL_REFINE_WINDOW_MS, RECENT_TERMINAL_REFINE_CAP } from './mesh/mesh-refine-status.js';
62
63
  export type { MeshAsyncRefineJobStatus, MeshAsyncRefineJobSummary, MeshAsyncRefineJobsSummary } from './mesh/mesh-refine-status.js';
64
+ export { buildMeshMagiActivity, summarizeMeshMagiActivity, getMeshMagiActivityByGroup, STALE_MAGI_WINDOW_MS, RECENT_MAGI_CAP, MAGI_NEEDS_VERIFICATION_PREVIEW_CAP } from './mesh/mesh-magi-status.js';
65
+ export type { MeshMagiActivityStatus, MeshMagiActivitySummary, MeshMagiActivitySummaryFold, MeshMagiNeedsVerificationItem } from './mesh/mesh-magi-status.js';
63
66
  export { buildMeshSchedulingRuntime } from './mesh/mesh-scheduling-runtime.js';
64
67
  export type { MeshSchedulingRuntime, MeshNodeSchedulingRuntime, MeshNodeProviderSchedulingRuntime } from './mesh/mesh-scheduling-runtime.js';
65
68
  export { buildMeshHostRequiredFailure, createDefaultMeshHostMetadata, isMeshHostOwner, normalizeMeshDaemonRole, requireMeshHostQueueOwner, resolveMeshHostStatus } from './mesh/mesh-host-ownership.js';