@the-librarian/cordis-plugin 0.0.0-stage → 1.54.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/README.md +80 -2
- package/cordis.avn.patch.yml +25 -0
- package/cordis.dsh.patch.yml +25 -0
- package/dist/capture.d.ts +16 -0
- package/dist/capture.d.ts.map +1 -0
- package/dist/capture.js +226 -0
- package/dist/capture.js.map +1 -0
- package/dist/commands.d.ts +4 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +86 -0
- package/dist/commands.js.map +1 -0
- package/dist/config.d.ts +52 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +55 -0
- package/dist/config.js.map +1 -0
- package/dist/http.d.ts +34 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +128 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/private-mode.d.ts +16 -0
- package/dist/private-mode.d.ts.map +1 -0
- package/dist/private-mode.js +47 -0
- package/dist/private-mode.js.map +1 -0
- package/dist/prompt.d.ts +24 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +92 -0
- package/dist/prompt.js.map +1 -0
- package/dist/types.d.ts +94 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +76 -4
package/README.md
CHANGED
|
@@ -1,3 +1,81 @@
|
|
|
1
|
-
#
|
|
1
|
+
# The Librarian — Cordis plugin (Aeven & DeepSeek Harness)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[The Librarian](https://github.com/code-ministry-ltd/the-librarian) ships a single Cordis plugin
|
|
4
|
+
bundle (`@the-librarian/cordis-plugin`) that works on both **[Aeven](https://github.com/Aeven-AI/Aeven)**
|
|
5
|
+
(`avn`) and **[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)** (`dsh`).
|
|
6
|
+
|
|
7
|
+
Each harness reads its own bundle manifest key from `package.json`:
|
|
8
|
+
|
|
9
|
+
- **Aeven** (`avn.bundle.patch` → `./cordis.avn.patch.yml`) mounts `@aeven/mcp-client` alongside
|
|
10
|
+
`@the-librarian/cordis-plugin` (`harness: "aeven"`, `injectPrimer: true`).
|
|
11
|
+
- **DeepSeek Harness** (`dsh.bundle.patch` → `./cordis.dsh.patch.yml`) mounts
|
|
12
|
+
`@deepseek-ai/dsh-mcp-client` alongside `@the-librarian/cordis-plugin`
|
|
13
|
+
(`harness: "deepseek-harness"`, `injectPrimer: false` — `dsh-mcp-client` injects MCP
|
|
14
|
+
`initialize.instructions` natively).
|
|
15
|
+
|
|
16
|
+
The 8 MCP tools (`recall`, `remember`, `flag_memory`, `store_handoff`, `list_handoffs`,
|
|
17
|
+
`claim_handoff`, `search_references`, `journal`) are bridged natively under `mcp__librarian__*` by
|
|
18
|
+
each harness's built-in MCP client, while the shared Cordis plugin module adds:
|
|
19
|
+
|
|
20
|
+
- **System prompt (`ctx.systemPrompt`)**: `/healthz` awareness banner, recent journal window
|
|
21
|
+
(`GET /journal.md?max_chars=9500`), and optional primer fallback (`GET /primer.md`).
|
|
22
|
+
- **Slash commands (`ctx.commands`)**: `/handoff`, `/takeover`, and `/toggle-private` (matching
|
|
23
|
+
[`docs/slash-commands.md`](../../docs/slash-commands.md)).
|
|
24
|
+
- **Automatic capture (`ctx.on('session/event', ...)`)**: in-process prose-only turn capture to
|
|
25
|
+
`POST /transcript` on `turn/end`, respecting forward-only `[librarian:private=on|off]` markers,
|
|
26
|
+
`/toggle-private`, and `session/rewind`.
|
|
27
|
+
|
|
28
|
+
## Install with the Librarian CLI (recommended)
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npx @the-librarian/cli install # choose Aeven and/or DeepSeek Harness
|
|
32
|
+
npx @the-librarian/cli update # pull the latest bundle
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Install directly
|
|
36
|
+
|
|
37
|
+
### Aeven
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
avn plugin add @the-librarian/cordis-plugin
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### DeepSeek Harness
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
dsh plugin add @the-librarian/cordis-plugin
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Configure credentials
|
|
50
|
+
|
|
51
|
+
Export your server URL and agent bearer token in the shell (or `.env` in `$AVN_HOME` / `$DSH_HOME`):
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
export LIBRARIAN_MCP_URL="https://librarian.example.com/mcp"
|
|
55
|
+
export LIBRARIAN_AGENT_TOKEN="your-agent-token"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
If `LIBRARIAN_MCP_URL` is unset, both bundle patches disable the `mcp-librarian` row automatically
|
|
59
|
+
(`disabled: !!js "!process.env.LIBRARIAN_MCP_URL"`) and the plugin stays dormant and fail-soft.
|
|
60
|
+
|
|
61
|
+
## Optional environment switches
|
|
62
|
+
|
|
63
|
+
- `LIBRARIAN_AUTO_SAVE=false` — disable automatic transcript capture on this machine.
|
|
64
|
+
- `LIBRARIAN_JOURNAL=off` — skip automatic session-start journal injection on this machine.
|
|
65
|
+
|
|
66
|
+
## Plugin configuration (`cordis.patch.yml`)
|
|
67
|
+
|
|
68
|
+
Every tunable value is exposed in the Schemastery `Config` schema and can be overridden in your
|
|
69
|
+
profile's `cordis.patch.yml` under row id `the-librarian`:
|
|
70
|
+
|
|
71
|
+
| Field | Default | Meaning |
|
|
72
|
+
| --- | --- | --- |
|
|
73
|
+
| `harness` | `"aeven"` / `"deepseek-harness"` | Harness attribution sent on `POST /transcript` |
|
|
74
|
+
| `endpoint` | `""` (reads `LIBRARIAN_MCP_URL`) | Override MCP endpoint URL |
|
|
75
|
+
| `token` | `""` (reads `LIBRARIAN_AGENT_TOKEN`) | Override bearer token (marked `secret`) |
|
|
76
|
+
| `timeoutMs` | `3000` | Per-request HTTP timeout in milliseconds |
|
|
77
|
+
| `injectPrimer` | `true` (Aeven) / `false` (DSH) | Inject `/primer.md` (with bundled fallback) into `ctx.systemPrompt` |
|
|
78
|
+
| `injectJournal` | `true` | Inject `GET /journal.md` into `ctx.systemPrompt` |
|
|
79
|
+
| `autoSave` | `true` | Capture completed prose turns to `POST /transcript` |
|
|
80
|
+
| `maxJournalChars` | `9500` | Character budget requested from `GET /journal.md` |
|
|
81
|
+
| `sectionOrder` | `500` | Sort order for the `the-librarian` section in `ctx.systemPrompt` |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Aeven bundle patch for @the-librarian/cordis-plugin.
|
|
2
|
+
#
|
|
3
|
+
# Mounts Aeven's built-in Streamable HTTP MCP client for The Librarian's 8 tools
|
|
4
|
+
# (disabled automatically when LIBRARIAN_MCP_URL is unset, and fail-soft on
|
|
5
|
+
# startup outages), plus the shared Cordis plugin for awareness/primer/journal
|
|
6
|
+
# injection, /handoff /takeover /toggle-private commands, and automatic capture.
|
|
7
|
+
- insert:
|
|
8
|
+
- id: mcp-librarian
|
|
9
|
+
name: "@aeven/mcp-client"
|
|
10
|
+
disabled: !!js "!process.env.LIBRARIAN_MCP_URL"
|
|
11
|
+
config:
|
|
12
|
+
serverName: librarian
|
|
13
|
+
title: The Librarian
|
|
14
|
+
transport: streamable-http
|
|
15
|
+
url: !!js "process.env.LIBRARIAN_MCP_URL"
|
|
16
|
+
headers:
|
|
17
|
+
Authorization: !!js "process.env.LIBRARIAN_AGENT_TOKEN ? `Bearer ${process.env.LIBRARIAN_AGENT_TOKEN}` : ''"
|
|
18
|
+
awaitStartup: false
|
|
19
|
+
failOnStartupError: false
|
|
20
|
+
|
|
21
|
+
- id: the-librarian
|
|
22
|
+
name: "@the-librarian/cordis-plugin"
|
|
23
|
+
config:
|
|
24
|
+
harness: aeven
|
|
25
|
+
injectPrimer: true
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# DeepSeek Harness bundle patch for @the-librarian/cordis-plugin.
|
|
2
|
+
#
|
|
3
|
+
# Mounts DeepSeek Harness's built-in Streamable HTTP MCP client for The
|
|
4
|
+
# Librarian's 8 tools (disabled automatically when LIBRARIAN_MCP_URL is unset,
|
|
5
|
+
# and fail-soft on startup outages), plus the shared Cordis plugin for
|
|
6
|
+
# awareness/journal injection, /handoff /takeover /toggle-private commands, and
|
|
7
|
+
# automatic capture. dsh-mcp-client injects MCP initialize.instructions natively,
|
|
8
|
+
# so injectPrimer defaults to false here.
|
|
9
|
+
- insert:
|
|
10
|
+
- id: mcp-librarian
|
|
11
|
+
name: "@deepseek-ai/dsh-mcp-client"
|
|
12
|
+
disabled: !!js "!process.env.LIBRARIAN_MCP_URL"
|
|
13
|
+
config:
|
|
14
|
+
serverName: librarian
|
|
15
|
+
transport: streamable-http
|
|
16
|
+
url: !!js "process.env.LIBRARIAN_MCP_URL"
|
|
17
|
+
headers:
|
|
18
|
+
Authorization: !!js "process.env.LIBRARIAN_AGENT_TOKEN ? `Bearer ${process.env.LIBRARIAN_AGENT_TOKEN}` : ''"
|
|
19
|
+
failOnStartupError: false
|
|
20
|
+
|
|
21
|
+
- id: the-librarian
|
|
22
|
+
name: "@the-librarian/cordis-plugin"
|
|
23
|
+
config:
|
|
24
|
+
harness: deepseek-harness
|
|
25
|
+
injectPrimer: false
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RuntimeConfig } from "./config.js";
|
|
2
|
+
import { type PrivateModeRegistry } from "./private-mode.js";
|
|
3
|
+
import type { CordisSession, CordisSessionEvent } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Extract only plain prose text from a Cordis message's content blocks,
|
|
6
|
+
* dropping thinking/reasoning, tool calls, tool results, images, and files.
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractProse(content: unknown): string;
|
|
9
|
+
export declare function deriveProject(cwd: string | undefined): string | null;
|
|
10
|
+
export interface CaptureController {
|
|
11
|
+
onSessionEvent(session: CordisSession, event: CordisSessionEvent): void;
|
|
12
|
+
onSessionDisposed(session: CordisSession): void;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function createCaptureController(runtime: RuntimeConfig, privateMode: PrivateModeRegistry, isJournalSupported: () => boolean, fetchImpl?: typeof fetch): CaptureController;
|
|
16
|
+
//# sourceMappingURL=capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAqB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,KAAK,EAAsB,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAoBxF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAWrD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAmBpE;AAeD,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACxE,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAChD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,aAAa,EACtB,WAAW,EAAE,mBAAmB,EAChC,kBAAkB,EAAE,MAAM,OAAO,EACjC,SAAS,GAAE,OAAO,KAAa,GAC9B,iBAAiB,CAoKnB"}
|
package/dist/capture.js
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// In-process `session/event` automatic transcript capture for Cordis harnesses
|
|
2
|
+
// (Aeven and DeepSeek Harness).
|
|
3
|
+
//
|
|
4
|
+
// Listens to the append-only session event stream, keeps only prose text blocks
|
|
5
|
+
// from committed user/assistant messages, honours forward-only private mode
|
|
6
|
+
// (`[librarian:private=on|off]` and `/toggle-private`), drops rewound events on
|
|
7
|
+
// `session/rewind`, and ships deltas to `POST /transcript` on `turn/end`.
|
|
8
|
+
// Every failure path is fail-soft and never throws into the host's event loop.
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { postTranscript } from "./http.js";
|
|
12
|
+
import { scanPrivateMarker } from "./private-mode.js";
|
|
13
|
+
const MAX_TRACKED_SESSIONS = 500;
|
|
14
|
+
/**
|
|
15
|
+
* Extract only plain prose text from a Cordis message's content blocks,
|
|
16
|
+
* dropping thinking/reasoning, tool calls, tool results, images, and files.
|
|
17
|
+
*/
|
|
18
|
+
export function extractProse(content) {
|
|
19
|
+
if (typeof content === "string")
|
|
20
|
+
return content.trim();
|
|
21
|
+
if (!Array.isArray(content))
|
|
22
|
+
return "";
|
|
23
|
+
const lines = [];
|
|
24
|
+
for (const item of content) {
|
|
25
|
+
if (item && typeof item === "object" && item.type === "text" && typeof item.text === "string") {
|
|
26
|
+
const trimmed = item.text.trim();
|
|
27
|
+
if (trimmed)
|
|
28
|
+
lines.push(trimmed);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return lines.join("\n").trim();
|
|
32
|
+
}
|
|
33
|
+
export function deriveProject(cwd) {
|
|
34
|
+
if (!cwd || !path.isAbsolute(cwd))
|
|
35
|
+
return null;
|
|
36
|
+
try {
|
|
37
|
+
let dir = path.resolve(cwd);
|
|
38
|
+
let repoName = null;
|
|
39
|
+
for (;;) {
|
|
40
|
+
if (fs.existsSync(path.join(dir, ".git"))) {
|
|
41
|
+
repoName = path.basename(dir);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
const parent = path.dirname(dir);
|
|
45
|
+
if (parent === dir)
|
|
46
|
+
break;
|
|
47
|
+
dir = parent;
|
|
48
|
+
}
|
|
49
|
+
const label = (repoName ?? path.basename(path.resolve(cwd))).trim().slice(0, 200);
|
|
50
|
+
return label || null;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function sessionCwd(session) {
|
|
57
|
+
return session.header?.cwd ?? session.meta?.cwd ?? session.cwd;
|
|
58
|
+
}
|
|
59
|
+
function isoTimestamp(ms) {
|
|
60
|
+
if (typeof ms !== "number" || !Number.isFinite(ms))
|
|
61
|
+
return undefined;
|
|
62
|
+
try {
|
|
63
|
+
return new Date(ms).toISOString();
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export function createCaptureController(runtime, privateMode, isJournalSupported, fetchImpl = fetch) {
|
|
70
|
+
const sessions = new Map();
|
|
71
|
+
let disposed = false;
|
|
72
|
+
const getOrCreate = (session) => {
|
|
73
|
+
const existing = sessions.get(session.id);
|
|
74
|
+
if (existing) {
|
|
75
|
+
if (!existing.project)
|
|
76
|
+
existing.project = deriveProject(sessionCwd(session));
|
|
77
|
+
return existing;
|
|
78
|
+
}
|
|
79
|
+
if (sessions.size >= MAX_TRACKED_SESSIONS) {
|
|
80
|
+
const oldest = sessions.keys().next().value;
|
|
81
|
+
if (oldest !== undefined)
|
|
82
|
+
sessions.delete(oldest);
|
|
83
|
+
}
|
|
84
|
+
const created = {
|
|
85
|
+
nextSeq: 1,
|
|
86
|
+
everPosted: false,
|
|
87
|
+
turnPrivate: privateMode.isPrivate(session.id),
|
|
88
|
+
pending: [],
|
|
89
|
+
project: deriveProject(sessionCwd(session)),
|
|
90
|
+
chain: Promise.resolve(),
|
|
91
|
+
};
|
|
92
|
+
sessions.set(session.id, created);
|
|
93
|
+
return created;
|
|
94
|
+
};
|
|
95
|
+
const enqueuePost = (state, sessionId, turns, ended) => {
|
|
96
|
+
if (disposed || !runtime.configured || !runtime.autoSave || !runtime.origin || !runtime.token) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const origin = runtime.origin;
|
|
100
|
+
const token = runtime.token;
|
|
101
|
+
const seq = state.nextSeq;
|
|
102
|
+
state.nextSeq += 1;
|
|
103
|
+
const payload = {
|
|
104
|
+
conv_id: sessionId,
|
|
105
|
+
harness: runtime.harness,
|
|
106
|
+
seq,
|
|
107
|
+
turns,
|
|
108
|
+
...(ended ? { ended: true } : {}),
|
|
109
|
+
...(isJournalSupported() && state.project ? { project: state.project } : {}),
|
|
110
|
+
};
|
|
111
|
+
state.chain = state.chain
|
|
112
|
+
.then(async () => {
|
|
113
|
+
if (disposed)
|
|
114
|
+
return;
|
|
115
|
+
const res = await postTranscript(origin, token, payload, runtime.timeoutMs, fetchImpl);
|
|
116
|
+
if (res.ok)
|
|
117
|
+
state.everPosted = true;
|
|
118
|
+
})
|
|
119
|
+
.catch(() => {
|
|
120
|
+
// Fail-soft: never surface an unhandled rejection from background capture.
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
const observeText = (sessionId, state, text) => {
|
|
124
|
+
const marker = scanPrivateMarker(text);
|
|
125
|
+
if (marker === "on") {
|
|
126
|
+
privateMode.set(sessionId, true);
|
|
127
|
+
state.turnPrivate = true;
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
if (marker === "off") {
|
|
131
|
+
const wasPrivate = privateMode.isPrivate(sessionId) || state.turnPrivate;
|
|
132
|
+
privateMode.set(sessionId, false);
|
|
133
|
+
if (wasPrivate) {
|
|
134
|
+
// Do not ship the turn that transitions out of private mode; the next
|
|
135
|
+
// turn resumes clean public capture.
|
|
136
|
+
state.turnPrivate = true;
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return privateMode.isPrivate(sessionId) || state.turnPrivate;
|
|
141
|
+
};
|
|
142
|
+
const onSessionEvent = (session, event) => {
|
|
143
|
+
try {
|
|
144
|
+
if (disposed || !session?.id || !event?.type)
|
|
145
|
+
return;
|
|
146
|
+
const state = getOrCreate(session);
|
|
147
|
+
const seq = typeof event.seq === "number" ? event.seq : 0;
|
|
148
|
+
if (event.type === "turn/start") {
|
|
149
|
+
state.pending = [];
|
|
150
|
+
state.turnPrivate = privateMode.isPrivate(session.id);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (event.type === "session/rewind") {
|
|
154
|
+
const data = event.data;
|
|
155
|
+
const rewindSeq = typeof data?.seq === "number" ? data.seq : -1;
|
|
156
|
+
if (rewindSeq >= 0) {
|
|
157
|
+
state.pending = state.pending.filter((entry) => entry.seq < rewindSeq);
|
|
158
|
+
}
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (event.type === "user/message") {
|
|
162
|
+
const msg = event.data;
|
|
163
|
+
const text = extractProse(msg?.content);
|
|
164
|
+
if (!text)
|
|
165
|
+
return;
|
|
166
|
+
const suppressed = observeText(session.id, state, text);
|
|
167
|
+
const kind = msg?.source?.kind;
|
|
168
|
+
// Skip synthetic plugin/tool injections from captured turns (their
|
|
169
|
+
// private-mode markers were still observed above).
|
|
170
|
+
if (kind !== undefined && kind !== "user")
|
|
171
|
+
return;
|
|
172
|
+
if (suppressed)
|
|
173
|
+
return;
|
|
174
|
+
state.pending.push({ seq, role: "user", text, ts: isoTimestamp(event.time) });
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (event.type === "assistant/message") {
|
|
178
|
+
const data = event.data;
|
|
179
|
+
const text = extractProse(data?.message?.content);
|
|
180
|
+
if (!text)
|
|
181
|
+
return;
|
|
182
|
+
const suppressed = observeText(session.id, state, text);
|
|
183
|
+
if (suppressed)
|
|
184
|
+
return;
|
|
185
|
+
state.pending.push({ seq, role: "assistant", text, ts: isoTimestamp(event.time) });
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (event.type === "turn/end") {
|
|
189
|
+
const pending = state.pending;
|
|
190
|
+
const isTurnPrivate = state.turnPrivate || privateMode.isPrivate(session.id);
|
|
191
|
+
state.pending = [];
|
|
192
|
+
state.turnPrivate = privateMode.isPrivate(session.id);
|
|
193
|
+
if (isTurnPrivate || pending.length === 0)
|
|
194
|
+
return;
|
|
195
|
+
const turns = pending.map((entry) => entry.ts !== undefined
|
|
196
|
+
? { role: entry.role, text: entry.text, ts: entry.ts }
|
|
197
|
+
: { role: entry.role, text: entry.text });
|
|
198
|
+
enqueuePost(state, session.id, turns);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
// Fail-soft: never throw out of a host session/event listener.
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const onSessionDisposed = (session) => {
|
|
206
|
+
try {
|
|
207
|
+
if (!session?.id)
|
|
208
|
+
return;
|
|
209
|
+
const state = sessions.get(session.id);
|
|
210
|
+
if (state && state.everPosted && !privateMode.isPrivate(session.id)) {
|
|
211
|
+
enqueuePost(state, session.id, [], true);
|
|
212
|
+
}
|
|
213
|
+
sessions.delete(session.id);
|
|
214
|
+
privateMode.delete(session.id);
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
// Fail-soft.
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
const dispose = () => {
|
|
221
|
+
disposed = true;
|
|
222
|
+
sessions.clear();
|
|
223
|
+
};
|
|
224
|
+
return { onSessionEvent, onSessionDisposed, dispose };
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.js","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gCAAgC;AAChC,EAAE;AACF,gFAAgF;AAChF,4EAA4E;AAC5E,gFAAgF;AAChF,0EAA0E;AAC1E,+EAA+E;AAE/E,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cAAc,EAA2D,MAAM,WAAW,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAA4B,MAA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CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;gBACpE,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;YAC3C,CAAC;YACD,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC5B,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACjC,CAAC;QAAC,MAAM,CAAC;YACP,aAAa;QACf,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,GAAS,EAAE;QACzB,QAAQ,GAAG,IAAI,CAAC;QAChB,QAAQ,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type PrivateModeRegistry } from "./private-mode.js";
|
|
2
|
+
import type { CordisCommandRuntime } from "./types.js";
|
|
3
|
+
export declare function registerCommands(commands: CordisCommandRuntime, privateMode: PrivateModeRegistry): () => void;
|
|
4
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAOA,OAAO,EAAyC,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,KAAK,EAAE,oBAAoB,EAAqB,MAAM,YAAY,CAAC;AAiD1E,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,oBAAoB,EAC9B,WAAW,EAAE,mBAAmB,GAC/B,MAAM,IAAI,CAgDZ"}
|
package/dist/commands.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Cordis human slash commands (`/handoff`, `/takeover`, `/toggle-private`).
|
|
2
|
+
//
|
|
3
|
+
// Aligned verbatim with `docs/slash-commands.md` and `integrations/pi/extensions/librarian/commands.ts`.
|
|
4
|
+
// Mounted optionally via `ctx.inject(['commands'], ...)` so headless/SDK
|
|
5
|
+
// compositions without a command registry load cleanly without error.
|
|
6
|
+
import { randomUUID } from "node:crypto";
|
|
7
|
+
import { PRIVATE_OFF_MARKER, PRIVATE_ON_MARKER } from "./private-mode.js";
|
|
8
|
+
const HANDOFF_PROMPT = "Author a five-section handoff document with these exact headings: " +
|
|
9
|
+
"`## Start & intent`, `## Journey`, `## Current state`, `## What's left`, " +
|
|
10
|
+
"`## Open questions`. Then call `store_handoff` with the document (plus " +
|
|
11
|
+
"project_key / cwd / harness when known) and report the returned handoff_id. " +
|
|
12
|
+
"While private mode is on, ask for explicit user confirmation before writing anything.";
|
|
13
|
+
const TAKEOVER_PROMPT = "Call `list_handoffs` scoped to the current project_key + cwd (drop filters " +
|
|
14
|
+
"to broaden when nothing matches), present the candidates to the user — " +
|
|
15
|
+
"never auto-select — then `claim_handoff` the chosen id and continue the " +
|
|
16
|
+
"work its document describes. If the user supplied a handoff id, claim it directly.";
|
|
17
|
+
const TOGGLE_ON_TEXT = `Private mode is ON. ${PRIVATE_ON_MARKER} — do not call \`remember\`, ` +
|
|
18
|
+
"`store_handoff`, or `flag_memory` until told otherwise. `recall`, " +
|
|
19
|
+
"`search_references` and `journal` stay allowed; note that read queries still reach the " +
|
|
20
|
+
"Librarian server's logs. Private mode is an in-conversation instruction; " +
|
|
21
|
+
"the server cannot verify its marker. A curator review queued by a flag " +
|
|
22
|
+
"from public context may still correct that memory after switching private; " +
|
|
23
|
+
"the toggle does not cancel queued work. Remain in this state until explicitly toggled off.";
|
|
24
|
+
const TOGGLE_OFF_TEXT = `Private mode is OFF. ${PRIVATE_OFF_MARKER} — normal operation resumed.`;
|
|
25
|
+
function createUserFollowup(text) {
|
|
26
|
+
return Object.freeze({
|
|
27
|
+
id: randomUUID(),
|
|
28
|
+
role: "user",
|
|
29
|
+
content: Object.freeze([Object.freeze({ type: "text", text })]),
|
|
30
|
+
source: Object.freeze({ kind: "user" }),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function createPluginNotice(text, summary) {
|
|
34
|
+
return Object.freeze({
|
|
35
|
+
id: randomUUID(),
|
|
36
|
+
role: "user",
|
|
37
|
+
content: Object.freeze([Object.freeze({ type: "text", text })]),
|
|
38
|
+
source: Object.freeze({
|
|
39
|
+
kind: "plugin",
|
|
40
|
+
plugin: "the-librarian",
|
|
41
|
+
form: "notice",
|
|
42
|
+
summary,
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export function registerCommands(commands, privateMode) {
|
|
47
|
+
const disposers = [];
|
|
48
|
+
disposers.push(commands.register({
|
|
49
|
+
name: "handoff",
|
|
50
|
+
description: "Author and persist a cross-harness handoff document",
|
|
51
|
+
input: { hint: "[optional note]" },
|
|
52
|
+
handler: ({ agent, rawInput }) => {
|
|
53
|
+
const note = rawInput.trim();
|
|
54
|
+
const prompt = note ? `${HANDOFF_PROMPT}\n\nUser input: ${note}` : HANDOFF_PROMPT;
|
|
55
|
+
agent.followup(createUserFollowup(prompt));
|
|
56
|
+
return { kind: "success", text: "Queued handoff request." };
|
|
57
|
+
},
|
|
58
|
+
}));
|
|
59
|
+
disposers.push(commands.register({
|
|
60
|
+
name: "takeover",
|
|
61
|
+
description: "Pick up a handoff from another agent / harness",
|
|
62
|
+
input: { hint: "[handoff_id]" },
|
|
63
|
+
handler: ({ agent, rawInput }) => {
|
|
64
|
+
const note = rawInput.trim();
|
|
65
|
+
const prompt = note ? `${TAKEOVER_PROMPT}\n\nUser input: ${note}` : TAKEOVER_PROMPT;
|
|
66
|
+
agent.followup(createUserFollowup(prompt));
|
|
67
|
+
return { kind: "success", text: "Queued takeover request." };
|
|
68
|
+
},
|
|
69
|
+
}));
|
|
70
|
+
disposers.push(commands.register({
|
|
71
|
+
name: "toggle-private",
|
|
72
|
+
description: "Toggle in-conversation private mode (no server state)",
|
|
73
|
+
handler: ({ agent }) => {
|
|
74
|
+
const active = privateMode.toggle(agent.session.id);
|
|
75
|
+
const text = active ? TOGGLE_ON_TEXT : TOGGLE_OFF_TEXT;
|
|
76
|
+
const summary = active ? "The Librarian private mode ON" : "The Librarian private mode OFF";
|
|
77
|
+
agent.inject(createPluginNotice(text, summary));
|
|
78
|
+
return { kind: "success", text };
|
|
79
|
+
},
|
|
80
|
+
}));
|
|
81
|
+
return () => {
|
|
82
|
+
for (const dispose of disposers)
|
|
83
|
+
dispose();
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,yGAAyG;AACzG,yEAAyE;AACzE,sEAAsE;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAA4B,MAAM,mBAAmB,CAAC;AAGpG,MAAM,cAAc,GAClB,oEAAoE;IACpE,2EAA2E;IAC3E,yEAAyE;IACzE,8EAA8E;IAC9E,uFAAuF,CAAC;AAE1F,MAAM,eAAe,GACnB,6EAA6E;IAC7E,yEAAyE;IACzE,0EAA0E;IAC1E,oFAAoF,CAAC;AAEvF,MAAM,cAAc,GAClB,uBAAuB,iBAAiB,+BAA+B;IACvE,oEAAoE;IACpE,yFAAyF;IACzF,2EAA2E;IAC3E,yEAAyE;IACzE,6EAA6E;IAC7E,4FAA4F,CAAC;AAE/F,MAAM,eAAe,GAAG,wBAAwB,kBAAkB,8BAA8B,CAAC;AAEjG,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,EAAE,EAAE,UAAU,EAAE;QAChB,IAAI,EAAE,MAAe;QACrB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,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;QACV,KAAK,MAAM,OAAO,IAAI,SAAS;YAAE,OAAO,EAAE,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Schema from "@deepseek-ai/schemastery";
|
|
2
|
+
export type CordisHarnessId = "aeven" | "deepseek-harness" | "cordis";
|
|
3
|
+
export declare const DEFAULT_TIMEOUT_MS = 3000;
|
|
4
|
+
export declare const DEFAULT_MAX_JOURNAL_CHARS = 9500;
|
|
5
|
+
export declare const DEFAULT_SECTION_ORDER = 500;
|
|
6
|
+
export interface Config {
|
|
7
|
+
/** Which harness mounted this bundle — used for transcript attribution. */
|
|
8
|
+
harness: CordisHarnessId;
|
|
9
|
+
/** Optional override for `LIBRARIAN_MCP_URL` (e.g. `https://host/mcp`). */
|
|
10
|
+
endpoint: string;
|
|
11
|
+
/** Optional override for `LIBRARIAN_AGENT_TOKEN`. Never logged. */
|
|
12
|
+
token: string;
|
|
13
|
+
/** Per-request HTTP timeout in milliseconds for awareness/journal/capture calls. */
|
|
14
|
+
timeoutMs: number;
|
|
15
|
+
/**
|
|
16
|
+
* Inject the Librarian primer into `ctx.systemPrompt`. Defaults to `true` in
|
|
17
|
+
* `cordis.avn.patch.yml` (Aeven's mcp-client only hands instructions to tool-search)
|
|
18
|
+
* and `false` in `cordis.dsh.patch.yml` (`dsh-mcp-client` injects them natively).
|
|
19
|
+
*/
|
|
20
|
+
injectPrimer: boolean;
|
|
21
|
+
/** Inject the recent conversation journal window into `ctx.systemPrompt`. */
|
|
22
|
+
injectJournal: boolean;
|
|
23
|
+
/** Capture completed prose turns to `POST /transcript` (fail-soft). */
|
|
24
|
+
autoSave: boolean;
|
|
25
|
+
/** Maximum characters requested from `GET /journal.md`. */
|
|
26
|
+
maxJournalChars: number;
|
|
27
|
+
/** Sort order for the `the-librarian` section in `ctx.systemPrompt`. */
|
|
28
|
+
sectionOrder: number;
|
|
29
|
+
}
|
|
30
|
+
export declare const Config: Schema<Partial<Config>, Config>;
|
|
31
|
+
export interface RuntimeConfig {
|
|
32
|
+
readonly configured: boolean;
|
|
33
|
+
readonly harness: CordisHarnessId;
|
|
34
|
+
readonly origin: string | null;
|
|
35
|
+
readonly endpoint: string | null;
|
|
36
|
+
readonly token: string | null;
|
|
37
|
+
readonly timeoutMs: number;
|
|
38
|
+
readonly injectPrimer: boolean;
|
|
39
|
+
readonly injectJournal: boolean;
|
|
40
|
+
readonly autoSave: boolean;
|
|
41
|
+
readonly maxJournalChars: number;
|
|
42
|
+
readonly sectionOrder: number;
|
|
43
|
+
}
|
|
44
|
+
export declare function isJournalOffByEnv(env: Record<string, string | undefined>): boolean;
|
|
45
|
+
export declare function isAutoSaveOffByEnv(env: Record<string, string | undefined>): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Merge validated Cordis plugin config with process environment variables.
|
|
48
|
+
* Never throws: missing or non-http(s) endpoint yields `configured: false` so
|
|
49
|
+
* the plugin stays dormant and fail-soft.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveRuntimeConfig(config: Config, env?: Record<string, string | undefined>): RuntimeConfig;
|
|
52
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAG9C,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,kBAAkB,GAAG,QAAQ,CAAC;AAEtE,eAAO,MAAM,kBAAkB,OAAQ,CAAC;AACxC,eAAO,MAAM,yBAAyB,OAAQ,CAAC;AAC/C,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,MAAM,WAAW,MAAM;IACrB,2EAA2E;IAC3E,OAAO,EAAE,eAAe,CAAC;IACzB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,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AAM,GAAG,SAAS,CAAe,GACpD,aAAa,CAmBf"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Cordis plugin configuration schema and environment resolution.
|
|
2
|
+
//
|
|
3
|
+
// Follows Aeven & DeepSeek Harness conventions: every tunable value is declared
|
|
4
|
+
// in the exported Schemastery `Config` schema with safe defaults so deployments
|
|
5
|
+
// can override any setting in `cordis.patch.yml` without editing code, while
|
|
6
|
+
// zero-config users get automatic resolution from `LIBRARIAN_MCP_URL` and
|
|
7
|
+
// `LIBRARIAN_AGENT_TOKEN`.
|
|
8
|
+
import Schema from "@deepseek-ai/schemastery";
|
|
9
|
+
import { deriveServerOrigin } from "./http.js";
|
|
10
|
+
export const DEFAULT_TIMEOUT_MS = 3_000;
|
|
11
|
+
export const DEFAULT_MAX_JOURNAL_CHARS = 9_500;
|
|
12
|
+
export const DEFAULT_SECTION_ORDER = 500;
|
|
13
|
+
export const Config = Schema.object({
|
|
14
|
+
harness: Schema.union(["aeven", "deepseek-harness", "cordis"]).default("cordis"),
|
|
15
|
+
endpoint: Schema.string().default("").description("Override LIBRARIAN_MCP_URL"),
|
|
16
|
+
token: Schema.string().role("secret").default("").description("Override LIBRARIAN_AGENT_TOKEN"),
|
|
17
|
+
timeoutMs: Schema.number().min(1).default(DEFAULT_TIMEOUT_MS),
|
|
18
|
+
injectPrimer: Schema.boolean().default(false),
|
|
19
|
+
injectJournal: Schema.boolean().default(true),
|
|
20
|
+
autoSave: Schema.boolean().default(true),
|
|
21
|
+
maxJournalChars: Schema.number().min(200).max(50_000).default(DEFAULT_MAX_JOURNAL_CHARS),
|
|
22
|
+
sectionOrder: Schema.number().default(DEFAULT_SECTION_ORDER),
|
|
23
|
+
});
|
|
24
|
+
export function isJournalOffByEnv(env) {
|
|
25
|
+
const raw = env.LIBRARIAN_JOURNAL ?? "";
|
|
26
|
+
return ["off", "false", "0", "no"].includes(raw.trim().toLowerCase());
|
|
27
|
+
}
|
|
28
|
+
export function isAutoSaveOffByEnv(env) {
|
|
29
|
+
return (env.LIBRARIAN_AUTO_SAVE ?? "").trim().toLowerCase() === "false";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Merge validated Cordis plugin config with process environment variables.
|
|
33
|
+
* Never throws: missing or non-http(s) endpoint yields `configured: false` so
|
|
34
|
+
* the plugin stays dormant and fail-soft.
|
|
35
|
+
*/
|
|
36
|
+
export function resolveRuntimeConfig(config, env = process.env) {
|
|
37
|
+
const endpointRaw = (config.endpoint.trim() || env.LIBRARIAN_MCP_URL?.trim() || "").trim();
|
|
38
|
+
const tokenRaw = (config.token.trim() || env.LIBRARIAN_AGENT_TOKEN?.trim() || "").trim();
|
|
39
|
+
const origin = deriveServerOrigin(endpointRaw);
|
|
40
|
+
const configured = origin !== null && tokenRaw.length > 0;
|
|
41
|
+
return {
|
|
42
|
+
configured,
|
|
43
|
+
harness: config.harness,
|
|
44
|
+
origin,
|
|
45
|
+
endpoint: endpointRaw || null,
|
|
46
|
+
token: tokenRaw || null,
|
|
47
|
+
timeoutMs: config.timeoutMs,
|
|
48
|
+
injectPrimer: config.injectPrimer,
|
|
49
|
+
injectJournal: config.injectJournal && !isJournalOffByEnv(env),
|
|
50
|
+
autoSave: config.autoSave && !isAutoSaveOffByEnv(env),
|
|
51
|
+
maxJournalChars: config.maxJournalChars,
|
|
52
|
+
sectionOrder: config.sectionOrder,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,6EAA6E;AAC7E,0EAA0E;AAC1E,2BAA2B;AAE3B,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAI/C,MAAM,CAAC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