anhedral 0.18.0 → 0.20.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 (128) hide show
  1. package/README.md +10 -6
  2. package/assets/contracts/deployment-provenance.json +6 -6
  3. package/assets/contracts/operations-provenance.json +2 -1
  4. package/assets/launch/oj/OJ.LICENSE +21 -0
  5. package/assets/launch/oj/run.mjs +82 -0
  6. package/assets/launch/oj/runtime.json +21 -0
  7. package/assets/launch/root.tsx.txt +1 -2
  8. package/assets/launch/server.ts.txt +4 -2
  9. package/assets/ui/catalog.json +36 -324
  10. package/dist/{platforms/web.d.ts → api-proxy.d.ts} +1 -3
  11. package/dist/api-proxy.js +48 -0
  12. package/dist/capability-catalog.d.ts +3 -57
  13. package/dist/capability-catalog.js +3 -90
  14. package/dist/capability-command.d.ts +10 -2
  15. package/dist/capability-command.js +35 -99
  16. package/dist/capability-editor.js +21 -1
  17. package/dist/capability-recipes.js +8 -343
  18. package/dist/cli-commands.js +6 -1
  19. package/dist/command-schema.js +141 -2
  20. package/dist/command-types.d.ts +1 -0
  21. package/dist/composition.d.ts +4 -14
  22. package/dist/composition.js +6 -6
  23. package/dist/contracts/cli-transport.d.ts +139 -40
  24. package/dist/contracts/cli-transport.js +96 -27
  25. package/dist/contracts/deployment.d.ts +7 -56
  26. package/dist/contracts/deployment.js +9 -45
  27. package/dist/contracts/production-transport.d.ts +71 -0
  28. package/dist/contracts/production-transport.js +56 -0
  29. package/dist/contracts/source-profile.js +1 -1
  30. package/dist/contracts/staging-transport.d.ts +2 -2
  31. package/dist/credential-helper.d.ts +2 -0
  32. package/dist/credential-helper.js +44 -0
  33. package/dist/dependencies.d.ts +0 -27
  34. package/dist/dependencies.js +3 -67
  35. package/dist/index.d.ts +0 -4
  36. package/dist/index.js +0 -2
  37. package/dist/launch.d.ts +11 -5
  38. package/dist/launch.js +21 -9
  39. package/dist/platform-command.js +245 -42
  40. package/dist/platform-production.d.ts +16 -0
  41. package/dist/platform-production.js +135 -0
  42. package/dist/platform-state.d.ts +4 -1
  43. package/dist/platform-state.js +28 -5
  44. package/dist/platforms/tanstack.d.ts +2 -0
  45. package/dist/platforms/tanstack.js +113 -20
  46. package/dist/registry/usage.js +3 -1
  47. package/dist/release-artifact.d.ts +18 -0
  48. package/dist/release-artifact.js +169 -0
  49. package/dist/scaffold/bootstrap.d.ts +3 -3
  50. package/dist/scaffold/styling.d.ts +3 -2
  51. package/dist/stack-update.d.ts +39 -0
  52. package/dist/stack-update.js +346 -0
  53. package/dist/transaction.d.ts +1 -0
  54. package/dist/transaction.js +2 -0
  55. package/dist/ui-catalog.d.ts +3 -5
  56. package/dist/ui-catalog.js +8 -24
  57. package/dist/ui-command.d.ts +1 -1
  58. package/dist/ui-command.js +18 -57
  59. package/dist/ui-project.d.ts +2 -2
  60. package/dist/ui-project.js +8 -36
  61. package/dist/version.d.ts +1 -1
  62. package/dist/version.js +1 -1
  63. package/docs/capabilities.md +7 -7
  64. package/docs/software-factory.md +83 -16
  65. package/docs/stack-standard.md +1 -1
  66. package/package.json +1 -4
  67. package/assets/stack/ai-schema.ts.txt +0 -5
  68. package/assets/stack/ai.ts.txt +0 -30
  69. package/assets/stack/desktop.rs.txt +0 -21
  70. package/assets/stack/event-retention.sql.txt +0 -10
  71. package/assets/stack/events-schema.ts.txt +0 -12
  72. package/assets/stack/events.ts.txt +0 -59
  73. package/assets/stack/mobile-auth.ts.txt +0 -25
  74. package/assets/stack/mobile-billing.tsx.txt +0 -63
  75. package/assets/stack/mobile-session.tsx.txt +0 -83
  76. package/assets/stack/native-button.tsx.txt +0 -108
  77. package/assets/stack/native-global.css.txt +0 -4
  78. package/assets/stack/native-lib-utils.ts.txt +0 -5
  79. package/assets/stack/native-metro.config.js.txt +0 -6
  80. package/assets/stack/native-nativewind-env.d.ts.txt +0 -1
  81. package/assets/stack/native-tailwind.config.js.txt +0 -73
  82. package/assets/stack/native-text.tsx.txt +0 -89
  83. package/assets/stack/purchases.ts.txt +0 -65
  84. package/assets/stack/revenuecat.ts.txt +0 -88
  85. package/assets/stack/rtc-schema.ts.txt +0 -10
  86. package/assets/stack/rtc.ts.txt +0 -122
  87. package/assets/stack/web-sign-in.tsx.txt +0 -51
  88. package/dist/capabilities.d.ts +0 -11
  89. package/dist/capabilities.js +0 -14
  90. package/dist/dependency-order.d.ts +0 -2
  91. package/dist/dependency-order.js +0 -24
  92. package/dist/platforms/lint.d.ts +0 -1
  93. package/dist/platforms/lint.js +0 -5
  94. package/dist/platforms/web.js +0 -251
  95. package/dist/project-config.d.ts +0 -3
  96. package/dist/project-config.js +0 -16
  97. package/dist/registry/context.d.ts +0 -3
  98. package/dist/registry/context.js +0 -20
  99. package/dist/registry/options.d.ts +0 -2
  100. package/dist/registry/options.js +0 -47
  101. package/dist/registry/resolve.d.ts +0 -11
  102. package/dist/registry/resolve.js +0 -46
  103. package/dist/registry/types.d.ts +0 -60
  104. package/dist/scaffold/api.d.ts +0 -2
  105. package/dist/scaffold/api.js +0 -38
  106. package/dist/scaffold/backend.d.ts +0 -2
  107. package/dist/scaffold/backend.js +0 -36
  108. package/dist/scaffold/compose.d.ts +0 -4
  109. package/dist/scaffold/compose.js +0 -30
  110. package/dist/scaffold/database.d.ts +0 -2
  111. package/dist/scaffold/database.js +0 -41
  112. package/dist/scaffold/documentation.d.ts +0 -2
  113. package/dist/scaffold/documentation.js +0 -71
  114. package/dist/scaffold/environment.d.ts +0 -4
  115. package/dist/scaffold/environment.js +0 -22
  116. package/dist/scaffold/stack-documentation.d.ts +0 -2
  117. package/dist/scaffold/stack-documentation.js +0 -6
  118. package/dist/scaffold/storage.d.ts +0 -2
  119. package/dist/scaffold/storage.js +0 -21
  120. package/dist/scaffold/workspace.d.ts +0 -3
  121. package/dist/scaffold/workspace.js +0 -141
  122. package/dist/stack-registry.d.ts +0 -35
  123. package/dist/stack-registry.js +0 -189
  124. package/dist/standard.d.ts +0 -8
  125. package/dist/standard.js +0 -109
  126. package/dist/workspace-graph.d.ts +0 -7
  127. package/dist/workspace-graph.js +0 -74
  128. /package/dist/{registry/types.js → command-types.js} +0 -0
