@nexart/mcp-server 0.0.0-stage → 0.1.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 (114) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/CONTRIBUTING.md +56 -0
  3. package/LICENSE +202 -0
  4. package/NOTICE +14 -0
  5. package/README.md +340 -2
  6. package/SECURITY.md +76 -0
  7. package/THIRD_PARTY_NOTICES.md +111 -0
  8. package/dist/adapters.d.ts +16 -0
  9. package/dist/adapters.js +48 -0
  10. package/dist/approve-public.d.ts +2 -0
  11. package/dist/approve-public.js +65 -0
  12. package/dist/contracts.d.ts +48 -0
  13. package/dist/contracts.js +34 -0
  14. package/dist/create-confidential.d.ts +2 -0
  15. package/dist/create-confidential.js +34 -0
  16. package/dist/instrumentation/openai-worker.d.ts +1 -0
  17. package/dist/instrumentation/openai-worker.js +26 -0
  18. package/dist/instrumentation/openai.d.ts +51 -0
  19. package/dist/instrumentation/openai.js +197 -0
  20. package/dist/limits.d.ts +15 -0
  21. package/dist/limits.js +62 -0
  22. package/dist/lookup/contracts.d.ts +38 -0
  23. package/dist/lookup/contracts.js +22 -0
  24. package/dist/lookup/verify.d.ts +54 -0
  25. package/dist/lookup/verify.js +110 -0
  26. package/dist/network/client.d.ts +26 -0
  27. package/dist/network/client.js +188 -0
  28. package/dist/network/contracts.d.ts +104 -0
  29. package/dist/network/contracts.js +54 -0
  30. package/dist/network-tools.d.ts +5 -0
  31. package/dist/network-tools.js +32 -0
  32. package/dist/owner/create.d.ts +52 -0
  33. package/dist/owner/create.js +117 -0
  34. package/dist/owner/custody.d.ts +33 -0
  35. package/dist/owner/custody.js +200 -0
  36. package/dist/owner/host.d.ts +10 -0
  37. package/dist/owner/host.js +70 -0
  38. package/dist/owner/publisher.d.ts +21 -0
  39. package/dist/owner/publisher.js +27 -0
  40. package/dist/owner/reconcile.d.ts +16 -0
  41. package/dist/owner/reconcile.js +109 -0
  42. package/dist/receipts/contracts.d.ts +72 -0
  43. package/dist/receipts/contracts.js +33 -0
  44. package/dist/receipts/verify.d.ts +4 -0
  45. package/dist/receipts/verify.js +104 -0
  46. package/dist/record/contracts.d.ts +281 -0
  47. package/dist/record/contracts.js +70 -0
  48. package/dist/record/customer.d.ts +40 -0
  49. package/dist/record/customer.js +99 -0
  50. package/dist/record/policy.d.ts +46 -0
  51. package/dist/record/policy.js +67 -0
  52. package/dist/record/publication.d.ts +23 -0
  53. package/dist/record/publication.js +148 -0
  54. package/dist/record/record.d.ts +12 -0
  55. package/dist/record/record.js +93 -0
  56. package/dist/record/state.d.ts +44 -0
  57. package/dist/record/state.js +84 -0
  58. package/dist/record-tools.d.ts +10 -0
  59. package/dist/record-tools.js +85 -0
  60. package/dist/recover-confidential.d.ts +2 -0
  61. package/dist/recover-confidential.js +13 -0
  62. package/dist/results.d.ts +8 -0
  63. package/dist/results.js +83 -0
  64. package/dist/server.d.ts +2 -0
  65. package/dist/server.js +39 -0
  66. package/dist/stdio.d.ts +2 -0
  67. package/dist/stdio.js +104 -0
  68. package/dist/trust/lifecycle.d.ts +13 -0
  69. package/dist/trust/lifecycle.js +42 -0
  70. package/dist/trust/policy.d.ts +14 -0
  71. package/dist/trust/policy.js +6 -0
  72. package/dist/verify.d.ts +3 -0
  73. package/dist/verify.js +56 -0
  74. package/dist/write/approval.d.ts +5 -0
  75. package/dist/write/approval.js +95 -0
  76. package/dist/write/attest.d.ts +14 -0
  77. package/dist/write/attest.js +140 -0
  78. package/dist/write/config.d.ts +11 -0
  79. package/dist/write/config.js +12 -0
  80. package/dist/write/contracts.d.ts +229 -0
  81. package/dist/write/contracts.js +61 -0
  82. package/dist/write/post.d.ts +11 -0
  83. package/dist/write/post.js +105 -0
  84. package/dist/write/profile.d.ts +19 -0
  85. package/dist/write/profile.js +114 -0
  86. package/dist/write/seal.d.ts +3 -0
  87. package/dist/write/seal.js +49 -0
  88. package/dist/write-tools.d.ts +4 -0
  89. package/dist/write-tools.js +36 -0
  90. package/docs/age-version-compatibility.md +46 -0
  91. package/docs/architecture.md +72 -0
  92. package/docs/compatibility.md +163 -0
  93. package/docs/contracts.md +127 -0
  94. package/docs/examples/customer-claude-desktop.json +14 -0
  95. package/docs/examples/customer-consent.json +15 -0
  96. package/docs/examples/customer-custody.json +8 -0
  97. package/docs/examples/customer-policy.json +43 -0
  98. package/docs/licensing-review.md +109 -0
  99. package/docs/milestone-1-validation.md +110 -0
  100. package/docs/milestone-2.md +291 -0
  101. package/docs/milestone-3.2.md +291 -0
  102. package/docs/milestone-3.md +274 -0
  103. package/docs/milestone-4a.md +221 -0
  104. package/docs/milestone-4b1.md +220 -0
  105. package/docs/milestone-4b2.md +260 -0
  106. package/docs/public-default.md +263 -0
  107. package/docs/recording-schema-compatibility.md +46 -0
  108. package/docs/release.md +311 -0
  109. package/docs/security-fixes.md +47 -0
  110. package/docs/security.md +195 -0
  111. package/docs/standalone-acceptance.md +81 -0
  112. package/docs/validation.md +85 -0
  113. package/package.json +51 -4
  114. package/server.json +20 -0
