@superblocksteam/shared 0.9590.8 → 0.9591.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/dist/database-lifecycle/index.d.ts +33 -74
- package/dist/database-lifecycle/index.d.ts.map +1 -1
- package/dist/database-lifecycle/index.js +33 -31
- package/dist/database-lifecycle/index.js.map +1 -1
- package/dist/database-lifecycle/index.test.js +6 -6
- package/dist/database-lifecycle/index.test.js.map +1 -1
- package/dist/socket/protocol.d.ts +16 -2
- package/dist/socket/protocol.d.ts.map +1 -1
- package/dist/socket/protocol.js.map +1 -1
- package/dist/types/ai/index.d.ts +1 -0
- package/dist/types/ai/index.d.ts.map +1 -1
- package/dist/types/ai/index.js +1 -0
- package/dist/types/ai/index.js.map +1 -1
- package/dist/types/ai/quota-paywall.d.ts +8 -0
- package/dist/types/ai/quota-paywall.d.ts.map +1 -1
- package/dist/types/ai/quota-paywall.js +19 -1
- package/dist/types/ai/quota-paywall.js.map +1 -1
- package/dist/types/ai/safety-classification.d.ts +16 -0
- package/dist/types/ai/safety-classification.d.ts.map +1 -0
- package/dist/types/ai/safety-classification.js +22 -0
- package/dist/types/ai/safety-classification.js.map +1 -0
- package/dist/types/application/index.d.ts +15 -0
- package/dist/types/application/index.d.ts.map +1 -1
- package/dist/types/application/index.js.map +1 -1
- package/dist/types/audit/ocsf.d.ts +32 -0
- package/dist/types/audit/ocsf.d.ts.map +1 -1
- package/dist/types/audit/ocsf.js +2 -0
- package/dist/types/audit/ocsf.js.map +1 -1
- package/dist/types/billing/billing.d.ts +1 -0
- package/dist/types/billing/billing.d.ts.map +1 -1
- package/dist/types/billing/billing.js +10 -0
- package/dist/types/billing/billing.js.map +1 -1
- package/dist/types/billing/index.d.ts +1 -0
- package/dist/types/billing/index.d.ts.map +1 -1
- package/dist/types/billing/index.js +1 -0
- package/dist/types/billing/index.js.map +1 -1
- package/dist/types/billing/spendAlert.d.ts +62 -0
- package/dist/types/billing/spendAlert.d.ts.map +1 -0
- package/dist/types/billing/spendAlert.js +11 -0
- package/dist/types/billing/spendAlert.js.map +1 -0
- package/dist/types/policyGate/index.d.ts +24 -0
- package/dist/types/policyGate/index.d.ts.map +1 -1
- package/dist/types/policyGate/index.js +9 -0
- package/dist/types/policyGate/index.js.map +1 -1
- package/dist/types/rbac/index.d.ts +4 -0
- package/dist/types/rbac/index.d.ts.map +1 -1
- package/dist/types/rbac/index.js +4 -0
- package/dist/types/rbac/index.js.map +1 -1
- package/dist/types/reviewPolicy/index.d.ts +9 -3
- package/dist/types/reviewPolicy/index.d.ts.map +1 -1
- package/dist/types/reviewPolicy/index.js +5 -1
- package/dist/types/reviewPolicy/index.js.map +1 -1
- package/dist-esm/database-lifecycle/index.d.ts +33 -74
- package/dist-esm/database-lifecycle/index.d.ts.map +1 -1
- package/dist-esm/database-lifecycle/index.js +32 -29
- package/dist-esm/database-lifecycle/index.js.map +1 -1
- package/dist-esm/database-lifecycle/index.test.js +6 -6
- package/dist-esm/database-lifecycle/index.test.js.map +1 -1
- package/dist-esm/socket/protocol.d.ts +16 -2
- package/dist-esm/socket/protocol.d.ts.map +1 -1
- package/dist-esm/socket/protocol.js.map +1 -1
- package/dist-esm/types/ai/index.d.ts +1 -0
- package/dist-esm/types/ai/index.d.ts.map +1 -1
- package/dist-esm/types/ai/index.js +1 -0
- package/dist-esm/types/ai/index.js.map +1 -1
- package/dist-esm/types/ai/quota-paywall.d.ts +8 -0
- package/dist-esm/types/ai/quota-paywall.d.ts.map +1 -1
- package/dist-esm/types/ai/quota-paywall.js +17 -0
- package/dist-esm/types/ai/quota-paywall.js.map +1 -1
- package/dist-esm/types/ai/safety-classification.d.ts +16 -0
- package/dist-esm/types/ai/safety-classification.d.ts.map +1 -0
- package/dist-esm/types/ai/safety-classification.js +19 -0
- package/dist-esm/types/ai/safety-classification.js.map +1 -0
- package/dist-esm/types/application/index.d.ts +15 -0
- package/dist-esm/types/application/index.d.ts.map +1 -1
- package/dist-esm/types/application/index.js.map +1 -1
- package/dist-esm/types/audit/ocsf.d.ts +32 -0
- package/dist-esm/types/audit/ocsf.d.ts.map +1 -1
- package/dist-esm/types/audit/ocsf.js +2 -0
- package/dist-esm/types/audit/ocsf.js.map +1 -1
- package/dist-esm/types/billing/billing.d.ts +1 -0
- package/dist-esm/types/billing/billing.d.ts.map +1 -1
- package/dist-esm/types/billing/billing.js +9 -0
- package/dist-esm/types/billing/billing.js.map +1 -1
- package/dist-esm/types/billing/index.d.ts +1 -0
- package/dist-esm/types/billing/index.d.ts.map +1 -1
- package/dist-esm/types/billing/index.js +1 -0
- package/dist-esm/types/billing/index.js.map +1 -1
- package/dist-esm/types/billing/spendAlert.d.ts +62 -0
- package/dist-esm/types/billing/spendAlert.d.ts.map +1 -0
- package/dist-esm/types/billing/spendAlert.js +10 -0
- package/dist-esm/types/billing/spendAlert.js.map +1 -0
- package/dist-esm/types/policyGate/index.d.ts +24 -0
- package/dist-esm/types/policyGate/index.d.ts.map +1 -1
- package/dist-esm/types/policyGate/index.js +8 -1
- package/dist-esm/types/policyGate/index.js.map +1 -1
- package/dist-esm/types/rbac/index.d.ts +4 -0
- package/dist-esm/types/rbac/index.d.ts.map +1 -1
- package/dist-esm/types/rbac/index.js +4 -0
- package/dist-esm/types/rbac/index.js.map +1 -1
- package/dist-esm/types/reviewPolicy/index.d.ts +9 -3
- package/dist-esm/types/reviewPolicy/index.d.ts.map +1 -1
- package/dist-esm/types/reviewPolicy/index.js +4 -0
- package/dist-esm/types/reviewPolicy/index.js.map +1 -1
- package/package.json +2 -2
- package/src/database-lifecycle/index.test.ts +6 -6
- package/src/database-lifecycle/index.ts +76 -152
- package/src/socket/protocol.ts +22 -4
- package/src/types/ai/index.ts +1 -0
- package/src/types/ai/quota-paywall.ts +20 -0
- package/src/types/ai/safety-classification.ts +27 -0
- package/src/types/application/index.ts +16 -0
- package/src/types/audit/ocsf.ts +43 -0
- package/src/types/billing/billing.ts +11 -0
- package/src/types/billing/index.ts +1 -0
- package/src/types/billing/spendAlert.ts +84 -0
- package/src/types/policyGate/index.ts +28 -0
- package/src/types/rbac/index.ts +4 -0
- package/src/types/reviewPolicy/index.ts +13 -3
|
@@ -54,6 +54,7 @@ export interface ReviewPolicyDto {
|
|
|
54
54
|
type: ReviewPolicyScopeType;
|
|
55
55
|
};
|
|
56
56
|
lastRun: ReviewPolicyLastRunDto | null;
|
|
57
|
+
freshPendingApprovalRunCount: number;
|
|
57
58
|
createdBy: string | null;
|
|
58
59
|
created: string;
|
|
59
60
|
}
|
|
@@ -71,6 +72,7 @@ export interface ReviewPolicyRunDto {
|
|
|
71
72
|
status: ReviewRunStatus;
|
|
72
73
|
decision: ReviewRunDecision | null;
|
|
73
74
|
decisionReason: string | null;
|
|
75
|
+
hasFreshPendingApproval: boolean;
|
|
74
76
|
startedAt: string | null;
|
|
75
77
|
completedAt: string | null;
|
|
76
78
|
created: string;
|
|
@@ -108,11 +110,15 @@ export interface ReviewPolicyRunsDto {
|
|
|
108
110
|
policy: ReviewPolicyDto;
|
|
109
111
|
runs: ReviewPolicyRunDto[];
|
|
110
112
|
}
|
|
113
|
+
export declare const REVIEW_POLICY_SUMMARY_WINDOWS: readonly ["24h", "7d", "30d"];
|
|
114
|
+
export type ReviewPolicySummaryWindow = (typeof REVIEW_POLICY_SUMMARY_WINDOWS)[number];
|
|
115
|
+
export declare const DEFAULT_REVIEW_POLICY_SUMMARY_WINDOW: ReviewPolicySummaryWindow;
|
|
111
116
|
export interface ReviewPolicySummaryDto {
|
|
112
117
|
activeAgents: number;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
agentRuns: number;
|
|
119
|
+
securityScans: number;
|
|
120
|
+
findings: number;
|
|
121
|
+
window: ReviewPolicySummaryWindow;
|
|
116
122
|
}
|
|
117
123
|
export type CreateReviewPolicyBody = {
|
|
118
124
|
policyType: 'built_in_security_scan';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../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3F,MAAM,MAAM,sBAAsB,GAAG;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,CAAC;AAC/D,MAAM,MAAM,4BAA4B,GACpC;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,wBAAwB,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAA;CAAE,GACzF;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -41,4 +41,8 @@ export const REVIEW_RUN_STATUSES = [
|
|
|
41
41
|
// Lifecycle ordering is semantically meaningful.
|
|
42
42
|
export const REVIEW_RUN_DECISIONS = ['allowed', 'advisory_allowed', 'blocked', 'error_blocked', 'not_applicable'];
|
|
43
43
|
export const REVIEW_RUN_TRIGGERED_BYS = ['system', 'user'];
|
|
44
|
+
// Trailing-time windows the summary can be scoped to. Order is semantically
|
|
45
|
+
// meaningful (shortest to longest) for rendering the selector.
|
|
46
|
+
export const REVIEW_POLICY_SUMMARY_WINDOWS = ['24h', '7d', '30d'];
|
|
47
|
+
export const DEFAULT_REVIEW_POLICY_SUMMARY_WINDOW = '24h';
|
|
44
48
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/reviewPolicy/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAU,CAAC;AAEjE,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AACjD,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAErD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,wBAAwB,EAAE,gBAAgB,CAAU,CAAC;AACzF,MAAM,CAAC,MAAM,qBAAq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AClB,gBAAgB;IAChB,QAAQ;IACR,gBAAgB;IAChB,eAAe;CACP,CAAC;AAEX,sFAAsF;AACtF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAU,CAAC;AAChG,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;AAC7E,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AAE7F,iHAAiH;AACjH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,UAAU;IACV,SAAS;IACT,SAAS;IACT,WAAW;IACX,UAAU;IACV,OAAO;CACC,CAAC;AAEX,iDAAiD;AACjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,CAAU,CAAC;AAC3H,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAU,CAAC;AAuGpE,4EAA4E;AAC5E,+DAA+D;AAC/D,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAE3E,MAAM,CAAC,MAAM,oCAAoC,GAA8B,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9591.0",
|
|
4
4
|
"description": "Superblocks Shared Resources",
|
|
5
5
|
"license": "Superblocks Community Software License",
|
|
6
6
|
"repository": "https://github.com/superblocksteam/shared.git",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"chokidar-cli": "3.0.0",
|
|
51
51
|
"eslint": "^9.39.2",
|
|
52
52
|
"eslint-config-prettier": "^10.1.8",
|
|
53
|
-
"eslint-config-turbo": "^2.
|
|
53
|
+
"eslint-config-turbo": "^2.9.16",
|
|
54
54
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
55
55
|
"eslint-plugin-import": "^2.32.0",
|
|
56
56
|
"esprima": "^4.0.1",
|
|
@@ -30,20 +30,20 @@ describe('database lifecycle contracts', () => {
|
|
|
30
30
|
computeBindingKey({
|
|
31
31
|
organizationId: 'org-1',
|
|
32
32
|
applicationId: 'app-1',
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
environment: 'edit',
|
|
34
|
+
profile: 'Staging EU',
|
|
35
35
|
requirementKey: 'orders-db~Orders%20DB:postgres'
|
|
36
36
|
})
|
|
37
|
-
).toBe('org-1:app-1:
|
|
37
|
+
).toBe('org-1:app-1:edit:staging-eu~Staging%20EU:orders-db~Orders%20DB:postgres');
|
|
38
38
|
expect(
|
|
39
39
|
computeBindingKey({
|
|
40
40
|
organizationId: 'org-1',
|
|
41
41
|
applicationId: 'app-1',
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
environment: 'edit',
|
|
43
|
+
profile: 'staging',
|
|
44
44
|
requirementKey: 'orders-db~Orders%20DB:postgres'
|
|
45
45
|
})
|
|
46
|
-
).toBe('org-1:app-1:
|
|
46
|
+
).toBe('org-1:app-1:edit:staging~staging:orders-db~Orders%20DB:postgres');
|
|
47
47
|
|
|
48
48
|
await expect(computeDesiredSpecHash(requirement)).resolves.toBe(
|
|
49
49
|
await computeDesiredSpecHash({ ...requirement, extensions: ['uuid-ossp', 'pgcrypto'] })
|
|
@@ -4,12 +4,32 @@ export const LIFECYCLE_TERMINAL_STATES = ['ready', 'failed', 'cancelled'] as con
|
|
|
4
4
|
export const LIFECYCLE_NON_TERMINAL_STATES = ['pending', 'provisioning', 'migrating', 'retiring'] as const;
|
|
5
5
|
export const LIFECYCLE_STATES = [...LIFECYCLE_NON_TERMINAL_STATES, ...LIFECYCLE_TERMINAL_STATES] as const;
|
|
6
6
|
export const LIFECYCLE_MIGRATION_STATES = ['pending', 'migrated', 'failed'] as const;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
// The environment axis (edit/preview/deployed) lives on the binding, so a
|
|
8
|
+
// single `ensure_database` covers what used to be split into
|
|
9
|
+
// ensure_dev_database / ensure_prod_database. `migrate_schema` and
|
|
10
|
+
// `retire_database` were always environment-agnostic.
|
|
11
|
+
export const LIFECYCLE_OPERATIONS = ['ensure_database', 'migrate_schema', 'retire_database'] as const;
|
|
12
|
+
// Mirrors the platform's view modes (proto api.v1.ViewMode: VIEW_MODE_EDIT /
|
|
13
|
+
// VIEW_MODE_PREVIEW / VIEW_MODE_DEPLOYED). Working-state migrations and the
|
|
14
|
+
// shared workspace database serve edit/preview; deploy-commit migrations and
|
|
15
|
+
// the deploy gate concern deployed.
|
|
16
|
+
export const LIFECYCLE_ENVIRONMENTS = ['edit', 'preview', 'deployed'] as const;
|
|
9
17
|
export const DATABASE_ENGINES = ['postgres', 'snowflake', 'snowflake_postgres', 'lakebase'] as const;
|
|
10
18
|
export const DATABASE_LIFECYCLE_MANAGED_BY = 'database_lifecycle';
|
|
11
19
|
|
|
12
|
-
|
|
20
|
+
// Agent capability tag keys. A lifecycle worker publishes these in the
|
|
21
|
+
// `tags` map of its agent registration (merged into — never replacing — the
|
|
22
|
+
// tag map the agent already publishes; the existing `profile` tag carries
|
|
23
|
+
// datatag coverage, same meaning it has for execution routing. Lifecycle
|
|
24
|
+
// environment/profile coverage is published as pairs so edit-only staging
|
|
25
|
+
// profiles do not imply deployed staging support. The server matches pending
|
|
26
|
+
// lifecycle requests against these at poll/claim time and gates task creation
|
|
27
|
+
// on "some active org agent supports this".
|
|
28
|
+
export const DATABASE_LIFECYCLE_TAG_OPERATIONS = 'databaseLifecycle:operations';
|
|
29
|
+
export const DATABASE_LIFECYCLE_TAG_ENGINES = 'databaseLifecycle:engines';
|
|
30
|
+
export const DATABASE_LIFECYCLE_TAG_ENVIRONMENT_PROFILES = 'databaseLifecycle:environmentProfiles';
|
|
31
|
+
|
|
32
|
+
export type LifecycleEnvironment = (typeof LIFECYCLE_ENVIRONMENTS)[number];
|
|
13
33
|
export type DatabaseEngine = (typeof DATABASE_ENGINES)[number];
|
|
14
34
|
export type LifecycleOperation = (typeof LIFECYCLE_OPERATIONS)[number];
|
|
15
35
|
export type LifecycleTerminalState = (typeof LIFECYCLE_TERMINAL_STATES)[number];
|
|
@@ -40,22 +60,6 @@ export type CredentialRef = {
|
|
|
40
60
|
field?: string;
|
|
41
61
|
};
|
|
42
62
|
|
|
43
|
-
export type CredentialResolverConfig = {
|
|
44
|
-
type: CredentialResolver;
|
|
45
|
-
config: Record<string, unknown>;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// Reference to a versioned Terraform module that the lifecycle worker should
|
|
49
|
-
// invoke for one operation in this profile. `baseInputs` are profile-level
|
|
50
|
-
// inputs the org admin sets once (AWS account/region/VPC/subnets/KMS/...);
|
|
51
|
-
// the planner merges these with binding-derived inputs (binding_key,
|
|
52
|
-
// requirement spec, credential refs) when it builds a dispatch payload.
|
|
53
|
-
export type TerraformModuleRef = {
|
|
54
|
-
source: string;
|
|
55
|
-
version: string;
|
|
56
|
-
baseInputs: Record<string, unknown>;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
63
|
export type DatabaseRequirement = {
|
|
60
64
|
logicalName: string;
|
|
61
65
|
engine: DatabaseEngine;
|
|
@@ -66,51 +70,17 @@ export type DatabaseRequirement = {
|
|
|
66
70
|
migrationDirectory?: string;
|
|
67
71
|
};
|
|
68
72
|
|
|
69
|
-
export type TerraformDatabaseBackend = {
|
|
70
|
-
provisioner: 'terraform';
|
|
71
|
-
provider: 'aws-rds' | 'snowflake' | 'databricks';
|
|
72
|
-
stateBackend: 's3' | 'gcs' | 'azurerm' | 'local';
|
|
73
|
-
remoteState: boolean;
|
|
74
|
-
locking: boolean;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export type DatabaseBackend = TerraformDatabaseBackend;
|
|
78
|
-
|
|
79
|
-
export type EnvironmentProfile = {
|
|
80
|
-
id: string;
|
|
81
|
-
organizationId: string;
|
|
82
|
-
environmentClass: EnvironmentClass;
|
|
83
|
-
environmentName: string;
|
|
84
|
-
opaAgentId: string;
|
|
85
|
-
supportedOperations: LifecycleOperation[];
|
|
86
|
-
supportedEngines: DatabaseEngine[];
|
|
87
|
-
backend: DatabaseBackend;
|
|
88
|
-
// V1 stop-gap. Picks the Terraform module the lifecycle worker invokes
|
|
89
|
-
// per operation. `Partial` because not every operation is Terraform-backed
|
|
90
|
-
// in V1 — `migrate_schema` is served by the native Go runner inside the
|
|
91
|
-
// worker (ENG-3415); admins leave it unset and the dispatcher skips
|
|
92
|
-
// emitting a Terraform dispatch for it.
|
|
93
|
-
//
|
|
94
|
-
// TODO(ENG-3456): collapse into per-operation backends when the
|
|
95
|
-
// shared-vs-isolated admin config lands. Each operation will then carry
|
|
96
|
-
// its own discriminated kind ('terraform' | 'native-migration-runner'),
|
|
97
|
-
// with the module reference and Terraform backend config nested under
|
|
98
|
-
// kind: 'terraform'. The wire protocol picks up a matching discriminant.
|
|
99
|
-
moduleSelectors: Partial<Record<LifecycleOperation, TerraformModuleRef>>;
|
|
100
|
-
// Where the worker resolves and writes credential refs. Scoped per profile
|
|
101
|
-
// because dev/prod profiles may use different resolvers (e.g. opa_local
|
|
102
|
-
// for dev, aws_secrets_manager for prod).
|
|
103
|
-
credentialResolver: CredentialResolverConfig;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
73
|
type DatabaseBindingBase = {
|
|
107
74
|
id: string;
|
|
108
75
|
bindingKey: string;
|
|
109
76
|
requirementKey: string;
|
|
110
77
|
logicalName: string;
|
|
111
78
|
applicationId: string;
|
|
112
|
-
|
|
113
|
-
|
|
79
|
+
environment: LifecycleEnvironment;
|
|
80
|
+
// The datatag key (Profile.key, e.g. 'staging' / 'production') this
|
|
81
|
+
// binding serves. The same datatag can exist across environments, so the
|
|
82
|
+
// pair (environment, profile) — not either alone — scopes a binding.
|
|
83
|
+
profile: string;
|
|
114
84
|
desiredSpecHash: string;
|
|
115
85
|
migrationState: LifecycleMigrationState;
|
|
116
86
|
};
|
|
@@ -148,47 +118,33 @@ export type LifecycleRequest = {
|
|
|
148
118
|
state: LifecycleState;
|
|
149
119
|
};
|
|
150
120
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
export type TerraformModuleOutput = {
|
|
159
|
-
connection: Record<string, string | number | boolean>;
|
|
160
|
-
credentialRefs: Record<string, CredentialRef>;
|
|
161
|
-
resourceKey: string;
|
|
162
|
-
};
|
|
121
|
+
// Physical database instances back the M2 shared-RDS allocation pattern: dev-DB
|
|
122
|
+
// provisioning issues `CREATE DATABASE`/`CREATE ROLE` against a pre-existing
|
|
123
|
+
// physical database instance instead of spinning up a fresh RDS per binding.
|
|
124
|
+
// The control plane is the dumb org-scoped state store (registry + atomic
|
|
125
|
+
// capacity counter); ALL selection and provisioning logic lives in the worker.
|
|
126
|
+
export const PHYSICAL_DATABASE_INSTANCE_STATUSES = ['active', 'draining', 'retired'] as const;
|
|
127
|
+
export type PhysicalDatabaseInstanceStatus = (typeof PHYSICAL_DATABASE_INSTANCE_STATUSES)[number];
|
|
163
128
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
// `terraform { backend "<stateBackend>" {} }` block — same name as on the
|
|
179
|
-
// profile side. `remoteState` and `locking` pass through unchanged. The
|
|
180
|
-
// worker doesn't see `provisioner`/`provider` — those are server-side
|
|
181
|
-
// categorical fields, not backend args.
|
|
182
|
-
export type TerraformBackendDispatch = {
|
|
183
|
-
stateBackend: TerraformDatabaseBackend['stateBackend'];
|
|
184
|
-
remoteState: boolean;
|
|
185
|
-
locking: boolean;
|
|
186
|
-
key: string;
|
|
129
|
+
export type PhysicalDatabaseInstance = {
|
|
130
|
+
id: string;
|
|
131
|
+
organizationId: string;
|
|
132
|
+
region: string;
|
|
133
|
+
environment: LifecycleEnvironment;
|
|
134
|
+
engine: DatabaseEngine; // postgres-only in V1
|
|
135
|
+
endpoint: string;
|
|
136
|
+
masterCredentialRef: CredentialRef;
|
|
137
|
+
capacityMax: number;
|
|
138
|
+
capacityUsed: number;
|
|
139
|
+
status: PhysicalDatabaseInstanceStatus;
|
|
140
|
+
metadata: Record<string, unknown>;
|
|
141
|
+
created?: Date;
|
|
142
|
+
updated?: Date;
|
|
187
143
|
};
|
|
188
144
|
|
|
189
145
|
// One forward-only SQL migration the server attaches to a dispatch
|
|
190
146
|
// payload so the lifecycle worker's migration runner can apply it after
|
|
191
|
-
//
|
|
147
|
+
// provisioning succeeds. `version` is the sort key + the primary key in
|
|
192
148
|
// the worker's in-DB `superblocks_schema_migrations` ledger; `filename`
|
|
193
149
|
// is recorded for diagnostics; `sql` is the raw multi-statement SQL.
|
|
194
150
|
// Matches `orchestrator/pkg/databaselifecycle/migrations.Migration`.
|
|
@@ -201,32 +157,31 @@ export type LifecycleMigration = {
|
|
|
201
157
|
// Canonical wire payload for a lifecycle dispatch sent from the server to a
|
|
202
158
|
// lifecycle worker. The worker's `DispatchPayload` struct in
|
|
203
159
|
// orchestrator/pkg/databaselifecycle/dispatch.go decodes this JSON shape;
|
|
204
|
-
// keys and order here are intentional.
|
|
205
|
-
//
|
|
160
|
+
// keys and order here are intentional.
|
|
161
|
+
//
|
|
162
|
+
// The server describes WHAT (binding identity, desired spec, migrations,
|
|
163
|
+
// connection/credential context); the worker owns HOW (Terraform modules,
|
|
164
|
+
// state backends, credential resolvers, shared physical database instances — all resolved from
|
|
165
|
+
// the worker's local config keyed by the payload's environment + profile).
|
|
206
166
|
//
|
|
207
167
|
// `migrations` is present iff the operation should consider migration
|
|
208
|
-
// state — `
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
// "
|
|
212
|
-
// non-empty slice triggers the runner.
|
|
168
|
+
// state — `ensure_database` / `migrate_schema` dispatches carry an array
|
|
169
|
+
// (possibly empty); `retire_database` omits it. An omitted slice keeps the
|
|
170
|
+
// worker's `MigrationState` at the default "pending"; an empty slice means
|
|
171
|
+
// "vacuous truth, mark migrated"; a non-empty slice triggers the runner.
|
|
213
172
|
export type LifecycleDispatchPayload = {
|
|
214
|
-
agentId: string;
|
|
215
173
|
bindingKey: string;
|
|
216
174
|
connectionMetadata?: Record<string, string | number | boolean>;
|
|
217
175
|
desiredSpec: DatabaseRequirement;
|
|
218
176
|
desiredSpecHash: string;
|
|
177
|
+
environment: LifecycleEnvironment;
|
|
219
178
|
migrations?: LifecycleMigration[];
|
|
220
179
|
operation: LifecycleOperation;
|
|
221
|
-
|
|
180
|
+
profile: string;
|
|
222
181
|
requestId: string;
|
|
223
182
|
resourceKey: string;
|
|
224
183
|
runtimeCredentialRefs?: Record<string, CredentialRef>;
|
|
225
|
-
|
|
226
|
-
// dispatches, where the worker skips Terraform materialization and runs the
|
|
227
|
-
// migration runner directly.
|
|
228
|
-
terraformBackend?: TerraformBackendDispatch;
|
|
229
|
-
terraformModule?: TerraformModuleDispatch;
|
|
184
|
+
migrationCredentialRefs?: Record<string, CredentialRef>;
|
|
230
185
|
};
|
|
231
186
|
|
|
232
187
|
export function computeRequirementKey(requirement: Pick<DatabaseRequirement, 'logicalName' | 'engine'>): string {
|
|
@@ -236,8 +191,8 @@ export function computeRequirementKey(requirement: Pick<DatabaseRequirement, 'lo
|
|
|
236
191
|
export function computeBindingKey(input: {
|
|
237
192
|
organizationId: string;
|
|
238
193
|
applicationId: string;
|
|
239
|
-
|
|
240
|
-
|
|
194
|
+
environment: LifecycleEnvironment;
|
|
195
|
+
profile: string;
|
|
241
196
|
requirementKey: string;
|
|
242
197
|
}): string {
|
|
243
198
|
return [input.organizationId, ...bindingKeySegments(input)].join(':');
|
|
@@ -245,8 +200,8 @@ export function computeBindingKey(input: {
|
|
|
245
200
|
|
|
246
201
|
export function computeLegacyBindingKeyWithoutOrganization(input: {
|
|
247
202
|
applicationId: string;
|
|
248
|
-
|
|
249
|
-
|
|
203
|
+
environment: LifecycleEnvironment;
|
|
204
|
+
profile: string;
|
|
250
205
|
requirementKey: string;
|
|
251
206
|
}): string {
|
|
252
207
|
return bindingKeySegments(input).join(':');
|
|
@@ -254,16 +209,11 @@ export function computeLegacyBindingKeyWithoutOrganization(input: {
|
|
|
254
209
|
|
|
255
210
|
function bindingKeySegments(input: {
|
|
256
211
|
applicationId: string;
|
|
257
|
-
|
|
258
|
-
|
|
212
|
+
environment: LifecycleEnvironment;
|
|
213
|
+
profile: string;
|
|
259
214
|
requirementKey: string;
|
|
260
215
|
}): string[] {
|
|
261
|
-
return [
|
|
262
|
-
input.applicationId,
|
|
263
|
-
input.environmentClass,
|
|
264
|
-
`${slugify(input.environmentName)}~${encodeURIComponent(input.environmentName)}`,
|
|
265
|
-
input.requirementKey
|
|
266
|
-
];
|
|
216
|
+
return [input.applicationId, input.environment, `${slugify(input.profile)}~${encodeURIComponent(input.profile)}`, input.requirementKey];
|
|
267
217
|
}
|
|
268
218
|
|
|
269
219
|
export async function computeDesiredSpecHash(requirement: DatabaseRequirement): Promise<string> {
|
|
@@ -273,52 +223,26 @@ export async function computeDesiredSpecHash(requirement: DatabaseRequirement):
|
|
|
273
223
|
// resource_key identifies the physical resource a binding maps to in
|
|
274
224
|
// customer infrastructure, and is the unit of locking inside the lifecycle
|
|
275
225
|
// worker. Distinct from binding_key (product identity in the control plane)
|
|
276
|
-
// because
|
|
277
|
-
//
|
|
278
|
-
// fresh resource. Shape mirrors planning doc §15.
|
|
226
|
+
// because the worker derives infrastructure identity from it — shape
|
|
227
|
+
// mirrors planning doc §15.
|
|
279
228
|
export function computeResourceKey(input: {
|
|
280
229
|
organizationId: string;
|
|
281
|
-
profileId: string;
|
|
282
230
|
applicationId: string;
|
|
283
231
|
requirementKey: string;
|
|
284
|
-
|
|
285
|
-
|
|
232
|
+
environment: LifecycleEnvironment;
|
|
233
|
+
profile: string;
|
|
286
234
|
actorScope?: string;
|
|
287
235
|
}): string {
|
|
288
236
|
return [
|
|
289
237
|
input.organizationId,
|
|
290
|
-
input.profileId,
|
|
291
238
|
input.applicationId,
|
|
292
239
|
input.requirementKey,
|
|
293
|
-
input.
|
|
294
|
-
`${slugify(input.
|
|
240
|
+
input.environment,
|
|
241
|
+
`${slugify(input.profile)}~${encodeURIComponent(input.profile)}`,
|
|
295
242
|
input.actorScope ?? 'default'
|
|
296
243
|
].join('/');
|
|
297
244
|
}
|
|
298
245
|
|
|
299
|
-
// Per-binding Terraform state path inside the configured backend. Used to
|
|
300
|
-
// generate the `backend.tfbackend` config that the worker passes to
|
|
301
|
-
// `terraform init -backend-config=...`. Planning doc §9.4.
|
|
302
|
-
export function computeTerraformStateKey(input: {
|
|
303
|
-
organizationId: string;
|
|
304
|
-
applicationId: string;
|
|
305
|
-
requirementKey: string;
|
|
306
|
-
environmentClass: EnvironmentClass;
|
|
307
|
-
environmentName: string;
|
|
308
|
-
actorScope?: string;
|
|
309
|
-
}): string {
|
|
310
|
-
return [
|
|
311
|
-
'superblocks/byo-db',
|
|
312
|
-
input.environmentClass,
|
|
313
|
-
input.organizationId,
|
|
314
|
-
input.applicationId,
|
|
315
|
-
input.requirementKey,
|
|
316
|
-
`${slugify(input.environmentName)}~${encodeURIComponent(input.environmentName)}`,
|
|
317
|
-
input.actorScope ?? 'default',
|
|
318
|
-
'terraform.tfstate'
|
|
319
|
-
].join('/');
|
|
320
|
-
}
|
|
321
|
-
|
|
322
246
|
export function isTerminalLifecycleState(state: LifecycleState): state is LifecycleTerminalState {
|
|
323
247
|
return (LIFECYCLE_TERMINAL_STATES as readonly string[]).includes(state);
|
|
324
248
|
}
|
package/src/socket/protocol.ts
CHANGED
|
@@ -23,7 +23,8 @@ import {
|
|
|
23
23
|
ModifyEntitiesResponse,
|
|
24
24
|
GetAppBranchLockResponseBody,
|
|
25
25
|
LockInfo,
|
|
26
|
-
DegradedMode
|
|
26
|
+
DegradedMode,
|
|
27
|
+
CheckpointSkipReason
|
|
27
28
|
} from '../types';
|
|
28
29
|
import {
|
|
29
30
|
AiChatMessageDto,
|
|
@@ -36,7 +37,8 @@ import {
|
|
|
36
37
|
FactCreate,
|
|
37
38
|
FactDto,
|
|
38
39
|
FactListQuery,
|
|
39
|
-
ListFactsResponse
|
|
40
|
+
ListFactsResponse,
|
|
41
|
+
NpmInstallBlockedAuditReport
|
|
40
42
|
} from '../types/index.js';
|
|
41
43
|
import { MethodSchema } from './types.js';
|
|
42
44
|
|
|
@@ -159,6 +161,15 @@ export interface ServerMethods {
|
|
|
159
161
|
list: ServerMethodSchema<FactListQuery, ListFactsResponse>;
|
|
160
162
|
create: ServerMethodSchema<FactCreate, FactDto>;
|
|
161
163
|
};
|
|
164
|
+
audit: {
|
|
165
|
+
/**
|
|
166
|
+
* Report a controlled-install `NpmInstallBlocked` so the server can write a
|
|
167
|
+
* throttled OCSF audit row (APPS-4191 / P6.3). Org + actor are derived from
|
|
168
|
+
* the authenticated connection; `recorded` is false when the event was
|
|
169
|
+
* dropped by the per-org or global throttle.
|
|
170
|
+
*/
|
|
171
|
+
npmInstallBlocked: ServerMethodSchema<NpmInstallBlockedAuditReport, { recorded: boolean }>;
|
|
172
|
+
};
|
|
162
173
|
};
|
|
163
174
|
v2: {
|
|
164
175
|
application: {
|
|
@@ -214,8 +225,15 @@ export interface ServerMethods {
|
|
|
214
225
|
*/
|
|
215
226
|
get: ServerMethodSchema<{ applicationId: string; branchName?: string }, { hash: string }>;
|
|
216
227
|
set: ServerMethodSchema<
|
|
217
|
-
{
|
|
218
|
-
|
|
228
|
+
{
|
|
229
|
+
applicationId: string;
|
|
230
|
+
branchName?: string;
|
|
231
|
+
hash: string;
|
|
232
|
+
source?: string;
|
|
233
|
+
targetTemplateName?: string;
|
|
234
|
+
migrationGeneration?: number;
|
|
235
|
+
},
|
|
236
|
+
{ hash: string; degradedMode?: DegradedMode; commitId?: string; checkpointSkipped?: CheckpointSkipReason }
|
|
219
237
|
>;
|
|
220
238
|
};
|
|
221
239
|
directoryContents: {
|
package/src/types/ai/index.ts
CHANGED
|
@@ -8,6 +8,26 @@ export type AiQuotaPaywallReason =
|
|
|
8
8
|
| 'trial_expired'
|
|
9
9
|
| 'user_credit_limit_exceeded';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* The complete set of paywall reasons, kept in lockstep with the
|
|
13
|
+
* `AiQuotaPaywallReason` union above. Shared so that callers parsing
|
|
14
|
+
* untrusted error payloads (`packages/vite-plugin-file-sync`) can validate
|
|
15
|
+
* string values against the same source of truth rather than duplicating it.
|
|
16
|
+
*/
|
|
17
|
+
export const AI_QUOTA_PAYWALL_REASONS: ReadonlySet<AiQuotaPaywallReason> = new Set<AiQuotaPaywallReason>([
|
|
18
|
+
'credit_limit_exceeded',
|
|
19
|
+
'deploy_quota_exceeded',
|
|
20
|
+
'dollar_commit_exhausted',
|
|
21
|
+
'no_seat_assigned',
|
|
22
|
+
'payment_past_due',
|
|
23
|
+
'token_limit_exceeded',
|
|
24
|
+
'trial_expired',
|
|
25
|
+
'user_credit_limit_exceeded'
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
export const isAiQuotaPaywallReason = (value: unknown): value is AiQuotaPaywallReason =>
|
|
29
|
+
typeof value === 'string' && AI_QUOTA_PAYWALL_REASONS.has(value as AiQuotaPaywallReason);
|
|
30
|
+
|
|
11
31
|
export const getAiQuotaPaywallReasonFromMessage = (message: string): AiQuotaPaywallReason | undefined => {
|
|
12
32
|
const normalizedMessage = message.toLowerCase();
|
|
13
33
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants and types for LLM-based prompt safety classification.
|
|
3
|
+
*
|
|
4
|
+
* Used by the Clark AI service (vite-plugin-file-sync) and the server-side
|
|
5
|
+
* policy-gate prompt check. Each consumer owns its own context-specific
|
|
6
|
+
* system prompt; only the structural contract (categories, result types,
|
|
7
|
+
* default results) lives here.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const SAFETY_CATEGORIES = [
|
|
11
|
+
'harmful_instructions',
|
|
12
|
+
'illegal_activity',
|
|
13
|
+
'jailbreak_attempt',
|
|
14
|
+
'malicious_code',
|
|
15
|
+
'other',
|
|
16
|
+
'personal_data_extraction',
|
|
17
|
+
'prompt_injection',
|
|
18
|
+
'system_extraction'
|
|
19
|
+
] as const;
|
|
20
|
+
|
|
21
|
+
export type SafetyCategory = (typeof SAFETY_CATEGORIES)[number];
|
|
22
|
+
|
|
23
|
+
export interface SafetyClassificationResult {
|
|
24
|
+
safe: boolean;
|
|
25
|
+
justification: string;
|
|
26
|
+
categories?: SafetyCategory[];
|
|
27
|
+
}
|
|
@@ -630,6 +630,22 @@ export type ApplicationHashChangeSource =
|
|
|
630
630
|
// scratch artifacts are removed.
|
|
631
631
|
| 'migrate:complete';
|
|
632
632
|
|
|
633
|
+
/**
|
|
634
|
+
* Why setApplicationHash returned no `commitId` even though the call succeeded.
|
|
635
|
+
* These are the by-design no-checkpoint paths. The dev server, which always
|
|
636
|
+
* supplies a `source`, uses this to log by-design skips at info instead of
|
|
637
|
+
* warning on every autosave; for it, absence of both `commitId` and this field
|
|
638
|
+
* is the only genuine "checkpoint creation failed" signal. (The server-side
|
|
639
|
+
* `no-source` path also returns a commit-less response without this field, but
|
|
640
|
+
* the dev server never omits the source, so that case does not arise here.)
|
|
641
|
+
*
|
|
642
|
+
* - 'draft-autosave' a DRAFT autosave was written inside an active draft session
|
|
643
|
+
* (a commit exists, but its id is intentionally withheld)
|
|
644
|
+
* - 'no-changes' the tree hash matches the last checkpoint, so nothing to commit
|
|
645
|
+
* - 'no-op-source' the change source never produces a commit (e.g. ai:generate:pre)
|
|
646
|
+
*/
|
|
647
|
+
export type CheckpointSkipReason = 'draft-autosave' | 'no-changes' | 'no-op-source';
|
|
648
|
+
|
|
633
649
|
/**
|
|
634
650
|
* Returns true if the application's template uses the SDK API structure.
|
|
635
651
|
* Legacy apps (templateName null/undefined) use YAML API.
|