@contentful/experience-design-system-cli 2.42.1-dev-build-774b3e20.0 → 2.42.1-dev-build-fb965e69.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 (70) hide show
  1. package/bin/cli.js +1 -1
  2. package/dist/app.js +24929 -17177
  3. package/dist/index.js +27021 -17682
  4. package/dist/package.json +1 -1
  5. package/dist/src/commands/import-options.d.ts +8 -0
  6. package/dist/src/tui/debug-store.d.ts +2 -0
  7. package/dist/src/tui/import/cancellation.d.ts +26 -0
  8. package/dist/src/tui/import/debug-resume-screen.d.ts +7 -0
  9. package/dist/src/tui/import/debug-resume.d.ts +53 -0
  10. package/dist/src/tui/import/shared/agent-activity.d.ts +2 -0
  11. package/dist/src/tui/import/shared/running-step/logic.d.ts +7 -16
  12. package/dist/src/tui/import/shared/running-step/running-step.d.ts +2 -1
  13. package/dist/src/tui/import/shared/running-step/use-elapsed.d.ts +1 -0
  14. package/dist/src/tui/import/steps/03-path-validation/logic.d.ts +1 -0
  15. package/dist/src/tui/import/steps/03-path-validation/screen.d.ts +1 -0
  16. package/dist/src/tui/import/steps/06-extraction/logic.d.ts +3 -6
  17. package/dist/src/tui/import/steps/06-extraction/run-tokens-only.d.ts +1 -0
  18. package/dist/src/tui/import/steps/06-extraction/run.d.ts +9 -9
  19. package/dist/src/tui/import/steps/06-extraction/screen.d.ts +1 -3
  20. package/dist/src/tui/import/steps/06-extraction/selection.d.ts +7 -1
  21. package/dist/src/tui/import/steps/06-extraction/types.d.ts +13 -0
  22. package/dist/src/tui/import/steps/06-extraction/use-extraction.d.ts +0 -1
  23. package/dist/src/tui/import/steps/07-scope-gate/graph/index.d.ts +3 -1
  24. package/dist/src/tui/import/steps/07-scope-gate/screen.d.ts +2 -1
  25. package/dist/src/tui/import/steps/07-scope-gate/sidebar/ai-flag.d.ts +0 -1
  26. package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/GroupedSidebar.d.ts +2 -0
  27. package/dist/src/tui/import/steps/07-scope-gate/state.d.ts +5 -2
  28. package/dist/src/tui/import/steps/07-scope-gate/types.d.ts +4 -6
  29. package/dist/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.d.ts +3 -0
  30. package/dist/src/tui/import/steps/07-scope-gate/use-scope-gate.d.ts +7 -3
  31. package/dist/src/tui/import/steps/08-generation/logic.d.ts +2 -3
  32. package/dist/src/tui/import/steps/08-generation/map-tokens.d.ts +1 -1
  33. package/dist/src/tui/import/steps/08-generation/run.d.ts +9 -1
  34. package/dist/src/tui/import/steps/08-generation/save-decisions.d.ts +3 -5
  35. package/dist/src/tui/import/steps/08-generation/screen.d.ts +1 -3
  36. package/dist/src/tui/import/steps/08-generation/types.d.ts +16 -10
  37. package/dist/src/tui/import/steps/08-generation/use-generation.d.ts +0 -1
  38. package/dist/src/tui/import/steps/09-review/components/FieldEditor.d.ts +50 -2
  39. package/dist/src/tui/import/steps/09-review/components/RepresentationEditor.d.ts +11 -0
  40. package/dist/src/tui/import/steps/09-review/components/ReviewComponentPanel.d.ts +4 -1
  41. package/dist/src/tui/import/steps/09-review/components/ReviewDetailsEditor.d.ts +1 -1
  42. package/dist/src/tui/import/steps/09-review/components/source-observation-rows.d.ts +3 -0
  43. package/dist/src/tui/import/steps/09-review/generate-review-step.d.ts +17 -0
  44. package/dist/src/tui/import/steps/09-review/graph/cycle-view.d.ts +3 -0
  45. package/dist/src/tui/import/steps/09-review/history.d.ts +1 -0
  46. package/dist/src/tui/import/steps/09-review/persist-review-entry.d.ts +14 -0
  47. package/dist/src/tui/import/steps/09-review/review-details-panel.d.ts +1 -2
  48. package/dist/src/tui/import/steps/09-review/review-models.d.ts +12 -0
  49. package/dist/src/tui/import/steps/09-review/run-live-preview.d.ts +1 -0
  50. package/dist/src/tui/import/steps/09-review/types.d.ts +2 -1
  51. package/dist/src/tui/import/steps/09-review/use-review-editor.d.ts +7 -2
  52. package/dist/src/tui/import/steps/10-flow/flow/preview.d.ts +1 -0
  53. package/dist/src/tui/import/steps/10-flow/flow/push.d.ts +2 -0
  54. package/dist/src/tui/import/steps/10-flow/flow/save.d.ts +2 -0
  55. package/dist/src/tui/import/steps/10-flow/support/push-progress.d.ts +0 -1
  56. package/dist/src/tui/settings/PreferenceScreen.d.ts +17 -0
  57. package/package.json +3 -3
  58. package/skills/consensus/check.md +6 -0
  59. package/skills/consensus/tier.md +5 -0
  60. package/skills/consensus/verify.md +6 -0
  61. package/skills/debate-select.md +37 -0
  62. package/skills/explore/components.md +30 -0
  63. package/skills/explore/full-inventory.md +27 -0
  64. package/skills/explore/model-component.md +44 -0
  65. package/skills/explore/rules.md +20 -0
  66. package/skills/generate-components.md +156 -427
  67. package/skills/generate-tokens.md +1 -7
  68. package/skills/map-tokens.md +1 -1
  69. package/skills/select-components.md +20 -159
  70. package/dist/src/tui/import/steps/10-flow/support/use-timed-spinner.d.ts +0 -4
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.42.1-dev-build-774b3e20.0",
3
+ "version": "2.42.1-dev-build-fb965e69.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,10 +1,18 @@
1
1
  export interface ImportOptions {
2
2
  agent?: string;
3
3
  prompt: string[];
4
+ cache: boolean;
5
+ debugResume?: string;
6
+ debugFrom?: string;
7
+ debugOutput?: string;
4
8
  }
