Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions Releases/v5.0.0/.claude/PAI/PULSE/Observability/observability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* GET /, /work, /telos, /health, etc. — Static Next.js pages (fallback handler)
*/

import { join, extname } from "path"
import { join, extname, isAbsolute } from "path"
import { readFileSync, readdirSync, existsSync, realpathSync } from "fs"
import YAML from "yaml"

Expand Down Expand Up @@ -66,7 +66,7 @@ const SECURITY_LOG_DIR = join(MEMORY_DIR, "SECURITY")
const SETTINGS_PATH = join(HOME, ".claude", "settings.json")
const LADDER_DIR = join(HOME, "Projects", "Ladder")

const DEFAULT_DASHBOARD_DIR = join(PAI_DIR, "Pulse", "Observability", "out")
const DEFAULT_DASHBOARD_DIR = join(PAI_DIR, "PULSE", "Observability", "out")

// ── In-Memory Store (hook-pushed state/events) ──

Expand Down Expand Up @@ -147,9 +147,11 @@ function existsSafe(path: string): boolean {

function getDashboardDir(): string {
const dir = config.dashboard_dir ?? DEFAULT_DASHBOARD_DIR
// Resolve relative paths against Pulse directory
if (!dir.startsWith("/")) {
return join(HOME, ".claude", "PAI", "Pulse", dir)
// Resolve relative paths against the Pulse directory.
// Use path.isAbsolute() so Windows absolute paths (C:\..., D:\...) are
// detected correctly — startsWith("/") only matches POSIX absolute paths.
if (!isAbsolute(dir)) {
return join(HOME, ".claude", "PAI", "PULSE", dir)
}
return dir
}
Expand Down Expand Up @@ -1647,7 +1649,7 @@ function readDirMdFiles(dir: string): { name: string, content: string, sections:
function handleUserIndexApi(filter: string | null): Response {
try {
const PAI_DIR = process.env.PAI_DIR || join(process.env.HOME || "", ".claude", "PAI")
const indexPath = join(PAI_DIR, "Pulse", "state", "user-index.json")
const indexPath = join(PAI_DIR, "PULSE", "state", "user-index.json")
const raw = Bun.file(indexPath)
if (!raw.size) {
return Response.json(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const HOME = process.env.HOME ?? ""
const PAI_DIR = join(HOME, ".claude", "PAI")
const PROJECTS_DIR = join(HOME, ".claude", "projects")
const OUTPUT_FILE = join(PAI_DIR, "MEMORY", "OBSERVABILITY", "session-costs.jsonl")
const STATE_FILE = join(PAI_DIR, "Pulse", "Performance", "aggregator-state.json")
const STATE_FILE = join(PAI_DIR, "PULSE", "Performance", "aggregator-state.json")

// Model pricing per million tokens (as of 2026-04)
const MODEL_PRICING: Record<string, { input: number; output: number; cacheWrite: number; cacheRead: number }> = {
Expand Down
2 changes: 1 addition & 1 deletion Releases/v5.0.0/.claude/PAI/PULSE/checks/github-work.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { parse } from "smol-toml"
import { SignJWT, importPKCS8 } from "jose"

const HOME = process.env.HOME ?? ""
const PULSE_DIR = join(HOME, ".claude", "PAI", "Pulse")
const PULSE_DIR = join(HOME, ".claude", "PAI", "PULSE")
const STATE_FILE = join(PULSE_DIR, "state", "work-token.json")

// ── Worker Config (from PULSE.toml [worker] section) ──
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { createHash } from "crypto";

const HOME = process.env.HOME || "";
const PAI_DIR = process.env.PAI_DIR || join(HOME, ".claude", "PAI");
const STATE_FILE = join(PAI_DIR, "Pulse", "state", "notification-governor.json");
const STATE_FILE = join(PAI_DIR, "PULSE", "state", "notification-governor.json");
const LOG_FILE = join(PAI_DIR, "MEMORY", "OBSERVABILITY", "notification-governor.jsonl");
const NOTIFY_URL = "http://localhost:31337/notify";
const VOICE_ID = "fTtv3eikoepIosk8dTZ5";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { join } from "path";

const HOME = process.env.HOME || "";
const PAI_DIR = process.env.PAI_DIR || join(HOME, ".claude", "PAI");
const PULSE_STATE = join(PAI_DIR, "Pulse", "state", "state.json");
const PULSE_TOML = join(PAI_DIR, "Pulse", "PULSE.toml");
const PULSE_STATE = join(PAI_DIR, "PULSE", "state", "state.json");
const PULSE_TOML = join(PAI_DIR, "PULSE", "PULSE.toml");

// Jobs we specifically monitor — the Current→Ideal pipeline ones.
const WATCHED_JOBS = [
Expand Down
2 changes: 1 addition & 1 deletion Releases/v5.0.0/.claude/PAI/PULSE/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export async function spawnScript(command: string, timeoutMs = 60_000): Promise<
const proc = Bun.spawn(["bash", "-c", command], {
stdout: "pipe",
stderr: "pipe",
cwd: join(process.env.HOME ?? "~", ".claude", "PAI", "Pulse"),
cwd: join(process.env.HOME ?? "~", ".claude", "PAI", "PULSE"),
env: { ...process.env },
})

Expand Down
4 changes: 2 additions & 2 deletions Releases/v5.0.0/.claude/PAI/PULSE/modules/imessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export interface IMessageHealth {

const HOME = process.env.HOME ?? ""
const CWD = join(HOME, ".claude")
const STATE_DIR = join(HOME, ".claude", "PAI", "Pulse", "state", "imessage")
const LOGS_DIR = join(HOME, ".claude", "PAI", "Pulse", "logs", "imessage")
const STATE_DIR = join(HOME, ".claude", "PAI", "PULSE", "state", "imessage")
const LOGS_DIR = join(HOME, ".claude", "PAI", "PULSE", "logs", "imessage")

let pollTimer: ReturnType<typeof setInterval> | null = null
let running = false
Expand Down
2 changes: 1 addition & 1 deletion Releases/v5.0.0/.claude/PAI/PULSE/modules/user-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { join, relative, basename, dirname } from "path"
const HOME = process.env.HOME ?? ""
const PAI_DIR = process.env.PAI_DIR || join(HOME, ".claude", "PAI")
const USER_DIR = join(PAI_DIR, "USER")
const STATE_DIR = join(PAI_DIR, "Pulse", "state")
const STATE_DIR = join(PAI_DIR, "PULSE", "state")
const INDEX_PATH = join(STATE_DIR, "user-index.json")
const MODULE_NAME = "user-index"

Expand Down