@n8r/surface 0.0.0-stage → 0.1.0-experimental.2

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 (96) hide show
  1. package/LICENSE +202 -0
  2. package/LICENSE-DOCS +395 -0
  3. package/LICENSING.md +36 -0
  4. package/README.md +181 -2
  5. package/dist/activity.d.ts +16 -0
  6. package/dist/activity.js +44 -0
  7. package/dist/cli.d.ts +2 -0
  8. package/dist/cli.js +260 -0
  9. package/dist/codec.d.ts +4 -0
  10. package/dist/codec.js +41 -0
  11. package/dist/codex.d.ts +72 -0
  12. package/dist/codex.js +510 -0
  13. package/dist/contracts.d.ts +129 -0
  14. package/dist/contracts.js +1 -0
  15. package/dist/html.d.ts +5 -0
  16. package/dist/html.js +50 -0
  17. package/dist/index.d.ts +7 -0
  18. package/dist/index.js +5 -0
  19. package/dist/notes.d.ts +52 -0
  20. package/dist/notes.js +184 -0
  21. package/dist/portable.d.ts +10 -0
  22. package/dist/portable.js +71 -0
  23. package/dist/revisions.d.ts +2 -0
  24. package/dist/revisions.js +18 -0
  25. package/dist/settings.d.ts +23 -0
  26. package/dist/settings.js +100 -0
  27. package/dist/setup.d.ts +9 -0
  28. package/dist/setup.js +161 -0
  29. package/dist/source-tools.d.ts +102 -0
  30. package/dist/source-tools.js +201 -0
  31. package/dist/startup.d.ts +7 -0
  32. package/dist/startup.js +74 -0
  33. package/dist/surface-draft.d.ts +19 -0
  34. package/dist/surface-draft.js +95 -0
  35. package/dist/surface-instructions.d.ts +2 -0
  36. package/dist/surface-instructions.js +23 -0
  37. package/dist/surface-store.d.ts +36 -0
  38. package/dist/surface-store.js +181 -0
  39. package/dist/validate.d.ts +4 -0
  40. package/dist/validate.js +184 -0
  41. package/docs/n8r-surface/README.md +133 -0
  42. package/docs/n8r-surface/codex-research-transcript.md +51 -0
  43. package/docs/n8r-surface/codex-research-verification.md +176 -0
  44. package/docs/n8r-surface/command-outcomes.md +564 -0
  45. package/docs/n8r-surface/contracts.md +210 -0
  46. package/docs/n8r-surface/critical-path.md +163 -0
  47. package/docs/n8r-surface/design.md +289 -0
  48. package/docs/n8r-surface/getting-started.md +107 -0
  49. package/docs/n8r-surface/host-contract.md +176 -0
  50. package/docs/n8r-surface/implementation-decisions.md +96 -0
  51. package/docs/n8r-surface/npm-distribution.md +137 -0
  52. package/docs/n8r-surface/npm-release.md +188 -0
  53. package/docs/n8r-surface/recreation-handoff.md +117 -0
  54. package/docs/n8r-surface/researcher-discovery.md +157 -0
  55. package/docs/n8r-surface/researcher-prepared-check.md +117 -0
  56. package/docs/n8r-surface/researcher-reconciliation-trial.md +149 -0
  57. package/docs/n8r-surface/researcher-repository-check.md +95 -0
  58. package/docs/n8r-surface/researcher-skeleton-check.md +84 -0
  59. package/docs/n8r-surface/researcher-skill-verification.md +725 -0
  60. package/docs/n8r-surface/researcher-skill.md +255 -0
  61. package/docs/n8r-surface/researcher-vault.md +134 -0
  62. package/docs/n8r-surface/save-reopen-transcript.md +211 -0
  63. package/docs/n8r-surface/save-reopen-verification.md +152 -0
  64. package/docs/n8r-surface/startup-human-check.md +172 -0
  65. package/docs/n8r-surface/startup-verification.md +161 -0
  66. package/docs/n8r-surface/startup.md +151 -0
  67. package/docs/n8r-surface/surface-revisions-transcript.md +552 -0
  68. package/docs/n8r-surface/surface-revisions-verification.md +161 -0
  69. package/docs/n8r-surface/vault-setup-verification.md +210 -0
  70. package/docs/n8r-surface/verification.md +117 -0
  71. package/docs/n8r-surface/versioning.md +183 -0
  72. package/examples/researcher/README.md +92 -0
  73. package/examples/researcher/composed.surface.json +430 -0
  74. package/examples/researcher/composed.surface.yaml +283 -0
  75. package/examples/researcher/harbor-r1.research.html +193 -0
  76. package/examples/researcher/harbor-r2.research.html +226 -0
  77. package/examples/researcher/lumen-manual-edit.pending.html +271 -0
  78. package/examples/researcher/lumen-r1.research.html +271 -0
  79. package/examples/researcher/lumen-r2.research.html +280 -0
  80. package/examples/researcher/sources/harbor-api.md +16 -0
  81. package/examples/researcher/sources/harbor-auth.md +8 -0
  82. package/examples/researcher/sources/lumen-guide.md +28 -0
  83. package/examples/researcher/sources/lumen-settings.md +9 -0
  84. package/package.json +45 -4
  85. package/plugins/n8r-surface/.codex-plugin/plugin.json +31 -0
  86. package/plugins/n8r-surface/LICENSE +202 -0
  87. package/plugins/n8r-surface/LICENSE-DOCS +395 -0
  88. package/plugins/n8r-surface/LICENSING.md +36 -0
  89. package/plugins/n8r-surface/assets/icon.svg +5 -0
  90. package/plugins/n8r-surface/plugin.json +27 -0
  91. package/plugins/n8r-surface/skills/research/SKILL.md +122 -0
  92. package/plugins/n8r-surface/skills/research/agents/openai.yaml +4 -0
  93. package/plugins/n8r-surface/skills/research/references/discovery-map.md +160 -0
  94. package/plugins/n8r-surface/skills/research/references/model-meanings.md +55 -0
  95. package/plugins/n8r-surface/skills/research/references/skeleton-surface.md +105 -0
  96. package/plugins/n8r-surface/skills/research/references/working-notes.md +116 -0
