feat(core): reload config on filesystem changes

This commit is contained in:
Dax Raad 2026-07-03 20:34:29 -04:00
commit c9b24ef027
48 changed files with 596 additions and 510 deletions

View file

@ -0,0 +1,10 @@
export * as Config from "./config.js"
import { ephemeral, inventory } from "./event.js"
const Updated = ephemeral({
type: "config.updated",
schema: {},
})
export const Event = { Updated, Definitions: inventory(Updated) }

View file

@ -3,10 +3,11 @@ export * as EventManifest from "./event-manifest.js"
import { Agent } from "./agent.js"
import { Catalog } from "./catalog.js"
import { Command } from "./command.js"
import { Config } from "./config.js"
import { Durable } from "./durable-event-manifest.js"
import { Event } from "./event.js"
import { FileSystem } from "./filesystem.js"
import { FileSystemWatcher } from "./filesystem-watcher.js"
import { FileSystemV1 } from "./filesystem-v1.js"
import { Form } from "./form.js"
import { InstallationEvent } from "./installation-event.js"
import { Integration } from "./integration.js"
@ -60,8 +61,8 @@ const featureDefinitions = Event.inventory(
...Plugin.Event.Definitions,
...ProjectDirectories.Event.Definitions,
...Command.Event.Definitions,
...Config.Event.Definitions,
...Skill.Event.Definitions,
...FileSystemWatcher.Event.Definitions,
...Pty.Event.Definitions,
...Shell.Event.Definitions,
...Question.Event.Definitions,
@ -97,6 +98,7 @@ export const Definitions = Event.inventory(
...TuiEvent.Definitions,
...McpEvent.Definitions,
...LegacyEvent.Definitions,
...FileSystemV1.Event.Definitions,
...Project.Event.Definitions,
...SessionStatusEvent.Definitions,
...QuestionV1.Event.Definitions,

View file

@ -0,0 +1 @@
export * from "./v1/filesystem.js"

View file

@ -1,13 +0,0 @@
export * as FileSystemWatcher from "./filesystem-watcher.js"
import { Schema } from "effect"
import { ephemeral, inventory } from "./event.js"
const Updated = ephemeral({
type: "file.watcher.updated",
schema: {
file: Schema.String,
event: Schema.Literals(["add", "change", "unlink"]),
},
})
export const Event = { Updated, Definitions: inventory(Updated) }

View file

@ -5,11 +5,14 @@ import { optional } from "./schema.js"
import { ephemeral, inventory } from "./event.js"
import { NonNegativeInt, PositiveInt, RelativePath } from "./schema.js"
const Edited = ephemeral({
type: "file.edited",
schema: { file: Schema.String },
const Changed = ephemeral({
type: "filesystem.changed",
schema: {
file: Schema.String,
event: Schema.Literals(["add", "change", "unlink"]),
},
})
export const Event = { Edited, Definitions: inventory(Edited) }
export const Event = { Changed, Definitions: inventory(Changed) }
export interface Entry extends Schema.Schema.Type<typeof Entry> {}
export const Entry = Schema.Struct({

View file

@ -1,5 +1,6 @@
export { Agent } from "./agent.js"
export { Command } from "./command.js"
export { Config } from "./config.js"
export { Connection } from "./connection.js"
export { Credential } from "./credential.js"
export { Event } from "./event.js"

View file

@ -0,0 +1,11 @@
export * as FileSystemV1 from "./filesystem.js"
import { Schema } from "effect"
import { ephemeral, inventory } from "../event.js"
const Edited = ephemeral({
type: "file.edited",
schema: { file: Schema.String },
})
export const Event = { Edited, Definitions: inventory(Edited) }

View file

@ -1,6 +1,7 @@
import { describe, expect, test } from "bun:test"
import {
Agent,
Config,
FileSystem,
Form,
Integration,
@ -11,6 +12,7 @@ import {
Workspace,
} from "../src/index.js"
import { EventManifest } from "../src/event-manifest.js"
import { FileSystemV1 } from "../src/filesystem-v1.js"
import { IdeEvent } from "../src/ide-event.js"
import { McpEvent } from "../src/mcp-event.js"
import { SessionEvent } from "../src/session-event.js"
@ -59,7 +61,9 @@ describe("public event manifest", () => {
expect(EventManifest.Latest.get("project.updated")).toBe(Project.Event.Updated)
expect(Agent.Event.Definitions).toEqual([Agent.Event.Updated])
expect(Project.Event.Definitions).toEqual([Project.Event.Updated])
expect(FileSystem.Event.Definitions).toEqual([FileSystem.Event.Edited])
expect(Config.Event.Definitions).toEqual([Config.Event.Updated])
expect(FileSystem.Event.Definitions).toEqual([FileSystem.Event.Changed])
expect(FileSystemV1.Event.Definitions).toEqual([FileSystemV1.Event.Edited])
expect(Integration.Event.Definitions).toEqual([Integration.Event.Updated, Integration.Event.ConnectionUpdated])
expect(Permission.Event.Definitions).toEqual([Permission.Event.Asked, Permission.Event.Replied])
expect(Form.Event.Definitions).toEqual([Form.Event.Created, Form.Event.Replied, Form.Event.Cancelled])