@amoree-code/ocean 1.11.0 → 2.0.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.
Files changed (30) hide show
  1. package/README.md +8 -1
  2. package/dist/application/clients/editors.js +3 -1
  3. package/dist/application/integrations/skill-auto-sync.js +44 -0
  4. package/dist/application/onboarding/steps.js +4 -3
  5. package/dist/interfaces/cli/browser-command.js +34 -1
  6. package/dist/interfaces/cli/browser-findings.js +19 -7
  7. package/dist/interfaces/cli/command-registry.js +16 -1
  8. package/dist/interfaces/cli/help-command.js +3 -3
  9. package/dist/interfaces/cli/market-command.js +11 -4
  10. package/market/mcp/chrome-devtools/ocean.capability.json +33 -4
  11. package/node_modules/@ocean/brain/dist/infrastructure/brain/brain-index.js +29 -2
  12. package/node_modules/@ocean/brain/dist/memory/brain-dump.js +5 -2
  13. package/node_modules/@ocean/brain/package.json +1 -1
  14. package/node_modules/@ocean/context/package.json +1 -1
  15. package/node_modules/@ocean/core/dist/shared/clean-title.js +17 -0
  16. package/node_modules/@ocean/core/package.json +1 -1
  17. package/node_modules/@ocean/loop/dist/tasks/verify-task.js +31 -27
  18. package/node_modules/@ocean/loop/package.json +1 -1
  19. package/node_modules/@ocean/market/dist/mcp/chrome-debugging.js +148 -15
  20. package/node_modules/@ocean/market/dist/mcp/mcp-launch.js +9 -1
  21. package/node_modules/@ocean/market/dist/skills/core-skill-sync.js +10 -2
  22. package/node_modules/@ocean/market/dist/skills/skill-hub.js +99 -7
  23. package/node_modules/@ocean/market/package.json +1 -1
  24. package/node_modules/@ocean/services/dist/distill/distill.js +2 -1
  25. package/node_modules/@ocean/services/dist/doctor/workspace-doctor.js +5 -1
  26. package/node_modules/@ocean/services/dist/harvest/harvest.js +3 -14
  27. package/node_modules/@ocean/services/dist/projects/projects-overview.js +172 -0
  28. package/node_modules/@ocean/services/package.json +1 -1
  29. package/ocean-marketplace.json +66 -39
  30. package/package.json +7 -7
package/README.md CHANGED
@@ -132,7 +132,7 @@ prints its usage and never runs it. To hand `--help` to a wrapped client, put it
132
132
  | `ocean uninstall` | undo `setup` and `clients apply` outside the workspace; `--purge` also deletes the workspace | Reads; `--yes` writes (also outside: client configs, shell profile, login service) |
133
133
  | `ocean onboard` | run the pending first-run steps | Writes; `--status` reads |
134
134
  | `ocean context` | the workspace context for this folder; `cost` measures each client's always-on context | Reads |
135
- | `ocean project` | resolve, bind, register, rename, move and index projects | Reads; `bind`, `register`, `rename`, `unbind`, `--write` write |
135
+ | `ocean project` | resolve, bind, register, rename, move and index projects; `status`: each one's git state, open tasks, last session and next action | Reads; `bind`, `register`, `rename`, `unbind`, `--write` write |
136
136
  | `ocean tasks` | list, create, claim, checkpoint, verify and complete tasks | Reads; `new`, `claim`, `checkpoint`, `complete`, `archive --apply` write |
137
137
  | `ocean loop` | repeated agent runs on one task | Runs; `start` needs `--approve` |
138
138
  | `ocean policy` | list the charter's policies or print one | Reads |
@@ -215,6 +215,13 @@ See [skills/index.json](packages/harness/skills/index.json) for the current cata
215
215
  `ocean skill learn <completed-session-id>` extracts a candidate skill from a finished
216
216
  session, and `ocean skill review <candidate-id> promoted` activates it.
217
217
 
218
+ Skills reach every client by themselves. At each session start Ocean copies any new or updated
219
+ skill — the engine's core skills, and the ones in the skill hub (`bridge/skills/`, where
220
+ `ocean market install` puts a skill and where you can make your own) — into Claude, Codex,
221
+ Gemini and Hermes. `ocean market install|update` copies at once, and `ocean market uninstall`
222
+ removes the copies it made. A copy you edited inside a client after Ocean's version is left as
223
+ you wrote it. `ocean skill sync` still does the core skills by hand.
224
+
218
225
  ## Public engine, private workspace, machine state
219
226
 
