@webinson/peer 0.4.28 → 0.4.29
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 +11 -2
- package/bin/codex-thread-mark.mjs +16 -7
- package/mod/codex/peer-thread-mark/.codex-plugin/plugin.json +2 -1
- package/mod/codex/peer-thread-mark/skills/peer/SKILL.md +16 -0
- package/mod/codex/peer-thread-mark/skills/peer-all/SKILL.md +8 -0
- package/mod/codex/peer-thread-mark/skills/peer-list/SKILL.md +8 -0
- package/mod/codex/peer-thread-mark/skills/peer-thread/SKILL.md +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -107,8 +107,17 @@ peer login --codex you@company.com
|
|
|
107
107
|
If you already signed in to Peer, use `peer install --codex` in place of the login
|
|
108
108
|
command. Review and trust the Peer Thread Mark hooks in Codex's `/hooks` menu.
|
|
109
109
|
|
|
110
|
-
In
|
|
111
|
-
|
|
110
|
+
In the desktop Codex composer, type `/` and select one of the skills installed with Peer Thread Mark.
|
|
111
|
+
|
|
112
|
+
- `/peer` shares this chat. Append a task to share the chat and continue with that task.
|
|
113
|
+
Append `elephant` or `jellyfish` to select Peer's memory mode, or `stop` to stop sharing.
|
|
114
|
+
- `/peer-list` shows the threads shared in your Peer workspace.
|
|
115
|
+
- `/peer-thread` shows what the current chat saved to your personal OpenViking memory.
|
|
116
|
+
- `/peer-all [words] [here] [--newest | --oldest] [page N]` browses or searches that memory.
|
|
117
|
+
|
|
118
|
+
You can also send `peer: start [task | elephant | jellyfish]`, `peer: stop`, `peer: list`, `peer: thread`, or
|
|
119
|
+
`peer: all [words] [here] [--newest | --oldest] [page N]` as plain text. The hook handles sharing and
|
|
120
|
+
displays lists and memories locally.
|
|
112
121
|
The plugin uses the [Codex hook API](https://learn.chatgpt.com/docs/hooks) and lives under
|
|
113
122
|
[`mod/codex`](mod/codex) in its own marketplace.
|
|
114
123
|
|
|
@@ -9,6 +9,8 @@ const local = (reason) => ({ decision: "block", reason });
|
|
|
9
9
|
const MARKETPLACE = "webinson-peer-codex";
|
|
10
10
|
const PLUGIN = `peer-thread-mark@${MARKETPLACE}`;
|
|
11
11
|
const setupFile = (peer) => path.join(peer.home, "codex-cli.json");
|
|
12
|
+
const SKILL_MENTION = /^\$peer-thread-mark:(peer(?:-all|-list|-thread)?)(?=\s|$)/;
|
|
13
|
+
const SKILL_LINK = /^\[(\$peer-thread-mark:[\w-]+)(?:\?[^\]\r\n]*)?\]\((?:\\.|[^\\)\r\n])+\)(?=\s|$)/;
|
|
12
14
|
|
|
13
15
|
export function installCodex(peer, { client = false } = {}) {
|
|
14
16
|
if (peer.cli.includes(`${path.sep}_npx${path.sep}`)) {
|
|
@@ -264,20 +266,24 @@ async function collideHook(input, session, peer) {
|
|
|
264
266
|
|
|
265
267
|
async function promptHook(prompt, id, cwd, peer) {
|
|
266
268
|
const session = `codex-${id}`;
|
|
269
|
+
// The desktop composer can send the namespaced skill as a Markdown link.
|
|
270
|
+
const link = SKILL_LINK.exec(prompt);
|
|
271
|
+
const skill = SKILL_MENTION.exec(link?.[1] ?? prompt);
|
|
272
|
+
const command = skill ? `/${skill[1]}${prompt.slice((link ?? skill)[0].length)}` : prompt;
|
|
267
273
|
// The text form also works in clients that handle slash commands before submitting a turn.
|
|
268
|
-
const all = /^(?:\/peer-all|peer:\s+all)(?:\s+([\s\S]*))?$/.exec(
|
|
274
|
+
const all = /^(?:\/peer-all|peer:\s+all)(?:\s+([\s\S]*))?$/.exec(command);
|
|
269
275
|
if (all) {
|
|
270
276
|
const query = peer.memoryQuery((all[1] ?? "").split(/\s+/).filter(Boolean), cwd || process.cwd());
|
|
271
277
|
return local(await peer.memoryText(query).catch((error) => `Peer: your memories did not load (${error.message})`));
|
|
272
278
|
}
|
|
273
|
-
if (/^(?:\/peer-list|peer:\s+list)$/.test(
|
|
279
|
+
if (/^(?:\/peer-list|peer:\s+list)$/.test(command)) {
|
|
274
280
|
try {
|
|
275
281
|
return local(await peer.listText(peer.signedIn()));
|
|
276
282
|
} catch (error) {
|
|
277
283
|
return local(`Peer: ${error.message}`);
|
|
278
284
|
}
|
|
279
285
|
}
|
|
280
|
-
if (/^(?:\/peer-thread|peer:\s+thread)$/.test(
|
|
286
|
+
if (/^(?:\/peer-thread|peer:\s+thread)$/.test(command)) {
|
|
281
287
|
try {
|
|
282
288
|
return local(peer.threadMemoryText(await peer.threadMemories(id, true)));
|
|
283
289
|
} catch (error) {
|
|
@@ -285,15 +291,18 @@ async function promptHook(prompt, id, cwd, peer) {
|
|
|
285
291
|
}
|
|
286
292
|
}
|
|
287
293
|
|
|
288
|
-
const share = /^(?:\/peer|peer:\s+start)(?:\s+([\s\S]*))?$/.exec(
|
|
294
|
+
const share = /^(?:\/peer|peer:\s+start)(?:\s+([\s\S]*))?$/.exec(command);
|
|
289
295
|
const message = share?.[1]?.trim() ?? "";
|
|
290
|
-
const stop = (share && message === "stop") || /^peer:\s+stop$/.test(
|
|
296
|
+
const stop = (share && message === "stop") || /^peer:\s+stop$/.test(command);
|
|
291
297
|
if (share || stop) {
|
|
292
298
|
try {
|
|
293
299
|
if (stop) return local(await setMode(peer, id, cwd, "inactive"));
|
|
294
300
|
const mode = modeOf(peer, session);
|
|
295
|
-
const
|
|
296
|
-
|
|
301
|
+
const selectedMode = /^(elephant|jellyfish)$/i.exec(message)?.[1].toLowerCase();
|
|
302
|
+
const hasWork = Boolean(message) && !selectedMode;
|
|
303
|
+
const said = await setMode(peer, id, cwd, selectedMode ?? (mode === "inactive" ? "elephant" : mode), { working: hasWork });
|
|
304
|
+
if (selectedMode) return local(`${said} Peer memory mode: ${selectedMode}.`);
|
|
305
|
+
if (!hasWork) return local(said);
|
|
297
306
|
return {
|
|
298
307
|
hookSpecificOutput: {
|
|
299
308
|
hookEventName: "UserPromptSubmit",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "peer-thread-mark",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Share selected Codex threads in Peer and browse their memories.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"skills": "./skills/",
|
|
6
7
|
"hooks": "./hooks/hooks.json",
|
|
7
8
|
"interface": {
|
|
8
9
|
"displayName": "Peer Thread Mark",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: peer
|
|
3
|
+
description: Share the current Codex chat on Peer, optionally with a task or a memory mode, or stop sharing it.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Peer
|
|
7
|
+
|
|
8
|
+
The Peer Thread Mark hook handles sharing before this skill reaches the model. If the user invokes it and the hook has supplied a confirmation, continue with the task they appended.
|
|
9
|
+
|
|
10
|
+
If the hook did not confirm the action, direct the user to send one of these messages in the chat they want to share or stop sharing.
|
|
11
|
+
|
|
12
|
+
- `peer: start` shares the chat. Append a task to share it and continue with that task.
|
|
13
|
+
- `peer: start elephant` or `peer: start jellyfish` shares the chat and selects Peer's memory mode.
|
|
14
|
+
- `peer: stop` stops sharing.
|
|
15
|
+
|
|
16
|
+
If the plain-text command also reaches the model, direct the user to `peer doctor` to check the hook.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: peer-all
|
|
3
|
+
description: Browse or search your personal OpenViking memories with Peer, optionally scoped to the current repository.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Peer all
|
|
7
|
+
|
|
8
|
+
The Peer Thread Mark hook searches and displays these memories locally. If the request reaches the model, ask the user to send `peer: all` with their search terms and filters as a separate message. The hook accepts `here`, `--newest`, `--oldest`, and `page N`. If the plain-text command also reaches the model, direct them to `peer doctor`.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: peer-list
|
|
3
|
+
description: List the people in your Peer workspace and the agent chats they share.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Peer list
|
|
7
|
+
|
|
8
|
+
The Peer Thread Mark hook shows this list directly in the chat. If the request reaches the model, ask the user to send `peer: list` by itself so the hook can answer. If that also reaches the model, direct them to `peer doctor`.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: peer-thread
|
|
3
|
+
description: Show what the current Codex chat has saved to your personal OpenViking memory.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Peer thread
|
|
7
|
+
|
|
8
|
+
The Peer Thread Mark hook reads the current chat's memories and displays them locally. If the request reaches the model, ask the user to send `peer: thread` by itself. If that also reaches the model, direct them to `peer doctor`.
|