Merge remote-tracking branch 'origin/v2' into subagent-command

# Conflicts:
#	packages/core/src/config/plugin/command.ts
This commit is contained in:
Aiden Cline 2026-07-03 23:04:15 -05:00
commit 958e7f77f6
190 changed files with 4891 additions and 2758 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

@ -27,4 +27,4 @@ export const StatusChanged = Event.ephemeral({
},
})
export const Definitions = Event.inventory(ToolsChanged, BrowserOpenFailed, StatusChanged)
export const Definitions = Event.inventory(ToolsChanged, StatusChanged)

View file

@ -7,8 +7,8 @@ import { IntegrationID } from "./integration-id.js"
const Connected = Schema.Struct({ status: Schema.Literal("connected") }).annotate({
identifier: "Mcp.Status.Connected",
})
const Disconnected = Schema.Struct({ status: Schema.Literal("disconnected") }).annotate({
identifier: "Mcp.Status.Disconnected",
const Pending = Schema.Struct({ status: Schema.Literal("pending") }).annotate({
identifier: "Mcp.Status.Pending",
})
const Disabled = Schema.Struct({ status: Schema.Literal("disabled") }).annotate({
identifier: "Mcp.Status.Disabled",
@ -27,7 +27,7 @@ const NeedsClientRegistration = Schema.Struct({
export type Status = typeof Status.Type
export const Status = Schema.Union([
Connected,
Disconnected,
Pending,
Disabled,
Failed,
NeedsAuth,

View file

@ -12,6 +12,7 @@ import { SessionID } from "./session-id.js"
import { Location } from "./location.js"
import { SessionMessage } from "./session-message.js"
import { Revert } from "./revert.js"
import { Shell as ShellSchema } from "./shell.js"
export { FileAttachment }
@ -51,7 +52,7 @@ export const UnknownError = SessionMessage.UnknownError
export type UnknownError = SessionMessage.UnknownError
export const AgentSelected = Event.durable({
type: "agent.selected",
type: "session.agent.selected",
...options,
schema: {
...Base,
@ -61,7 +62,7 @@ export const AgentSelected = Event.durable({
export type AgentSelected = typeof AgentSelected.Type
export const ModelSelected = Event.durable({
type: "model.selected",
type: "session.model.selected",
...options,
schema: {
...Base,
@ -82,7 +83,7 @@ export const Moved = Event.durable({
export type Moved = typeof Moved.Type
export const Renamed = Event.durable({
type: "renamed",
type: "session.renamed",
...options,
schema: {
...Base,
@ -92,7 +93,7 @@ export const Renamed = Event.durable({
export type Renamed = typeof Renamed.Type
export const Forked = Event.durable({
type: "forked",
type: "session.forked",
...options,
schema: {
...Base,
@ -103,7 +104,7 @@ export const Forked = Event.durable({
export type Forked = typeof Forked.Type
export const PromptPromoted = Event.durable({
type: "prompt.promoted",
type: "session.prompt.promoted",
...options,
schema: {
sessionID: SessionID,
@ -113,14 +114,14 @@ export const PromptPromoted = Event.durable({
export type PromptPromoted = typeof PromptPromoted.Type
export const PromptAdmitted = Event.durable({
type: "prompt.admitted",
type: "session.prompt.admitted",
...options,
schema: PromptFields,
})
export type PromptAdmitted = typeof PromptAdmitted.Type
export const ExecutionSettled = Event.ephemeral({
type: "execution.settled",
type: "session.execution.settled",
schema: {
...Base,
outcome: Schema.Literals(["success", "failure", "interrupted"]),
@ -140,7 +141,7 @@ export const ContextUpdated = Event.durable({
export type ContextUpdated = typeof ContextUpdated.Type
export const Synthetic = Event.durable({
type: "synthetic",
type: "session.synthetic",
...options,
schema: {
...Base,
@ -153,7 +154,7 @@ export type Synthetic = typeof Synthetic.Type
export namespace Skill {
export const Activated = Event.durable({
type: "skill.activated",
type: "session.skill.activated",
...options,
schema: {
...Base,
@ -166,23 +167,22 @@ export namespace Skill {
export namespace Shell {
export const Started = Event.durable({
type: "shell.started",
type: "session.shell.started",
...options,
schema: {
...Base,
callID: Schema.String,
command: Schema.String,
shell: ShellSchema.Info,
},
})
export type Started = typeof Started.Type
export const Ended = Event.durable({
type: "shell.ended",
type: "session.shell.ended",
...options,
schema: {
...Base,
callID: Schema.String,
output: Schema.String,
shell: ShellSchema.Info,
output: ShellSchema.Output,
},
})
export type Ended = typeof Ended.Type
@ -190,7 +190,7 @@ export namespace Shell {
export namespace Step {
export const Started = Event.durable({
type: "step.started",
type: "session.step.started",
...options,
schema: {
...Base,
@ -203,7 +203,7 @@ export namespace Step {
export type Started = typeof Started.Type
export const Ended = Event.durable({
type: "step.ended",
type: "session.step.ended",
...stepSettlementOptions,
schema: {
...Base,
@ -226,7 +226,7 @@ export namespace Step {
export type Ended = typeof Ended.Type
export const Failed = Event.durable({
type: "step.failed",
type: "session.step.failed",
...stepSettlementOptions,
schema: {
...Base,
@ -239,7 +239,7 @@ export namespace Step {
export namespace Text {
export const Started = Event.durable({
type: "text.started",
type: "session.text.started",
...options,
schema: {
...Base,
@ -251,7 +251,7 @@ export namespace Text {
// Stream fragments are live-only; Text.Ended is the replayable full-value boundary.
export const Delta = Event.ephemeral({
type: "text.delta",
type: "session.text.delta",
schema: {
...Base,
assistantMessageID: SessionMessage.ID,
@ -262,7 +262,7 @@ export namespace Text {
export type Delta = typeof Delta.Type
export const Ended = Event.durable({
type: "text.ended",
type: "session.text.ended",
...options,
schema: {
...Base,
@ -276,7 +276,7 @@ export namespace Text {
export namespace Reasoning {
export const Started = Event.durable({
type: "reasoning.started",
type: "session.reasoning.started",
...options,
schema: {
...Base,
@ -289,7 +289,7 @@ export namespace Reasoning {
// Stream fragments are live-only; Reasoning.Ended is the replayable full-value boundary.
export const Delta = Event.ephemeral({
type: "reasoning.delta",
type: "session.reasoning.delta",
schema: {
...Base,
assistantMessageID: SessionMessage.ID,
@ -300,7 +300,7 @@ export namespace Reasoning {
export type Delta = typeof Delta.Type
export const Ended = Event.durable({
type: "reasoning.ended",
type: "session.reasoning.ended",
...options,
schema: {
...Base,
@ -322,7 +322,7 @@ export namespace Tool {
export namespace Input {
export const Started = Event.durable({
type: "tool.input.started",
type: "session.tool.input.started",
...options,
schema: {
...ToolBase,
@ -333,7 +333,7 @@ export namespace Tool {
// Stream fragments are live-only; Input.Ended is the replayable raw-input boundary.
export const Delta = Event.ephemeral({
type: "tool.input.delta",
type: "session.tool.input.delta",
schema: {
...ToolBase,
delta: Schema.String,
@ -342,7 +342,7 @@ export namespace Tool {
export type Delta = typeof Delta.Type
export const Ended = Event.durable({
type: "tool.input.ended",
type: "session.tool.input.ended",
...options,
schema: {
...ToolBase,
@ -353,7 +353,7 @@ export namespace Tool {
}
export const Called = Event.durable({
type: "tool.called",
type: "session.tool.called",
...options,
schema: {
...ToolBase,
@ -372,7 +372,7 @@ export namespace Tool {
* transitions or at a bounded cadence, not persist every stdout/stderr chunk.
*/
export const Progress = Event.durable({
type: "tool.progress",
type: "session.tool.progress",
...options,
schema: {
...ToolBase,
@ -383,7 +383,7 @@ export namespace Tool {
export type Progress = typeof Progress.Type
export const Success = Event.durable({
type: "tool.success",
type: "session.tool.success",
...options,
schema: {
...ToolBase,
@ -400,7 +400,7 @@ export namespace Tool {
export type Success = typeof Success.Type
export const Failed = Event.durable({
type: "tool.failed",
type: "session.tool.failed",
...options,
schema: {
...ToolBase,
@ -428,7 +428,7 @@ export const RetryError = Schema.Struct({
export interface RetryError extends Schema.Schema.Type<typeof RetryError> {}
export const Retried = Event.durable({
type: "retried",
type: "session.retried",
...options,
schema: {
...Base,
@ -440,7 +440,7 @@ export type Retried = typeof Retried.Type
export namespace Compaction {
export const Started = Event.durable({
type: "compaction.started",
type: "session.compaction.started",
...options,
schema: {
...Base,
@ -450,7 +450,7 @@ export namespace Compaction {
export type Started = typeof Started.Type
export const Delta = Event.ephemeral({
type: "compaction.delta",
type: "session.compaction.delta",
schema: {
...Base,
text: Schema.String,
@ -459,7 +459,7 @@ export namespace Compaction {
export type Delta = typeof Delta.Type
export const Ended = Event.durable({
type: "compaction.ended",
type: "session.compaction.ended",
...options,
schema: {
...Base,
@ -473,13 +473,13 @@ export namespace Compaction {
export namespace RevertEvent {
export const Staged = Event.durable({
type: "revert.staged",
type: "session.revert.staged",
...options,
schema: { ...Base, revert: Revert.State },
})
export const Cleared = Event.durable({ type: "revert.cleared", ...options, schema: Base })
export const Cleared = Event.durable({ type: "session.revert.cleared", ...options, schema: Base })
export const Committed = Event.durable({
type: "revert.committed",
type: "session.revert.committed",
...options,
schema: { ...Base, messageID: SessionMessage.ID },
})

View file

@ -9,6 +9,7 @@ import { DateTimeUtcFromMillis, RelativePath, statics } from "./schema.js"
import { SessionID } from "./session-id.js"
import { ascending } from "./identifier.js"
import { Event } from "./event.js"
import { Shell as ShellSchema } from "./shell.js"
export const ID = Schema.String.check(Schema.isStartsWith("msg_")).pipe(
Schema.brand("Session.Message.ID"),
@ -82,9 +83,8 @@ export interface Shell extends Schema.Schema.Type<typeof Shell> {}
export const Shell = Schema.Struct({
...Base,
type: Schema.Literal("shell"),
callID: Schema.String,
command: Schema.String,
output: Schema.String,
shell: ShellSchema.Info,
output: ShellSchema.Output.pipe(optional),
time: Schema.Struct({
created: DateTimeUtcFromMillis,
completed: DateTimeUtcFromMillis.pipe(optional),

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,7 +12,9 @@ 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"
import { SessionTodo } from "../src/session-todo.js"
import { SessionV1 } from "../src/session-v1.js"
@ -52,17 +55,21 @@ describe("public event manifest", () => {
expect(Session.Event.Definitions).toBe(SessionEvent.Definitions)
expect(Workspace.Event).toBe(WorkspaceEvent)
expect(Workspace.Event.Definitions).toBe(WorkspaceEvent.Definitions)
expect(EventManifest.Latest.get("step.ended")).toBe(SessionEvent.Step.Ended)
expect(EventManifest.Latest.get("session.step.ended")).toBe(SessionEvent.Step.Ended)
expect(EventManifest.Latest.get("todo.updated")).toBe(SessionTodo.Event.Updated)
expect(EventManifest.Latest.get("agent.updated")).toBe(Agent.Event.Updated)
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])
expect(Reference.Event.Definitions).toEqual([Reference.Event.Updated])
expect(McpEvent.Definitions).toEqual([McpEvent.ToolsChanged, McpEvent.StatusChanged])
expect(EventManifest.Latest.has("mcp.browser.open.failed")).toBe(false)
expect(EventManifest.Latest.has("ide.installed")).toBe(false)
expect(IdeEvent.Definitions).toEqual([IdeEvent.Installed])
const sessionV1TailStart = EventManifest.Definitions.indexOf(SessionV1.Event.PartDelta)
@ -71,8 +78,8 @@ describe("public event manifest", () => {
SessionV1.Event.Diff,
SessionV1.Event.Error,
])
expect(EventManifest.Durable.get("step.ended.1")).toBe(SessionEvent.Step.Ended)
expect(EventManifest.Durable.has("step.ended.2")).toBe(false)
expect(EventManifest.Durable.get("session.step.ended.1")).toBe(SessionEvent.Step.Ended)
expect(EventManifest.Durable.has("session.step.ended.2")).toBe(false)
})
test("derives durable definitions from explicit definition durability", () => {
@ -85,37 +92,37 @@ describe("public event manifest", () => {
"message.removed.1",
"message.part.updated.1",
"message.part.removed.1",
"agent.selected.1",
"model.selected.1",
"session.agent.selected.1",
"session.model.selected.1",
"session.moved.1",
"renamed.1",
"forked.1",
"prompt.promoted.1",
"prompt.admitted.1",
"session.renamed.1",
"session.forked.1",
"session.prompt.promoted.1",
"session.prompt.admitted.1",
"session.context.updated.1",
"synthetic.1",
"skill.activated.1",
"shell.started.1",
"shell.ended.1",
"step.started.1",
"step.ended.1",
"step.failed.1",
"text.started.1",
"text.ended.1",
"tool.input.started.1",
"tool.input.ended.1",
"tool.called.1",
"tool.progress.1",
"tool.success.1",
"tool.failed.1",
"reasoning.started.1",
"reasoning.ended.1",
"retried.1",
"compaction.started.1",
"compaction.ended.1",
"revert.staged.1",
"revert.cleared.1",
"revert.committed.1",
"session.synthetic.1",
"session.skill.activated.1",
"session.shell.started.1",
"session.shell.ended.1",
"session.step.started.1",
"session.step.ended.1",
"session.step.failed.1",
"session.text.started.1",
"session.text.ended.1",
"session.tool.input.started.1",
"session.tool.input.ended.1",
"session.tool.called.1",
"session.tool.progress.1",
"session.tool.success.1",
"session.tool.failed.1",
"session.reasoning.started.1",
"session.reasoning.ended.1",
"session.retried.1",
"session.compaction.started.1",
"session.compaction.ended.1",
"session.revert.staged.1",
"session.revert.cleared.1",
"session.revert.committed.1",
].toSorted(),
)
expect(SessionEvent.DurableDefinitions).toEqual(