@amalgm/core 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 (87) hide show
  1. package/PURPOSE.md +94 -0
  2. package/README.md +30 -0
  3. package/dist/adapters/index.d.ts +13 -0
  4. package/dist/adapters/index.d.ts.map +1 -0
  5. package/dist/adapters/index.js +11 -0
  6. package/dist/adapters/index.js.map +1 -0
  7. package/dist/identity/auth-records.d.ts +147 -0
  8. package/dist/identity/auth-records.d.ts.map +1 -0
  9. package/dist/identity/auth-records.js +354 -0
  10. package/dist/identity/auth-records.js.map +1 -0
  11. package/dist/identity/ids.d.ts +57 -0
  12. package/dist/identity/ids.d.ts.map +1 -0
  13. package/dist/identity/ids.js +80 -0
  14. package/dist/identity/ids.js.map +1 -0
  15. package/dist/identity/index.d.ts +14 -0
  16. package/dist/identity/index.d.ts.map +1 -0
  17. package/dist/identity/index.js +14 -0
  18. package/dist/identity/index.js.map +1 -0
  19. package/dist/identity/labels.d.ts +115 -0
  20. package/dist/identity/labels.d.ts.map +1 -0
  21. package/dist/identity/labels.js +154 -0
  22. package/dist/identity/labels.js.map +1 -0
  23. package/dist/identity/layout.d.ts +188 -0
  24. package/dist/identity/layout.d.ts.map +1 -0
  25. package/dist/identity/layout.js +233 -0
  26. package/dist/identity/layout.js.map +1 -0
  27. package/dist/identity/ports.d.ts +31 -0
  28. package/dist/identity/ports.d.ts.map +1 -0
  29. package/dist/identity/ports.js +9 -0
  30. package/dist/identity/ports.js.map +1 -0
  31. package/dist/identity/product-state.d.ts +49 -0
  32. package/dist/identity/product-state.d.ts.map +1 -0
  33. package/dist/identity/product-state.js +55 -0
  34. package/dist/identity/product-state.js.map +1 -0
  35. package/dist/index.d.ts +19 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +19 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/supervision/app-health.d.ts +148 -0
  40. package/dist/supervision/app-health.d.ts.map +1 -0
  41. package/dist/supervision/app-health.js +165 -0
  42. package/dist/supervision/app-health.js.map +1 -0
  43. package/dist/supervision/app-restart.d.ts +105 -0
  44. package/dist/supervision/app-restart.d.ts.map +1 -0
  45. package/dist/supervision/app-restart.js +97 -0
  46. package/dist/supervision/app-restart.js.map +1 -0
  47. package/dist/supervision/health.d.ts +218 -0
  48. package/dist/supervision/health.d.ts.map +1 -0
  49. package/dist/supervision/health.js +227 -0
  50. package/dist/supervision/health.js.map +1 -0
  51. package/dist/supervision/index.d.ts +17 -0
  52. package/dist/supervision/index.d.ts.map +1 -0
  53. package/dist/supervision/index.js +17 -0
  54. package/dist/supervision/index.js.map +1 -0
  55. package/dist/supervision/service-registration.d.ts +343 -0
  56. package/dist/supervision/service-registration.d.ts.map +1 -0
  57. package/dist/supervision/service-registration.js +543 -0
  58. package/dist/supervision/service-registration.js.map +1 -0
  59. package/dist/supervision/update.d.ts +231 -0
  60. package/dist/supervision/update.d.ts.map +1 -0
  61. package/dist/supervision/update.js +336 -0
  62. package/dist/supervision/update.js.map +1 -0
  63. package/dist/transport/admission.d.ts +235 -0
  64. package/dist/transport/admission.d.ts.map +1 -0
  65. package/dist/transport/admission.js +313 -0
  66. package/dist/transport/admission.js.map +1 -0
  67. package/dist/transport/auth.d.ts +232 -0
  68. package/dist/transport/auth.d.ts.map +1 -0
  69. package/dist/transport/auth.js +266 -0
  70. package/dist/transport/auth.js.map +1 -0
  71. package/dist/transport/index.d.ts +21 -0
  72. package/dist/transport/index.d.ts.map +1 -0
  73. package/dist/transport/index.js +21 -0
  74. package/dist/transport/index.js.map +1 -0
  75. package/dist/transport/ingress.d.ts +94 -0
  76. package/dist/transport/ingress.d.ts.map +1 -0
  77. package/dist/transport/ingress.js +171 -0
  78. package/dist/transport/ingress.js.map +1 -0
  79. package/dist/transport/routing.d.ts +235 -0
  80. package/dist/transport/routing.d.ts.map +1 -0
  81. package/dist/transport/routing.js +288 -0
  82. package/dist/transport/routing.js.map +1 -0
  83. package/dist/transport/shipped-routes.d.ts +21 -0
  84. package/dist/transport/shipped-routes.d.ts.map +1 -0
  85. package/dist/transport/shipped-routes.js +53 -0
  86. package/dist/transport/shipped-routes.js.map +1 -0
  87. package/package.json +51 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-records.js","sourceRoot":"","sources":["../../src/identity/auth-records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAKpD,MAAM,MAAM,GAAG,CAAC,KAAc,EAAe,EAAE,CAC7C,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAE,KAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAEhE,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACvE,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AAC1C,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,mBAAmB,CAAC,MAAe;IACjD,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACzB,OAAO,kBAAkB,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AACnF,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC;IAC/D,cAAc;IACd,qBAAqB;IACrB,aAAa;IACb,wBAAwB;IACxB,wBAAwB;IACxB,0BAA0B;IAC1B,YAAY;IACZ,qBAAqB;IACrB,YAAY;IACZ,WAAW;CACZ,CA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,EAAE,CAAC;QACjB,WAAW,EAAE,UAAU;QACvB,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACjE,UAAU,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,EAAE;eAC3D,WAAW,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,EAAE;eAC5C,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,EAAE;QAC/C,OAAO,EAAE,MAAM;QACf,KAAK,EAAE;YACL,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC;YACrB,KAAK,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,CAAC,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC;YACpF,UAAU,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,wBAAwB,CAAC,IAAI,UAAU,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,SAAS;YACzG,UAAU,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,wBAAwB,CAAC,CAAC,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC,YAAY,CAAC,CAAC;YACzG,YAAY,EAAE,GAAG;SAClB;QACD,UAAU,EAAE,GAAG;KAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Identity minting and validation laws — the shapes of the ids a machine
3
+ * proves itself with: computer UUIDs, device ids, runtime instance ids,
4
+ * the unenrolled fallback, and setup codes.
5
+ */
6
+ import type { ResolvePathPort, Sha256HexPort } from './ports.js';
7
+ /**
8
+ * The enrolled-computer id law (engine
9
+ * runtime/scripts/amalgm-mcp/lib/computer.js:12): a classic RFC-4122 UUID,
10
+ * versions 1-5, variant 89ab. TWO DIFFERENT LAWS share this street:
11
+ * @amalgm/live's entity UUID_PATTERN admits versions 1-8 — an entity may be
12
+ * minted as a modern v7 — while a computer id stays the platform-minted
13
+ * classic shape. Do not unify them.
14
+ */
15
+ export declare const COMPUTER_UUID_PATTERN: RegExp;
16
+ /** Is this a computer id? (computer.js:18-20). Non-strings and blank
17
+ * strings are simply not ids; surrounding whitespace is forgiven. */
18
+ export declare function isUuid(value: unknown): boolean;
19
+ /**
20
+ * The identity of one runtime installation directory (engine
21
+ * packages/amalgm/lib/runtime-identity.js:148-154): sha256 of the RESOLVED
22
+ * directory path, first 16 hex chars. Resolution matters — two spellings
23
+ * of the same directory are the same instance — so the path resolver is a
24
+ * named port, not an ambient reach for the cwd.
25
+ */
26
+ export declare function runtimeInstanceIdForDir(dir: unknown, ports: Sha256HexPort & ResolvePathPort): string;
27
+ /** The device-id format the npm CLI mints (engine
28
+ * packages/amalgm/lib/cli.js:326-329): `npm-<uuid>`, marking the minting
29
+ * surface in the id itself. */
30
+ export declare function npmDeviceId(uuid: string): string;
31
+ /** A stored device id is usable when it is a string of at least 8 chars
32
+ * (cli.js:301,314) — the CLI's scavenging accepts legacy ids from other
33
+ * surfaces, so the validator is deliberately about length, not prefix. */
34
+ export declare function isUsableDeviceId(value: unknown): value is string;
35
+ /**
36
+ * The machine id of a never-enrolled machine (engine
37
+ * runtime/scripts/amalgm-mcp/workspace/identity.js:44):
38
+ * `unenrolled:<hostname>` — a VISIBLY local identity, so an unenrolled
39
+ * machine can never be mistaken for a platform-known computer id.
40
+ */
41
+ export declare function unenrolledMachineId(hostname: string): string;
42
+ /** A setup code is exactly 16 significant characters (cli.js:77). */
43
+ export declare const SETUP_CODE_LENGTH = 16;
44
+ /** Normalize a typed setup code (cli.js:290-292): uppercase, strip
45
+ * everything outside A-Z0-9, keep the first 16 — so dashes, spaces, and
46
+ * overtyping never fail a correct code. */
47
+ export declare function normalizeSetupCode(value: unknown): string;
48
+ /** Display form (cli.js:294-297): the normalized code regrouped in fours,
49
+ * joined with dashes — `ABCD-EFGH-JKLM-NPQR`. Empty input displays as ''. */
50
+ export declare function formatSetupCode(value: unknown): string;
51
+ /**
52
+ * A redeemable setup code is the full 16 characters (cli.js:545-548).
53
+ * Returns the normalized code; the refusal is the ratified string the CLI
54
+ * shows a mistyped code.
55
+ */
56
+ export declare function assertSetupCode(value: unknown): string;
57
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/identity/ids.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEjE;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,QAC4C,CAAC;AAM/E;qEACqE;AACrE,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE9C;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,aAAa,GAAG,eAAe,GACrC,MAAM,CAER;AAED;;+BAE+B;AAC/B,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;0EAE0E;AAC1E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEhE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,qEAAqE;AACrE,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;2CAE2C;AAC3C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEzD;AAED;6EAC6E;AAC7E,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAGtD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMtD"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Identity minting and validation laws — the shapes of the ids a machine
3
+ * proves itself with: computer UUIDs, device ids, runtime instance ids,
4
+ * the unenrolled fallback, and setup codes.
5
+ */
6
+ /**
7
+ * The enrolled-computer id law (engine
8
+ * runtime/scripts/amalgm-mcp/lib/computer.js:12): a classic RFC-4122 UUID,
9
+ * versions 1-5, variant 89ab. TWO DIFFERENT LAWS share this street:
10
+ * @amalgm/live's entity UUID_PATTERN admits versions 1-8 — an entity may be
11
+ * minted as a modern v7 — while a computer id stays the platform-minted
12
+ * classic shape. Do not unify them.
13
+ */
14
+ export const COMPUTER_UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
15
+ function nonEmptyString(value) {
16
+ return typeof value === 'string' && value.trim() ? value.trim() : '';
17
+ }
18
+ /** Is this a computer id? (computer.js:18-20). Non-strings and blank
19
+ * strings are simply not ids; surrounding whitespace is forgiven. */
20
+ export function isUuid(value) {
21
+ return COMPUTER_UUID_PATTERN.test(nonEmptyString(value));
22
+ }
23
+ /**
24
+ * The identity of one runtime installation directory (engine
25
+ * packages/amalgm/lib/runtime-identity.js:148-154): sha256 of the RESOLVED
26
+ * directory path, first 16 hex chars. Resolution matters — two spellings
27
+ * of the same directory are the same instance — so the path resolver is a
28
+ * named port, not an ambient reach for the cwd.
29
+ */
30
+ export function runtimeInstanceIdForDir(dir, ports) {
31
+ return ports.sha256Hex(ports.resolvePath(String(dir || ''))).slice(0, 16);
32
+ }
33
+ /** The device-id format the npm CLI mints (engine
34
+ * packages/amalgm/lib/cli.js:326-329): `npm-<uuid>`, marking the minting
35
+ * surface in the id itself. */
36
+ export function npmDeviceId(uuid) {
37
+ return `npm-${uuid}`;
38
+ }
39
+ /** A stored device id is usable when it is a string of at least 8 chars
40
+ * (cli.js:301,314) — the CLI's scavenging accepts legacy ids from other
41
+ * surfaces, so the validator is deliberately about length, not prefix. */
42
+ export function isUsableDeviceId(value) {
43
+ return typeof value === 'string' && value.length >= 8;
44
+ }
45
+ /**
46
+ * The machine id of a never-enrolled machine (engine
47
+ * runtime/scripts/amalgm-mcp/workspace/identity.js:44):
48
+ * `unenrolled:<hostname>` — a VISIBLY local identity, so an unenrolled
49
+ * machine can never be mistaken for a platform-known computer id.
50
+ */
51
+ export function unenrolledMachineId(hostname) {
52
+ return `unenrolled:${hostname}`;
53
+ }
54
+ /** A setup code is exactly 16 significant characters (cli.js:77). */
55
+ export const SETUP_CODE_LENGTH = 16;
56
+ /** Normalize a typed setup code (cli.js:290-292): uppercase, strip
57
+ * everything outside A-Z0-9, keep the first 16 — so dashes, spaces, and
58
+ * overtyping never fail a correct code. */
59
+ export function normalizeSetupCode(value) {
60
+ return String(value || '').toUpperCase().replace(/[^A-Z0-9]/g, '').slice(0, SETUP_CODE_LENGTH);
61
+ }
62
+ /** Display form (cli.js:294-297): the normalized code regrouped in fours,
63
+ * joined with dashes — `ABCD-EFGH-JKLM-NPQR`. Empty input displays as ''. */
64
+ export function formatSetupCode(value) {
65
+ const normalized = normalizeSetupCode(value);
66
+ return normalized.match(/.{1,4}/g)?.join('-') || '';
67
+ }
68
+ /**
69
+ * A redeemable setup code is the full 16 characters (cli.js:545-548).
70
+ * Returns the normalized code; the refusal is the ratified string the CLI
71
+ * shows a mistyped code.
72
+ */
73
+ export function assertSetupCode(value) {
74
+ const normalized = normalizeSetupCode(value);
75
+ if (normalized.length !== SETUP_CODE_LENGTH) {
76
+ throw new Error('Invalid setup code. It should look like ABCD-EFGH-JKLM-NPQR.');
77
+ }
78
+ return normalized;
79
+ }
80
+ //# sourceMappingURL=ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/identity/ids.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAChC,4EAA4E,CAAC;AAE/E,SAAS,cAAc,CAAC,K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AAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC7C,OAAO,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,MAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,UAAU,CAAC,MAAM,KAAK,iBAAiB,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAClF,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * IDENTITY — who this machine is, for which user, on which branch (axiom 2:
3
+ * identity is one story). The pure laws behind `~/amalgm` layout, runtime
4
+ * labels and channels, id minting/validation, and credential-record
5
+ * shaping. Every effect (hash, random, clock, path resolution, env) arrives
6
+ * as an injected port from `./ports.js`.
7
+ */
8
+ export * from './ports.js';
9
+ export * from './labels.js';
10
+ export * from './layout.js';
11
+ export * from './product-state.js';
12
+ export * from './ids.js';
13
+ export * from './auth-records.js';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * IDENTITY — who this machine is, for which user, on which branch (axiom 2:
3
+ * identity is one story). The pure laws behind `~/amalgm` layout, runtime
4
+ * labels and channels, id minting/validation, and credential-record
5
+ * shaping. Every effect (hash, random, clock, path resolution, env) arrives
6
+ * as an injected port from `./ports.js`.
7
+ */
8
+ export * from './ports.js';
9
+ export * from './labels.js';
10
+ export * from './layout.js';
11
+ export * from './product-state.js';
12
+ export * from './ids.js';
13
+ export * from './auth-records.js';
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Runtime label + channel laws — which branch of Amalgm a process runs AS,
3
+ * and which cloud infrastructure it talks TO.
4
+ *
5
+ * The engine keeps TWO different partitions of the same raw input, and both
6
+ * are load-bearing:
7
+ *
8
+ * 1. The LABEL partition ({@link normalizeRuntimeLabel} and its coercing
9
+ * twin {@link coerceRuntimeLabel}): `main | preview | local` — the
10
+ * identity that scopes state under `runtimes/<label>/` and decides which
11
+ * computer records may bind to this process.
12
+ * 2. The INFRA partition ({@link usesPreviewInfraDefaults}): main infra vs
13
+ * preview infra. Here `local`/`dev`/`development` land on the PREVIEW
14
+ * side — a development build must never default onto production
15
+ * endpoints, even though its label is `local`, not `preview`.
16
+ *
17
+ * `dev` is the input that convicts any conflation of the two: label
18
+ * `local`, infra `preview`.
19
+ */
20
+ export type RuntimeLabel = 'main' | 'preview' | 'local';
21
+ /** The three runtime identities a process may run as
22
+ * (engine packages/amalgm/lib/runtime-identity.js:10). */
23
+ export declare const VALID_RUNTIME_LABELS: ReadonlySet<RuntimeLabel>;
24
+ /**
25
+ * The CLI's label law (engine packages/amalgm/lib/runtime-identity.js:12-19):
26
+ * fold the alias vocabulary onto the three labels, and return `''` for
27
+ * anything unrecognized. The empty string is the point — the CLI layers
28
+ * fallbacks (env chain, then version sniffing via
29
+ * {@link runtimeLabelFromVersion}), so "no answer" must stay expressible.
30
+ * A booted runtime that needs an unconditional answer uses
31
+ * {@link coerceRuntimeLabel} instead.
32
+ */
33
+ export declare function normalizeRuntimeLabel(value: unknown): RuntimeLabel | '';
34
+ /**
35
+ * The runtime's label law (engine runtime/scripts/amalgm-mcp/config.js:119-124,
36
+ * repeated verbatim in runtime/scripts/lib/runtime-paths.js:7-12,
37
+ * runtime/scripts/amalgm-mcp/apps/advertise.js:25-30 and
38
+ * runtime/scripts/proxy-token-store.js:56-61): the same alias folding, but a
39
+ * running process must have SOME label, so everything unrecognized —
40
+ * including the empty string — is `main`. The two functions agree on every
41
+ * named alias and disagree only on garbage: `normalizeRuntimeLabel('x')` is
42
+ * `''`, `coerceRuntimeLabel('x')` is `'main'`.
43
+ */
44
+ export declare function coerceRuntimeLabel(value: unknown): RuntimeLabel;
45
+ /**
46
+ * A label that reaches state paths must already be one of the three
47
+ * (engine runtime-identity.js:38-43). The error text is the ratified string
48
+ * the CLI's exams pin.
49
+ */
50
+ export declare function assertRuntimeLabel(label: string): RuntimeLabel;
51
+ /**
52
+ * Which git branch a runtime tracks (engine runtime-identity.js:45-50).
53
+ * An explicit branch wins when it normalizes to a real branch (`main` or
54
+ * `preview` — `local` is a label, never a branch); otherwise the label
55
+ * decides: preview tracks preview, everything else tracks main.
56
+ * Pure over the would-be `AMALGM_BRANCH` value instead of reading env.
57
+ */
58
+ export declare function runtimeBranchForLabel(label: string, envBranch?: unknown): 'main' | 'preview';
59
+ /**
60
+ * Which npm dist-tag an installation updates from (engine
61
+ * runtime-identity.js:52-57). Releases are promoted deliberately to `main`;
62
+ * `latest` is retained only as the public compatibility channel and may lag
63
+ * the runtime we boot, so a main installation must update from the channel
64
+ * it actually runs. NOTE: `main` here is an UNCOMMITTED engine change from
65
+ * the previous `latest` — the new behavior is the law being ported.
66
+ */
67
+ export declare function npmTagForRuntimeLabel(label: string): 'canary' | 'main';
68
+ /**
69
+ * Sniff the runtime label from a package version (engine
70
+ * runtime-identity.js:21-24): a recognized prerelease token means
71
+ * `preview`; the ABSENCE of one means `main`. This is the terminal
72
+ * fallback after the env chain returns nothing.
73
+ */
74
+ export declare function runtimeLabelFromVersion(version: unknown): 'main' | 'preview';
75
+ /** The raw inputs the infra partition reads, in engine precedence order:
76
+ * AMALGM_RUNTIME_LABEL, then AMALGM_CHANNEL, then AMALGM_BRANCH. */
77
+ export interface RuntimeChannelInput {
78
+ readonly label?: unknown;
79
+ readonly channel?: unknown;
80
+ readonly branch?: unknown;
81
+ }
82
+ /**
83
+ * The INFRA partition (engine runtime/scripts/amalgm-mcp/config.js:61-69,
84
+ * repeated in runtime/scripts/proxy-token-store.js:7-15): does this process
85
+ * default onto preview infrastructure (api/apps/gateway `*.preview.amalgm.ai`)?
86
+ * A DIFFERENT partition from {@link normalizeRuntimeLabel} over the same
87
+ * input: the preview-infra set additionally contains `local`/`dev`/
88
+ * `development`, and it matches the RAW input, not the folded label —
89
+ * `master` or `latest` fall to main infra without being renamed `main`.
90
+ * Pure over `{label, channel, branch}`; the engine reads the env vars named
91
+ * on {@link RuntimeChannelInput} in exactly this order.
92
+ */
93
+ export declare function usesPreviewInfraDefaults({ label, channel, branch }: RuntimeChannelInput): boolean;
94
+ /** A stored record naming the runtime it belongs to, by any of its three
95
+ * historical key spellings. Precedence: runtime_label > label > branch. */
96
+ export interface RuntimeLabeledRecord {
97
+ readonly runtime_label?: unknown;
98
+ readonly label?: unknown;
99
+ readonly branch?: unknown;
100
+ }
101
+ /**
102
+ * May this stored record bind to the runtime labeled `currentLabel`?
103
+ * (engine runtime/scripts/amalgm-mcp/apps/advertise.js:32-36). The record's
104
+ * claim is read with key precedence runtime_label > label > branch, coerced
105
+ * by the runtime law, and must equal the current label exactly.
106
+ *
107
+ * DELIBERATE DEVIATION: the engine follows the coercion with
108
+ * `if (!label) return AMALGM_RUNTIME_LABEL === 'main'` — unreachable,
109
+ * because its coercing normalizer never returns `''`. That branch is
110
+ * dropped here. The reachable form of the absent-label rule lives in
111
+ * `recordMatchesCurrentRuntime` (auth-records.ts), whose normalizer CAN
112
+ * return `''`.
113
+ */
114
+ export declare function recordMatchesRuntime(record: RuntimeLabeledRecord | null | undefined, currentLabel: RuntimeLabel): boolean;
115
+ //# sourceMappingURL=labels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/identity/labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAExD;0DAC0D;AAC1D,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,YAAY,CAIzD,CAAC;AAMH;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,EAAE,CAOvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAK/D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAK9D;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAK5F;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAEtE;AAMD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAG5E;AAED;oEACoE;AACpE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAGjG;AAED;2EAC2E;AAC3E,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,oBAAoB,GAAG,IAAI,GAAG,SAAS,EAC/C,YAAY,EAAE,YAAY,GACzB,OAAO,CAGT"}
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Runtime label + channel laws — which branch of Amalgm a process runs AS,
3
+ * and which cloud infrastructure it talks TO.
4
+ *
5
+ * The engine keeps TWO different partitions of the same raw input, and both
6
+ * are load-bearing:
7
+ *
8
+ * 1. The LABEL partition ({@link normalizeRuntimeLabel} and its coercing
9
+ * twin {@link coerceRuntimeLabel}): `main | preview | local` — the
10
+ * identity that scopes state under `runtimes/<label>/` and decides which
11
+ * computer records may bind to this process.
12
+ * 2. The INFRA partition ({@link usesPreviewInfraDefaults}): main infra vs
13
+ * preview infra. Here `local`/`dev`/`development` land on the PREVIEW
14
+ * side — a development build must never default onto production
15
+ * endpoints, even though its label is `local`, not `preview`.
16
+ *
17
+ * `dev` is the input that convicts any conflation of the two: label
18
+ * `local`, infra `preview`.
19
+ */
20
+ /** The three runtime identities a process may run as
21
+ * (engine packages/amalgm/lib/runtime-identity.js:10). */
22
+ export const VALID_RUNTIME_LABELS = new Set([
23
+ 'main',
24
+ 'preview',
25
+ 'local',
26
+ ]);
27
+ const MAIN_ALIASES = Object.freeze(['main', 'latest', 'stable', 'prod', 'production', 'release', 'master']);
28
+ const PREVIEW_ALIASES = Object.freeze(['preview', 'canary', 'native-chat', 'staging']);
29
+ const LOCAL_ALIASES = Object.freeze(['local', 'dev', 'development']);
30
+ /**
31
+ * The CLI's label law (engine packages/amalgm/lib/runtime-identity.js:12-19):
32
+ * fold the alias vocabulary onto the three labels, and return `''` for
33
+ * anything unrecognized. The empty string is the point — the CLI layers
34
+ * fallbacks (env chain, then version sniffing via
35
+ * {@link runtimeLabelFromVersion}), so "no answer" must stay expressible.
36
+ * A booted runtime that needs an unconditional answer uses
37
+ * {@link coerceRuntimeLabel} instead.
38
+ */
39
+ export function normalizeRuntimeLabel(value) {
40
+ const raw = String(value || '').trim().toLowerCase();
41
+ if (!raw)
42
+ return '';
43
+ if (MAIN_ALIASES.includes(raw))
44
+ return 'main';
45
+ if (PREVIEW_ALIASES.includes(raw))
46
+ return 'preview';
47
+ if (LOCAL_ALIASES.includes(raw))
48
+ return 'local';
49
+ return '';
50
+ }
51
+ /**
52
+ * The runtime's label law (engine runtime/scripts/amalgm-mcp/config.js:119-124,
53
+ * repeated verbatim in runtime/scripts/lib/runtime-paths.js:7-12,
54
+ * runtime/scripts/amalgm-mcp/apps/advertise.js:25-30 and
55
+ * runtime/scripts/proxy-token-store.js:56-61): the same alias folding, but a
56
+ * running process must have SOME label, so everything unrecognized —
57
+ * including the empty string — is `main`. The two functions agree on every
58
+ * named alias and disagree only on garbage: `normalizeRuntimeLabel('x')` is
59
+ * `''`, `coerceRuntimeLabel('x')` is `'main'`.
60
+ */
61
+ export function coerceRuntimeLabel(value) {
62
+ const raw = String(value || '').trim().toLowerCase();
63
+ if (PREVIEW_ALIASES.includes(raw))
64
+ return 'preview';
65
+ if (LOCAL_ALIASES.includes(raw))
66
+ return 'local';
67
+ return 'main';
68
+ }
69
+ /**
70
+ * A label that reaches state paths must already be one of the three
71
+ * (engine runtime-identity.js:38-43). The error text is the ratified string
72
+ * the CLI's exams pin.
73
+ */
74
+ export function assertRuntimeLabel(label) {
75
+ if (!VALID_RUNTIME_LABELS.has(label)) {
76
+ throw new Error(`Unsupported Amalgm runtime label "${label}". Use main, preview, or local.`);
77
+ }
78
+ return label;
79
+ }
80
+ /**
81
+ * Which git branch a runtime tracks (engine runtime-identity.js:45-50).
82
+ * An explicit branch wins when it normalizes to a real branch (`main` or
83
+ * `preview` — `local` is a label, never a branch); otherwise the label
84
+ * decides: preview tracks preview, everything else tracks main.
85
+ * Pure over the would-be `AMALGM_BRANCH` value instead of reading env.
86
+ */
87
+ export function runtimeBranchForLabel(label, envBranch) {
88
+ const branch = normalizeRuntimeLabel(envBranch);
89
+ if (branch === 'main' || branch === 'preview')
90
+ return branch;
91
+ if (label === 'preview')
92
+ return 'preview';
93
+ return 'main';
94
+ }
95
+ /**
96
+ * Which npm dist-tag an installation updates from (engine
97
+ * runtime-identity.js:52-57). Releases are promoted deliberately to `main`;
98
+ * `latest` is retained only as the public compatibility channel and may lag
99
+ * the runtime we boot, so a main installation must update from the channel
100
+ * it actually runs. NOTE: `main` here is an UNCOMMITTED engine change from
101
+ * the previous `latest` — the new behavior is the law being ported.
102
+ */
103
+ export function npmTagForRuntimeLabel(label) {
104
+ return label === 'preview' ? 'canary' : 'main';
105
+ }
106
+ /** The prerelease grammar that marks a version as preview-channel. A tag
107
+ * counts only as a whole dash-delimited token: `-canaryish` is not canary. */
108
+ const PRERELEASE_PATTERN = /-(?:canary|preview|alpha|beta|rc)(?:[.\-+]|$)/;
109
+ /**
110
+ * Sniff the runtime label from a package version (engine
111
+ * runtime-identity.js:21-24): a recognized prerelease token means
112
+ * `preview`; the ABSENCE of one means `main`. This is the terminal
113
+ * fallback after the env chain returns nothing.
114
+ */
115
+ export function runtimeLabelFromVersion(version) {
116
+ const raw = String(version || '').toLowerCase();
117
+ return PRERELEASE_PATTERN.test(raw) ? 'preview' : 'main';
118
+ }
119
+ const PREVIEW_INFRA_INPUTS = Object.freeze([
120
+ 'preview', 'canary', 'native-chat', 'staging', 'local', 'dev', 'development',
121
+ ]);
122
+ /**
123
+ * The INFRA partition (engine runtime/scripts/amalgm-mcp/config.js:61-69,
124
+ * repeated in runtime/scripts/proxy-token-store.js:7-15): does this process
125
+ * default onto preview infrastructure (api/apps/gateway `*.preview.amalgm.ai`)?
126
+ * A DIFFERENT partition from {@link normalizeRuntimeLabel} over the same
127
+ * input: the preview-infra set additionally contains `local`/`dev`/
128
+ * `development`, and it matches the RAW input, not the folded label —
129
+ * `master` or `latest` fall to main infra without being renamed `main`.
130
+ * Pure over `{label, channel, branch}`; the engine reads the env vars named
131
+ * on {@link RuntimeChannelInput} in exactly this order.
132
+ */
133
+ export function usesPreviewInfraDefaults({ label, channel, branch }) {
134
+ const raw = String(label || channel || branch || '').trim().toLowerCase();
135
+ return PREVIEW_INFRA_INPUTS.includes(raw);
136
+ }
137
+ /**
138
+ * May this stored record bind to the runtime labeled `currentLabel`?
139
+ * (engine runtime/scripts/amalgm-mcp/apps/advertise.js:32-36). The record's
140
+ * claim is read with key precedence runtime_label > label > branch, coerced
141
+ * by the runtime law, and must equal the current label exactly.
142
+ *
143
+ * DELIBERATE DEVIATION: the engine follows the coercion with
144
+ * `if (!label) return AMALGM_RUNTIME_LABEL === 'main'` — unreachable,
145
+ * because its coercing normalizer never returns `''`. That branch is
146
+ * dropped here. The reachable form of the absent-label rule lives in
147
+ * `recordMatchesCurrentRuntime` (auth-records.ts), whose normalizer CAN
148
+ * return `''`.
149
+ */
150
+ export function recordMatchesRuntime(record, currentLabel) {
151
+ const label = coerceRuntimeLabel(record?.runtime_label || record?.label || record?.branch);
152
+ return label === currentLabel;
153
+ }
154
+ //# sourceMappingURL=labels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels.js","sourceRoot":"","sources":["../../src/identity/labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH;0DAC0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAA8B,IAAI,GAAG,CAAe;IACnF,MAAM;IACN,SAAS;IACT,OAAO;CACR,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,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