@playola-radio/slipstream 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +427 -101
  2. package/SKILL.md +4 -1
  3. package/contracts/interface/v2/schema.json +3 -3
  4. package/dist/attach-workflow.js +557 -0
  5. package/dist/attribution-engine.js +2 -3
  6. package/dist/attribution-scoring.js +70 -13
  7. package/dist/boundary-registry.js +25 -0
  8. package/dist/capture-intent.js +70 -0
  9. package/dist/capture-scope.js +135 -0
  10. package/dist/cas.js +61 -14
  11. package/dist/claude-root-transcript.js +18 -11
  12. package/dist/cli.js +426 -26
  13. package/dist/clip-function-parser.js +9 -2
  14. package/dist/clip-projection-service.js +28 -0
  15. package/dist/clip-projection-worker.js +4 -0
  16. package/dist/clip-worker-pool.js +13 -1
  17. package/dist/codex-root-transcript.js +46 -0
  18. package/dist/conductor-settings.js +178 -0
  19. package/dist/conductor.js +313 -0
  20. package/dist/control-protocol.js +2 -1
  21. package/dist/daemon.js +1718 -470
  22. package/dist/engine.js +26 -10
  23. package/dist/ensure-daemon.js +30 -0
  24. package/dist/http-reader.js +20 -8
  25. package/dist/intent-store.js +196 -0
  26. package/dist/interface-range-resolver.js +28 -1
  27. package/dist/launch-agent.js +179 -0
  28. package/dist/lock.js +1 -1
  29. package/dist/public-events.js +26 -2
  30. package/dist/question-hook.js +11 -1
  31. package/dist/questions.js +102 -3
  32. package/dist/recovery.js +62 -6
  33. package/dist/session.js +604 -104
  34. package/dist/store-reader.js +112 -7
  35. package/dist/task-forwarder.js +8 -8
  36. package/dist/transcript/discovery.js +242 -111
  37. package/dist/transcript/fs-io.js +10 -1
  38. package/dist/transcript/scheduler.js +114 -0
  39. package/dist/transcript/watcher.js +5 -3
  40. package/dist/withdraw-workflow.js +106 -0
  41. package/dist/workspace.js +133 -0
  42. package/package.json +3 -2
  43. package/schemas/slipstream.agent.binding.v1.json +90 -0
  44. package/schemas/slipstream.agent.connection.v1.json +34 -0
  45. package/schemas/slipstream.agent.unlinked.v1.json +68 -0
  46. package/schemas/slipstream.capture.gap.v1.json +1 -0
  47. package/schemas/slipstream.capture.ready.v1.json +55 -0
  48. package/schemas/slipstream.capture.scope.v1.json +85 -0
  49. package/schemas/slipstream.capture.stopped.v1.json +65 -0
  50. package/schemas/slipstream.question.dispatch_attempted.v1.json +11 -1
  51. package/schemas/slipstream.question.exchange_recorded.v1.json +65 -0
  52. package/schemas/slipstream.question.relay_updated.v1.json +64 -0
  53. package/schemas/slipstream.session.resumed.v1.json +4 -1
  54. package/schemas/slipstream.session.started.v1.json +4 -1
  55. package/dist/transcript/runner.js +0 -62
