@intentic/constants 1.310.0 → 1.311.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.
package/README.md CHANGED
@@ -1,77 +1,36 @@
1
- # @intentic/constants
2
-
3
- The ports, paths and image references the daemon, the CLIs and the desktop app all have to agree on.
4
-
5
- ## Responsibilities
6
-
7
- - Name every shared constant once, so no two programs can disagree about where something is.
8
- - Find the monorepo root, and a package's own root, by looking for them rather than by counting directories.
1
+ # constants
2
+
3
+ The values several packages must agree on (ports, workspace paths, origins, install-script URLs, the sign-in client id, the hosted price ladder), defined once so no copy drifts.
4
+
5
+ ```mermaid
6
+ flowchart LR
7
+ c(["constants"])
8
+ c -->|"index: browser-safe values"| web["Web app · public site"]
9
+ c -->|"index"| daemon["Daemon · platform api · CLIs"]
10
+ c -->|"./node: repoRoot"| scripts["Scripts, configs,<br/>dev servers"]
11
+ c -->|"plain .mjs tables"| gates["_tools/checks · push gate<br/>daemon's own checks"]
12
+ ```
13
+
14
+ - The index has no Node imports, so the web app and the public site bundle the same values the daemon reads.
15
+ It also carries the provider logos, the arrival profiles (`profile.ts`) and the hosted machine ladder
16
+ (`hosted-tiers.ts`), whose prices the site, the Billing page and the platform config all state.
17
+ - `./node` holds `repoRoot` and `packageRoot`, which find the monorepo by walking up to `pnpm-workspace.yaml`
18
+ instead of counting `../..`. The `paths` check refuses counted roots.
19
+ - The `.mjs` modules (`control-bytes`, `contract-shrink`, `assertion-measure`, `mirror-roots`, `test-suites`,
20
+ `vocabulary`, `ci-infra-steps`) are plain JavaScript with `.d.mts` types, so the checks and the push gate import
21
+ them by path before any install or build, and the daemon applies the same rule from the same file.
22
+ - `WORKSPACE_ROOT` and `HISTORY_ROOT` are defaults only: a running daemon reads its real roots from config.
9
23
 
10
24
  ## Key files
11
25
 
12
- - [src/index.ts](src/index.ts), the constants themselves: ports, the fixed directory layouts, legal and origin
13
- values, and the install-script table. Isomorphic, imported by browser code, so nothing here may touch `node:fs`.
14
- - [src/profile.ts](src/profile.ts): who is arriving — the profile a link from the site names, the localStorage
15
- keys it seeds, and the look each one asks for. Here because the app applies it from an inline `<head>` script
16
- that runs before any module and so cannot import anything; `_editor/web/src/bootProfile.test.ts` reads that
17
- script back and fails if it has parted from this table. The site and the platform import it directly.
18
- - [src/node.mjs](src/node.mjs): `repoRoot()` and `packageRoot()`, behind the `@intentic/constants/node`
19
- subpath. Node-only, and hand-written JavaScript rather than compiled TypeScript.
20
- - [src/assertion-measure.mjs](src/assertion-measure.mjs), [src/contract-shrink.mjs](src/contract-shrink.mjs),
21
- [src/control-bytes.mjs](src/control-bytes.mjs), [src/mirror-roots.mjs](src/mirror-roots.mjs) and
22
- [src/ci-infra-steps.mjs](src/ci-infra-steps.mjs): the five judgments the repository's scripts and checks
23
- (`_tools/checks/`, `_tools/scripts/ci/ci-audit.mjs`) and the daemon both make, kept as one copy each.
24
- Hand-written JavaScript for the same reason `node.mjs` is: a gate that runs before `pnpm install` imports them
25
- by relative path, and the daemon imports them as subpaths of this package. `assertion-measure.mjs` carries
26
- three of them, not one: which files are test files (`TEST_FILE`), how strong a TypeScript file's assertions
27
- are, and how strong a python file's are.
28
-
29
- ## How it fits
30
-
31
- The bottom of the dependency graph: it imports nothing and almost everything imports it. That is also what
32
- makes it the home of the few pure judgments a pre-install script and the daemon have to share: anything else
33
- they could both import would need an install to resolve. `mirror-roots.mjs` is the clearest case of that: the
34
- set of directories an isolated turn overlays is the daemon's business (`agents/isolation.ts` mounts them), and
35
- whether a build script may `rm -rf` one of them is a checkout gate's business, and the two answers have to be
36
- the same answer or a name added to one is a directory the other stops protecting. `assertion-measure.mjs` is
37
- the same shape of problem one level up: the push gate refuses an undeclared weakening and the daemon reports one
38
- at the Stop, so if the two disagreed about which files are tests, or about what a python `assert` is worth, a
39
- file could be measured by one and ignored by the other while both claimed to hold the same line. A port number that lives
40
- in two files is a port number that will eventually be two different numbers, which is the entire argument for
41
- this package existing. The same argument covers the directory layouts: `/work`, `/history`, `.intentic`,
42
- `/opt/intentic`: which were previously typed out by hand across dozens of files with nothing linking the copies.
43
-
44
- The two root-finders answer the other half of that problem. Code used to locate the repo root by counting how
45
- deep it sat (`../..`, `../../..`, `../../../..`), a number correct only for the file's current depth and checked
46
- by nothing. Walking up to a marker has no such coupling, so a file can move anywhere and still resolve.
26
+ - [src/index.ts](src/index.ts) — ports, workspace paths, origins, install scripts and the Google client id.
27
+ - [src/node.mjs](src/node.mjs) — `repoRoot` and `packageRoot`, the found-not-counted roots.
28
+ - [src/hosted-tiers.ts](src/hosted-tiers.ts) — every hosted machine rung, what it costs to run and what it sells for.
29
+ - [src/profile.ts](src/profile.ts) — the named arrival profiles the site, the app and the platform share.
30
+ - [src/vocabulary.mjs](src/vocabulary.mjs) — the words this repository retired and what each became.
47
31
 
48
- ## Conventions & gotchas
32
+ ## Commands
49
33
 
50
- - If a constant is used by exactly one package, it belongs in that package. This is for the ones that cross a
51
- boundary.
52
- - `INSTALL_SCRIPTS` is the vanity path → asset table for `intentic.dev/connect` and its siblings, and it crosses
53
- the widest boundary in here: the **app** writes those URLs into the one-liners it hands out, the **site
54
- worker** is what answers them, and the **site's own pages** link to them so a reader can check a script before
55
- running it. Three hand-synced lists in three packages meant a renamed script served the site's 404 page into
56
- somebody's `sh`. Use `installScriptUrl()` / `installScriptPath()` rather than joining the parts: two vanity
57
- paths (`/rebuild`, `/update`) deliberately serve one script, so neither half is derivable from the other.
58
- - `src/node.mjs` is plain JavaScript with a hand-written `.d.mts` **on purpose**. Its earliest callers run before
59
- anything is built (the prepass is what performs the build, and the byte and path checks run ahead of it) so a
60
- helper importable only from `dist/` is one they cannot import at all, which is how a second copy of the walk
61
- gets written. It is also why the root `package.json` depends on this package: without that link, scripts under
62
- `_tools/scripts/` cannot resolve it by name.
63
- - **The name only resolves once `pnpm install` has run**, because a bare specifier is looked up through
64
- `node_modules`. The two callers that run before any install: `_tools/checks/run.mjs`, which the `pre-push`
65
- hook and the CI `preflight` job invoke on a bare checkout: therefore import `../constants/src/node.mjs` by
66
- path. Same file, same single copy of the walk, no install required. Everything that runs after the install
67
- imports it by name.
68
- - **Extensions cannot import this package**: the boundary rule (`.oxlintrc.json`, `_extensions/README.md`) allows
69
- them only the SDK halves and `@intentic/sandbox-contract`, so an extension can't couple itself to app or engine
70
- internals. That rule stands; the contract package re-exports the four layout constants so extensions can still
71
- name a location instead of spelling it. One definition, reached by two paths.
72
- - `WORKSPACE_ROOT` and `HISTORY_ROOT` are **defaults, not laws**. The daemon takes both as overridable config and
73
- an isolated turn re-points them, so code holding a `Config` must read the config value. The constants are what
74
- that config defaults to, and what code with no config in reach can still name correctly.
75
- - Prefer the daemon's own `statePath()` over joining `STATE_DIR` by hand wherever it is reachable: it is typed
76
- against the table of state files, so it catches a name the table doesn't declare. `STATE_DIR` is for callers
77
- outside that table.
34
+ ```sh
35
+ pnpm --filter @intentic/constants test
36
+ ```
package/dist/profile.d.ts CHANGED
@@ -2,7 +2,7 @@ export declare const PROFILE_PARAM = "profile";
2
2
  export declare const PROFILE_STORAGE_KEY = "ui-profile";
3
3
  export declare const PROFILE_COOKIE = "variant";
4
4
  export declare const sharedCookieDomain: (originA: string, originB: string) => string | undefined;
5
- export declare const PROFILE_IDS: readonly ["default", "maker"];
5
+ export declare const PROFILE_IDS: readonly ["default", "desk"];
6
6
  export type Profile = (typeof PROFILE_IDS)[number];
7
7
  export type ProfileScheme = "system" | "light" | "dark";
8
8
  export type ProfileSkin = "system" | "none" | "sanctum";
@@ -1 +1 @@
1
- {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,aAAa,YAAY,CAAC;AAGvC,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAQhD,eAAO,MAAM,cAAc,YAAY,CAAC;AAMxC,eAAO,MAAM,kBAAkB,YAAa,MAAM,WAAW,MAAM,KAAG,MAAM,GAAG,SAa9E,CAAC;AAGF,eAAO,MAAM,WAAW,YAAI,SAA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C;AACxD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AACxD,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,OAAO,CAAC;AAGpD,eAAO,MAAM,YAAY;aAErB,MAAM,EAAE,iBAAiB;aAEzB,IAAI,EAAE,SAAS;aAEf,QAAQ,EAAE,aAAa;CACjB,CAAC;AAEX,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC;CACvC;AAID,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,WAAW,CAGjD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,OAAmB,CAAC;AAElD,eAAO,MAAM,SAAS,UAAW,OAAO,KAAG,KAAK,IAAI,OAAiD,CAAC"}
package/dist/profile.js CHANGED
@@ -14,7 +14,7 @@ export const sharedCookieDomain = (originA, originB) => {
14
14
  }
15
15
  return shared.length >= 2 && shared.every((label) => !/^\d+$/u.test(label)) ? shared.join(".") : undefined;
16
16
  };
17
- export const PROFILE_IDS = ["default", "maker"];
17
+ export const PROFILE_IDS = ["default", "desk"];
18
18
  export const PROFILE_KEYS = {
19
19
  scheme: "ui-color-scheme",
20
20
  skin: "ui-skin",
@@ -22,7 +22,7 @@ export const PROFILE_KEYS = {
22
22
  };
23
23
  export const PROFILES = {
24
24
  default: { scheme: "system", skin: "system" },
25
- maker: { scheme: "light", skin: "none", audience: "maker" },
25
+ desk: { scheme: "light", skin: "none", audience: "maker" },
26
26
  };
27
27
  export const DEFAULT_PROFILE = "default";
28
28
  export const isProfile = (value) => PROFILE_IDS.includes(value);
@@ -1 +1 @@
1
- {"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;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CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAY,CAAC,CAAC;QAClC,CAAC,CAAC,GAAG,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/G,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,MAAM,CAAU,CAAC;AAWxD,MAAM,CAAC,MAAM,YAAY,GAAG;IAExB,MAAM,EAAE,iBAAiB;IAEzB,IAAI,EAAE,SAAS;IAEf,QAAQ,EAAE,aAAa;CACjB,CAAC;AAWX,MAAM,CAAC,MAAM,QAAQ,GAAiC;IAClD,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC7C,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE;CAC7D,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAY,SAAS,CAAC;AAElD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAoB,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAgB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentic/constants",
3
- "version": "1.310.0",
3
+ "version": "1.311.0",
4
4
  "description": "Shared constants for the intentic packages, ports, paths, and image references the daemon, CLIs and desktop app all agree on",
5
5
  "license": "MIT",
6
6
  "type": "module",