sessionpipe-core 0.1.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.
- package/LICENSE +202 -0
- package/NOTICE +41 -0
- package/README.md +5 -0
- package/dist/index.js +2380 -0
- package/dist/index.js.map +7 -0
- package/dist/schema/v1.d.ts +579 -0
- package/dist/schema/v1.d.ts.map +1 -0
- package/dist/schema.js +248 -0
- package/dist/schema.js.map +7 -0
- package/dist/src/adapters/antigravity.d.ts +26 -0
- package/dist/src/adapters/antigravity.d.ts.map +1 -0
- package/dist/src/adapters/claude-code.d.ts +18 -0
- package/dist/src/adapters/claude-code.d.ts.map +1 -0
- package/dist/src/adapters/claude-shaped.d.ts +21 -0
- package/dist/src/adapters/claude-shaped.d.ts.map +1 -0
- package/dist/src/adapters/codex-config.d.ts +31 -0
- package/dist/src/adapters/codex-config.d.ts.map +1 -0
- package/dist/src/adapters/codex.d.ts +6 -0
- package/dist/src/adapters/codex.d.ts.map +1 -0
- package/dist/src/adapters/gemini-cli.d.ts +4 -0
- package/dist/src/adapters/gemini-cli.d.ts.map +1 -0
- package/dist/src/adapters/index.d.ts +10 -0
- package/dist/src/adapters/index.d.ts.map +1 -0
- package/dist/src/adapters/types.d.ts +90 -0
- package/dist/src/adapters/types.d.ts.map +1 -0
- package/dist/src/config.d.ts +33 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/events.d.ts +12 -0
- package/dist/src/events.d.ts.map +1 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/outbox.d.ts +41 -0
- package/dist/src/outbox.d.ts.map +1 -0
- package/dist/src/paths.d.ts +8 -0
- package/dist/src/paths.d.ts.map +1 -0
- package/dist/src/privacy/filter.d.ts +10 -0
- package/dist/src/privacy/filter.d.ts.map +1 -0
- package/dist/src/privacy/index.d.ts +4 -0
- package/dist/src/privacy/index.d.ts.map +1 -0
- package/dist/src/privacy/pii.d.ts +8 -0
- package/dist/src/privacy/pii.d.ts.map +1 -0
- package/dist/src/privacy/secrets.d.ts +13 -0
- package/dist/src/privacy/secrets.d.ts.map +1 -0
- package/dist/src/readers/files.d.ts +10 -0
- package/dist/src/readers/files.d.ts.map +1 -0
- package/dist/src/readers/git.d.ts +7 -0
- package/dist/src/readers/git.d.ts.map +1 -0
- package/dist/src/readers/transcripts.d.ts +20 -0
- package/dist/src/readers/transcripts.d.ts.map +1 -0
- package/dist/src/sinks/file.d.ts +11 -0
- package/dist/src/sinks/file.d.ts.map +1 -0
- package/dist/src/sinks/index.d.ts +4 -0
- package/dist/src/sinks/index.d.ts.map +1 -0
- package/dist/src/sinks/stdout.d.ts +11 -0
- package/dist/src/sinks/stdout.d.ts.map +1 -0
- package/dist/src/sinks/types.d.ts +27 -0
- package/dist/src/sinks/types.d.ts.map +1 -0
- package/dist/src/types.d.ts +19 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/ulid.d.ts +3 -0
- package/dist/src/ulid.d.ts.map +1 -0
- package/package.json +56 -0
package/dist/schema.js
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// sessionpipe-core 0.1.0 · Apache-2.0 · https://sessionpipe.org
|
|
2
|
+
|
|
3
|
+
// schema/v1.ts
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
var PROTOCOL = 1;
|
|
6
|
+
var EventType = z.string().regex(/^(?:native|[a-z][a-z0-9]*(?:\.[a-z][a-z0-9_]*)+)$/, "dotted lowercase type, or native");
|
|
7
|
+
var KNOWN_TYPES = [
|
|
8
|
+
"session.started",
|
|
9
|
+
"session.heartbeat",
|
|
10
|
+
"session.ended",
|
|
11
|
+
"session.backfill",
|
|
12
|
+
"session.forgotten",
|
|
13
|
+
"turn.started",
|
|
14
|
+
"turn.ended",
|
|
15
|
+
"turn.transcript",
|
|
16
|
+
"tool.started",
|
|
17
|
+
"tool.ended",
|
|
18
|
+
"files.changed",
|
|
19
|
+
"attention.needed",
|
|
20
|
+
"attention.cleared",
|
|
21
|
+
"subagent.started",
|
|
22
|
+
"subagent.ended",
|
|
23
|
+
"context.compacted",
|
|
24
|
+
"native"
|
|
25
|
+
];
|
|
26
|
+
var TYPE_TIER = {
|
|
27
|
+
"session.started": 0,
|
|
28
|
+
"session.heartbeat": 0,
|
|
29
|
+
"session.ended": 0,
|
|
30
|
+
"session.backfill": 0,
|
|
31
|
+
"session.forgotten": 0,
|
|
32
|
+
"turn.started": 0,
|
|
33
|
+
"turn.ended": 0,
|
|
34
|
+
"turn.transcript": 2,
|
|
35
|
+
"tool.started": 1,
|
|
36
|
+
"tool.ended": 1,
|
|
37
|
+
"files.changed": 1,
|
|
38
|
+
"attention.needed": 0,
|
|
39
|
+
"attention.cleared": 0,
|
|
40
|
+
"subagent.started": 1,
|
|
41
|
+
"subagent.ended": 1,
|
|
42
|
+
"context.compacted": 1,
|
|
43
|
+
native: 3
|
|
44
|
+
};
|
|
45
|
+
var HARNESS_NAMES = [
|
|
46
|
+
"claude-code",
|
|
47
|
+
"codex",
|
|
48
|
+
"gemini-cli",
|
|
49
|
+
"antigravity",
|
|
50
|
+
"cursor",
|
|
51
|
+
"copilot-cli",
|
|
52
|
+
"droid",
|
|
53
|
+
"kiro",
|
|
54
|
+
"opencode"
|
|
55
|
+
];
|
|
56
|
+
var Tier = z.int().min(0).max(3);
|
|
57
|
+
var Ulid = z.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/, "ULID");
|
|
58
|
+
var Rfc3339 = z.iso.datetime({ offset: false, precision: 3 });
|
|
59
|
+
var SessionId = z.string().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/);
|
|
60
|
+
var ToolName = z.string().regex(/^[A-Za-z0-9_.:-]{1,120}$/);
|
|
61
|
+
var Harness = z.object({
|
|
62
|
+
/** From the registry in ADAPTERS.md; a name outside it is allowed ([a-z0-9-]). */
|
|
63
|
+
name: z.string().regex(/^[a-z][a-z0-9-]{0,39}$/),
|
|
64
|
+
version: z.string().max(64).optional(),
|
|
65
|
+
/** The harness's own event name (`PostToolUse`, `agentStop`). */
|
|
66
|
+
event: z.string().max(64).optional()
|
|
67
|
+
});
|
|
68
|
+
var Session = z.object({
|
|
69
|
+
id: SessionId,
|
|
70
|
+
/** Monotonic per session per sender; the dedup key with harness.name and id. */
|
|
71
|
+
seq: z.int().min(0),
|
|
72
|
+
machine: z.string().max(80).optional(),
|
|
73
|
+
/** Home is written `~`. */
|
|
74
|
+
cwd: z.string().max(1024).optional(),
|
|
75
|
+
/** A remote URL with credentials stripped. */
|
|
76
|
+
repo: z.string().max(512).optional(),
|
|
77
|
+
branch: z.string().max(256).optional(),
|
|
78
|
+
model: z.string().max(128).optional(),
|
|
79
|
+
title: z.string().max(200).optional(),
|
|
80
|
+
title_source: z.enum(["custom", "harness", "first-ask"]).optional(),
|
|
81
|
+
url: z.url().max(1024).optional(),
|
|
82
|
+
/** An id, never an email. */
|
|
83
|
+
account_id: z.string().max(128).optional(),
|
|
84
|
+
parent_id: SessionId.nullable().optional()
|
|
85
|
+
});
|
|
86
|
+
var Privacy = z.object({
|
|
87
|
+
/** The redaction rulesets that ran; `secrets@1` always above tier 0. */
|
|
88
|
+
rulesets: z.array(z.string().regex(/^[a-z][a-z0-9-]*@\d+$/)),
|
|
89
|
+
pii: z.boolean()
|
|
90
|
+
});
|
|
91
|
+
var Event = z.object({
|
|
92
|
+
protocol: z.literal(PROTOCOL),
|
|
93
|
+
id: Ulid,
|
|
94
|
+
type: EventType,
|
|
95
|
+
time: Rfc3339,
|
|
96
|
+
tier: Tier,
|
|
97
|
+
harness: Harness,
|
|
98
|
+
session: Session,
|
|
99
|
+
privacy: Privacy,
|
|
100
|
+
/** Per type (see EventData); extra keys allowed and kept. */
|
|
101
|
+
data: z.record(z.string(), z.unknown())
|
|
102
|
+
});
|
|
103
|
+
var Loose = z.object({}).loose();
|
|
104
|
+
var AttentionKind = z.enum(["permission", "question", "elicitation", "idle", "error"]);
|
|
105
|
+
var EventData = z.object({
|
|
106
|
+
"session.started": Loose.extend({ source: z.enum(["startup", "resume", "clear", "compact", "fork", "unknown"]) }),
|
|
107
|
+
"session.heartbeat": Loose,
|
|
108
|
+
"session.ended": Loose.extend({ reason: z.enum(["clear", "logout", "exit", "other"]) }),
|
|
109
|
+
"session.backfill": Loose.extend({ started_at: Rfc3339, last_at: Rfc3339, turns: z.int().min(0).optional() }),
|
|
110
|
+
"session.forgotten": Loose,
|
|
111
|
+
"turn.started": Loose.extend({ turn_id: z.string().max(128).optional(), prompt_chars: z.int().min(0).optional() }),
|
|
112
|
+
"turn.ended": Loose.extend({
|
|
113
|
+
turn_id: z.string().max(128).optional(),
|
|
114
|
+
reason: z.enum(["stop", "interrupt", "error"]),
|
|
115
|
+
ms: z.int().min(0).optional()
|
|
116
|
+
}),
|
|
117
|
+
"turn.transcript": Loose.extend({
|
|
118
|
+
turn: z.int().min(0),
|
|
119
|
+
user: z.string().max(2e4),
|
|
120
|
+
assistant: z.string().max(2e4),
|
|
121
|
+
at: Rfc3339
|
|
122
|
+
}),
|
|
123
|
+
"tool.started": Loose.extend({
|
|
124
|
+
tool: ToolName,
|
|
125
|
+
call_id: z.string().max(128).optional(),
|
|
126
|
+
turn_id: z.string().max(128).optional(),
|
|
127
|
+
/** Set when a subagent made the call. */
|
|
128
|
+
agent_id: z.string().max(128).optional(),
|
|
129
|
+
input: z.unknown().optional()
|
|
130
|
+
}),
|
|
131
|
+
"tool.ended": Loose.extend({
|
|
132
|
+
tool: ToolName,
|
|
133
|
+
call_id: z.string().max(128).optional(),
|
|
134
|
+
turn_id: z.string().max(128).optional(),
|
|
135
|
+
agent_id: z.string().max(128).optional(),
|
|
136
|
+
ms: z.int().min(0).optional(),
|
|
137
|
+
ok: z.boolean(),
|
|
138
|
+
error: z.string().max(2e3).optional(),
|
|
139
|
+
input: z.unknown().optional(),
|
|
140
|
+
output: z.unknown().optional()
|
|
141
|
+
}),
|
|
142
|
+
"files.changed": Loose.extend({ paths: z.array(z.string().max(1024)).max(500) }),
|
|
143
|
+
"attention.needed": Loose.extend({
|
|
144
|
+
attention_id: z.string().max(128),
|
|
145
|
+
kind: AttentionKind,
|
|
146
|
+
tool: ToolName.optional(),
|
|
147
|
+
message: z.string().max(200).optional()
|
|
148
|
+
}),
|
|
149
|
+
"attention.cleared": Loose.extend({
|
|
150
|
+
attention_id: z.string().max(128),
|
|
151
|
+
how: z.enum(["answered", "cancelled", "timeout", "unknown"])
|
|
152
|
+
}),
|
|
153
|
+
"subagent.started": Loose.extend({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),
|
|
154
|
+
"subagent.ended": Loose.extend({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),
|
|
155
|
+
"context.compacted": Loose.extend({ trigger: z.enum(["manual", "auto"]) }),
|
|
156
|
+
native: Loose
|
|
157
|
+
});
|
|
158
|
+
var Batch = z.object({ events: z.array(Event).min(1).max(50) });
|
|
159
|
+
var BatchResponse = z.object({
|
|
160
|
+
accepted: z.int().min(0),
|
|
161
|
+
duplicates: z.int().min(0),
|
|
162
|
+
rejected: z.array(z.object({ id: Ulid, reason: z.string().max(200) })),
|
|
163
|
+
max_tier: Tier
|
|
164
|
+
});
|
|
165
|
+
var ErrorResponse = z.object({
|
|
166
|
+
reason: z.string().max(200),
|
|
167
|
+
supported: z.array(z.int()).optional(),
|
|
168
|
+
max_tier: Tier.optional()
|
|
169
|
+
});
|
|
170
|
+
var Capability = z.enum(["events", "backfill", "forget", "control", "native"]);
|
|
171
|
+
var WellKnown = z.object({
|
|
172
|
+
protocol: z.array(z.int().min(1)).min(1),
|
|
173
|
+
max_tier: Tier,
|
|
174
|
+
capabilities: z.array(z.string().regex(/^[a-z][a-z0-9-]*$/)),
|
|
175
|
+
auth: z.array(z.enum(["bearer"])).default(["bearer"]),
|
|
176
|
+
endpoints: z.object({
|
|
177
|
+
events: z.string(),
|
|
178
|
+
control: z.string().optional(),
|
|
179
|
+
native: z.string().optional()
|
|
180
|
+
}),
|
|
181
|
+
batch: z.object({ max_events: z.int().min(1).max(50), max_bytes: z.int().min(1024).max(262144) }),
|
|
182
|
+
control: z.object({ wait_max_s: z.int().min(1).max(60) }).optional()
|
|
183
|
+
});
|
|
184
|
+
var ControlKind = z.enum(["permission.answer", "prompt", "cancel"]);
|
|
185
|
+
var ControlMessage = z.object({
|
|
186
|
+
id: Ulid,
|
|
187
|
+
kind: ControlKind,
|
|
188
|
+
/** The attention_id a permission answer is for. */
|
|
189
|
+
for: z.string().max(128).optional(),
|
|
190
|
+
decision: z.enum(["allow", "deny"]).optional(),
|
|
191
|
+
/** The prompt text. */
|
|
192
|
+
text: z.string().max(2e4).optional(),
|
|
193
|
+
/** Shown to the model beside a decision. */
|
|
194
|
+
note: z.string().max(2e3).optional(),
|
|
195
|
+
at: Rfc3339,
|
|
196
|
+
expires_at: Rfc3339
|
|
197
|
+
});
|
|
198
|
+
var ControlPoll = z.object({ messages: z.array(ControlMessage) });
|
|
199
|
+
var ControlAck = z.object({
|
|
200
|
+
acks: z.array(
|
|
201
|
+
z.object({
|
|
202
|
+
id: Ulid,
|
|
203
|
+
outcome: z.enum(["delivered", "expired", "unsupported", "failed"]),
|
|
204
|
+
at: Rfc3339,
|
|
205
|
+
detail: z.string().max(500).optional()
|
|
206
|
+
})
|
|
207
|
+
).min(1)
|
|
208
|
+
});
|
|
209
|
+
var SCHEMAS = {
|
|
210
|
+
event: Event,
|
|
211
|
+
"event-data": EventData,
|
|
212
|
+
batch: Batch,
|
|
213
|
+
"batch-response": BatchResponse,
|
|
214
|
+
error: ErrorResponse,
|
|
215
|
+
"well-known": WellKnown,
|
|
216
|
+
control: ControlMessage,
|
|
217
|
+
"control-poll": ControlPoll,
|
|
218
|
+
"control-ack": ControlAck
|
|
219
|
+
};
|
|
220
|
+
export {
|
|
221
|
+
AttentionKind,
|
|
222
|
+
Batch,
|
|
223
|
+
BatchResponse,
|
|
224
|
+
Capability,
|
|
225
|
+
ControlAck,
|
|
226
|
+
ControlKind,
|
|
227
|
+
ControlMessage,
|
|
228
|
+
ControlPoll,
|
|
229
|
+
ErrorResponse,
|
|
230
|
+
Event,
|
|
231
|
+
EventData,
|
|
232
|
+
EventType,
|
|
233
|
+
HARNESS_NAMES,
|
|
234
|
+
Harness,
|
|
235
|
+
KNOWN_TYPES,
|
|
236
|
+
PROTOCOL,
|
|
237
|
+
Privacy,
|
|
238
|
+
Rfc3339,
|
|
239
|
+
SCHEMAS,
|
|
240
|
+
Session,
|
|
241
|
+
SessionId,
|
|
242
|
+
TYPE_TIER,
|
|
243
|
+
Tier,
|
|
244
|
+
ToolName,
|
|
245
|
+
Ulid,
|
|
246
|
+
WellKnown
|
|
247
|
+
};
|
|
248
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../schema/v1.ts"],
|
|
4
|
+
"sourcesContent": ["// SPDX-License-Identifier: Apache-2.0\n// The one source for the protocol's shapes. schemas/v1/*.json are GENERATED from\n// this file (`npm run schemas`); core's runtime types are inferred from it with\n// type-only imports, so zod never enters the zero-dependency bundle. Prose lives in\n// spec/PROTOCOL.md; a rule that is not encoded here is a MUST in words only.\nimport { z } from \"zod\";\n\nexport const PROTOCOL = 1;\n\n/** Dotted, lowercase. Unknown types MUST be accepted and stored. */\nexport const EventType = z\n .string()\n .regex(/^(?:native|[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+)$/, \"dotted lowercase type, or native\");\n\nexport const KNOWN_TYPES = [\n \"session.started\",\n \"session.heartbeat\",\n \"session.ended\",\n \"session.backfill\",\n \"session.forgotten\",\n \"turn.started\",\n \"turn.ended\",\n \"turn.transcript\",\n \"tool.started\",\n \"tool.ended\",\n \"files.changed\",\n \"attention.needed\",\n \"attention.cleared\",\n \"subagent.started\",\n \"subagent.ended\",\n \"context.compacted\",\n \"native\",\n] as const;\n\n/** The lowest tier that carries each known type. */\nexport const TYPE_TIER: Record<(typeof KNOWN_TYPES)[number], 0 | 1 | 2 | 3> = {\n \"session.started\": 0,\n \"session.heartbeat\": 0,\n \"session.ended\": 0,\n \"session.backfill\": 0,\n \"session.forgotten\": 0,\n \"turn.started\": 0,\n \"turn.ended\": 0,\n \"turn.transcript\": 2,\n \"tool.started\": 1,\n \"tool.ended\": 1,\n \"files.changed\": 1,\n \"attention.needed\": 0,\n \"attention.cleared\": 0,\n \"subagent.started\": 1,\n \"subagent.ended\": 1,\n \"context.compacted\": 1,\n native: 3,\n};\n\nexport const HARNESS_NAMES = [\n \"claude-code\",\n \"codex\",\n \"gemini-cli\",\n \"antigravity\",\n \"cursor\",\n \"copilot-cli\",\n \"droid\",\n \"kiro\",\n \"opencode\",\n] as const;\n\nexport const Tier = z.int().min(0).max(3);\nexport const Ulid = z.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/, \"ULID\");\nexport const Rfc3339 = z.iso.datetime({ offset: false, precision: 3 });\nexport const SessionId = z\n .string()\n .min(1)\n .max(128)\n .regex(/^[A-Za-z0-9._:-]+$/);\nexport const ToolName = z.string().regex(/^[A-Za-z0-9_.:-]{1,120}$/);\n\nexport const Harness = z.object({\n /** From the registry in ADAPTERS.md; a name outside it is allowed ([a-z0-9-]). */\n name: z.string().regex(/^[a-z][a-z0-9-]{0,39}$/),\n version: z.string().max(64).optional(),\n /** The harness's own event name (`PostToolUse`, `agentStop`). */\n event: z.string().max(64).optional(),\n});\n\nexport const Session = z.object({\n id: SessionId,\n /** Monotonic per session per sender; the dedup key with harness.name and id. */\n seq: z.int().min(0),\n machine: z.string().max(80).optional(),\n /** Home is written `~`. */\n cwd: z.string().max(1024).optional(),\n /** A remote URL with credentials stripped. */\n repo: z.string().max(512).optional(),\n branch: z.string().max(256).optional(),\n model: z.string().max(128).optional(),\n title: z.string().max(200).optional(),\n title_source: z.enum([\"custom\", \"harness\", \"first-ask\"]).optional(),\n url: z.url().max(1024).optional(),\n /** An id, never an email. */\n account_id: z.string().max(128).optional(),\n parent_id: SessionId.nullable().optional(),\n});\n\nexport const Privacy = z.object({\n /** The redaction rulesets that ran; `secrets@1` always above tier 0. */\n rulesets: z.array(z.string().regex(/^[a-z][a-z0-9-]*@\\d+$/)),\n pii: z.boolean(),\n});\n\nexport const Event = z.object({\n protocol: z.literal(PROTOCOL),\n id: Ulid,\n type: EventType,\n time: Rfc3339,\n tier: Tier,\n harness: Harness,\n session: Session,\n privacy: Privacy,\n /** Per type (see EventData); extra keys allowed and kept. */\n data: z.record(z.string(), z.unknown()),\n});\n\n// --- data per type --------------------------------------------------------------\n\nconst Loose = z.object({}).loose();\nexport const AttentionKind = z.enum([\"permission\", \"question\", \"elicitation\", \"idle\", \"error\"]);\n\nexport const EventData = z.object({\n \"session.started\": Loose.extend({ source: z.enum([\"startup\", \"resume\", \"clear\", \"compact\", \"fork\", \"unknown\"]) }),\n \"session.heartbeat\": Loose,\n \"session.ended\": Loose.extend({ reason: z.enum([\"clear\", \"logout\", \"exit\", \"other\"]) }),\n \"session.backfill\": Loose.extend({ started_at: Rfc3339, last_at: Rfc3339, turns: z.int().min(0).optional() }),\n \"session.forgotten\": Loose,\n \"turn.started\": Loose.extend({ turn_id: z.string().max(128).optional(), prompt_chars: z.int().min(0).optional() }),\n \"turn.ended\": Loose.extend({\n turn_id: z.string().max(128).optional(),\n reason: z.enum([\"stop\", \"interrupt\", \"error\"]),\n ms: z.int().min(0).optional(),\n }),\n \"turn.transcript\": Loose.extend({\n turn: z.int().min(0),\n user: z.string().max(20_000),\n assistant: z.string().max(20_000),\n at: Rfc3339,\n }),\n \"tool.started\": Loose.extend({\n tool: ToolName,\n call_id: z.string().max(128).optional(),\n turn_id: z.string().max(128).optional(),\n /** Set when a subagent made the call. */\n agent_id: z.string().max(128).optional(),\n input: z.unknown().optional(),\n }),\n \"tool.ended\": Loose.extend({\n tool: ToolName,\n call_id: z.string().max(128).optional(),\n turn_id: z.string().max(128).optional(),\n agent_id: z.string().max(128).optional(),\n ms: z.int().min(0).optional(),\n ok: z.boolean(),\n error: z.string().max(2000).optional(),\n input: z.unknown().optional(),\n output: z.unknown().optional(),\n }),\n \"files.changed\": Loose.extend({ paths: z.array(z.string().max(1024)).max(500) }),\n \"attention.needed\": Loose.extend({\n attention_id: z.string().max(128),\n kind: AttentionKind,\n tool: ToolName.optional(),\n message: z.string().max(200).optional(),\n }),\n \"attention.cleared\": Loose.extend({\n attention_id: z.string().max(128),\n how: z.enum([\"answered\", \"cancelled\", \"timeout\", \"unknown\"]),\n }),\n \"subagent.started\": Loose.extend({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),\n \"subagent.ended\": Loose.extend({ agent_id: z.string().max(128), agent_type: z.string().max(128).optional() }),\n \"context.compacted\": Loose.extend({ trigger: z.enum([\"manual\", \"auto\"]) }),\n native: Loose,\n});\n\n// --- wire -----------------------------------------------------------------------\n\nexport const Batch = z.object({ events: z.array(Event).min(1).max(50) });\n\nexport const BatchResponse = z.object({\n accepted: z.int().min(0),\n duplicates: z.int().min(0),\n rejected: z.array(z.object({ id: Ulid, reason: z.string().max(200) })),\n max_tier: Tier,\n});\n\nexport const ErrorResponse = z.object({\n reason: z.string().max(200),\n supported: z.array(z.int()).optional(),\n max_tier: Tier.optional(),\n});\n\nexport const Capability = z.enum([\"events\", \"backfill\", \"forget\", \"control\", \"native\"]);\n\nexport const WellKnown = z.object({\n protocol: z.array(z.int().min(1)).min(1),\n max_tier: Tier,\n capabilities: z.array(z.string().regex(/^[a-z][a-z0-9-]*$/)),\n auth: z.array(z.enum([\"bearer\"])).default([\"bearer\"]),\n endpoints: z.object({\n events: z.string(),\n control: z.string().optional(),\n native: z.string().optional(),\n }),\n batch: z.object({ max_events: z.int().min(1).max(50), max_bytes: z.int().min(1024).max(262_144) }),\n control: z.object({ wait_max_s: z.int().min(1).max(60) }).optional(),\n});\n\nexport const ControlKind = z.enum([\"permission.answer\", \"prompt\", \"cancel\"]);\n\nexport const ControlMessage = z.object({\n id: Ulid,\n kind: ControlKind,\n /** The attention_id a permission answer is for. */\n for: z.string().max(128).optional(),\n decision: z.enum([\"allow\", \"deny\"]).optional(),\n /** The prompt text. */\n text: z.string().max(20_000).optional(),\n /** Shown to the model beside a decision. */\n note: z.string().max(2000).optional(),\n at: Rfc3339,\n expires_at: Rfc3339,\n});\n\nexport const ControlPoll = z.object({ messages: z.array(ControlMessage) });\n\nexport const ControlAck = z.object({\n acks: z\n .array(\n z.object({\n id: Ulid,\n outcome: z.enum([\"delivered\", \"expired\", \"unsupported\", \"failed\"]),\n at: Rfc3339,\n detail: z.string().max(500).optional(),\n }),\n )\n .min(1),\n});\n\n/** What `npm run schemas` writes to schemas/v1/<name>.json. */\nexport const SCHEMAS = {\n event: Event,\n \"event-data\": EventData,\n batch: Batch,\n \"batch-response\": BatchResponse,\n error: ErrorResponse,\n \"well-known\": WellKnown,\n control: ControlMessage,\n \"control-poll\": ControlPoll,\n \"control-ack\": ControlAck,\n} as const;\n"],
|
|
5
|
+
"mappings": ";;;AAKA,SAAS,SAAS;AAEX,IAAM,WAAW;AAGjB,IAAM,YAAY,EACtB,OAAO,EACP,MAAM,qDAAqD,kCAAkC;AAEzF,IAAM,cAAc;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,IAAM,YAAiE;AAAA,EAC5E,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,qBAAqB;AAAA,EACrB,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,QAAQ;AAC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,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,IAAI;AAAA,EACJ,MAAM;AAAA;AAAA,EAEN,KAAK,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EAClC,UAAU,EAAE,KAAK,CAAC,SAAS,MAAM,CAAC,EAAE,SAAS;AAAA;AAAA,EAE7C,MAAM,EAAE,OAAO,EAAE,IAAI,GAAM,EAAE,SAAS;AAAA;AAAA,EAEtC,MAAM,EAAE,OAAO,EAAE,IAAI,GAAI,EAAE,SAAS;AAAA,EACpC,IAAI;AAAA,EACJ,YAAY;AACd,CAAC;AAEM,IAAM,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,EAAE,CAAC;AAElE,IAAM,aAAa,EAAE,OAAO;AAAA,EACjC,MAAM,EACH;AAAA,IACC,EAAE,OAAO;AAAA,MACP,IAAI;AAAA,MACJ,SAAS,EAAE,KAAK,CAAC,aAAa,WAAW,eAAe,QAAQ,CAAC;AAAA,MACjE,IAAI;AAAA,MACJ,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,IACvC,CAAC;AAAA,EACH,EACC,IAAI,CAAC;AACV,CAAC;AAGM,IAAM,UAAU;AAAA,EACrB,OAAO;AAAA,EACP,cAAc;AAAA,EACd,OAAO;AAAA,EACP,kBAAkB;AAAA,EAClB,OAAO;AAAA,EACP,cAAc;AAAA,EACd,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,eAAe;AACjB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Adapter, FactsState, SessionFacts } from "./types.js";
|
|
2
|
+
export declare const AG_EVENTS: readonly ["PreInvocation", "PostInvocation", "PreToolUse", "PostToolUse", "Stop"];
|
|
3
|
+
export declare const antigravity: Adapter;
|
|
4
|
+
/** A folder as Antigravity writes it (a file:// URI or a path) → an absolute path, or null. */
|
|
5
|
+
export declare function agPath(p: unknown): string | null;
|
|
6
|
+
export declare const agWorkspaces: (paths: unknown) => string[];
|
|
7
|
+
/** The project whose folder is the workspace or contains it; the deepest wins. */
|
|
8
|
+
export declare function agMatchProject(projects: {
|
|
9
|
+
id: string;
|
|
10
|
+
folders: string[];
|
|
11
|
+
}[], workspaces: string[]): string | null;
|
|
12
|
+
/** Antigravity's web remote: https://antigravity.google.com/r/<installation uuid>-v2, with
|
|
13
|
+
* ?p=c/<conversation>?section=<project> when the project is known. */
|
|
14
|
+
export declare function antigravityRemoteUrl(transcript: string, opts: {
|
|
15
|
+
conversation?: string;
|
|
16
|
+
workspaces?: string[];
|
|
17
|
+
env: NodeJS.ProcessEnv;
|
|
18
|
+
projectsDir?: string;
|
|
19
|
+
}): string | null;
|
|
20
|
+
export declare function antigravityFacts(file: string, opts: {
|
|
21
|
+
conversation: string;
|
|
22
|
+
workspaces: string[];
|
|
23
|
+
state: FactsState;
|
|
24
|
+
env: NodeJS.ProcessEnv;
|
|
25
|
+
}): SessionFacts;
|
|
26
|
+
//# sourceMappingURL=antigravity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"antigravity.d.ts","sourceRoot":"","sources":["../../../src/adapters/antigravity.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,OAAO,EAEP,UAAU,EAKV,YAAY,EACb,MAAM,YAAY,CAAC;AAIpB,eAAO,MAAM,SAAS,mFAAoF,CAAC;AAgB3G,eAAO,MAAM,WAAW,EAAE,OAiIzB,CAAC;AAOF,+FAA+F;AAC/F,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAahD;AACD,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,MAAM,EAIR,CAAC;AAoC7C,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,QAAQ,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAiBjH;AAED;uEACuE;AACvE,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACnG,MAAM,GAAG,IAAI,CAiBf;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;CAAE,GAC9F,YAAY,CAyBd"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Adapter, FactsState, SessionFacts } from "./types.js";
|
|
2
|
+
export declare const CLAUDE_EVENTS: readonly ["SessionStart", "UserPromptSubmit", "PreToolUse", "PostToolUse", "PostToolUseFailure", "PermissionRequest", "Notification", "Stop", "SubagentStart", "SubagentStop", "PreCompact", "PostCompact", "SessionEnd"];
|
|
3
|
+
/** Every Claude Code config dir on this machine. */
|
|
4
|
+
export declare function claudeDirs(env?: NodeJS.ProcessEnv, home?: string): string[];
|
|
5
|
+
export declare const claudeCode: Adapter;
|
|
6
|
+
/** The Claude Code process that ran this hook: the nearest ancestor with a registry
|
|
7
|
+
* file (hooks run under a shell, so usually the parent's parent). */
|
|
8
|
+
export declare function claudePid(env?: NodeJS.ProcessEnv): number | null;
|
|
9
|
+
/** A first ask as the Claude Code app titles an untitled session: whitespace
|
|
10
|
+
* collapsed, whole up to 50 characters, else its first 50 and "...". */
|
|
11
|
+
export declare function appTitle(text: string): string;
|
|
12
|
+
/** A session's title and where it came from, best first: /rename (registry "user"
|
|
13
|
+
* name or custom-title) → Claude Code's own title (registry "auto" name or
|
|
14
|
+
* ai-title) → the first ask, marked first-ask so a real title later replaces it. */
|
|
15
|
+
export declare function claudeFacts(file: string, sessionId: string, hints: Record<string, unknown>, state: FactsState): SessionFacts;
|
|
16
|
+
/** For tests: each hook runs in a fresh process; a test that edits the registry mid-run clears the cache. */
|
|
17
|
+
export declare const _resetClaudeCaches: () => void;
|
|
18
|
+
//# sourceMappingURL=claude-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../src/adapters/claude-code.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAe,UAAU,EAAsC,YAAY,EAAE,MAAM,YAAY,CAAC;AAGrH,eAAO,MAAM,aAAa,2NAchB,CAAC;AAIX,oDAAoD;AACpD,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,EAAE,IAAI,SAAO,GAAG,MAAM,EAAE,CAiBtF;AAgBD,eAAO,MAAM,UAAU,EAAE,OA0LxB,CAAC;AA4EF;sEACsE;AACtE,wBAAgB,SAAS,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,IAAI,CAa7E;AA4DD;yEACyE;AACzE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG7C;AA2DD;;qFAEqF;AACrF,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,EAAE,UAAU,GAChB,YAAY,CA6Fd;AAED,6GAA6G;AAC7G,eAAO,MAAM,kBAAkB,QAAO,IAGrC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HookCommand, InstallReport } from "./types.js";
|
|
2
|
+
export interface ClaudeShapedOptions {
|
|
3
|
+
/** Which events take a `matcher` (tool and permission events). */
|
|
4
|
+
matcherFor: (event: string) => string | undefined;
|
|
5
|
+
/** Seconds. */
|
|
6
|
+
timeout: number;
|
|
7
|
+
/** Extra top-level keys the file must carry (Cursor/Copilot: version: 1). */
|
|
8
|
+
top?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
/** A command of ours: a path that contains "sessionpipe" and ends in hook.js, then a harness and an event. */
|
|
11
|
+
export declare const OURS: RegExp;
|
|
12
|
+
export declare const isOurs: (h: {
|
|
13
|
+
hooks?: {
|
|
14
|
+
command?: string;
|
|
15
|
+
}[];
|
|
16
|
+
}) => boolean;
|
|
17
|
+
export declare function readJson(file: string): Record<string, unknown>;
|
|
18
|
+
export declare function installClaudeShaped(file: string, harness: string, events: readonly string[], cmd: HookCommand, o: ClaudeShapedOptions): InstallReport;
|
|
19
|
+
export declare function uninstallClaudeShaped(file: string, events: readonly string[]): InstallReport;
|
|
20
|
+
export declare function installedClaudeShaped(file: string, harness: string, events: readonly string[], cmd: HookCommand, o: ClaudeShapedOptions): "current" | "stale" | "missing";
|
|
21
|
+
//# sourceMappingURL=claude-shaped.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-shaped.d.ts","sourceRoot":"","sources":["../../../src/adapters/claude-shaped.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAClD,eAAe;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,8GAA8G;AAC9G,eAAO,MAAM,IAAI,QAAqE,CAAC;AACvF,eAAO,MAAM,MAAM,GAAI,GAAG;IAAE,KAAK,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,KAAG,OACwC,CAAC;AAExG,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM9D;AAUD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,mBAAmB,GACrB,aAAa,CA2Bf;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,aAAa,CAqB5F;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,mBAAmB,GACrB,SAAS,GAAG,OAAO,GAAG,SAAS,CAYjC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** A notify that runs sessionpipe's hook directly. */
|
|
2
|
+
export declare const OURS: RegExp;
|
|
3
|
+
/** Offset of the first table header, or -1. */
|
|
4
|
+
export declare function firstTableAt(text: string): number;
|
|
5
|
+
export declare function parseArgv(raw: string): string[] | null;
|
|
6
|
+
export interface Notify {
|
|
7
|
+
raw: string;
|
|
8
|
+
argv: string[] | null;
|
|
9
|
+
index: number;
|
|
10
|
+
length: number;
|
|
11
|
+
misplaced: boolean;
|
|
12
|
+
other: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** notify as Codex sees it; `misplaced` for a line of ours inside a table. */
|
|
15
|
+
export declare function readNotify(text: string): Notify | null;
|
|
16
|
+
/** Put `line` at the top level: before the first table, or at the end of a file that has none. */
|
|
17
|
+
export declare function insertTopLevel(text: string, line: string): string;
|
|
18
|
+
/** The config with `line` as its notify, for a config whose notify is ours or absent. */
|
|
19
|
+
export declare function withNotify(text: string, line: string): string;
|
|
20
|
+
/** The config with its top-level notify line replaced by `line`. */
|
|
21
|
+
export declare function replaceNotify(text: string, line: string): string | null;
|
|
22
|
+
/** The config with our top-level or misplaced notify removed. */
|
|
23
|
+
export declare function withoutNotify(text: string): string;
|
|
24
|
+
export declare function previousNotify(argv: string[] | null): string[] | null;
|
|
25
|
+
export declare function withPrevious(argv: string[], prev: string[] | null): string[];
|
|
26
|
+
/** The raw notify value with its --previous-notify pair removed, formatting kept. */
|
|
27
|
+
export declare function stripPreviousRaw(raw: string): string;
|
|
28
|
+
/** The raw notify value with `prev` as its --previous-notify, formatting of the rest kept. */
|
|
29
|
+
export declare function withPreviousRaw(raw: string, prev: string[]): string;
|
|
30
|
+
export declare const isComputerUse: (argv: string[] | null) => boolean;
|
|
31
|
+
//# sourceMappingURL=codex-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-config.d.ts","sourceRoot":"","sources":["../../../src/adapters/codex-config.ts"],"names":[],"mappings":"AASA,sDAAsD;AACtD,eAAO,MAAM,IAAI,QAAqC,CAAC;AAoCvD,+CAA+C;AAC/C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASjD;AAOD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAOtD;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmCtD;AAMD,kGAAkG;AAClG,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAIjE;AAED,yFAAyF;AACzF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAK7D;AAED,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIvE;AAED,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIlD;AAKD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,MAAM,EAAE,GAAG,IAAI,CAIrE;AACD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,MAAM,EAAE,CAM5E;AACD,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AACD,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAGnE;AACD,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,GAAG,IAAI,KAAG,OAC6C,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Adapter, SessionFacts } from "./types.js";
|
|
2
|
+
export declare const CODEX_EVENTS: readonly ["SessionStart", "UserPromptSubmit", "PreToolUse", "PostToolUse", "PermissionRequest", "Stop", "Interrupt", "SubagentStart", "SubagentStop", "PreCompact", "PostCompact", "SessionEnd"];
|
|
3
|
+
export declare const codex: Adapter;
|
|
4
|
+
/** Codex keeps no title; its first real ask stands in. */
|
|
5
|
+
export declare function codexFacts(file: string): SessionFacts;
|
|
6
|
+
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/adapters/codex.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAmD,YAAY,EAAE,MAAM,YAAY,CAAC;AAGzG,eAAO,MAAM,YAAY,kMAaf,CAAC;AA8GX,eAAO,MAAM,KAAK,EAAE,OA6KnB,CAAC;AAOF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CA2CrD"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Adapter } from "./types.js";
|
|
2
|
+
export declare const GEMINI_EVENTS: readonly ["SessionStart", "BeforeAgent", "BeforeTool", "AfterTool", "Notification", "AfterAgent", "PreCompress", "SessionEnd"];
|
|
3
|
+
export declare const geminiCli: Adapter;
|
|
4
|
+
//# sourceMappingURL=gemini-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini-cli.d.ts","sourceRoot":"","sources":["../../../src/adapters/gemini-cli.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,OAAO,EAAuC,MAAM,YAAY,CAAC;AAG/E,eAAO,MAAM,aAAa,gIAShB,CAAC;AAMX,eAAO,MAAM,SAAS,EAAE,OAiIvB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { antigravity } from "./antigravity.js";
|
|
2
|
+
import { claudeCode } from "./claude-code.js";
|
|
3
|
+
import { codex } from "./codex.js";
|
|
4
|
+
import { geminiCli } from "./gemini-cli.js";
|
|
5
|
+
import type { Adapter } from "./types.js";
|
|
6
|
+
export declare const ADAPTERS: readonly Adapter[];
|
|
7
|
+
export declare const adapterByName: (name: string) => Adapter | undefined;
|
|
8
|
+
export type { Adapter, AdapterEvent, BackfillRow, FactsState, HookCommand, HookInput, HookResult, InstallReport, SessionFacts, TranscriptRead, Turn, } from "./types.js";
|
|
9
|
+
export { antigravity, claudeCode, codex, geminiCli };
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,eAAO,MAAM,QAAQ,EAAE,SAAS,OAAO,EAAgD,CAAC;AACxF,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,OAAO,GAAG,SAAkD,CAAC;AAC1G,YAAY,EACV,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,IAAI,GACL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Session } from "../types.js";
|
|
2
|
+
export interface HookInput {
|
|
3
|
+
/** [harness, event, ...] as the hook was invoked. */
|
|
4
|
+
argv: string[];
|
|
5
|
+
stdin: string;
|
|
6
|
+
env: Record<string, string | undefined>;
|
|
7
|
+
cwd: string;
|
|
8
|
+
}
|
|
9
|
+
/** An event as an adapter emits it: no id/time/seq/tier yet (core adds them). */
|
|
10
|
+
export interface AdapterEvent {
|
|
11
|
+
type: string;
|
|
12
|
+
data: Record<string, unknown>;
|
|
13
|
+
/** The harness's own event name, for `harness.event`. */
|
|
14
|
+
harnessEvent: string;
|
|
15
|
+
}
|
|
16
|
+
export interface HookResult {
|
|
17
|
+
session: {
|
|
18
|
+
id: string;
|
|
19
|
+
} & Partial<Session>;
|
|
20
|
+
events: AdapterEvent[];
|
|
21
|
+
/** The transcript file, when the payload names it (tier-2 reads). */
|
|
22
|
+
transcript?: string;
|
|
23
|
+
/** What the harness must see on stdout, if anything. */
|
|
24
|
+
stdout?: string;
|
|
25
|
+
/** Hints for the facts pass (pids, workspaces, a desktop id). */
|
|
26
|
+
hints?: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
export interface Turn {
|
|
29
|
+
user: string;
|
|
30
|
+
assistant: string;
|
|
31
|
+
at: number;
|
|
32
|
+
endLine: number;
|
|
33
|
+
}
|
|
34
|
+
export interface TranscriptRead {
|
|
35
|
+
turns: Turn[];
|
|
36
|
+
/** The line the cursor may advance to once every turn is delivered. */
|
|
37
|
+
line: number;
|
|
38
|
+
}
|
|
39
|
+
export interface SessionFacts extends Partial<Session> {
|
|
40
|
+
first_ask?: string;
|
|
41
|
+
started_at?: number;
|
|
42
|
+
last_at?: number;
|
|
43
|
+
harness_version?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface BackfillRow {
|
|
46
|
+
session: {
|
|
47
|
+
id: string;
|
|
48
|
+
} & Partial<Session>;
|
|
49
|
+
started_at: number;
|
|
50
|
+
last_at: number;
|
|
51
|
+
turns?: number;
|
|
52
|
+
}
|
|
53
|
+
/** The command a hook entry runs: absolute node, absolute script, then args. */
|
|
54
|
+
export type HookCommand = (args: string[]) => {
|
|
55
|
+
argv: string[];
|
|
56
|
+
command: string;
|
|
57
|
+
};
|
|
58
|
+
export interface InstallReport {
|
|
59
|
+
file: string;
|
|
60
|
+
changed: boolean;
|
|
61
|
+
note?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface Adapter {
|
|
64
|
+
readonly name: string;
|
|
65
|
+
/** The harness's own event names this adapter hooks. */
|
|
66
|
+
readonly events: readonly string[];
|
|
67
|
+
/** Is the harness on this machine (a config dir exists)? */
|
|
68
|
+
detect(env?: NodeJS.ProcessEnv): boolean;
|
|
69
|
+
/** Config files the installer would write. */
|
|
70
|
+
configFiles(env?: NodeJS.ProcessEnv): string[];
|
|
71
|
+
install(cmd: HookCommand, env?: NodeJS.ProcessEnv): InstallReport[];
|
|
72
|
+
uninstall(env?: NodeJS.ProcessEnv): InstallReport[];
|
|
73
|
+
/** Is our hook present and current in the given file? */
|
|
74
|
+
installed(cmd: HookCommand, env?: NodeJS.ProcessEnv): {
|
|
75
|
+
file: string;
|
|
76
|
+
state: "current" | "stale" | "missing" | "misplaced";
|
|
77
|
+
}[];
|
|
78
|
+
fromHook(input: HookInput): HookResult | null;
|
|
79
|
+
readTranscript(file: string, fromLine: number): TranscriptRead;
|
|
80
|
+
facts(session: {
|
|
81
|
+
id: string;
|
|
82
|
+
} & Partial<Session>, transcript: string | undefined, hints: Record<string, unknown>, state: FactsState): SessionFacts;
|
|
83
|
+
backfill(sinceMs: number, env?: NodeJS.ProcessEnv): BackfillRow[];
|
|
84
|
+
}
|
|
85
|
+
/** Small per-session memory the facts pass keeps under <state>/facts/. */
|
|
86
|
+
export interface FactsState {
|
|
87
|
+
get(harness: string, session: string): Record<string, unknown>;
|
|
88
|
+
save(harness: string, session: string, patch: Record<string, unknown>): void;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/types.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,WAAW,SAAS;IACxB,qDAAqD;IACrD,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,iFAAiF;AACjF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC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AAY,CAAC;IAChB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,WAAW,EAAE,CAAC;CACnE;AAED,0EAA0E;AAC1E,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC9E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Tier } from "./types.js";
|
|
2
|
+
export interface SinkConfig {
|
|
3
|
+
name: string;
|
|
4
|
+
/** https://…, file:PATH, stdout, otlp:URL */
|
|
5
|
+
url: string;
|
|
6
|
+
tier: Tier;
|
|
7
|
+
pii?: boolean;
|
|
8
|
+
control?: boolean;
|
|
9
|
+
token?: string;
|
|
10
|
+
/** whsec_… for Standard Webhooks signatures. */
|
|
11
|
+
secret?: string;
|
|
12
|
+
/** Learned from the receiver's well-known file; re-read daily. */
|
|
13
|
+
max_tier?: Tier;
|
|
14
|
+
well_known_at?: string;
|
|
15
|
+
paused?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Config {
|
|
18
|
+
machine?: string;
|
|
19
|
+
sinks: SinkConfig[];
|
|
20
|
+
harnesses: Record<string, {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
update_check?: boolean;
|
|
24
|
+
keep_days?: number;
|
|
25
|
+
}
|
|
26
|
+
export declare const DEFAULT_CONFIG: Config;
|
|
27
|
+
export declare function readConfig(file?: string): Config;
|
|
28
|
+
export declare function writeConfig(c: Config, file?: string): void;
|
|
29
|
+
/** The machine's name: what the person configured, else the hostname without a
|
|
30
|
+
* local suffix. Never guessed from anything else (a hand-typed name once linked 64
|
|
31
|
+
* versions to nothing). */
|
|
32
|
+
export declare function machineName(c: Config, hostname: string): string;
|
|
33
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,MAAM;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACjD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,MAAwE,CAAC;AAEtG,wBAAgB,UAAU,CAAC,IAAI,GAAE,MAAqB,GAAG,MAAM,CAY9D;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,MAAqB,GAAG,IAAI,CAQxE;AAED;;4BAE4B;AAC5B,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG/D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AdapterEvent } from "./adapters/types.js";
|
|
2
|
+
import type { Event, Session } from "./types.js";
|
|
3
|
+
export interface EventContext {
|
|
4
|
+
harness: {
|
|
5
|
+
name: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
};
|
|
8
|
+
session: Session;
|
|
9
|
+
now?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function makeEvent(a: AdapterEvent, ctx: EventContext): Event;
|
|
12
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGjD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,GAAG,KAAK,CAenE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @sessionpipe/core — protocol types, adapters, privacy, outbox, sinks. Zero runtime dependencies. */
|
|
2
|
+
export declare const PROTOCOL_VERSION: 1;
|
|
3
|
+
export * from "./adapters/index.js";
|
|
4
|
+
export { type Config, DEFAULT_CONFIG, machineName, readConfig, type SinkConfig, writeConfig } from "./config.js";
|
|
5
|
+
export { type EventContext, makeEvent } from "./events.js";
|
|
6
|
+
export { Cursors, Outbox, type OutboxRef, takeLock } from "./outbox.js";
|
|
7
|
+
export { configFile, HOME, safeId, stateDir, tilde } from "./paths.js";
|
|
8
|
+
export * from "./privacy/index.js";
|
|
9
|
+
export { gitFacts, stripCredentials } from "./readers/git.js";
|
|
10
|
+
export { isInjected, pairTurns, readAntigravity, readClaude, readCodex, readGemini } from "./readers/transcripts.js";
|
|
11
|
+
export * from "./sinks/index.js";
|
|
12
|
+
export type * from "./types.js";
|
|
13
|
+
export { isUlid, ulid } from "./ulid.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,uGAAuG;AACvG,eAAO,MAAM,gBAAgB,EAAG,CAAU,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,KAAK,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACjH,OAAO,EAAE,KAAK,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACvE,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACrH,cAAc,kBAAkB,CAAC;AACjC,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC"}
|