package/README.md CHANGED
@@ -13,7 +13,7 @@ cd my-app
13
13
  pnpm dev
14
14
  ```
15
15
 
16
- Init creates `apps/web` and shared tooling with TanStack Start server rendering/server functions and source-owned Anhedral UI built on shadcn. It does not add an API, database, authentication, storage or payments. Preview with `anhedral init my-app --dry-run --json`; use `--skip-install --no-git` for offline source generation.
16
+ Init creates `apps/web` and shared tooling with OJ and TanStack Start server rendering/server functions and source-owned Anhedral UI built on shadcn. It does not add an API, database, authentication, storage or payments. Preview with `anhedral init my-app --dry-run --json`; use `--skip-install --no-git` for offline source generation.
17
17
 
18
18
  ## Add services
19
19
 
@@ -26,9 +26,13 @@ anhedral add stripe
26
26
 
27
27
  `backend` adds Hono, Better Auth and Drizzle/D1 together in one source transaction. `r2` adds private storage; `stripe` adds subscriptions. Both require the backend. Include missing prerequisites explicitly with `anhedral add r2 stripe --with-dependencies`.
28
28
 
29
- After adding backend, configure `apps/api/.dev.vars` from its example, review the initial SQL and apply it deliberately with `pnpm db:migrate --local`. The same Vite process then runs the web and auxiliary API Workers with local resources. Authentication methods start disabled and need explicit configuration. After adding Stripe, run `pnpm db:generate`, review the billing SQL and migrate before testing webhooks. Builds/startup never migrate databases or activate providers.
29
+ After adding backend, configure `apps/api/.dev.vars` from its example, review the initial SQL and apply it deliberately with `pnpm db:migrate --local`. The OJ development server then runs the web and auxiliary API Workers with local resources. Authentication methods start disabled and need explicit configuration. After adding Stripe, run `pnpm db:generate`, review the billing SQL and migrate before testing webhooks. Builds/startup never migrate databases or activate providers.
30
30
 
31
- Use `anhedral stack list`, `status` and `doctor` to inspect the Anhedral Stack and its additions. These checks describe source completeness, not live provider readiness. Current public generation is web-only. Historical generators and protocol values remain compatibility implementation details; preserved development branches retain the broader earlier work.
31
+ Use `anhedral stack list`, `status` and `doctor` to inspect the Anhedral Stack and its additions. These checks describe source completeness, not live provider readiness. Current public generation is web-only. OJ runs development and builds. Historical generators and framework aliases are removed.
32
+
33
+ ## Update an existing project
34
+
35
+ Update your agent plugin through its host and select the matching published CLI version. Preview `anhedral stack update --dry-run --json`, review the returned diffs/conflicts, then apply `anhedral stack update --expect-plan <planId> --json`. Updates preserve authored source and stop on customized-file conflicts or a changed plan. They refresh generated runtime/configuration and deployment provenance without running project scripts or installing dependencies. Validate dependencies and the application separately before upload/deployment. See [the operating workflow](docs/software-factory.md).
32
36
 
33
37
  ## Source-owned UI
34
38
 
@@ -43,11 +47,11 @@ UI commands operate on Anhedral Stack web applications. Components are editable
43
47
 
44
48
  ## Optional Platform access
45
49
 
46
- Local generation requires no account. For an existing Platform project, use browser-approved `login`, then `link --project <uuid> --team <uuid>`. `source upload --dry-run` inspects packaging without uploading; `source upload` sends a resumable immutable checkpoint.
50
+ Local generation requires no account. After browser-approved `login`, use `projects list --human` to discover projects and team IDs. Register your generated application with `projects create --name <name> --link --human`, or connect an existing project with `link --project <uuid> --team <uuid>`. `source upload --dry-run` inspects packaging without uploading; `source upload` sends a resumable immutable checkpoint.
47
51
 
48
- `deploy plan --manifest <file>`, `deploy prepare` and `deploy status` submit intent and read candidate receipts. Platform independently checks current authority, exact artifacts and runtime admission. Upload/build success is not production approval. The current manifest runtime profile is `anhedral-stack`; an application cannot approve itself for hosting.
52
+ `deploy plan --manifest <file>`, `deploy prepare` and `deploy status` submit intent and read candidate receipts. Platform independently checks current authority, exact artifacts and runtime admission. Upload/build success does not publish production. Plans report current runtime compatibility and actionable remediation; candidate preparation does not require another person to review the CLI artifact. The current manifest runtime profile is `anhedral-stack`; an application cannot approve itself for hosting.
49
53
 
50
- `env list/import/set` manages variable metadata and private imports. Send values through an owner-only file or stdin, never command arguments or chat. `staging status/deploy` operates on ready candidates; `logs` reads redacted runtime events. The optional plugin uses separate OAuth consent for Platform tools. See [the operating workflow](docs/software-factory.md#platform-cli-access-and-source-upload).
54
+ `env list/import/set` manages variable metadata and private imports. Send values through an owner-only file or stdin, never command arguments or chat. `staging status/deploy` operates on ready candidates. `production status` reads production history; `production deploy --candidate <uuid> --name <slug>` requests publication with your existing production permissions, without a second approver for self-service teams. Explicit independent-review team policy remains enforced; `logs` reads redacted runtime events. The Codex and Claude Code plugin provides CLI usage guidance; authentication and managed project operations run through the CLI. See [the operating workflow](docs/software-factory.md#platform-cli-access-and-source-upload).
51
55
 
52
56
  ## Help and automation
53
57
 
@@ -2,14 +2,14 @@
2
2
  "contractVersion": 1,
3
3
  "owner": "anhedral/platform-contracts/deployment",
4
4
  "license": "Apache-2.0",
5
- "sourceRevision": "754509cd760762e0c2e3fb00a644069dc1e2ecaf",
5
+ "sourceRevision": "63682e8ec510a984bfa14c02839b466a612dfc93",
6
6
  "files": {
7
- "cli-transport.ts": "30d184604c8d78ce3b8c88d71b525234d716d40ead278f6aed44a0250aa0d9a4",
8
- "source-profile.ts": "faf34ae54eb23881c4ec008f9fc59dbf6905fa04a912b66fe4f527a49d4b8490",
7
+ "cli-transport.ts": "0a20f25e6aa975aaa862531bda5e7318c7469b635c9261a878895e45b68724a8",
8
+ "source-profile.ts": "1426caa2675db95d249ca36bb06c039ce8382379fd33cf9cdae48d7aad2faded",
9
9
  "source-bundle.ts": "99df4874f9337a604da544093215de24f19f136182017be15629f78b5180a52b",
10
- "deployment.ts": "eb10b9eb771ef8a3f7a014ac473652d33fed6cb82969b3bc8a694dc48e267c0a",
11
- "fixtures.json": "41803dffca899a95afc9b00fb6a71a317448b6344452d0b0440a8550b5b1f2f7",
12
- "acceptance.mjs": "8e9d09d924ca7a7843d1578964243266641b09b339ea621b0981a7ccd28d4c5e",
10
+ "deployment.ts": "dbcb2b80129345a54e8cef340a48ffeadff662c903185ae5f6ac1120ced776df",
11
+ "fixtures.json": "2dfc70a23c5f60c293f2594263b8f5177b369f162026c323004ff5482f40f154",
12
+ "acceptance.mjs": "66605b98f1a606ae41df35b5e715e8626e760be351ee21c90cc9358a44b8b58a",
13
13
  "LICENSE": "6d89bce3e7760469015287d1b6a45d31ef7924475c9b54eabe974bcce373980b"
14
14
  }
15
15
  }
@@ -2,8 +2,9 @@
2
2
  "contractVersion": 1,
3
3
  "owner": "anhedral/platform-contracts/operations",
4
4
  "license": "Apache-2.0",
5
- "sourceRevision": "7ad79c1dfeb2675c98515507f609d95bee9133dd",
5
+ "sourceRevision": "63682e8ec510a984bfa14c02839b466a612dfc93",
6
6
  "files": {
7
+ "production-transport.ts": "f2aee199c0bc9476737556ca3e34251a891539dd38e68492a951b6532052cee8",
7
8
  "staging-transport.ts": "b5197c607492d7df912589e2707594210b92f06bf2db6b79931d620af4f49004",
8
9
  "runtime-logs-transport.ts": "29f2da5209d2daa1e4edf5c478a0414e89497063503345d805e463e11da1bb78",
9
10
  "LICENSE": "6d89bce3e7760469015287d1b6a45d31ef7924475c9b54eabe974bcce373980b"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Raphael Amorim and Lovable Labs Incorporated
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,82 @@
1
+ // Pinned public OJ release. Downloads only the declared artifact; never runs an installer.
2
+ import { spawn, execFileSync } from 'node:child_process';
3
+ import { constants } from 'node:os';
4
+ import { createHash, randomUUID } from 'node:crypto';
5
+ import { readFile, lstat, mkdir, open, rename, rm } from 'node:fs/promises';
6
+ import { fileURLToPath } from 'node:url';
7
+ import path from 'node:path';
8
+
9
+ const policy = JSON.parse(await readFile(new URL('./oj-runtime.json', import.meta.url), 'utf8'));
10
+ const target = `${process.platform}-${process.arch}`;
11
+ const pin = policy.targets[target];
12
+ if (!pin) throw Error(`OJ ${policy.version} is not pinned for ${target}.`);
13
+ const cache = fileURLToPath(
14
+ new URL(`../node_modules/.cache/anhedral-oj/${policy.version}/${target}/`, import.meta.url),
15
+ );
16
+ const binary = path.join(cache, 'oj');
17
+ const hash = (bytes) => createHash('sha256').update(bytes).digest('hex');
18
+ async function verifiedBinary() {
19
+ const stat = await lstat(binary);
20
+ if (
21
+ !stat.isFile() ||
22
+ stat.isSymbolicLink() ||
23
+ stat.size !== pin.binaryBytes ||
24
+ hash(await readFile(binary)) !== pin.binarySha256
25
+ )
26
+ throw Error('The cached OJ runtime failed integrity validation.');
27
+ }
28
+ try {
29
+ await verifiedBinary();
30
+ } catch (error) {
31
+ if (error.code !== 'ENOENT') throw error;
32
+ await mkdir(cache, { recursive: true });
33
+ const temporary = path.join(cache, randomUUID());
34
+ const archive = `${temporary}.tar.gz`;
35
+ try {
36
+ const response = await fetch(
37
+ `${policy.repository}/releases/download/v${policy.version}/${pin.asset}`,
38
+ { signal: AbortSignal.timeout(180000) },
39
+ );
40
+ if (!response.ok || !response.body) throw Error('The pinned OJ download failed.');
41
+ const file = await open(archive, 'wx', 0o600);
42
+ const digest = createHash('sha256');
43
+ let bytes = 0;
44
+ try {
45
+ for await (const chunk of response.body) {
46
+ bytes += chunk.byteLength;
47
+ if (bytes > pin.archiveBytes) throw Error('OJ archive exceeds its pinned size.');
48
+ digest.update(chunk);
49
+ await file.writeFile(chunk);
50
+ }
51
+ } finally {
52
+ await file.close();
53
+ }
54
+ if (bytes !== pin.archiveBytes || digest.digest('hex') !== pin.archiveSha256)
55
+ throw Error('OJ archive integrity failed.');
56
+ // Extract exactly one member to memory; archive paths never choose filesystem targets.
57
+ const executable = execFileSync('tar', ['-xOzf', archive, 'oj'], {
58
+ maxBuffer: 256 * 1024 * 1024,
59
+ });
60
+ if (executable.length !== pin.binaryBytes || hash(executable) !== pin.binarySha256)
61
+ throw Error('OJ executable integrity failed.');
62
+ const output = await open(temporary, 'wx', 0o755);
63
+ try {
64
+ await output.writeFile(executable);
65
+ } finally {
66
+ await output.close();
67
+ }
68
+ await rename(temporary, binary);
69
+ } finally {
70
+ await rm(temporary, { force: true });
71
+ await rm(archive, { force: true });
72
+ }
73
+ }
74
+ const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit', env: process.env });
75
+ for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) process.on(signal, () => child.kill(signal));
76
+ child.on('error', (error) => {
77
+ console.error(error.message);
78
+ process.exitCode = 1;
79
+ });
80
+ child.on('exit', (code, signal) => {
81
+ process.exitCode = signal ? 128 + (constants.signals[signal] ?? 1) : (code ?? 1);
82
+ });
@@ -0,0 +1,21 @@
1
+ {
2
+ "version": "0.4.0",
3
+ "repository": "https://github.com/lovablelabs/oj",
4
+ "sourceRevision": "40837765296064f5411bc48d1cd6afb1069e77c8",
5
+ "targets": {
6
+ "linux-x64": {
7
+ "asset": "oj-x86_64-unknown-linux-gnu.tar.gz",
8
+ "archiveBytes": 66040061,
9
+ "archiveSha256": "bef564eebb4c3f06fe264e2ed86ead197f54d2d43a7d56c29c81fe1a4151bf46",
10
+ "binaryBytes": 195888592,
11
+ "binarySha256": "e277cf0449affba28f42981d0588a5084d5e50c392713729a58825c7cb8620c7"
12
+ },
13
+ "darwin-arm64": {
14
+ "asset": "oj-aarch64-apple-darwin.tar.gz",
15
+ "archiveBytes": 60678688,
16
+ "archiveSha256": "953ce529e9a7ed69ea1fefbb698875fb615fa5a7d031366655b6fcbfcada1313",
17
+ "binaryBytes": 171043184,
18
+ "binarySha256": "4ca43edac2be0cc729f5b83887de040772a11a161d55de4cad1b8ed3529ca506"
19
+ }
20
+ }
21
+ }
@@ -1,7 +1,7 @@
1
1
  import { starterTitle } from '../starter';
2
2
  import { createRootRoute, HeadContent, Link, Outlet, Scripts } from '@tanstack/react-router';
3
3
  import type { ReactNode } from 'react';
4
- import styles from '../styles.css?url';
4
+ import '../styles.css';
5
5
 
6
6
  export const Route = createRootRoute({
7
7
  head: () => ({
@@ -11,7 +11,6 @@ export const Route = createRootRoute({
11
11
  { title: starterTitle },
12
12
  { name: 'description', content: 'Anhedral web application' },
13
13
  ],
14
- links: [{ rel: 'stylesheet', href: styles }],
15
14
  }),
16
15
  component: Root,
17
16
  notFoundComponent: () => <section className="stack"><h1>Page not found</h1><Link to="/">Return home</Link></section>,
@@ -1,6 +1,8 @@
1
- import handler from '@tanstack/react-start/server-entry';
1
+ import { createStartHandler, defaultStreamHandler } from '@tanstack/react-start/server';
2
2
  import { proxyApi } from './lib/api-proxy';
3
3
 
4
+ const handler = createStartHandler(defaultStreamHandler);
5
+
4
6
  export default {
5
7
  fetch(request: Request, bindings: Env) {
6
8
  const pathname = new URL(request.url).pathname;
@@ -8,6 +10,6 @@ export default {
8
10
  return proxyApi(request, { binding: bindings.ANHEDRAL_API, development: false });
9
11
  }
10
12
  // Start retains this server-owned capability only inside the current request.
11
- return handler.fetch(request, { context: { api: bindings.ANHEDRAL_API } });
13
+ return handler(request, { context: { api: bindings.ANHEDRAL_API } });
12
14
  },
13
15
  } satisfies ExportedHandler<Env>;