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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Event } from "./types.js";
|
|
2
|
+
export interface OutboxRef {
|
|
3
|
+
harness: string;
|
|
4
|
+
session: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class Outbox {
|
|
7
|
+
readonly root: string;
|
|
8
|
+
constructor(root: string);
|
|
9
|
+
dir(harness: string): string;
|
|
10
|
+
file(ref: OutboxRef): string;
|
|
11
|
+
private seqFile;
|
|
12
|
+
/** The next seq for a session, persisted (survives a hibernating machine and a
|
|
13
|
+
* restart; an in-memory counter would restart at 0 and collide). */
|
|
14
|
+
nextSeq(ref: OutboxRef): number;
|
|
15
|
+
private lastSeqInFile;
|
|
16
|
+
append(ref: OutboxRef, events: Event[]): void;
|
|
17
|
+
/** Every session file, newest first. */
|
|
18
|
+
sessions(): OutboxRef[];
|
|
19
|
+
/** Read events after byte offset `from`; returns them and the new offset. Lines
|
|
20
|
+
* are read whole; a partial trailing line (a write in progress) is left. */
|
|
21
|
+
read(ref: OutboxRef, from: number, maxEvents?: number): {
|
|
22
|
+
events: Event[];
|
|
23
|
+
offset: number;
|
|
24
|
+
};
|
|
25
|
+
/** Files older than `days` are pruned; the cursor files with them. */
|
|
26
|
+
prune(days: number, now?: number): number;
|
|
27
|
+
delete(ref: OutboxRef): void;
|
|
28
|
+
}
|
|
29
|
+
/** Per-sink cursor: byte offset per session file, moved only on a 2xx. */
|
|
30
|
+
export declare class Cursors {
|
|
31
|
+
readonly root: string;
|
|
32
|
+
readonly sink: string;
|
|
33
|
+
constructor(root: string, sink: string);
|
|
34
|
+
private file;
|
|
35
|
+
read(): Record<string, number>;
|
|
36
|
+
write(c: Record<string, number>): void;
|
|
37
|
+
key(ref: OutboxRef): string;
|
|
38
|
+
}
|
|
39
|
+
/** A lock per session so two workers never interleave. Stale after 5 min. */
|
|
40
|
+
export declare function takeLock(root: string, ref: OutboxRef, staleMs?: number): (() => void) | null;
|
|
41
|
+
//# sourceMappingURL=outbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox.d.ts","sourceRoot":"","sources":["../../src/outbox.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,MAAM;IACL,QAAQ,CAAC,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM;IAEjC,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAG5B,IAAI,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM;IAG5B,OAAO,CAAC,OAAO;IAIf;yEACqE;IACrE,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM;IAc/B,OAAO,CAAC,aAAa;IAarB,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI;IAM7C,wCAAwC;IACxC,QAAQ,IAAI,SAAS,EAAE;IAqBvB;iFAC6E;IAC7E,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,SAAM,GAAG;QAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IA8BxF,sEAAsE;IACtE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAa,GAAG,MAAM;IAkB7C,MAAM,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI;CAO7B;AAED,0EAA0E;AAC1E,qBAAa,OAAO;IAEhB,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM;gBADZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM;IAEvB,OAAO,CAAC,IAAI;IAGZ,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAO9B,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAOtC,GAAG,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM;CAG5B;AAED,6EAA6E;AAC7E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,SAAa,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAkBhG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const HOME: string;
|
|
2
|
+
export declare function configFile(env?: NodeJS.ProcessEnv): string;
|
|
3
|
+
export declare function stateDir(env?: NodeJS.ProcessEnv): string;
|
|
4
|
+
/** `~` for the home directory, as the session block writes paths. */
|
|
5
|
+
export declare function tilde(p: string, home?: string): string;
|
|
6
|
+
/** A file-name-safe id. */
|
|
7
|
+
export declare const safeId: (s: string) => string;
|
|
8
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/paths.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,IAAI,QAAe,CAAC;AAEjC,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAKvE;AAED,wBAAgB,QAAQ,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAKrE;AAED,qEAAqE;AACrE,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,MAAa,GAAG,MAAM,CAI5D;AAED,2BAA2B;AAC3B,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,KAAG,MAGjB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Event, Tier } from "../types.js";
|
|
2
|
+
/** The lowest tier that carries each known type (kept in step with schema/v1.ts). */
|
|
3
|
+
export declare const TYPE_TIER: Record<string, Tier>;
|
|
4
|
+
export interface FilterOptions {
|
|
5
|
+
/** The person's home directory, for pii@1's `~` rewrite. */
|
|
6
|
+
home?: string;
|
|
7
|
+
}
|
|
8
|
+
/** The event as a sink at `tier` may see it, or null when the type is above the tier. */
|
|
9
|
+
export declare function filterEvent(event: Event, tier: Tier, pii: boolean, opts?: FilterOptions): Event | null;
|
|
10
|
+
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/privacy/filter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAI/C,qFAAqF;AACrF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAkB1C,CAAC;AAwDF,MAAM,WAAW,aAAa;IAC5B,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,yFAAyF;AACzF,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,GAAE,aAAkB,GAAG,KAAK,GAAG,IAAI,CAoC1G"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { type FilterOptions, filterEvent, TYPE_TIER } from "./filter.js";
|
|
2
|
+
export { hashMachine, RULESET_PII, reducePii, reducePiiDeep } from "./pii.js";
|
|
3
|
+
export { hasSecret, isSecretName, REDACTED, RULESET_SECRETS, redactDeep, redactSecrets } from "./secrets.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/privacy/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const RULESET_PII = "pii@1";
|
|
2
|
+
/** Replace emails and phone numbers, and write `home` as `~`. */
|
|
3
|
+
export declare function reducePii(text: string, home?: string): string;
|
|
4
|
+
/** The machine's name under pii@1: the first 8 hex of its SHA-256. */
|
|
5
|
+
export declare function hashMachine(name: string): string;
|
|
6
|
+
/** Apply pii@1 to every string in a value; `home` becomes `~`. */
|
|
7
|
+
export declare function reducePiiDeep<T>(v: T, home?: string): T;
|
|
8
|
+
//# sourceMappingURL=pii.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pii.d.ts","sourceRoot":"","sources":["../../../src/privacy/pii.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,UAAU,CAAC;AAkBnC,iEAAiE;AACjE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAS7D;AAED,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,kEAAkE;AAClE,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,CASvD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const RULESET_SECRETS = "secrets@1";
|
|
2
|
+
export declare const REDACTED = "[redacted]";
|
|
3
|
+
/** Is this identifier the name of a secret? `DB_PASSWORD`, `apiKey`, `client-secret`,
|
|
4
|
+
* `AWS_SECRET_ACCESS_KEY`, `GITHUB_TOKEN`; an env-style `STRIPE_KEY` too. Not
|
|
5
|
+
* `password_hash`, `tokenizer`, `sort_key`. */
|
|
6
|
+
export declare function isSecretName(name: string): boolean;
|
|
7
|
+
/** Redact every credential in `text`. Returns the same string when there is none. */
|
|
8
|
+
export declare function redactSecrets(text: string): string;
|
|
9
|
+
/** Did redaction change anything? */
|
|
10
|
+
export declare function hasSecret(text: string): boolean;
|
|
11
|
+
/** Redact every string in a JSON-able value (keys are left alone). */
|
|
12
|
+
export declare function redactDeep<T>(v: T): T;
|
|
13
|
+
//# sourceMappingURL=secrets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../../src/privacy/secrets.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,eAAO,MAAM,QAAQ,eAAe,CAAC;AA6ErC;;gDAEgD;AAChD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMlD;AAiDD,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWlD;AAED,qCAAqC;AACrC,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CASrC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The first and last bytes of a file, as lines — a transcript can be tens of MB. */
|
|
2
|
+
export declare function ends(file: string, headBytes: number, tailBytes: number): {
|
|
3
|
+
head: string[];
|
|
4
|
+
tail: string[];
|
|
5
|
+
};
|
|
6
|
+
export declare const parseLines: (lines: string[]) => Record<string, unknown>[];
|
|
7
|
+
/** Read line by line up to `cap` bytes, stopping when `visit` returns a value. */
|
|
8
|
+
export declare function scanLines<T>(file: string, visit: (line: string) => T | null, cap?: number): T | null;
|
|
9
|
+
export declare function recentFiles(root: string, depth: number, sinceMs: number, match: (name: string) => boolean): string[];
|
|
10
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/readers/files.ts"],"names":[],"mappings":"AAKA,qFAAqF;AACrF,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAqB3G;AAED,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EASf,CAAC;AAEtD,kFAAkF;AAClF,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,SAAmB,GAAG,CAAC,GAAG,IAAI,CA6B9G;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,EAAE,CAuBpH"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function gitFacts(cwd: string | undefined): {
|
|
2
|
+
repo?: string;
|
|
3
|
+
branch?: string;
|
|
4
|
+
};
|
|
5
|
+
/** `https://user:token@host/x` → `https://host/x`; `git@github.com:a/b.git` → `github.com/a/b`. */
|
|
6
|
+
export declare function stripCredentials(url: string): string;
|
|
7
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../src/readers/git.ts"],"names":[],"mappings":"AAOA,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAsBpF;AAED,mGAAmG;AACnG,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKpD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TranscriptRead } from "../adapters/types.js";
|
|
2
|
+
interface Msg {
|
|
3
|
+
role: "user" | "assistant";
|
|
4
|
+
text: string;
|
|
5
|
+
at: number;
|
|
6
|
+
line: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function pairTurns(msgs: Msg[], endLine: number): TranscriptRead;
|
|
9
|
+
/** Injected context the person never typed: <tag>…</tag> wrappers, HTML comments, slash-command expansions. */
|
|
10
|
+
export declare const isInjected: (text: string) => boolean;
|
|
11
|
+
/** Claude Code / Droid: {type:"user"|"assistant", message:{content}, timestamp, isMeta, isSidechain, origin}. */
|
|
12
|
+
export declare function readClaude(lines: string[], from: number): TranscriptRead;
|
|
13
|
+
/** Codex rollout: {type:"response_item", payload:{type:"message", role, content:[{type:"input_text"|"output_text", text}]}}. */
|
|
14
|
+
export declare function readCodex(lines: string[], from: number): TranscriptRead;
|
|
15
|
+
/** Gemini CLI chat log: {type:"user"|"gemini", content|message|text, timestamp}. */
|
|
16
|
+
export declare function readGemini(lines: string[], from: number): TranscriptRead;
|
|
17
|
+
/** Antigravity: one step per line, type USER_INPUT | PLANNER_RESPONSE, content with <USER_REQUEST> wrapping. */
|
|
18
|
+
export declare function readAntigravity(lines: string[], from: number): TranscriptRead;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=transcripts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcripts.d.ts","sourceRoot":"","sources":["../../../src/readers/transcripts.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,UAAU,GAAG;IACX,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAuBtE;AAED,+GAA+G;AAC/G,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,OACwE,CAAC;AAyBnH,iHAAiH;AACjH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAmBxE;AAED,gIAAgI;AAChI,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAgBvE;AAED,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAcxE;AAED,gHAAgH;AAChH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAgB7E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Event, Tier } from "../types.js";
|
|
2
|
+
import type { DeliveryResult, Sink } from "./types.js";
|
|
3
|
+
export declare class FileSink implements Sink {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly file: string;
|
|
6
|
+
readonly tier: Tier;
|
|
7
|
+
readonly pii: boolean;
|
|
8
|
+
constructor(name: string, file: string, tier: Tier, pii: boolean);
|
|
9
|
+
send(events: Event[]): Promise<DeliveryResult>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/sinks/file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvD,qBAAa,QAAS,YAAW,IAAI;IAEjC,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,IAAI;IACnB,QAAQ,CAAC,GAAG,EAAE,OAAO;gBAHZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,OAAO;IAEjB,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;CASrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sinks/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Event, Tier } from "../types.js";
|
|
2
|
+
import type { DeliveryResult, Sink } from "./types.js";
|
|
3
|
+
export declare class StdoutSink implements Sink {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly tier: Tier;
|
|
6
|
+
readonly pii: boolean;
|
|
7
|
+
private readonly write;
|
|
8
|
+
constructor(name: string, tier: Tier, pii: boolean, write?: (line: string) => void);
|
|
9
|
+
send(events: Event[]): Promise<DeliveryResult>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=stdout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdout.d.ts","sourceRoot":"","sources":["../../../src/sinks/stdout.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvD,qBAAa,UAAW,YAAW,IAAI;IAEnC,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,IAAI;IACnB,QAAQ,CAAC,GAAG,EAAE,OAAO;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAHb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,OAAO,EACJ,KAAK,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAA4C;IAElF,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;CAIrD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Event, Tier } from "../types.js";
|
|
2
|
+
export interface DeliveryResult {
|
|
3
|
+
ok: boolean;
|
|
4
|
+
/** Events the receiver counted (accepted + duplicates + rejected). */
|
|
5
|
+
acknowledged: number;
|
|
6
|
+
accepted?: number;
|
|
7
|
+
duplicates?: number;
|
|
8
|
+
rejected?: {
|
|
9
|
+
id: string;
|
|
10
|
+
reason: string;
|
|
11
|
+
}[];
|
|
12
|
+
/** A lowered cap learned from the receiver. */
|
|
13
|
+
max_tier?: Tier;
|
|
14
|
+
status?: number;
|
|
15
|
+
error?: string;
|
|
16
|
+
/** What the sender should do next: retry later, split the batch, pause the sink. */
|
|
17
|
+
action?: "retry" | "split" | "pause" | "lower-tier" | "drop";
|
|
18
|
+
retryAfterMs?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface Sink {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly tier: Tier;
|
|
23
|
+
readonly pii: boolean;
|
|
24
|
+
/** Deliver one batch of ALREADY FILTERED events. */
|
|
25
|
+
send(events: Event[]): Promise<DeliveryResult>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/sinks/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,sEAAsE;IACtE,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,YAAY,GAAG,MAAM,CAAC;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,oDAAoD;IACpD,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAChD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type * as S from "../schema/v1.js";
|
|
3
|
+
export type Tier = 0 | 1 | 2 | 3;
|
|
4
|
+
export type Event = z.infer<typeof S.Event>;
|
|
5
|
+
export type EventType = (typeof S.KNOWN_TYPES)[number];
|
|
6
|
+
export type Harness = z.infer<typeof S.Harness>;
|
|
7
|
+
export type HarnessName = (typeof S.HARNESS_NAMES)[number];
|
|
8
|
+
export type Session = z.infer<typeof S.Session>;
|
|
9
|
+
export type Privacy = z.infer<typeof S.Privacy>;
|
|
10
|
+
export type EventData = z.infer<typeof S.EventData>;
|
|
11
|
+
export type DataOf<T extends EventType> = EventData[T];
|
|
12
|
+
export type Batch = z.infer<typeof S.Batch>;
|
|
13
|
+
export type BatchResponse = z.infer<typeof S.BatchResponse>;
|
|
14
|
+
export type ErrorResponse = z.infer<typeof S.ErrorResponse>;
|
|
15
|
+
export type WellKnown = z.infer<typeof S.WellKnown>;
|
|
16
|
+
export type ControlMessage = z.infer<typeof S.ControlMessage>;
|
|
17
|
+
export type ControlAck = z.infer<typeof S.ControlAck>;
|
|
18
|
+
export type AttentionKind = z.infer<typeof S.AttentionKind>;
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,KAAK,CAAC,MAAM,iBAAiB,CAAC;AAE1C,MAAM,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACjC,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;AAC5C,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACvD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;AAChD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3D,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;AAChD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;AAChD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC;AACpD,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;AACvD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;AAC5C,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC;AAC5D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC;AACpD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,CAAC;AAC9D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC;AACtD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ulid.d.ts","sourceRoot":"","sources":["../../src/ulid.ts"],"names":[],"mappings":"AAmBA,wBAAgB,IAAI,CAAC,GAAG,GAAE,MAAmB,GAAG,MAAM,CAiBrD;AAED,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,KAAG,OAA6C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sessionpipe-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "sessionpipe core: protocol types, harness adapters, privacy filter and redaction rulesets, outbox and sinks. Zero runtime dependencies. (published unscoped until the @sessionpipe npm org exists; the code is the same)",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=20"
|
|
9
|
+
},
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/micmmakarov/sessionpipe.git",
|
|
14
|
+
"directory": "packages/core"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://sessionpipe.org",
|
|
17
|
+
"bugs": "https://github.com/micmmakarov/sessionpipe/issues",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"sessionpipe",
|
|
20
|
+
"coding-agents",
|
|
21
|
+
"claude-code",
|
|
22
|
+
"codex",
|
|
23
|
+
"gemini-cli",
|
|
24
|
+
"hooks",
|
|
25
|
+
"observability",
|
|
26
|
+
"protocol"
|
|
27
|
+
],
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"NOTICE"
|
|
33
|
+
],
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/src/index.d.ts",
|
|
37
|
+
"import": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./schema": {
|
|
40
|
+
"types": "./dist/schema/v1.d.ts",
|
|
41
|
+
"import": "./dist/schema.js"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"types": "./dist/src/index.d.ts",
|
|
45
|
+
"main": "./dist/index.js",
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "node ../../scripts/build.mjs core"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"zod": "^4.6.5"
|
|
55
|
+
}
|
|
56
|
+
}
|