@superblocksteam/library-shared 1.99.99-next.3 → 2.0.0-SNAPSHOT.04704c19f32b3902
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/computed.d.ts +4 -2
- package/dist/computed.d.ts.map +1 -1
- package/dist/computed.js +1 -1
- package/dist/computed.js.map +1 -1
- package/dist/default-structure.d.ts +12 -0
- package/dist/default-structure.d.ts.map +1 -0
- package/dist/default-structure.js +36 -0
- package/dist/default-structure.js.map +1 -0
- package/dist/event-trigger-constants.d.ts +2 -0
- package/dist/event-trigger-constants.d.ts.map +1 -0
- package/dist/event-trigger-constants.js +2 -0
- package/dist/event-trigger-constants.js.map +1 -0
- package/dist/index.d.ts +18 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -9
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +12 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +11 -4
- package/dist/layout.js.map +1 -1
- package/dist/mobx-sync/apply-patch.d.ts.map +1 -1
- package/dist/mobx-sync/apply-patch.js +23 -4
- package/dist/mobx-sync/apply-patch.js.map +1 -1
- package/dist/mobx-sync/to-patch.d.ts.map +1 -1
- package/dist/mobx-sync/to-patch.js.map +1 -1
- package/dist/pages.d.ts +76 -6
- package/dist/pages.d.ts.map +1 -1
- package/dist/pages.js +54 -2
- package/dist/pages.js.map +1 -1
- package/dist/pegs/find-string-interpolation.d.ts +12 -0
- package/dist/pegs/find-string-interpolation.d.ts.map +1 -0
- package/dist/pegs/find-string-interpolation.js +1265 -0
- package/dist/pegs/find-string-interpolation.js.map +1 -0
- package/dist/props/helpers.d.ts +1 -1
- package/dist/props/helpers.d.ts.map +1 -1
- package/dist/props/helpers.js +13 -5
- package/dist/props/helpers.js.map +1 -1
- package/dist/props/prop-types.d.ts +24 -13
- package/dist/props/prop-types.d.ts.map +1 -1
- package/dist/props/prop-types.js.map +1 -1
- package/dist/props/properties-panel.d.ts +61 -26
- package/dist/props/properties-panel.d.ts.map +1 -1
- package/dist/props/properties-panel.js +2 -5
- package/dist/props/properties-panel.js.map +1 -1
- package/dist/props/tailwind-property-keys.d.ts +5 -0
- package/dist/props/tailwind-property-keys.d.ts.map +1 -0
- package/dist/props/tailwind-property-keys.js +234 -0
- package/dist/props/tailwind-property-keys.js.map +1 -0
- package/dist/restart-contract.d.ts +35 -0
- package/dist/restart-contract.d.ts.map +1 -0
- package/dist/restart-contract.js +49 -0
- package/dist/restart-contract.js.map +1 -0
- package/dist/scope.d.ts +2 -0
- package/dist/scope.d.ts.map +1 -1
- package/dist/scope.js +3 -0
- package/dist/scope.js.map +1 -1
- package/dist/types/ai.d.ts +1721 -0
- package/dist/types/ai.d.ts.map +1 -0
- package/dist/types/ai.js +432 -0
- package/dist/types/ai.js.map +1 -0
- package/dist/types/apis.d.ts +44 -1
- package/dist/types/apis.d.ts.map +1 -1
- package/dist/types/base-entity-manager.d.ts +15 -0
- package/dist/types/base-entity-manager.d.ts.map +1 -0
- package/dist/types/base-entity-manager.js +2 -0
- package/dist/types/base-entity-manager.js.map +1 -0
- package/dist/types/common.d.ts +2 -1
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/edit-operations.d.ts +26 -23
- package/dist/types/edit-operations.d.ts.map +1 -1
- package/dist/types/edit-operations.js +2 -0
- package/dist/types/edit-operations.js.map +1 -1
- package/dist/types/entities.d.ts +10 -29
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/types/entities.js +0 -5
- package/dist/types/entities.js.map +1 -1
- package/dist/types/errors.d.ts +82 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +15 -1
- package/dist/types/errors.js.map +1 -1
- package/dist/types/events.d.ts +218 -26
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/events.js +33 -5
- package/dist/types/events.js.map +1 -1
- package/dist/types/index.d.ts +19 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +19 -7
- package/dist/types/index.js.map +1 -1
- package/dist/types/migration.d.ts +240 -0
- package/dist/types/migration.d.ts.map +1 -0
- package/dist/types/migration.js +50 -0
- package/dist/types/migration.js.map +1 -0
- package/dist/types/mobx-shared-state.d.ts +27 -1
- package/dist/types/mobx-shared-state.d.ts.map +1 -1
- package/dist/types/parent-messages.d.ts +16 -7
- package/dist/types/parent-messages.d.ts.map +1 -1
- package/dist/types/persisted-chat-message.d.ts +55 -0
- package/dist/types/persisted-chat-message.d.ts.map +1 -0
- package/dist/types/persisted-chat-message.js +752 -0
- package/dist/types/persisted-chat-message.js.map +1 -0
- package/dist/types/protected-packages.d.ts +54 -0
- package/dist/types/protected-packages.d.ts.map +1 -0
- package/dist/types/protected-packages.js +91 -0
- package/dist/types/protected-packages.js.map +1 -0
- package/dist/types/register-component.d.ts +128 -0
- package/dist/types/register-component.d.ts.map +1 -0
- package/dist/types/register-component.js +45 -0
- package/dist/types/register-component.js.map +1 -0
- package/dist/types/routing.d.ts +68 -0
- package/dist/types/routing.d.ts.map +1 -0
- package/dist/types/routing.js +2 -0
- package/dist/types/routing.js.map +1 -0
- package/dist/types/runtime-sync.d.ts +32 -0
- package/dist/types/runtime-sync.d.ts.map +1 -0
- package/dist/types/runtime-sync.js +2 -0
- package/dist/types/runtime-sync.js.map +1 -0
- package/dist/types/scope.d.ts +8 -6
- package/dist/types/scope.d.ts.map +1 -1
- package/dist/types/snapshot.d.ts +53 -0
- package/dist/types/snapshot.d.ts.map +1 -0
- package/dist/types/snapshot.js +2 -0
- package/dist/types/snapshot.js.map +1 -0
- package/dist/types/socket.d.ts +668 -48
- package/dist/types/socket.d.ts.map +1 -1
- package/dist/types/theme.d.ts +8 -7
- package/dist/types/theme.d.ts.map +1 -1
- package/dist/types/theme.js +5 -6
- package/dist/types/theme.js.map +1 -1
- package/dist/types/tool-permission-response.d.ts +5 -0
- package/dist/types/tool-permission-response.d.ts.map +1 -0
- package/dist/types/tool-permission-response.js +26 -0
- package/dist/types/tool-permission-response.js.map +1 -0
- package/dist/types/vite.d.ts +29 -0
- package/dist/types/vite.d.ts.map +1 -0
- package/dist/types/vite.js +6 -0
- package/dist/types/vite.js.map +1 -0
- package/dist/urls.d.ts +7 -0
- package/dist/urls.d.ts.map +1 -0
- package/dist/urls.js +6 -0
- package/dist/urls.js.map +1 -0
- package/dist/utils/binding-identifier.d.ts +1 -0
- package/dist/utils/binding-identifier.d.ts.map +1 -1
- package/dist/utils/binding-identifier.js +3 -0
- package/dist/utils/binding-identifier.js.map +1 -1
- package/dist/utils/blocks.d.ts +3 -0
- package/dist/utils/blocks.d.ts.map +1 -0
- package/dist/utils/blocks.js +70 -0
- package/dist/utils/blocks.js.map +1 -0
- package/dist/utils/computed-args.d.ts +11 -0
- package/dist/utils/computed-args.d.ts.map +1 -0
- package/dist/utils/computed-args.js +13 -0
- package/dist/utils/computed-args.js.map +1 -0
- package/dist/utils/dev-server-authorization.d.ts +4 -0
- package/dist/utils/dev-server-authorization.d.ts.map +1 -0
- package/dist/utils/dev-server-authorization.js +56 -0
- package/dist/utils/dev-server-authorization.js.map +1 -0
- package/dist/utils/dotted-paths.js +1 -1
- package/dist/utils/dotted-paths.js.map +1 -1
- package/dist/utils/properties.d.ts +12 -9
- package/dist/utils/properties.d.ts.map +1 -1
- package/dist/utils/properties.js +14 -6
- package/dist/utils/properties.js.map +1 -1
- package/dist/utils/routing.d.ts +5 -0
- package/dist/utils/routing.d.ts.map +1 -0
- package/dist/utils/routing.js +16 -0
- package/dist/utils/routing.js.map +1 -0
- package/dist/utils/strings.d.ts +12 -0
- package/dist/utils/strings.d.ts.map +1 -1
- package/dist/utils/strings.js +40 -1
- package/dist/utils/strings.js.map +1 -1
- package/package.json +41 -25
- package/dist/apis.d.ts +0 -2
- package/dist/apis.d.ts.map +0 -1
- package/dist/apis.js +0 -4
- package/dist/apis.js.map +0 -1
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire types for the v2→v3 migration flow. Shared between the vite dev
|
|
3
|
+
* server (`vite-plugin-file-sync/src/migration/*`) and the editor UI
|
|
4
|
+
* (`ui/src/app/pages/components/migrateToV3/*`). Anything that crosses
|
|
5
|
+
* the `/sb-migration-status` boundary belongs here so a new phase or
|
|
6
|
+
* checklist field added on one side is a compile error on the other.
|
|
7
|
+
*
|
|
8
|
+
* ## State ownership (see `vite-plugin-file-sync/src/migration/README.md`)
|
|
9
|
+
*
|
|
10
|
+
* - **Server session** (`MigrationSessionResponse`): phase, generation, abort,
|
|
11
|
+
* backup/migration/completion commit IDs. Authoritative after CP4.
|
|
12
|
+
* - **Dev-server scratch** (`MigrationStatusResponse`): checklist,
|
|
13
|
+
* `integrationWritePolicy`, verification progress. Authoritative for in-pod work.
|
|
14
|
+
*
|
|
15
|
+
* `integrationWritePolicy` appears on both shapes for API symmetry, but only scratch
|
|
16
|
+
* is populated and enforced today. The Postgres column and `POST /migration/start`
|
|
17
|
+
* body field are schema placeholders — not part of CP1–CP4 delivery.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Checklist-derived phases exposed on `GET /sb-migration-status` after CP4.
|
|
21
|
+
* `backup`, `restructure`, and `flip` remain for in-process POST handlers
|
|
22
|
+
* only — they are not returned on GET.
|
|
23
|
+
*/
|
|
24
|
+
export type MigrationPhase = "idle"
|
|
25
|
+
/** @deprecated Not returned on GET /sb-migration-status (CP4). */
|
|
26
|
+
| "backup"
|
|
27
|
+
/** @deprecated Not returned on GET /sb-migration-status (CP4). */
|
|
28
|
+
| "restructure"
|
|
29
|
+
/** @deprecated Not returned on GET /sb-migration-status (CP4). */
|
|
30
|
+
| "flip" | "translating" | "done" | "done_with_unresolved" | "failed";
|
|
31
|
+
export type MigrationChecklistStatus = "pending" | "in_progress" | "completed" | "cancelled" | "failed";
|
|
32
|
+
export type MigrationChecklistOverallStatus = "active" | "completed";
|
|
33
|
+
export type MigrationChecklistOrigin = "2.0-upgrade" | "clark" | "seed_api" | "seed_phase";
|
|
34
|
+
export interface MigrationChecklistItem {
|
|
35
|
+
id: string;
|
|
36
|
+
content: string;
|
|
37
|
+
status: MigrationChecklistStatus;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
updatedAt?: string;
|
|
40
|
+
origin: MigrationChecklistOrigin;
|
|
41
|
+
/**
|
|
42
|
+
* Whether this checklist item should be removed automatically once a
|
|
43
|
+
* successful build finalize completes.
|
|
44
|
+
*/
|
|
45
|
+
clearOnFinalize?: boolean;
|
|
46
|
+
apiName?: string;
|
|
47
|
+
stubPath?: string;
|
|
48
|
+
/** Populated when `status === "failed"`. */
|
|
49
|
+
failureReason?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Number of prior translation attempts recorded on this item.
|
|
52
|
+
* Bumped each time the user invokes "Fix with Clark" on a failed
|
|
53
|
+
* row — the row flips back to `pending` and this counter
|
|
54
|
+
* increments. The initial agent run counts as attempt 0; the first
|
|
55
|
+
* manual retry produces `attemptCount = 1`, and so on. There is no
|
|
56
|
+
* automatic retry, so the counter is only non-zero once a user has
|
|
57
|
+
* explicitly asked for another attempt.
|
|
58
|
+
*/
|
|
59
|
+
attemptCount?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Most recent `failureReason` observed for this item, preserved
|
|
62
|
+
* across status transitions so a retry prompt can carry context
|
|
63
|
+
* even after the row is flipped back to `pending`.
|
|
64
|
+
*/
|
|
65
|
+
lastFailureReason?: string;
|
|
66
|
+
/**
|
|
67
|
+
* When set, verification was skipped for this item.
|
|
68
|
+
* `"mutation"` means the API contains write operations so running it
|
|
69
|
+
* automatically is unsafe. `"v2_unrunnable"` means the v2 baseline
|
|
70
|
+
* could not be executed (e.g. missing credentials, unsupported block
|
|
71
|
+
* type). `"both_failed"` means both v2 and v3 errored — typically because
|
|
72
|
+
* the API requires inputs from the frontend that aren't supplied during
|
|
73
|
+
* background verification — so we couldn't establish parity automatically.
|
|
74
|
+
* `"testing_denied"` means the user denied automatic testing; the API needs
|
|
75
|
+
* manual verification before production use.
|
|
76
|
+
*/
|
|
77
|
+
verificationSkippedReason?: "both_failed" | "mutation" | "testing_denied" | "v2_unrunnable";
|
|
78
|
+
/**
|
|
79
|
+
* The outcome of the most recent verification run for this item.
|
|
80
|
+
* `"auto_passed"` means Clark confirmed v2 and v3 outputs match.
|
|
81
|
+
* `"user_manually_verified"` means the user confirmed equivalence
|
|
82
|
+
* by hand. `"diverged_user_accepted"` means the user accepted a
|
|
83
|
+
* known diff.
|
|
84
|
+
*/
|
|
85
|
+
verificationOutcome?: "auto_passed" | "user_manually_verified" | "diverged_user_accepted";
|
|
86
|
+
/** Filesystem path to the last comparison diff written by the verifier. */
|
|
87
|
+
lastVerificationDiffPath?: string;
|
|
88
|
+
/** ISO-8601 timestamp of the last verification attempt. */
|
|
89
|
+
lastVerificationAt?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Identifier of the coding sub-agent that owns this item, set by
|
|
92
|
+
* `spawnCodingSubagents` before fan-out when Clark passes `apiNames` per
|
|
93
|
+
* worker. Used purely for UI grouping (batch rows in `ChecklistDisplay`);
|
|
94
|
+
* unset on items migrated sequentially in the main agent's turn.
|
|
95
|
+
*/
|
|
96
|
+
workerId?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Forward-scaffolding shape for structured detail captured from the
|
|
99
|
+
* most recent verification run (planned writer:
|
|
100
|
+
* `scratch/migration-verification/<api>.history.json`). The writer
|
|
101
|
+
* and consumers (chat checklist deep-dive, agent-facing summary)
|
|
102
|
+
* land in a follow-up PR; the field is included here so the
|
|
103
|
+
* cross-package wire shape doesn't churn when that PR ships. No
|
|
104
|
+
* code currently sets or reads `details` — treat it as reserved.
|
|
105
|
+
*/
|
|
106
|
+
details?: {
|
|
107
|
+
/** Last error returned when running the v2 baseline of this API. */
|
|
108
|
+
v2Error?: string;
|
|
109
|
+
/** Last error returned when running the migrated v3 of this API. */
|
|
110
|
+
v3Error?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Names of inputs the verifier could not synthesize a value for
|
|
113
|
+
* (e.g. UI-bound parameters that have no recorded test value).
|
|
114
|
+
*/
|
|
115
|
+
missingInputs?: string[];
|
|
116
|
+
/** Display name of the integration the API binds to. */
|
|
117
|
+
integrationName?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Concise, agent-readable summary of why verification failed and
|
|
120
|
+
* what (if anything) Clark could try next.
|
|
121
|
+
*/
|
|
122
|
+
summaryForAgent?: string;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export type IntegrationWritePolicy = "allow" | "deny";
|
|
126
|
+
export interface MigrationIntegrationEntry {
|
|
127
|
+
id: string;
|
|
128
|
+
displayName: string;
|
|
129
|
+
defaultPolicy: "allow" | "deny";
|
|
130
|
+
/** Classification of the integration's write behaviour derived from v2 YAML analysis. */
|
|
131
|
+
mutationKind: "read" | "write" | "unknown";
|
|
132
|
+
}
|
|
133
|
+
/** Server-owned migration session phases (DB `application_migration_session.phase`). */
|
|
134
|
+
export declare const MIGRATION_SESSION_PHASES: readonly ["aborting", "aborted", "failed", "in_progress", "preparing_postflip", "preparing_preflip"];
|
|
135
|
+
export type MigrationSessionPhase = (typeof MIGRATION_SESSION_PHASES)[number];
|
|
136
|
+
/** Phases that block a new `POST /migration/start`. */
|
|
137
|
+
export declare const ACTIVE_MIGRATION_SESSION_PHASES: readonly ["aborting", "in_progress", "preparing_postflip", "preparing_preflip"];
|
|
138
|
+
export type ActiveMigrationSessionPhase = (typeof ACTIVE_MIGRATION_SESSION_PHASES)[number];
|
|
139
|
+
export declare const MIGRATION_FAILURE_STAGES: readonly ["abort", "in_progress", "postflip", "preflip"];
|
|
140
|
+
export type MigrationFailureStage = (typeof MIGRATION_FAILURE_STAGES)[number];
|
|
141
|
+
export declare const DEFAULT_MIGRATION_TARGET_TEMPLATE_NAME = "app-fullstack";
|
|
142
|
+
/** Max wall-clock time for server abort saga + UI stale detection (5 minutes). */
|
|
143
|
+
export declare const MIGRATION_ABORT_MAX_DURATION_MS: number;
|
|
144
|
+
/** Server abort saga resume cursor (`application_migration_session.abort_checkpoint`). */
|
|
145
|
+
export declare const MIGRATION_ABORT_CHECKPOINTS: readonly ["requested", "restored", "terminated"];
|
|
146
|
+
export type MigrationAbortCheckpoint = (typeof MIGRATION_ABORT_CHECKPOINTS)[number];
|
|
147
|
+
export interface MigrationSessionResponse {
|
|
148
|
+
applicationId: string;
|
|
149
|
+
branchName: string;
|
|
150
|
+
generation: number;
|
|
151
|
+
phase: MigrationSessionPhase;
|
|
152
|
+
failureStage?: MigrationFailureStage;
|
|
153
|
+
errorMessage?: string;
|
|
154
|
+
sourceTemplateName?: string;
|
|
155
|
+
targetTemplateName: string;
|
|
156
|
+
backupCommitId?: string;
|
|
157
|
+
migrationCommitId?: string;
|
|
158
|
+
completionCommitId?: string;
|
|
159
|
+
/** Schema placeholder — not written or read for enforcement today. See module header. */
|
|
160
|
+
integrationWritePolicy?: Record<string, IntegrationWritePolicy>;
|
|
161
|
+
/** True when UI should reload (post-flip pod recycle window). */
|
|
162
|
+
reloadRecommended: boolean;
|
|
163
|
+
startedAt: string;
|
|
164
|
+
updatedAt: string;
|
|
165
|
+
/** ISO-8601 timestamp when `POST /migration/abort` entered `aborting`. */
|
|
166
|
+
abortStartedAt?: string;
|
|
167
|
+
abortCheckpoint?: MigrationAbortCheckpoint;
|
|
168
|
+
abortedAt?: string;
|
|
169
|
+
completedAt?: string;
|
|
170
|
+
failedAt?: string;
|
|
171
|
+
}
|
|
172
|
+
export interface MigrationSessionPayload {
|
|
173
|
+
session: MigrationSessionResponse | null;
|
|
174
|
+
}
|
|
175
|
+
export interface MigrationStartRequestBody {
|
|
176
|
+
/** Accepted but not persisted — policy is saved via `/sb-migration-set-write-policy`. */
|
|
177
|
+
integrationWritePolicy?: Record<string, IntegrationWritePolicy>;
|
|
178
|
+
targetTemplateName?: string;
|
|
179
|
+
}
|
|
180
|
+
export interface MigrationStartResponse {
|
|
181
|
+
accepted: true;
|
|
182
|
+
generation: number;
|
|
183
|
+
}
|
|
184
|
+
export interface MigrationAbortResponse {
|
|
185
|
+
accepted: true;
|
|
186
|
+
/** True when another abort saga is already running within the max duration window. */
|
|
187
|
+
inProgress?: boolean;
|
|
188
|
+
session: MigrationSessionResponse | null;
|
|
189
|
+
}
|
|
190
|
+
/** Optional body for POST .../migration/abort when the server session row was cleared. */
|
|
191
|
+
export interface MigrationAbortRequestBody {
|
|
192
|
+
backupCommitId?: string;
|
|
193
|
+
/** When true on an expired aborting session, reset the abort clock for a user-initiated retry. */
|
|
194
|
+
freshRetry?: boolean;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Aggregate view of normal (non-focused-debug) Clark migration turns,
|
|
198
|
+
* derived from the dev server's `scratch/migration-turns.jsonl` log.
|
|
199
|
+
* The UI uses this to decide when the initial migration generation has
|
|
200
|
+
* genuinely finished (e.g. to dismiss the "Upgrading your app" overlay)
|
|
201
|
+
* without client-side heuristics. `settledOutcome` reflects the most
|
|
202
|
+
* recent normal settle.
|
|
203
|
+
*/
|
|
204
|
+
export interface MigrationInitialTurnSummary {
|
|
205
|
+
dispatched: boolean;
|
|
206
|
+
settled: boolean;
|
|
207
|
+
settledOutcome?: "error" | "success";
|
|
208
|
+
}
|
|
209
|
+
export interface MigrationStatusResponse {
|
|
210
|
+
state: MigrationPhase;
|
|
211
|
+
error?: string;
|
|
212
|
+
/** Normal migration turn dispatch/settle summary from the dev server turn log. */
|
|
213
|
+
initialTurn?: MigrationInitialTurnSummary;
|
|
214
|
+
backupCommitId?: string;
|
|
215
|
+
migrationCommitId?: string;
|
|
216
|
+
startedAt?: string;
|
|
217
|
+
hasV2Backup: boolean;
|
|
218
|
+
checklist?: {
|
|
219
|
+
overallStatus: MigrationChecklistOverallStatus;
|
|
220
|
+
items: MigrationChecklistItem[];
|
|
221
|
+
lastUpdated: string;
|
|
222
|
+
};
|
|
223
|
+
/** Integration IDs discovered from v2-backup YAML files, populated once hasV2Backup is true. */
|
|
224
|
+
integrations?: MigrationIntegrationEntry[];
|
|
225
|
+
/** Per-integration write policy — source of truth in scratch; enforced by dev server. */
|
|
226
|
+
integrationWritePolicy?: Record<string, IntegrationWritePolicy>;
|
|
227
|
+
/**
|
|
228
|
+
* Set on the idle preflight when the live app references plugin IDs
|
|
229
|
+
* that are not in the fullstack `SUPPORTED_PLUGIN_IDS` allowlist.
|
|
230
|
+
* Migration is still allowed to proceed — the modal surfaces the
|
|
231
|
+
* lists below so the user can decide whether to attempt a Clark
|
|
232
|
+
* translation despite the gap.
|
|
233
|
+
*/
|
|
234
|
+
hasUnsupportedIntegrations?: boolean;
|
|
235
|
+
/** Plugin IDs (e.g. "redis", "python") that aren't supported by the v3 runtime. */
|
|
236
|
+
unsupportedIntegrationIds?: string[];
|
|
237
|
+
/** v2 API names that reference at least one unsupported integration. */
|
|
238
|
+
unsupportedApiNames?: string[];
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/types/migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB,MAAM;AACR,kEAAkE;GAChE,QAAQ;AACV,kEAAkE;GAChE,aAAa;AACf,kEAAkE;GAChE,MAAM,GACN,aAAa,GACb,MAAM,GACN,sBAAsB,GACtB,QAAQ,CAAC;AAEb,MAAM,MAAM,wBAAwB,GAChC,SAAS,GACT,aAAa,GACb,WAAW,GACX,WAAW,GACX,QAAQ,CAAC;AAEb,MAAM,MAAM,+BAA+B,GAAG,QAAQ,GAAG,WAAW,CAAC;AAErE,MAAM,MAAM,wBAAwB,GAChC,aAAa,GACb,OAAO,GACP,UAAU,GACV,YAAY,CAAC;AAEjB,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,wBAAwB,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAA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AAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE;QACV,aAAa,EAAE,+BAA+B,CAAC;QAC/C,KAAK,EAAE,sBAAsB,EAAE,CAAC;QAChC,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,gGAAgG;IAChG,YAAY,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC3C,yFAAyF;IACzF,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAChE;;;;;;OAMG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,mFAAmF;IACnF,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAC;IACrC,wEAAwE;IACxE,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire types for the v2→v3 migration flow. Shared between the vite dev
|
|
3
|
+
* server (`vite-plugin-file-sync/src/migration/*`) and the editor UI
|
|
4
|
+
* (`ui/src/app/pages/components/migrateToV3/*`). Anything that crosses
|
|
5
|
+
* the `/sb-migration-status` boundary belongs here so a new phase or
|
|
6
|
+
* checklist field added on one side is a compile error on the other.
|
|
7
|
+
*
|
|
8
|
+
* ## State ownership (see `vite-plugin-file-sync/src/migration/README.md`)
|
|
9
|
+
*
|
|
10
|
+
* - **Server session** (`MigrationSessionResponse`): phase, generation, abort,
|
|
11
|
+
* backup/migration/completion commit IDs. Authoritative after CP4.
|
|
12
|
+
* - **Dev-server scratch** (`MigrationStatusResponse`): checklist,
|
|
13
|
+
* `integrationWritePolicy`, verification progress. Authoritative for in-pod work.
|
|
14
|
+
*
|
|
15
|
+
* `integrationWritePolicy` appears on both shapes for API symmetry, but only scratch
|
|
16
|
+
* is populated and enforced today. The Postgres column and `POST /migration/start`
|
|
17
|
+
* body field are schema placeholders — not part of CP1–CP4 delivery.
|
|
18
|
+
*/
|
|
19
|
+
/** Server-owned migration session phases (DB `application_migration_session.phase`). */
|
|
20
|
+
export const MIGRATION_SESSION_PHASES = [
|
|
21
|
+
"aborting",
|
|
22
|
+
"aborted",
|
|
23
|
+
"failed",
|
|
24
|
+
"in_progress",
|
|
25
|
+
"preparing_postflip",
|
|
26
|
+
"preparing_preflip",
|
|
27
|
+
];
|
|
28
|
+
/** Phases that block a new `POST /migration/start`. */
|
|
29
|
+
export const ACTIVE_MIGRATION_SESSION_PHASES = [
|
|
30
|
+
"aborting",
|
|
31
|
+
"in_progress",
|
|
32
|
+
"preparing_postflip",
|
|
33
|
+
"preparing_preflip",
|
|
34
|
+
];
|
|
35
|
+
export const MIGRATION_FAILURE_STAGES = [
|
|
36
|
+
"abort",
|
|
37
|
+
"in_progress",
|
|
38
|
+
"postflip",
|
|
39
|
+
"preflip",
|
|
40
|
+
];
|
|
41
|
+
export const DEFAULT_MIGRATION_TARGET_TEMPLATE_NAME = "app-fullstack";
|
|
42
|
+
/** Max wall-clock time for server abort saga + UI stale detection (5 minutes). */
|
|
43
|
+
export const MIGRATION_ABORT_MAX_DURATION_MS = 5 * 60 * 1000;
|
|
44
|
+
/** Server abort saga resume cursor (`application_migration_session.abort_checkpoint`). */
|
|
45
|
+
export const MIGRATION_ABORT_CHECKPOINTS = [
|
|
46
|
+
"requested",
|
|
47
|
+
"restored",
|
|
48
|
+
"terminated",
|
|
49
|
+
];
|
|
50
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../src/types/migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAgJH,wFAAwF;AACxF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,UAAU;IACV,SAAS;IACT,QAAQ;IACR,aAAa;IACb,oBAAoB;IACpB,mBAAmB;CACX,CAAC;AAIX,uDAAuD;AACvD,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,UAAU;IACV,aAAa;IACb,oBAAoB;IACpB,mBAAmB;CACX,CAAC;AAKX,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,OAAO;IACP,aAAa;IACb,UAAU;IACV,SAAS;CACD,CAAC;AAIX,MAAM,CAAC,MAAM,sCAAsC,GAAG,eAAe,CAAC;AAEtE,kFAAkF;AAClF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7D,0FAA0F;AAC1F,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,WAAW;IACX,UAAU;IACV,YAAY;CACJ,CAAC"}
|
|
@@ -1,9 +1,35 @@
|
|
|
1
|
+
import type { Dim } from "../layout.js";
|
|
2
|
+
import type { EntityDefinition } from "../props/prop-types.js";
|
|
3
|
+
import type { SbElement } from "./common.js";
|
|
4
|
+
import type { CatalogWithInternalDetails, EditorConfig } from "./register-component.js";
|
|
1
5
|
export type ComponentRegistryShareState = {
|
|
2
6
|
customComponentList: string[];
|
|
3
|
-
|
|
7
|
+
libraryComponentCatalogs: CatalogWithInternalDetails[];
|
|
8
|
+
libraryComponentEditorConfigs: Record<string, EditorConfig>;
|
|
9
|
+
entityDefinitions: Record<string, EntityDefinition>;
|
|
10
|
+
};
|
|
11
|
+
export type DndShareState = {
|
|
12
|
+
isDragging: boolean;
|
|
13
|
+
isDraggingNewComponent: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type ResizingShareState = {
|
|
16
|
+
isResizing: boolean;
|
|
17
|
+
activeResize: null | {
|
|
18
|
+
width: Dim | null;
|
|
19
|
+
height: Dim | null;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type ValidationState = {
|
|
23
|
+
isValid: boolean;
|
|
24
|
+
message?: string;
|
|
25
|
+
invalidValue?: any;
|
|
4
26
|
};
|
|
5
27
|
export type KeyToState = {
|
|
6
28
|
"component-registry": ComponentRegistryShareState;
|
|
29
|
+
dnd: DndShareState;
|
|
30
|
+
resizing: ResizingShareState;
|
|
7
31
|
scope: Record<string, Record<string, unknown>>;
|
|
32
|
+
validationState: Record<string, ValidationState>;
|
|
33
|
+
runtimeSync: Record<SbElement, any>;
|
|
8
34
|
};
|
|
9
35
|
//# sourceMappingURL=mobx-shared-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobx-shared-state.d.ts","sourceRoot":"","sources":["../../src/types/mobx-shared-state.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GAAG;IACxC,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,
|
|
1
|
+
{"version":3,"file":"mobx-shared-state.d.ts","sourceRoot":"","sources":["../../src/types/mobx-shared-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,0BAA0B,EAC1B,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,2BAA2B,GAAG;IACxC,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,wBAAwB,EAAE,0BAA0B,EAAE,CAAC;IACvD,6BAA6B,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC5D,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,sBAAsB,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,IAAI,GAAG;QACnB,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;QAClB,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,oBAAoB,EAAE,2BAA2B,CAAC;IAClD,GAAG,EAAE,aAAa,CAAC;IACnB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACjD,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;CACrC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { BaseBlock } from "@superblocksteam/shared";
|
|
2
|
+
import type { ApiRunRecord } from "./apis.js";
|
|
1
3
|
import type { MobXPatch } from "./mobx-patch.js";
|
|
2
4
|
import type { KeyToState } from "./mobx-shared-state.js";
|
|
3
5
|
import type { AppScope } from "./scope.js";
|
|
4
|
-
import type { GeneratedTheme, Theme } from "./theme.js";
|
|
5
|
-
import type { BaseBlock } from "@superblocksteam/shared";
|
|
6
6
|
export type DeleteMeLibraryApi = {
|
|
7
7
|
apiPb: {
|
|
8
8
|
metadata: {
|
|
@@ -15,8 +15,12 @@ export type DeleteMeLibraryApi = {
|
|
|
15
15
|
};
|
|
16
16
|
blocks?: BaseBlock[];
|
|
17
17
|
trigger?: any;
|
|
18
|
+
authorization?: {
|
|
19
|
+
type?: "AUTHORIZATION_TYPE_APP_USERS" | "AUTHORIZATION_TYPE_JS_EXPRESSION";
|
|
20
|
+
expression?: string;
|
|
21
|
+
};
|
|
18
22
|
};
|
|
19
|
-
pageName
|
|
23
|
+
pageName?: string;
|
|
20
24
|
};
|
|
21
25
|
export type SyncStoreInitPayload<T extends keyof KeyToState = keyof KeyToState> = {
|
|
22
26
|
storeId: T;
|
|
@@ -32,10 +36,6 @@ export type SyncStoreUpdatePayload<T extends keyof KeyToState> = {
|
|
|
32
36
|
*/
|
|
33
37
|
export type AppToEditorMessage<PropertiesPanelDefinition> = {
|
|
34
38
|
"codeMode/initScopedEntities": AppScope;
|
|
35
|
-
"codeMode/updateTheme": {
|
|
36
|
-
theme: Theme;
|
|
37
|
-
generatedTheme: GeneratedTheme;
|
|
38
|
-
};
|
|
39
39
|
"codeMode/addPropertiesPanel": {
|
|
40
40
|
id: string;
|
|
41
41
|
definition: PropertiesPanelDefinition;
|
|
@@ -46,6 +46,15 @@ export type AppToEditorMessage<PropertiesPanelDefinition> = {
|
|
|
46
46
|
message: string;
|
|
47
47
|
description?: string;
|
|
48
48
|
};
|
|
49
|
+
"codeMode/addApiRunRecord": {
|
|
50
|
+
apiId: string;
|
|
51
|
+
run: ApiRunRecord;
|
|
52
|
+
};
|
|
53
|
+
"codeMode/updateApiRunRecord": {
|
|
54
|
+
apiId: string;
|
|
55
|
+
callId: string;
|
|
56
|
+
updates: Partial<Omit<ApiRunRecord, "id" | "callId">>;
|
|
57
|
+
};
|
|
49
58
|
"codeMode/editor-synced-store/update": SyncStoreUpdatePayload<keyof KeyToState>;
|
|
50
59
|
"codeMode/editor-synced-store/init": SyncStoreInitPayload<keyof KeyToState>;
|
|
51
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parent-messages.d.ts","sourceRoot":"","sources":["../../src/types/parent-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"parent-messages.d.ts","sourceRoot":"","sources":["../../src/types/parent-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EA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,EAAE,yBAAyB,CAAC,CAAC;IAC7E,2BAA2B,EAAE;QAC3B,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;QAC/C,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,0BAA0B,EAAE;QAC1B,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,YAAY,CAAC;KACnB,CAAC;IACF,6BAA6B,EAAE;QAC7B,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC;KACvD,CAAC;IAGF,qCAAqC,EAAE,sBAAsB,CAC3D,MAAM,UAAU,CACjB,CAAC;IACF,mCAAmC,EAAE,oBAAoB,CAAC,MAAM,UAAU,CAAC,CAAC;CAC7E,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type AiChatMessage, type TextAttachmentType } from "./ai.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parsing for a persisted chat row (`chat_message.chatPayload`).
|
|
4
|
+
*
|
|
5
|
+
* Two readers load these rows: the live-edit pod's resident transcript and the
|
|
6
|
+
* editor's durable reader. The persistence filter is looser than either one --
|
|
7
|
+
* it only checks that the role and content keys exist -- while renderers call
|
|
8
|
+
* string methods on these values (`content.includes`, `group.startsWith`,
|
|
9
|
+
* `JSON.parse(content)`) and read type-specific fields without guards. So the
|
|
10
|
+
* readers, not the writer, decide what is renderable, and they have to decide
|
|
11
|
+
* it identically: a row one renders and the other drops shows up as history
|
|
12
|
+
* that appears and disappears depending on which read won.
|
|
13
|
+
*
|
|
14
|
+
* That makes this module the single definition of a renderable row. It
|
|
15
|
+
* validates required fields, normalizes optional ones to their declared types,
|
|
16
|
+
* enforces the per-type required fields, and returns a message built from a
|
|
17
|
+
* known field set rather than the raw payload.
|
|
18
|
+
*/
|
|
19
|
+
/** The fields a persisted row must carry to be renderable, post-normalization. */
|
|
20
|
+
export type PersistedChatMessageFields = {
|
|
21
|
+
role: string;
|
|
22
|
+
content: string;
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
export type PersistedChatMessageFieldsResult = {
|
|
26
|
+
valid: true;
|
|
27
|
+
fields: PersistedChatMessageFields;
|
|
28
|
+
} | {
|
|
29
|
+
valid: false;
|
|
30
|
+
reason: "payload" | "role" | "normalizedRole" | "content" | "type";
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Required-field contract for a persisted row. Callers own their own logging;
|
|
34
|
+
* `reason` says which field failed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function parsePersistedChatMessageFields(payload: unknown): PersistedChatMessageFieldsResult;
|
|
37
|
+
export type ParsePersistedChatMessageOptions = {
|
|
38
|
+
/**
|
|
39
|
+
* Used when the payload carries no finite timestamp of its own. Omit it to
|
|
40
|
+
* leave such a message's timestamp unset -- never NaN, which is false in
|
|
41
|
+
* every comparison and would drop the message from any windowing pass.
|
|
42
|
+
*/
|
|
43
|
+
fallbackTimestamp?: number;
|
|
44
|
+
/** Called with a prefix-free reason when a row is rejected. */
|
|
45
|
+
onInvalid?: (detail: string) => void;
|
|
46
|
+
/** Called when parsing throws, so one bad row cannot fail a whole page. */
|
|
47
|
+
onError?: (error: unknown) => void;
|
|
48
|
+
};
|
|
49
|
+
export declare function inferTextAttachmentType(params: {
|
|
50
|
+
attachmentType: unknown;
|
|
51
|
+
mimeType: unknown;
|
|
52
|
+
fileName?: string;
|
|
53
|
+
}): TextAttachmentType | null;
|
|
54
|
+
export declare function parsePersistedChatMessage(payload: unknown, options: ParsePersistedChatMessageOptions): AiChatMessage | null;
|
|
55
|
+
//# sourceMappingURL=persisted-chat-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persisted-chat-message.d.ts","sourceRoot":"","sources":["../../src/types/persisted-chat-message.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