@amoree-code/ocean 2.19.0 → 2.20.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.
@@ -0,0 +1,91 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { readdirSync, readFileSync } from "node:fs";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ // Claude chat (Desktop, claude.ai, phone) runs on Anthropic's servers: it gets Ocean's tools from
6
+ // the MCP entry Ocean writes, but it drops the server's `instructions` and runs no hooks. A skill
7
+ // does reach it: an account plugin's skills load in chat, Cowork and Claude Code, and Claude
8
+ // loads one by itself when a message matches its description (T-328: asked "where your memory
9
+ // lives" with the ocean-memory skill installed, chat called brain_search and named Ocean).
10
+ //
11
+ // The plugin lives in Ocean's public repository (`.claude-plugin/marketplace.json` at its root,
12
+ // `kernel/plugins/ocean/`), so a release reaches every device without Ocean touching it. Adding a
13
+ // marketplace to a Claude account has no API, deep link or config file: the owner adds it once
14
+ // in Claude's settings. Ocean makes that one step short — the name on the clipboard, Claude open
15
+ // — and checks for it where Claude Code keeps its copy of the account's marketplaces.
16
+ export const OCEAN_MARKETPLACE = "amoree-code/ocean";
17
+ export const CHAT_PLUGIN_STEPS = [
18
+ "In Claude: Customize → Plugins → Add → Add marketplace",
19
+ `Paste ${OCEAN_MARKETPLACE} and add it`,
20
+ "Install the Ocean plugin it lists",
21
+ "Skills need Settings → Capabilities → Code execution on",
22
+ ];
23
+ function syncedDir(home) {
24
+ return path.join(home, ".claude", "plugins", "synced");
25
+ }
26
+ // True once the account lists Ocean's marketplace. Claude Code (v2.1.273 and later) mirrors the
27
+ // account's marketplaces into ~/.claude/plugins/synced/<account>_<org>/.marketplaces.json; the
28
+ // row's source names the repository. Undefined when that mirror does not exist, so absence of
29
+ // Claude Code never reads as "not added".
30
+ export function chatPluginAdded(home = os.homedir()) {
31
+ let accounts;
32
+ try {
33
+ accounts = readdirSync(syncedDir(home));
34
+ }
35
+ catch {
36
+ return undefined;
37
+ }
38
+ let mirrored = false;
39
+ for (const account of accounts) {
40
+ let rows;
41
+ try {
42
+ rows = JSON.parse(readFileSync(path.join(syncedDir(home), account, ".marketplaces.json"), "utf8")).rows;
43
+ }
44
+ catch {
45
+ continue;
46
+ }
47
+ if (!Array.isArray(rows))
48
+ continue;
49
+ mirrored = true;
50
+ const wanted = OCEAN_MARKETPLACE.toLowerCase();
51
+ if (rows.some((row) => JSON.stringify(row?.source ?? "")
52
+ .toLowerCase()
53
+ .includes(wanted)))
54
+ return true;
55
+ }
56
+ return mirrored ? false : undefined;
57
+ }
58
+ const run = (file, args, input) => {
59
+ execFileSync(file, args, {
60
+ input,
61
+ stdio: [input === undefined ? "ignore" : "pipe", "ignore", "ignore"],
62
+ timeout: 10_000,
63
+ });
64
+ };
65
+ // Puts the marketplace name on the clipboard and brings Claude up, so the step is a paste and a
66
+ // few clicks. Either half failing leaves the printed steps, which say the same.
67
+ export function openChatPluginSetup(options = {}) {
68
+ const platform = options.platform ?? process.platform;
69
+ const exec = options.exec ?? run;
70
+ const attempt = (file, args, input) => {
71
+ try {
72
+ exec(file, args, input);
73
+ return true;
74
+ }
75
+ catch {
76
+ return false;
77
+ }
78
+ };
79
+ if (platform === "darwin")
80
+ return {
81
+ copied: attempt("pbcopy", [], OCEAN_MARKETPLACE),
82
+ opened: attempt("open", ["-a", "Claude"]),
83
+ };
84
+ if (platform === "win32")
85
+ return {
86
+ copied: attempt("clip", [], OCEAN_MARKETPLACE),
87
+ opened: false,
88
+ };
89
+ return { copied: false, opened: false };
90
+ }
91
+ //# sourceMappingURL=chat-plugin.js.map
@@ -117,9 +117,8 @@ export function buildClientStatus(input) {
117
117
  const watcher = input.watcher.find((item) => item.client === plan.client);
118
118
  if (watcher && watcher.status !== "current")
119
119
  notes.push(`chat watcher ${watcher.status}`);
120
- if (plan.client === "claude-desktop" &&
121
- input.desktopPlugin?.installed === false)
122
- notes.push("start plugin not installed: run `ocean clients desktop-plugin`");
120
+ if (plan.client === "claude-desktop" && input.chatPlugin?.added === false)
121
+ notes.push("Ocean plugin not in your Claude account: run `ocean clients chat-plugin`");
123
122
  if (plan.tier !== "supported" && plan.reason)
124
123
  notes.push(plan.reason);
125
124
  clients.push({
@@ -4,8 +4,9 @@ import { syncCoreSkills } from "@ocean/market/skills/core-skill-sync.js";
4
4
  import { copyClientSkills } from "@ocean/market/skills/skill-hub.js";
5
5
  import { connectObsidianVault } from "@ocean/services/obsidian/vault-discovery.js";
6
6
  import { ONBOARDING_QUESTIONS, onboard, } from "@ocean/services/onboarding/onboarding.js";
7
+ import { CHAT_PLUGIN_STEPS, chatPluginAdded, OCEAN_MARKETPLACE, openChatPluginSetup, } from "../clients/chat-plugin.js";
7
8
  // Bump when a step is added; completed steps stay completed, only new ids run.
8
- export const ONBOARDING_VERSION = 4;
9
+ export const ONBOARDING_VERSION = 5;
9
10
  async function yes(io, question) {
10
11
  return (await io.ask(`${question} [Y/n] `, "y")).trim().toLowerCase() !== "n";
11
12
  }
@@ -96,6 +97,49 @@ function connectStep(clients) {
96
97
  },
97
98
  };
98
99
  }
100
+ // Claude chat (Desktop, claude.ai, phone) runs no hooks and drops MCP instructions, so Ocean's
101
+ // rule reaches it as a skill in an account plugin (T-328). Adding a marketplace to an account
102
+ // has no API: the one step left to the owner is a paste and a few clicks, set up here.
103
+ export function chatPluginStep(chat = {
104
+ added: () => chatPluginAdded(),
105
+ open: () => openChatPluginSetup(),
106
+ }) {
107
+ return {
108
+ id: "chat-plugin",
109
+ title: "Claude chat (the Ocean plugin in your Claude account)",
110
+ optional: false,
111
+ async reopen() {
112
+ return chat.added() === false
113
+ ? "the Ocean plugin is not in your Claude account"
114
+ : null;
115
+ },
116
+ async run(io) {
117
+ if (chat.added() === true) {
118
+ io.say(` ${OCEAN_MARKETPLACE} is in your Claude account: every Claude chat asks Ocean first.`);
119
+ return "done";
120
+ }
121
+ io.say(" Claude chat runs on Anthropic's servers, so one step is yours: add Ocean's plugin to your Claude account.");
122
+ if (!io.interactive) {
123
+ for (const step of CHAT_PLUGIN_STEPS)
124
+ io.say(` ${step}`);
125
+ io.say(" Or run: ocean clients chat-plugin");
126
+ return "skipped";
127
+ }
128
+ const opened = chat.open();
129
+ if (opened.copied)
130
+ io.say(` ${OCEAN_MARKETPLACE} is on your clipboard.`);
131
+ if (opened.opened)
132
+ io.say(" Claude is open.");
133
+ for (const step of CHAT_PLUGIN_STEPS)
134
+ io.say(` ${step}`);
135
+ if (!(await yes(io, " Added it?")))
136
+ return "skipped";
137
+ if (chat.added() === false)
138
+ io.say(" Claude Code has not synced it yet; `ocean clients status` shows it once it has.");
139
+ return "done";
140
+ },
141
+ };
142
+ }
99
143
  // A guided step prints the exact command instead of running it: these touch client
100
144
  // configs, credentials or the user's own settings, which Ocean must not edit unasked.
101
145
  function guided(id, title, lines, optional = true) {
@@ -213,6 +257,7 @@ export function buildSteps(deps) {
213
257
  },
214
258
  },
215
259
  connectStep(deps.clients),
260
+ chatPluginStep(deps.chatPlugin),
216
261
  guided("auth", "Provider authentication", [
217
262
  "Run: ocean auth",
218
263
  "Credentials stay in the OS keychain or environment, never in files.",
@@ -3,14 +3,14 @@ import { memorySettings, setSessionFacts, } from "@ocean/brain/memory/memory-aud
3
3
  import { marketplacePaths } from "@ocean/market/install/default-marketplace.js";
4
4
  import { updateGatewayAccess } from "@ocean/market/mcp/mcp-gateway.js";
5
5
  import { readCallLedger, summarizeCallLedger, } from "@ocean/services/infrastructure/mcp/call-ledger.js";
6
+ import { CHAT_PLUGIN_STEPS, chatPluginAdded, OCEAN_MARKETPLACE, openChatPluginSetup, } from "../../application/clients/chat-plugin.js";
6
7
  import { applyClients, attributeLedger, confirmClient, defaultClientEnv, gatewayDefault, planClients, readGatewayClients, recordVerification, repairClients, restoreClients, setGatewayClient, setGatewayDefault, temporaryEntryProblem, verifyClient, } from "../../application/clients/clients.js";
7
- import { desktopPluginInstalled, installDesktopPlugin, } from "../../application/clients/desktop-plugin.js";
8
8
  import { applyDesktopWatcher, planDesktopWatcher, restoreDesktopWatcher, } from "../../application/clients/desktop-watcher.js";
9
9
  import { applyHooks, planHooks, restoreHooks, } from "../../application/clients/hooks.js";
10
10
  import { applyNative, planNative, restoreNative, } from "../../application/clients/native.js";
11
11
  import { applyOpencodePlugin, planOpencodePlugin, restoreOpencodePlugin, } from "../../application/clients/opencode-plugin.js";
12
12
  import { buildClientStatus, formatClientStatus, } from "../../application/clients/status.js";
13
- const usage = "Usage: ocean clients status [--json] [--days <n>] | detect|plan [--json] | apply [--client <id>…] [--yes] [--session-facts on|off] | desktop-plugin | verify [<id>…] | confirm <id>… --label in-app|headless|connected|blocked [--via <evidence>] [--reason <why>] | gateway [<id> on|off] [--default gateway|per-server] | allow|deny|unset <id> <server> | ledger | repair | restore [--batch <id>]";
13
+ const usage = "Usage: ocean clients status [--json] [--days <n>] | detect|plan [--json] | apply [--client <id>…] [--yes] [--session-facts on|off] | chat-plugin | verify [<id>…] | confirm <id>… --label in-app|headless|connected|blocked [--via <evidence>] [--reason <why>] | gateway [<id> on|off] [--default gateway|per-server] | allow|deny|unset <id> <server> | ledger | repair | restore [--batch <id>]";
14
14
  export const SESSION_FACTS_QUESTION = "Capture durable facts from your sessions automatically? It costs one small model call per session, run by the client the session was in. Every fact goes to your review queue; nothing is saved without your approval, even with auto-approve on. [y/N] ";
15
15
  // The session-facts answer, asked once (T-313): `--session-facts on|off` decides; otherwise a
16
16
  // terminal is asked; with no terminal and no saved answer it stays unset (off), and
@@ -63,7 +63,7 @@ export async function runClientsCommand(args) {
63
63
  plugins: await planOpencodePlugin(),
64
64
  native: await planNative(),
65
65
  watcher: await planDesktopWatcher(),
66
- desktopPlugin: { installed: desktopPluginInstalled() },
66
+ chatPlugin: { added: chatPluginAdded() },
67
67
  calls: await readCallLedger(),
68
68
  days,
69
69
  });
@@ -141,29 +141,42 @@ export async function runClientsCommand(args) {
141
141
  .results,
142
142
  sessionFacts: await sessionFactsAnswer(values("--session-facts")[0]),
143
143
  };
144
- // Claude Desktop's start plugin (T-328): written to the folder Desktop installs from by
145
- // itself, behind one admin password prompt.
144
+ // Claude chat's Ocean plugin (T-328) is added to the account in Claude's own settings, which
145
+ // Ocean cannot write; apply only says whether it is there and what to run when it is not.
146
146
  const desktop = (await planClients()).find((plan) => plan.client === "claude-desktop");
147
- const desktopPlugin = desktop?.installed && (!selected || selected.includes("claude-desktop"))
148
- ? await installDesktopPlugin()
147
+ const added = chatPluginAdded();
148
+ const chatPlugin = desktop?.installed && (!selected || selected.includes("claude-desktop"))
149
+ ? {
150
+ added,
151
+ ...(added === true ? {} : { next: "ocean clients chat-plugin" }),
152
+ }
149
153
  : undefined;
150
154
  // After the session-facts answer: the watcher exists only for capture that is on (T-315).
151
155
  result = {
152
156
  ...appliedAll,
153
157
  watcher: (await applyDesktopWatcher({ clients: selected, batch: applied.batch })).results,
154
- ...(desktopPlugin ? { desktopPlugin } : {}),
158
+ ...(chatPlugin ? { chatPlugin } : {}),
155
159
  };
156
160
  }
157
- else if (action === "desktop-plugin") {
158
- // Installs the Claude Desktop start plugin, or says why it could not (T-328).
159
- const done = await installDesktopPlugin();
161
+ else if (action === "chat-plugin") {
162
+ // Claude chat's one step (T-328): the marketplace name on the clipboard, Claude open, the
163
+ // clicks printed. Nothing to do once Claude Code's mirror of the account lists it.
164
+ const added = chatPluginAdded();
165
+ const opened = added === true ? undefined : openChatPluginSetup();
160
166
  if (!json) {
161
- console.log(done.status === "manual"
162
- ? `not installed: ${done.reason}\n${done.file}\n${done.next}`
163
- : `${done.status}: ${done.dir}${done.next ? `\n${done.next}` : ""}`);
167
+ if (added === true) {
168
+ console.log(`added: ${OCEAN_MARKETPLACE} is in your Claude account; its skill reaches every Claude chat`);
169
+ return;
170
+ }
171
+ if (opened?.copied)
172
+ console.log(`${OCEAN_MARKETPLACE} is on your clipboard.`);
173
+ for (const step of CHAT_PLUGIN_STEPS)
174
+ console.log(` ${step}`);
175
+ if (added === undefined)
176
+ console.log("Ocean checks for it through Claude Code; without Claude Code, nothing confirms it here.");
164
177
  return;
165
178
  }
166
- result = done;
179
+ result = { added, ...(opened ?? {}), marketplace: OCEAN_MARKETPLACE };
167
180
  }
168
181
  else if (action === "verify") {
169
182
  const ids = rest.filter((arg) => !arg.startsWith("--"));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/brain",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/context",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/core",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/loop",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/market",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -9,7 +9,7 @@ import { lookupPerson } from "@ocean/brain/memory/people.js";
9
9
  import { promoteSessionToKnowledge } from "@ocean/brain/memory/session-promotion.js";
10
10
  import { isValidProjectId } from "@ocean/core/domain/context/project-id.js";
11
11
  import { actionFingerprint, mcpApprovalSchema, } from "@ocean/core/domain/mcp/mcp-contract.js";
12
- import { MEMORY_CONTRACT_VERSION, MEMORY_INSTRUCTIONS, MemoryContractError, } from "@ocean/core/domain/mcp/memory-contract.js";
12
+ import { MEMORY_AUTHORITY_LINE, MEMORY_CONTRACT_VERSION, MEMORY_INSTRUCTIONS, MemoryContractError, } from "@ocean/core/domain/mcp/memory-contract.js";
13
13
  import { redactSecrets } from "@ocean/core/domain/redaction/redaction.js";
14
14
  import { ackIssued } from "@ocean/core/shared/context-ack.js";
15
15
  import { oceanPath, oceanRoot, SYSTEM_DIR } from "@ocean/core/shared/paths.js";
@@ -471,6 +471,10 @@ let clientName = "unknown";
471
471
  // start line's hash: one `context_ack` ledger line per connection, ok when it echoed a hash
472
472
  // Ocean handed out.
473
473
  let contextAckChecked = false;
474
+ // Hosts that drop `instructions` (Claude chat) still show tool results to the model, so the first
475
+ // memory result of each connection carries the authority line as a second text block (T-328).
476
+ let authoritySent = false;
477
+ const AUTHORITY_TOOLS = new Set(["brain_search", "brain_read", "memory_read"]);
474
478
  async function callTool(name, args, ports) {
475
479
  if (name === "ocean_status") {
476
480
  const version = await serverVersion();
@@ -830,6 +834,7 @@ export async function handleOceanMcpRequest(request, ports) {
830
834
  if (typeof info?.name === "string" && /^[\w .@/-]{1,64}$/.test(info.name))
831
835
  clientName = info.name;
832
836
  contextAckChecked = false;
837
+ authoritySent = false;
833
838
  return {
834
839
  jsonrpc: "2.0",
835
840
  id: request.id,
@@ -912,6 +917,10 @@ export async function handleOceanMcpRequest(request, ports) {
912
917
  await ports.mcpSessions?.open(clientName);
913
918
  try {
914
919
  const result = textResult(await callTool(name, args, ports));
920
+ if (!authoritySent && AUTHORITY_TOOLS.has(name)) {
921
+ authoritySent = true;
922
+ result.content.push({ type: "text", text: MEMORY_AUTHORITY_LINE });
923
+ }
915
924
  await recordMcpCall(clientName, name, true);
916
925
  await ports.mcpSessions?.toolCall(clientName, name, true);
917
926
  return { jsonrpc: "2.0", id: request.id, result };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/services",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -5,9 +5,9 @@
5
5
  {
6
6
  "kind": "skill",
7
7
  "name": "dev.ocean.skills.business-logic",
8
- "version": "2.19.0",
8
+ "version": "2.20.0",
9
9
  "engines": {
10
- "ocean": ">=2.19.0"
10
+ "ocean": ">=2.20.0"
11
11
  },
12
12
  "source": {
13
13
  "type": "path",
@@ -23,9 +23,9 @@
23
23
  {
24
24
  "kind": "skill",
25
25
  "name": "dev.ocean.skills.catch-up",
26
- "version": "2.19.0",
26
+ "version": "2.20.0",
27
27
  "engines": {
28
- "ocean": ">=2.19.0"
28
+ "ocean": ">=2.20.0"
29
29
  },
30
30
  "source": {
31
31
  "type": "path",
@@ -41,9 +41,9 @@
41
41
  {
42
42
  "kind": "skill",
43
43
  "name": "dev.ocean.skills.core-thinking",
44
- "version": "2.19.0",
44
+ "version": "2.20.0",
45
45
  "engines": {
46
- "ocean": ">=2.19.0"
46
+ "ocean": ">=2.20.0"
47
47
  },
48
48
  "source": {
49
49
  "type": "path",
@@ -59,9 +59,9 @@
59
59
  {
60
60
  "kind": "skill",
61
61
  "name": "dev.ocean.skills.daily-harvest",
62
- "version": "2.19.0",
62
+ "version": "2.20.0",
63
63
  "engines": {
64
- "ocean": ">=2.19.0"
64
+ "ocean": ">=2.20.0"
65
65
  },
66
66
  "source": {
67
67
  "type": "path",
@@ -77,9 +77,9 @@
77
77
  {
78
78
  "kind": "skill",
79
79
  "name": "dev.ocean.skills.design-thinking",
80
- "version": "2.19.0",
80
+ "version": "2.20.0",
81
81
  "engines": {
82
- "ocean": ">=2.19.0"
82
+ "ocean": ">=2.20.0"
83
83
  },
84
84
  "source": {
85
85
  "type": "path",
@@ -95,9 +95,9 @@
95
95
  {
96
96
  "kind": "skill",
97
97
  "name": "dev.ocean.skills.graft",
98
- "version": "2.19.0",
98
+ "version": "2.20.0",
99
99
  "engines": {
100
- "ocean": ">=2.19.0"
100
+ "ocean": ">=2.20.0"
101
101
  },
102
102
  "source": {
103
103
  "type": "path",
@@ -113,9 +113,9 @@
113
113
  {
114
114
  "kind": "skill",
115
115
  "name": "dev.ocean.skills.loop",
116
- "version": "2.19.0",
116
+ "version": "2.20.0",
117
117
  "engines": {
118
- "ocean": ">=2.19.0"
118
+ "ocean": ">=2.20.0"
119
119
  },
120
120
  "source": {
121
121
  "type": "path",
@@ -131,9 +131,9 @@
131
131
  {
132
132
  "kind": "skill",
133
133
  "name": "dev.ocean.skills.memory-review",
134
- "version": "2.19.0",
134
+ "version": "2.20.0",
135
135
  "engines": {
136
- "ocean": ">=2.19.0"
136
+ "ocean": ">=2.20.0"
137
137
  },
138
138
  "source": {
139
139
  "type": "path",
@@ -149,9 +149,9 @@
149
149
  {
150
150
  "kind": "skill",
151
151
  "name": "dev.ocean.skills.session-handoff",
152
- "version": "2.19.0",
152
+ "version": "2.20.0",
153
153
  "engines": {
154
- "ocean": ">=2.19.0"
154
+ "ocean": ">=2.20.0"
155
155
  },
156
156
  "source": {
157
157
  "type": "path",
@@ -167,9 +167,9 @@
167
167
  {
168
168
  "kind": "skill",
169
169
  "name": "dev.ocean.skills.use-browser",
170
- "version": "2.19.0",
170
+ "version": "2.20.0",
171
171
  "engines": {
172
- "ocean": ">=2.19.0"
172
+ "ocean": ">=2.20.0"
173
173
  },
174
174
  "source": {
175
175
  "type": "path",
@@ -185,9 +185,9 @@
185
185
  {
186
186
  "kind": "skill",
187
187
  "name": "dev.ocean.skills.verification",
188
- "version": "2.19.0",
188
+ "version": "2.20.0",
189
189
  "engines": {
190
- "ocean": ">=2.19.0"
190
+ "ocean": ">=2.20.0"
191
191
  },
192
192
  "source": {
193
193
  "type": "path",
@@ -203,9 +203,9 @@
203
203
  {
204
204
  "kind": "skill",
205
205
  "name": "dev.ocean.skills.weekly-review",
206
- "version": "2.19.0",
206
+ "version": "2.20.0",
207
207
  "engines": {
208
- "ocean": ">=2.19.0"
208
+ "ocean": ">=2.20.0"
209
209
  },
210
210
  "source": {
211
211
  "type": "path",
@@ -258,9 +258,9 @@
258
258
  "npx"
259
259
  ]
260
260
  },
261
- "version": "2.19.0",
261
+ "version": "2.20.0",
262
262
  "engines": {
263
- "ocean": ">=2.19.0"
263
+ "ocean": ">=2.20.0"
264
264
  },
265
265
  "source": {
266
266
  "type": "path",
@@ -379,9 +379,9 @@
379
379
  "npx"
380
380
  ]
381
381
  },
382
- "version": "2.19.0",
382
+ "version": "2.20.0",
383
383
  "engines": {
384
- "ocean": ">=2.19.0"
384
+ "ocean": ">=2.20.0"
385
385
  },
386
386
  "source": {
387
387
  "type": "path",
@@ -445,9 +445,9 @@
445
445
  "kind": "mcp",
446
446
  "name": "dev.ocean/mcp-gateway",
447
447
  "description": "One MCP endpoint for every registered server: Ocean's own and those installed from the marketplace.",
448
- "version": "2.19.0",
448
+ "version": "2.20.0",
449
449
  "engines": {
450
- "ocean": ">=2.19.0"
450
+ "ocean": ">=2.20.0"
451
451
  },
452
452
  "source": {
453
453
  "type": "path",
@@ -489,9 +489,9 @@
489
489
  "kind": "mcp",
490
490
  "name": "dev.ocean/obsidian",
491
491
  "description": "Ocean's Obsidian vault bridge over MCP.",
492
- "version": "2.19.0",
492
+ "version": "2.20.0",
493
493
  "engines": {
494
- "ocean": ">=2.19.0"
494
+ "ocean": ">=2.20.0"
495
495
  },
496
496
  "source": {
497
497
  "type": "path",
@@ -533,9 +533,9 @@
533
533
  "kind": "mcp",
534
534
  "name": "dev.ocean/ocean",
535
535
  "description": "Ocean's own MCP server: workspace status, tasks, handoffs, sessions and the brain.",
536
- "version": "2.19.0",
536
+ "version": "2.20.0",
537
537
  "engines": {
538
- "ocean": ">=2.19.0"
538
+ "ocean": ">=2.20.0"
539
539
  },
540
540
  "source": {
541
541
  "type": "path",
@@ -587,9 +587,9 @@
587
587
  "npx"
588
588
  ]
589
589
  },
590
- "version": "2.19.0",
590
+ "version": "2.20.0",
591
591
  "engines": {
592
- "ocean": ">=2.19.0"
592
+ "ocean": ">=2.20.0"
593
593
  },
594
594
  "source": {
595
595
  "type": "path",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@amoree-code/ocean",
3
3
  "description": "Local-first memory, tasks and session capture shared by every AI coding client: one private workspace for Claude, Codex, Gemini and more.",
4
- "version": "2.19.0",
4
+ "version": "2.20.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "author": "AMEER ABDULKAREEM JABBAR LAMI",
@@ -53,12 +53,12 @@
53
53
  "@langchain/core": "1.2.14",
54
54
  "@langchain/langgraph": "1.4.19",
55
55
  "@modelcontextprotocol/sdk": "1.32.0",
56
- "@ocean/brain": "2.19.0",
57
- "@ocean/context": "2.19.0",
58
- "@ocean/core": "2.19.0",
59
- "@ocean/loop": "2.19.0",
60
- "@ocean/market": "2.19.0",
61
- "@ocean/services": "2.19.0",
56
+ "@ocean/brain": "2.20.0",
57
+ "@ocean/context": "2.20.0",
58
+ "@ocean/core": "2.20.0",
59
+ "@ocean/loop": "2.20.0",
60
+ "@ocean/market": "2.20.0",
61
+ "@ocean/services": "2.20.0",
62
62
  "playwright-core": "^1.48.0",
63
63
  "sqlite-vec": "0.1.9",
64
64
  "zod": "^4.6.5"
@@ -1,238 +0,0 @@
1
- import { execFileSync } from "node:child_process";
2
- import { createHash } from "node:crypto";
3
- import { readFileSync } from "node:fs";
4
- import { cp, mkdir, rm, writeFile } from "node:fs/promises";
5
- import path from "node:path";
6
- import { crc32 } from "node:zlib";
7
- import { MEMORY_AUTHORITY_LINE } from "@ocean/core/domain/mcp/memory-contract.js";
8
- import { oceanPath, SYSTEM_DIR } from "@ocean/core/shared/paths.js";
9
- // Claude Desktop's chat has no hook setting Ocean can write, and its own memory prompt outranks
10
- // the MCP server's instructions (T-328: asked alone "where is my memory saved?", chat named
11
- // Anthropic's store). A plugin's SessionStart hook runs in chat and Cowork, so the plugin carries
12
- // the authority line into context before the first turn.
13
- //
14
- // Installed with no user step: Desktop syncs every plugin in its organization plugins folder at
15
- // launch and at each session start, and installs one whose manifest says
16
- // `installationPreference: "required"` (claude.com/docs/third-party/claude-desktop/extensions).
17
- // The folder is admin-only, so writing it asks for the admin password once — and again only
18
- // when the plugin's content changes, since its version is a hash of that content. Hooks from
19
- // that folder do not run in Code sessions, which already get Ocean's own start hook.
20
- //
21
- // Static on purpose: chat hooks run sandboxed (the probe's log write never landed on the host),
22
- // so the hook cannot reach the `ocean` engine.
23
- export const DESKTOP_PLUGIN_NAME = "ocean";
24
- // Where Desktop reads organization plugins; Linux has none. OCEAN_DESKTOP_ORG_PLUGINS overrides.
25
- export function desktopOrgPluginsDir(platform = process.platform) {
26
- const override = process.env.OCEAN_DESKTOP_ORG_PLUGINS;
27
- if (override)
28
- return override;
29
- if (platform === "darwin")
30
- return "/Library/Application Support/Claude/org-plugins";
31
- if (platform === "win32")
32
- return "C:\\Program Files\\Claude\\org-plugins";
33
- return undefined;
34
- }
35
- function desktopPluginFile() {
36
- return oceanPath(SYSTEM_DIR, "state", "clients", "ocean-desktop-plugin.zip");
37
- }
38
- function desktopPluginStaging() {
39
- return oceanPath(SYSTEM_DIR, "state", "clients", "desktop-plugin");
40
- }
41
- const DESKTOP_PLUGIN_UPLOAD = "Claude Desktop → Customize → Plugins → + → Upload plugin, choose this file, then quit Claude (⌘Q) and reopen it";
42
- const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
43
- function hookFiles() {
44
- return {
45
- "hooks/hooks.json": json({
46
- hooks: {
47
- SessionStart: [
48
- {
49
- hooks: [
50
- {
51
- type: "command",
52
- // biome-ignore lint/suspicious/noTemplateCurlyInString: expanded by Desktop, not JS
53
- command: 'cat "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.json"',
54
- },
55
- ],
56
- },
57
- ],
58
- },
59
- }),
60
- "hooks/session-start.json": json({
61
- hookSpecificOutput: {
62
- hookEventName: "SessionStart",
63
- additionalContext: MEMORY_AUTHORITY_LINE,
64
- },
65
- }),
66
- };
67
- }
68
- // Changes only when the hook does, so an Ocean upgrade alone never asks for the password again.
69
- function contentVersion() {
70
- const hash = createHash("sha256");
71
- for (const [name, text] of Object.entries(hookFiles()))
72
- hash.update(`${name}\0${text}\0`);
73
- return `1.0.0-${hash.digest("hex").slice(0, 12)}`;
74
- }
75
- // The plugin's files, by path inside the plugin folder.
76
- export function desktopPluginFiles(version = contentVersion()) {
77
- return {
78
- ".claude-plugin/plugin.json": json({
79
- name: DESKTOP_PLUGIN_NAME,
80
- version,
81
- description: "Ocean is your single memory: every Claude Desktop session starts knowing it, and asks Ocean before its own memory.",
82
- author: { name: "Ocean" },
83
- homepage: "https://github.com/amoree-code/ocean",
84
- installationPreference: "required",
85
- }),
86
- "version.json": json({ version }),
87
- ...hookFiles(),
88
- };
89
- }
90
- // A stored (uncompressed) zip with a fixed timestamp, so the same files give the same bytes.
91
- // Folder entries precede their files, as `zip` writes them.
92
- export function zipStored(files) {
93
- const entries = [];
94
- const folders = new Set();
95
- for (const [name, text] of Object.entries(files)) {
96
- const parts = name.split("/");
97
- for (let depth = 1; depth < parts.length; depth++) {
98
- const folder = `${parts.slice(0, depth).join("/")}/`;
99
- if (!folders.has(folder)) {
100
- folders.add(folder);
101
- entries.push([folder, Buffer.alloc(0)]);
102
- }
103
- }
104
- entries.push([name, Buffer.from(text, "utf8")]);
105
- }
106
- const DOS_DATE = (0 << 9) | (1 << 5) | 1; // 1980-01-01
107
- const locals = [];
108
- const centrals = [];
109
- let offset = 0;
110
- for (const [name, data] of entries) {
111
- const nameBytes = Buffer.from(name, "utf8");
112
- const crc = crc32(data);
113
- const local = Buffer.alloc(30);
114
- local.writeUInt32LE(0x04034b50, 0);
115
- local.writeUInt16LE(20, 4); // version needed
116
- local.writeUInt16LE(0x0800, 6); // UTF-8 names
117
- local.writeUInt16LE(0, 8); // stored
118
- local.writeUInt16LE(0, 10);
119
- local.writeUInt16LE(DOS_DATE, 12);
120
- local.writeUInt32LE(crc, 14);
121
- local.writeUInt32LE(data.length, 18);
122
- local.writeUInt32LE(data.length, 22);
123
- local.writeUInt16LE(nameBytes.length, 26);
124
- local.writeUInt16LE(0, 28);
125
- const central = Buffer.alloc(46);
126
- central.writeUInt32LE(0x02014b50, 0);
127
- central.writeUInt16LE((3 << 8) | 20, 4); // made by: Unix
128
- central.writeUInt16LE(20, 6);
129
- central.writeUInt16LE(0x0800, 8);
130
- central.writeUInt16LE(0, 10);
131
- central.writeUInt16LE(0, 12);
132
- central.writeUInt16LE(DOS_DATE, 14);
133
- central.writeUInt32LE(crc, 16);
134
- central.writeUInt32LE(data.length, 20);
135
- central.writeUInt32LE(data.length, 24);
136
- central.writeUInt16LE(nameBytes.length, 28);
137
- central.writeUInt32LE(0, 30); // extra and comment lengths
138
- central.writeUInt32LE(0, 34); // disk start and internal attributes
139
- const mode = name.endsWith("/") ? 0o40755 : 0o100644;
140
- central.writeUInt32LE((mode << 16) >>> 0, 38);
141
- central.writeUInt32LE(offset, 42);
142
- locals.push(local, nameBytes, data);
143
- centrals.push(central, nameBytes);
144
- offset += local.length + nameBytes.length + data.length;
145
- }
146
- const directory = Buffer.concat(centrals);
147
- const end = Buffer.alloc(22);
148
- end.writeUInt32LE(0x06054b50, 0);
149
- end.writeUInt16LE(entries.length, 8);
150
- end.writeUInt16LE(entries.length, 10);
151
- end.writeUInt32LE(directory.length, 12);
152
- end.writeUInt32LE(offset, 16);
153
- return Buffer.concat([...locals, directory, end]);
154
- }
155
- // True when the folder Desktop reads holds exactly this plugin. Readable without admin rights.
156
- export function desktopPluginInstalled(orgDir = desktopOrgPluginsDir()) {
157
- if (!orgDir)
158
- return false;
159
- const target = path.join(orgDir, DESKTOP_PLUGIN_NAME);
160
- try {
161
- return Object.entries(desktopPluginFiles()).every(([name, text]) => readFileSync(path.join(target, name), "utf8") === text);
162
- }
163
- catch {
164
- return false;
165
- }
166
- }
167
- const shellQuote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
168
- const psQuote = (value) => `'${value.replaceAll("'", "''")}'`;
169
- // Copies the staged plugin into the admin-only folder behind the system's own password prompt.
170
- function elevatedCopy(staging, target, platform = process.platform) {
171
- const orgDir = path.dirname(target);
172
- if (platform === "darwin") {
173
- const sh = `mkdir -p ${shellQuote(orgDir)} && rm -rf ${shellQuote(target)} && cp -R ${shellQuote(staging)} ${shellQuote(target)}`;
174
- const escaped = sh.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
175
- execFileSync("osascript", [
176
- "-e",
177
- `do shell script "${escaped}" with prompt "Ocean installs its Claude Desktop plugin." with administrator privileges`,
178
- ], { stdio: "ignore" });
179
- return;
180
- }
181
- if (platform === "win32") {
182
- const inner = `New-Item -ItemType Directory -Force -Path ${psQuote(orgDir)} | Out-Null; if (Test-Path ${psQuote(target)}) { Remove-Item -Recurse -Force ${psQuote(target)} }; Copy-Item -Recurse ${psQuote(staging)} ${psQuote(target)}`;
183
- const encoded = Buffer.from(inner, "utf16le").toString("base64");
184
- execFileSync("powershell", [
185
- "-NoProfile",
186
- "-Command",
187
- `Start-Process powershell -Verb RunAs -Wait -ArgumentList '-NoProfile','-EncodedCommand','${encoded}'`,
188
- ], { stdio: "ignore" });
189
- return;
190
- }
191
- throw new Error(`no elevated copy on ${platform}`);
192
- }
193
- async function directCopy(staging, target) {
194
- await mkdir(path.dirname(target), { recursive: true });
195
- await rm(target, { recursive: true, force: true });
196
- await cp(staging, target, { recursive: true });
197
- }
198
- const NEXT_SYNC = "Claude Desktop installs it at its next launch or new session; nothing to upload";
199
- // Puts the plugin where Desktop installs it by itself. Only when that folder does not exist on
200
- // this platform, or the admin prompt is declined, does it fall back to a zip to upload.
201
- export async function installDesktopPlugin(options = {}) {
202
- const orgDir = "orgDir" in options ? options.orgDir : desktopOrgPluginsDir();
203
- const manual = async (reason) => {
204
- const file = desktopPluginFile();
205
- await mkdir(path.dirname(file), { recursive: true });
206
- await writeFile(file, zipStored(desktopPluginFiles()));
207
- return { status: "manual", file, reason, next: DESKTOP_PLUGIN_UPLOAD };
208
- };
209
- if (!orgDir)
210
- return manual(`Claude Desktop reads no organization plugins folder on ${process.platform}`);
211
- const target = path.join(orgDir, DESKTOP_PLUGIN_NAME);
212
- if (desktopPluginInstalled(orgDir))
213
- return { status: "current", dir: target, next: "" };
214
- const staging = path.join(options.staging ?? desktopPluginStaging(), DESKTOP_PLUGIN_NAME);
215
- await rm(staging, { recursive: true, force: true });
216
- for (const [name, text] of Object.entries(desktopPluginFiles())) {
217
- await mkdir(path.dirname(path.join(staging, name)), { recursive: true });
218
- await writeFile(path.join(staging, name), text);
219
- }
220
- try {
221
- await (options.copy ?? directCopy)(staging, target);
222
- }
223
- catch (error) {
224
- const code = error.code;
225
- if (code !== "EACCES" && code !== "EPERM")
226
- throw error;
227
- try {
228
- (options.elevate ?? elevatedCopy)(staging, target);
229
- }
230
- catch {
231
- return manual("the admin password prompt was declined or failed");
232
- }
233
- }
234
- if (!desktopPluginInstalled(orgDir))
235
- return manual(`the plugin did not land in ${target}`);
236
- return { status: "installed", dir: target, next: NEXT_SYNC };
237
- }
238
- //# sourceMappingURL=desktop-plugin.js.map