220
227
  ```text
@@ -94,7 +94,9 @@ function parseScalar(raw) {
94
94
  const quote = (value) => JSON.stringify(value);
95
95
  // --- TOML: one `[<table>.<key>]` section per server -------------------------------------------
96
96
  export function tomlEditor(table) {
97
- const header = /^\s*\[([^\]]+)\]\s*$/;
97
+ // `[table]` and `[[array-of-tables]]` both start a section: a `[[skills.config]]` block after
98
+ // the last server (Ocean's own skill filter writes one) must end that server, not join it.
99
+ const header = /^\s*\[\[?([^\]]+)\]\]?\s*$/;
98
100
  const sections = (lines) => {
99
101
  const found = [];
100
102
  lines.forEach((line, index) => {
@@ -0,0 +1,44 @@
1
+ import { syncCoreSkills } from "@ocean/market/skills/core-skill-sync.js";
2
+ import { copyClientSkills, retireCoreFromHub, } from "@ocean/market/skills/skill-hub.js";
3
+ // Keeps every client's skills current with no command run: the session-start sync and
4
+ // `ocean market install|update` call it. Hub skills (installed from the market or made there)
5
+ // first, then the engine's core skills, so the engine's version of a core skill wins. A copy the
6
+ // owner changed inside a client after Ocean's version is kept, never overwritten.
7
+ export async function autoSyncSkills(home) {
8
+ const summary = {
9
+ retired: [],
10
+ copied: [],
11
+ kept: [],
12
+ failed: [],
13
+ };
14
+ try {
15
+ summary.retired = await retireCoreFromHub();
16
+ }
17
+ catch (error) {
18
+ summary.failed.push(`retire: ${error instanceof Error ? error.message : String(error)}`);
19
+ }
20
+ try {
21
+ const hub = await copyClientSkills({ apply: true, auto: true, home });
22
+ for (const action of hub.actions) {
23
+ const label = `${action.client}:${action.skill}`;
24
+ if (action.action === "kept")
25
+ summary.kept.push(label);
26
+ else if (action.action === "failed")
27
+ summary.failed.push(`${label}: ${action.error}`);
28
+ else if (action.action !== "synchronized")
29
+ summary.copied.push(label);
30
+ }
31
+ }
32
+ catch (error) {
33
+ summary.failed.push(`hub: ${error instanceof Error ? error.message : String(error)}`);
34
+ }
35
+ try {
36
+ for (const result of await syncCoreSkills(home, { keepNewer: true }))
37
+ summary.copied.push(...result.copied.map((skill) => `${result.client}:${skill}`));
38
+ }
39
+ catch (error) {
40
+ summary.failed.push(`core: ${error instanceof Error ? error.message : String(error)}`);
41
+ }
42
+ return summary;
43
+ }
44
+ //# sourceMappingURL=skill-auto-sync.js.map
@@ -1,6 +1,7 @@
1
1
  import { writeFile } from "node:fs/promises";
2
2
  import { oceanPath, PERSONAL_DIR } from "@ocean/core/shared/paths.js";
3
- import { copyClientSkills, populateSkillHub, } from "@ocean/market/skills/skill-hub.js";
3
+ import { syncCoreSkills } from "@ocean/market/skills/core-skill-sync.js";
4
+ import { copyClientSkills } from "@ocean/market/skills/skill-hub.js";
4
5
  import { connectObsidianVault } from "@ocean/services/obsidian/vault-discovery.js";
5
6
  import { ONBOARDING_QUESTIONS, onboard, } from "@ocean/services/onboarding/onboarding.js";
6
7
  // Bump when a step is added; completed steps stay completed, only new ids run.
@@ -182,8 +183,8 @@ export function buildSteps(deps) {
182
183
  title: "Skills (one store in Ocean, clients hold copies)",
183
184
  optional: false,
184
185
  async run(io) {
185
- const hub = await populateSkillHub();
186
- io.say(` Hub: ${hub.added.length} added, ${hub.kept.length} already there.`);
186
+ const core = await syncCoreSkills(undefined, { keepNewer: true });
187
+ io.say(` Core skills: ${core.flatMap((item) => item.copied).length} copied to clients.`);
187
188
  const plan = await copyClientSkills({});
188
189
  const pending = plan.actions.filter((a) => a.action !== "synchronized");
189
190
  if (pending.length === 0) {
@@ -1,9 +1,42 @@
1
1
  import { openSessionStore } from "@ocean/loop/infrastructure/persistence/session-store.js";
2
+ import { BROWSER_CAPABILITY, BROWSER_PROFILE_VARIABLE, browserLabel, browserProfileRoot, CHROMIUM_BROWSERS, listeningBrowsers, resolveBrowserChoice, selectedBrowserProfile, } from "@ocean/market/mcp/chrome-debugging.js";
3
+ import { keychainStore } from "@ocean/market/security/secrets.js";
2
4
  import { BrowserService, } from "@ocean/services/browser/browser-service.js";
3
5
  import { BrowserSessionManager, browserDownloadsPath, } from "@ocean/services/browser/browser-session.js";
4
6
  import { BrowserTaskRunner } from "@ocean/services/browser/browser-task-runner.js";
5
7
  import { PlaywrightBrowserProvider } from "../../infrastructure/providers/playwright-browser-provider.js";
8
+ // `ocean browser use <name|path>`: which Chromium browser `dev.ocean/chrome-devtools` attaches
9
+ // to, stored on this machine (macOS keychain) and read by every client's launch. `use chrome`
10
+ // clears it back to the default. `ocean browser attach` lists what can be attached right now.
11
+ async function runBrowserChoice(action, args) {
12
+ const store = keychainStore();
13
+ const read = () => store.get(BROWSER_CAPABILITY, BROWSER_PROFILE_VARIABLE);
14
+ if (action === "attach") {
15
+ const selected = selectedBrowserProfile({ stored: read });
16
+ return print({
17
+ selected: { browser: browserLabel(selected), profile: selected },
18
+ listening: await listeningBrowsers(),
19
+ known: CHROMIUM_BROWSERS.map((each) => each.id),
20
+ });
21
+ }
22
+ const choice = args[0];
23
+ if (!choice)
24
+ throw new Error(`Usage: ocean browser use <${CHROMIUM_BROWSERS.map((each) => each.id).join("|")}|/absolute/profile/path>`);
25
+ const root = resolveBrowserChoice(choice);
26
+ if (root === browserProfileRoot("chrome"))
27
+ store.remove(BROWSER_CAPABILITY, BROWSER_PROFILE_VARIABLE);
28
+ else
29
+ store.set(BROWSER_CAPABILITY, BROWSER_PROFILE_VARIABLE, root);
30
+ return print({
31
+ browser: browserLabel(root),
32
+ profile: root,
33
+ in: store.name,
34
+ next: "turn on remote debugging in that browser's inspect page (e.g. brave://inspect/#remote-debugging), then restart open clients",
35
+ });
36
+ }
6
37
  export async function runBrowserCommand(action, args) {
38
+ if (action === "use" || action === "attach")
39
+ return runBrowserChoice(action, args);
7
40
  const store = await openSessionStore();
8
41
  const manager = new BrowserSessionManager(store, new BrowserService(new PlaywrightBrowserProvider()));
9
42
  const runner = new BrowserTaskRunner(manager);
@@ -114,6 +147,6 @@ function print(value) {
114
147
  console.log(JSON.stringify(value, null, 2));
115
148
  }
116
149
  function usage() {
117
- console.error("Usage: ocean browser detect|open|show|events|close|approve|navigate|read|observe|extract|click|type|replace-text|select|scroll|wait|upload|download|submit|run");
150
+ console.error("Usage: ocean browser use|attach|detect|open|show|events|close|approve|navigate|read|observe|extract|click|type|replace-text|select|scroll|wait|upload|download|submit|run");
118
151
  }
119
152
  //# sourceMappingURL=browser-command.js.map
@@ -1,14 +1,17 @@
1
1
  import { existsSync } from "node:fs";
2
+ import path from "node:path";
2
3
  import { mcpServerFile } from "@ocean/market/adapters/mcp-adapter.js";
3
4
  import { marketplacePaths } from "@ocean/market/install/default-marketplace.js";
4
- import { chromeDebuggingListening } from "@ocean/market/mcp/chrome-debugging.js";
5
- // Marketplace capabilities that attach to the owner's running Chrome (T-298).
5
+ import { BROWSER_CAPABILITY, BROWSER_PROFILE_VARIABLE, browserLabel, chromeDebuggingListening, listeningBrowsers, selectedBrowserProfile, } from "@ocean/market/mcp/chrome-debugging.js";
6
+ import { keychainStore } from "@ocean/market/security/secrets.js";
7
+ // Marketplace capabilities that attach to the owner's running browser (T-298).
6
8
  export const BROWSER_CAPABILITIES = [
7
9
  "dev.ocean/chrome-devtools",
8
10
  "dev.ocean/browser",
9
11
  ];
10
- // `ocean doctor`: once a browser capability is installed, whether Chrome is there to attach to.
11
- // Nothing installed is nothing to report.
12
+ // `ocean doctor`: once a browser capability is installed, whether the chosen browser is there
13
+ // to attach to — and, when it is not, whether another Chromium browser is. Nothing installed is
14
+ // nothing to report.
12
15
  export async function browserFindings(options = {}) {
13
16
  const serversRoot = options.serversRoot ?? marketplacePaths().mcpServers;
14
17
  const installed = BROWSER_CAPABILITIES.filter((name) => existsSync(mcpServerFile(serversRoot, name)));
@@ -17,8 +20,17 @@ export async function browserFindings(options = {}) {
17
20
  const finding = (severity, message) => [
18
21
  { code: "BROWSER", severity, message, fixable: false },
19
22
  ];
20
- return (await (options.listening ?? chromeDebuggingListening)())
21
- ? finding("OK", `${installed.join(", ")} installed and Chrome debugging is listening`)
22
- : finding("WARN", `${installed.join(", ")} installed, but Chrome is closed or chrome://inspect/#remote-debugging is off (a sandboxed shell that blocks loopback also sees this)`);
23
+ const probe = options.listening ?? chromeDebuggingListening;
24
+ const root = options.profileRoot ??
25
+ selectedBrowserProfile({
26
+ stored: () => keychainStore().get(BROWSER_CAPABILITY, BROWSER_PROFILE_VARIABLE),
27
+ });
28
+ const label = browserLabel(root);
29
+ if (await probe(path.join(root, "DevToolsActivePort")))
30
+ return finding("OK", `${installed.join(", ")} installed and ${label} debugging is listening`);
31
+ const other = (await listeningBrowsers({ listening: probe })).find((each) => each.root !== root);
32
+ return other
33
+ ? finding("WARN", `${installed.join(", ")} attaches to ${label}, but only ${other.label} has debugging on: run \`ocean browser use ${other.id}\``)
34
+ : finding("WARN", `${installed.join(", ")} installed, but ${label} is closed or its inspect page's remote-debugging is off (a sandboxed shell that blocks loopback also sees this)`);
23
35
  }