package/SECURITY.md ADDED
@@ -0,0 +1,76 @@
1
+ # Security policy
2
+
3
+ ## Release/support scope
4
+
5
+ `0.1.0` is an unpublished release candidate, not a supported public release.
6
+ Node 24 and local stdio are the intended scope. Linux is automatically tested;
7
+ macOS/Claude Desktop live acceptance is owner-reported. Windows and other
8
+ individual hosts are not validated. No support period, response deadline or
9
+ remediation SLA is promised.
10
+
11
+ ## Report privately
12
+
13
+ Email **security@nexart.io** for private vulnerability reporting. Artnames Ltd
14
+ has designated this contact for the standalone MCP Server. Do not open a
15
+ public issue containing a vulnerability,
16
+ customer evidence, credentials, recovery material or an exploit.
17
+
18
+ The owner will independently test mailbox delivery and monitoring before
19
+ publication. This preparation has not tested delivery or monitoring and does
20
+ not claim either is verified. Send a minimal, non-sensitive initial report;
21
+ agree a secure transfer method before sending sensitive reproductions.
22
+ No response deadline, named security team or remediation SLA is promised.
23
+
24
+ Public npm distribution does **not** require making the GitHub repository public.
25
+ The email route is intended to work without private-repository membership.
26
+
27
+ ### Optional future GitHub route
28
+
29
+ GitHub documents this feature for **public repositories**. Once repository
30
+ redistribution is authorised and the standalone repository is made public,
31
+ an owner/admin should open **Settings → Advanced Security → Private vulnerability
32
+ reporting → Enable**. Then confirm that a non-maintainer can open
33
+ **Security → Advisories → Report a vulnerability** for this repository and that
34
+ the owner receives/monitors notifications. No real exploit or customer evidence
35
+ is needed to check route availability.
36
+
37
+ This setting has not been enabled or verified by this preparation. Do not mark
38
+ the gate complete merely because SECURITY.md or the conditional link exists.
39
+ GitHub enablement is not a prerequisite for the owner-designated email route.
40
+ Official instructions:
41
+ https://docs.github.com/en/code-security/how-tos/report-and-fix-vulnerabilities/configure-vulnerability-reporting/configure-for-a-repository
42
+
43
+ A private report should include the affected version, Node/OS/client versions,
44
+ impact, prerequisites and a minimal synthetic reproduction. Use reason codes,
45
+ not raw customer artifacts. Agree coordinated disclosure with the maintainer;
46
+ do not assume a fixed publication timeline. Do not probe production systems,
47
+ consume paid quota, or submit live certifications without separate authority.
48
+
49
+ ## Boundaries to understand
50
+
51
+ - A local MCP host controls process arguments, environment and OS account.
52
+ Same-user code may steal keys or rewrite local policy. Consent and counters
53
+ are not a malicious-same-user containment mechanism.
54
+ - Customer-owned Node keys must be provisioned in trusted host configuration,
55
+ not prompts/tool arguments. Desktop JSON environment entries are plaintext
56
+ storage. Use an established secret-store launcher where possible.
57
+ - Confidential commitments protect selected fields; readable metadata may leak
58
+ sensitive information. Age encryption protects recovery at rest, not memory
59
+ already visible to the agent/host. Preserve complete recovery and exclude the
60
+ decryption identity from the agent's effective access.
61
+ - MCP recording is explicitly invoked and producer-supplied, not independent
62
+ observation of every model execution. Instrumentation assertions are not
63
+ provider-authenticated signatures.
64
+ - Artifact integrity, receipt mathematics and signer trust are distinct.
65
+ No approved production trust anchors are shipped; `UNAPPROVED_KEY` is not
66
+ trusted success. Key discovery alone does not establish trust.
67
+ - Local limits conservatively reserve attempts and do not enforce Node-wide
68
+ quota, credential scopes or a financial cap. No automatic POST retries.
69
+ - Public certification can permanently disclose metadata. Private visibility
70
+ does not replace commitments, and does not make same-account key access safe.
71
+ - The package is not an authenticated remote/multi-tenant server.
72
+
73
+ See [detailed security boundaries](docs/security.md), [compatibility](docs/compatibility.md)
74
+ and [customer setup](docs/milestone-4b2.md). Report upstream issues through the
75
+ relevant upstream's verified private process; this repository cannot promise
76
+ changes to NexArt Node, SDKs or the Verification Terminal.
@@ -0,0 +1,111 @@
1
+ # Licensing and third-party provenance
2
+
3
+ ## Original MCP project code
4
+
5
+ Artnames Ltd expressly confirmed ownership of the original standalone NexArt MCP
6
+ Server code, including applicable development contributions, and authorised its
7
+ release under Apache License 2.0. LICENSE contains the standard text; NOTICE
8
+ records Copyright 2026 Artnames Ltd and the limited scope of that authorisation.
9
+
10
+ This supersedes the earlier UNLICENSED preparation status. It does not extend
11
+ to NexArt Canonical Node, separately maintained SDKs, Verification Terminal or
12
+ other products. No third-party fixture/dependency is relicensed as original code.
13
+ The scope is based on the owner's confirmation, not inferred from a repository
14
+ name or npm scope. See [the current rights inventory](docs/licensing-review.md).
15
+
16
+ The owner authorised public-distribution configuration and removal of
17
+ `private:true`; publication remains manual. The owner will check npm authority
18
+ and test the designated security@nexart.io mailbox before publishing.
19
+ Excluded fixtures/private Git history are not npm release blockers.
20
+ SDK packaging findings below belong to their separate distributions.
21
+
22
+ ## SDK declarations inspected
23
+
24
+ | Published package | Version | Manifest license |
25
+ | --- | --- | --- |
26
+ | `@nexart/ai-execution` | 1.4.0 | MIT |
27
+ | `@nexart/consequential-execution` | 0.1.0 | MIT |
28
+ | `@nexart/governed-execution` | 0.4.2 | MIT |
29
+
30
+ The exact public npm tarballs were downloaded and verified against their
31
+ registry SHA-512 integrity. All three tarball manifests and registry manifests
32
+ declare MIT. None contains a LICENSE/COPYING/NOTICE file at any level.
33
+ MIT permits use, modification and redistribution, subject to keeping its
34
+ copyright and permission notice in copies/substantial portions, with its
35
+ disclaimer. Public SPDX declarations are ordinary licensing evidence, not a
36
+ claim of independently verified title.
37
+
38
+ The AI SDK itself embeds Noble ed25519/hash code, including source-map sources,
39
+ with MIT attribution to Paul Miller (2019/2022), but no full MIT permission
40
+ text was found. The Governed SDK ships `schemas/provider_02/types.ts` with
41
+ Copyright 2026 Google LLC and an Apache-2.0 header/link. That material is not
42
+ relicensed by the SDK's general MIT declaration. Apache redistribution requires
43
+ the licence copy and applicable notices, plus change notices where relevant;
44
+ an upstream NOTICE, if supplied, must be preserved.
45
+
46
+ These are SDK-side licence/notice packaging findings. Their maintainers should
47
+ include the applicable MIT grants/copyrights and Apache-2.0 text/notices in their
48
+ own distributions. No SDK repository/package is modified by this review.
49
+ An absent SDK licence file is not by itself an adapter publication blocker:
50
+ the MCP tarball does not contain those SDKs or the embedded Noble/Google files,
51
+ and no conflicting restriction on this external dependency use was identified.
52
+ Bundling/copying those materials later would require a fresh notice review.
53
+
54
+ ## Repository-only fixtures — excluded from npm
55
+
56
+ Fixture files are retained in the repository, not repackaged as original code. They contain
57
+ synthetic/public test examples, not customer evidence.
58
+
59
+ - `tests/fixtures/ai/compat-vectors-v1.json` and `compat-vectors-v2.json` came
60
+ from the published AI 1.4.0 npm distribution.
61
+ - `tests/fixtures/governed/*.json` came from `artnames/governed-execution` at
62
+ source revision `c45cba5972157bbc872009b21cdf066cb97c05e2`.
63
+ The package manifest at that revision declares MIT. Its root listing
64
+ contains no LICENSE, and that revision is not asserted identical to the
65
+ npm release. `01_single_path_happy.json` explicitly records deterministic
66
+ correction of invalid non-v4 identifiers; not all current governed files
67
+ should be described as byte-identical upstream copies.
68
+ - Consequential and additional integration inputs are generated with the
69
+ official SDK constructors from synthetic test data; they are not independent
70
+ upstream compatibility vectors.
71
+
72
+ The AI compatibility examples include fixed public test openings/salts.
73
+ They remain repository test fixtures only: no such opening/salt values are copied to
74
+ validation output or returned by the MCP server. The npm release allowlist excludes
75
+ all tests and fixtures, source files and source maps. They are not embedded in
76
+ the compiled runtime; the release consumer is tested using an external harness.
77
+ This reduces npm redistribution exposure but does not authorise public GitHub
78
+ redistribution of those files or erase their provenance/permission requirements.
79
+
80
+ ## Dependency distribution
81
+
82
+ The three SDKs are external, exact-version npm dependencies of the MCP adapter,
83
+ not vendored or bundled into this archive. npm separately downloads their own
84
+ published distributions; the AI SDK internally bundles code as noted above.
85
+ The adapter's manifest has no bundleDependencies/bundledDependencies, and its
86
+ compiled JavaScript retains SDK imports. This adapter does not grant or change
87
+ rights in those dependencies, strip their notices or redistribute their files.
88
+ The three SDKs declare no ordinary runtime dependencies; AI declares optional
89
+ peers `pkijs` (^3.4.0) and `asn1js` (^3.0.5). They are not bundled into MCP and
90
+ are not required for its validated installation or supported verification scope.
91
+ The installed MCP server/core/client distributions declare Apache-2.0 and include
92
+ LICENSE files; Zod declares MIT with a LICENSE. Other installed dependency
93
+ declarations and licence-file presence are inventoried in
94
+ [the rights review](docs/licensing-review.md), including development dependencies.
95
+
96
+ ## Release gate
97
+
98
+ Original-code authorisation is complete on the owner's express confirmation.
99
+ For npm specifically, no additional third-party permission/notice blocker was
100
+ identified in the inspected MCP archive. SDK notice corrections belong upstream;
101
+ fixture permissions/private history concern public repository distribution,
102
+ not this tarball. Original-code confirmation is not SDK/fixture authorisation.
103
+ No existing notice was removed from a fixture or dependency.
104
+
105
+ Owner-side npm publishing authority and testing of the designated security
106
+ mailbox remain pre-publication checks, not blockers to preparing the public
107
+ configuration expressly requested by the owner. No npm login is performed by
108
+ this preparation, and publishing authority is not claimed as confirmed.
109
+ A public GitHub repository or Registry listing is not required for npm publication.
110
+
111
+ This is a provenance review, not an independent legal opinion.
@@ -0,0 +1,16 @@
1
+ import type { ToolName } from './contracts.js';
2
+ export type SdkOutcome = Record<string, unknown> & {
3
+ ok: boolean;
4
+ code: string;
5
+ };
6
+ export type DispatchResult = {
7
+ result: SdkOutcome;
8
+ family: string;
9
+ } | {
10
+ rejection: 'UNSUPPORTED_RECORD_FAMILY' | 'UNSUPPORTED_RECORD_VERSION' | 'SCHEMA_ERROR';
11
+ };
12
+ /**
13
+ * Only dispatch; all schema, hash, canonicalization and evidence checks belong
14
+ * to the published SDKs. Never retry a failed record under a different verifier.
15
+ */
16
+ export declare function dispatch(tool: ToolName, bundle: unknown): DispatchResult;
@@ -0,0 +1,48 @@
1
+ import { verifyCer, verifyCerV2, verifyProjectBundle, } from '@nexart/ai-execution';
2
+ import { verifyCer as verifyConsequential } from '@nexart/consequential-execution';
3
+ import { verifyGovernedExecution, verifyGovernedExecutionV2, } from '@nexart/governed-execution';
4
+ import { isObject } from './limits.js';
5
+ /**
6
+ * Only dispatch; all schema, hash, canonicalization and evidence checks belong
7
+ * to the published SDKs. Never retry a failed record under a different verifier.
8
+ */
9
+ export function dispatch(tool, bundle) {
10
+ if (!isObject(bundle))
11
+ return { rejection: 'SCHEMA_ERROR' };
12
+ const family = bundle.bundleType;
13
+ const result = (outcome) => ({
14
+ result: outcome, family: family,
15
+ });
16
+ switch (tool) {
17
+ case 'nexart_verify_ai_cer':
18
+ if (family !== 'cer.ai.execution.v1' && family !== 'cer.ai.execution.v2') {
19
+ return { rejection: 'UNSUPPORTED_RECORD_FAMILY' };
20
+ }
21
+ // V1 validates envelope.version, including its specific pre-protocol
22
+ // vintage tolerance. Preserve the SDK's gate rather than replacing it.
23
+ // The SDK itself selects/rejects snapshot.protocolVersion without fallback.
24
+ return result(family === 'cer.ai.execution.v1'
25
+ ? verifyCer(bundle)
26
+ : verifyCerV2(bundle));
27
+ case 'nexart_verify_consequential_cer':
28
+ if (family !== 'cer.consequential.execution.v1') {
29
+ return { rejection: 'UNSUPPORTED_RECORD_FAMILY' };
30
+ }
31
+ return result(verifyConsequential(bundle));
32
+ case 'nexart_verify_governed_execution':
33
+ if (family !== 'cer.governed.execution.v1') {
34
+ return { rejection: 'UNSUPPORTED_RECORD_FAMILY' };
35
+ }
36
+ if (bundle.version === '0.1')
37
+ return result(verifyGovernedExecution(bundle));
38
+ if (bundle.version === '0.2')
39
+ return result(verifyGovernedExecutionV2(bundle));
40
+ return { rejection: 'UNSUPPORTED_RECORD_VERSION' };
41
+ case 'nexart_verify_project_bundle':
42
+ if (family !== 'cer.project.bundle.v1') {
43
+ return { rejection: 'UNSUPPORTED_RECORD_FAMILY' };
44
+ }
45
+ return result(verifyProjectBundle(bundle));
46
+ }
47
+ }
48
+ //# sourceMappingURL=adapters.js.map
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+ import { constants, openSync, fstatSync, readFileSync, closeSync } from 'node:fs';
3
+ import { createInterface } from 'node:readline/promises';
4
+ import { ReadStream, WriteStream } from 'node:tty';
5
+ import { attestInput } from './write/contracts.js';
6
+ import { writeConfig } from './write/config.js';
7
+ import { boundedInput, validV2, publicProfile, PUBLIC_PROFILE, WRITE_LIMITS } from './write/profile.js';
8
+ import { issueApproval } from './write/approval.js';
9
+ import { NODE_ORIGIN } from './network/client.js';
10
+ /** Owner-only command, deliberately not registered as an MCP tool.
11
+ * A trusted local terminal is required; piped/model-generated flags cannot consent.
12
+ */
13
+ async function main() {
14
+ if (process.argv.length !== 3)
15
+ throw Error('USAGE');
16
+ const fd = openSync(process.argv[2], constants.O_RDONLY | constants.O_NOFOLLOW);
17
+ let raw;
18
+ try {
19
+ const stat = fstatSync(fd);
20
+ if (!stat.isFile() || stat.size > WRITE_LIMITS.inputBytes)
21
+ throw Error('INPUT');
22
+ raw = JSON.parse(readFileSync(fd, 'utf8'));
23
+ }
24
+ finally {
25
+ closeSync(fd);
26
+ }
27
+ if (boundedInput(raw))
28
+ throw Error('INPUT');
29
+ const args = attestInput.parse(raw);
30
+ if (args.visibility !== 'public' || !validV2(args.bundle) ||
31
+ args.certificateHash !== args.bundle.certificateHash || !publicProfile(args.bundle))
32
+ throw Error('PROFILE');
33
+ const config = writeConfig(), key = config.apiKey();
34
+ if (!config.publicEnabled || !config.attestEnabled || !config.accountContext?.trim() || !key || /[\r\n]/.test(key))
35
+ throw Error('CONFIG');
36
+ // Open the controlling terminal directly. stdin and stdout are not approval channels.
37
+ const ttyFd = openSync('/dev/tty', constants.O_RDWR | constants.O_NOCTTY);
38
+ const input = new ReadStream(ttyFd);
39
+ const output = new WriteStream(openSync('/dev/tty', constants.O_RDWR | constants.O_NOCTTY));
40
+ if (!input.isTTY || !output.isTTY)
41
+ throw Error('TTY');
42
+ const rl = createInterface({ input, output, terminal: true });
43
+ try {
44
+ output.write(`PUBLIC CERTIFICATION APPROVAL\nDestination: ${NODE_ORIGIN}/api/attest\nProfile: ${PUBLIC_PROFILE}\n`);
45
+ output.write('The complete CER below, its canonical certificate/envelope payloads, input/output hashes, all identity fields, and Node receipt/timestamp metadata can become public and permanently cached.\n');
46
+ output.write('Commitment plaintext and openings are absent. Readable values and original hashes can still disclose or correlate information. Identity verified:true remains a producer assertion, not authentication by this server.\n');
47
+ output.write(JSON.stringify(args.bundle, null, 2) + '\n');
48
+ output.write('Node-generated public metadata includes execution/app/SDK descriptors when present, creation/attestation times, Node ID/runtime hash, attestation ID, public signing key information, signatures, and available timestamp/transparency evidence. See docs/milestone-3.md.\n');
49
+ const answer = await rl.question(`Type PUBLISH ${args.certificateHash} to authorize this exact payload once for five minutes: `);
50
+ if (answer !== `PUBLISH ${args.certificateHash}`)
51
+ throw Error('DECLINED');
52
+ issueApproval(config, JSON.stringify(args.bundle), key);
53
+ output.write('Single-use approval recorded. No evidence was submitted by this command.\n');
54
+ }
55
+ finally {
56
+ rl.close();
57
+ input.destroy();
58
+ output.destroy();
59
+ }
60
+ }
61
+ main().catch(() => {
62
+ process.stderr.write('PUBLIC_APPROVAL_NOT_CREATED: check the input/profile, host configuration, secure approval directory and controlling terminal. No submission was made.\n');
63
+ process.exitCode = 1;
64
+ });
65
+ //# sourceMappingURL=approve-public.js.map
@@ -0,0 +1,48 @@
1
+ import * as z from 'zod/v4';
2
+ export declare const TOOL_NAMES: readonly ["nexart_verify_ai_cer", "nexart_verify_consequential_cer", "nexart_verify_governed_execution", "nexart_verify_project_bundle"];
3
+ export type ToolName = (typeof TOOL_NAMES)[number];
4
+ export declare const inputSchema: z.ZodObject<{
5
+ bundle: z.ZodUnknown;
6
+ }, z.core.$strict>;
7
+ export declare const outputSchema: z.ZodObject<{
8
+ contractVersion: z.ZodLiteral<"1">;
9
+ tool: z.ZodEnum<{
10
+ nexart_verify_ai_cer: "nexart_verify_ai_cer";
11
+ nexart_verify_consequential_cer: "nexart_verify_consequential_cer";
12
+ nexart_verify_governed_execution: "nexart_verify_governed_execution";
13
+ nexart_verify_project_bundle: "nexart_verify_project_bundle";
14
+ }>;
15
+ family: z.ZodNullable<z.ZodEnum<{
16
+ "cer.ai.execution.v1": "cer.ai.execution.v1";
17
+ "cer.ai.execution.v2": "cer.ai.execution.v2";
18
+ "cer.consequential.execution.v1": "cer.consequential.execution.v1";
19
+ "cer.governed.execution.v1": "cer.governed.execution.v1";
20
+ "cer.project.bundle.v1": "cer.project.bundle.v1";
21
+ }>>;
22
+ recordVersion: z.ZodNullable<z.ZodEnum<{
23
+ 0.1: "0.1";
24
+ 0.2: "0.2";
25
+ }>>;
26
+ protocol: z.ZodNullable<z.ZodEnum<{
27
+ "1.2.0": "1.2.0";
28
+ "1.3.0": "1.3.0";
29
+ "1.3.1": "1.3.1";
30
+ "jcs-v1": "jcs-v1";
31
+ }>>;
32
+ artifactIntegrity: z.ZodEnum<{
33
+ valid: "valid";
34
+ invalid: "invalid";
35
+ not_performed: "not_performed";
36
+ }>;
37
+ reasonCode: z.ZodString;
38
+ sdk: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
39
+ checks: z.ZodObject<{
40
+ nodeSignature: z.ZodLiteral<"not_performed">;
41
+ signerTrust: z.ZodLiteral<"not_established">;
42
+ timestampCryptography: z.ZodLiteral<"not_performed">;
43
+ confidentialOpenings: z.ZodLiteral<"not_performed">;
44
+ completeness: z.ZodLiteral<"not_established">;
45
+ }, z.core.$strict>;
46
+ limitations: z.ZodArray<z.ZodString>;
47
+ }, z.core.$strict>;
48
+ export type VerificationOutput = z.infer<typeof outputSchema>;
@@ -0,0 +1,34 @@
1
+ import * as z from 'zod/v4';
2
+ export const TOOL_NAMES = [
3
+ 'nexart_verify_ai_cer',
4
+ 'nexart_verify_consequential_cer',
5
+ 'nexart_verify_governed_execution',
6
+ 'nexart_verify_project_bundle',
7
+ ];
8
+ export const inputSchema = z.strictObject({
9
+ bundle: z.unknown().describe('An inline NexArt artifact. No URLs, paths, credentials or openings.'),
10
+ });
11
+ const state = z.enum(['valid', 'invalid', 'not_performed']);
12
+ const safeSdkResult = z.record(z.string(), z.unknown());
13
+ export const outputSchema = z.strictObject({
14
+ contractVersion: z.literal('1'),
15
+ tool: z.enum(TOOL_NAMES),
16
+ family: z.enum([
17
+ 'cer.ai.execution.v1', 'cer.ai.execution.v2', 'cer.consequential.execution.v1',
18
+ 'cer.governed.execution.v1', 'cer.project.bundle.v1',
19
+ ]).nullable(),
20
+ recordVersion: z.enum(['0.1', '0.2']).nullable(),
21
+ protocol: z.enum(['1.2.0', '1.3.0', '1.3.1', 'jcs-v1']).nullable(),
22
+ artifactIntegrity: state,
23
+ reasonCode: z.string().max(96),
24
+ sdk: safeSdkResult.nullable(),
25
+ checks: z.strictObject({
26
+ nodeSignature: z.literal('not_performed'),
27
+ signerTrust: z.literal('not_established'),
28
+ timestampCryptography: z.literal('not_performed'),
29
+ confidentialOpenings: z.literal('not_performed'),
30
+ completeness: z.literal('not_established'),
31
+ }),
32
+ limitations: z.array(z.string().max(256)).max(12),
33
+ });
34
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ import { openSync, constants } from 'node:fs';
3
+ import { ReadStream, WriteStream } from 'node:tty';
4
+ import { createInterface } from 'node:readline/promises';
5
+ import { createOwnerConfidential, readOwnerInput, ownerDirectory } from './owner/create.js';
6
+ async function main() {
7
+ if (process.argv.length !== 4)
8
+ throw Error('USAGE');
9
+ const input = process.argv[2], custody = ownerDirectory(process.argv[3]);
10
+ const output = new WriteStream(openSync('/dev/tty', constants.O_RDWR | constants.O_NOCTTY));
11
+ const terminal = new ReadStream(openSync('/dev/tty', constants.O_RDWR | constants.O_NOCTTY));
12
+ const rl = createInterface({ input: terminal, output, terminal: true });
13
+ try {
14
+ if (!terminal.isTTY || !output.isTTY)
15
+ throw Error('OWNER_TTY');
16
+ output.write('OWNER-ONLY CONFIDENTIAL CREATION — no network or MCP.\nUse an isolated owner account/device, inaccessible to agents. A TTY is not isolation.\n');
17
+ output.write(`Custody directory: ${custody}\n`);
18
+ output.write('recovery.json will contain original confidential plaintext AND SDK salt openings, unencrypted with mode 0600 under 0700 directories. Use an owner-encrypted volume and offline backup; never share recovery.json or the input with an agent. Only cer.json may be exported after metadata review. Losing recovery material prevents later opening verification. No automatic deletion or backup is provided.\n');
19
+ if (await rl.question('Type RETAIN OWNER RECOVERY to approve this custody mechanism: ') !== 'RETAIN OWNER RECOVERY')
20
+ throw Error('DECLINED');
21
+ const result = createOwnerConfidential(readOwnerInput(input), custody);
22
+ process.stdout.write(`CONFIDENTIAL_CREATED ${result.certificateHash}\n`);
23
+ }
24
+ finally {
25
+ rl.close();
26
+ terminal.destroy();
27
+ output.destroy();
28
+ }
29
+ }
30
+ main().catch(() => {
31
+ process.stderr.write('CONFIDENTIAL_CREATION_STOPPED: no plaintext or openings logged. Unsaved openings cannot be recovered; no successful export is authorized. Keep any private partial custody files and inspect locally before exporting any CER.\n');
32
+ process.exitCode = 1;
33
+ });
34
+ //# sourceMappingURL=create-confidential.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ import { parentPort, workerData } from 'node:worker_threads';
2
+ import { runOpenAIChatExecutionV2 } from '@nexart/ai-execution/providers/openaiV2';
3
+ // This worker bounds SDK lifetime and confines its fetch shim to this worker.
4
+ // It is NOT an OS/security boundary against an agent controlling the process.
5
+ globalThis.fetch = (async (url, init) => {
6
+ return new Promise((resolve, reject) => {
7
+ parentPort.once('message', message => {
8
+ if (message.type !== 'response')
9
+ return reject(Error('PROVIDER_TRANSPORT_FAILED'));
10
+ resolve(new Response(message.body, { status: message.status, headers: { 'content-type': 'application/json' } }));
11
+ });
12
+ parentPort.postMessage({ type: 'request', url, init });
13
+ });
14
+ });
15
+ try {
16
+ const result = await runOpenAIChatExecutionV2(workerData);
17
+ parentPort.postMessage({ type: 'result', result });
18
+ }
19
+ catch {
20
+ // The published SDK may put raw provider bodies into errors. Never forward.
21
+ parentPort.postMessage({ type: 'failed' });
22
+ }
23
+ finally {
24
+ parentPort.close();
25
+ }
26
+ //# sourceMappingURL=openai-worker.js.map
@@ -0,0 +1,51 @@
1
+ import * as z from 'zod/v4';
2
+ import { type RecordRuntime } from '../record/record.js';
3
+ import { type RecordResult } from '../record/contracts.js';
4
+ import { type EncryptedCustody } from '../owner/custody.js';
5
+ declare const inputSchema: z.ZodObject<{
6
+ params: z.ZodObject<{
7
+ instruction: z.ZodString;
8
+ input: z.ZodString;
9
+ model: z.ZodOptional<z.ZodString>;
10
+ parameters: z.ZodOptional<z.ZodObject<{
11
+ temperature: z.ZodOptional<z.ZodNumber>;
12
+ maxTokens: z.ZodOptional<z.ZodNumber>;
13
+ topP: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
14
+ seed: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
15
+ }, z.core.$strict>>;
16
+ executionRole: z.ZodOptional<z.ZodEnum<{
17
+ advisory: "advisory";
18
+ operative: "operative";
19
+ unspecified: "unspecified";
20
+ }>>;
21
+ decisionRefs: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
22
+ }, z.core.$strict>;
23
+ certification: z.ZodOptional<z.ZodObject<{
24
+ mode: z.ZodDefault<z.ZodEnum<{
25
+ local: "local";
26
+ node: "node";
27
+ }>>;
28
+ visibility: z.ZodOptional<z.ZodEnum<{
29
+ private: "private";
30
+ public: "public";
31
+ }>>;
32
+ }, z.core.$strict>>;
33
+ }, z.core.$strict>;
34
+ export type OpenAIRecordingInput = z.input<typeof inputSchema>;
35
+ export interface OpenAIRecordingRuntime {
36
+ custody: EncryptedCustody;
37
+ apiKey: () => string | undefined;
38
+ /** Trusted application transport injection, never input/env/MCP. Defaults to fixed-origin fetch. */
39
+ request?: typeof fetch;
40
+ /** Only an independently secured existing 4A owner publisher may be supplied. */
41
+ publish?: RecordRuntime['publish'];
42
+ }
43
+ export interface OpenAIRecordingResult {
44
+ providerCall: 'not_started' | 'completed' | 'failed_or_outcome_unknown';
45
+ output: string | null;
46
+ recording: RecordResult;
47
+ }
48
+ /** Real SDK wrapper, called once. No provider key from model arguments and no
49
+ * ambient Node credential discovery. Plaintext output goes only to its calling app. */
50
+ export declare function runOpenAIRecorded(raw: OpenAIRecordingInput, runtime: OpenAIRecordingRuntime): Promise<OpenAIRecordingResult>;
51
+ export {};