pi-apexlang 0.1.0 → 0.2.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.
|
@@ -157,7 +157,7 @@ export function createApexlangTool(overrides: Partial<ApexlangDependencies> = {}
|
|
|
157
157
|
),
|
|
158
158
|
list: Type.Optional(Type.Boolean({ description: "List matching compiler component types." })),
|
|
159
159
|
supporting_objects: Type.Optional(
|
|
160
|
-
Type.Boolean({ description: "Include supporting objects in runtime preflight
|
|
160
|
+
Type.Boolean({ description: "Include supporting objects in runtime preflight, validation, and import." })
|
|
161
161
|
),
|
|
162
162
|
fix_vocab: Type.Optional(
|
|
163
163
|
Type.Boolean({ description: "Apply local vocabulary fixes after interactive confirmation." })
|
|
@@ -250,6 +250,12 @@ export function createApexlangTool(overrides: Partial<ApexlangDependencies> = {}
|
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
if (choice === IMPORT_CHOICE) {
|
|
253
|
+
const expectedAppDigest = String(result.appDigest ?? "").trim().toLowerCase();
|
|
254
|
+
if (!/^[a-f0-9]{64}$/.test(expectedAppDigest)) {
|
|
255
|
+
throw new Error(
|
|
256
|
+
"APEXlang live check did not produce a valid application snapshot digest; import is blocked until it is revalidated."
|
|
257
|
+
);
|
|
258
|
+
}
|
|
253
259
|
const targetChoice = await ctx.ui.select("Choose the explicitly intended import target:", [
|
|
254
260
|
UPDATE_EXISTING_CHOICE,
|
|
255
261
|
CREATE_NEW_CHOICE
|
|
@@ -286,7 +292,9 @@ export function createApexlangTool(overrides: Partial<ApexlangDependencies> = {}
|
|
|
286
292
|
],
|
|
287
293
|
details: { action: input.action, targetResolutionMode, provingTarget: true }
|
|
288
294
|
});
|
|
289
|
-
const proofResult = await dependencies.runCreateNewProof(input, runOptions
|
|
295
|
+
const proofResult = await dependencies.runCreateNewProof(input, runOptions, {
|
|
296
|
+
expectedAppDigest
|
|
297
|
+
});
|
|
290
298
|
if (!createNewTargetProved(proofResult)) {
|
|
291
299
|
throw new Error(
|
|
292
300
|
failureOutput(
|
|
@@ -329,7 +337,8 @@ export function createApexlangTool(overrides: Partial<ApexlangDependencies> = {}
|
|
|
329
337
|
});
|
|
330
338
|
const importResult = await dependencies.runImport(input, runOptions, {
|
|
331
339
|
targetResolutionMode,
|
|
332
|
-
createNewConfirmed
|
|
340
|
+
createNewConfirmed,
|
|
341
|
+
expectedAppDigest
|
|
333
342
|
});
|
|
334
343
|
const importOutput = processOutput(importResult);
|
|
335
344
|
if (!liveImportPassed(importResult)) {
|
|
@@ -43,11 +43,21 @@ export interface ApexlangRunOptions {
|
|
|
43
43
|
export interface ApexlangImportOptions {
|
|
44
44
|
targetResolutionMode?: "update-existing" | "create-new";
|
|
45
45
|
createNewConfirmed?: boolean;
|
|
46
|
+
expectedAppDigest?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ApexlangApprovedImportOptions extends ApexlangImportOptions {
|
|
50
|
+
expectedAppDigest: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ApexlangCreateNewProofOptions {
|
|
54
|
+
expectedAppDigest: string;
|
|
46
55
|
}
|
|
47
56
|
|
|
48
57
|
export interface ProcessTreeOptions {
|
|
49
58
|
cwd: string;
|
|
50
59
|
env?: NodeJS.ProcessEnv;
|
|
60
|
+
input?: string;
|
|
51
61
|
maxBuffer?: number;
|
|
52
62
|
signal?: AbortSignal;
|
|
53
63
|
timeoutMs?: number;
|
|
@@ -60,11 +70,43 @@ export interface ApexlangProcessResult {
|
|
|
60
70
|
stderr: string;
|
|
61
71
|
}
|
|
62
72
|
|
|
73
|
+
export interface SqlclValidationImportOptions extends ProcessTreeOptions {
|
|
74
|
+
validateCommand: string;
|
|
75
|
+
importCommand: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface SqlclValidationImportResult extends ApexlangProcessResult {
|
|
79
|
+
validationAccepted: boolean;
|
|
80
|
+
validationEvidence: {
|
|
81
|
+
accepted: boolean;
|
|
82
|
+
reason: string;
|
|
83
|
+
warningCount?: number;
|
|
84
|
+
validationSuccessCount?: number;
|
|
85
|
+
outputSha256?: string;
|
|
86
|
+
};
|
|
87
|
+
ptyBacked: true;
|
|
88
|
+
ptyProcessGroupReady: boolean;
|
|
89
|
+
sessionReady: boolean;
|
|
90
|
+
validationSent: boolean;
|
|
91
|
+
importSent: boolean;
|
|
92
|
+
importCompleted: boolean;
|
|
93
|
+
hardFailureDetected: boolean;
|
|
94
|
+
orderedMergedOutput: true;
|
|
95
|
+
validationOutput: string;
|
|
96
|
+
importOutput: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
63
99
|
export interface ApexlangRunResult extends ApexlangProcessResult {
|
|
64
100
|
action: ApexlangAction;
|
|
65
101
|
command: ApexlangCommand;
|
|
66
102
|
outputRoot: string;
|
|
67
103
|
preludeResults: ApexlangProcessResult[];
|
|
104
|
+
runtimeApp: {
|
|
105
|
+
appPath?: string;
|
|
106
|
+
staged: boolean;
|
|
107
|
+
workspaceSource?: "workspace.name" | "app.workspace.name" | "explicit_workspace_name";
|
|
108
|
+
};
|
|
109
|
+
appDigest?: string;
|
|
68
110
|
}
|
|
69
111
|
|
|
70
112
|
export const APEXLANG_SKILL_ROOT: string;
|
|
@@ -91,11 +133,79 @@ export function validateMaterializationPaths(options: {
|
|
|
91
133
|
requested: string;
|
|
92
134
|
suggested: string;
|
|
93
135
|
}): Promise<string>;
|
|
136
|
+
export function prepareRuntimeApp(
|
|
137
|
+
input: ApexlangInput,
|
|
138
|
+
cwd: string,
|
|
139
|
+
outputRoot: string,
|
|
140
|
+
options?: { forceStage?: boolean }
|
|
141
|
+
): Promise<{
|
|
142
|
+
appPath?: string;
|
|
143
|
+
staged: boolean;
|
|
144
|
+
workspaceSource?: "workspace.name" | "app.workspace.name" | "explicit_workspace_name";
|
|
145
|
+
}>;
|
|
146
|
+
export function computeApexlangAppDigest(appPath: string): Promise<string>;
|
|
147
|
+
export function classifyWarningOnlyRuntimePayload(
|
|
148
|
+
payload: Record<string, unknown>,
|
|
149
|
+
transcript: string,
|
|
150
|
+
expectedImportIntent?: "validate-only" | "validate-and-import"
|
|
151
|
+
): {
|
|
152
|
+
accepted: boolean;
|
|
153
|
+
reason: string;
|
|
154
|
+
attemptLabel?: string;
|
|
155
|
+
warningCount?: number;
|
|
156
|
+
validationSuccessCount?: number;
|
|
157
|
+
attemptSha256?: string;
|
|
158
|
+
};
|
|
159
|
+
export function classifyWarningCompatibleSqlclValidation(output: string): {
|
|
160
|
+
accepted: boolean;
|
|
161
|
+
reason: string;
|
|
162
|
+
warningCount: number;
|
|
163
|
+
validationSuccessCount: number;
|
|
164
|
+
outputSha256?: string;
|
|
165
|
+
};
|
|
166
|
+
export function proveWarningOnlyProblemsAreDiagnostics(
|
|
167
|
+
payload: Record<string, any>,
|
|
168
|
+
result: Pick<ApexlangRunResult, "outputRoot">
|
|
169
|
+
): Promise<{
|
|
170
|
+
accepted: boolean;
|
|
171
|
+
reason?: string;
|
|
172
|
+
problemCount?: number;
|
|
173
|
+
problemsPath?: string;
|
|
174
|
+
problemsSha256?: string;
|
|
175
|
+
}>;
|
|
176
|
+
export function validateUpdateExistingImportProof(
|
|
177
|
+
payload: Record<string, any>,
|
|
178
|
+
input: ApexlangInput,
|
|
179
|
+
stagedAppPath: string
|
|
180
|
+
): {
|
|
181
|
+
canonicalId: number;
|
|
182
|
+
canonicalAlias: string;
|
|
183
|
+
sourceId: number;
|
|
184
|
+
sourceAlias: string;
|
|
185
|
+
workspaceId: string;
|
|
186
|
+
workspaceName: string;
|
|
187
|
+
};
|
|
188
|
+
export function buildWarningCompatibleImportCommands(options: {
|
|
189
|
+
appPath: string;
|
|
190
|
+
workspaceId: string;
|
|
191
|
+
canonicalId: number;
|
|
192
|
+
}): { validateCommand: string; importCommand: string };
|
|
193
|
+
export function runWarningCompatibleImport(
|
|
194
|
+
input: ApexlangInput,
|
|
195
|
+
result: ApexlangRunResult,
|
|
196
|
+
options: ApexlangRunOptions,
|
|
197
|
+
dependencies?: { sessionRunner?: typeof executeSqlclValidationThenImport }
|
|
198
|
+
): Promise<ApexlangRunResult>;
|
|
94
199
|
export function executeProcessTree(
|
|
95
200
|
executable: string,
|
|
96
201
|
args: string[],
|
|
97
202
|
options: ProcessTreeOptions
|
|
98
203
|
): Promise<ApexlangProcessResult>;
|
|
204
|
+
export function executeSqlclValidationThenImport(
|
|
205
|
+
executable: string,
|
|
206
|
+
args: string[],
|
|
207
|
+
options: SqlclValidationImportOptions
|
|
208
|
+
): Promise<SqlclValidationImportResult>;
|
|
99
209
|
export function runApexlang(
|
|
100
210
|
input: ApexlangInput,
|
|
101
211
|
options: ApexlangRunOptions
|
|
@@ -103,9 +213,10 @@ export function runApexlang(
|
|
|
103
213
|
export function runApexlangImport(
|
|
104
214
|
input: ApexlangInput,
|
|
105
215
|
options: ApexlangRunOptions,
|
|
106
|
-
importOptions
|
|
216
|
+
importOptions: ApexlangApprovedImportOptions
|
|
107
217
|
): Promise<ApexlangRunResult>;
|
|
108
218
|
export function runApexlangCreateNewProof(
|
|
109
219
|
input: ApexlangInput,
|
|
110
|
-
options: ApexlangRunOptions
|
|
220
|
+
options: ApexlangRunOptions,
|
|
221
|
+
proofOptions: ApexlangCreateNewProofOptions
|
|
111
222
|
): Promise<ApexlangRunResult>;
|