24
36
  //# sourceMappingURL=browser-findings.js.map
@@ -27,6 +27,7 @@ import { listInboxCandidates, promoteInboxNote, } from "@ocean/services/obsidian
27
27
  import { connectObsidianVault, discoverObsidianVault, loadObsidianConnection, } from "@ocean/services/obsidian/vault-discovery.js";
28
28
  import { syncObsidianVault, watchObsidianVault, } from "@ocean/services/obsidian/vault-sync.js";
29
29
  import { writeObsidianNote } from "@ocean/services/obsidian/vault-writer.js";
30
+ import { overviewTable, projectsOverview, writeRegistryBlock, } from "@ocean/services/projects/projects-overview.js";
30
31
  import { clientFindings, repairClients, } from "../../application/clients/clients.js";
31
32
  import { desktopWatcherFindings } from "../../application/clients/desktop-watcher.js";
32
33
  import { nativeFindings } from "../../application/clients/native.js";
@@ -35,6 +36,7 @@ import { findInstallSpec, installPlan, installProvider, listInstallSpecs, remove
35
36
  import { syncCharterCopies } from "../../application/integrations/charter-copies.js";
36
37
  import { configureClaudeCodeWrapper } from "../../application/integrations/claude-vscode.js";
37
38
  import { repairEngineEntries } from "../../application/integrations/engine-entry-repair.js";
39
+ import { autoSyncSkills } from "../../application/integrations/skill-auto-sync.js";
38
40
  import { syncSkillFilter } from "../../application/integrations/skill-filter.js";
39
41
  import { selectProfileForTask } from "../../application/profiles/profile-suggestion.js";
40
42
  import { listSchedules, runDueSchedules, runSchedule, runSchedulerWorker, runSchedulerWorkerOnce, saveSchedule, setScheduleEnabled, } from "../../application/scheduler/local-scheduler.js";
@@ -185,6 +187,8 @@ async function commandClient() {
185
187
  // to core.md reaches the clients that carry a copy without a manual step.
186
188
  const charter = await syncCharterCopies();
187
189
  const skillFilter = await syncSkillFilter();
190
+ // A skill made or installed reaches every client at the next session start.
191
+ const skills = await autoSyncSkills();
188
192
  const engineEntries = await repairEngineEntries();
189
193
  // T-305: a repointed service start file only takes effect once the service restarts.
190
194
  const service = engineEntries.some((repair) => repair.kind === "service" && repair.status === "updated")
@@ -200,6 +204,7 @@ async function commandClient() {
200
204
  providers: result.providers,
201
205
  charter,
202
206
  skillFilter,
207
+ skills,
203
208
  engineEntries,
204
209
  service,
205
210
  clients,
@@ -594,6 +599,16 @@ async function commandProject() {
594
599
  const result = await migrateProjectBindings(process.argv.includes("--write"));
595
600
  console.log(JSON.stringify(result, null, 2));
596
601
  }
602
+ else if (action === "status") {
603
+ // Every project's git state, open tasks, last session and next action, derived now (T-317).
604
+ const rows = await projectsOverview();
605
+ if (process.argv.includes("--write"))
606
+ console.log(`updated ${await writeRegistryBlock(rows)}`);
607
+ else if (process.argv.includes("--json"))
608
+ console.log(JSON.stringify(rows, null, 2));
609
+ else
610
+ console.log(overviewTable(rows));
611
+ }
597
612
  else if (action === "index") {
598
613
  if (process.argv.includes("--write"))
599
614
  console.log(JSON.stringify(await writeProjectIndex(), null, 2));
@@ -601,7 +616,7 @@ async function commandProject() {
601
616
  console.log(await renderProjectIndex());
602
617
  }
603
618
  else {
604
- console.error("Usage: ocean project resolve [path]|bind <name> <path> [--add]|register [path]|unbind <path>|rename <id> <new-id>|move <id> <category> [--write]|list [--category <name>]|migrate [--write]|index [--write]");
619
+ console.error("Usage: ocean project resolve [path]|bind <name> <path> [--add]|register [path]|unbind <path>|rename <id> <new-id>|move <id> <category> [--write]|list [--category <name>]|status [--json] [--write]|migrate [--write]|index [--write]");
605
620
  process.exitCode = 1;
606
621
  }
607
622
  }
@@ -43,8 +43,8 @@ export const commandHelp = {
43
43
  "ocean context [--json] | cost [--json] [--budget <bytes>] [--project <dir>]",
44
44
  ],
45
45
  project: [
46
- "Resolve, bind, register, rename and index projects.",
47
- "ocean project resolve [path]|bind <name> <path> [--add]|register [path]|unbind <path>|rename <id> <new-id>|list|migrate [--write]|index [--write]",
46
+ "Resolve, bind, register, rename, index projects, and show each one's live status.",
47
+ "ocean project resolve [path]|bind <name> <path> [--add]|register [path]|unbind <path>|rename <id> <new-id>|list|status [--json] [--write]|migrate [--write]|index [--write]",
48
48
  ],
49
49
  tasks: [
50
50
  "List, create, claim, checkpoint, verify and complete tasks.",
@@ -134,7 +134,7 @@ export const commandHelp = {
134
134
  ],
135
135
  browser: [
136
136
  "Drive a browser session; uploads and submits need --approve.",
137
- "ocean browser detect|open|show|events|close|approve|navigate|read|observe|extract|click|type|replace-text|select|scroll|wait|upload|download|submit|run",
137
+ "ocean browser use|attach|detect|open|show|events|close|approve|navigate|read|observe|extract|click|type|replace-text|select|scroll|wait|upload|download|submit|run",
138
138
  ],
139
139
  memory: [
140
140
  "Search, read, review and maintain memory records and the brain index.",
@@ -9,6 +9,8 @@ import { launchInputs, } from "@ocean/market/mcp/mcp-launch.js";
9
9
  import { runInstalledMcp } from "@ocean/market/mcp/mcp-runner.js";
10
10
  import { fetchRegistryServer, searchRegistry, } from "@ocean/market/registry/official-registry.js";
11
11
  import { keychainStore } from "@ocean/market/security/secrets.js";
12
+ import { hubSkillHashes, pruneClientSkills, } from "@ocean/market/skills/skill-hub.js";
13
+ import { autoSyncSkills } from "../../application/integrations/skill-auto-sync.js";
12
14
  import { oceanVersion } from "../../version.js";
13
15
  const usage = "Usage: ocean market list|search <term>|add <server.json|registry name> [--version <v>]|install <name> [--version <v>]|update <name>|uninstall <name>|exec <name>|secret list|set|remove <name> [<value name>] [--index <file>]... [--yes] [--accept-flagged]";
14
16
  function installedServer(name) {
@@ -174,16 +176,21 @@ export async function runMarketCommand(action, args) {
174
176
  }
175
177
  if (!name || !["install", "update", "uninstall"].includes(action))
176
178
  throw new Error(usage);
179
+ // A skill installed, updated or removed reaches every client now, not at the next session.
177
180
  if (action === "install") {
178
181
  const result = await marketplace.install(name, flagValues(args, "--version")[0]);
179
- console.log(JSON.stringify(result, null, 2));
182
+ console.log(JSON.stringify({ ...result, skills: await autoSyncSkills() }, null, 2));
180
183
  printVisibility(result.name);
181
184
  }
182
- else if (action === "update")
183
- console.log(JSON.stringify(await marketplace.update(name), null, 2));
185
+ else if (action === "update") {
186
+ const result = await marketplace.update(name);
187
+ console.log(JSON.stringify({ ...result, skills: await autoSyncSkills() }, null, 2));
188
+ }
184
189
  else {
190
+ const before = await hubSkillHashes();
185
191
  await marketplace.uninstall(name);
186
- console.log(JSON.stringify({ name, status: "uninstalled" }, null, 2));
192
+ const removed = await pruneClientSkills(before);
193
+ console.log(JSON.stringify({ name, status: "uninstalled", skills: { removed } }, null, 2));
187
194
  }
188
195
  }
189
196
  //# sourceMappingURL=market-command.js.map
@@ -1,17 +1,29 @@
1
1
  {
2
2
  "kind": "mcp",
3
3
  "name": "dev.ocean/chrome-devtools",
4
- "description": "Control the owner's real, signed-in Chrome through the ocean-browser-mcp package (pinned Chrome DevTools MCP): tabs, navigation, clicks, forms, uploads, screenshots, console and network errors. Reads every open tab and acts inside any signed-in session of the attached Chrome, for every client wired to it. Chrome asks to allow each new connection. The filesystem permission is declared for consent but not enforced at runtime, and the npm package is pinned by version, not by digest.",
4
+ "description": "Control the owner's real, signed-in Chromium browser (Chrome by default; Brave, Edge, Arc, Vivaldi, Opera or Chromium through `ocean browser use`) through the ocean-browser-mcp package (pinned Chrome DevTools MCP): tabs, navigation, clicks, forms, uploads, screenshots, console and network errors. Reads every open tab and acts inside any signed-in session of the attached browser, for every client wired to it. The browser asks to allow each new connection. The filesystem permission is declared for consent but not enforced at runtime, and the npm package is pinned by version, not by digest.",
5
5
  "permissions": {
6
6
  "filesystem": {
7
- "read": ["~/Library/Application Support/Google/Chrome"]
7
+ "read": [
8
+ "~/Library/Application Support/Google",
9
+ "~/Library/Application Support/Chromium",
10
+ "~/Library/Application Support/BraveSoftware",
11
+ "~/Library/Application Support/Microsoft Edge",
12
+ "~/Library/Application Support/Vivaldi",
13
+ "~/Library/Application Support/com.operasoftware.Opera",
14
+ "~/Library/Application Support/Arc"
15
+ ]
8
16
  },
9
17
  "network": ["registry.npmjs.org", "localhost", "127.0.0.1"],
18
+ "env": [
19
+ "CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS",
20
+ "OCEAN_BROWSER_USER_DATA_DIR"
21
+ ],
10
22
  "exec": ["npx"]
11
23
  },
12
24
  "server": {
13
25
  "name": "dev.ocean/chrome-devtools",
14
- "description": "ocean-browser-mcp runs Chrome DevTools MCP 1.12.0 attached to the owner's running Chrome, with usage statistics and CrUX lookups off, so page URLs stay on this machine.",
26
+ "description": "ocean-browser-mcp runs Chrome DevTools MCP 1.12.0 attached to the owner's running Chromium browser, with usage statistics and CrUX lookups off, so page URLs stay on this machine.",
15
27
  "packages": [
16
28
  {
17
29
  "registryType": "npm",
@@ -19,7 +31,24 @@
19
31
  "version": "0.1.0",
20
32
  "transport": {
21
33
  "type": "stdio"
22
- }
34
+ },
35
+ "packageArguments": [
36
+ {
37
+ "type": "named",
38
+ "name": "--userDataDir",
39
+ "value": "{OCEAN_BROWSER_USER_DATA_DIR}",
40
+ "isRequired": false,
41
+ "description": "Profile root of the Chromium browser to attach to; unset attaches to Chrome. Set with `ocean browser use <name|path>`."
42
+ }
43
+ ],
44
+ "environmentVariables": [
45
+ {
46
+ "name": "CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS",
47
+ "default": "1",
48
+ "isRequired": false,
49
+ "description": "Skips upstream's update check (an npm child process and a registry fetch) on every start; the version is pinned."
50
+ }
51
+ ]
23
52
  }
24
53
  ],
25
54
  "_meta": {
@@ -2,6 +2,25 @@ import { rename, rm } from "node:fs/promises";
2
2
  import { DatabaseSync } from "node:sqlite";
3
3
  import { BRAIN_INDEX_SCHEMA_VERSION, } from "@ocean/core/domain/ports/brain-index-port.js";
4
4
  import * as sqliteVec from "sqlite-vec";
5
+ // Sole file in the brain subsystem that imports node:sqlite (and, when vectors are enabled,
6
+ // sqlite-vec) directly — everything else in application/brain/ talks to the
7
+ // domain/ports/brain-index-port.ts contract, wired to this module only through
8
+ // composition/runtime.ts (enforced by tests/architecture.test.mjs). The index is a
9
+ // disposable, rebuildable cache: nothing here is the source of truth, and nothing outside
10
+ // `reindex` (application/brain/brain-reindex.ts) ever writes to it.
11
+ // bm25 column weights for chunks_fts (title, heading, body): a word in a record's title says
12
+ // far more about what the record is than the same word somewhere in its body.
13
+ const BM25_WEIGHTS = [8, 3, 1];
14
+ // English question and function words, dropped only from the any-word fallback.
15
+ const STOPWORDS = new Set(("a an and are as at be by can could did do does for from had has have how i if in is it " +
16
+ "its me my of on or our should so that the their them then there these they this to was " +
17
+ "we were what when where which who why will with would you your about").split(" "));
18
+ // A crude Latin-script stem: long words lose their last two letters so inflections share a
19
+ // prefix ("decide"/"decision" → "deci"). Other scripts are left alone — their prefixes already
20
+ // match inflected forms.
21
+ function stem(word) {
22
+ return /^[a-z]{6,}$/.test(word) ? word.slice(0, -2) : word;
23
+ }
5
24
  function createSchema(db, withVectors, dims) {
6
25
  db.exec(`
7
26
  CREATE TABLE meta (key TEXT PRIMARY KEY, value TEXT NOT NULL);
@@ -191,7 +210,8 @@ export class BrainIndexReader {
191
210
  try {
192
211
  return this.db
193
212
  .prepare(`
194
- SELECT c.chunk_id AS chunkId, c.doc_id AS docId, bm25(chunks_fts) AS rank
213
+ SELECT c.chunk_id AS chunkId, c.doc_id AS docId,
214
+ bm25(chunks_fts, ${BM25_WEIGHTS.join(", ")}) AS rank
195
215
  FROM chunks_fts JOIN chunks c ON c.chunk_id = chunks_fts.rowid
196
216
  WHERE chunks_fts MATCH ?${scopeFilter}
197
217
  ORDER BY rank LIMIT ?
@@ -208,7 +228,14 @@ export class BrainIndexReader {
208
228
  // A question rarely shares every word with its answer (T-296 eval: natural questions found
209
229
  // nothing). Fill up with any-word matches, bm25-ranked so rarer shared words weigh more;
210
230
  // one-letter prefixes would match everything and are left out.
211
- const anyWord = words.filter((word) => word.length > 1);
231
+ // Question words ("what did I … where my …") match nearly every record and would rank
232
+ // noise first, so they are dropped here, and a long Latin word matches by its stem
233
+ // ("decide" → "deci"*, which also finds "decision").
234
+ const anyWord = [
235
+ ...new Set(words
236
+ .filter((word) => word.length > 1 && !STOPWORDS.has(word))
237
+ .map(stem)),
238
+ ];
212
239
  if (anyWord.length < 2)
213
240
  return all;
214
241
  const seen = new Set(all.map((hit) => hit.chunkId));
@@ -1,6 +1,7 @@
1
1
  import { mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { redactRuntimeText } from "@ocean/core/domain/redaction/redaction.js";
4
+ import { cleanTitle } from "@ocean/core/shared/clean-title.js";
4
5
  import { localDate, localMoment, localTime, } from "@ocean/core/shared/local-date.js";
5
6
  import { DAILY_DIR, INBOX_DIR, oceanPath, oceanRoot, } from "@ocean/core/shared/paths.js";
6
7
  import { findGitRoot } from "@ocean/core/shared/project-resolution.js";
@@ -89,7 +90,9 @@ export async function writeBrainDump(input) {
89
90
  const status = session.status === "completed" && (input.exitCode ?? 0) === 0
90
91
  ? "completed"
91
92
  : "failed";
92
- const title = isGenericContent(workLog) ? project : workLog;
93
+ const title = isGenericContent(workLog)
94
+ ? project
95
+ : cleanTitle(workLog, project);
93
96
  // A session record (T-314): flat frontmatter Obsidian can read, then fixed sections. The
94
97
  // narrative comes from one model call when there was one; otherwise from the events.
95
98
  const quote = (value) => JSON.stringify(value);
@@ -198,7 +201,7 @@ export async function writeDigestRecord(input) {
198
201
  const { digest } = input;
199
202
  const date = localDate(localMoment(input.endedAt));
200
203
  const time = localTime(localMoment(input.startedAt));
201
- const title = safeText(digest.title || digest.goal, 120) || "Conversation";
204
+ const title = cleanTitle(safeText(digest.title || digest.goal, 400), input.project || "Conversation");
202
205
  const quote = (value) => JSON.stringify(value);
203
206
  const list = (heading, items) => items.length
204
207
  ? [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/brain",
3
- "version": "1.11.0",
3
+ "version": "2.0.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": "1.11.0",
3
+ "version": "2.0.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -0,0 +1,17 @@
1
+ // A title made from a client's raw first turn carries the harness's tags (`<system-reminder>…`,
2
+ // `<browser_instruction>…`, `<ide_opened_file>…`). The words inside a closed tag are the
3
+ // harness's, except a slash command's name and arguments; an opening tag left unclosed (the
4
+ // turn was cut short) takes everything after it. What is left, or the fallback, is the title.
5
+ export function cleanTitle(raw, fallback, max = 120) {
6
+ const text = raw
7
+ .replace(/<([\w-]+)(?:\s[^>]*)?>[\s\S]*?<\/\1>/g, (whole, tag) => /^(command-name|command-args)$/.test(tag)
8
+ ? whole.replace(/<[^>]+>/g, " ")
9
+ : " ")
10
+ .replace(/<[\w-]+(?:\s[^>]*)?>[\s\S]*$/, " ")
11
+ .replace(/<[^>]+>/g, " ")
12
+ .replace(/^[\s#>*-]+/, "")
13
+ .replace(/\s+/g, " ")
14
+ .trim();
15
+ return (text || fallback).slice(0, max);
16
+ }
17
+ //# sourceMappingURL=clean-title.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/core",
3
- "version": "1.11.0",
3
+ "version": "2.0.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -8,10 +8,9 @@ import { expandHome, hasControlCharacters, projectVerify, readProjectManifest, }
8
8
  const execFile = promisify(execFileCallback);
9
9
  // Only commands whose first token is on this list are ever executed by the
10
10
  // verifier — including every link of a `&&`/`||`/`;`/`|` chain, since each
11
- // link runs as its own command. A task's `## Verification` section is prose
12
- // with inline-backtick spans and fenced code blocks, so the allowlist keeps
13
- // the verifier from running an arbitrary span that merely looks like a
14
- // command. Command substitution and redirection (`` ` ``, `$(`, `>`, `<`) are
11
+ // link runs as its own command. Only a `verify:` field or a fenced block in
12
+ // `## Verification` is read, and the allowlist still keeps an arbitrary line
13
+ // there from running. Command substitution and redirection (`` ` ``, `$(`, `>`, `<`) are
15
14
  // rejected outright: they let an allowlisted first token smuggle an
16
15
  // unrelated command in (e.g. `` bash -c "rm -rf $HOME" ``).
17
16
  const COMMAND_ALLOWLIST = new Set([
@@ -45,10 +44,10 @@ const defaultRunner = async (command, cwd) => {
45
44
  };
46
45
  /**
47
46
  * Pull runnable commands out of a task's verification declaration. A `verify:`
48
- * frontmatter field (string or comma-separated list) wins; otherwise the
49
- * `## Verification` section is used — each non-empty line inside a fenced code
50
- * block, plus any inline-backtick spans outside of fences — filtered to the
51
- * command allowlist so prose spans are ignored.
47
+ * frontmatter field (string or comma-separated list) wins; otherwise each non-empty
48
+ * line inside a fenced code block of the `## Verification` section. Inline-backtick
49
+ * spans are prose, never commands: on T-308 a prose span naming `npm publish` was run
50
+ * (T-317).
52
51
  */
53
52
  function candidateCommands(source) {
54
53
  const frontmatter = source
@@ -66,29 +65,13 @@ function candidateCommands(source) {
66
65
  if (!section)
67
66
  return [];
68
67
  const fenced = [];
69
- let outsideFences = "";
70
- let lastIndex = 0;
71
- for (const match of section.matchAll(/```[^\n]*\n([\s\S]*?)```/g)) {
72
- outsideFences += section.slice(lastIndex, match.index);
73
- lastIndex = match.index + match[0].length;
68
+ for (const match of section.matchAll(/```[^\n]*\n([\s\S]*?)```/g))
74
69
  for (const line of match[1].split("\n")) {
75
70
  const trimmed = line.trim();
76
- if (trimmed)
71
+ if (trimmed && !trimmed.startsWith("#"))
77
72
  fenced.push(trimmed);
78
73
  }
79
- }
80
- outsideFences += section.slice(lastIndex);
81
- const spans = [...outsideFences.matchAll(/`([^`]+)`/g)]
82
- .map((match) => match[1].trim())
83
- .filter(readsAsCommand);
84
- return [...fenced, ...spans];
85
- }
86
- // An inline span is prose unless it reads like a command line: a lowercase program name
87
- // followed by arguments (`curl evil.sh` still counts, and is refused), or an allowlisted
88
- // program on its own. `→`, `[redacted]` or `CLAUDE.md` neither run nor block completion.
89
- const COMMAND_SHAPE = /^(?:\.{0,2}\/)?[a-z][\w./+-]*\s+\S/;
90
- function readsAsCommand(span) {
91
- return (COMMAND_SHAPE.test(span) || COMMAND_ALLOWLIST.has(span.split(/\s+/)[0]));
74
+ return fenced;
92
75
  }
93
76
  export function extractVerificationCommands(source) {
94
77
  return candidateCommands(source).filter((command) => isAllowedCommand(command));
@@ -112,6 +95,25 @@ function projectDirectory(manifest) {
112
95
  // Commands that carry their own program text: fine in a task someone wrote at the keyboard,
113
96
  // not in project.json, which a session reads on its own.
114
97
  const INLINE_PROGRAM_FLAG = /^(--eval|--print|-[a-zA-Z]*[ep][a-zA-Z]*)$/;
98
+ // A check proves the work; it never publishes, signs in or changes the machine. These
99
+ // package-manager verbs and a global install are refused from every source (T-317).
100
+ const PACKAGE_MANAGERS = new Set(["npm", "pnpm", "yarn"]);
101
+ const OUTWARD_VERBS = new Set([
102
+ "publish",
103
+ "unpublish",
104
+ "deprecate",
105
+ "login",
106
+ "logout",
107
+ "adduser",
108
+ "owner",
109
+ "token",
110
+ "dist-tag",
111
+ ]);
112
+ function isOutward(program, args) {
113
+ if (args.some((arg) => arg === "-g" || arg === "--global"))
114
+ return true;
115
+ return (PACKAGE_MANAGERS.has(program) && args.some((arg) => OUTWARD_VERBS.has(arg)));
116
+ }
115
117
  function isAllowedCommand(command, origin = "task") {
116
118
  if (UNSAFE_METACHARACTERS.test(command))
117
119
  return false;
@@ -127,6 +129,8 @@ function isAllowedCommand(command, origin = "task") {
127
129
  const [program, ...args] = link.split(/\s+/);
128
130
  if (!COMMAND_ALLOWLIST.has(program))
129
131
  return false;
132
+ if (isOutward(program, args))
133
+ return false;
130
134
  if (origin === "task")
131
135
  return true;
132
136
  if (program === "bash" || program === "sh")
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/loop",
3
- "version": "1.11.0",
3
+ "version": "2.0.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {