Commit graph

3 commits

Author SHA1 Message Date
Pascal André
08705aa725
feat(design): add the Design agent and skills as native OpenCode content (#1201)
Slice 2 ("content") of the Design image companion (SCR v1.3.1 §5, §11.2,
§15; AC-14, AC-15, AC-49 content part).

## What

- Native OpenCode files under
`packages/server/src/opencode/design/opencode/`: the `design` primary
agent and seven unlisted skills (`design-core` + six recipes), with
per-file licence notices, `NOTICE.md` and the Apache-2.0 licence. They
work unchanged when copied into a project's or the global `.opencode/`.
- `design/content.ts`: `loadDesignContent()` (text embedded through a
`.md` loader added to the shared native plugin build) and strict
`parseDesignContent()` for checkout code and tests.
- Nothing registers or displays the content yet: the activation slice
wires it into the session-pruning plugin.

## Attribution

- `design-logo` ← brandkit (MIT); `design-ui-mockup` ←
imagegen-frontend-web/mobile (MIT); full MIT notices kept in the files.
- `design-core` and the agent ← Open Design's review ideas, the five
directions (rewritten, no brand names) and the image-poster prompt order
(Apache-2.0, marked as modified work).
- Other recipes written for CodeNomad. No CC-BY prompts, no design
systems.

## Tests

- `node --import tsx --test
packages/server/src/opencode/design/content.test.ts` (9/9; verified
against 19 content mutations)
- `node --test packages/server/scripts/native-plugin-build.test.mjs`
(2/2, self-contained bundle outside the checkout)
- `node --import tsx scripts/test-design-content-native.mjs <cli>`
against OpenCode 2.2.1 and 2.1.2 (added to the PR build); outside CI it
requires `CODENOMAD_NATIVE_FIXTURE_PARENT` outside the user's home
because project discovery walks every ancestor
- Server typecheck; `build:pruning`, `build:automation`,
`build:missions`
2026-10-30 05:18:38 +01:00
Pascal André
7a206a9297
feat(history): rank past-session search and expose it to agents as session_search (#1161)
## Summary

Agents can now find past discussions themselves. The bundled
session-pruning plugin registers a Code Mode tool,
`codenomad.session_search`, ranked by relevance over the calling
session's own project history. This is PR 1 of 2: server/plugin only;
the search window keeps its current behaviour until PR 2 wires the same
engine.

- **Tool scope:** the caller's directory tree, native workspace and
project (plus `global`) history, never other projects. The caller's
location is checked before and after the read, and excerpts are flagged
as untrusted transcript data. The tool follows backend presence like the
plugin's RPCs.
- **Ranking:** up to six Unicode terms; a precise SQL prefilter over
rowid chunks (superset of the JS judge: ASCII folding, Unicode case
classes, literal `\u` escape fallback) yields per-term IDF weights. The
best candidates are judged one bounded body at a time on word
boundaries, with an exact-phrase bonus, prose before tool payloads,
recency as tie-break and one hit per session before repeats. Optional
inclusive UTC `since`/`until`. Candidate, session, judge and time caps
are reported.
- **Shared limits:** scope SQL, readable-part extraction, the 16 MiB
message bound and 40 ms slices move to `history-content.ts` and are
shared with the literal search.
- **For PR 2:** a versioned `historyRanked` RPC returns the same hit
fields plus per-session provenance, so the broker can validate ownership
as for `history`. Existing RPC methods, HTTP routes and UI are
unchanged; the generic RPC proxy stays closed.

Inspired by `@rizal72/oc-session-search`.

## Validation

- Session-pruning tests 98/98, including the package regression; native
plugin bundle 1/1; server typecheck.
- Regressions: Unicode terms and accented case variants, weights, phrase
bonus, diversity, dates, prefilter precision (multi-line and accented
messages lacking a term are not candidates), a rare old match outranking
600+ newer frequent ones, scope isolation, cancellation, caps, skipped
rows, tool registration and presence disposal.
- Isolated native history fixture on OpenCode 2.2.0: 23 checks,
including a ranked query (3 hits across 2 sessions). No shared daemon or
user database was used.
2026-10-27 19:41:50 +01:00
Pascal André
dd5a1f387d
fix(opencode): share host plugin runtime and require 2.0.27 (#920)
## Résultat
Corrige le chargement des plugins CodeNomad avec OpenCode 2.0.27 et
établit cette version comme minimum pour les prochaines releases et les
prereleases dev. Aucun déploiement de l’application active ni
redémarrage du daemon partagé.

## Cause démontrée
- Le runtime natif passe d’Effect 4.0.0-rc.112 à 4.0.1. Le bundle
précédent reproduit `cache.stackFrame` sur une CLI 2.0.27 isolée.
- Embarquer Effect 4.0.1 ne préserve pas la 2.0.26 : échec inverse
`cache.scheduler`.
- Les schémas 2.0.27 consomment `Schema.isStartingWith`, absent du
moteur 2.0.26. Le plancher est fondé sur cette rupture mesurée, pas sur
une liste de versions testées.

## Implémentation
- Pins client/plugin synchronisés à 2.0.27 ; Effect et le SDK public des
plugins sont fournis par OpenCode, hors bundles natifs
pruning/Missions/automation.
- Réglages de build partagés et régression qui interdit une seconde
copie du runtime ; smoke natif ajouté à la matrice minimum/latest.
- Diagnostic `plugin_runtime` traduit dans les dix locales ; versions
futures et personnalisées conservent la reconnaissance authentifiée du
contrat.
- Adaptations du SDK : annulation des lectures projet, références de
credentials externes et connexion fournisseur externe avec formulaire
natif, sans fallback OAuth/API key ni rejeu.
- Le runtime OpenTunnel du backend reste isolé et inchangé. Aucun
tunnel, route ou identité distant n’est modifié.

## Validation locale
- Échec reproduit sur 2.0.26 et réussite sur 2.0.27 pour les variantes
de bundle comparées.
- Suites natives isolées automation,
pruning/historique/proxy/concurrence/redémarrage et Missions réussies
sur 2.0.27.
- Régressions ciblées de build, store/serveur et navigateur (diagnostic
du minimum, connexion externe et brouillon conservé) réussies ;
typechecks UI/serveur/Electron/OpenTunnel réussis.
- Suite serveur complète et CI multiplateforme encore en validation à
l’ouverture ; aucun résultat entièrement vert anticipé.

La revue gatekeeper indépendante sera publiée ici avant fusion. Les
anciennes preuves de qualification restent historiques, pas une promesse
de support des moteurs antérieurs au nouveau plancher.
2026-10-12 16:42:07 +02:00