@slicemachine/manager 0.26.2 → 0.26.3-alpha.jp-error-track-args.1
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/managers/customTypes/CustomTypesManager.cjs +32 -7
- package/dist/managers/customTypes/CustomTypesManager.cjs.map +1 -1
- package/dist/managers/customTypes/CustomTypesManager.js +33 -8
- package/dist/managers/customTypes/CustomTypesManager.js.map +1 -1
- package/dist/managers/telemetry/types.cjs +8 -0
- package/dist/managers/telemetry/types.cjs.map +1 -1
- package/dist/managers/telemetry/types.d.ts +19 -1
- package/dist/managers/telemetry/types.js +8 -0
- package/dist/managers/telemetry/types.js.map +1 -1
- package/package.json +4 -3
- package/src/managers/customTypes/CustomTypesManager.ts +48 -11
- package/src/managers/telemetry/types.ts +42 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slicemachine/manager",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.3-alpha.jp-error-track-args.1",
|
|
4
4
|
"description": "Manage all aspects of a Slice Machine project.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@prismicio/mocks": "2.14.0",
|
|
72
72
|
"@prismicio/types-internal": "3.11.2",
|
|
73
73
|
"@segment/analytics-node": "^2.1.2",
|
|
74
|
-
"@slicemachine/plugin-kit": "0.4.
|
|
74
|
+
"@slicemachine/plugin-kit": "0.4.88-alpha.jp-error-track-args.1",
|
|
75
75
|
"cookie": "^1.0.1",
|
|
76
76
|
"cors": "^2.8.5",
|
|
77
77
|
"execa": "^7.1.1",
|
|
@@ -131,5 +131,6 @@
|
|
|
131
131
|
},
|
|
132
132
|
"publishConfig": {
|
|
133
133
|
"access": "public"
|
|
134
|
-
}
|
|
134
|
+
},
|
|
135
|
+
"stableVersion": "0.26.2"
|
|
135
136
|
}
|
|
@@ -42,11 +42,11 @@ import { randomUUID } from "node:crypto";
|
|
|
42
42
|
import { join as joinPath, relative as relativePath } from "node:path";
|
|
43
43
|
import {
|
|
44
44
|
mkdtemp,
|
|
45
|
-
rename,
|
|
46
45
|
rm,
|
|
47
46
|
writeFile,
|
|
48
47
|
readFile,
|
|
49
48
|
readdir,
|
|
49
|
+
copyFile,
|
|
50
50
|
} from "node:fs/promises";
|
|
51
51
|
import { query as queryClaude } from "@anthropic-ai/claude-agent-sdk";
|
|
52
52
|
|
|
@@ -580,6 +580,8 @@ export class CustomTypesManager extends BaseManager {
|
|
|
580
580
|
console.info(`inferSlice (${source}) started for request ${requestId}`);
|
|
581
581
|
const startTime = Date.now();
|
|
582
582
|
|
|
583
|
+
const claudeErrors: string[] = [];
|
|
584
|
+
|
|
583
585
|
try {
|
|
584
586
|
if (source === "figma") {
|
|
585
587
|
const { libraryID } = args;
|
|
@@ -595,6 +597,7 @@ export class CustomTypesManager extends BaseManager {
|
|
|
595
597
|
.parse(exp.payload);
|
|
596
598
|
|
|
597
599
|
let tmpDir: string | undefined;
|
|
600
|
+
|
|
598
601
|
try {
|
|
599
602
|
const config = await this.project.getSliceMachineConfig();
|
|
600
603
|
|
|
@@ -818,9 +821,13 @@ FINAL REMINDERS:
|
|
|
818
821
|
prompt,
|
|
819
822
|
options: {
|
|
820
823
|
cwd,
|
|
821
|
-
stderr: (
|
|
822
|
-
if (!
|
|
823
|
-
|
|
824
|
+
stderr: (error) => {
|
|
825
|
+
if (!error.startsWith("Spawning Claude Code process")) {
|
|
826
|
+
claudeErrors.push(error);
|
|
827
|
+
console.error(
|
|
828
|
+
`inferSlice - stderr for request ${requestId}:`,
|
|
829
|
+
error,
|
|
830
|
+
);
|
|
824
831
|
}
|
|
825
832
|
},
|
|
826
833
|
model: "claude-haiku-4-5",
|
|
@@ -873,10 +880,25 @@ FINAL REMINDERS:
|
|
|
873
880
|
for await (const query of queries) {
|
|
874
881
|
switch (query.type) {
|
|
875
882
|
case "result":
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
883
|
+
switch (query.subtype) {
|
|
884
|
+
case "success":
|
|
885
|
+
if (!query.is_error) {
|
|
886
|
+
newSliceAbsPath = query.result.match(
|
|
887
|
+
/<new_slice_path>(.*)<\/new_slice_path>/s,
|
|
888
|
+
)?.[1];
|
|
889
|
+
} else {
|
|
890
|
+
claudeErrors.push(query.result);
|
|
891
|
+
}
|
|
892
|
+
break;
|
|
893
|
+
case "error_during_execution":
|
|
894
|
+
case "error_max_budget_usd":
|
|
895
|
+
case "error_max_turns":
|
|
896
|
+
claudeErrors.push(...query.errors);
|
|
897
|
+
console.error(
|
|
898
|
+
`inferSlice - result query error for request ${requestId}}:`,
|
|
899
|
+
query.errors,
|
|
900
|
+
);
|
|
901
|
+
break;
|
|
880
902
|
}
|
|
881
903
|
break;
|
|
882
904
|
}
|
|
@@ -897,12 +919,21 @@ FINAL REMINDERS:
|
|
|
897
919
|
);
|
|
898
920
|
}
|
|
899
921
|
|
|
900
|
-
//
|
|
901
|
-
await
|
|
922
|
+
// copy instead of moving because the file might be in a different volume
|
|
923
|
+
await copyFile(
|
|
902
924
|
tmpImageAbsPath,
|
|
903
925
|
joinPath(newSliceAbsPath, "screenshot-default.png"),
|
|
904
926
|
);
|
|
905
927
|
|
|
928
|
+
try {
|
|
929
|
+
await rm(tmpImageAbsPath);
|
|
930
|
+
} catch (error) {
|
|
931
|
+
console.warn(
|
|
932
|
+
`inferSlice - Failed to delete temporary slice screenshot at ${tmpImageAbsPath}`,
|
|
933
|
+
error,
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
|
|
906
937
|
return InferSliceResponse.parse({ slice: JSON.parse(model) });
|
|
907
938
|
} finally {
|
|
908
939
|
if (tmpDir && existsSync(tmpDir)) {
|
|
@@ -935,7 +966,13 @@ FINAL REMINDERS:
|
|
|
935
966
|
error,
|
|
936
967
|
);
|
|
937
968
|
|
|
938
|
-
throw
|
|
969
|
+
throw new Error(`inferSlice encountered errors`, {
|
|
970
|
+
cause: {
|
|
971
|
+
error,
|
|
972
|
+
...(claudeErrors.length > 0 ? { claudeErrors } : {}),
|
|
973
|
+
args,
|
|
974
|
+
},
|
|
975
|
+
});
|
|
939
976
|
} finally {
|
|
940
977
|
this.inferSliceAbortControllers.delete(requestId);
|
|
941
978
|
clearTimeout(timeoutId);
|
|
@@ -45,6 +45,11 @@ export const SegmentEventType = {
|
|
|
45
45
|
sharedOnboarding_completed: "shared-onboarding:completed",
|
|
46
46
|
sharedOnboarding_tutorial: "shared-onboarding:follow-tutorial",
|
|
47
47
|
sliceGenerationFeedback: "slice-generation-feedback",
|
|
48
|
+
sliceGeneration_pastedFromFigma: "slice-generation:pasted-from-figma",
|
|
49
|
+
sliceGeneration_started: "slice-generation:started",
|
|
50
|
+
sliceGeneration_ended: "slice-generation:ended",
|
|
51
|
+
sliceGeneration_pluginInstallationClicked:
|
|
52
|
+
"slice-generation:plugin-installation-clicked",
|
|
48
53
|
navigation_documentationLinkClicked: "navigation:documentation-link-clicked",
|
|
49
54
|
sidebar_link_clicked: "sidebar:link-clicked",
|
|
50
55
|
mcp_promo_link_clicked: "mcp:promo-link-clicked",
|
|
@@ -106,6 +111,14 @@ export const HumanSegmentEventType = {
|
|
|
106
111
|
[SegmentEventType.sharedOnboarding_tutorial]:
|
|
107
112
|
"Prismic Onboarding Guide Follow Tutorial",
|
|
108
113
|
[SegmentEventType.sliceGenerationFeedback]: "Slice Generation Feedback",
|
|
114
|
+
[SegmentEventType.sliceGeneration_pastedFromFigma]:
|
|
115
|
+
"SliceMachine Shared Slice Generation - Pasted From Figma",
|
|
116
|
+
[SegmentEventType.sliceGeneration_started]:
|
|
117
|
+
"SliceMachine Shared Slice Generation - Started",
|
|
118
|
+
[SegmentEventType.sliceGeneration_ended]:
|
|
119
|
+
"SliceMachine Shared Slice Generation - Ended",
|
|
120
|
+
[SegmentEventType.sliceGeneration_pluginInstallationClicked]:
|
|
121
|
+
"SliceMachine Shared Slice Generation - Plugin Installation Clicked",
|
|
109
122
|
[SegmentEventType.navigation_documentationLinkClicked]:
|
|
110
123
|
"SliceMachine Documentation Link Clicked",
|
|
111
124
|
[SegmentEventType.sidebar_link_clicked]: "Sidebar Link Clicked",
|
|
@@ -428,6 +441,31 @@ type SliceGenerationFeedback = SegmentEvent<
|
|
|
428
441
|
}
|
|
429
442
|
>;
|
|
430
443
|
|
|
444
|
+
type SliceGenerationPastedFromFigma = SegmentEvent<
|
|
445
|
+
typeof SegmentEventType.sliceGeneration_pastedFromFigma,
|
|
446
|
+
{
|
|
447
|
+
source: "shortcut" | "button";
|
|
448
|
+
}
|
|
449
|
+
>;
|
|
450
|
+
|
|
451
|
+
type SliceGenerationStarted = SegmentEvent<
|
|
452
|
+
typeof SegmentEventType.sliceGeneration_started,
|
|
453
|
+
{
|
|
454
|
+
source: "figma" | "upload";
|
|
455
|
+
}
|
|
456
|
+
>;
|
|
457
|
+
|
|
458
|
+
type SliceGenerationEnded = SegmentEvent<
|
|
459
|
+
typeof SegmentEventType.sliceGeneration_ended,
|
|
460
|
+
{
|
|
461
|
+
error: boolean;
|
|
462
|
+
}
|
|
463
|
+
>;
|
|
464
|
+
|
|
465
|
+
type SliceGenerationPluginInstallationClicked = SegmentEvent<
|
|
466
|
+
typeof SegmentEventType.sliceGeneration_pluginInstallationClicked
|
|
467
|
+
>;
|
|
468
|
+
|
|
431
469
|
type NavigationDocumentationLinkClicked = SegmentEvent<
|
|
432
470
|
typeof SegmentEventType.navigation_documentationLinkClicked,
|
|
433
471
|
{
|
|
@@ -502,6 +540,10 @@ export type SegmentEvents =
|
|
|
502
540
|
| SliceMachinePostPushToastCtaClicked
|
|
503
541
|
| SliceMachineExperimentExposure
|
|
504
542
|
| SliceGenerationFeedback
|
|
543
|
+
| SliceGenerationPastedFromFigma
|
|
544
|
+
| SliceGenerationStarted
|
|
545
|
+
| SliceGenerationEnded
|
|
546
|
+
| SliceGenerationPluginInstallationClicked
|
|
505
547
|
| NavigationDocumentationLinkClicked
|
|
506
548
|
| SidebarLinkClicked
|
|
507
549
|
| McpPromoLinkClicked
|