@@ -0,0 +1,183 @@
1
+ # Package version and release identity
2
+
3
+ The [approved decision in issue #27](https://github.com/injectionator/n8r-surface/issues/27#issuecomment-6661015093)
4
+ applies to both `@n8r/surface` and `n8r-surface`. Their authoritative version is
5
+ `package.json`; the lockfile must agree. Both packages come from one build of one
6
+ commit. The installed command reads its own manifest for `--version`, regardless
7
+ of the working directory. Package versions do not version the AI Surface Model,
8
+ Researcher skill, or individual saved Surface revisions.
9
+
10
+ ## Compatibility and version changes
11
+
12
+ Follow [SemVer 2.0.0](https://semver.org/spec/v2.0.0.html) for package releases.
13
+ The compatibility boundary covers documented library exports, supported Node
14
+ majors, command inputs/exit behavior, settings and persisted formats. Provisional
15
+ model semantics remain provisional; a package number does not establish universal
16
+ model conformance. Document migration requirements for breaking changes.
17
+
18
+ | Stage | Breaking change | Compatible feature | Compatible fix |
19
+ | --- | --- | --- | --- |
20
+ | Before 1.0 | Increment minor, reset patch | Increment minor, reset patch | Increment patch |
21
+ | From 1.0 | Increment major, reset minor/patch | Increment minor, reset patch | Increment patch |
22
+
23
+ Before 1.0, this is a project compatibility convention stronger than SemVer's
24
+ allowance for initial development. A major release of 1.0 requires an explicit
25
+ compatibility decision, not simply a successful build. Prereleases use a suffix
26
+ such as `-experimental.1` or `-rc.1`; increment it for changed prerelease bytes.
27
+ Never reuse a released number. Release versions exclude `+build` metadata to
28
+ avoid distinct Git tags representing the same npm version identity.
29
+
30
+ Use `npm version VERSION --no-git-tag-version` for an approved version change,
31
+ then review both manifests in the issue's PR. `npm run check:version` rejects
32
+ invalid versions and drift in either lockfile version. `npm test` and candidate
33
+ packing run that check. A version bump needs no source-code edit for CLI output.
34
+ The maintainer confirmed `0.1.0-experimental.2` and authorized publication on
35
+ 5 November 2026. Review/merge and required account actions remain separate. See
36
+ the [first-release procedure](npm-release.md).
37
+
38
+ npm distribution tags are movable pointers, unlike permanent Git release tags:
39
+
40
+ - Experimental prereleases use explicit `experimental` on both packages.
41
+ - Release candidates use explicit `next`; they must not update `latest`.
42
+ - Stable releases may use `latest` only after both exact-version routes pass
43
+ verification and promotion is authorized. Publish initially under `next` to
44
+ permit independent readback before promotion.
45
+
46
+ ## One version, one commit, one release
47
+
48
+ After release authorization, use a clean, reviewed commit with the approved
49
+ version. Create one annotated `vVERSION` Git tag pointing to its full commit SHA;
50
+ never move, overwrite or delete a release tag. Create the corresponding GitHub
51
+ Release as a draft with `target_commitish` explicitly set to that SHA and the
52
+ prerelease flag matching the version. Do not use a moving branch as the target.
53
+
54
+ Enable [GitHub release immutability](https://docs.github.com/en/code-security/how-tos/secure-your-supply-chain/establish-provenance-and-integrity/prevent-release-changes)
55
+ before publishing a release. Attach all evidence before finalizing the draft:
56
+ GitHub then locks its tag and assets. The verifier rejects published releases
57
+ that do not report `immutable: true`. No repository settings are changed by
58
+ these local tools. Review/approval of the selected commit is a maintainer
59
+ prerequisite; the verifier checks identity, not the adequacy of code review.
60
+
61
+ Retain `candidates.json` and both exact tarballs from the approved build. Each
62
+ report entry has a `releaseAsset` name, respectively
63
+ `n8r-surface-VERSION-scoped.tgz` and `n8r-surface-VERSION-unscoped.tgz`. Copy the
64
+ bytes under those distinct names when uploading release assets, since npm gives
65
+ both original tarballs the same basename. Upload the report too, and retain the
66
+ build environment, test evidence, release notes and per-package registry results.
67
+ SHA-256 identifies bytes; it does not authenticate the builder.
68
+
69
+ The source packer requires `private: true`. The explicit `--publishable` option
70
+ creates fresh publishable archives at the approved first version; ordinary
71
+ candidates stay private. Use a fresh reviewed commit and build. Do not strip the guard from an old tarball
72
+ and keep its old hash or claim it was built from an unchanged commit. The current
73
+ verifier accepts private artifacts only for draft metadata rehearsals.
74
+
75
+ ## Read-only verification commands
76
+
77
+ From the clean source checkout corresponding to the retained candidates, with
78
+ Node 22/24/26, Git, POSIX `tar`, and GitHub CLI authenticated for read access:
79
+
80
+ ```sh
81
+ npm run check:version
82
+ npm run check:release -- /path/to/candidates
83
+ ```
84
+
85
+ The second command reads GitHub's release API and resolves the remote tag. It
86
+ checks the source and lockfile versions, clean HEAD, report revision/dirty flag,
87
+ local and remote tag targets, release target SHA and prerelease flag, both archive
88
+ manifests and hashes, and matching uploaded asset names/digests. It fails closed
89
+ on missing data or API errors. A passing JSON result includes the version,
90
+ revision, tag, draft status, `evidence: "GitHub API readback"`, and explicit
91
+ `npmPublication`/`provenance` values of `"not checked"`. No files or remote state
92
+ are changed. Published releases also require immutability and non-private archives.
93
+
94
+ For offline checking of a previously saved raw GitHub REST release response:
95
+
96
+ ```sh
97
+ npm run check:release -- /path/to/candidates /path/to/release.json
98
+ ```
99
+
100
+ This deliberately reports `evidence: "offline metadata rehearsal"`. It does not
101
+ contact GitHub or verify a remote tag. Handwritten or stale JSON is not live
102
+ release evidence. The report is also not a reproducible-build proof: validating
103
+ its claimed revision cannot prove arbitrary supplied artifacts were built from
104
+ that revision. Authenticated build provenance and registry readback remain
105
+ required. This checker remains read-only. The separate [release workflow](npm-release.md)
106
+ performs explicitly selected publication; registry permissions remain external.
107
+
108
+ ## Authentication, provenance and incomplete releases
109
+
110
+ Before any first publication, establish the npm account, package ownership and
111
+ `n8r` organization/team rights for both names. The official
112
+ [scoped publication guide](https://docs.npmjs.com/creating-and-publishing-scoped-public-packages/)
113
+ documents public access and direct-publication authentication requirements.
114
+ Its staged first-publication path creates a public placeholder; staging is not
115
+ a read-only readiness check. The maintainer approved this staged route for the
116
+ first release after npm offered stage-only tokens; submit the actual retained
117
+ artifacts, not an empty reservation package. The [procedure](npm-release.md)
118
+ requires maintainer 2FA approval of both real versions.
119
+
120
+ Prefer [trusted publishing](https://docs.npmjs.com/trusted-publishers/) from the
121
+ public repository using GitHub-hosted runners. Configure each package separately
122
+ for the exact workflow and environment. npm documents Node 22.14+ and npm 11.5.1+
123
+ for trusted publishing; its dist-tag permission is separate and requires newer
124
+ npm (11.21.0+ in the 11 series or 12.2.0+ in the 12 series). A newly configured
125
+ publisher must complete a successful publish within two days or be recreated.
126
+ These are prerequisites to verify during release preparation, not settings this
127
+ increment changes. References checked 5 November 2026.
128
+
129
+ For each exact installed registry version, run `npm audit signatures` and inspect
130
+ its [provenance](https://docs.npmjs.com/generating-provenance-statements/). Require
131
+ evidence for the package itself, not merely an attested dependency. Compare the
132
+ attestation's source commit/repository and artifact digest with the approved
133
+ release. Also compare registry tarball bytes with the retained SHA-256 and record
134
+ registry `dist.integrity`. A repository URL or locally generated hash is not
135
+ registry provenance. Repeat the [isolated consumer checks](npm-distribution.md#human-verification)
136
+ and documented npm-exec routes for both names.
137
+
138
+ If one package publishes and the other fails, the release is **incomplete**.
139
+ Retain the exact build and draft GitHub Release. Inspect the existing published
140
+ bytes and evidence, then retry only the missing package using the retained
141
+ artifact after resolving the failure. Never rebuild or overwrite the published
142
+ version. A mismatch requires a new approved version for both names. Promote both
143
+ npm dist-tags and finalize the immutable GitHub Release only after both routes
144
+ pass. If tag promotion partially fails, record that too and repair only the
145
+ missing pointer update; it does not require republishing package bytes.
146
+
147
+ ## Human check for this increment
148
+
149
+ Maintainer preparation: provide this branch, installed dependencies and the
150
+ candidate setup from [the distribution guide](npm-distribution.md#build-and-inspect-candidates).
151
+ No npm credentials, real Git tag, GitHub Release or global-install change is needed.
152
+ Keep the current terminal with `candidate_run` set by that guide.
153
+
154
+ - [ ] From the checkout root run `npm run check:version`. Expect
155
+ `Version consistent: 0.1.0-experimental.2`, exit 0. Inspect `package.json` and
156
+ both root version fields in `package-lock.json`; they must match.
157
+ - [ ] Follow the [candidate install steps](npm-distribution.md#human-verification)
158
+ for both names. In each consumer directory run:
159
+
160
+ ```sh
161
+ node -p 'require("./node_modules/@n8r/surface/package.json").version'
162
+ ./node_modules/.bin/n8r-surface --version
163
+ ```
164
+
165
+ For the alternative use `./node_modules/n8r-surface/package.json`. Expect
166
+ `0.1.0-experimental.2` and `n8r-surface 0.1.0-experimental.2`, both exit 0.
167
+ - [ ] Inspect `candidates.json`: both entries have distinct `releaseAsset` names,
168
+ the same report version/revision, and hashes matching the retained tarballs.
169
+ A clean-commit rehearsal must say `dirty: false`.
170
+ - [ ] Read the compatibility table and release/recovery procedure above. Expect
171
+ one permanent Git tag and exact commit for both package names; `experimental`
172
+ and `next` do not silently promote `latest`.
173
+ - [ ] Report **Pass / Fail / Blocked**, Node/npm versions, report revision and
174
+ both CLI outputs. Version drift or missing artifacts is Fail. Missing real
175
+ release/authentication is Blocked for live release verification, not a reason
176
+ to create a tag or publish. Clean up only the temporary consumer directory
177
+ created by the distribution procedure after retaining needed evidence.
178
+
179
+ Automated technical evidence: `tests/version.test.mjs` changes a copied installed
180
+ manifest to `0.7.3-rc.2` and asserts CLI readback; `tests/release.test.mjs` uses
181
+ throwaway Git repositories, tags, archives and metadata to exercise success and
182
+ rejection paths. These tests are synthetic, not a real GitHub Release or registry
183
+ publication. Agent rehearsal and human acceptance remain separate.
@@ -0,0 +1,92 @@
1
+ # Synthetic Researcher acceptance cases
2
+
3
+ These fictional products and documents exercise the
4
+ [experimental 0.1 contracts](../../docs/n8r-surface/contracts.md). They are not
5
+ LibreChat findings, AI-generated discovery results or a working integration.
6
+ No inference, credentials, network access or running target is needed to check them.
7
+
8
+ Lumen Desk is a fictional AI support-summary application. Harbor Archive is an
9
+ independent fictional document/event archive. A synthetic human selects a proposed
10
+ composition after researching both. The sources establish possible interfaces;
11
+ payload compatibility and effective configuration remain unverified.
12
+
13
+ | File | Case |
14
+ | --- | --- |
15
+ | [Lumen guide](sources/lumen-guide.md), [settings](sources/lumen-settings.md) | Conflicting batch limits of 10 and 25; inference model unknown. |
16
+ | [Lumen r1](lumen-r1.research.html) | Initial research; archive/identity selected, callback deferred. |
17
+ | [Pending manual edit](lumen-manual-edit.pending.html) | Deliberately invalid visible edit; embedded data remains r1. |
18
+ | [Lumen r2](lumen-r2.research.html) | Human-reviewed callback selection, preserving findings and opaque extension data. |
19
+ | [Harbor interface notes](sources/harbor-api.md) | Independent product with unknown authentication. |
20
+ | [Harbor r1](harbor-r1.research.html) | Useful incomplete research from one source. |
21
+ | [Harbor authentication note](sources/harbor-auth.md) | Second supplied source establishes an OIDC option. |
22
+ | [Harbor r2](harbor-r2.research.html) | Continuation keeps the authentication finding's identity and records a human selection. |
23
+ | [Selected JSON](composed.surface.json), [selected YAML](composed.surface.yaml) | Same partial graph, referencing the exact r2 records. |
24
+
25
+ Open a research HTML file in a browser to read its findings and inspect its embedded
26
+ data. The data owns all facts; rendering is a derived view. These checked fixtures
27
+ are inert, but arbitrary imported HTML must be validated before trusted rendering.
28
+
29
+ ## Selected composition
30
+
31
+ ```mermaid
32
+ flowchart LR
33
+ Lumen[Lumen Desk] -->|documents| Harbor[Harbor Archive]
34
+ Lumen -->|audit events| Harbor
35
+ Harbor -->|callback| Lumen
36
+ Lumen -->|uses identity| Identity[Shared identity service]
37
+ Harbor -->|uses identity| Identity
38
+ Lumen -->|uses inference| Inference[Inference service]
39
+ ```
40
+
41
+ The graph has shared identity, a cycle, identified parallel edges and node/edge
42
+ attributes. All edges are declared only. The identity service's product and
43
+ inference version remain unknown. Configuration/secret requirements are explicit
44
+ local references without credential values. Attributes exercise known, unknown,
45
+ omitted, redacted, absent and out-of-scope states. The conflicting batch limit is
46
+ unknown in the selected definition and points back to both research claims.
47
+
48
+ The example vocabulary `urn:n8r:vocabulary:researcher-example` version `0.1` has
49
+ node terms `application`, `service`, `inference-service` and relationship terms
50
+ `sends-documents`, `sends-audit`, `notifies`, `uses-identity`, `uses-inference`.
51
+ These mean precisely the labeled roles/connections above, with no hidden protocol
52
+ or lifecycle behavior. They are not a general ontology or a consumer capability.
53
+
54
+ ## Manual-edit case
55
+
56
+ The pending file changes only the visible callback-decision reason. Its original
57
+ embedded decision remains deferred. `readResearchHtml` must reject it as an
58
+ HTML/data conflict. It must not silently choose the old embedded data or assume
59
+ that visible prose establishes a structured decision.
60
+
61
+ The synthetic review resolves the intended change: include callbacks in the desired
62
+ composition, while retaining compatibility gaps. Lumen r2 records that selection,
63
+ its author/time/reason and a human note, then regenerates the visible projection.
64
+ Its parent digest pins r1; both earlier and pending files remain available.
65
+ This demonstrates a reviewed result, not an implemented automatic reconciliation
66
+ or persistence command.
67
+
68
+ ## Run the checks
69
+
70
+ From the repository root, with a supported Node.js and npm:
71
+
72
+ ```sh
73
+ npm ci
74
+ npm test
75
+ ```
76
+
77
+ Dependency installation uses the npm registry. The tests themselves are offline.
78
+ They check source-byte hashes, internal references, exact external revisions,
79
+ HTML/data agreement, rejection of the pending edit, successor lineage, unknown
80
+ values and JSON/YAML equality. Semantic assertions verify the competing limits,
81
+ new authentication evidence and selected graph structure. These checks do not
82
+ verify an AI Researcher, facts about a real product or Lab compatibility.
83
+
84
+ The future #17 runner and external skill must use these same cases, including a
85
+ second source and human correction, and compare facts/choices/gaps rather than
86
+ exact generated wording. Later Lab import/continuation must retain incomplete
87
+ records, IDs, versions, provenance and extensions, and report unsupported meanings.
88
+
89
+ Machine-readable fixtures and their rendered research HTML use
90
+ [Apache-2.0](../../LICENSE). The synthetic source documents and this guide use
91
+ [CC-BY-4.0](../../LICENSE-DOCS); credit AI Surface Model contributors. All material
92
+ was created for these fixtures; no third-party product documentation is included.