@@ -0,0 +1,114 @@
1
+ import { createDiscoveryMemory, discoverRoots } from "./discovery.js";
2
+ import { nodeDiscoveryIO, nodeTranscriptFileIO } from "./fs-io.js";
3
+ import { createTranscriptWatcher } from "./watcher.js";
4
+ /** How long after one discovery cycle finishes the next one starts. */
5
+ export const DEFAULT_TRANSCRIPT_POLL_MS = 2000;
6
+ export function createTranscriptScheduler(opts) {
7
+ const discoveryIO = opts.discoveryIO ?? nodeDiscoveryIO;
8
+ const fileIO = opts.fileIO ?? nodeTranscriptFileIO;
9
+ const intervalMs = opts.pollIntervalMs ?? DEFAULT_TRANSCRIPT_POLL_MS;
10
+ const setTimer = opts.setTimer ??
11
+ ((ms, fn) => {
12
+ const t = setTimeout(fn, ms);
13
+ t.unref?.();
14
+ return t;
15
+ });
16
+ const clearTimer = opts.clearTimer ?? ((h) => clearTimeout(h));
17
+ const report = (err) => {
18
+ try {
19
+ opts.onError?.(err);
20
+ }
21
+ catch {
22
+ // An error reporter that throws must not stop the loop.
23
+ }
24
+ };
25
+ const memory = createDiscoveryMemory();
26
+ const entries = new Set();
27
+ let chain = Promise.resolve();
28
+ let timer;
29
+ let looping = false;
30
+ const dispatch = (entry, harness, found) => {
31
+ if (!entry.active)
32
+ return undefined;
33
+ const work = entry.watchers.get(harness).apply(found).catch(report);
34
+ entry.inflight.add(work);
35
+ return work.finally(() => entry.inflight.delete(work));
36
+ };
37
+ const cycle = async () => {
38
+ for (const harness of opts.harnesses) {
39
+ const due = [...entries];
40
+ if (due.length === 0)
41
+ return;
42
+ const discover = (roots) => discoverRoots(harness, discoveryIO, opts.homes[harness], roots, opts.codexScanLimit, memory);
43
+ let found;
44
+ try {
45
+ found = await discover(due.map((e) => e.root));
46
+ }
47
+ catch (err) {
48
+ report(err);
49
+ // Retry one capture at a time, so a failure only one root's scan hits
50
+ // costs that capture alone, as it did when each capture scanned for itself.
51
+ found = new Map();
52
+ if (due.length > 1) {
53
+ for (const e of due) {
54
+ try {
55
+ found.set(e.root, (await discover([e.root])).get(e.root));
56
+ }
57
+ catch (rootErr) {
58
+ report(rootErr);
59
+ }
60
+ }
61
+ }
62
+ }
63
+ await Promise.all(due.filter((e) => found.has(e.root)).map((e) => dispatch(e, harness, found.get(e.root))));
64
+ }
65
+ };
66
+ const tick = () => {
67
+ const run = chain.then(cycle);
68
+ chain = run;
69
+ return run;
70
+ };
71
+ const loop = () => {
72
+ timer = undefined;
73
+ looping = true;
74
+ void tick().finally(() => {
75
+ looping = false;
76
+ if (entries.size > 0 && timer === undefined)
77
+ timer = setTimer(intervalMs, loop);
78
+ });
79
+ };
80
+ const register = ({ root, sink, publish }) => {
81
+ const entry = {
82
+ root,
83
+ watchers: new Map(opts.harnesses.map((harness) => [
84
+ harness,
85
+ createTranscriptWatcher({
86
+ harness,
87
+ home: opts.homes[harness],
88
+ root,
89
+ codexScanLimit: opts.codexScanLimit,
90
+ discoveryIO,
91
+ fileIO,
92
+ sink,
93
+ publish,
94
+ }),
95
+ ])),
96
+ active: true,
97
+ inflight: new Set(),
98
+ };
99
+ entries.add(entry);
100
+ if (timer === undefined && !looping)
101
+ loop();
102
+ let unregistered;
103
+ return () => (unregistered ??= (async () => {
104
+ entry.active = false;
105
+ entries.delete(entry);
106
+ if (entries.size === 0 && timer !== undefined) {
107
+ clearTimer(timer);
108
+ timer = undefined;
109
+ }
110
+ await Promise.all([...entry.inflight]);
111
+ })());
112
+ };
113
+ return { register, tick };
114
+ }
@@ -80,8 +80,7 @@ export function createTranscriptWatcher(opts) {
80
80
  const { harness, home, root, codexScanLimit, discoveryIO, fileIO, sink, publish } = opts;
81
81
  const readers = new Map();
82
82
  let lastKey;
83
- const tick = async () => {
84
- const { bindings, issues: discoveryIssues } = await discover(harness, discoveryIO, home, root, codexScanLimit);
83
+ const apply = async ({ bindings, issues: discoveryIssues }) => {
85
84
  const perFile = [];
86
85
  for (const binding of bindings) {
87
86
  // Recreate the reader whenever its bound context or file generation changes: a
@@ -129,5 +128,8 @@ export function createTranscriptWatcher(opts) {
129
128
  lastKey = key;
130
129
  }
131
130
  };
132
- return { tick };
131
+ const tick = async () => {
132
+ await apply(await discover(harness, discoveryIO, home, root, codexScanLimit));
133
+ };
134
+ return { tick, apply };
133
135
  }
@@ -0,0 +1,106 @@
1
+ /**
2
+ * `slipstream detach`, `slipstream unlink` and `slipstream conductor archive`.
3
+ * Each goes through the daemon when one runs. With no daemon, the CLI records the
4
+ * withdrawal in the intent record itself, under the store lock (contracts.md §8),
5
+ * so a later daemon never resumes it. Nothing is written to the session's log:
6
+ * no capture ran, so no stop is claimed and the state is `stop-unconfirmed`.
7
+ */
8
+ import { realpath } from 'node:fs/promises';
9
+ import { NoCaptureError, unlinkOffline, withdrawOffline } from "./intent-store.js";
10
+ import { SessionOwnedError } from "./lock.js";
11
+ import { isValidSessionId } from "./store-reader.js";
12
+ /** A starting daemon holds the store lock before its socket answers. */
13
+ const LOCKED_RETRY_MS = 10_000;
14
+ const LOCKED_POLL_MS = 250;
15
+ /** `missingOk` makes a target with no capture a success: an archive script must
16
+ * not fail for a workspace Slipstream never captured. */
17
+ export async function runWithdraw(opts, deps) {
18
+ const request = { verb: 'detach', target: opts.target, ...(opts.reason === 'archived' ? { reason: 'archived' } : {}) };
19
+ const nothing = (message) => deps.out(`slipstream: ${message}; nothing to withdraw.`);
20
+ const missing = opts.missingOk ? (res) => !res.ok && res.code === 'TARGET_NOT_FOUND' : () => false;
21
+ return untilUnlocked(deps, request, async () => {
22
+ let result;
23
+ try {
24
+ result = await withdrawOffline(deps.store, await offlineTarget(opts.target), opts.reason);
25
+ }
26
+ catch (err) {
27
+ if (!opts.missingOk || !(err instanceof NoCaptureError))
28
+ throw err;
29
+ nothing(err.message);
30
+ return;
31
+ }
32
+ if (result.withdrawn.length === 0)
33
+ deps.out('already_withdrawn: true');
34
+ for (const id of result.withdrawn) {
35
+ deps.out(`session_id: ${id}`);
36
+ deps.out('state: not_recording');
37
+ deps.out('reason: stop-unconfirmed');
38
+ }
39
+ deps.out('slipstream: no daemon is running; the withdrawal is recorded and will not be resumed. '
40
+ + 'No stop was written to the session, because none was observed.');
41
+ }, missing, nothing);
42
+ }
43
+ export async function runUnlink(opts, deps) {
44
+ return untilUnlocked(deps, { verb: 'unlink', session_id: opts.sessionId }, async () => {
45
+ if (!await unlinkOffline(deps.store, opts.sessionId)) {
46
+ deps.out(`session_id: ${opts.sessionId}`);
47
+ deps.out('already_unlinked: true');
48
+ return;
49
+ }
50
+ deps.out(`session_id: ${opts.sessionId}`);
51
+ deps.out('slipstream: no daemon is running; the unlink is recorded and the chat will not be reconnected.');
52
+ });
53
+ }
54
+ /** Ask the daemon; with none answering, act offline. A store lock held while no
55
+ * daemon answers is a daemon starting (or another CLI writing): ask again. */
56
+ async function untilUnlocked(deps, request, offline, missing = () => false, nothing = () => { }) {
57
+ const now = deps.now ?? Date.now;
58
+ const sleep = deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
59
+ const deadline = now() + LOCKED_RETRY_MS;
60
+ for (;;) {
61
+ const res = await deps.control(request);
62
+ if (!res.ok && missing(res)) {
63
+ nothing(res.message);
64
+ return 0;
65
+ }
66
+ if (res.ok || res.code !== 'DAEMON_UNAVAILABLE')
67
+ return report(res, deps);
68
+ try {
69
+ await offline();
70
+ return 0;
71
+ }
72
+ catch (err) {
73
+ if (!(err instanceof SessionOwnedError)) {
74
+ deps.err(`slipstream: ${err.message}`);
75
+ return 1;
76
+ }
77
+ }
78
+ if (now() >= deadline) {
79
+ deps.err(`slipstream: the store ${deps.store} is locked by another process, but no daemon answers on its control `
80
+ + 'socket. Nothing was changed; retry once that process exits.');
81
+ return 1;
82
+ }
83
+ await sleep(LOCKED_POLL_MS);
84
+ }
85
+ }
86
+ async function offlineTarget(target) {
87
+ if (isValidSessionId(target))
88
+ return { sessionId: target };
89
+ try {
90
+ return { root: await realpath(target) };
91
+ }
92
+ catch {
93
+ return { root: target };
94
+ }
95
+ }
96
+ function report(res, deps) {
97
+ if (!res.ok) {
98
+ deps.err(`slipstream: ${res.code}: ${res.message}`);
99
+ return 1;
100
+ }
101
+ for (const [key, value] of Object.entries(res)) {
102
+ if (key !== 'v' && key !== 'ok')
103
+ deps.out(`${key}: ${String(value)}`);
104
+ }
105
+ return 0;
106
+ }
@@ -0,0 +1,133 @@
1
+ import { basename, dirname, join, relative, sep } from 'node:path';
2
+ import {} from "./conductor-settings.js";
3
+ export function workspacesRoot(home) {
4
+ return join(home, 'slipstream', 'workspaces');
5
+ }
6
+ const BRANCH_PREFIX = 'slipstream/';
7
+ const REV_PARSE = ['rev-parse', '--path-format=absolute', '--show-toplevel', '--git-dir', '--git-common-dir'];
8
+ export async function runWorkspaceCreate(repo, deps) {
9
+ const where = await deps.git(REV_PARSE, repo);
10
+ const [top, gitDir, commonDir] = where.output.replace(/\n$/, '').split('\n');
11
+ if (where.code !== 0 || !top || !commonDir) {
12
+ deps.err(`slipstream: ${repo} is not inside a git repository.`);
13
+ return 1;
14
+ }
15
+ // A linked worktree branches from, and runs scripts against, its main checkout.
16
+ const root = gitDir === commonDir ? top : dirname(commonDir);
17
+ if ((await deps.git(['remote', 'get-url', 'origin'], root)).code !== 0) {
18
+ deps.err(`slipstream: ${root} has no "origin" remote to branch from.`);
19
+ return 1;
20
+ }
21
+ const fetch = await deps.git(['fetch', '--prune', 'origin'], root);
22
+ if (fetch.code !== 0) {
23
+ deps.err(`slipstream: git fetch origin failed:\n${fetch.output.trim()}`);
24
+ return 1;
25
+ }
26
+ const base = await baseBranch(root, deps);
27
+ if (!base) {
28
+ deps.err(`slipstream: ${root} has neither origin/develop nor a default origin branch to start from.`);
29
+ return 1;
30
+ }
31
+ const parent = join(workspacesRoot(deps.home), basename(root));
32
+ let n = 1;
33
+ while (await deps.exists(join(parent, `workspace-${n}`))
34
+ || (await deps.git(['show-ref', '--verify', '--quiet', `refs/heads/${BRANCH_PREFIX}workspace-${n}`], root)).code === 0)
35
+ n++;
36
+ const branch = `${BRANCH_PREFIX}workspace-${n}`;
37
+ const add = await deps.git(['worktree', 'add', '--no-track', '-b', branch, join(parent, `workspace-${n}`), base], root);
38
+ if (add.code !== 0) {
39
+ deps.err(`slipstream: git worktree add failed:\n${add.output.trim()}`);
40
+ return 1;
41
+ }
42
+ const path = await deps.realpath(join(parent, `workspace-${n}`));
43
+ deps.out(`created ${path} on ${branch} from ${base}`);
44
+ const recorded = await deps.record(path).catch((err) => {
45
+ deps.err(`slipstream: couldn't record ${path}: ${errorMessage(err)}`);
46
+ return 1;
47
+ });
48
+ deps.out('');
49
+ deps.out(`workspace_path: ${path}`);
50
+ const setUp = await runRepoScript('setup', root, path, deps);
51
+ // Ends any unterminated line the setup script left, so the path stays on a line of its own.
52
+ deps.out('');
53
+ deps.out(`workspace_path: ${path}`);
54
+ return recorded === 0 && setUp ? 0 : 1;
55
+ }
56
+ export async function runWorkspaceArchive(dir, deps) {
57
+ const managed = await deps.realpath(workspacesRoot(deps.home)).catch(() => null);
58
+ const path = await deps.realpath(dir).catch(() => null);
59
+ const parts = managed !== null && path !== null ? relative(managed, path).split(sep) : [];
60
+ if (path === null || parts.length !== 2 || parts.includes('..') || parts.includes('')) {
61
+ deps.err(`slipstream: workspace archive only archives folders under ${workspacesRoot(deps.home)}/<repo>/<name>.`);
62
+ return 1;
63
+ }
64
+ const where = await deps.git(REV_PARSE, path);
65
+ const [top, gitDir, commonDir] = where.output.trim().split('\n');
66
+ if (where.code !== 0 || top !== path || !commonDir || gitDir === commonDir) {
67
+ deps.err(`slipstream: ${path} is not a git worktree.`);
68
+ return 1;
69
+ }
70
+ const status = await deps.git(['status', '--porcelain', '--untracked-files=all', '--ignore-submodules=none'], path);
71
+ if (status.code !== 0 || status.output.trim() !== '') {
72
+ deps.err(`slipstream: ${path} has uncommitted or untracked changes; commit or remove them first:\n${status.output.trimEnd()}`);
73
+ return 1;
74
+ }
75
+ if ((await deps.git(['symbolic-ref', '--quiet', '--short', 'HEAD'], path)).code !== 0) {
76
+ deps.err(`slipstream: ${path} has a detached HEAD; switch to a branch before archiving it.`);
77
+ return 1;
78
+ }
79
+ const root = await mainCheckout(path, deps);
80
+ if (!root) {
81
+ deps.err(`slipstream: couldn't find the main checkout for ${path}.`);
82
+ return 1;
83
+ }
84
+ const withdrawn = await deps.withdraw(path);
85
+ if (withdrawn !== 0)
86
+ return withdrawn;
87
+ if (!(await runRepoScript('archive', root, path, deps)))
88
+ return 1;
89
+ const removed = await deps.git(['worktree', 'remove', path], root);
90
+ if (removed.code !== 0) {
91
+ deps.err(`slipstream: git worktree remove failed:\n${removed.output.trim()}`);
92
+ return 1;
93
+ }
94
+ deps.out(`archived ${path}; its branch is kept`);
95
+ return 0;
96
+ }
97
+ async function baseBranch(root, deps) {
98
+ if ((await deps.git(['show-ref', '--verify', '--quiet', 'refs/remotes/origin/develop'], root)).code === 0)
99
+ return 'origin/develop';
100
+ if ((await deps.git(['remote', 'set-head', 'origin', '--auto'], root)).code !== 0)
101
+ return null;
102
+ const head = await deps.git(['symbolic-ref', '--short', 'refs/remotes/origin/HEAD'], root);
103
+ return head.code === 0 && head.output.trim() !== '' ? head.output.trim() : null;
104
+ }
105
+ /** Finds Git's main checkout without assuming the common Git directory is inside it. */
106
+ async function mainCheckout(path, deps) {
107
+ const worktrees = await deps.git(['worktree', 'list', '--porcelain'], path);
108
+ if (worktrees.code !== 0)
109
+ return null;
110
+ const first = worktrees.output.match(/^worktree (.+)$/m)?.[1];
111
+ return first || null;
112
+ }
113
+ /** Runs the workspace's committed `kind` script, if any; true when it succeeded or there is none. */
114
+ async function runRepoScript(kind, root, path, deps) {
115
+ let scripts;
116
+ try {
117
+ scripts = await deps.scripts(path);
118
+ }
119
+ catch (err) {
120
+ deps.err(`slipstream: ${errorMessage(err)}`);
121
+ return false;
122
+ }
123
+ const script = scripts[kind];
124
+ if (!script)
125
+ return true;
126
+ const code = await deps.runScript(script, path, { CONDUCTOR_ROOT_PATH: root, CONDUCTOR_WORKSPACE_PATH: path });
127
+ if (code !== 0)
128
+ deps.err(`slipstream: the ${kind} script exited ${code}.`);
129
+ return code === 0;
130
+ }
131
+ function errorMessage(err) {
132
+ return err instanceof Error ? err.message : String(err);
133
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playola-radio/slipstream",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Live, honest stream of the file changes a coding agent makes in a worktree, so you can review as it works.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -16,7 +16,8 @@
16
16
  "node": ">=24"
17
17
  },
18
18
  "bin": {
19
- "slipstream": "./dist/cli.js"
19
+ "slipstream": "./dist/cli.js",
20
+ "slipstream-mcp": "./dist/mcp-forwarder.js"
20
21
  },
21
22
  "files": [
22
23
  "dist",
@@ -0,0 +1,90 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://slipstream.dev/schemas/slipstream.agent.binding.v1.json",
4
+ "title": "slipstream.agent.binding.v1",
5
+ "$comment": "A chat was durably linked to this capture for question delivery: a slot was reserved, the chat's identity was verified against its transcript, and binding intent was persisted. A link is a question-delivery relationship only; it never credits file changes to the chat. binding_generation is a per-store decimal counter, never reused; agent.connection and agent.unlinked records carry it so a stale handshake can be told apart. Self-contained; unknown fields permitted for forward compatibility.",
6
+ "type": "object",
7
+ "required": [
8
+ "specversion",
9
+ "id",
10
+ "source",
11
+ "type",
12
+ "datacontenttype",
13
+ "seq",
14
+ "time",
15
+ "data"
16
+ ],
17
+ "properties": {
18
+ "specversion": {
19
+ "const": "1.0"
20
+ },
21
+ "id": {
22
+ "type": "string",
23
+ "pattern": "^[1-9][0-9]*$"
24
+ },
25
+ "source": {
26
+ "type": "string",
27
+ "pattern": "^urn:slipstream:session:"
28
+ },
29
+ "type": {
30
+ "const": "slipstream.agent.binding.v1"
31
+ },
32
+ "datacontenttype": {
33
+ "const": "application/json"
34
+ },
35
+ "seq": {
36
+ "type": "string",
37
+ "pattern": "^[1-9][0-9]*$"
38
+ },
39
+ "time": {
40
+ "type": "string",
41
+ "format": "date-time"
42
+ },
43
+ "data": {
44
+ "type": "object",
45
+ "required": [
46
+ "session_id",
47
+ "binding_generation",
48
+ "target",
49
+ "verified_transcript_path"
50
+ ],
51
+ "properties": {
52
+ "session_id": {
53
+ "type": "string"
54
+ },
55
+ "binding_generation": {
56
+ "type": "string",
57
+ "pattern": "^[1-9][0-9]*$"
58
+ },
59
+ "target": {
60
+ "type": "object",
61
+ "required": [
62
+ "harness",
63
+ "harness_session_id",
64
+ "worktree"
65
+ ],
66
+ "properties": {
67
+ "harness": {
68
+ "enum": [
69
+ "claude-code",
70
+ "codex"
71
+ ]
72
+ },
73
+ "harness_session_id": {
74
+ "type": "string",
75
+ "minLength": 1
76
+ },
77
+ "worktree": {
78
+ "type": "string",
79
+ "minLength": 1
80
+ }
81
+ }
82
+ },
83
+ "verified_transcript_path": {
84
+ "type": "string",
85
+ "minLength": 1
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://slipstream.dev/schemas/slipstream.agent.connection.v1.json",
4
+ "title": "slipstream.agent.connection.v1",
5
+ "$comment": "Whether the agent chat bound to this capture can take questions. setup_pending: the chat was bound at attach but no setup check has completed. connected: the bound chat received a one-time setup check through its tool-use callback and returned it through its answer tool, proving delivery and answer return at this event's time. It does not prove the chat is still open later; a capture that is no longer live has no agent connection, which /v1/sessions reports. binding_generation names the agent.binding this handshake belongs to; a connection whose generation is not the binding's current one is history only. It is absent only on records written before bindings had generations. Self-contained; unknown fields permitted for forward compatibility.",
6
+ "type": "object",
7
+ "required": ["specversion", "id", "source", "type", "datacontenttype", "seq", "time", "data"],
8
+ "properties": {
9
+ "specversion": { "const": "1.0" },
10
+ "id": { "type": "string", "pattern": "^[1-9][0-9]*$" },
11
+ "source": { "type": "string", "pattern": "^urn:slipstream:session:" },
12
+ "type": { "const": "slipstream.agent.connection.v1" },
13
+ "datacontenttype": { "const": "application/json" },
14
+ "seq": { "type": "string", "pattern": "^[1-9][0-9]*$" },
15
+ "time": { "type": "string", "format": "date-time" },
16
+ "data": {
17
+ "type": "object",
18
+ "required": ["session_id", "state", "target"],
19
+ "properties": {
20
+ "session_id": { "type": "string" },
21
+ "state": { "enum": ["setup_pending", "connected"] },
22
+ "binding_generation": { "type": "string", "pattern": "^[1-9][0-9]*$" },
23
+ "target": {
24
+ "type": "object",
25
+ "required": ["harness", "harness_session_id"],
26
+ "properties": {
27
+ "harness": { "enum": ["claude-code", "codex"] },
28
+ "harness_session_id": { "type": "string", "minLength": 1 }
29
+ }
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://slipstream.dev/schemas/slipstream.agent.unlinked.v1.json",
4
+ "title": "slipstream.agent.unlinked.v1",
5
+ "$comment": "Binding intent for this generation was revoked. unlinked: an explicit unlink; capture keeps running. detached and archived: capture intent was withdrawn too, and this record comes immediately before capture.stopped. Revoked intent wins over a missing record: a crash between the revoke and this append leaves no record, and the next activation's capture.gap restart discloses the hole. Self-contained; unknown fields permitted for forward compatibility.",
6
+ "type": "object",
7
+ "required": [
8
+ "specversion",
9
+ "id",
10
+ "source",
11
+ "type",
12
+ "datacontenttype",
13
+ "seq",
14
+ "time",
15
+ "data"
16
+ ],
17
+ "properties": {
18
+ "specversion": {
19
+ "const": "1.0"
20
+ },
21
+ "id": {
22
+ "type": "string",
23
+ "pattern": "^[1-9][0-9]*$"
24
+ },
25
+ "source": {
26
+ "type": "string",
27
+ "pattern": "^urn:slipstream:session:"
28
+ },
29
+ "type": {
30
+ "const": "slipstream.agent.unlinked.v1"
31
+ },
32
+ "datacontenttype": {
33
+ "const": "application/json"
34
+ },
35
+ "seq": {
36
+ "type": "string",
37
+ "pattern": "^[1-9][0-9]*$"
38
+ },
39
+ "time": {
40
+ "type": "string",
41
+ "format": "date-time"
42
+ },
43
+ "data": {
44
+ "type": "object",
45
+ "required": [
46
+ "session_id",
47
+ "binding_generation",
48
+ "reason"
49
+ ],
50
+ "properties": {
51
+ "session_id": {
52
+ "type": "string"
53
+ },
54
+ "binding_generation": {
55
+ "type": "string",
56
+ "pattern": "^[1-9][0-9]*$"
57
+ },
58
+ "reason": {
59
+ "enum": [
60
+ "unlinked",
61
+ "detached",
62
+ "archived"
63
+ ]
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
@@ -56,6 +56,7 @@
56
56
  "$ref": "#/$defs/scope"
57
57
  },
58
58
  "reason": {
59
+ "$comment": "restart: the daemon did not watch this session for an unknown interval — a daemon restart, or a re-attach after a detach. Reconciliation afterwards reports observed states, not the edits in between.",
59
60
  "enum": [
60
61
  "coalesced",
61
62
  "baseline-unreadable",
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://slipstream.dev/schemas/slipstream.capture.ready.v1.json",
4
+ "title": "slipstream.capture.ready.v1",
5
+ "$comment": "Appended once per activation, after the watcher is installed, the baseline (on start) or reconciliation (on resume) is complete, and every earlier record is durable. An activation (its opening session.started or session.resumed) with no capture.ready has not finished its baseline or reconciliation; events before it are real observations, not yet a complete picture. Whether the activation started or resumed is in that opening event; when it became ready is the envelope time. Self-contained; unknown fields permitted for forward compatibility.",
6
+ "type": "object",
7
+ "required": [
8
+ "specversion",
9
+ "id",
10
+ "source",
11
+ "type",
12
+ "datacontenttype",
13
+ "seq",
14
+ "time",
15
+ "data"
16
+ ],
17
+ "properties": {
18
+ "specversion": {
19
+ "const": "1.0"
20
+ },
21
+ "id": {
22
+ "type": "string",
23
+ "pattern": "^[1-9][0-9]*$"
24
+ },
25
+ "source": {
26
+ "type": "string",
27
+ "pattern": "^urn:slipstream:session:"
28
+ },
29
+ "type": {
30
+ "const": "slipstream.capture.ready.v1"
31
+ },
32
+ "datacontenttype": {
33
+ "const": "application/json"
34
+ },
35
+ "seq": {
36
+ "type": "string",
37
+ "pattern": "^[1-9][0-9]*$"
38
+ },
39
+ "time": {
40
+ "type": "string",
41
+ "format": "date-time"
42
+ },
43
+ "data": {
44
+ "type": "object",
45
+ "required": [
46
+ "session_id"
47
+ ],
48
+ "properties": {
49
+ "session_id": {
50
+ "type": "string"
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }