Repository navigation
feat(plugins): add bundled session-share import plugin - #1303
Open
blueberrycongee wants to merge 3 commits into
Open
blueberrycongee wants to merge 3 commits into
blueberrycongee wants to merge 3 commits into
Conversation
A reviewed SharedDocument v1 produced by session/share/read can now be seeded into a new user-visible conversation through the import_shared_context tool or the /import-share command, so shared context can continue in the recipient workspace. The plugin validates the document, keeps the newest items within the context-seed budget, defaults provider/model to the calling session, and deduplicates repeated imports by document digest. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The bundled session-share plugin could not create a valid session on a real host: a shared document's session_id is foreign to the importing store, but context seeds required a local source snapshot, and seed admission required provider/model that host.session.model cannot read for a user-owned calling session. - Allow through_seq 0 as an external source reference recorded only as provenance; positive cutoffs still require a local source session and head check. Advertise the semantic as host feature session.seed.external_source.v1 and require it from the plugin. - Allow seed creates to omit provider/model when a parent session supplies the runtime selection; a half-specified pair is rejected. - Import sessions inherit provider, model and workspace from the calling session through parent_session_id instead of the unauthorized host.session.model lookup. - Scope the dedup request id to workspace, document and mutable args over canonical JSON, so retries dedup while a changed intent or model creates a new conversation. - Align document validation with sessionshare.Document.Validate: attachment items carry no text and declare at most 8 MiB, the compact projection caps at 2 MiB, session_id is bounded, intent is bounded, and non-string arguments are rejected. - Cover the real create path: seed persistence tests, appserver admission and inheritance tests, and a bundled-plugins e2e scenario. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…eeds Follow-ups from the second review: - A user-visible imported conversation emitted no thread/started notification and stayed invisible in the desktop sidebar until a full refresh; announce it after the create returns (seed creation keeps the shared notification suppressed for launch ordering). - Session deletion collected context seeds by source id alone, so a local session colliding with an external source id could destroy an imported seed; skip provenance-only (through_seq 0) seeds. - Assert the intent launch params in the bundled e2e scenario. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
session-shareplugin that imports a reviewedSharedDocumentv1 (produced bysession/share/reador the owner'swuu session-shareCLI) as the context seed of a new user-visible conversation, closing the "share my session context to a teammate" loop on the recipient sideimport_shared_contextvalidates the document (version, item kinds, roles, attachment metadata), renders it into the context-seed budget keeping the newest items, and deduplicates repeated imports via a canonical-digestrequest_id/import-shareprompt command walks the agent through the flow; a small system-prompt section marks the boundary (plugins cannot create grants; owner-side publishing stays onwuu session-share)docs/{en,zh-cn}/customize/session-sharing.mdHost contract changes (fix after review)
The first revision could not create a valid session on a real host: a shared
document's
session_idis foreign to the importing store, but context seedsrequired a local source snapshot, and
host.session.modelcannot read auser-owned calling session.
246112bd7fixes the contract:through_seq: 0now marks a seed source as a non-local reference recordedonly as provenance (never resolved against local history). Positive cutoffs
keep requiring a local source session and head check. Advertised as host
feature
session.seed.external_source.v1; the plugin requires it atinitialize so older hosts reject it cleanly.
provider/modelwhenparent_session_idsuppliesthe runtime selection (the pair must still be specified together). The
import is a child of the calling session, inheriting provider, model and
workspace binding.
request_iddigests the canonical document plus name, intent,provider and model scoped by workspace: retries of one import dedup to the
same conversation while changed arguments intentionally create a new one.
sessionshare.Document.Validate: attachmentitems carry no text and declare at most 8 MiB, the compact projection caps
at 2 MiB,
session_idandintentare bounded, non-string arguments arerejected.
11278ca01(second review round): imported user conversations now emitthread/startedso they appear in the sidebar without a refresh; sessiondeletion no longer collects provenance-only seeds when a local session id
collides with an external source id.
Scope notes
Test plan
node --test plugins/session-share/test/import.test.mjs— 10 tests: import contract, JSON text, provider/model pairing, malformed/out-of-contract documents, budget truncation, canonical-digest dedup, prompt capabilitygo test ./internal/session— external-source seed persists without a local source; positive cutoffs still enforce local snapshotgo test ./internal/appserver— seed create inherits parent runtime and replays dedup; orphan/half-pair seeds rejected (broad Seed|Handoff|Create|Plugin|Session run, 174s)go test ./internal/ 8000 plugin ./internal/pluginhost,go vetnode scripts/bundled-plugins-e2e.mjs— all bundled plugins incl. newsession-sharescenario (real JSONL runtime; asserts seed shape, replay dedup, launch params, contract rejection)node scripts/build-bundled-plugins.mjs --check,npm --prefix plugins run typecheck(tsc), plugin-sdknpm test,make docs-policy-check test-policy-checkGenerated with Devin