@vibesdotdev/infra-contracts 1.0.0-rc.6 → 1.0.0-rc.9

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.
package/SPEC.md ADDED
@@ -0,0 +1,101 @@
1
+ # @vibesdotdev/infra-contracts
2
+
3
+ Public MIT schemas and inferred types for portable infrastructure service
4
+ declarations and target ports. No premium or internal split.
5
+
6
+ ## Owns
7
+
8
+ Canonical definitions live in `src/schemas/service.ts`:
9
+
10
+ - `deploymentOriginKindSchema` and `DeploymentOriginKind`: primary, redirect,
11
+ preview, internal and alias.
12
+ - Strict `ServiceOriginSchema`: kernel `EnvironmentTierSchema`, origin kind
13
+ and URL. `ServiceEnvironment` is inferred from that kernel schema.
14
+ - Strict `ServiceDescriptorSchema` and `ServiceDescriptor`: infra/service
15
+ metadata, nonempty origins, aliases defaulting to [], optional cookieDomain,
16
+ sshHost and sshHostKey. Duplicate primary/internal origins in one environment
17
+ produce a custom Zod issue at the duplicate origins index.
18
+ - `ServiceTargetKindSchema` and `ServiceTargetKind`: primary or internal.
19
+ Strict `ServiceTargetSchema` and `ServiceTarget`: origin URL and environment.
20
+ - `ServicePortSchema` and `ServicePort`: a target function accepting an
21
+ optional kind and returning a promise of a validated target.
22
+ - `serviceOrigin(runtime, id, kind?)` on `./service` only. It validates `id`
23
+ with the kernel `SafeIdentifierSchema` and `kind` with `ServiceTargetKindSchema`,
24
+ reads the handed runtime's `infra/service` port, and returns the parsed target
25
+ origin. An invalid id refuses `INVALID_INPUT` `service-id-invalid`. An invalid
26
+ kind refuses `INVALID_INPUT` `service-target-kind-invalid`. A runtime without
27
+ the kind, or without that id, refuses `NOT_FOUND` `service-undeclared`. The
28
+ message, details, and cause carry no caller value. Implementation failures
29
+ propagate unchanged. Root and `./schemas` do not export it.
30
+ - Topic `infra-contracts.service` and `infraContractsDocsPlugin` at `./docs`.
31
+
32
+ ## Does not own
33
+
34
+ `@vibesdotdev/infra-core` owns infra/service kind registration, implementations,
35
+ configuration, environment selection, overrides, and the operational refusals
36
+ those implementations raise (`originOf`, local dev ports, transport). This
37
+ package has no service kind, configuration reader, host implementation, storage
38
+ or provider catalog.
39
+
40
+ ## Hard rules and public exports
41
+
42
+ `.`, `./service` and `./schemas` retain all existing service symbols and
43
+ share identical canonical schema objects within each artifact condition.
44
+ `./service` re-exports the schemas and adds `serviceOrigin`. Bun selects
45
+ source; Node selects built ESM; declaration consumers select emitted
46
+ declarations.
47
+
48
+ Descriptor and target malformed-input refusals are Zod errors, not operational
49
+ CapabilityErrors. Port arguments are validated before invocation and promised
50
+ results after resolution. Implementation failures propagate with unchanged
51
+ identity. An optional target kind remains callable with no argument or undefined.
52
+
53
+ Port admission validates a plain function contract and returns a parsed object.
54
+ Consumers retain resolved class implementations and call their methods with the
55
+ original receiver, then validate returned targets with ServiceTargetSchema.
56
+
57
+ The root barrel contains only the primary portable contract. Documentation is
58
+ selected explicitly through `./docs`; it contributes one typed topic and no
59
+ kind or implementation. Its inline Markdown is included in source and dist.
60
+
61
+ ## Composes with
62
+
63
+ Production dependencies are `@vibesdotdev/kernel`, `zod` and the type-only
64
+ `@vibesdotdev/docs-contracts` documentation contract. The primary contract's
65
+ runtime closure remains kernel and Zod. Compose the real docs owner's
66
+ `docsPlugin` from `@vibesdotdev/docs/plugin` with `infraContractsDocsPlugin`.
67
+ Resolve `getVibesDocsClient(runtime)` from `@vibesdotdev/docs`, then
68
+ `findById('infra-contracts.service')` and `resolveBody(topic)`.
69
+
70
+ ## Verification
71
+
72
+ Run `bun run check`, `bun run test` and `bun run build` in this directory,
73
+ or from Developer run:
74
+ `bun run vibes dev check --package @vibesdotdev/infra-contracts --check rules lint check build test`.
75
+
76
+ Typecheck includes tests. The complete suite proves admission, rejection details,
77
+ defaults, kernel schema reuse, optional-kind calls, port argument/result
78
+ validation, implementation-error identity, receiver-preserving typed usage, and
79
+ value-free `serviceOrigin` refusals for an undeclared id, an unsafe id, and an
80
+ invalid kind.
81
+ Docs discovery runs an owned createTestRuntime with both production plugins and
82
+ disposes it.
83
+
84
+ Artifact tests run in-process without packing, extraction or subprocess installs.
85
+ They import all four public package specifiers, compare canonical schema objects,
86
+ check exact export mappings and required publication exclusions, and resolve the
87
+ `./docs` plugin through the real docs runtime client. They exercise admission,
88
+ duplicate-origin refusal details and port behavior. Typecheck verifies source
89
+ inference, optional-kind calls and receiver-preserving usage. The local source
90
+ scan checks direct import text; it does not traverse dependency edges.
91
+
92
+ Build/export checks and release preflight own emitted-declaration consumption
93
+ and transitive universal-closure verification. Release preflight also owns actual
94
+ published-file verification. Unit tests check manifest declarations, not packed
95
+ contents or emitted declarations. Created runtimes are disposed in `finally`.
96
+
97
+ Publication is restricted to source, dist, README, SPEC and LICENSE, with test
98
+ and compiler-state exclusions. In-process proof does not certify a registry
99
+ install.
100
+ Rules and lint cover the package's nonempty source scope. CI/release ownership
101
+ remains the Framework repository; dependency updates belong to its release train.
@@ -5,7 +5,7 @@ declare const _default: {
5
5
  summary: string;
6
6
  track: "api-reference";
7
7
  tags: string[];
8
- surfaces: ("cli" | "mcp" | "web" | "in-app")[];
8
+ surfaces: ("cli" | "web" | "in-app" | "mcp")[];
9
9
  enabled: true;
10
10
  body: {
11
11
  type: "markdown";
@@ -1,10 +1,10 @@
1
1
  import * as z from 'zod/v4';
2
2
  import { EnvironmentTierSchema } from '@vibesdotdev/kernel/schemas/scope';
3
3
  export declare const deploymentOriginKindSchema: z.ZodEnum<{
4
- internal: "internal";
5
4
  primary: "primary";
6
5
  redirect: "redirect";
7
6
  preview: "preview";
7
+ internal: "internal";
8
8
  alias: "alias";
9
9
  }>;
10
10
  export type DeploymentOriginKind = z.infer<typeof deploymentOriginKindSchema>;
@@ -16,10 +16,10 @@ export declare const ServiceOriginSchema: z.ZodObject<{
16
16
  production: "production";
17
17
  }>;
18
18
  kind: z.ZodEnum<{
19
- internal: "internal";
20
19
  primary: "primary";
21
20
  redirect: "redirect";
22
21
  preview: "preview";
22
+ internal: "internal";
23
23
  alias: "alias";
24
24
  }>;
25
25
  origin: z.ZodURL;
@@ -54,10 +54,10 @@ export declare const ServiceDescriptorSchema: z.ZodObject<{
54
54
  production: "production";
55
55
  }>;
56
56
  kind: z.ZodEnum<{
57
- internal: "internal";
58
57
  primary: "primary";
59
58
  redirect: "redirect";
60
59
  preview: "preview";
60
+ internal: "internal";
61
61
  alias: "alias";
62
62
  }>;
63
63
  origin: z.ZodURL;
@@ -70,8 +70,8 @@ export declare const ServiceDescriptorSchema: z.ZodObject<{
70
70
  export type ServiceDescriptor = z.infer<typeof ServiceDescriptorSchema>;
71
71
  export type ServiceEnvironment = z.infer<typeof EnvironmentTierSchema>;
72
72
  export declare const ServiceTargetKindSchema: z.ZodEnum<{
73
- internal: "internal";
74
73
  primary: "primary";
74
+ internal: "internal";
75
75
  }>;
76
76
  export type ServiceTargetKind = z.infer<typeof ServiceTargetKindSchema>;
77
77
  export declare const ServiceTargetSchema: z.ZodObject<{
@@ -87,8 +87,8 @@ export type ServiceTarget = z.infer<typeof ServiceTargetSchema>;
87
87
  /** Validate a plain port; runtime consumers retain implementation receivers and validate returned targets. */
88
88
  export declare const ServicePortSchema: z.ZodObject<{
89
89
  target: z.ZodFunction<z.ZodTuple<readonly [z.ZodOptional<z.ZodEnum<{
90
- internal: "internal";
91
90
  primary: "primary";
91
+ internal: "internal";
92
92
  }>>], null>, z.ZodPromise<z.ZodObject<{
93
93
  origin: z.ZodURL;
94
94
  environment: z.ZodEnum<{
package/package.json CHANGED
@@ -1,34 +1,40 @@
1
1
  {
2
2
  "name": "@vibesdotdev/infra-contracts",
3
- "version": "1.0.0-rc.6",
3
+ "version": "1.0.0-rc.9",
4
4
  "dependencies": {
5
- "@vibesdotdev/kernel": "^1.0.0-rc.11",
5
+ "@vibesdotdev/kernel": "^1.0.0-rc.18",
6
6
  "zod": "^4.6.7",
7
- "@vibesdotdev/docs-contracts": "^1.0.0-rc.5"
7
+ "@vibesdotdev/docs-contracts": "^1.0.0-rc.7"
8
+ },
9
+ "gitHead": "064f1d6a92d5a23556d642b61e96513f415f6289",
10
+ "_vibes_source": {
11
+ "repo": "ssh://git@git.vibes.dev/vibesdotdev/framework.git",
12
+ "sha": "064f1d6a92d5a23556d642b61e96513f415f6289",
13
+ "workspaceDigest": "sha256:9bff65980c3a1077d348ce387160801b71238114bd6b55d13f624639a9a951ca"
8
14
  },
9
15
  "main": "./dist/index.js",
10
16
  "exports": {
11
17
  ".": {
12
- "bun": "./dist/index.js",
13
18
  "types": "./dist/index.d.ts",
19
+ "bun": "./dist/index.js",
14
20
  "import": "./dist/index.js",
15
21
  "default": "./dist/index.js"
16
22
  },
17
23
  "./service": {
18
- "bun": "./dist/service.js",
19
24
  "types": "./dist/service.d.ts",
25
+ "bun": "./dist/service.js",
20
26
  "import": "./dist/service.js",
21
27
  "default": "./dist/service.js"
22
28
  },
23
29
  "./schemas": {
24
- "bun": "./dist/schemas/index.js",
25
30
  "types": "./dist/schemas/index.d.ts",
31
+ "bun": "./dist/schemas/index.js",
26
32
  "import": "./dist/schemas/index.js",
27
33
  "default": "./dist/schemas/index.js"
28
34
  },
29
35
  "./docs": {
30
- "bun": "./dist/docs/plugin.js",
31
36
  "types": "./dist/docs/plugin.d.ts",
37
+ "bun": "./dist/docs/plugin.js",
32
38
  "import": "./dist/docs/plugin.js",
33
39
  "default": "./dist/docs/plugin.js"
34
40
  }
@@ -37,6 +43,7 @@
37
43
  "dist",
38
44
  "README.md",
39
45
  "LICENSE",
46
+ "SPEC.md",
40
47
  "!dist/**/__tests__/**",
41
48
  "!dist/**/*.test.js",
42
49
  "!dist/**/*.test.d.ts",
@@ -64,7 +71,7 @@
64
71
  "!**/*.spec.mts",
65
72
  "!**/*.spec.cts",
66
73
  "!**/*.spec.tsx",
67
- "!**/SPEC.md",
74
+ "!**/dist/**/SPEC.md",
68
75
  "!**/tsconfig.json",
69
76
  "!**/tsconfig.*.json",
70
77
  "!**/*.tsbuildinfo",
@@ -72,9 +79,9 @@
72
79
  "!**/*.tgz"
73
80
  ],
74
81
  "scripts": {
75
- "lint": "node ../node_modules/@vibesdotdev/internal-oxlint-toolchain/ratchet.mjs .",
76
- "build": "${BUN:-bun} --bun tsc -p tsconfig.json",
77
- "check": "${BUN:-bun} --bun tsc -p tsconfig.check.json",
82
+ "lint": "node ../node_modules/@vibesdotdev/oxlint-toolchain/ratchet.mjs .",
83
+ "build": "tsc -p tsconfig.json",
84
+ "check": "${BUN:-bun} check --no-script -p tsconfig.check.json",
78
85
  "test": "${BUN:-bun} test src"
79
86
  },
80
87
  "repository": {
@@ -98,11 +105,5 @@
98
105
  "description": "Portable infrastructure service descriptors and target port contracts.",
99
106
  "type": "module",
100
107
  "types": "./dist/index.d.ts",
101
- "license": "MIT",
102
- "gitHead": "d1948c757f179d2c3fb41553347085335cb76710",
103
- "_vibes_source": {
104
- "repo": "ssh://git@git.vibes.dev/vibesdotdev/framework.git",
105
- "sha": "d1948c757f179d2c3fb41553347085335cb76710",
106
- "workspaceDigest": "sha256:44321e8f358fedf741daff2c84e5b4ce3aafe7c04ae53a5537e60613aee4fd2d"
107
- }
108
+ "license": "MIT"
108
109
  }