Fix: move bootstrap session grammar into plugin-owned session-key surfaces (#58400)

Merged via squash.

Prepared head SHA: b062b18b03
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Gustavo Madeira Santana
2026-03-31 19:41:01 -04:00
committed by GitHub
parent bf0f33db32
commit bea53d7a3f
38 changed files with 1082 additions and 288 deletions

View File

@@ -154,7 +154,7 @@
"exportName": "ChannelMessageActionAdapter",
"kind": "type",
"source": {
"line": 529,
"line": 556,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -163,7 +163,7 @@
"exportName": "ChannelMessageActionContext",
"kind": "type",
"source": {
"line": 493,
"line": 520,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -1170,7 +1170,7 @@
"exportName": "BaseProbeResult",
"kind": "type",
"source": {
"line": 572,
"line": 599,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -1179,7 +1179,7 @@
"exportName": "BaseTokenResolution",
"kind": "type",
"source": {
"line": 578,
"line": 605,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -1224,7 +1224,7 @@
"exportName": "ChannelMessageActionAdapter",
"kind": "type",
"source": {
"line": 529,
"line": 556,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -1233,7 +1233,7 @@
"exportName": "ChannelMessageActionContext",
"kind": "type",
"source": {
"line": 493,
"line": 520,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -1752,7 +1752,7 @@
"exportName": "BaseProbeResult",
"kind": "type",
"source": {
"line": 572,
"line": 599,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -1761,7 +1761,7 @@
"exportName": "BaseTokenResolution",
"kind": "type",
"source": {
"line": 578,
"line": 605,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -1797,7 +1797,7 @@
"exportName": "ChannelAgentPromptAdapter",
"kind": "type",
"source": {
"line": 466,
"line": 493,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -1977,7 +1977,7 @@
"exportName": "ChannelDirectoryEntry",
"kind": "type",
"source": {
"line": 480,
"line": 507,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -1986,7 +1986,7 @@
"exportName": "ChannelDirectoryEntryKind",
"kind": "type",
"source": {
"line": 478,
"line": 505,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -2130,7 +2130,7 @@
"exportName": "ChannelMessageActionAdapter",
"kind": "type",
"source": {
"line": 529,
"line": 556,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -2139,7 +2139,7 @@
"exportName": "ChannelMessageActionContext",
"kind": "type",
"source": {
"line": 493,
"line": 520,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -2274,7 +2274,7 @@
"exportName": "ChannelPollContext",
"kind": "type",
"source": {
"line": 560,
"line": 587,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -2283,7 +2283,7 @@
"exportName": "ChannelPollResult",
"kind": "type",
"source": {
"line": 551,
"line": 578,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -2427,7 +2427,7 @@
"exportName": "ChannelToolSend",
"kind": "type",
"source": {
"line": 522,
"line": 549,
"path": "src/channels/plugins/types.core.ts"
}
},
@@ -2683,7 +2683,7 @@
"exportName": "buildCommandsMessage",
"kind": "function",
"source": {
"line": 1075,
"line": 1076,
"path": "src/auto-reply/status.ts"
}
},
@@ -2692,7 +2692,7 @@
"exportName": "buildCommandsMessagePaginated",
"kind": "function",
"source": {
"line": 1084,
"line": 1085,
"path": "src/auto-reply/status.ts"
}
},
@@ -2728,7 +2728,7 @@
"exportName": "buildHelpMessage",
"kind": "function",
"source": {
"line": 870,
"line": 871,
"path": "src/auto-reply/status.ts"
}
},
@@ -3738,7 +3738,7 @@
"exportName": "ChannelMessageActionContext",
"kind": "type",
"source": {
"line": 493,
"line": 520,
"path": "src/channels/plugins/types.core.ts"
}
},

File diff suppressed because one or more lines are too long

View File

@@ -159,6 +159,8 @@ The current boundary is:
bookkeeping, and execution dispatch
- channel plugins own scoped action discovery, capability discovery, and any
channel-specific schema fragments
- channel plugins own provider-specific session conversation grammar, such as
how conversation ids encode thread ids or inherit from parent conversations
- channel plugins execute the final action through their action adapter
For channel plugins, the SDK surface is

View File

@@ -28,11 +28,31 @@ shared `message` tool in core. Your plugin owns:
- **Config** — account resolution and setup wizard
- **Security** — DM policy and allowlists
- **Pairing** — DM approval flow
- **Session grammar** — how provider-specific conversation ids map to base chats, thread ids, and parent fallbacks
- **Outbound** — sending text, media, and polls to the platform
- **Threading** — how replies are threaded
Core owns the shared message tool, prompt wiring, session bookkeeping, and
dispatch.
Core owns the shared message tool, prompt wiring, the outer session-key shape,
generic `:thread:` bookkeeping, and dispatch.
If your platform stores extra scope inside conversation ids, keep that parsing
in the plugin with `messaging.resolveSessionConversation(...)`. That is the
canonical hook for mapping `rawId` to the base conversation id, optional thread
id, explicit `baseConversationId`, and any `parentConversationCandidates`.
When you return `parentConversationCandidates`, keep them ordered from the
narrowest parent to the broadest/base conversation.
Bundled plugins that need the same parsing before the channel registry boots
can also expose a top-level `session-key-api.ts` file with a matching
`resolveSessionConversation(...)` export. Core uses that bootstrap-safe surface
only when the runtime plugin registry is not available yet.
`messaging.resolveParentConversationCandidates(...)` remains available as a
legacy compatibility fallback when a plugin only needs parent fallbacks on top
of the generic/raw id. If both hooks exist, core uses
`resolveSessionConversation(...).parentConversationCandidates` first and only
falls back to `resolveParentConversationCandidates(...)` when the canonical hook
omits them.
## Approvals and channel capabilities