@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,107 @@
1
+ # Create a Surface from saved research
2
+
3
+ This candidate adds a linked research HTML record and partial Surface JSON to
4
+ the existing Markdown research workflow. Reopen either saved file to revise the pair. The package remains private and unpublished.
5
+ Use Node 22, 24 or 26, Codex CLI **0.166.0**, and an existing ChatGPT sign-in with
6
+ access to `gpt-6-astra`. No API-key billing or model fallback is used.
7
+
8
+ For isolated checks of both official npm package candidates, use the
9
+ [distribution walkthrough](npm-distribution.md). The global install below uses
10
+ the checkout tarball and replaces the command in your npm global prefix.
11
+
12
+ ## 1. Install
13
+
14
+ - Open a terminal in this checkout at the reviewed candidate revision and paste:
15
+
16
+ ```sh
17
+ npm ci && npm pack && npm install --global ./n8r-surface-0.1.0-experimental.2.tgz
18
+ ```
19
+
20
+ Expect successful installation and the terminal prompt. Stay in the checkout.
21
+ If installation fails, stop and report the error.
22
+
23
+ ## 2. Create and save a Surface
24
+
25
+ Use your existing saved note and its original source. Replace `NOTE` and `SOURCE`
26
+ with their paths (keep quotes). If you have no note, use the optional steps below.
27
+
28
+ - Paste:
29
+
30
+ ```sh
31
+ n8r-surface reopen "NOTE" --source "SOURCE" --model gpt-6-astra
32
+ ```
33
+
34
+ Type **y** at the transmission prompt. Expect evidence comparisons, a fresh
35
+ conversation and your retained choices. At `You>`, paste:
36
+
37
+ ```text
38
+ Create a Surface from these notes; show me what is selected and still unknown. Preserve the component IDs, source evidence and my decisions. Prepare the linked research and Surface preview.
39
+ ```
40
+
41
+ Expect a **Validated partial Surface preview** listing components, declared
42
+ connections, human decisions, requirements, coverage, gaps and evidence.
43
+ - Enter `/save surface`. Expect **Saved and read back** for `research.html` and
44
+ `surface.json`. Open both: they should match the preview. Copy the JSON path,
45
+ then enter `/exit`; expect exit 0 and the terminal prompt.
46
+
47
+ ## 3. Reopen and revise
48
+
49
+ - Paste, replacing `SURFACE_JSON` with the saved JSON path and `SOURCE` with the
50
+ same source path:
51
+
52
+ ```sh
53
+ n8r-surface reopen "SURFACE_JSON" --source "SOURCE" --model gpt-6-astra
54
+ ```
55
+
56
+ Type **y**. Expect the same component identities and decisions. Ask to change
57
+ one decision, with your reason, and prepare an updated Surface. For the optional
58
+ Lumen case below, paste:
59
+
60
+ ```text
61
+ Select external OIDC in the desired composition because this investigation now requires centralized sign-in. This is my selection, not proof of a configured provider. Keep the provider and model unknown, preserve existing IDs and evidence, and prepare the updated Surface preview.
62
+ ```
63
+
64
+ - Inspect the preview, enter `/save surface`, then `/exit`. Expect a new numbered
65
+ pair, exit 0 and the original pair unchanged. Open both revisions and compare
66
+ component IDs, evidence, the decision and parent references. The new
67
+ `research.html` path can also be used with the same reopen command.
68
+
69
+ Report **Pass**, **Fail** or **Blocked**, with the changed decision and unexpected
70
+ message or excerpt. Wording and filenames vary. Lost evidence/IDs/decisions,
71
+ overwrites or a claimed save without files are failures. Keep test pairs or delete
72
+ only their numbered directories afterward; keep your vault, source and earlier work.
73
+
74
+ `/save` still writes Markdown. `/save surface` needs a current validated preview;
75
+ a later question invalidates the old preview, so request an updated one after a
76
+ correction. Edited HTML or mismatched pair bytes are rejected and preserved; make
77
+ changes conversationally in a new revision. Ctrl-C cancels with exit 130. The
78
+ [maintainer evidence](surface-revisions-verification.md) distinguishes agent
79
+ rehearsal from human acceptance and lists remaining limits.
80
+
81
+ ## Optional: create a research note first
82
+
83
+ - Paste:
84
+
85
+ ```sh
86
+ n8r-surface
87
+ n8r-surface discover examples/researcher/sources/lumen-guide.md --model gpt-6-astra
88
+ ```
89
+
90
+ The first command reuses your vault (or asks you to choose/create it once).
91
+ The second names the fictional source and requests permission to send inspected
92
+ text to OpenAI. Type **y**; expect the connected model and `You>` prompt.
93
+ - At `You>`, paste this as one line:
94
+
95
+ ```text
96
+ Describe the AI components and connections with stable component IDs and source citations. For this investigation I choose not to use external OIDC: retain that as my decision, not a change to the source. Keep unknowns and useful next steps clear.
97
+ ```
98
+
99
+ Expect a source read and cited findings. The [source](../../examples/researcher/sources/lumen-guide.md)
100
+ describes configured inference; OIDC is an option, not proof of selected or
101
+ exercised authentication. Your decision must stay separate from source claims.
102
+ - Enter `/save`. Expect a numbered destination followed by **Saved and read back**,
103
+ its full path and SHA-256 digest. While waiting, a spinner shows
104
+ **Preparing note** and elapsed seconds; answers use **Waiting for Codex**.
105
+ It should stop when the operation finishes or you cancel. Open that file: it should retain component IDs,
106
+ your OIDC choice, evidence and next steps. Copy its path, then enter `/exit`.
107
+ Expect exit 0 and the terminal prompt.
@@ -0,0 +1,176 @@
1
+ # Researcher host contract 0.1
2
+
3
+ This is the integration boundary for the future shared Researcher instructions,
4
+ not an implemented runner or Lab adapter. It builds on the
5
+ [artefact contracts](contracts.md) and [shared cases](../../examples/researcher/README.md).
6
+ The existing chat harness was the first skill host. The standalone CLI now has a
7
+ bounded conversation adapter with [Markdown save/reopen support](save-reopen-verification.md).
8
+ The current candidate additionally stages and saves one linked structured research/Surface
9
+ pair; [its evidence](surface-revisions-verification.md) bounds that workflow. Lab adaptation remains later work. A Lab is optional, and AI runner selection is
10
+ independent of the destination for results.
11
+
12
+ ## Version negotiation
13
+
14
+ A host must identify its adapter version, the exact Researcher instruction
15
+ revision, supported artefact contract versions and understood vocabulary/extension
16
+ versions. The bundled #17 skill is version `0.1.8`, with
17
+ [bounded package and behavioral evidence](researcher-skill-verification.md).
18
+ It produces working notes, not validated contract artefacts. Broader host support
19
+ requires the applicable trial; applications consume that revision
20
+ rather than maintaining a separate copy of discovery knowledge.
21
+
22
+ Reject unsupported core versions before modification. Report unrecognized
23
+ vocabulary/extension meanings while retaining their data. Successful parsing does
24
+ not imply that the host understands or can operate the selected composition.
25
+ Use a separate migration with explicit losses when a host cannot preserve data.
26
+ The original artefact remains recoverable.
27
+
28
+ The proposed `urn:n8r:researcher:provenance` extension may record the instruction
29
+ revision and adapter version used for a new revision. It must contain no credentials,
30
+ local paths or copied chat history. Until #17 implements it, this is a reserved
31
+ extension convention rather than a required field or proof of AI execution.
32
+
33
+ ## Capabilities supplied by a host
34
+
35
+ The following operations specify behavior and inputs/outputs, not API/MCP method
36
+ names. A host can implement them as local functions, attachment tools or application
37
+ services. Missing capabilities must be explicit; the core must not fabricate
38
+ access or a successful save.
39
+
40
+ The Researcher's primary result is an AI Surface graph, not an application-wide
41
+ configuration inventory. Source access includes user-selected code, documents,
42
+ websites, prior research/definitions and permitted live observations. The
43
+ [shared discovery guide](../../plugins/n8r-surface/skills/research/references/discovery-map.md)
44
+ defines discover, continue and reconcile behavior across these combinations.
45
+ Product libraries provide reusable navigation/evidence where available; no Lab
46
+ or registry connection is required or implied.
47
+
48
+ | Capability | Input | Result and required behavior |
49
+ | --- | --- | --- |
50
+ | Describe capabilities | No source inspection | Versions, available operations, bounded sizes, inference destination and save/download mode. |
51
+ | Establish source scope | Explicit supplied directory/file/attachment selection | Opaque scope ID and allowed material; no ancestor traversal or implicit corpus scan. |
52
+ | List/read source | Scope ID, relative reference, requested range | Text, exact source/version/digest, inspected range and excluded/unreadable/truncated coverage. No source execution. |
53
+ | Find related knowledge | Explicitly available library and product/source scope | Applicable guides, research and definitions with identity/revision/coverage; no implicit scan or union of different deployment selections. |
54
+ | Read web/live evidence | Selected URL/system/environment and graph question | Available connector/API/browser/computer observations with location, time and nonsecret results. Host-supported human sign-in, read-only inspection, no credential copying or bypass of denied access. |
55
+ | Invoke inference | Selected runner/model, instructions, bounded conversation/tool outputs | Response/tool proposals or explicit unavailable/error; no silent account/provider fallback. |
56
+ | Ask human | Consequential question with current evidence/options | Answer, deferred answer or unavailable interaction; unresolved work stays in the record. |
57
+ | Read artefact | Explicit artefact/revision selection | Original bytes, parsed contract status and exact byte-conflict token; do not render unvalidated imported HTML. |
58
+ | Create artefact | Valid new artefact and explicit destination | Created identity/revision and actual location/download, or conflict/error; never overwrite an existing identity silently. |
59
+ | Revise artefact | Proposed successor and expected byte token | Recheck current bytes, validate parent, retain previous bytes and commit atomically; reject conflicts. |
60
+ | Continue | Accepted record plus newly established source access | Preserve IDs, findings, decisions, questions and extensions; record new evidence in a successor. |
61
+ | Export selection | Reviewed selected definition and encoding | JSON/YAML preserving supported meaning, or explicit rejection; no implicit deployment or publication. |
62
+
63
+ Reading is not permission to upload. Before inference, the host identifies the
64
+ provider and source transmission scope and obtains the user's authorization for
65
+ that discovery session. The implemented bare-startup overview does not inspect or transmit sources;
66
+ future source selection must have a specified scope. No status subcommand is planned.
67
+ The runner sees only authorized source extracts and context selected by the host;
68
+ source instructions are data, and tool arguments remain subject to deterministic
69
+ path, version, size and operation checks.
70
+
71
+ Live inspection uses existing host capabilities; this contract adds no browser,
72
+ admin client or runner. Inspect enablement and connection targets needed by the
73
+ graph, not all settings. The user completes private authentication directly.
74
+ Stored configuration, observed effective configuration, reachability and exercised
75
+ behavior remain separate. Record access/identity limits and sanitized evidence;
76
+ do not manufacture a source digest when the host provides no stable source bytes.
77
+ An authorized settings read does not authorize a configuration change or a
78
+ connection test. Document each real host path before claiming it was verified.
79
+
80
+ ## Continuation and persistence
81
+
82
+ The current standalone increment uses numbered Markdown working notes and an
83
+ experimental host metadata footer. It requires `/save`, preserves predecessor
84
+ bytes, and reacquires explicit source/transmission permission on `reopen`.
85
+ This is a bounded implementation of working-note continuity, not the structured
86
+ HTML/Surface contract below. See [SAVE-01](command-outcomes.md#save-01-save-reopen-and-continue).
87
+
88
+ A portable continuation needs the current accepted HTML record, exact referenced
89
+ source identities/revisions, and the intended output or selected definition.
90
+ The record carries inspected coverage, findings, alternatives, human decisions,
91
+ notes and open questions. A new host must reacquire actual source access; a saved
92
+ source locator or prior conversation does not grant it.
93
+
94
+ A host unable to read a referenced source must retain its evidence and mark the
95
+ new inspection as unavailable. It cannot claim to have rechecked that evidence.
96
+ A host unable to persist returns downloadable artefacts and says so. It must not
97
+ claim that they were saved to a corpus or Lab.
98
+
99
+ Use byte hashes for optimistic concurrency, including edits that leave logical
100
+ data unchanged. Parent logical digests bind the accepted revision's meaning.
101
+ Keep both the edited bytes and accepted predecessor during reconciliation. A
102
+ successful write reports the actual revision/location; a failed or interrupted
103
+ write must leave recoverable work. The local persistence implementation is #16.
104
+
105
+ A host can have a mutable draft and deliberate named baselines in addition to
106
+ artefact snapshots. It must map these explicitly: an artefact snapshot is not
107
+ necessarily a product release or named Surface version. Import identity collisions
108
+ require exact-match reuse or an explicit fork/migration; do not merge by label.
109
+
110
+ ## Candidate structured pair host
111
+
112
+ The restricted `surface_draft` tool stages content in memory. The host fills
113
+ revision envelopes and exact research references, validates both artefacts and
114
+ shows a deterministic preview. `/save surface` publishes exactly that preview as
115
+ `research.html`, `surface.json` and `manifest.json` in a new numbered directory
116
+ under `surfaces/<source-slug>/`. The manifest is host storage/provenance metadata,
117
+ not a model contract. Its hashes detect byte edits; they do not authenticate authors.
118
+
119
+ Either saved member reopens the pair after validation and renewed transmission
120
+ consent. The complete context is bounded to 512 KiB independently of individual
121
+ file limits. Original notes and accepted pair revisions remain unchanged. Source
122
+ availability comparisons retain historical evidence. Manual HTML/data edits fail
123
+ closed; this increment does not implement automatic reconciliation or arbitrary
124
+ multi-record imports. Directory topology must remain stable during synchronous
125
+ operations. See [SURFACE-01](command-outcomes.md#surface-01-generate-save-and-revise-a-partial-surface).
126
+
127
+ ## Lab requirements review
128
+
129
+ The #15 review compared this boundary with the separate application's relevant
130
+ saved-definition, discovery, revision and import/continuation requirements.
131
+ This public report records alignment and integration obligations only; private
132
+ application prompts, code, operational data and internal source locations are
133
+ not reproduced. No application implementation or compatibility trial was run.
134
+
135
+ | Requirement | Contract decision | Later consumer work or gap |
136
+ | --- | --- | --- |
137
+ | Offline saved work independent of equipment | Research and selected definitions need no Lab or running target. | Adapt application storage and selection without applying setup. |
138
+ | Explicit context/ownership | Artefact IDs carry no authority to create/configure Lab resources. | Map application ownership explicitly; do not infer it from graph containment or rewrite this model's Lab/Experiment semantics. |
139
+ | Sources and attachments | Opaque scopes plus versioned evidence; portable locators grant no access. | Supply attachment/source adapters and permission checks. |
140
+ | Human-guided research | Decisions/questions are durable; unsupported interaction remains visible. | Implement session questions and compare behavior on shared cases. |
141
+ | Stable identity and immutable evidence | Exact revisions/digests, stable finding/node/edge IDs, separate runtime evidence. | Map local snapshot and deliberate version labels; retain prior Run references. |
142
+ | Partial import and continuation | Unknowns/conflicts/opaque extensions are preserved; no operational readiness claim. | Build an importer that previews limitations and rejects unsupported loss. |
143
+ | Reuse of one Researcher core | Version negotiation includes instruction and artefact versions. | Consume #17's identified instruction revision and run both discovery and import cases. |
144
+
145
+ The application may use different persistence and ownership conventions. This
146
+ profile describes component graphs. The current model has Lab → Experiment →
147
+ Setup ownership: the Experiment requests setup directly from its Lab, which owns
148
+ resource configuration and local bindings. Historical ownership records remain
149
+ historical. Consumer lifecycle/authority mapping remains an explicit integration
150
+ obligation, not something passing JSON/YAML tests resolves. See the proposed
151
+ [recreation handoff](recreation-handoff.md).
152
+
153
+ ## Acceptance for later adapters
154
+
155
+ Use the [command outcome specification](command-outcomes.md) to define initial
156
+ state, actual human interaction, state changes and independent readback. The
157
+ cases below must be exercised through the relevant host, not fulfilled by the
158
+ developing agent outside it. The installed CLI's complete path is E2E-01;
159
+ LibreChat requires its own E2E-02 rehearsal before a product-support claim.
160
+
161
+ 1. Research Lumen and Harbor separately from the supplied sources, keeping the
162
+ 10/25 conflict and unknown authentication/model facts.
163
+ 2. Ask the human about selection; do not turn every supported option into an edge.
164
+ 3. Import the incomplete Harbor r1 record without inventing authentication or
165
+ requiring a deployed system. Establish access to the second source and continue
166
+ the same finding into a new revision.
167
+ 4. Detect the edited Lumen HTML, preserve it, resolve the human correction and
168
+ produce a successor without changing the old record or losing extensions.
169
+ 5. Produce the selected graph, retaining shared components, cycles, parallel edges,
170
+ requirement references, decisions and exact research revision links.
171
+ 6. Import/continue the result in a named Lab version and document supported meanings,
172
+ unsupported data and any losses. Compare facts and decisions, not prose wording.
173
+
174
+ Steps 1–5 require real runner/harness trials in #17 beyond #15's deterministic
175
+ fixtures. Step 6 is later application work. Until those trials run, alignment is
176
+ a design review and byte/value checks are only contract verification.
@@ -0,0 +1,96 @@
1
+ # Initial implementation decisions
2
+
3
+ These choices complete the remaining implementation decisions for
4
+ [issue #15](https://github.com/injectionator/n8r-surface/issues/15). They are
5
+ maintainer-reviewable implementation choices within the approved design, not
6
+ claims that the CLI or runner has shipped.
7
+
8
+ ## Runtime and distribution
9
+
10
+ Use TypeScript compiled to ESM JavaScript, npm with a committed lockfile, and the
11
+ built-in Node test runner. The initial supported majors are **Node.js 22, 24 and
12
+ 26**. Test the current patch of each supported major before a release. Odd-numbered
13
+ majors and Bun-only execution are not part of the initial support promise. Revisit
14
+ 22 before its scheduled end of support. The official
15
+ [Node release schedule](https://github.com/nodejs/Release/blob/main/schedule.json)
16
+ lists 22/24/26 support windows through April 2027/2028/2029 respectively (checked
17
+ 4 November 2026).
18
+
19
+ Use **`@n8r/surface`** as the preferred npm package/library import and
20
+ **`n8r-surface`** as the supported alternative, both exposing `n8r-surface`.
21
+ This supersedes the unscoped-first/fallback decision under
22
+ [issue #27](https://github.com/injectionator/n8r-surface/issues/27).
23
+ Generate both from one build with matching payloads and version. The
24
+ [distribution candidate procedure](npm-distribution.md) preserves `private: true`
25
+ by default. The maintainer confirmed `0.1.0-experimental.2` and authorized
26
+ publication; explicit `--publishable` preparation creates fresh public archives.
27
+ The [first-release workflow](npm-release.md) retains both archives before
28
+ publication, uses stage-only token bootstrap with provenance and maintainer 2FA approval, and requires
29
+ independent registry verification. Merge and account prerequisites remain. Registry
30
+ lookups do not reserve names or establish publishing rights. The approved
31
+ [package version policy](versioning.md) makes the root manifest authoritative,
32
+ derives CLI output from the installed manifest and verifies retained artifact
33
+ identity against the exact Git tag, commit and GitHub Release metadata.
34
+
35
+ Issue #15 ships a library, built declarations, contracts and synthetic assets.
36
+ The first #16 increment adds a `bin` entry for bare startup only; see its
37
+ [settings, parser and inspection decisions](startup.md). It must be exercised
38
+ through the installed tarball outside the source checkout. #17 adds the versioned
39
+ Researcher instructions. Runtime consumers do not need TypeScript or Bun.
40
+
41
+ Use `yaml` 2.9.1 as the single runtime dependency; its parsed nodes allow rejection
42
+ of tags, aliases, duplicate keys and unsupported numeric forms before conversion.
43
+ See its [version 2 documentation](https://eemeli.org/yaml/) and the locked version
44
+ in [package-lock.json](../../package-lock.json). TypeScript 6.0.3 and Node typings
45
+ 22.20.5 are development dependencies. The bounded field/reference checker and
46
+ HTML renderer need no framework, browser runtime or general ontology dependency.
47
+
48
+ ## First CLI AI runner
49
+
50
+ The user revised the order on 4 November 2026: use the Researcher as a
51
+ [shareable skill](researcher-skill.md) in Codex/ChatGPT first, adapt it in n8r-labs
52
+ second, then complete the standalone command. The current host supplies inference,
53
+ file access, search and conversation. The skill does not configure a provider,
54
+ extract credentials, or connect a second AI account.
55
+
56
+ For the later CLI, select installed Codex with ChatGPT sign-in. This supersedes
57
+ the earlier direct OpenAI Responses API adapter decision from #15. The
58
+ [official authentication guide](https://learn.chatgpt.com/docs/auth) distinguishes
59
+ ChatGPT subscription access from separately billed API-key access. The
60
+ [SDK guide](https://learn.chatgpt.com/docs/codex-sdk) documents local-agent control
61
+ and directs interactive clients to app-server. Reviewed 4 November 2026.
62
+
63
+ Before implementing the CLI integration, verify a supported interface against its
64
+ actual installed version, preserve user permissions and source scope, and record
65
+ real tool events, human continuation and saved-output readback. Do not borrow
66
+ application tokens, silently switch accounts/providers or fall back to API billing.
67
+ Source transmission and a result destination remain separate decisions. A Lab is
68
+ optional. No standalone runner or Lab compatibility is established by installing
69
+ the skill. No API key was read or model API invoked by #15's contract tests.
70
+
71
+ ## HTML ownership and numeric scope
72
+
73
+ The embedded data owns the record and the whole readable HTML is its deterministic
74
+ projection. The reader rejects divergence, including benign reformatting, so human
75
+ edits cannot disappear in a later save. Reviewed corrections become successors;
76
+ a rich editor and automatic merging are deferred.
77
+
78
+ Use only safe integer numbers in the initial portable data subset. Decimal and
79
+ large quantities require explicit strings/units. This costs convenience but makes
80
+ lossy numeric conversion an explicit error instead of an undetected change to
81
+ evidence or identity. Expanding either HTML editing or numeric support requires
82
+ versioned tests and a documented migration.
83
+
84
+ ## Verification boundary
85
+
86
+ `npm test` checks this profile, its source/reference fixtures and HTML/data
87
+ consistency. `npm run check:package` packs and installs into a temporary directory,
88
+ then imports built exports and bundled fixtures with no checkout-relative imports.
89
+ Prepare npm's local dependency cache with `npm ci` and `npm cache add yaml@2.9.1`:
90
+ the latter also fetches registry metadata needed on a fresh machine. The installer
91
+ then runs with `--offline --ignore-scripts`. Temporary files are removed after the
92
+ check. See [contributor commands](../../CONTRIBUTING.md#researcher-contract-library).
93
+
94
+ These checks do not prove an AI can research LibreChat, a consumer understands an
95
+ extension, a Lab can import the format, or a selected composition runs. Keep those
96
+ later tests separate and name the actual runner/consumer versions when they run.
@@ -0,0 +1,137 @@
1
+ # Dual npm distribution candidates
2
+
3
+ Issue [#27](https://github.com/injectionator/n8r-surface/issues/27) selects
4
+ `@n8r/surface` as the preferred package and library import, with `n8r-surface` as
5
+ an official alternative. Both expose the `n8r-surface` executable. Install one
6
+ route per environment because they provide the same command name.
7
+
8
+ This increment prepares **private local candidates**, not a published release.
9
+ The root manifest and default generated manifests retain `private: true`. The
10
+ maintainer selected `0.1.0-experimental.2` and authorized publication. Explicit
11
+ `--publishable` preparation removes the generated guards only; see the
12
+ [first-release procedure](npm-release.md). Registry installation remains unproved.
13
+
14
+ ## Build and inspect candidates
15
+
16
+ From the checkout root, with Node 22, 24 or 26, npm, Git, POSIX `tar` and Python 3.9+:
17
+
18
+ ```sh
19
+ npm ci
20
+ npm cache add yaml@2.9.1
21
+ npm test
22
+ npm run check:package
23
+ candidate_run=$(mktemp -d)
24
+ npm run pack:candidates -- "$candidate_run/packages"
25
+ cat "$candidate_run/packages/candidates.json"
26
+ ```
27
+
28
+ Dependency preparation uses the network. Candidate packing and consumer checks
29
+ use local files/cache with lifecycle scripts disabled. `pack:candidates` builds
30
+ once into a fresh temporary directory (excluding stale checkout `dist/` files),
31
+ captures npm's source payload once, and generates both packages from that
32
+ payload. Development scripts/dependencies are removed from both manifests;
33
+ only `name` differs between them. Versions, engines, licenses, dependencies,
34
+ exports, executable and asset bytes match. Existing destinations are refused.
35
+ A failed run may leave an incomplete destination; use a new directory on retry.
36
+
37
+ Both tarballs are named `n8r-surface-0.1.0-experimental.2.tgz`, so they live in
38
+ separate `scoped/` and `unscoped/` directories. `candidates.json` records their
39
+ relative paths, SHA-256 digests, version, source HEAD and dirty status. This is
40
+ local build evidence, not registry provenance. Each entry also names a unique
41
+ `releaseAsset` for later GitHub upload; see the [version and release policy](versioning.md). Release evidence must use a clean
42
+ reviewed checkout; a dirty report does not identify all inputs by commit alone.
43
+
44
+ `check:package` installs each candidate in a separate temporary consumer outside
45
+ the checkout, imports its own package name, checks installed identity and assets,
46
+ and runs the startup/discovery terminal rehearsals. Temporary homes isolate
47
+ settings and vaults. Discovery uses a scripted offline fixture, not real inference.
48
+ Existing [real Codex evidence](surface-revisions-verification.md) remains separate.
49
+
50
+ ## Human verification
51
+
52
+ Maintainer preparation: supply this checkout and the candidate build above.
53
+ Keep the same terminal so `candidate_run` remains set. No global installation,
54
+ Codex sign-in or existing vault is needed for this distribution check.
55
+
56
+ - [ ] Install the preferred candidate into an isolated consumer and inspect it:
57
+
58
+ ```sh
59
+ mkdir "$candidate_run/consumer"
60
+ cd "$candidate_run/consumer"
61
+ npm install --offline --ignore-scripts --no-audit --no-fund --package-lock=false "$candidate_run/packages/scoped/n8r-surface-0.1.0-experimental.2.tgz"
62
+ node --input-type=module -e 'import {decode} from "@n8r/surface"; console.log(typeof decode)'
63
+ ./node_modules/.bin/n8r-surface --version
64
+ ```
65
+
66
+ Expect successful installation, `function`, then
67
+ `n8r-surface 0.1.0-experimental.2`; each exits 0.
68
+ - [ ] Run bare startup with a fresh isolated home and closed input:
69
+
70
+ ```sh
71
+ mkdir "$candidate_run/home"
72
+ HOME="$candidate_run/home" USERPROFILE="$candidate_run/home" ./node_modules/.bin/n8r-surface </dev/null
73
+ echo "$?"
74
+ ls -A "$candidate_run/home"
75
+ ```
76
+
77
+ Expect the overview, `Vault setup required; run n8r-surface in an interactive
78
+ terminal.`, exit **1**, and no home entries. This is the expected unconfigured
79
+ path. No normal settings or vault should change.
80
+ - [ ] Repeat the first two tasks in a new `consumer-alternative` directory,
81
+ using the `unscoped/` tarball, import `"n8r-surface"` and a new `home-alternative`.
82
+ Expect identical command behavior and exit codes.
83
+ - [ ] Report **Pass / Fail / Blocked**, Node/npm versions, both installed names,
84
+ and unexpected output. Missing imports/assets, a different version or writes
85
+ during closed-input startup are failures. Return the candidate report too.
86
+ After inspection, leave the consumer directory and remove only the temporary
87
+ directory created by `mktemp`; keep any evidence you need first.
88
+
89
+ ## Registry routes after a separately approved release
90
+
91
+ These are planned routes; do not use them as evidence of a release today.
92
+ Replace `VERSION` with the same verified published version for either route:
93
+
94
+ ```sh
95
+ npm install --global @n8r/surface@VERSION
96
+ # Alternative in a separate environment:
97
+ npm install --global n8r-surface@VERSION
98
+ # Explicit executable selection for a one-off invocation:
99
+ npm exec --package=@n8r/surface@VERSION -- n8r-surface --version
100
+ npm exec --package=n8r-surface@VERSION -- n8r-surface --version
101
+ ```
102
+
103
+ Library users install the chosen exact version locally and import from
104
+ `@n8r/surface` (preferred) or `n8r-surface`. Source links must resolve to
105
+ [the official repository](https://github.com/injectionator/n8r-surface).
106
+ After publication, check each registry manifest's version, repository and
107
+ `dist.integrity`, verify its provenance against the reviewed source revision,
108
+ and repeat isolated installs and the command/asset readback for both names.
109
+ Matching repository text alone does not prove origin.
110
+
111
+ ## Remaining release decisions and recovery
112
+
113
+ On 5 November 2026, public metadata lookups returned E404 for both names and
114
+ `npm whoami --registry=https://registry.npmjs.org` returned E401. This establishes
115
+ neither name availability nor publishing rights. An authorized maintainer must
116
+ establish the npm identity, `n8r` organization/team rights and unscoped ownership.
117
+ Subsequent authenticated readback identified the intended npm account and its
118
+ `n8r` owner role; new-package publication rights still require an actual publish.
119
+
120
+ The approved first version is `0.1.0-experimental.2`. Review the release
121
+ workflow before merging; account configuration and registry verification remain. Prefer trusted publishing for both packages
122
+ from the public repository on GitHub-hosted runners. npm documents Node 22.14+
123
+ and npm 11.5.1+ for trusted publishing and automatic provenance for public packages
124
+ from public repositories. Configure and verify each package's trust relationship;
125
+ local tarball tests cannot do this. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/)
126
+ (checked 5 November 2026). The manual workflow and its remaining account prerequisites are described in
127
+ [the first-release procedure](npm-release.md).
128
+
129
+ Use the same version and an explicit `experimental` distribution tag for both
130
+ packages; do not promote `latest` implicitly. Record each package's publication,
131
+ integrity and verification separately. If only one publishes, report the release
132
+ as incomplete and retain the exact approved build. Inspect existing registry
133
+ bytes before retrying the missing package; never replace or rebuild a published
134
+ version under an assumption of equivalence. Align tags only after both packages
135
+ pass registry readback. A mismatching published payload needs a new approved
136
+ version for both names. Publication, registry rehearsals, provenance verification
137
+ and human acceptance remain open under #27.