5
9
  interface RawImportOptions {
6
10
  agent?: string;
7
11
  prompt?: string[];
12
+ cache?: boolean;
13
+ debugResume?: string | boolean;
14
+ debugFrom?: string;
15
+ debugOutput?: string;
8
16
  }
9
17
  export declare function toImportOptions(raw: RawImportOptions): ImportOptions;
10
18
  export {};
@@ -18,6 +18,8 @@ export declare function startDebugSessionIn(base: string, { replace }?: {
18
18
  * folder that cannot be created) the files stay in `<project>/.contentful`, as before.
19
19
  */
20
20
  export declare function startImportRun(projectPath: string): Promise<string>;
21
+ /** Append an event to the current debug session; disabled or failed logging must not stop the import. */
22
+ export declare function recordDebugEvent(event: string, payload?: Record<string, unknown>): Promise<void>;
21
23
  export declare function startDebugRun({ flow, step, menuOption, inputs, }: {
22
24
  flow: string;
23
25
  step: string;
@@ -0,0 +1,26 @@
1
+ export declare function throwIfAborted(signal?: AbortSignal): void;
2
+ export declare function isAbortError(error: unknown): boolean;
3
+ export interface ImportAttempt {
4
+ id: number;
5
+ controller: AbortController;
6
+ }
7
+ export interface ImportAttemptOwner {
8
+ begin(): ImportAttempt;
9
+ cancel(): void;
10
+ isCurrent(attempt: ImportAttempt): boolean;
11
+ current(): ImportAttempt | undefined;
12
+ }
13
+ export declare function createImportAttemptOwner(): ImportAttemptOwner;
14
+ export declare function awaitForCurrentImportAttempt<T>(attempt: ImportAttempt, isCurrent: (attempt: ImportAttempt) => boolean, operation: () => Promise<T>): Promise<{
15
+ current: false;
16
+ } | {
17
+ current: true;
18
+ value: T;
19
+ }>;
20
+ export declare function trackImportWork<T>(work: Promise<T>): Promise<T>;
21
+ export declare function cancelAndDrainImportWork(): Promise<void>;
22
+ export declare function linkAbortSignal(parent?: AbortSignal): {
23
+ controller: AbortController;
24
+ dispose: () => void;
25
+ };
26
+ export declare function awaitWithSignal<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T>;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { type DebugResumeState, type DebugResumeStep } from './debug-resume.js';
3
+ export declare function DebugResumeScreen({ state, onChoose, onQuit, }: {
4
+ state: DebugResumeState;
5
+ onChoose: (step: DebugResumeStep) => void;
6
+ onQuit: () => void;
7
+ }): React.ReactElement;
@@ -0,0 +1,53 @@
1
+ import * as z from 'zod/mini';
2
+ import { type ScopeDecisions } from '@contentful/experience-design-system-backend-pipeline';
3
+ import { type ExtractionHandoff } from '@contentful/experience-design-system-types/handoff';
4
+ import type { ExtractionInput } from './steps/06-extraction/types.js';
5
+ export declare const DEBUG_RESUME_STEPS: readonly ["scope", "details", "generation", "tokens", "review"];
6
+ export type DebugResumeStep = (typeof DEBUG_RESUME_STEPS)[number];
7
+ declare const CheckpointSchema: z.ZodMiniObject<{
8
+ version: z.ZodMiniLiteral<1>;
9
+ projectPath: z.ZodMiniString<string>;
10
+ rawTokensPath: z.ZodMiniString<string>;
11
+ agent: z.ZodMiniString<string>;
12
+ agentModel: z.ZodMiniOptional<z.ZodMiniString<string>>;
13
+ promptOverrides: z.ZodMiniArray<z.ZodMiniString<string>>;
14
+ extraction: z.ZodMiniCustom<{
15
+ sessionId: string;
16
+ outDir: string;
17
+ tokensPath: string;
18
+ tokenSessionId: string | null;
19
+ tokenCount: number;
20
+ existingEntitiesPath: string | null;
21
+ existingEntitiesStatus: "failed" | "idle" | "complete";
22
+ compositionPhase: "done" | "cache-hit";
23
+ }, {
24
+ sessionId: string;
25
+ outDir: string;
26
+ tokensPath: string;
27
+ tokenSessionId: string | null;
28
+ tokenCount: number;
29
+ existingEntitiesPath: string | null;
30
+ existingEntitiesStatus: "failed" | "idle" | "complete";
31
+ compositionPhase: "done" | "cache-hit";
32
+ }>;
33
+ }, z.core.$strip>;
34
+ type DebugImportCheckpoint = z.infer<typeof CheckpointSchema>;
35
+ export interface DebugResumeState {
36
+ checkpoint: DebugImportCheckpoint;
37
+ decisions?: ScopeDecisions;
38
+ detailComplete: boolean;
39
+ generationComplete: boolean;
40
+ tokenMappingComplete: boolean;
41
+ }
42
+ export declare function debugCheckpointDirectory(sessionId: string): string;
43
+ export declare function saveDebugImportCheckpoint(input: ExtractionInput, extraction: ExtractionHandoff): Promise<void>;
44
+ export declare function saveDebugTokenMappingComplete(sessionId: string, detailRunId: string | undefined): Promise<void>;
45
+ /** Explicit debugging reopens saved evidence; it does not compare it with current disk or prompt contents. */
46
+ export declare function loadDebugResume(session: string, fallback?: {
47
+ outDir: string;
48
+ agent: string;
49
+ agentModel?: string;
50
+ promptOverrides: string[];
51
+ }): Promise<DebugResumeState>;
52
+ export declare function assertDebugResumeStep(state: DebugResumeState, step: DebugResumeStep): void;
53
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { AgentInvocationActivity } from '@contentful/experience-design-system-backend-pipeline';
2
+ export declare function describeAgentActivity(activity?: AgentInvocationActivity): string | undefined;
@@ -1,27 +1,18 @@
1
1
  export interface Progress {
2
2
  done: number;
3
3
  total: number;
4
+ label?: string;
4
5
  }
5
6
  export interface RunningLine {
7
+ id?: string;
6
8
  text: string;
9
+ detail?: string;
7
10
  complete?: boolean;
8
- /** Set for a row that ended badly. A warning carries on without it; a failure does not. Otherwise `complete` decides. */
9
- state?: 'warning' | 'failed';
11
+ failed?: boolean;
12
+ pending?: boolean;
10
13
  progress?: Progress;
11
- /** How long the row took, once it has finished. */
12
- ms?: number;
13
14
  }
14
- export type LineState = 'running' | 'done' | 'warning' | 'failed';
15
- /** What a row looks like. A row that ended badly is never shown as running or as done. */
16
- export declare function lineState(line: RunningLine): LineState;
17
- export declare function formatDuration(ms: number): string;
18
- /**
19
- * How long each row took, by position, for the rows that have finished. A row's time is how long the run had been going
20
- * when it was first seen finished, and it does not change after that. Rows keep their position for the whole run, so a row
21
- * that appears later is added at the end.
22
- */
23
- export declare function trackFinished(previous: ReadonlyArray<number | undefined>, rows: readonly RunningLine[], elapsedMs: number): Array<number | undefined>;
24
- /** The rows with the time each finished row took, by position. */
25
- export declare function withTimes(rows: RunningLine[], rowMs: ReadonlyArray<number | undefined>): RunningLine[];
15
+ /** A moving segment indicates activity without inventing a percentage or completion estimate. */
16
+ export declare function activitySegment(seconds: number, width?: number, size?: number): number;
26
17
  export declare function progressPercent(progress: Progress): number;
27
18
  export declare function formatElapsed(totalSeconds: number): string;
@@ -4,7 +4,8 @@ import type { ImportStepId } from '@tui/shared/components/StepHeader.js';
4
4
  interface RunningStepProps {
5
5
  step: ImportStepId;
6
6
  description: string;
7
+ elapsedLabel?: string;
7
8
  lines?: readonly RunningLine[];
8
9
  }
9
- export declare function RunningStep({ step, description, lines, }: RunningStepProps): React.ReactElement;
10
+ export declare function RunningStep({ step, description, elapsedLabel, lines, }: RunningStepProps): React.ReactElement;
10
11
  export {};
@@ -1 +1,2 @@
1
+ export declare function useElapsedSeconds(active?: boolean): number;
1
2
  export declare function useElapsed(): string;
@@ -8,6 +8,7 @@ export type ScanResult = {
8
8
  counts: FileCounts;
9
9
  filePaths: string[];
10
10
  warnings: string[];
11
+ sourceInventory?: import('@contentful/experience-design-system-backend-pipeline').SourceEvidenceInventory;
11
12
  } | {
12
13
  ok: false;
13
14
  failure: ScanFailureCode;
@@ -7,6 +7,7 @@ interface PathValidationScreenProps {
7
7
  onConfirm: (result: {
8
8
  projectPath: string;
9
9
  filePaths: string[];
10
+ sourceInventory?: import('@contentful/experience-design-system-backend-pipeline').SourceEvidenceInventory;
10
11
  }) => void;
11
12
  onChangePath: () => void;
12
13
  onBack: () => void;
@@ -1,5 +1,5 @@
1
+ import type { RunningLine } from '../../shared/running-step/logic.js';
1
2
  import type { ExtractAndComposeProgress } from '@contentful/experience-design-system-backend-pipeline';
2
- import { type RunningLine } from '../../shared/running-step/logic.js';
3
3
  import type { ExtractionInput, ExtractionProgress, ExtractionResult } from './types.js';
4
4
  /** Structured progress events emitted by the orchestrator (extraction + composition). */
5
5
  export type ProgressEvent = ExtractAndComposeProgress;
@@ -25,11 +25,8 @@ export declare function initialProgress(input: {
25
25
  hasRawTokens: boolean;
26
26
  }): ExtractionProgress;
27
27
  export declare function applyProgressEvent(progress: ExtractionProgress, event: ProgressEvent): ExtractionProgress;
28
- /**
29
- * The rows the screen shows, in the order the wizard showed them. Rows that do not apply are left out. `rowMs` is how long
30
- * each finished row took, by position (see `trackFinished`).
31
- */
32
- export declare function progressRows(progress: ExtractionProgress, agent: string, rowMs?: ReadonlyArray<number | undefined>): RunningLine[];
28
+ /** The rows the screen shows, in the order the wizard showed them. Rows that do not apply are left out. */
29
+ export declare function progressRows(progress: ExtractionProgress, agent: string): RunningLine[];
33
30
  /** True when every job is already done, so the screen would only flash. The wizard shows nothing in this case. */
34
31
  export declare function isFullCacheHit(progress: ExtractionProgress): boolean;
35
32
  export declare function noComponentsMessage(projectPath: string): string;
@@ -1,5 +1,6 @@
1
1
  import { checkAgentAuth, runGenerateTokensSession } from '@contentful/experience-design-system-backend-pipeline';
2
2
  export interface TokensOnlyInput {
3
+ signal?: AbortSignal;
3
4
  rawTokensPath: string;
4
5
  /** Where tokens.json is written: this import run's folder. */
5
6
  outDir: string;
@@ -1,10 +1,10 @@
1
- import { checkAgentAuth, runExtractAndComposeSession, runGenerateTokensSession } from '@contentful/experience-design-system-backend-pipeline';
1
+ import { checkAgentAuth, type ExistingContentfulEntities, runExtractAndComposeSession, runGenerateTokensSession } from '@contentful/experience-design-system-backend-pipeline';
2
2
  import { runSelection } from './selection.js';
3
3
  import type { ExtractionInput, ExtractionProgress, ExtractionResult } from './types.js';
4
4
  /** The outside world the stage talks to, so the order of events can be tested without a network, an agent or a CLI. */
5
5
  export interface ExtractionDeps {
6
6
  checkAgentAuth: typeof checkAgentAuth;
7
- fetchEntities: (credentials: NonNullable<ExtractionInput['credentials']>, outDir: string) => Promise<string | null>;
7
+ fetchEntities: (credentials: NonNullable<ExtractionInput['credentials']>, outDir: string, onCapture?: (entities: ExistingContentfulEntities) => void, onActivity?: (activity: string) => void) => Promise<string | null>;
8
8
  runExtractAndComposeSession: typeof runExtractAndComposeSession;
9
9
  runGenerateTokensSession: typeof runGenerateTokensSession;
10
10
  runSelection: typeof runSelection;
@@ -14,13 +14,13 @@ export interface ExtractionDeps {
14
14
  * subprocess:
15
15
  *
16
16
  * entities fetch ───────────────────┐
17
- * extract + compose (in-process) │
18
- * └─ onSessionCreated(id) ────────┴─ selection agent (waits for fetch) ──┐
19
- * └──────────────────────── returns (composition done) ─────────────────┴─ result
20
- * token generation (only when the tokens are not being reused)
17
+ * extract + compose (in-process) ── returns complete source evidence ──┐
18
+ * token generation (only when the tokens are not being reused)│
19
+ * entities fetch ──────────────────────────────────────────────────────┤
20
+ * selection (after extraction returns; waits for entities) ────────────┴─ result
21
21
  *
22
- * Selection starts the moment the orchestrator mints the sessionId, so it
23
- * overlaps with composition. When more than one job fails, the error reported
24
- * is the first of: extract, no components, selection, token generation.
22
+ * Selection consumes the completed saved source envelope, so it starts only
23
+ * after extraction and composition return. When multiple jobs fail, the
24
+ * reported error priority is: extract, no components, selection, token generation.
25
25
  */
26
26
  export declare function runExtraction(input: ExtractionInput, onProgress: (progress: ExtractionProgress) => void, deps?: ExtractionDeps): Promise<ExtractionResult>;
@@ -3,8 +3,6 @@ import type { ExtractionProgress } from './types.js';
3
3
  interface ExtractionScreenProps {
4
4
  progress: ExtractionProgress;
5
5
  agent: string;
6
- /** How long each finished row took, by position. */
7
- rowMs?: ReadonlyArray<number | undefined>;
8
6
  }
9
- export declare function ExtractionScreen({ progress, agent, rowMs }: ExtractionScreenProps): React.ReactElement;
7
+ export declare function ExtractionScreen({ progress, agent }: ExtractionScreenProps): React.ReactElement;
10
8
  export {};
@@ -1,11 +1,17 @@
1
- import { type AgentName } from '@contentful/experience-design-system-backend-pipeline';
1
+ import { type AgentName, type SourceEvidenceHandle, type RendererReferenceInput, type ExplorationProgressEvent } from '@contentful/experience-design-system-backend-pipeline';
2
2
  export interface SelectionOptions {
3
+ rendererReference?: RendererReferenceInput;
4
+ onActivity?: (event: ExplorationProgressEvent) => void;
5
+ signal?: AbortSignal;
3
6
  sessionId: string;
4
7
  agent: AgentName;
5
8
  model?: string;
6
9
  promptText?: string;
7
10
  promptPath?: string;
8
11
  noCache: boolean;
12
+ sourceEvidenceHandle?: SourceEvidenceHandle;
13
+ promptOverrides?: string[];
14
+ existingEntitiesPath?: string | null;
9
15
  }
10
16
  /**
11
17
  * The selection agent run, as the legacy wizard ran it.
@@ -1,5 +1,8 @@
1
1
  import type { ExtractionHandoff } from '@contentful/experience-design-system-types/handoff';
2
2
  export interface ExtractionInput {
3
+ sourceInventory?: import('@contentful/experience-design-system-backend-pipeline').SourceEvidenceInventory;
4
+ evidenceFilePaths?: readonly string[];
5
+ signal?: AbortSignal;
3
6
  projectPath: string;
4
7
  /** Where the stage writes tokens.json and the other files. Defaults to `<projectPath>/.contentful`. */
5
8
  outDir?: string;
@@ -26,11 +29,21 @@ export interface ExtractionProgress {
26
29
  scan: {
27
30
  scanned: number;
28
31
  total: number | null;
32
+ componentsFound?: number;
29
33
  } | null;
34
+ sourceActivity?: {
35
+ phase: 'analyzing' | 'validating' | 'capturing' | 'captured' | 'publishing' | 'complete';
36
+ activity: string;
37
+ };
30
38
  composition: CompositionPhase;
39
+ compositionActivity?: string;
31
40
  selection: 'running' | 'complete';
41
+ exploration?: import('@contentful/experience-design-system-backend-pipeline').ExplorationProgressEvent;
32
42
  existingEntities: JobStatus;
43
+ existingEntitiesActivity?: string;
33
44
  tokens: JobStatus;
45
+ tokenActivity?: import('@contentful/experience-design-system-backend-pipeline').GenerateTokensProgress;
46
+ tokenCount?: number;
34
47
  }
35
48
  /** The label the error screen shows, as the wizard labelled it. */
36
49
  type ExtractionStepName = 'analyze extract' | 'selection agent' | 'generate tokens' | 'print tokens' | `${string} auth check`;
@@ -2,7 +2,6 @@ import type { ExtractionInput, ExtractionProgress, ExtractionResult } from './ty
2
2
  export type ExtractionState = {
3
3
  status: 'running';
4
4
  progress: ExtractionProgress;
5
- rowMs: Array<number | undefined>;
6
5
  } | {
7
6
  status: 'done';
8
7
  result: ExtractionResult;
@@ -20,7 +20,9 @@ export interface SidebarItem {
20
20
  status: NodeStatus;
21
21
  }
22
22
  /** What the sidebar draws a row from: an entry standing in for the component (its slots are what matter), and its status. */
23
- export declare function sidebarItems(components: ScopeComponent[]): SidebarItem[];
23
+ export declare function sidebarItems(components: ScopeComponent[], displayNodes?: ComponentGraphNode[]): SidebarItem[];
24
+ /** Source relationships guide navigation; they do not establish slot restrictions or selection cascades. */
25
+ export declare function buildRelationshipNodes(components: ScopeComponent[]): ComponentGraphNode[];
24
26
  export declare function buildScopeGraph(components: ScopeComponent[]): ScopeGraph;
25
27
  /** Names that change when `target` is accepted. Pulls in everything it needs, whole cycles together. */
26
28
  export declare function acceptCascade(graph: ScopeGraph, target: string): string[];
@@ -2,9 +2,10 @@ import React from 'react';
2
2
  import type { ScopeComponent, ScopeDecisions } from './types.js';
3
3
  interface ScopeGateScreenProps {
4
4
  components: ScopeComponent[];
5
+ savedDecisions?: ScopeDecisions;
5
6
  tokensPath?: string;
6
7
  onConfirm: (decisions: ScopeDecisions) => void;
7
8
  onQuit: () => void;
8
9
  }
9
- export declare function ScopeGateScreen({ components, tokensPath, onConfirm, onQuit, }: ScopeGateScreenProps): React.ReactElement;
10
+ export declare function ScopeGateScreen(props: ScopeGateScreenProps): React.ReactElement;
10
11
  export {};
@@ -1,5 +1,4 @@
1
1
  export type AiFlaggable = {
2
2
  aiDecision?: 'accepted' | 'rejected' | 'failed' | null;
3
- needsReview?: boolean;
4
3
  };
5
4
  export declare function isAiFlagged(row: AiFlaggable): boolean;
@@ -27,6 +27,7 @@ export interface GroupedSidebarProps {
27
27
  alwaysExpanded?: boolean;
28
28
  showFlatTier?: boolean;
29
29
  selectionStateByKey?: Map<string, 'accepted' | 'rejected' | 'undecided'>;
30
+ displayLabelByKey?: Map<string, string>;
30
31
  aiFlaggedByKey?: Map<string, boolean>;
31
32
  dimPredicate?: (componentKey: string) => boolean;
32
33
  viewMode?: 'grouped' | 'flat';
@@ -56,6 +57,7 @@ export declare function buildVisibleRows(props: {
56
57
  viewMode?: 'grouped' | 'flat';
57
58
  graph: ComponentGraphNode[];
58
59
  filterVisibleKeys?: Set<string>;
60
+ edgeLabel?: string;
59
61
  }): VisibleRow[];
60
62
  export declare function GroupedSidebar(props: GroupedSidebarProps): React.ReactElement;
61
63
  export {};
@@ -1,6 +1,8 @@
1
1
  import { type ScopeGraph } from './graph/index.js';
2
- import type { Decision, ScopeComponent, ScopeDecisions } from './types.js';
3
- export type DecisionState = Map<string, Decision>;
2
+ import type { Decision, ScopeComponent, ScopeDecisions, ScopeProvenance } from './types.js';
3
+ export type DecisionState = Map<string, Decision> & {
4
+ acceptedProvenance?: Map<string, ScopeProvenance>;
5
+ };
4
6
  export type DecisionAction = {
5
7
  type: 'accept';
6
8
  name: string;
@@ -12,6 +14,7 @@ export type DecisionAction = {
12
14
  } | {
13
15
  type: 'accept-unflagged';
14
16
  };
17
+ export declare function createDecisionState(components: ScopeComponent[], saved?: ScopeDecisions): DecisionState;
15
18
  export declare function reduceDecisions(state: DecisionState, action: DecisionAction, components: ScopeComponent[], graph: ScopeGraph): DecisionState;
16
19
  /** Whether rejecting `name` touches 2 or more other components, so the screen has to ask first. */
17
20
  export declare function rejectNeedsConfirmation(graph: ScopeGraph, name: string, state: DecisionState): boolean;
@@ -1,4 +1,5 @@
1
- import type { ScopeComponentRow } from '@contentful/experience-design-system-backend-pipeline';
1
+ import type { ScopeComponentRow, ScopeDecisions, ScopeDecisionProvenance } from '@contentful/experience-design-system-backend-pipeline';
2
+ export type { ScopeDecisions };
2
3
  /**
3
4
  * One row of the gate. The loader always fills in the slots, but the screen is handed whatever the caller has, and
4
5
  * legacy's screen accepted rows without them (and without the AI fields), so those stay optional here.
@@ -10,14 +11,11 @@ export type ScopeComponent = Omit<ScopeComponentRow, 'aiDecision' | 'aiReason' |
10
11
  slots?: ScopeComponentRow['slots'];
11
12
  };
12
13
  export type Decision = 'accepted' | 'rejected' | 'undecided';
13
- /** What the user confirmed. Becomes `ImportHandoff.scope`; the legacy wizard saves it and starts generation. */
14
- export interface ScopeDecisions {
15
- accepted: string[];
16
- rejected: string[];
17
- }
14
+ export type ScopeProvenance = ScopeDecisionProvenance;
18
15
  export type ScopeGateLoad = {
19
16
  ok: true;
20
17
  components: ScopeComponent[];
18
+ savedDecisions?: ScopeDecisions;
21
19
  } | {
22
20
  ok: false;
23
21
  message: string;
@@ -21,7 +21,10 @@ interface Deps {
21
21
  }
22
22
  /** `input` is undefined until the extraction stage has produced a session, so the hook can be called unconditionally. */
23
23
  export declare function useScopeGateFlow(input: {
24
+ attemptId: number;
25
+ signal: AbortSignal;
24
26
  sessionId: string;
25
27
  cache: CacheCheckInput;
28
+ initialDecisions?: ScopeDecisions;
26
29
  } | undefined, deps?: Deps): ScopeGateFlow | undefined;
27
30
  export {};
@@ -1,8 +1,9 @@
1
1
  import type { ScopeComponent, ScopeDecisions } from './types.js';
2
2
  interface UseScopeGateOptions {
3
3
  components: ScopeComponent[];
4
- tokenCount: number;
5
- tokensWidth: number;
4
+ savedDecisions?: ScopeDecisions;
5
+ tokenCount?: number;
6
+ tokensWidth?: number;
6
7
  onConfirm: (decisions: ScopeDecisions) => void;
7
8
  onQuit: () => void;
8
9
  }
@@ -12,7 +13,7 @@ export interface PendingRejectCascade {
12
13
  ancestors: string[];
13
14
  descendants: string[];
14
15
  }
15
- export declare function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }: UseScopeGateOptions): {
16
+ export declare function useScopeGate({ components, savedDecisions, tokenCount, tokensWidth, onConfirm, onQuit, }: UseScopeGateOptions): {
16
17
  totalWidth: number;
17
18
  columnPlan: {
18
19
  layout: "single" | "two-column";
@@ -24,7 +25,9 @@ export declare function useScopeGate({ components, tokenCount, tokensWidth, onCo
24
25
  panelMaxRows: number;
25
26
  groupedItems: import("./graph/index.js").SidebarItem[];
26
27
  graph: import("./graph/index.js").ScopeGraph;
28
+ displayNodes: import("./graph/composite-closure.js").ComponentGraphNode[];
27
29
  hasGroupRoots: boolean;
30
+ hasSourceRelationships: boolean;
28
31
  expandedGroups: Set<string>;
29
32
  toggleExpanded: (rootName: string) => void;
30
33
  visibleRows: import("./sidebar/components/GroupedSidebar.js").VisibleRow[];
@@ -48,6 +51,7 @@ export declare function useScopeGate({ components, tokenCount, tokensWidth, onCo
48
51
  jumpTarget: string;
49
52
  }[];
50
53
  aiExcludedCount: number;
54
+ hasAdvisoryNotes: boolean;
51
55
  pendingRejectCascade: PendingRejectCascade | null;
52
56
  safeTokensCursor: number;
53
57
  counters: {
@@ -1,4 +1,4 @@
1
- import { type RunningLine } from '../../shared/running-step/logic.js';
1
+ import type { RunningLine } from '../../shared/running-step/logic.js';
2
2
  import type { GenerationInput, GenerationProgress, GenerationResult } from './types.js';
3
3
  /** What the debug log says the stage started with. The counts are logged, not the lists of names. */
4
4
  export declare function generationLogInputs(input: GenerationInput): Record<string, unknown>;
@@ -21,5 +21,4 @@ export declare function describeGeneration(input: {
21
21
  agent: string;
22
22
  hasTokens: boolean;
23
23
  }): string;
24
- /** `rowMs` is how long each finished row took, by position (see `trackFinished`). */
25
- export declare function progressRows(progress: GenerationProgress, agent: string, rowMs?: ReadonlyArray<number | undefined>): RunningLine[];
24
+ export declare function progressRows(progress: GenerationProgress, agent: string): RunningLine[];
@@ -11,4 +11,4 @@ export interface MapTokensPlan {
11
11
  * one, or restored from the saved tokens.json when an existing catalog was reused (there is no token session then).
12
12
  * Then it counts the design props that are tokens and the raw tokens. Reads and writes the pipeline database.
13
13
  */
14
- export declare function prepareMapTokens(input: Pick<GenerationInput, 'tokenSessionId' | 'tokensPath'>, generatedSessionId: string): Promise<MapTokensPlan>;
14
+ export declare function prepareMapTokens(input: Pick<GenerationInput, 'tokenSessionId' | 'tokensPath' | 'signal'>, generatedSessionId: string): Promise<MapTokensPlan>;
@@ -1,4 +1,4 @@
1
- import { checkAgentAuth, runGenerateComponentsSession, runMapTokens } from '@contentful/experience-design-system-backend-pipeline';
1
+ import { checkAgentAuth, runGenerateComponentsSession, runExplorationDetailSession, runMapTokens } from '@contentful/experience-design-system-backend-pipeline';
2
2
  import { prepareMapTokens } from './map-tokens.js';
3
3
  import { saveDecisions } from './save-decisions.js';
4
4
  import type { GenerationInput, GenerationProgress, GenerationResult } from './types.js';
@@ -8,5 +8,13 @@ export interface GenerationDeps {
8
8
  runGenerate: typeof runGenerateComponentsSession;
9
9
  runMapTokens: typeof runMapTokens;
10
10
  prepareMapTokens: typeof prepareMapTokens;
11
+ prepareMapOptions: typeof buildMapTokensOptions;
12
+ runDetail?: typeof runExplorationDetailSession;
11
13
  }
12
14
  export declare function runGeneration(input: GenerationInput, onProgress: (progress: GenerationProgress) => void, deps?: GenerationDeps): Promise<GenerationResult>;
15
+ declare function buildMapTokensOptions(input: GenerationInput, signal?: AbortSignal): Promise<{
16
+ skillContentOverride?: string;
17
+ skillPathOverride?: string;
18
+ existingEntitiesInline?: string;
19
+ }>;
20
+ export {};
@@ -1,8 +1,6 @@
1
1
  import type { GenerationInput } from './types.js';
2
2
  /**
3
- * Applies the scope decisions to the session and writes the review snapshot that `generate components` reads to leave
4
- * out rejected components. Without the snapshot the generator would process rejected components anyway.
5
- * Uses `applyScopeDecisions` and `writeScopeDecisionsSnapshot` from backend-pipeline, which are identical to legacy's.
6
- * Both write to the pipeline database, so this runs only after the cache check has finished restoring into it.
3
+ * Saves human scope decisions in the database. Completed exploration consumes that scope directly;
4
+ * the snapshot writer only creates a review artifact for legacy sessions without exploration.
7
5
  */
8
- export declare function saveDecisions(input: Pick<GenerationInput, 'sessionId' | 'decisions'>): Promise<void>;
6
+ export declare function saveDecisions(input: Pick<GenerationInput, 'sessionId' | 'decisions' | 'signal'>): Promise<void>;
@@ -5,8 +5,6 @@ interface GenerationScreenProps {
5
5
  agent: string;
6
6
  acceptedCount: number;
7
7
  hasTokens: boolean;
8
- /** How long each finished row took, by position. */
9
- rowMs?: ReadonlyArray<number | undefined>;
10
8
  }
11
- export declare function GenerationScreen({ progress, agent, acceptedCount, hasTokens, rowMs, }: GenerationScreenProps): React.ReactElement;
9
+ export declare function GenerationScreen({ progress, agent, acceptedCount, hasTokens, }: GenerationScreenProps): React.ReactElement;
12
10
  export {};
@@ -1,11 +1,11 @@
1
1
  import type { GenerationHandoff } from '@contentful/experience-design-system-types/handoff';
2
+ import type { ExplorationProgressEvent, ScopeDecisions } from '@contentful/experience-design-system-backend-pipeline';
2
3
  export interface GenerationInput {
4
+ debugResumeFrom?: 'details' | 'generation' | 'tokens';
5
+ signal?: AbortSignal;
3
6
  /** The extraction session the scope was decided on. */
4
7
  sessionId: string;
5
- decisions: {
6
- accepted: string[];
7
- rejected: string[];
8
- };
8
+ decisions: ScopeDecisions;
9
9
  /**
10
10
  * The cache check that ran while the scope gate was open, which restores cached definitions into the pipeline
11
11
  * database. The stage waits for it before saving the decisions, since both write to that database.
@@ -26,21 +26,27 @@ export interface GenerationInput {
26
26
  }
27
27
  /** One line per thing the screen shows, in the order it shows them. */
28
28
  export interface GenerationProgress {
29
- /**
30
- * Components finished, out of the total, and the one being worked on. `failed` counts the finished ones that failed: the
31
- * run carries on through the rest and only fails at the end. Null until the first progress line.
32
- */
29
+ stage: 'preparing' | 'saving-decisions' | 'authenticating' | 'exploring' | 'generating' | 'preparing-token-mapping' | 'mapping-tokens' | 'complete';
30
+ exploration?: ExplorationProgressEvent;
31
+ activeComponents: Array<{
32
+ name: string;
33
+ attempt: number;
34
+ maxAttempts: number;
35
+ exploringModel?: boolean;
36
+ }>;
37
+ failedComponents: number;
38
+ /** Components finished, out of the total, and the one being worked on. Null until the first progress line. */
33
39
  components: {
34
40
  done: number;
35
41
  total: number;
36
42
  current: string;
37
- failed: number;
38
43
  } | null;
39
44
  mapTokens: 'idle' | 'running' | 'complete';
40
45
  /** Whether token mapping will run at all; unknown until the generated components have been looked at. */
41
46
  mapTokensEligible: boolean | null;
47
+ resumedComponents?: number;
42
48
  }
43
- export type GenerationStepName = 'save decisions' | 'generate components' | 'map tokens' | `${string} auth check`;
49
+ export type GenerationStepName = 'save decisions' | 'explore selected components' | 'generate components' | 'map tokens' | `${string} auth check`;
44
50
  export type GenerationResult = {
45
51
  ok: true;
46
52
  generation: GenerationHandoff;
@@ -2,7 +2,6 @@ import type { GenerationInput, GenerationProgress, GenerationResult } from './ty
2
2
  export type GenerationState = {
3
3
  status: 'running';
4
4
  progress: GenerationProgress;
5
- rowMs: Array<number | undefined>;
6
5
  } | {
7
6
  status: 'done';
8
7
  result: GenerationResult;