@wildo-ai/platform-core-shared 1.0.1 → 1.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 (77) hide show
  1. package/LICENSE +34 -0
  2. package/dist/esm/.builder.pid +9 -0
  3. package/dist/esm/core/resources/resources-operations.custom.shared.definitions.d.ts +1 -1
  4. package/dist/esm/core/resources/resources-operations.custom.shared.definitions.d.ts.map +1 -1
  5. package/dist/esm/core/resources/resources-operations.custom.shared.definitions.js +6 -1
  6. package/dist/esm/core/resources/resources-operations.custom.shared.definitions.js.map +1 -1
  7. package/dist/esm/core/resources/resources-relationships.custom.shared.definitions.d.ts +20 -0
  8. package/dist/esm/core/resources/resources-relationships.custom.shared.definitions.d.ts.map +1 -1
  9. package/dist/esm/core/resources/resources-relationships.custom.shared.definitions.js +93 -3
  10. package/dist/esm/core/resources/resources-relationships.custom.shared.definitions.js.map +1 -1
  11. package/dist/esm/core/resources/resources-types.custom.shared.schemas.d.ts +4 -1
  12. package/dist/esm/core/resources/resources-types.custom.shared.schemas.d.ts.map +1 -1
  13. package/dist/esm/core/resources/resources-types.custom.shared.schemas.js +7 -1
  14. package/dist/esm/core/resources/resources-types.custom.shared.schemas.js.map +1 -1
  15. package/dist/esm/index.d.ts +14 -8
  16. package/dist/esm/index.d.ts.map +1 -1
  17. package/dist/esm/index.js +16 -1
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/esm/runtime/application-backend-env.contracts.d.ts +212 -15
  20. package/dist/esm/runtime/application-backend-env.contracts.d.ts.map +1 -1
  21. package/dist/esm/runtime/application-backend-env.contracts.js +256 -20
  22. package/dist/esm/runtime/application-backend-env.contracts.js.map +1 -1
  23. package/dist/esm/runtime/application-worker-env.contracts.d.ts +82 -0
  24. package/dist/esm/runtime/application-worker-env.contracts.d.ts.map +1 -0
  25. package/dist/esm/runtime/application-worker-env.contracts.js +106 -0
  26. package/dist/esm/runtime/application-worker-env.contracts.js.map +1 -0
  27. package/dist/esm/runtime/runtime-topology.contracts.d.ts +10 -3
  28. package/dist/esm/runtime/runtime-topology.contracts.d.ts.map +1 -1
  29. package/dist/esm/runtime/runtime-topology.contracts.js +8 -5
  30. package/dist/esm/runtime/runtime-topology.contracts.js.map +1 -1
  31. package/dist/esm/security/authorizations/roles.custom.shared.definitions.d.ts.map +1 -1
  32. package/dist/esm/security/authorizations/roles.custom.shared.definitions.js +1 -1
  33. package/dist/esm/security/authorizations/roles.custom.shared.definitions.js.map +1 -1
  34. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas.d.ts +830 -0
  35. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas.d.ts.map +1 -0
  36. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas.js +58 -0
  37. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.resources-config.schemas.js.map +1 -0
  38. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.schemas.d.ts +834 -0
  39. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.schemas.d.ts.map +1 -0
  40. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.schemas.js +27 -0
  41. package/dist/esm/wildo-application-executions/wildo-application-executions.custom.shared.schemas.js.map +1 -0
  42. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas.d.ts +342 -0
  43. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas.d.ts.map +1 -0
  44. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas.js +38 -0
  45. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.resources-config.schemas.js.map +1 -0
  46. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.schemas.d.ts +343 -0
  47. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.schemas.d.ts.map +1 -0
  48. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.schemas.js +38 -0
  49. package/dist/esm/wildo-application-tasks/wildo-application-tasks.custom.shared.schemas.js.map +1 -0
  50. package/dist/esm/wildo-applications/wildo-applications.custom.shared.resources-config.schemas.d.ts.map +1 -1
  51. package/dist/esm/wildo-applications/wildo-applications.custom.shared.resources-config.schemas.js +30 -1
  52. package/dist/esm/wildo-applications/wildo-applications.custom.shared.resources-config.schemas.js.map +1 -1
  53. package/dist/esm/wildo-applications/wildo-applications.custom.shared.schemas.d.ts +2 -2
  54. package/dist/esm/wildo-applications/wildo-applications.custom.shared.schemas.d.ts.map +1 -1
  55. package/dist/esm/wildo-applications/wildo-applications.custom.shared.schemas.js +35 -2
  56. package/dist/esm/wildo-applications/wildo-applications.custom.shared.schemas.js.map +1 -1
  57. package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.resources-config.schemas.d.ts.map +1 -1
  58. package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.resources-config.schemas.js +1 -1
  59. package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.resources-config.schemas.js.map +1 -1
  60. package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.schemas.d.ts +1 -1
  61. package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.schemas.d.ts.map +1 -1
  62. package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.schemas.js +1 -1
  63. package/dist/esm/wildo-applications-versions/wildo-applications-versions.custom.shared.schemas.js.map +1 -1
  64. package/dist/esm/workbench/workbench-resources-types.custom.shared.schemas.d.ts +38 -0
  65. package/dist/esm/workbench/workbench-resources-types.custom.shared.schemas.d.ts.map +1 -0
  66. package/dist/esm/workbench/workbench-resources-types.custom.shared.schemas.js +40 -0
  67. package/dist/esm/workbench/workbench-resources-types.custom.shared.schemas.js.map +1 -0
  68. package/dist/esm/workbench/workbench-resources.custom.shared.resources-config.schemas.d.ts +79 -0
  69. package/dist/esm/workbench/workbench-resources.custom.shared.resources-config.schemas.d.ts.map +1 -0
  70. package/dist/esm/workbench/workbench-resources.custom.shared.resources-config.schemas.js +177 -0
  71. package/dist/esm/workbench/workbench-resources.custom.shared.resources-config.schemas.js.map +1 -0
  72. package/dist/esm/workbench/workbench-resources.custom.shared.schemas.d.ts +65 -0
  73. package/dist/esm/workbench/workbench-resources.custom.shared.schemas.d.ts.map +1 -0
  74. package/dist/esm/workbench/workbench-resources.custom.shared.schemas.js +111 -0
  75. package/dist/esm/workbench/workbench-resources.custom.shared.schemas.js.map +1 -0
  76. package/dist/tsconfig.build.tsbuildinfo +1 -1
  77. package/package.json +21 -15
@@ -10,39 +10,144 @@ export declare enum ApplicationBackendBootstrapEnvKey {
10
10
  APPLICATION_ID = "APPLICATION_ID",
11
11
  SERVICE_NAME = "SERVICE_NAME",
12
12
  PLATFORM_ENVIRONMENT_ID = "PLATFORM_ENVIRONMENT_ID",
13
+ /** Deployment topology authority (`local` or `remote`), distinct from APPLICATION_ENV behavior mode and from the environment id. */
14
+ DEPLOYMENT_LOCATION_TYPE = "DEPLOYMENT_LOCATION_TYPE",
13
15
  PLATFORM_APPLICATION_PRIMARY_SECRET = "PLATFORM_APPLICATION_PRIMARY_SECRET",
14
16
  PLATFORM_APPS_MANAGER_URL = "PLATFORM_APPS_MANAGER_URL",
15
17
  APPLICATION_ENV = "APPLICATION_ENV"
16
18
  }
17
19
  export declare enum ApplicationBackendPlatformUrlEnvKey {
18
- PLATFORM_FILE_GENERATOR_URL = "PLATFORM_FILE_GENERATOR_URL",
19
- PLATFORM_CRONTABS_BATCHES_MANAGER_URL = "PLATFORM_CRONTABS_BATCHES_MANAGER_URL"
20
+ PLATFORM_CRONTABS_BATCHES_MANAGER_URL = "PLATFORM_CRONTABS_BATCHES_MANAGER_URL",
21
+ PLATFORM_MODULE_REGISTRY_URL = "PLATFORM_MODULE_REGISTRY_URL"
20
22
  }
21
23
  export declare enum ApplicationBackendRuntimeEnvKey {
22
- APPLICATION_RUNTIME_ENDPOINTS = "APPLICATION_RUNTIME_ENDPOINTS"
24
+ APPLICATION_RUNTIME_ENDPOINTS = "APPLICATION_RUNTIME_ENDPOINTS",
25
+ /** Explicit app-owned filesystem handoff shared by a local backend and its companion. Absence means no filesystem transport is authorized. */
26
+ APPLICATION_RUNTIME_SIGNALS_HOME = "APPLICATION_RUNTIME_SIGNALS_HOME"
23
27
  }
24
28
  export declare enum ApplicationBackendDataEnvKey {
29
+ /**
30
+ * Which persistence adapter the application's resources use.
31
+ *
32
+ * DECLARED, not derived. Until this existed the config loader hard-coded MONGODB, so no
33
+ * environment, secret or bootstrap value could select PostgreSQL — the adapter was reachable only
34
+ * by a test that reached into the config object directly, which is why no application had ever
35
+ * booted on it. Deriving it instead ("PostgreSQL keys are present, so use PostgreSQL") was
36
+ * rejected: which store an application persists to is a deployment decision that must be legible
37
+ * in one place, not an emergent property of which variables happen to be set.
38
+ *
39
+ * Absent means MONGODB, so every existing deployment is unaffected.
40
+ */
41
+ DATABASE_DEFAULT_ADAPTER = "DATABASE_DEFAULT_ADAPTER",
42
+ /**
43
+ * The format NEW resource identifiers are minted in — `object-id` or `uuid`.
44
+ *
45
+ * DECLARED, and specifically NOT derived from {@link DATABASE_DEFAULT_ADAPTER}. The engine used to
46
+ * derive it (MongoDB implied `OBJECT_ID`, PostgreSQL implied `UUID`), which made an application's
47
+ * identity format a side effect of where its rows happen to live: moving a resource between
48
+ * adapters silently changed the shape of every id it minted AND made every id it had already
49
+ * minted fail `validateForResource`. Identity reaches URLs, exports, external references and
50
+ * integrations, so it is an application-level decision that must outlive a storage decision.
51
+ *
52
+ * It needed an env key for the same reason the adapter did. The loader hard-coded
53
+ * `ResourceIdFormat.OBJECT_ID`, so the value was legible nowhere and changeable by nobody: an
54
+ * application could select PostgreSQL and still had no supported way to STATE its identity format,
55
+ * which left the engine's "declared, never derived" rule true in the schema and unreachable in
56
+ * practice.
57
+ *
58
+ * Absent means `OBJECT_ID` — what every existing application already mints — so no deployment
59
+ * changes behaviour by adding this key to the contract.
60
+ *
61
+ * One deployment constraint travels with it: on PostgreSQL the `_id` COLUMN must be able to hold
62
+ * the declared format. DDL rendered from the schema plan types it `text`, which is correct for
63
+ * either member; a hand-written `_id uuid` column restricts the application to `UUID` and rejects
64
+ * an `OBJECT_ID` outright.
65
+ */
66
+ RESOURCE_ID_FORMAT = "RESOURCE_ID_FORMAT",
25
67
  MONGODB_HOST = "MONGODB_HOST",
26
68
  MONGODB_DATABASE = "MONGODB_DATABASE",
27
69
  MONGODB_PROTOCOL = "MONGODB_PROTOCOL",
28
70
  MONGODB_DIRECT_CONNECTION = "MONGODB_DIRECT_CONNECTION",
71
+ /**
72
+ * PostgreSQL TOPOLOGY only — host, port, database, ssl.
73
+ *
74
+ * CREDENTIALS are deliberately NOT here. They arrive through
75
+ * `secrets.database.postgresql`, exactly as MongoDB's do: env carries where the database is,
76
+ * secrets carry who may open it. Putting a password in an env contract would make it readable
77
+ * from every process listing and every container inspect.
78
+ */
79
+ POSTGRESQL_HOST = "POSTGRESQL_HOST",
80
+ POSTGRESQL_PORT = "POSTGRESQL_PORT",
81
+ POSTGRESQL_DATABASE = "POSTGRESQL_DATABASE",
82
+ POSTGRESQL_SSL_MODE = "POSTGRESQL_SSL_MODE",
29
83
  REDIS_HOST = "REDIS_HOST",
30
84
  REDIS_PORT = "REDIS_PORT",
85
+ /**
86
+ * Optional Redis logical database index (0–15). Emitted only when the
87
+ * author sets `backingServices.redis.database` in `wildo.infra.<env>.config.ts`.
88
+ * Consumers default to DB 0 when this var is missing.
89
+ */
90
+ REDIS_DATABASE = "REDIS_DATABASE",
91
+ /**
92
+ * Canonical app-level Redis key namespace. Emitted only when the author
93
+ * sets `dataServices.redis.keyPrefix` in `wildo.saas.config.ts` (Slice 3.6).
94
+ * `RedisService` uses this as the `appPrefix` for all keys it writes — every
95
+ * key becomes `${REDIS_KEY_PREFIX}org:${orgId}:${key}` or
96
+ * `${REDIS_KEY_PREFIX}global:${key}`. When unset, the app-level prefix
97
+ * stays empty (multi-tenant isolation falls back to the
98
+ * `org:`/`global:` segment alone).
99
+ *
100
+ * REPLACE semantics: this supersedes the legacy
101
+ * `secrets.database.redis.username`-derived prefix (Slice 3.6 audit
102
+ * decision — single source of truth = `wildo.saas.config.dataServices`).
103
+ */
104
+ REDIS_KEY_PREFIX = "REDIS_KEY_PREFIX",
31
105
  RABBITMQ_HOST = "RABBITMQ_HOST",
32
106
  RABBITMQ_PORT = "RABBITMQ_PORT",
107
+ /**
108
+ * Optional RabbitMQ virtual host. Emitted only when the author sets
109
+ * `backingServices.rabbitmq.vhost` in `wildo.infra.<env>.config.ts`.
110
+ * Consumers default to `/` (the RabbitMQ root vhost) when missing.
111
+ *
112
+ * Note (Slice 3.6 audit): the symmetric saas-side field
113
+ * `dataServices.rabbitmq.vhost` was DELETED. Vhost is an
114
+ * infra/topology concern with a single authoring seam (infra config).
115
+ */
116
+ RABBITMQ_VHOST = "RABBITMQ_VHOST",
33
117
  STORAGE_PROVIDER = "STORAGE_PROVIDER",
118
+ /**
119
+ * S3-compatible endpoint **hostname** (NOT a URL). The variable name
120
+ * pre-dates the convention pin and is intentionally kept stable for
121
+ * backward compatibility with deployed manifests, but the value is
122
+ * always a bare host (`minio`, `s3.amazonaws.com`, `127.0.0.1`) — the
123
+ * `STORAGE_PORT` and `STORAGE_USE_SSL` siblings are what compose the
124
+ * full `https?://host:port` URL at the SDK initialization site.
125
+ *
126
+ * Slice 3.2 audit (L-4): authoring an explicit URL here (`http://...`)
127
+ * silently breaks the `host:port` contract downstream because the SDK
128
+ * concatenates the parts naively. If a future migration wants to flip
129
+ * the contract to a URL, rename the env key (`STORAGE_URL`) rather
130
+ * than overloading this one — the rename surfaces the breaking change
131
+ * to operators.
132
+ */
34
133
  STORAGE_ENDPOINT = "STORAGE_ENDPOINT",
35
134
  STORAGE_PORT = "STORAGE_PORT",
36
135
  STORAGE_USE_SSL = "STORAGE_USE_SSL",
37
136
  STORAGE_BUCKET = "STORAGE_BUCKET",
38
- STORAGE_ACCESS_KEY = "STORAGE_ACCESS_KEY",
39
- STORAGE_SECRET_KEY = "STORAGE_SECRET_KEY",
137
+ /**
138
+ * Optional app-level object-key namespace prefix prepended to every
139
+ * application file path produced by `WildoManagedStorageProvider`
140
+ * (Slice 3.6). Final key shape becomes
141
+ * `${STORAGE_BUCKET_PREFIX}/applications/${applicationId}/files/${fileId}`
142
+ * (extra segment above the existing `applicationId`-based namespace).
143
+ *
144
+ * Emitted only when the author sets `dataServices.s3.bucketPrefix` in
145
+ * `wildo.saas.config.ts`. The actual MinIO bucket name (`STORAGE_BUCKET`)
146
+ * remains infra-controlled and is unaffected by this prefix — N apps
147
+ * can share one bucket while keeping their object trees disjoint.
148
+ */
149
+ STORAGE_BUCKET_PREFIX = "STORAGE_BUCKET_PREFIX",
40
150
  STORAGE_LOCAL_BASE_DIR = "STORAGE_LOCAL_BASE_DIR",
41
- WEAVIATE_HOST = "WEAVIATE_HOST",
42
- WEAVIATE_PORT = "WEAVIATE_PORT",
43
- WEAVIATE_GRPC_PORT = "WEAVIATE_GRPC_PORT",
44
- WEAVIATE_API_KEY = "WEAVIATE_API_KEY",
45
- WEAVIATE_SCHEME = "WEAVIATE_SCHEME",
46
151
  CLAMAV_HOST = "CLAMAV_HOST",
47
152
  CLAMAV_PORT = "CLAMAV_PORT",
48
153
  YARA_ENABLED = "YARA_ENABLED",
@@ -57,15 +162,107 @@ export declare const ApplicationBackendBootstrapEnvKeys: typeof ApplicationBacke
57
162
  export declare const ApplicationBackendPlatformUrlEnvKeys: typeof ApplicationBackendPlatformUrlEnvKey;
58
163
  export declare const ApplicationBackendRuntimeEnvKeys: typeof ApplicationBackendRuntimeEnvKey;
59
164
  export declare const ApplicationBackendDataEnvKeys: typeof ApplicationBackendDataEnvKey;
60
- export declare const APPLICATION_BACKEND_BOOTSTRAP_ENV_KEY_LIST: readonly [ApplicationBackendBootstrapEnvKey.APPLICATION_ID, ApplicationBackendBootstrapEnvKey.SERVICE_NAME, ApplicationBackendBootstrapEnvKey.PLATFORM_ENVIRONMENT_ID, ApplicationBackendBootstrapEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET, ApplicationBackendBootstrapEnvKey.PLATFORM_APPS_MANAGER_URL, ApplicationBackendBootstrapEnvKey.APPLICATION_ENV];
61
- export declare const APPLICATION_BACKEND_PLATFORM_URL_ENV_KEY_LIST: readonly [ApplicationBackendPlatformUrlEnvKey.PLATFORM_FILE_GENERATOR_URL, ApplicationBackendPlatformUrlEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_URL];
62
- export declare const APPLICATION_BACKEND_RUNTIME_ENV_KEY_LIST: readonly [ApplicationBackendRuntimeEnvKey];
63
- export declare const APPLICATION_BACKEND_DATA_ENV_KEY_LIST: readonly [ApplicationBackendDataEnvKey.MONGODB_HOST, ApplicationBackendDataEnvKey.MONGODB_DATABASE, ApplicationBackendDataEnvKey.MONGODB_PROTOCOL, ApplicationBackendDataEnvKey.MONGODB_DIRECT_CONNECTION, ApplicationBackendDataEnvKey.REDIS_HOST, ApplicationBackendDataEnvKey.REDIS_PORT, ApplicationBackendDataEnvKey.RABBITMQ_HOST, ApplicationBackendDataEnvKey.RABBITMQ_PORT, ApplicationBackendDataEnvKey.STORAGE_PROVIDER, ApplicationBackendDataEnvKey.STORAGE_ENDPOINT, ApplicationBackendDataEnvKey.STORAGE_PORT, ApplicationBackendDataEnvKey.STORAGE_USE_SSL, ApplicationBackendDataEnvKey.STORAGE_BUCKET, ApplicationBackendDataEnvKey.STORAGE_ACCESS_KEY, ApplicationBackendDataEnvKey.STORAGE_SECRET_KEY, ApplicationBackendDataEnvKey.STORAGE_LOCAL_BASE_DIR, ApplicationBackendDataEnvKey.WEAVIATE_HOST, ApplicationBackendDataEnvKey.WEAVIATE_PORT, ApplicationBackendDataEnvKey.WEAVIATE_GRPC_PORT, ApplicationBackendDataEnvKey.WEAVIATE_API_KEY, ApplicationBackendDataEnvKey.WEAVIATE_SCHEME, ApplicationBackendDataEnvKey.CLAMAV_HOST, ApplicationBackendDataEnvKey.CLAMAV_PORT, ApplicationBackendDataEnvKey.YARA_ENABLED, ApplicationBackendDataEnvKey.YARA_HOST, ApplicationBackendDataEnvKey.YARA_PORT];
64
- export declare const APPLICATION_BACKEND_ENV_KEY_LIST: readonly [ApplicationBackendBootstrapEnvKey.APPLICATION_ID, ApplicationBackendBootstrapEnvKey.SERVICE_NAME, ApplicationBackendBootstrapEnvKey.PLATFORM_ENVIRONMENT_ID, ApplicationBackendBootstrapEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET, ApplicationBackendBootstrapEnvKey.PLATFORM_APPS_MANAGER_URL, ApplicationBackendBootstrapEnvKey.APPLICATION_ENV, ApplicationBackendPlatformUrlEnvKey.PLATFORM_FILE_GENERATOR_URL, ApplicationBackendPlatformUrlEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_URL, ApplicationBackendRuntimeEnvKey, ApplicationBackendDataEnvKey.MONGODB_HOST, ApplicationBackendDataEnvKey.MONGODB_DATABASE, ApplicationBackendDataEnvKey.MONGODB_PROTOCOL, ApplicationBackendDataEnvKey.MONGODB_DIRECT_CONNECTION, ApplicationBackendDataEnvKey.REDIS_HOST, ApplicationBackendDataEnvKey.REDIS_PORT, ApplicationBackendDataEnvKey.RABBITMQ_HOST, ApplicationBackendDataEnvKey.RABBITMQ_PORT, ApplicationBackendDataEnvKey.STORAGE_PROVIDER, ApplicationBackendDataEnvKey.STORAGE_ENDPOINT, ApplicationBackendDataEnvKey.STORAGE_PORT, ApplicationBackendDataEnvKey.STORAGE_USE_SSL, ApplicationBackendDataEnvKey.STORAGE_BUCKET, ApplicationBackendDataEnvKey.STORAGE_ACCESS_KEY, ApplicationBackendDataEnvKey.STORAGE_SECRET_KEY, ApplicationBackendDataEnvKey.STORAGE_LOCAL_BASE_DIR, ApplicationBackendDataEnvKey.WEAVIATE_HOST, ApplicationBackendDataEnvKey.WEAVIATE_PORT, ApplicationBackendDataEnvKey.WEAVIATE_GRPC_PORT, ApplicationBackendDataEnvKey.WEAVIATE_API_KEY, ApplicationBackendDataEnvKey.WEAVIATE_SCHEME, ApplicationBackendDataEnvKey.CLAMAV_HOST, ApplicationBackendDataEnvKey.CLAMAV_PORT, ApplicationBackendDataEnvKey.YARA_ENABLED, ApplicationBackendDataEnvKey.YARA_HOST, ApplicationBackendDataEnvKey.YARA_PORT];
165
+ export declare const APPLICATION_BACKEND_BOOTSTRAP_ENV_KEY_LIST: readonly [ApplicationBackendBootstrapEnvKey.APPLICATION_ID, ApplicationBackendBootstrapEnvKey.SERVICE_NAME, ApplicationBackendBootstrapEnvKey.PLATFORM_ENVIRONMENT_ID, ApplicationBackendBootstrapEnvKey.DEPLOYMENT_LOCATION_TYPE, ApplicationBackendBootstrapEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET, ApplicationBackendBootstrapEnvKey.PLATFORM_APPS_MANAGER_URL, ApplicationBackendBootstrapEnvKey.APPLICATION_ENV];
166
+ export declare const APPLICATION_BACKEND_PLATFORM_URL_ENV_KEY_LIST: readonly [ApplicationBackendPlatformUrlEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_URL, ApplicationBackendPlatformUrlEnvKey.PLATFORM_MODULE_REGISTRY_URL];
167
+ export declare const APPLICATION_BACKEND_RUNTIME_ENV_KEY_LIST: readonly [ApplicationBackendRuntimeEnvKey.APPLICATION_RUNTIME_ENDPOINTS, ApplicationBackendRuntimeEnvKey.APPLICATION_RUNTIME_SIGNALS_HOME];
168
+ export declare const APPLICATION_BACKEND_DATA_ENV_KEY_LIST: readonly [ApplicationBackendDataEnvKey.DATABASE_DEFAULT_ADAPTER, ApplicationBackendDataEnvKey.RESOURCE_ID_FORMAT, ApplicationBackendDataEnvKey.MONGODB_HOST, ApplicationBackendDataEnvKey.MONGODB_DATABASE, ApplicationBackendDataEnvKey.MONGODB_PROTOCOL, ApplicationBackendDataEnvKey.MONGODB_DIRECT_CONNECTION, ApplicationBackendDataEnvKey.POSTGRESQL_HOST, ApplicationBackendDataEnvKey.POSTGRESQL_PORT, ApplicationBackendDataEnvKey.POSTGRESQL_DATABASE, ApplicationBackendDataEnvKey.POSTGRESQL_SSL_MODE, ApplicationBackendDataEnvKey.REDIS_HOST, ApplicationBackendDataEnvKey.REDIS_PORT, ApplicationBackendDataEnvKey.REDIS_DATABASE, ApplicationBackendDataEnvKey.REDIS_KEY_PREFIX, ApplicationBackendDataEnvKey.RABBITMQ_HOST, ApplicationBackendDataEnvKey.RABBITMQ_PORT, ApplicationBackendDataEnvKey.RABBITMQ_VHOST, ApplicationBackendDataEnvKey.STORAGE_PROVIDER, ApplicationBackendDataEnvKey.STORAGE_ENDPOINT, ApplicationBackendDataEnvKey.STORAGE_PORT, ApplicationBackendDataEnvKey.STORAGE_USE_SSL, ApplicationBackendDataEnvKey.STORAGE_BUCKET, ApplicationBackendDataEnvKey.STORAGE_BUCKET_PREFIX, ApplicationBackendDataEnvKey.STORAGE_LOCAL_BASE_DIR, ApplicationBackendDataEnvKey.CLAMAV_HOST, ApplicationBackendDataEnvKey.CLAMAV_PORT, ApplicationBackendDataEnvKey.YARA_ENABLED, ApplicationBackendDataEnvKey.YARA_HOST, ApplicationBackendDataEnvKey.YARA_PORT];
169
+ export declare const APPLICATION_BACKEND_ENV_KEY_LIST: readonly [ApplicationBackendBootstrapEnvKey.APPLICATION_ID, ApplicationBackendBootstrapEnvKey.SERVICE_NAME, ApplicationBackendBootstrapEnvKey.PLATFORM_ENVIRONMENT_ID, ApplicationBackendBootstrapEnvKey.DEPLOYMENT_LOCATION_TYPE, ApplicationBackendBootstrapEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET, ApplicationBackendBootstrapEnvKey.PLATFORM_APPS_MANAGER_URL, ApplicationBackendBootstrapEnvKey.APPLICATION_ENV, ApplicationBackendPlatformUrlEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_URL, ApplicationBackendPlatformUrlEnvKey.PLATFORM_MODULE_REGISTRY_URL, ApplicationBackendRuntimeEnvKey.APPLICATION_RUNTIME_ENDPOINTS, ApplicationBackendRuntimeEnvKey.APPLICATION_RUNTIME_SIGNALS_HOME, ApplicationBackendDataEnvKey.DATABASE_DEFAULT_ADAPTER, ApplicationBackendDataEnvKey.RESOURCE_ID_FORMAT, ApplicationBackendDataEnvKey.MONGODB_HOST, ApplicationBackendDataEnvKey.MONGODB_DATABASE, ApplicationBackendDataEnvKey.MONGODB_PROTOCOL, ApplicationBackendDataEnvKey.MONGODB_DIRECT_CONNECTION, ApplicationBackendDataEnvKey.POSTGRESQL_HOST, ApplicationBackendDataEnvKey.POSTGRESQL_PORT, ApplicationBackendDataEnvKey.POSTGRESQL_DATABASE, ApplicationBackendDataEnvKey.POSTGRESQL_SSL_MODE, ApplicationBackendDataEnvKey.REDIS_HOST, ApplicationBackendDataEnvKey.REDIS_PORT, ApplicationBackendDataEnvKey.REDIS_DATABASE, ApplicationBackendDataEnvKey.REDIS_KEY_PREFIX, ApplicationBackendDataEnvKey.RABBITMQ_HOST, ApplicationBackendDataEnvKey.RABBITMQ_PORT, ApplicationBackendDataEnvKey.RABBITMQ_VHOST, ApplicationBackendDataEnvKey.STORAGE_PROVIDER, ApplicationBackendDataEnvKey.STORAGE_ENDPOINT, ApplicationBackendDataEnvKey.STORAGE_PORT, ApplicationBackendDataEnvKey.STORAGE_USE_SSL, ApplicationBackendDataEnvKey.STORAGE_BUCKET, ApplicationBackendDataEnvKey.STORAGE_BUCKET_PREFIX, ApplicationBackendDataEnvKey.STORAGE_LOCAL_BASE_DIR, ApplicationBackendDataEnvKey.CLAMAV_HOST, ApplicationBackendDataEnvKey.CLAMAV_PORT, ApplicationBackendDataEnvKey.YARA_ENABLED, ApplicationBackendDataEnvKey.YARA_HOST, ApplicationBackendDataEnvKey.YARA_PORT];
65
170
  /**
66
171
  * Keys that must always be treated as secrets when this app-backend env surface
67
172
  * is materialized into logs, CI artifacts, or deployment manifests.
68
173
  */
69
174
  export declare const APPLICATION_BACKEND_SENSITIVE_ENV_KEYS: Set<string>;
70
175
  export type ApplicationBackendEnvKey = typeof APPLICATION_BACKEND_ENV_KEY_LIST[number];
176
+ /**
177
+ * ────────────────────────────────────────────────────────────────────────
178
+ * Backend → worker dispatch contract (G-8 / MW4)
179
+ * ────────────────────────────────────────────────────────────────────────
180
+ * A declared worker's HTTP base URL is injected into the app-backend env at
181
+ * deploy time as `WILDO_WORKER_<NAME>_URL`. The `<NAME>` segment is DYNAMIC
182
+ * (one per declared worker), so — unlike the static enums above — the key is a
183
+ * HELPER, not a fixed member. Both the CLI EMIT side
184
+ * (`PlatformEnvVarsBuilder.buildApplicationBackendEnv`) and the backend READ
185
+ * side (`WorkerRemoteClientFactoryBackendService`) MUST derive the key + URL
186
+ * through these single helpers so the two can never drift.
187
+ */
188
+ export declare const WILDO_WORKER_URL_ENV_PREFIX = "WILDO_WORKER_";
189
+ export declare const WILDO_WORKER_URL_ENV_SUFFIX = "_URL";
190
+ /**
191
+ * Normalize a worker identifier (the `wildo.saas.config.ts` bucket key —
192
+ * camelCase or kebab-case, e.g. `myNodeWorker` / `my-node-worker`) into the
193
+ * UPPER_SNAKE segment embedded inside `WILDO_WORKER_<NAME>_URL`. Both
194
+ * `myNodeWorker` and `my-node-worker` normalize to `MY_NODE_WORKER`, so the env
195
+ * key is stable regardless of the authoring style.
196
+ */
197
+ export declare function normalizeWorkerEnvSegment(workerName: string): string;
198
+ /**
199
+ * The `WILDO_WORKER_<NAME>_URL` env-var name for a declared worker. The single
200
+ * source of truth for both emit (CLI) and read (backend factory).
201
+ *
202
+ * @example wildoWorkerUrlEnvKey('myNodeWorker') // 'WILDO_WORKER_MY_NODE_WORKER_URL'
203
+ */
204
+ export declare function wildoWorkerUrlEnvKey(workerName: string): string;
205
+ /**
206
+ * Normalize a service key (the `wildo.saas.config.ts` `minions`/`workers` bucket
207
+ * key — authored camelCase or kebab, e.g. `marketingScrapper` / `my-rust-worker`)
208
+ * into an RFC1123-valid DNS label segment: lowercase, `[a-z0-9-]` only, no
209
+ * leading/trailing hyphen. `marketingScrapper` → `marketing-scrapper`,
210
+ * `myNodeWorker` → `my-node-worker`.
211
+ *
212
+ * This is the DNS-NAME axis of a background runtime — the segment embedded in the
213
+ * k8s object/Service name, the built container image ref, the compose service name,
214
+ * and the worker dispatch URL host. It is DISTINCT from the IDENTITY axis (the raw
215
+ * bucket key), which apps-manager keys on (`appConfig.workers[key]` /
216
+ * `appConfig.minions[key]`) and which the worker stamps as `APP_OWNED_SERVICE_NAME`
217
+ * / both runtimes carry as the `wildo.ai/owned-service-name` pod label — the
218
+ * identity axis MUST stay raw and is NEVER passed through this helper. The
219
+ * env-key axis (`WILDO_WORKER_<NAME>_URL`) has its own normalization,
220
+ * {@link normalizeWorkerEnvSegment}, because an env-var name is UPPER_SNAKE, not a
221
+ * DNS label.
222
+ *
223
+ * This helper does NOT truncate — a name too long for a DNS label (63 chars) is
224
+ * REJECTED at authoring, not silently shortened (truncation risks colliding with
225
+ * a sibling key). Returns `''` for all-symbol input. The authoring-time guard in
226
+ * `define-saas-config.ts` fails fast on keys that normalize to empty, collide with
227
+ * a sibling after normalization, or whose full `{slug}-{kind}-{name}` deploy name
228
+ * exceeds 63 chars — so an empty / duplicate / over-long DNS name can never reach
229
+ * the render.
230
+ */
231
+ export declare function normalizeServiceKeyToDnsName(key: string): string;
232
+ /**
233
+ * The k8s Service (and same-network compose service) name for a per-app worker:
234
+ * `{appSlug}-worker-{dnsName}`, where `dnsName` is the bucket key normalized to an
235
+ * RFC1123 label ({@link normalizeServiceKeyToDnsName}). Coherent-by-construction
236
+ * with the CLI k8s render (`renderWorkerForTarget`), the compose render
237
+ * (`deriveAppRuntimeServiceName`), the CI image build (`syncCicd`), and the worker
238
+ * dispatch URL host ({@link buildWorkerInternalUrl}) — EVERY DNS-name site derives
239
+ * the name through THIS helper (rather than inlining `{appSlug}-worker-{key}`), so
240
+ * the backend calls the exact Service the render deploys and CI builds the exact
241
+ * image ref the deploy pulls.
242
+ *
243
+ * `workerName` is the saas-config bucket key (NOT the per-folder `config.name`) —
244
+ * passed raw; the normalization happens inside. The raw key remains the worker's
245
+ * IDENTITY (apps-manager lookup + `APP_OWNED_SERVICE_NAME`), a separate axis that
246
+ * is never derived from this function.
247
+ */
248
+ export declare function buildWorkerServiceName(appSlug: string, workerName: string): string;
249
+ /**
250
+ * The k8s Deployment (and same-network compose service) name for a per-app minion:
251
+ * `{appSlug}-minion-{dnsName}`, where `dnsName` is the bucket key normalized to an
252
+ * RFC1123 label ({@link normalizeServiceKeyToDnsName}). Symmetric with
253
+ * {@link buildWorkerServiceName} — minions have no inbound Service / dispatch URL,
254
+ * but the k8s render, the compose render, and the CI image build all need the
255
+ * deploy name, and it must be RFC1123-valid for the same reasons. `minionName` is
256
+ * the saas-config bucket key; the raw key stays the minion's IDENTITY (the
257
+ * `wildo.ai/owned-service-name` pod label), never derived from here.
258
+ */
259
+ export declare function buildMinionServiceName(appSlug: string, minionName: string): string;
260
+ /**
261
+ * The in-cluster base URL the app-backend uses to reach a per-app worker
262
+ * (`http://{appSlug}-worker-{workerName}:{port}`). The backend + its workers
263
+ * deploy into the SAME namespace (per-app deploy), so the short Service name
264
+ * resolves without a namespace qualifier. `port` is the worker's authored
265
+ * `http.port` (schema default 8080).
266
+ */
267
+ export declare function buildWorkerInternalUrl(appSlug: string, workerName: string, port: number): string;
71
268
  //# sourceMappingURL=application-backend-env.contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"application-backend-env.contracts.d.ts","sourceRoot":"","sources":["../../../src/runtime/application-backend-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oBAAY,iCAAiC;IAC3C,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;IAC7B,uBAAuB,4BAA4B;IACnD,mCAAmC,wCAAwC;IAC3E,yBAAyB,8BAA8B;IACvD,eAAe,oBAAoB;CACpC;AAED,oBAAY,mCAAmC;IAC7C,2BAA2B,gCAAgC;IAC3D,qCAAqC,0CAA0C;CAChF;AAED,oBAAY,+BAA+B;IACzC,6BAA6B,kCAAkC;CAChE;AAED,oBAAY,4BAA4B;IACtC,YAAY,iBAAiB;IAC7B,gBAAgB,qBAAqB;IACrC,gBAAgB,qBAAqB;IACrC,yBAAyB,8BAA8B;IACvD,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,gBAAgB,qBAAqB;IACrC,gBAAgB,qBAAqB;IACrC,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,cAAc,mBAAmB;IACjC,kBAAkB,uBAAuB;IACzC,kBAAkB,uBAAuB;IACzC,sBAAsB,2BAA2B;IACjD,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;IACzC,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,kCAAkC,0CAAoC,CAAC;AACpF,eAAO,MAAM,oCAAoC,4CAAsC,CAAC;AACxF,eAAO,MAAM,gCAAgC,wCAAkC,CAAC;AAChF,eAAO,MAAM,6BAA6B,qCAA+B,CAAC;AAE1E,eAAO,MAAM,0CAA0C,+VAO7C,CAAC;AAEX,eAAO,MAAM,6CAA6C,uJAGhD,CAAC;AAEX,eAAO,MAAM,wCAAwC,4CAE3C,CAAC;AAEX,eAAO,MAAM,qCAAqC,sqCA2BxC,CAAC;AAEX,eAAO,MAAM,gCAAgC,uqDAKnC,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,sCAAsC,aAKjD,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAClC,OAAO,gCAAgC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"application-backend-env.contracts.d.ts","sourceRoot":"","sources":["../../../../src/runtime/application-backend-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oBAAY,iCAAiC;IAC3C,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;IAC7B,uBAAuB,4BAA4B;IACnD,oIAAoI;IACpI,wBAAwB,6BAA6B;IACrD,mCAAmC,wCAAwC;IAC3E,yBAAyB,8BAA8B;IACvD,eAAe,oBAAoB;CACpC;AAED,oBAAY,mCAAmC;IAC7C,qCAAqC,0CAA0C;IAC/E,4BAA4B,iCAAiC;CAC9D;AAED,oBAAY,+BAA+B;IACzC,6BAA6B,kCAAkC;IAC/D,8IAA8I;IAC9I,gCAAgC,qCAAqC;CACtE;AAED,oBAAY,4BAA4B;IACtC;;;;;;;;;;;OAWG;IACH,wBAAwB,6BAA6B;IACrD;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,kBAAkB,uBAAuB;IACzC,YAAY,iBAAiB;IAC7B,gBAAgB,qBAAqB;IACrC,gBAAgB,qBAAqB;IACrC,yBAAyB,8BAA8B;IACvD;;;;;;;OAOG;IACH,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,mBAAmB,wBAAwB;IAC3C,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB;;;;OAIG;IACH,cAAc,mBAAmB;IACjC;;;;;;;;;;;;OAYG;IACH,gBAAgB,qBAAqB;IACrC,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B;;;;;;;;OAQG;IACH,cAAc,mBAAmB;IACjC,gBAAgB,qBAAqB;IACrC;;;;;;;;;;;;;;OAcG;IACH,gBAAgB,qBAAqB;IACrC,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,cAAc,mBAAmB;IACjC;;;;;;;;;;;OAWG;IACH,qBAAqB,0BAA0B;IAc/C,sBAAsB,2BAA2B;IACjD,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,kCAAkC,0CAAoC,CAAC;AACpF,eAAO,MAAM,oCAAoC,4CAAsC,CAAC;AACxF,eAAO,MAAM,gCAAgC,wCAAkC,CAAC;AAChF,eAAO,MAAM,6BAA6B,qCAA+B,CAAC;AAE1E,eAAO,MAAM,0CAA0C,2ZAQ7C,CAAC;AAEX,eAAO,MAAM,6CAA6C,wJAGhD,CAAC;AAEX,eAAO,MAAM,wCAAwC,4IAG3C,CAAC;AAEX,eAAO,MAAM,qCAAqC,m0CA8BxC,CAAC;AAEX,eAAO,MAAM,gCAAgC,i+DAKnC,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,sCAAsC,aAKjD,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAClC,OAAO,gCAAgC,CAAC,MAAM,CAAC,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,kBAAkB,CAAC;AAC3D,eAAO,MAAM,2BAA2B,SAAS,CAAC;AAElD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAOpE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMhE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAElF;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAElF;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhG"}
@@ -11,42 +11,160 @@ export var ApplicationBackendBootstrapEnvKey;
11
11
  ApplicationBackendBootstrapEnvKey["APPLICATION_ID"] = "APPLICATION_ID";
12
12
  ApplicationBackendBootstrapEnvKey["SERVICE_NAME"] = "SERVICE_NAME";
13
13
  ApplicationBackendBootstrapEnvKey["PLATFORM_ENVIRONMENT_ID"] = "PLATFORM_ENVIRONMENT_ID";
14
+ /** Deployment topology authority (`local` or `remote`), distinct from APPLICATION_ENV behavior mode and from the environment id. */
15
+ ApplicationBackendBootstrapEnvKey["DEPLOYMENT_LOCATION_TYPE"] = "DEPLOYMENT_LOCATION_TYPE";
14
16
  ApplicationBackendBootstrapEnvKey["PLATFORM_APPLICATION_PRIMARY_SECRET"] = "PLATFORM_APPLICATION_PRIMARY_SECRET";
15
17
  ApplicationBackendBootstrapEnvKey["PLATFORM_APPS_MANAGER_URL"] = "PLATFORM_APPS_MANAGER_URL";
16
18
  ApplicationBackendBootstrapEnvKey["APPLICATION_ENV"] = "APPLICATION_ENV";
17
19
  })(ApplicationBackendBootstrapEnvKey || (ApplicationBackendBootstrapEnvKey = {}));
18
20
  export var ApplicationBackendPlatformUrlEnvKey;
19
21
  (function (ApplicationBackendPlatformUrlEnvKey) {
20
- ApplicationBackendPlatformUrlEnvKey["PLATFORM_FILE_GENERATOR_URL"] = "PLATFORM_FILE_GENERATOR_URL";
21
22
  ApplicationBackendPlatformUrlEnvKey["PLATFORM_CRONTABS_BATCHES_MANAGER_URL"] = "PLATFORM_CRONTABS_BATCHES_MANAGER_URL";
23
+ ApplicationBackendPlatformUrlEnvKey["PLATFORM_MODULE_REGISTRY_URL"] = "PLATFORM_MODULE_REGISTRY_URL";
22
24
  })(ApplicationBackendPlatformUrlEnvKey || (ApplicationBackendPlatformUrlEnvKey = {}));
23
25
  export var ApplicationBackendRuntimeEnvKey;
24
26
  (function (ApplicationBackendRuntimeEnvKey) {
25
27
  ApplicationBackendRuntimeEnvKey["APPLICATION_RUNTIME_ENDPOINTS"] = "APPLICATION_RUNTIME_ENDPOINTS";
28
+ /** Explicit app-owned filesystem handoff shared by a local backend and its companion. Absence means no filesystem transport is authorized. */
29
+ ApplicationBackendRuntimeEnvKey["APPLICATION_RUNTIME_SIGNALS_HOME"] = "APPLICATION_RUNTIME_SIGNALS_HOME";
26
30
  })(ApplicationBackendRuntimeEnvKey || (ApplicationBackendRuntimeEnvKey = {}));
27
31
  export var ApplicationBackendDataEnvKey;
28
32
  (function (ApplicationBackendDataEnvKey) {
33
+ /**
34
+ * Which persistence adapter the application's resources use.
35
+ *
36
+ * DECLARED, not derived. Until this existed the config loader hard-coded MONGODB, so no
37
+ * environment, secret or bootstrap value could select PostgreSQL — the adapter was reachable only
38
+ * by a test that reached into the config object directly, which is why no application had ever
39
+ * booted on it. Deriving it instead ("PostgreSQL keys are present, so use PostgreSQL") was
40
+ * rejected: which store an application persists to is a deployment decision that must be legible
41
+ * in one place, not an emergent property of which variables happen to be set.
42
+ *
43
+ * Absent means MONGODB, so every existing deployment is unaffected.
44
+ */
45
+ ApplicationBackendDataEnvKey["DATABASE_DEFAULT_ADAPTER"] = "DATABASE_DEFAULT_ADAPTER";
46
+ /**
47
+ * The format NEW resource identifiers are minted in — `object-id` or `uuid`.
48
+ *
49
+ * DECLARED, and specifically NOT derived from {@link DATABASE_DEFAULT_ADAPTER}. The engine used to
50
+ * derive it (MongoDB implied `OBJECT_ID`, PostgreSQL implied `UUID`), which made an application's
51
+ * identity format a side effect of where its rows happen to live: moving a resource between
52
+ * adapters silently changed the shape of every id it minted AND made every id it had already
53
+ * minted fail `validateForResource`. Identity reaches URLs, exports, external references and
54
+ * integrations, so it is an application-level decision that must outlive a storage decision.
55
+ *
56
+ * It needed an env key for the same reason the adapter did. The loader hard-coded
57
+ * `ResourceIdFormat.OBJECT_ID`, so the value was legible nowhere and changeable by nobody: an
58
+ * application could select PostgreSQL and still had no supported way to STATE its identity format,
59
+ * which left the engine's "declared, never derived" rule true in the schema and unreachable in
60
+ * practice.
61
+ *
62
+ * Absent means `OBJECT_ID` — what every existing application already mints — so no deployment
63
+ * changes behaviour by adding this key to the contract.
64
+ *
65
+ * One deployment constraint travels with it: on PostgreSQL the `_id` COLUMN must be able to hold
66
+ * the declared format. DDL rendered from the schema plan types it `text`, which is correct for
67
+ * either member; a hand-written `_id uuid` column restricts the application to `UUID` and rejects
68
+ * an `OBJECT_ID` outright.
69
+ */
70
+ ApplicationBackendDataEnvKey["RESOURCE_ID_FORMAT"] = "RESOURCE_ID_FORMAT";
29
71
  ApplicationBackendDataEnvKey["MONGODB_HOST"] = "MONGODB_HOST";
30
72
  ApplicationBackendDataEnvKey["MONGODB_DATABASE"] = "MONGODB_DATABASE";
31
73
  ApplicationBackendDataEnvKey["MONGODB_PROTOCOL"] = "MONGODB_PROTOCOL";
32
74
  ApplicationBackendDataEnvKey["MONGODB_DIRECT_CONNECTION"] = "MONGODB_DIRECT_CONNECTION";
75
+ /**
76
+ * PostgreSQL TOPOLOGY only — host, port, database, ssl.
77
+ *
78
+ * CREDENTIALS are deliberately NOT here. They arrive through
79
+ * `secrets.database.postgresql`, exactly as MongoDB's do: env carries where the database is,
80
+ * secrets carry who may open it. Putting a password in an env contract would make it readable
81
+ * from every process listing and every container inspect.
82
+ */
83
+ ApplicationBackendDataEnvKey["POSTGRESQL_HOST"] = "POSTGRESQL_HOST";
84
+ ApplicationBackendDataEnvKey["POSTGRESQL_PORT"] = "POSTGRESQL_PORT";
85
+ ApplicationBackendDataEnvKey["POSTGRESQL_DATABASE"] = "POSTGRESQL_DATABASE";
86
+ ApplicationBackendDataEnvKey["POSTGRESQL_SSL_MODE"] = "POSTGRESQL_SSL_MODE";
33
87
  ApplicationBackendDataEnvKey["REDIS_HOST"] = "REDIS_HOST";
34
88
  ApplicationBackendDataEnvKey["REDIS_PORT"] = "REDIS_PORT";
89
+ /**
90
+ * Optional Redis logical database index (0–15). Emitted only when the
91
+ * author sets `backingServices.redis.database` in `wildo.infra.<env>.config.ts`.
92
+ * Consumers default to DB 0 when this var is missing.
93
+ */
94
+ ApplicationBackendDataEnvKey["REDIS_DATABASE"] = "REDIS_DATABASE";
95
+ /**
96
+ * Canonical app-level Redis key namespace. Emitted only when the author
97
+ * sets `dataServices.redis.keyPrefix` in `wildo.saas.config.ts` (Slice 3.6).
98
+ * `RedisService` uses this as the `appPrefix` for all keys it writes — every
99
+ * key becomes `${REDIS_KEY_PREFIX}org:${orgId}:${key}` or
100
+ * `${REDIS_KEY_PREFIX}global:${key}`. When unset, the app-level prefix
101
+ * stays empty (multi-tenant isolation falls back to the
102
+ * `org:`/`global:` segment alone).
103
+ *
104
+ * REPLACE semantics: this supersedes the legacy
105
+ * `secrets.database.redis.username`-derived prefix (Slice 3.6 audit
106
+ * decision — single source of truth = `wildo.saas.config.dataServices`).
107
+ */
108
+ ApplicationBackendDataEnvKey["REDIS_KEY_PREFIX"] = "REDIS_KEY_PREFIX";
35
109
  ApplicationBackendDataEnvKey["RABBITMQ_HOST"] = "RABBITMQ_HOST";
36
110
  ApplicationBackendDataEnvKey["RABBITMQ_PORT"] = "RABBITMQ_PORT";
111
+ /**
112
+ * Optional RabbitMQ virtual host. Emitted only when the author sets
113
+ * `backingServices.rabbitmq.vhost` in `wildo.infra.<env>.config.ts`.
114
+ * Consumers default to `/` (the RabbitMQ root vhost) when missing.
115
+ *
116
+ * Note (Slice 3.6 audit): the symmetric saas-side field
117
+ * `dataServices.rabbitmq.vhost` was DELETED. Vhost is an
118
+ * infra/topology concern with a single authoring seam (infra config).
119
+ */
120
+ ApplicationBackendDataEnvKey["RABBITMQ_VHOST"] = "RABBITMQ_VHOST";
37
121
  ApplicationBackendDataEnvKey["STORAGE_PROVIDER"] = "STORAGE_PROVIDER";
122
+ /**
123
+ * S3-compatible endpoint **hostname** (NOT a URL). The variable name
124
+ * pre-dates the convention pin and is intentionally kept stable for
125
+ * backward compatibility with deployed manifests, but the value is
126
+ * always a bare host (`minio`, `s3.amazonaws.com`, `127.0.0.1`) — the
127
+ * `STORAGE_PORT` and `STORAGE_USE_SSL` siblings are what compose the
128
+ * full `https?://host:port` URL at the SDK initialization site.
129
+ *
130
+ * Slice 3.2 audit (L-4): authoring an explicit URL here (`http://...`)
131
+ * silently breaks the `host:port` contract downstream because the SDK
132
+ * concatenates the parts naively. If a future migration wants to flip
133
+ * the contract to a URL, rename the env key (`STORAGE_URL`) rather
134
+ * than overloading this one — the rename surfaces the breaking change
135
+ * to operators.
136
+ */
38
137
  ApplicationBackendDataEnvKey["STORAGE_ENDPOINT"] = "STORAGE_ENDPOINT";
39
138
  ApplicationBackendDataEnvKey["STORAGE_PORT"] = "STORAGE_PORT";
40
139
  ApplicationBackendDataEnvKey["STORAGE_USE_SSL"] = "STORAGE_USE_SSL";
41
140
  ApplicationBackendDataEnvKey["STORAGE_BUCKET"] = "STORAGE_BUCKET";
42
- ApplicationBackendDataEnvKey["STORAGE_ACCESS_KEY"] = "STORAGE_ACCESS_KEY";
43
- ApplicationBackendDataEnvKey["STORAGE_SECRET_KEY"] = "STORAGE_SECRET_KEY";
141
+ /**
142
+ * Optional app-level object-key namespace prefix prepended to every
143
+ * application file path produced by `WildoManagedStorageProvider`
144
+ * (Slice 3.6). Final key shape becomes
145
+ * `${STORAGE_BUCKET_PREFIX}/applications/${applicationId}/files/${fileId}`
146
+ * (extra segment above the existing `applicationId`-based namespace).
147
+ *
148
+ * Emitted only when the author sets `dataServices.s3.bucketPrefix` in
149
+ * `wildo.saas.config.ts`. The actual MinIO bucket name (`STORAGE_BUCKET`)
150
+ * remains infra-controlled and is unaffected by this prefix — N apps
151
+ * can share one bucket while keeping their object trees disjoint.
152
+ */
153
+ ApplicationBackendDataEnvKey["STORAGE_BUCKET_PREFIX"] = "STORAGE_BUCKET_PREFIX";
154
+ // ⚠️ `STORAGE_ACCESS_KEY` / `STORAGE_SECRET_KEY` are deliberately ABSENT from
155
+ // this contract, and must not be re-added.
156
+ //
157
+ // They carried the object store's ROOT credential — the same pair the MinIO
158
+ // container itself is created with — into every application, minion and worker
159
+ // environment. An application now obtains short-lived, prefix-confined session
160
+ // credentials from apps-manager instead (`createStsStorageCredentialResolver`),
161
+ // so there is no application-tier storage credential to name here.
162
+ //
163
+ // Re-adding them would not merely restore a variable: this enum is the DECLARED
164
+ // app-backend env surface, so a key here is an invitation for a builder to fill
165
+ // it. `assertNoStorageSecretInGeneratedEnv` fails the build if one ever does.
166
+ // See `.claude/plans/object-storage-root-credential-distribution.md`.
44
167
  ApplicationBackendDataEnvKey["STORAGE_LOCAL_BASE_DIR"] = "STORAGE_LOCAL_BASE_DIR";
45
- ApplicationBackendDataEnvKey["WEAVIATE_HOST"] = "WEAVIATE_HOST";
46
- ApplicationBackendDataEnvKey["WEAVIATE_PORT"] = "WEAVIATE_PORT";
47
- ApplicationBackendDataEnvKey["WEAVIATE_GRPC_PORT"] = "WEAVIATE_GRPC_PORT";
48
- ApplicationBackendDataEnvKey["WEAVIATE_API_KEY"] = "WEAVIATE_API_KEY";
49
- ApplicationBackendDataEnvKey["WEAVIATE_SCHEME"] = "WEAVIATE_SCHEME";
50
168
  ApplicationBackendDataEnvKey["CLAMAV_HOST"] = "CLAMAV_HOST";
51
169
  ApplicationBackendDataEnvKey["CLAMAV_PORT"] = "CLAMAV_PORT";
52
170
  ApplicationBackendDataEnvKey["YARA_ENABLED"] = "YARA_ENABLED";
@@ -65,39 +183,44 @@ export const APPLICATION_BACKEND_BOOTSTRAP_ENV_KEY_LIST = [
65
183
  ApplicationBackendBootstrapEnvKey.APPLICATION_ID,
66
184
  ApplicationBackendBootstrapEnvKey.SERVICE_NAME,
67
185
  ApplicationBackendBootstrapEnvKey.PLATFORM_ENVIRONMENT_ID,
186
+ ApplicationBackendBootstrapEnvKey.DEPLOYMENT_LOCATION_TYPE,
68
187
  ApplicationBackendBootstrapEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET,
69
188
  ApplicationBackendBootstrapEnvKey.PLATFORM_APPS_MANAGER_URL,
70
189
  ApplicationBackendBootstrapEnvKey.APPLICATION_ENV,
71
190
  ];
72
191
  export const APPLICATION_BACKEND_PLATFORM_URL_ENV_KEY_LIST = [
73
- ApplicationBackendPlatformUrlEnvKey.PLATFORM_FILE_GENERATOR_URL,
74
192
  ApplicationBackendPlatformUrlEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_URL,
193
+ ApplicationBackendPlatformUrlEnvKey.PLATFORM_MODULE_REGISTRY_URL,
75
194
  ];
76
195
  export const APPLICATION_BACKEND_RUNTIME_ENV_KEY_LIST = [
77
196
  ApplicationBackendRuntimeEnvKey.APPLICATION_RUNTIME_ENDPOINTS,
197
+ ApplicationBackendRuntimeEnvKey.APPLICATION_RUNTIME_SIGNALS_HOME,
78
198
  ];
79
199
  export const APPLICATION_BACKEND_DATA_ENV_KEY_LIST = [
200
+ ApplicationBackendDataEnvKey.DATABASE_DEFAULT_ADAPTER,
201
+ ApplicationBackendDataEnvKey.RESOURCE_ID_FORMAT,
80
202
  ApplicationBackendDataEnvKey.MONGODB_HOST,
81
203
  ApplicationBackendDataEnvKey.MONGODB_DATABASE,
82
204
  ApplicationBackendDataEnvKey.MONGODB_PROTOCOL,
83
205
  ApplicationBackendDataEnvKey.MONGODB_DIRECT_CONNECTION,
206
+ ApplicationBackendDataEnvKey.POSTGRESQL_HOST,
207
+ ApplicationBackendDataEnvKey.POSTGRESQL_PORT,
208
+ ApplicationBackendDataEnvKey.POSTGRESQL_DATABASE,
209
+ ApplicationBackendDataEnvKey.POSTGRESQL_SSL_MODE,
84
210
  ApplicationBackendDataEnvKey.REDIS_HOST,
85
211
  ApplicationBackendDataEnvKey.REDIS_PORT,
212
+ ApplicationBackendDataEnvKey.REDIS_DATABASE,
213
+ ApplicationBackendDataEnvKey.REDIS_KEY_PREFIX,
86
214
  ApplicationBackendDataEnvKey.RABBITMQ_HOST,
87
215
  ApplicationBackendDataEnvKey.RABBITMQ_PORT,
216
+ ApplicationBackendDataEnvKey.RABBITMQ_VHOST,
88
217
  ApplicationBackendDataEnvKey.STORAGE_PROVIDER,
89
218
  ApplicationBackendDataEnvKey.STORAGE_ENDPOINT,
90
219
  ApplicationBackendDataEnvKey.STORAGE_PORT,
91
220
  ApplicationBackendDataEnvKey.STORAGE_USE_SSL,
92
221
  ApplicationBackendDataEnvKey.STORAGE_BUCKET,
93
- ApplicationBackendDataEnvKey.STORAGE_ACCESS_KEY,
94
- ApplicationBackendDataEnvKey.STORAGE_SECRET_KEY,
222
+ ApplicationBackendDataEnvKey.STORAGE_BUCKET_PREFIX,
95
223
  ApplicationBackendDataEnvKey.STORAGE_LOCAL_BASE_DIR,
96
- ApplicationBackendDataEnvKey.WEAVIATE_HOST,
97
- ApplicationBackendDataEnvKey.WEAVIATE_PORT,
98
- ApplicationBackendDataEnvKey.WEAVIATE_GRPC_PORT,
99
- ApplicationBackendDataEnvKey.WEAVIATE_API_KEY,
100
- ApplicationBackendDataEnvKey.WEAVIATE_SCHEME,
101
224
  ApplicationBackendDataEnvKey.CLAMAV_HOST,
102
225
  ApplicationBackendDataEnvKey.CLAMAV_PORT,
103
226
  ApplicationBackendDataEnvKey.YARA_ENABLED,
@@ -116,8 +239,121 @@ export const APPLICATION_BACKEND_ENV_KEY_LIST = [
116
239
  */
117
240
  export const APPLICATION_BACKEND_SENSITIVE_ENV_KEYS = new Set([
118
241
  ApplicationBackendBootstrapEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET,
119
- ApplicationBackendDataEnvKey.STORAGE_ACCESS_KEY,
120
- ApplicationBackendDataEnvKey.STORAGE_SECRET_KEY,
121
- ApplicationBackendDataEnvKey.WEAVIATE_API_KEY,
242
+ // The storage pair is gone rather than listed: an app-tier env no longer
243
+ // carries an object-storage credential at all, so there is nothing here to
244
+ // mark sensitive. See the note on the enum above.
122
245
  ]);
123
- //# sourceMappingURL=application-backend-env.contracts.js.map
246
+ /**
247
+ * ────────────────────────────────────────────────────────────────────────
248
+ * Backend → worker dispatch contract (G-8 / MW4)
249
+ * ────────────────────────────────────────────────────────────────────────
250
+ * A declared worker's HTTP base URL is injected into the app-backend env at
251
+ * deploy time as `WILDO_WORKER_<NAME>_URL`. The `<NAME>` segment is DYNAMIC
252
+ * (one per declared worker), so — unlike the static enums above — the key is a
253
+ * HELPER, not a fixed member. Both the CLI EMIT side
254
+ * (`PlatformEnvVarsBuilder.buildApplicationBackendEnv`) and the backend READ
255
+ * side (`WorkerRemoteClientFactoryBackendService`) MUST derive the key + URL
256
+ * through these single helpers so the two can never drift.
257
+ */
258
+ export const WILDO_WORKER_URL_ENV_PREFIX = 'WILDO_WORKER_';
259
+ export const WILDO_WORKER_URL_ENV_SUFFIX = '_URL';
260
+ /**
261
+ * Normalize a worker identifier (the `wildo.saas.config.ts` bucket key —
262
+ * camelCase or kebab-case, e.g. `myNodeWorker` / `my-node-worker`) into the
263
+ * UPPER_SNAKE segment embedded inside `WILDO_WORKER_<NAME>_URL`. Both
264
+ * `myNodeWorker` and `my-node-worker` normalize to `MY_NODE_WORKER`, so the env
265
+ * key is stable regardless of the authoring style.
266
+ */
267
+ export function normalizeWorkerEnvSegment(workerName) {
268
+ return workerName
269
+ .replace(/([a-z0-9])([A-Z])/g, '$1_$2') // camelCase word boundary → underscore
270
+ .replace(/[^A-Za-z0-9]+/g, '_') // kebab / space / other → underscore
271
+ .replace(/_+/g, '_') // collapse repeats
272
+ .replace(/^_|_$/g, '') // trim edges
273
+ .toUpperCase();
274
+ }
275
+ /**
276
+ * The `WILDO_WORKER_<NAME>_URL` env-var name for a declared worker. The single
277
+ * source of truth for both emit (CLI) and read (backend factory).
278
+ *
279
+ * @example wildoWorkerUrlEnvKey('myNodeWorker') // 'WILDO_WORKER_MY_NODE_WORKER_URL'
280
+ */
281
+ export function wildoWorkerUrlEnvKey(workerName) {
282
+ return `${WILDO_WORKER_URL_ENV_PREFIX}${normalizeWorkerEnvSegment(workerName)}${WILDO_WORKER_URL_ENV_SUFFIX}`;
283
+ }
284
+ /**
285
+ * Normalize a service key (the `wildo.saas.config.ts` `minions`/`workers` bucket
286
+ * key — authored camelCase or kebab, e.g. `marketingScrapper` / `my-rust-worker`)
287
+ * into an RFC1123-valid DNS label segment: lowercase, `[a-z0-9-]` only, no
288
+ * leading/trailing hyphen. `marketingScrapper` → `marketing-scrapper`,
289
+ * `myNodeWorker` → `my-node-worker`.
290
+ *
291
+ * This is the DNS-NAME axis of a background runtime — the segment embedded in the
292
+ * k8s object/Service name, the built container image ref, the compose service name,
293
+ * and the worker dispatch URL host. It is DISTINCT from the IDENTITY axis (the raw
294
+ * bucket key), which apps-manager keys on (`appConfig.workers[key]` /
295
+ * `appConfig.minions[key]`) and which the worker stamps as `APP_OWNED_SERVICE_NAME`
296
+ * / both runtimes carry as the `wildo.ai/owned-service-name` pod label — the
297
+ * identity axis MUST stay raw and is NEVER passed through this helper. The
298
+ * env-key axis (`WILDO_WORKER_<NAME>_URL`) has its own normalization,
299
+ * {@link normalizeWorkerEnvSegment}, because an env-var name is UPPER_SNAKE, not a
300
+ * DNS label.
301
+ *
302
+ * This helper does NOT truncate — a name too long for a DNS label (63 chars) is
303
+ * REJECTED at authoring, not silently shortened (truncation risks colliding with
304
+ * a sibling key). Returns `''` for all-symbol input. The authoring-time guard in
305
+ * `define-saas-config.ts` fails fast on keys that normalize to empty, collide with
306
+ * a sibling after normalization, or whose full `{slug}-{kind}-{name}` deploy name
307
+ * exceeds 63 chars — so an empty / duplicate / over-long DNS name can never reach
308
+ * the render.
309
+ */
310
+ export function normalizeServiceKeyToDnsName(key) {
311
+ return key
312
+ .replace(/([a-z0-9])([A-Z])/g, '$1-$2') // camelCase word boundary → hyphen
313
+ .toLowerCase()
314
+ .replace(/[^a-z0-9]+/g, '-') // any non-DNS char (kebab already ok) → hyphen
315
+ .replace(/^-+|-+$/g, ''); // trim leading/trailing hyphens
316
+ }
317
+ /**
318
+ * The k8s Service (and same-network compose service) name for a per-app worker:
319
+ * `{appSlug}-worker-{dnsName}`, where `dnsName` is the bucket key normalized to an
320
+ * RFC1123 label ({@link normalizeServiceKeyToDnsName}). Coherent-by-construction
321
+ * with the CLI k8s render (`renderWorkerForTarget`), the compose render
322
+ * (`deriveAppRuntimeServiceName`), the CI image build (`syncCicd`), and the worker
323
+ * dispatch URL host ({@link buildWorkerInternalUrl}) — EVERY DNS-name site derives
324
+ * the name through THIS helper (rather than inlining `{appSlug}-worker-{key}`), so
325
+ * the backend calls the exact Service the render deploys and CI builds the exact
326
+ * image ref the deploy pulls.
327
+ *
328
+ * `workerName` is the saas-config bucket key (NOT the per-folder `config.name`) —
329
+ * passed raw; the normalization happens inside. The raw key remains the worker's
330
+ * IDENTITY (apps-manager lookup + `APP_OWNED_SERVICE_NAME`), a separate axis that
331
+ * is never derived from this function.
332
+ */
333
+ export function buildWorkerServiceName(appSlug, workerName) {
334
+ return `${appSlug}-worker-${normalizeServiceKeyToDnsName(workerName)}`;
335
+ }
336
+ /**
337
+ * The k8s Deployment (and same-network compose service) name for a per-app minion:
338
+ * `{appSlug}-minion-{dnsName}`, where `dnsName` is the bucket key normalized to an
339
+ * RFC1123 label ({@link normalizeServiceKeyToDnsName}). Symmetric with
340
+ * {@link buildWorkerServiceName} — minions have no inbound Service / dispatch URL,
341
+ * but the k8s render, the compose render, and the CI image build all need the
342
+ * deploy name, and it must be RFC1123-valid for the same reasons. `minionName` is
343
+ * the saas-config bucket key; the raw key stays the minion's IDENTITY (the
344
+ * `wildo.ai/owned-service-name` pod label), never derived from here.
345
+ */
346
+ export function buildMinionServiceName(appSlug, minionName) {
347
+ return `${appSlug}-minion-${normalizeServiceKeyToDnsName(minionName)}`;
348
+ }
349
+ /**
350
+ * The in-cluster base URL the app-backend uses to reach a per-app worker
351
+ * (`http://{appSlug}-worker-{workerName}:{port}`). The backend + its workers
352
+ * deploy into the SAME namespace (per-app deploy), so the short Service name
353
+ * resolves without a namespace qualifier. `port` is the worker's authored
354
+ * `http.port` (schema default 8080).
355
+ */
356
+ export function buildWorkerInternalUrl(appSlug, workerName, port) {
357
+ return `http://${buildWorkerServiceName(appSlug, workerName)}:${port}`;
358
+ }
359
+ //# sourceMappingURL=application-backend-env.contracts.js.map