@contentful/experience-design-system-cli 2.37.1-dev-build-2fb4dadf.0 → 2.37.1-dev-build-34dbca05.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/app.js +533 -299
- package/dist/index.js +1958 -1574
- package/dist/package.json +1 -1
- package/legacy/dist/src/analytics/exit.d.ts +1 -1
- package/legacy/dist/src/analytics/index.d.ts +2 -5
- package/legacy/dist/src/index.js +18561 -18497
- package/legacy/package.json +1 -1
- package/package.json +3 -3
- package/legacy/dist/src/analytics/apply.d.ts +0 -6
- package/legacy/dist/src/analytics/client.d.ts +0 -8
- package/legacy/dist/src/analytics/constants.d.ts +0 -4
- package/legacy/dist/src/analytics/normalize.d.ts +0 -3
- package/legacy/dist/src/analytics/os.d.ts +0 -2
- package/legacy/dist/src/analytics/session.d.ts +0 -3
- package/legacy/dist/src/analytics/tracker.d.ts +0 -16
- package/legacy/dist/src/analytics/types.d.ts +0 -28
package/dist/app.js
CHANGED
|
@@ -2699,8 +2699,8 @@ function indexRowsByKey(items, key) {
|
|
|
2699
2699
|
}
|
|
2700
2700
|
|
|
2701
2701
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/read.js
|
|
2702
|
-
function getSessionById(db,
|
|
2703
|
-
const row = db.prepare("SELECT id FROM sessions WHERE id = ?").get(
|
|
2702
|
+
function getSessionById(db, sessionId2) {
|
|
2703
|
+
const row = db.prepare("SELECT id FROM sessions WHERE id = ?").get(sessionId2);
|
|
2704
2704
|
return row ?? null;
|
|
2705
2705
|
}
|
|
2706
2706
|
function getLatestCompletedSessionForCommand(db, command) {
|
|
@@ -2716,8 +2716,8 @@ function getLatestCompletedSessionForCommand(db, command) {
|
|
|
2716
2716
|
function createSession(db, id, name, timestamp) {
|
|
2717
2717
|
db.prepare("INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)").run(id, name, timestamp, timestamp);
|
|
2718
2718
|
}
|
|
2719
|
-
function updateSessionTimestamp(db,
|
|
2720
|
-
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(timestamp,
|
|
2719
|
+
function updateSessionTimestamp(db, sessionId2, timestamp) {
|
|
2720
|
+
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(timestamp, sessionId2);
|
|
2721
2721
|
}
|
|
2722
2722
|
|
|
2723
2723
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/steps/read.js
|
|
@@ -2727,13 +2727,13 @@ function getSessionIdForStep(db, stepId) {
|
|
|
2727
2727
|
}
|
|
2728
2728
|
|
|
2729
2729
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/steps/write.js
|
|
2730
|
-
function updatePendingStepsToInterrupted(db,
|
|
2730
|
+
function updatePendingStepsToInterrupted(db, sessionId2, command, timestamp) {
|
|
2731
2731
|
db.prepare(`UPDATE steps SET status = 'interrupted', completed_at = ?, updated_at = ?
|
|
2732
|
-
WHERE session_id = ? AND command = ? AND status = 'pending'`).run(timestamp, timestamp,
|
|
2732
|
+
WHERE session_id = ? AND command = ? AND status = 'pending'`).run(timestamp, timestamp, sessionId2, command);
|
|
2733
2733
|
}
|
|
2734
|
-
function createPendingStep(db,
|
|
2734
|
+
function createPendingStep(db, sessionId2, command, inputs, timestamp) {
|
|
2735
2735
|
const result = db.prepare(`INSERT INTO steps (session_id, command, status, started_at, inputs, outputs, updated_at)
|
|
2736
|
-
VALUES (?, ?, 'pending', ?, ?, '{}', ?)`).run(
|
|
2736
|
+
VALUES (?, ?, 'pending', ?, ?, '{}', ?)`).run(sessionId2, command, timestamp, JSON.stringify(inputs), timestamp);
|
|
2737
2737
|
return Number(result.lastInsertRowid);
|
|
2738
2738
|
}
|
|
2739
2739
|
function updateStepStatus(db, stepId, status, outputs, error, timestamp) {
|
|
@@ -2995,12 +2995,12 @@ function buildDtcgTokens(tokenRows) {
|
|
|
2995
2995
|
}
|
|
2996
2996
|
|
|
2997
2997
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/tokens/read.js
|
|
2998
|
-
function getDtcgTokensForSession(db,
|
|
2999
|
-
const groupRows = db.prepare("SELECT path, description FROM raw_token_groups WHERE session_id = ? ORDER BY path").all(
|
|
2998
|
+
function getDtcgTokensForSession(db, sessionId2) {
|
|
2999
|
+
const groupRows = db.prepare("SELECT path, description FROM raw_token_groups WHERE session_id = ? ORDER BY path").all(sessionId2).map((row) => ({
|
|
3000
3000
|
path: String(row.path),
|
|
3001
3001
|
description: row.description === null ? null : String(row.description)
|
|
3002
3002
|
}));
|
|
3003
|
-
const tokenRows = db.prepare("SELECT path, type, value, description FROM raw_tokens WHERE session_id = ? ORDER BY path").all(
|
|
3003
|
+
const tokenRows = db.prepare("SELECT path, type, value, description FROM raw_tokens WHERE session_id = ? ORDER BY path").all(sessionId2).map((row) => ({
|
|
3004
3004
|
path: String(row.path),
|
|
3005
3005
|
type: String(row.type),
|
|
3006
3006
|
value: String(row.value),
|
|
@@ -3011,12 +3011,12 @@ function getDtcgTokensForSession(db, sessionId) {
|
|
|
3011
3011
|
tokens: buildDtcgTokens(tokenRows)
|
|
3012
3012
|
};
|
|
3013
3013
|
}
|
|
3014
|
-
function getRawTokenNamePaths(db,
|
|
3015
|
-
const rows = db.prepare("SELECT raw_name, path FROM raw_token_name_paths WHERE session_id = ? ORDER BY raw_name").all(
|
|
3014
|
+
function getRawTokenNamePaths(db, sessionId2) {
|
|
3015
|
+
const rows = db.prepare("SELECT raw_name, path FROM raw_token_name_paths WHERE session_id = ? ORDER BY raw_name").all(sessionId2);
|
|
3016
3016
|
return Object.fromEntries(rows.map((row) => [String(row.raw_name), String(row.path)]));
|
|
3017
3017
|
}
|
|
3018
|
-
function getRawTokenNamePathRows(db,
|
|
3019
|
-
return db.prepare("SELECT raw_name, path, source FROM raw_token_name_paths WHERE session_id = ? ORDER BY raw_name").all(
|
|
3018
|
+
function getRawTokenNamePathRows(db, sessionId2) {
|
|
3019
|
+
return db.prepare("SELECT raw_name, path, source FROM raw_token_name_paths WHERE session_id = ? ORDER BY raw_name").all(sessionId2).map((row) => ({
|
|
3020
3020
|
rawName: String(row.raw_name),
|
|
3021
3021
|
path: String(row.path),
|
|
3022
3022
|
source: String(row.source)
|
|
@@ -3049,49 +3049,49 @@ function hashTokenContent(rawTokenContent) {
|
|
|
3049
3049
|
}
|
|
3050
3050
|
|
|
3051
3051
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/tokens/write.js
|
|
3052
|
-
function deleteRawTokensForSession(db,
|
|
3053
|
-
db.prepare("DELETE FROM raw_token_groups WHERE session_id = ?").run(
|
|
3054
|
-
db.prepare("DELETE FROM raw_tokens WHERE session_id = ?").run(
|
|
3052
|
+
function deleteRawTokensForSession(db, sessionId2) {
|
|
3053
|
+
db.prepare("DELETE FROM raw_token_groups WHERE session_id = ?").run(sessionId2);
|
|
3054
|
+
db.prepare("DELETE FROM raw_tokens WHERE session_id = ?").run(sessionId2);
|
|
3055
3055
|
}
|
|
3056
|
-
function createRawTokenGroups(db,
|
|
3056
|
+
function createRawTokenGroups(db, sessionId2, groups) {
|
|
3057
3057
|
const insertGroup = db.prepare(`INSERT INTO raw_token_groups (session_id, path, description) VALUES (?, ?, ?)`);
|
|
3058
3058
|
for (const group of groups) {
|
|
3059
|
-
insertGroup.run(
|
|
3059
|
+
insertGroup.run(sessionId2, group.path, group.$description ?? null);
|
|
3060
3060
|
}
|
|
3061
3061
|
}
|
|
3062
|
-
function createRawTokens(db,
|
|
3062
|
+
function createRawTokens(db, sessionId2, tokens) {
|
|
3063
3063
|
const insertToken = db.prepare(`INSERT INTO raw_tokens (session_id, path, type, value, description) VALUES (?, ?, ?, ?, ?)`);
|
|
3064
3064
|
for (const token of tokens) {
|
|
3065
|
-
insertToken.run(
|
|
3065
|
+
insertToken.run(sessionId2, token.path, token.$type, JSON.stringify(token.$value), token.$description ?? null);
|
|
3066
3066
|
}
|
|
3067
3067
|
}
|
|
3068
|
-
function upsertRawToken(db,
|
|
3068
|
+
function upsertRawToken(db, sessionId2, call) {
|
|
3069
3069
|
db.prepare(`INSERT INTO raw_tokens (session_id, path, type, value, description) VALUES (?, ?, ?, ?, ?)
|
|
3070
|
-
ON CONFLICT(session_id, path) DO UPDATE SET type = excluded.type, value = excluded.value, description = excluded.description`).run(
|
|
3070
|
+
ON CONFLICT(session_id, path) DO UPDATE SET type = excluded.type, value = excluded.value, description = excluded.description`).run(sessionId2, call.path, call.type, JSON.stringify(call.value), call.description ?? null);
|
|
3071
3071
|
}
|
|
3072
|
-
function upsertRawTokenGroup(db,
|
|
3072
|
+
function upsertRawTokenGroup(db, sessionId2, call) {
|
|
3073
3073
|
db.prepare(`INSERT INTO raw_token_groups (session_id, path, description) VALUES (?, ?, ?)
|
|
3074
|
-
ON CONFLICT(session_id, path) DO UPDATE SET description = excluded.description`).run(
|
|
3074
|
+
ON CONFLICT(session_id, path) DO UPDATE SET description = excluded.description`).run(sessionId2, call.path, call.description ?? null);
|
|
3075
3075
|
}
|
|
3076
|
-
function updateRawTokenNamePaths(db,
|
|
3076
|
+
function updateRawTokenNamePaths(db, sessionId2, tokenNamePaths, source) {
|
|
3077
3077
|
const entries = Object.entries(tokenNamePaths);
|
|
3078
3078
|
const deletePaths = db.prepare("DELETE FROM raw_token_name_paths WHERE session_id = ? AND source = ?");
|
|
3079
3079
|
const insertPath = db.prepare("INSERT OR IGNORE INTO raw_token_name_paths (session_id, raw_name, path, source) VALUES (?, ?, ?, ?)");
|
|
3080
3080
|
const deleteAutomaticByName = db.prepare("DELETE FROM raw_token_name_paths WHERE session_id = ? AND raw_name = ? AND source = 'automatic'");
|
|
3081
|
-
deletePaths.run(
|
|
3081
|
+
deletePaths.run(sessionId2, source);
|
|
3082
3082
|
for (const [rawName, path5] of entries) {
|
|
3083
3083
|
if (source === "manual")
|
|
3084
|
-
deleteAutomaticByName.run(
|
|
3085
|
-
insertPath.run(
|
|
3084
|
+
deleteAutomaticByName.run(sessionId2, rawName);
|
|
3085
|
+
insertPath.run(sessionId2, rawName, path5, source);
|
|
3086
3086
|
}
|
|
3087
3087
|
}
|
|
3088
|
-
function updateRawPropTokenPaths(db,
|
|
3088
|
+
function updateRawPropTokenPaths(db, sessionId2, componentId, propName, paths, source) {
|
|
3089
3089
|
db.prepare(`DELETE FROM raw_prop_token_paths
|
|
3090
|
-
WHERE session_id = ? AND component_id = ? AND prop_name = ?`).run(
|
|
3090
|
+
WHERE session_id = ? AND component_id = ? AND prop_name = ?`).run(sessionId2, componentId, propName);
|
|
3091
3091
|
const insertPath = db.prepare(`INSERT INTO raw_prop_token_paths (session_id, component_id, prop_name, source, position, path)
|
|
3092
3092
|
VALUES (?, ?, ?, ?, ?, ?)`);
|
|
3093
3093
|
paths.forEach((path5, position) => {
|
|
3094
|
-
insertPath.run(
|
|
3094
|
+
insertPath.run(sessionId2, componentId, propName, source, position, path5);
|
|
3095
3095
|
});
|
|
3096
3096
|
}
|
|
3097
3097
|
|
|
@@ -3109,18 +3109,18 @@ function withTransaction(db, fn) {
|
|
|
3109
3109
|
}
|
|
3110
3110
|
|
|
3111
3111
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/services/tokens/store-dtcg-tokens.js
|
|
3112
|
-
function storeDtcgTokens(db,
|
|
3112
|
+
function storeDtcgTokens(db, sessionId2, groups, tokens) {
|
|
3113
3113
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3114
3114
|
withTransaction(db, () => {
|
|
3115
|
-
deleteRawTokensForSession(db,
|
|
3116
|
-
createRawTokenGroups(db,
|
|
3117
|
-
createRawTokens(db,
|
|
3118
|
-
updateSessionTimestamp(db,
|
|
3115
|
+
deleteRawTokensForSession(db, sessionId2);
|
|
3116
|
+
createRawTokenGroups(db, sessionId2, groups);
|
|
3117
|
+
createRawTokens(db, sessionId2, tokens);
|
|
3118
|
+
updateSessionTimestamp(db, sessionId2, now);
|
|
3119
3119
|
});
|
|
3120
3120
|
}
|
|
3121
3121
|
|
|
3122
3122
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/services/tokens/apply-tool-calls.js
|
|
3123
|
-
function applyTokenToolCalls(db,
|
|
3123
|
+
function applyTokenToolCalls(db, sessionId2, calls, incomingWarnings) {
|
|
3124
3124
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3125
3125
|
const warnings = [...incomingWarnings];
|
|
3126
3126
|
let tokens = 0;
|
|
@@ -3128,31 +3128,31 @@ function applyTokenToolCalls(db, sessionId, calls, incomingWarnings) {
|
|
|
3128
3128
|
withTransaction(db, () => {
|
|
3129
3129
|
for (const call of calls) {
|
|
3130
3130
|
if (call.tool === "set_token") {
|
|
3131
|
-
upsertRawToken(db,
|
|
3131
|
+
upsertRawToken(db, sessionId2, call);
|
|
3132
3132
|
tokens++;
|
|
3133
3133
|
} else if (call.tool === "set_group") {
|
|
3134
|
-
upsertRawTokenGroup(db,
|
|
3134
|
+
upsertRawTokenGroup(db, sessionId2, call);
|
|
3135
3135
|
groups++;
|
|
3136
3136
|
}
|
|
3137
3137
|
}
|
|
3138
|
-
updateSessionTimestamp(db,
|
|
3138
|
+
updateSessionTimestamp(db, sessionId2, now);
|
|
3139
3139
|
});
|
|
3140
3140
|
return { tokens, groups, warnings };
|
|
3141
3141
|
}
|
|
3142
3142
|
|
|
3143
3143
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/services/tokens/replace-raw-token-name-paths.js
|
|
3144
|
-
function replaceRawTokenNamePaths(db,
|
|
3144
|
+
function replaceRawTokenNamePaths(db, sessionId2, tokenNamePaths, source = "automatic") {
|
|
3145
3145
|
withTransaction(db, () => {
|
|
3146
|
-
updateRawTokenNamePaths(db,
|
|
3147
|
-
updateSessionTimestamp(db,
|
|
3146
|
+
updateRawTokenNamePaths(db, sessionId2, tokenNamePaths, source);
|
|
3147
|
+
updateSessionTimestamp(db, sessionId2, (/* @__PURE__ */ new Date()).toISOString());
|
|
3148
3148
|
});
|
|
3149
3149
|
}
|
|
3150
3150
|
|
|
3151
3151
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/services/tokens/replace-raw-prop-token-paths.js
|
|
3152
|
-
function replaceRawPropTokenPaths(db,
|
|
3152
|
+
function replaceRawPropTokenPaths(db, sessionId2, componentId, propName, paths, source) {
|
|
3153
3153
|
withTransaction(db, () => {
|
|
3154
|
-
updateRawPropTokenPaths(db,
|
|
3155
|
-
updateSessionTimestamp(db,
|
|
3154
|
+
updateRawPropTokenPaths(db, sessionId2, componentId, propName, paths, source);
|
|
3155
|
+
updateSessionTimestamp(db, sessionId2, (/* @__PURE__ */ new Date()).toISOString());
|
|
3156
3156
|
});
|
|
3157
3157
|
}
|
|
3158
3158
|
|
|
@@ -3596,11 +3596,11 @@ function applyDbMigrations(db) {
|
|
|
3596
3596
|
`);
|
|
3597
3597
|
}
|
|
3598
3598
|
}
|
|
3599
|
-
function loadComponentReviewMetadata(db,
|
|
3600
|
-
const compRow = db.prepare(`SELECT component_id, source, source_path FROM raw_components WHERE session_id = ? AND name = ?`).get(
|
|
3599
|
+
function loadComponentReviewMetadata(db, sessionId2, componentName) {
|
|
3600
|
+
const compRow = db.prepare(`SELECT component_id, source, source_path FROM raw_components WHERE session_id = ? AND name = ?`).get(sessionId2, componentName);
|
|
3601
3601
|
if (!compRow)
|
|
3602
3602
|
return null;
|
|
3603
|
-
const propRows = db.prepare(`SELECT name, rationale, source_start_line, source_end_line FROM raw_props WHERE session_id = ? AND component_id = ?`).all(
|
|
3603
|
+
const propRows = db.prepare(`SELECT name, rationale, source_start_line, source_end_line FROM raw_props WHERE session_id = ? AND component_id = ?`).all(sessionId2, compRow.component_id);
|
|
3604
3604
|
const props = {};
|
|
3605
3605
|
for (const r of propRows) {
|
|
3606
3606
|
props[r.name] = {
|
|
@@ -3622,15 +3622,15 @@ function loadComponentReviewMetadata(db, sessionId, componentName) {
|
|
|
3622
3622
|
props
|
|
3623
3623
|
};
|
|
3624
3624
|
}
|
|
3625
|
-
function loadComponentRationale(db,
|
|
3625
|
+
function loadComponentRationale(db, sessionId2, componentName) {
|
|
3626
3626
|
const compRow = db.prepare(`SELECT component_id, name, description, component_description_rationale, props_rationale, slots_rationale
|
|
3627
|
-
FROM raw_components WHERE session_id = ? AND name = ?`).get(
|
|
3627
|
+
FROM raw_components WHERE session_id = ? AND name = ?`).get(sessionId2, componentName);
|
|
3628
3628
|
if (!compRow)
|
|
3629
3629
|
return null;
|
|
3630
3630
|
const propRows = db.prepare(`SELECT name, cdf_category, category, description, rationale FROM raw_props
|
|
3631
|
-
WHERE session_id = ? AND component_id = ? ORDER BY position`).all(
|
|
3631
|
+
WHERE session_id = ? AND component_id = ? ORDER BY position`).all(sessionId2, compRow.component_id);
|
|
3632
3632
|
const slotRows = db.prepare(`SELECT name, description, rationale FROM raw_slots
|
|
3633
|
-
WHERE session_id = ? AND component_id = ? ORDER BY position`).all(
|
|
3633
|
+
WHERE session_id = ? AND component_id = ? ORDER BY position`).all(sessionId2, compRow.component_id);
|
|
3634
3634
|
return {
|
|
3635
3635
|
name: compRow.name,
|
|
3636
3636
|
description: compRow.description,
|
|
@@ -3650,7 +3650,7 @@ function loadComponentRationale(db, sessionId, componentName) {
|
|
|
3650
3650
|
}))
|
|
3651
3651
|
};
|
|
3652
3652
|
}
|
|
3653
|
-
function applyToolCalls(db,
|
|
3653
|
+
function applyToolCalls(db, sessionId2, componentId, componentName, calls, incomingWarnings, options = {}) {
|
|
3654
3654
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3655
3655
|
const warnings = [...incomingWarnings];
|
|
3656
3656
|
let classified = 0;
|
|
@@ -3678,58 +3678,58 @@ function applyToolCalls(db, sessionId, componentId, componentName, calls, incomi
|
|
|
3678
3678
|
for (const call of calls) {
|
|
3679
3679
|
if (call.tool === "classify_component") {
|
|
3680
3680
|
if (call.description !== void 0) {
|
|
3681
|
-
db.prepare("UPDATE raw_components SET description = ? WHERE session_id = ? AND component_id = ?").run(call.description,
|
|
3681
|
+
db.prepare("UPDATE raw_components SET description = ? WHERE session_id = ? AND component_id = ?").run(call.description, sessionId2, componentId);
|
|
3682
3682
|
}
|
|
3683
3683
|
if (call.rationale) {
|
|
3684
3684
|
if (call.rationale.description !== void 0) {
|
|
3685
|
-
db.prepare("UPDATE raw_components SET component_description_rationale = ? WHERE session_id = ? AND component_id = ?").run(call.rationale.description,
|
|
3685
|
+
db.prepare("UPDATE raw_components SET component_description_rationale = ? WHERE session_id = ? AND component_id = ?").run(call.rationale.description, sessionId2, componentId);
|
|
3686
3686
|
}
|
|
3687
3687
|
if (call.rationale.props !== void 0) {
|
|
3688
|
-
db.prepare("UPDATE raw_components SET props_rationale = ? WHERE session_id = ? AND component_id = ?").run(call.rationale.props,
|
|
3688
|
+
db.prepare("UPDATE raw_components SET props_rationale = ? WHERE session_id = ? AND component_id = ?").run(call.rationale.props, sessionId2, componentId);
|
|
3689
3689
|
}
|
|
3690
3690
|
if (call.rationale.slots !== void 0) {
|
|
3691
|
-
db.prepare("UPDATE raw_components SET slots_rationale = ? WHERE session_id = ? AND component_id = ?").run(call.rationale.slots,
|
|
3691
|
+
db.prepare("UPDATE raw_components SET slots_rationale = ? WHERE session_id = ? AND component_id = ?").run(call.rationale.slots, sessionId2, componentId);
|
|
3692
3692
|
}
|
|
3693
3693
|
}
|
|
3694
3694
|
} else if (call.tool === "classify_prop") {
|
|
3695
|
-
const changes = updateProp.run(call.cdf_type, call.cdf_category, call.token_kind ?? null, call.required !== void 0 ? call.required ? 1 : 0 : 0, call.description ?? null, call.reason ?? null,
|
|
3695
|
+
const changes = updateProp.run(call.cdf_type, call.cdf_category, call.token_kind ?? null, call.required !== void 0 ? call.required ? 1 : 0 : 0, call.description ?? null, call.reason ?? null, sessionId2, componentId, call.prop);
|
|
3696
3696
|
if (changes.changes === 0) {
|
|
3697
3697
|
warnings.push(`${componentName}: classify_prop '${call.prop}' \u2014 prop not found, skipped`);
|
|
3698
3698
|
continue;
|
|
3699
3699
|
}
|
|
3700
3700
|
if (call.cdf_type === "token") {
|
|
3701
|
-
deleteAllowedValues.run(
|
|
3701
|
+
deleteAllowedValues.run(sessionId2, componentId, call.prop);
|
|
3702
3702
|
if (call.values && call.values.length > 0) {
|
|
3703
3703
|
const count = call.values.length;
|
|
3704
3704
|
warnings.push(`${componentName}: classify_prop '${call.prop}' \u2014 dropped ${count} value${count === 1 ? "" : "s"} on a token property; its options list is $token.allowed, not $values`);
|
|
3705
3705
|
}
|
|
3706
3706
|
} else {
|
|
3707
|
-
deleteTokenPaths.run(
|
|
3707
|
+
deleteTokenPaths.run(sessionId2, componentId, call.prop);
|
|
3708
3708
|
if (call.values && call.values.length > 0) {
|
|
3709
|
-
deleteAllowedValues.run(
|
|
3710
|
-
call.values.forEach((v, i) => insertAllowedValue.run(
|
|
3709
|
+
deleteAllowedValues.run(sessionId2, componentId, call.prop);
|
|
3710
|
+
call.values.forEach((v, i) => insertAllowedValue.run(sessionId2, componentId, call.prop, v, i));
|
|
3711
3711
|
}
|
|
3712
3712
|
}
|
|
3713
3713
|
if (call.default !== void 0) {
|
|
3714
3714
|
const storedDefault = typeof call.default === "boolean" ? String(call.default) : call.default;
|
|
3715
|
-
db.prepare(`UPDATE raw_props SET default_value = ? WHERE session_id = ? AND component_id = ? AND name = ?`).run(storedDefault,
|
|
3715
|
+
db.prepare(`UPDATE raw_props SET default_value = ? WHERE session_id = ? AND component_id = ? AND name = ?`).run(storedDefault, sessionId2, componentId, call.prop);
|
|
3716
3716
|
}
|
|
3717
3717
|
classified++;
|
|
3718
3718
|
} else if (call.tool === "exclude_prop") {
|
|
3719
|
-
clearProp.run(call.reason || null,
|
|
3719
|
+
clearProp.run(call.reason || null, sessionId2, componentId, call.prop);
|
|
3720
3720
|
excluded++;
|
|
3721
3721
|
} else if (call.tool === "classify_slot") {
|
|
3722
3722
|
const slotRequired = call.required !== void 0 ? call.required ? 1 : 0 : 1;
|
|
3723
|
-
const slotChanges = updateSlot.run(slotRequired, call.description ?? null,
|
|
3723
|
+
const slotChanges = updateSlot.run(slotRequired, call.description ?? null, sessionId2, componentId, call.slot);
|
|
3724
3724
|
if (slotChanges.changes === 0) {
|
|
3725
3725
|
warnings.push(`${componentName}: classify_slot '${call.slot}' \u2014 slot not found, skipped`);
|
|
3726
3726
|
continue;
|
|
3727
3727
|
}
|
|
3728
3728
|
if (call.rationale !== void 0) {
|
|
3729
|
-
db.prepare("UPDATE raw_slots SET rationale = ? WHERE session_id = ? AND component_id = ? AND name = ?").run(call.rationale,
|
|
3729
|
+
db.prepare("UPDATE raw_slots SET rationale = ? WHERE session_id = ? AND component_id = ? AND name = ?").run(call.rationale, sessionId2, componentId, call.slot);
|
|
3730
3730
|
}
|
|
3731
3731
|
if (call.allowed_components !== void 0) {
|
|
3732
|
-
deleteAllowedComponents.run(
|
|
3732
|
+
deleteAllowedComponents.run(sessionId2, componentId, call.slot);
|
|
3733
3733
|
const allowedComponents = options.allowedComponentNames ? call.allowed_components.filter((allowedComponent) => options.allowedComponentNames.has(allowedComponent)) : call.allowed_components;
|
|
3734
3734
|
if (options.allowedComponentNames) {
|
|
3735
3735
|
const dropped = [
|
|
@@ -3739,13 +3739,13 @@ function applyToolCalls(db, sessionId, componentId, componentName, calls, incomi
|
|
|
3739
3739
|
warnings.push(`${componentName}: classify_slot '${call.slot}' \u2014 dropped unknown allowed component '${allowedComponent}'`);
|
|
3740
3740
|
}
|
|
3741
3741
|
}
|
|
3742
|
-
allowedComponents.forEach((ac, i) => insertAllowedComponent.run(
|
|
3742
|
+
allowedComponents.forEach((ac, i) => insertAllowedComponent.run(sessionId2, componentId, call.slot, ac, i));
|
|
3743
3743
|
}
|
|
3744
3744
|
slots++;
|
|
3745
3745
|
}
|
|
3746
3746
|
}
|
|
3747
|
-
db.prepare(`UPDATE raw_components SET status = 'generated', extracted_at = ? WHERE session_id = ? AND component_id = ?`).run(now,
|
|
3748
|
-
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(now,
|
|
3747
|
+
db.prepare(`UPDATE raw_components SET status = 'generated', extracted_at = ? WHERE session_id = ? AND component_id = ?`).run(now, sessionId2, componentId);
|
|
3748
|
+
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(now, sessionId2);
|
|
3749
3749
|
db.exec("COMMIT");
|
|
3750
3750
|
} catch (e) {
|
|
3751
3751
|
db.exec("ROLLBACK");
|
|
@@ -3756,13 +3756,13 @@ function applyToolCalls(db, sessionId, componentId, componentName, calls, incomi
|
|
|
3756
3756
|
function getOrCreateSession(db, sessionFlag, sessionName, hints) {
|
|
3757
3757
|
return getOrCreateSessionForCommand(db, sessionFlag, sessionName, hints);
|
|
3758
3758
|
}
|
|
3759
|
-
function createStep(db,
|
|
3759
|
+
function createStep(db, sessionId2, command, inputs) {
|
|
3760
3760
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3761
3761
|
db.exec("BEGIN");
|
|
3762
3762
|
try {
|
|
3763
|
-
updatePendingStepsToInterrupted(db,
|
|
3764
|
-
const stepId = createPendingStep(db,
|
|
3765
|
-
updateSessionTimestamp(db,
|
|
3763
|
+
updatePendingStepsToInterrupted(db, sessionId2, command, now);
|
|
3764
|
+
const stepId = createPendingStep(db, sessionId2, command, inputs, now);
|
|
3765
|
+
updateSessionTimestamp(db, sessionId2, now);
|
|
3766
3766
|
db.exec("COMMIT");
|
|
3767
3767
|
return stepId;
|
|
3768
3768
|
} catch (e) {
|
|
@@ -3785,7 +3785,7 @@ function updateStep(db, stepId, status, outputs, error) {
|
|
|
3785
3785
|
throw e;
|
|
3786
3786
|
}
|
|
3787
3787
|
}
|
|
3788
|
-
function storeRawComponents(db,
|
|
3788
|
+
function storeRawComponents(db, sessionId2, components, options) {
|
|
3789
3789
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3790
3790
|
const insertComp = db.prepare(`INSERT INTO raw_components (session_id, component_id, name, source, framework, extracted_at, extraction_confidence, review_reasons, needs_review, source_path)
|
|
3791
3791
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
@@ -3806,34 +3806,34 @@ function storeRawComponents(db, sessionId, components, options) {
|
|
|
3806
3806
|
let statusSnapshot = [];
|
|
3807
3807
|
if (options?.preserveCDF) {
|
|
3808
3808
|
cdfSnapshot = db.prepare(`SELECT component_id, name, position, cdf_type, cdf_category, cdf_token_kind
|
|
3809
|
-
FROM raw_props WHERE session_id = ? AND cdf_type IS NOT NULL`).all(
|
|
3809
|
+
FROM raw_props WHERE session_id = ? AND cdf_type IS NOT NULL`).all(sessionId2);
|
|
3810
3810
|
descSnapshot = db.prepare(`SELECT component_id, description
|
|
3811
|
-
FROM raw_components WHERE session_id = ? AND description IS NOT NULL`).all(
|
|
3811
|
+
FROM raw_components WHERE session_id = ? AND description IS NOT NULL`).all(sessionId2);
|
|
3812
3812
|
if (cdfSnapshot.length > 0) {
|
|
3813
3813
|
avSnapshot = db.prepare(`SELECT component_id, prop_name, position, value
|
|
3814
|
-
FROM raw_prop_allowed_values WHERE session_id = ?`).all(
|
|
3814
|
+
FROM raw_prop_allowed_values WHERE session_id = ?`).all(sessionId2);
|
|
3815
3815
|
}
|
|
3816
3816
|
}
|
|
3817
3817
|
if (options?.preserveStatus) {
|
|
3818
3818
|
statusSnapshot = db.prepare(`SELECT component_id, status, reject_reason
|
|
3819
|
-
FROM raw_components WHERE session_id = ?`).all(
|
|
3819
|
+
FROM raw_components WHERE session_id = ?`).all(sessionId2);
|
|
3820
3820
|
}
|
|
3821
|
-
db.prepare("DELETE FROM raw_components WHERE session_id = ?").run(
|
|
3821
|
+
db.prepare("DELETE FROM raw_components WHERE session_id = ?").run(sessionId2);
|
|
3822
3822
|
for (const comp of components) {
|
|
3823
3823
|
const componentId = deriveComponentId(comp.name, comp.source);
|
|
3824
|
-
insertComp.run(
|
|
3824
|
+
insertComp.run(sessionId2, componentId, comp.name, comp.source, comp.framework, now, comp.extractionConfidence ?? null, JSON.stringify(comp.reviewReasons ?? []), comp.needsReview ? 1 : 0, comp.sourcePath ?? null);
|
|
3825
3825
|
for (let i = 0; i < comp.props.length; i++) {
|
|
3826
3826
|
const prop = comp.props[i];
|
|
3827
|
-
insertProp.run(
|
|
3827
|
+
insertProp.run(sessionId2, componentId, prop.name, prop.type, prop.required ? 1 : 0, prop.category ?? null, prop.defaultValue ?? null, prop.description ?? null, prop.tokenReference ?? null, i, prop.sourceStartLine ?? null, prop.sourceEndLine ?? null);
|
|
3828
3828
|
if (prop.allowedValues) {
|
|
3829
|
-
prop.allowedValues.forEach((v, j) => insertAllowedValue.run(
|
|
3829
|
+
prop.allowedValues.forEach((v, j) => insertAllowedValue.run(sessionId2, componentId, prop.name, j, v));
|
|
3830
3830
|
}
|
|
3831
3831
|
}
|
|
3832
3832
|
for (let i = 0; i < comp.slots.length; i++) {
|
|
3833
3833
|
const slot = comp.slots[i];
|
|
3834
|
-
insertSlot.run(
|
|
3834
|
+
insertSlot.run(sessionId2, componentId, slot.name, slot.isDefault ? 1 : 0, slot.description ?? null, i);
|
|
3835
3835
|
if (slot.allowedComponents) {
|
|
3836
|
-
slot.allowedComponents.forEach((ac, j) => insertAllowedComponent.run(
|
|
3836
|
+
slot.allowedComponents.forEach((ac, j) => insertAllowedComponent.run(sessionId2, componentId, slot.name, j, ac));
|
|
3837
3837
|
}
|
|
3838
3838
|
}
|
|
3839
3839
|
}
|
|
@@ -3845,7 +3845,7 @@ function storeRawComponents(db, sessionId, components, options) {
|
|
|
3845
3845
|
const restoredPropKeys = /* @__PURE__ */ new Set();
|
|
3846
3846
|
const unmatchedSnaps = [];
|
|
3847
3847
|
for (const snap of cdfSnapshot) {
|
|
3848
|
-
const result = updateCDFByName.run(snap.cdf_type, snap.cdf_category, snap.cdf_token_kind,
|
|
3848
|
+
const result = updateCDFByName.run(snap.cdf_type, snap.cdf_category, snap.cdf_token_kind, sessionId2, snap.component_id, snap.name);
|
|
3849
3849
|
if (Number(result.changes) > 0) {
|
|
3850
3850
|
restoredPropKeys.add(`${snap.component_id}::${snap.name}`);
|
|
3851
3851
|
} else {
|
|
@@ -3853,9 +3853,9 @@ function storeRawComponents(db, sessionId, components, options) {
|
|
|
3853
3853
|
}
|
|
3854
3854
|
}
|
|
3855
3855
|
for (const snap of unmatchedSnaps) {
|
|
3856
|
-
const result = updateCDFByPosition.run(snap.cdf_type, snap.cdf_category, snap.cdf_token_kind,
|
|
3856
|
+
const result = updateCDFByPosition.run(snap.cdf_type, snap.cdf_category, snap.cdf_token_kind, sessionId2, snap.component_id, snap.position);
|
|
3857
3857
|
if (Number(result.changes) > 0) {
|
|
3858
|
-
const matched = db.prepare(`SELECT name FROM raw_props WHERE session_id = ? AND component_id = ? AND position = ?`).get(
|
|
3858
|
+
const matched = db.prepare(`SELECT name FROM raw_props WHERE session_id = ? AND component_id = ? AND position = ?`).get(sessionId2, snap.component_id, snap.position);
|
|
3859
3859
|
if (matched) {
|
|
3860
3860
|
restoredPropKeys.add(`${snap.component_id}::${matched.name}`);
|
|
3861
3861
|
}
|
|
@@ -3863,7 +3863,7 @@ function storeRawComponents(db, sessionId, components, options) {
|
|
|
3863
3863
|
}
|
|
3864
3864
|
const updateDesc = db.prepare(`UPDATE raw_components SET description = ? WHERE session_id = ? AND component_id = ?`);
|
|
3865
3865
|
for (const snap of descSnapshot) {
|
|
3866
|
-
updateDesc.run(snap.description,
|
|
3866
|
+
updateDesc.run(snap.description, sessionId2, snap.component_id);
|
|
3867
3867
|
}
|
|
3868
3868
|
const relevantAV = avSnapshot.filter((av) => restoredPropKeys.has(`${av.component_id}::${av.prop_name}`));
|
|
3869
3869
|
if (relevantAV.length > 0) {
|
|
@@ -3874,10 +3874,10 @@ function storeRawComponents(db, sessionId, components, options) {
|
|
|
3874
3874
|
for (const av of relevantAV) {
|
|
3875
3875
|
const key = `${av.component_id}::${av.prop_name}`;
|
|
3876
3876
|
if (!deletedKeys.has(key)) {
|
|
3877
|
-
deleteAV.run(
|
|
3877
|
+
deleteAV.run(sessionId2, av.component_id, av.prop_name);
|
|
3878
3878
|
deletedKeys.add(key);
|
|
3879
3879
|
}
|
|
3880
|
-
insertAV.run(
|
|
3880
|
+
insertAV.run(sessionId2, av.component_id, av.prop_name, av.position, av.value);
|
|
3881
3881
|
}
|
|
3882
3882
|
}
|
|
3883
3883
|
}
|
|
@@ -3885,33 +3885,33 @@ function storeRawComponents(db, sessionId, components, options) {
|
|
|
3885
3885
|
const restoreStatus = db.prepare(`UPDATE raw_components SET status = ?, reject_reason = ?
|
|
3886
3886
|
WHERE session_id = ? AND component_id = ?`);
|
|
3887
3887
|
for (const snapshot of statusSnapshot) {
|
|
3888
|
-
restoreStatus.run(snapshot.status, snapshot.reject_reason,
|
|
3888
|
+
restoreStatus.run(snapshot.status, snapshot.reject_reason, sessionId2, snapshot.component_id);
|
|
3889
3889
|
}
|
|
3890
3890
|
}
|
|
3891
3891
|
if (options?.status) {
|
|
3892
|
-
db.prepare("UPDATE raw_components SET status = ? WHERE session_id = ?").run(options.status,
|
|
3892
|
+
db.prepare("UPDATE raw_components SET status = ? WHERE session_id = ?").run(options.status, sessionId2);
|
|
3893
3893
|
}
|
|
3894
|
-
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(now,
|
|
3894
|
+
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(now, sessionId2);
|
|
3895
3895
|
db.exec("COMMIT");
|
|
3896
3896
|
} catch (e) {
|
|
3897
3897
|
db.exec("ROLLBACK");
|
|
3898
3898
|
throw e;
|
|
3899
3899
|
}
|
|
3900
3900
|
}
|
|
3901
|
-
function loadRawComponents(db,
|
|
3902
|
-
const all = db.prepare("SELECT component_id, name, source, framework, extraction_confidence, review_reasons, needs_review, source_path FROM raw_components WHERE session_id = ? ORDER BY rowid").all(
|
|
3901
|
+
function loadRawComponents(db, sessionId2, allowedNames) {
|
|
3902
|
+
const all = db.prepare("SELECT component_id, name, source, framework, extraction_confidence, review_reasons, needs_review, source_path FROM raw_components WHERE session_id = ? ORDER BY rowid").all(sessionId2);
|
|
3903
3903
|
const components = allowedNames ? all.filter((c2) => allowedNames.has(c2.name)) : all;
|
|
3904
3904
|
if (components.length === 0)
|
|
3905
3905
|
return [];
|
|
3906
3906
|
const props = db.prepare(`SELECT component_id, name, type, required, category, default_value, description, token_reference, position,
|
|
3907
3907
|
rationale, source_start_line, source_end_line
|
|
3908
|
-
FROM raw_props WHERE session_id = ? ORDER BY component_id, position`).all(
|
|
3908
|
+
FROM raw_props WHERE session_id = ? ORDER BY component_id, position`).all(sessionId2);
|
|
3909
3909
|
const allowedValues = db.prepare(`SELECT component_id, prop_name, position, value
|
|
3910
|
-
FROM raw_prop_allowed_values WHERE session_id = ? ORDER BY component_id, prop_name, position`).all(
|
|
3910
|
+
FROM raw_prop_allowed_values WHERE session_id = ? ORDER BY component_id, prop_name, position`).all(sessionId2);
|
|
3911
3911
|
const slots = db.prepare(`SELECT component_id, name, is_default, description, position
|
|
3912
|
-
FROM raw_slots WHERE session_id = ? ORDER BY component_id, position`).all(
|
|
3912
|
+
FROM raw_slots WHERE session_id = ? ORDER BY component_id, position`).all(sessionId2);
|
|
3913
3913
|
const allowedComponents = db.prepare(`SELECT component_id, slot_name, position, allowed_component
|
|
3914
|
-
FROM raw_slot_allowed_components WHERE session_id = ? ORDER BY component_id, slot_name, position`).all(
|
|
3914
|
+
FROM raw_slot_allowed_components WHERE session_id = ? ORDER BY component_id, slot_name, position`).all(sessionId2);
|
|
3915
3915
|
const propsByComponent = indexRowsByKey(props, (p) => p.component_id);
|
|
3916
3916
|
const allowedValuesByProp = indexRowsByKey(allowedValues, (av) => `${av.component_id}::${av.prop_name}`);
|
|
3917
3917
|
const slotsByComponent = indexRowsByKey(slots, (s) => s.component_id);
|
|
@@ -4116,18 +4116,18 @@ async function loadComponentSourceRef(name, sourcePath, propNames = [], propType
|
|
|
4116
4116
|
ref.usesNotShown = notShown;
|
|
4117
4117
|
return ref;
|
|
4118
4118
|
}
|
|
4119
|
-
async function loadComponentSourceRefs(db,
|
|
4120
|
-
const rows = db.prepare(`SELECT component_id, name, source, source_path FROM raw_components WHERE session_id = ? AND status = 'generated' ORDER BY rowid`).all(
|
|
4119
|
+
async function loadComponentSourceRefs(db, sessionId2) {
|
|
4120
|
+
const rows = db.prepare(`SELECT component_id, name, source, source_path FROM raw_components WHERE session_id = ? AND status = 'generated' ORDER BY rowid`).all(sessionId2);
|
|
4121
4121
|
const propsFor = db.prepare(`SELECT name, type FROM raw_props WHERE session_id = ? AND component_id = ? ORDER BY position`);
|
|
4122
4122
|
return Promise.all(rows.map((r) => {
|
|
4123
|
-
const props = propsFor.all(
|
|
4123
|
+
const props = propsFor.all(sessionId2, r.component_id);
|
|
4124
4124
|
return loadComponentSourceRef(r.name, r.source_path ?? r.source, props.map((p) => p.name), props.map((p) => p.type));
|
|
4125
4125
|
}));
|
|
4126
4126
|
}
|
|
4127
|
-
function renameEmptySlots(db,
|
|
4127
|
+
function renameEmptySlots(db, sessionId2, componentId, componentName, slotCount) {
|
|
4128
4128
|
const emptySlots = db.prepare(`SELECT name, position FROM raw_slots
|
|
4129
4129
|
WHERE session_id = ? AND component_id = ? AND trim(name) = ''
|
|
4130
|
-
ORDER BY position`).all(
|
|
4130
|
+
ORDER BY position`).all(sessionId2, componentId);
|
|
4131
4131
|
if (emptySlots.length === 0)
|
|
4132
4132
|
return { renames: [], warnings: [] };
|
|
4133
4133
|
const renames = [];
|
|
@@ -4137,7 +4137,7 @@ function renameEmptySlots(db, sessionId, componentId, componentName, slotCount)
|
|
|
4137
4137
|
try {
|
|
4138
4138
|
for (const slot of emptySlots) {
|
|
4139
4139
|
const newName = slotCount === 1 ? "children" : `slot_${slot.position}`;
|
|
4140
|
-
rename3.run(newName,
|
|
4140
|
+
rename3.run(newName, sessionId2, componentId, slot.name, slot.position);
|
|
4141
4141
|
renames.push({ oldName: slot.name, newName });
|
|
4142
4142
|
warnings.push(`${componentName}: slot at position ${slot.position} had empty name \u2014 renamed to "${newName}" for classification`);
|
|
4143
4143
|
}
|
|
@@ -4156,7 +4156,7 @@ function parseReviewReasons(raw) {
|
|
|
4156
4156
|
return [];
|
|
4157
4157
|
}
|
|
4158
4158
|
}
|
|
4159
|
-
function storeCDFComponents(db,
|
|
4159
|
+
function storeCDFComponents(db, sessionId2, components) {
|
|
4160
4160
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4161
4161
|
const updateComp = db.prepare(`UPDATE raw_components SET status = 'generated', description = ? WHERE session_id = ? AND name = ?`);
|
|
4162
4162
|
const updateProp = db.prepare(`UPDATE raw_props SET cdf_type = ?, cdf_category = ?, cdf_token_kind = ?, required = ? WHERE session_id = ? AND component_id = ? AND name = ?`);
|
|
@@ -4169,8 +4169,8 @@ function storeCDFComponents(db, sessionId, components) {
|
|
|
4169
4169
|
const insertTokenPath = db.prepare(`INSERT INTO raw_prop_token_paths (session_id, component_id, prop_name, source, position, path)
|
|
4170
4170
|
VALUES (?, ?, ?, ?, ?, ?)`);
|
|
4171
4171
|
const writeTokenPaths = (componentId, propName, paths) => {
|
|
4172
|
-
deleteTokenPaths.run(
|
|
4173
|
-
paths.forEach((path5, position) => insertTokenPath.run(
|
|
4172
|
+
deleteTokenPaths.run(sessionId2, componentId, propName);
|
|
4173
|
+
paths.forEach((path5, position) => insertTokenPath.run(sessionId2, componentId, propName, "review", position, path5));
|
|
4174
4174
|
};
|
|
4175
4175
|
const deleteSlots = db.prepare(`DELETE FROM raw_slots WHERE session_id = ? AND component_id = ?`);
|
|
4176
4176
|
const deleteSlotAllowedComponents = db.prepare(`DELETE FROM raw_slot_allowed_components WHERE session_id = ? AND component_id = ?`);
|
|
@@ -4180,42 +4180,42 @@ function storeCDFComponents(db, sessionId, components) {
|
|
|
4180
4180
|
db.exec("BEGIN");
|
|
4181
4181
|
try {
|
|
4182
4182
|
for (const { key, entry } of components) {
|
|
4183
|
-
const row = db.prepare("SELECT component_id FROM raw_components WHERE session_id = ? AND name = ?").get(
|
|
4183
|
+
const row = db.prepare("SELECT component_id FROM raw_components WHERE session_id = ? AND name = ?").get(sessionId2, key);
|
|
4184
4184
|
if (row) {
|
|
4185
4185
|
const { component_id: componentId } = row;
|
|
4186
|
-
updateComp.run(entry.$description ?? null,
|
|
4186
|
+
updateComp.run(entry.$description ?? null, sessionId2, key);
|
|
4187
4187
|
for (const [propName, prop] of Object.entries(entry.$properties)) {
|
|
4188
|
-
updateProp.run(prop.$type, prop.$category, prop["$token.kind"] ?? null, prop.$required ? 1 : 0,
|
|
4188
|
+
updateProp.run(prop.$type, prop.$category, prop["$token.kind"] ?? null, prop.$required ? 1 : 0, sessionId2, componentId, propName);
|
|
4189
4189
|
if (prop.$values && prop.$values.length > 0) {
|
|
4190
|
-
deleteAllowedValues.run(
|
|
4191
|
-
prop.$values.forEach((v, i) => insertAllowedValue.run(
|
|
4190
|
+
deleteAllowedValues.run(sessionId2, componentId, propName);
|
|
4191
|
+
prop.$values.forEach((v, i) => insertAllowedValue.run(sessionId2, componentId, propName, v, i));
|
|
4192
4192
|
}
|
|
4193
4193
|
if (prop.$type === "token" && prop.$category === "design") {
|
|
4194
4194
|
writeTokenPaths(componentId, propName, prop["$token.allowed"] ?? []);
|
|
4195
4195
|
}
|
|
4196
4196
|
}
|
|
4197
|
-
const existingDefaults = new Map(readExistingSlotDefaults.all(
|
|
4198
|
-
deleteSlotAllowedComponents.run(
|
|
4199
|
-
deleteSlots.run(
|
|
4197
|
+
const existingDefaults = new Map(readExistingSlotDefaults.all(sessionId2, componentId).map((r) => [r.name, r.is_default]));
|
|
4198
|
+
deleteSlotAllowedComponents.run(sessionId2, componentId);
|
|
4199
|
+
deleteSlots.run(sessionId2, componentId);
|
|
4200
4200
|
let slotPos = 0;
|
|
4201
4201
|
for (const [slotName, slot] of Object.entries(entry.$slots ?? {})) {
|
|
4202
4202
|
const isDefault = existingDefaults.get(slotName) ?? 0;
|
|
4203
|
-
insertSlotOnUpdate.run(
|
|
4203
|
+
insertSlotOnUpdate.run(sessionId2, componentId, slotName, isDefault, slot.$required ? 1 : 0, slot.$description ?? null, slotPos++);
|
|
4204
4204
|
if (slot.$allowedComponents && slot.$allowedComponents.length > 0) {
|
|
4205
|
-
slot.$allowedComponents.forEach((ac, i) => insertAllowedComponent.run(
|
|
4205
|
+
slot.$allowedComponents.forEach((ac, i) => insertAllowedComponent.run(sessionId2, componentId, slotName, ac, i));
|
|
4206
4206
|
}
|
|
4207
4207
|
}
|
|
4208
4208
|
} else {
|
|
4209
4209
|
const componentId = deriveComponentId(key, "generated");
|
|
4210
4210
|
db.prepare(`INSERT INTO raw_components (session_id, component_id, name, source, framework, extracted_at, status, description)
|
|
4211
|
-
VALUES (?, ?, ?, '', 'react', ?, 'generated', ?)`).run(
|
|
4211
|
+
VALUES (?, ?, ?, '', 'react', ?, 'generated', ?)`).run(sessionId2, componentId, key, now, entry.$description ?? null);
|
|
4212
4212
|
let position = 0;
|
|
4213
4213
|
for (const [propName, prop] of Object.entries(entry.$properties)) {
|
|
4214
4214
|
db.prepare(`INSERT OR REPLACE INTO raw_props
|
|
4215
4215
|
(session_id, component_id, name, type, required, category, default_value, description, token_reference, position, cdf_type, cdf_category, cdf_token_kind)
|
|
4216
|
-
VALUES (?, ?, ?, '', ?, NULL, NULL, NULL, NULL, ?, ?, ?, ?)`).run(
|
|
4216
|
+
VALUES (?, ?, ?, '', ?, NULL, NULL, NULL, NULL, ?, ?, ?, ?)`).run(sessionId2, componentId, propName, prop.$required ? 1 : 0, position++, prop.$type, prop.$category, prop["$token.kind"] ?? null);
|
|
4217
4217
|
if (prop.$values && prop.$values.length > 0) {
|
|
4218
|
-
prop.$values.forEach((v, i) => insertAllowedValue.run(
|
|
4218
|
+
prop.$values.forEach((v, i) => insertAllowedValue.run(sessionId2, componentId, propName, v, i));
|
|
4219
4219
|
}
|
|
4220
4220
|
if (prop.$type === "token" && prop.$category === "design") {
|
|
4221
4221
|
writeTokenPaths(componentId, propName, prop["$token.allowed"] ?? []);
|
|
@@ -4225,39 +4225,39 @@ function storeCDFComponents(db, sessionId, components) {
|
|
|
4225
4225
|
for (const [slotName, slot] of Object.entries(entry.$slots ?? {})) {
|
|
4226
4226
|
db.prepare(`INSERT OR REPLACE INTO raw_slots
|
|
4227
4227
|
(session_id, component_id, name, is_default, required, description, position)
|
|
4228
|
-
VALUES (?, ?, ?, 0, ?, ?, ?)`).run(
|
|
4228
|
+
VALUES (?, ?, ?, 0, ?, ?, ?)`).run(sessionId2, componentId, slotName, slot.$required ? 1 : 0, slot.$description ?? null, slotPos++);
|
|
4229
4229
|
if (slot.$allowedComponents && slot.$allowedComponents.length > 0) {
|
|
4230
|
-
slot.$allowedComponents.forEach((ac, i) => insertAllowedComponent.run(
|
|
4230
|
+
slot.$allowedComponents.forEach((ac, i) => insertAllowedComponent.run(sessionId2, componentId, slotName, ac, i));
|
|
4231
4231
|
}
|
|
4232
4232
|
}
|
|
4233
4233
|
}
|
|
4234
4234
|
}
|
|
4235
|
-
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(now,
|
|
4235
|
+
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(now, sessionId2);
|
|
4236
4236
|
db.exec("COMMIT");
|
|
4237
4237
|
} catch (e) {
|
|
4238
4238
|
db.exec("ROLLBACK");
|
|
4239
4239
|
throw e;
|
|
4240
4240
|
}
|
|
4241
4241
|
}
|
|
4242
|
-
function loadCDFComponents(db,
|
|
4242
|
+
function loadCDFComponents(db, sessionId2) {
|
|
4243
4243
|
const components = db.prepare(`SELECT component_id, name, description FROM raw_components
|
|
4244
|
-
WHERE session_id = ? AND status = 'generated' ORDER BY rowid`).all(
|
|
4244
|
+
WHERE session_id = ? AND status = 'generated' ORDER BY rowid`).all(sessionId2);
|
|
4245
4245
|
if (components.length === 0)
|
|
4246
4246
|
return [];
|
|
4247
4247
|
const props = db.prepare(`SELECT component_id, name, required, default_value, description,
|
|
4248
4248
|
cdf_type, cdf_category, cdf_token_kind, position
|
|
4249
4249
|
FROM raw_props
|
|
4250
4250
|
WHERE session_id = ? AND cdf_type IS NOT NULL
|
|
4251
|
-
ORDER BY component_id, position`).all(
|
|
4251
|
+
ORDER BY component_id, position`).all(sessionId2);
|
|
4252
4252
|
const allowedValues = db.prepare(`SELECT component_id, prop_name, value, position
|
|
4253
|
-
FROM raw_prop_allowed_values WHERE session_id = ? ORDER BY component_id, prop_name, position`).all(
|
|
4254
|
-
const slots = db.prepare(`SELECT component_id, name, description, required FROM raw_slots WHERE session_id = ? ORDER BY component_id, position`).all(
|
|
4253
|
+
FROM raw_prop_allowed_values WHERE session_id = ? ORDER BY component_id, prop_name, position`).all(sessionId2);
|
|
4254
|
+
const slots = db.prepare(`SELECT component_id, name, description, required FROM raw_slots WHERE session_id = ? ORDER BY component_id, position`).all(sessionId2);
|
|
4255
4255
|
const allowedComponents = db.prepare(`SELECT component_id, slot_name, allowed_component
|
|
4256
|
-
FROM raw_slot_allowed_components WHERE session_id = ? ORDER BY component_id, slot_name, position`).all(
|
|
4256
|
+
FROM raw_slot_allowed_components WHERE session_id = ? ORDER BY component_id, slot_name, position`).all(sessionId2);
|
|
4257
4257
|
const tokenPaths = db.prepare(`SELECT component_id, prop_name, position, path
|
|
4258
|
-
FROM raw_prop_token_paths WHERE session_id = ? ORDER BY component_id, prop_name, position`).all(
|
|
4259
|
-
const resolvedDefaultPaths = getRawTokenNamePaths(db,
|
|
4260
|
-
const tokenTypeByPath = new Map(db.prepare("SELECT path, type FROM raw_tokens WHERE session_id = ?").all(
|
|
4258
|
+
FROM raw_prop_token_paths WHERE session_id = ? ORDER BY component_id, prop_name, position`).all(sessionId2);
|
|
4259
|
+
const resolvedDefaultPaths = getRawTokenNamePaths(db, sessionId2);
|
|
4260
|
+
const tokenTypeByPath = new Map(db.prepare("SELECT path, type FROM raw_tokens WHERE session_id = ?").all(sessionId2).map((token) => [token.path, token.type]));
|
|
4261
4261
|
const propsByComponent = indexRowsByKey(props, (p) => p.component_id);
|
|
4262
4262
|
const allowedValuesByProp = indexRowsByKey(allowedValues, (av) => `${av.component_id}::${av.prop_name}`);
|
|
4263
4263
|
const slotsByComponent = indexRowsByKey(slots, (s) => s.component_id);
|
|
@@ -4324,16 +4324,16 @@ function loadCDFComponents(db, sessionId) {
|
|
|
4324
4324
|
return { key: name, entry };
|
|
4325
4325
|
});
|
|
4326
4326
|
}
|
|
4327
|
-
function loadScopeComponents(db,
|
|
4327
|
+
function loadScopeComponents(db, sessionId2) {
|
|
4328
4328
|
const rows = db.prepare(`SELECT name, component_id, status, reject_reason, review_reasons, needs_review FROM raw_components
|
|
4329
4329
|
WHERE session_id = ? AND status IN ('extracted', 'accepted', 'rejected')
|
|
4330
|
-
ORDER BY name`).all(
|
|
4330
|
+
ORDER BY name`).all(sessionId2);
|
|
4331
4331
|
if (rows.length === 0)
|
|
4332
4332
|
return [];
|
|
4333
4333
|
const slotRows = db.prepare(`SELECT component_id, name, position
|
|
4334
|
-
FROM raw_slots WHERE session_id = ? ORDER BY component_id, position`).all(
|
|
4334
|
+
FROM raw_slots WHERE session_id = ? ORDER BY component_id, position`).all(sessionId2);
|
|
4335
4335
|
const allowedRows = db.prepare(`SELECT component_id, slot_name, position, allowed_component
|
|
4336
|
-
FROM raw_slot_allowed_components WHERE session_id = ? ORDER BY component_id, slot_name, position`).all(
|
|
4336
|
+
FROM raw_slot_allowed_components WHERE session_id = ? ORDER BY component_id, slot_name, position`).all(sessionId2);
|
|
4337
4337
|
const slotsByComponent = indexRowsByKey(slotRows, (s) => s.component_id);
|
|
4338
4338
|
const allowedBySlot = indexRowsByKey(allowedRows, (a) => `${a.component_id}::${a.slot_name}`);
|
|
4339
4339
|
return rows.map((r) => {
|
|
@@ -4352,25 +4352,25 @@ function loadScopeComponents(db, sessionId) {
|
|
|
4352
4352
|
};
|
|
4353
4353
|
});
|
|
4354
4354
|
}
|
|
4355
|
-
function applyScopeDecisions(db,
|
|
4355
|
+
function applyScopeDecisions(db, sessionId2, decisions) {
|
|
4356
4356
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4357
4357
|
const acceptedSet = new Set(decisions.accepted);
|
|
4358
4358
|
const accepted = [...acceptedSet];
|
|
4359
4359
|
const rejected = [...new Set(decisions.rejected)].filter((n) => !acceptedSet.has(n));
|
|
4360
4360
|
if (rejected.length > 0) {
|
|
4361
4361
|
const placeholders = rejected.map(() => "?").join(",");
|
|
4362
|
-
db.prepare(`UPDATE raw_components SET status = 'rejected' WHERE session_id = ? AND name IN (${placeholders})`).run(
|
|
4362
|
+
db.prepare(`UPDATE raw_components SET status = 'rejected' WHERE session_id = ? AND name IN (${placeholders})`).run(sessionId2, ...rejected);
|
|
4363
4363
|
}
|
|
4364
4364
|
if (accepted.length > 0) {
|
|
4365
4365
|
const placeholders = accepted.map(() => "?").join(",");
|
|
4366
|
-
db.prepare(`UPDATE raw_components SET status = 'generated' WHERE session_id = ? AND name IN (${placeholders})`).run(
|
|
4366
|
+
db.prepare(`UPDATE raw_components SET status = 'generated' WHERE session_id = ? AND name IN (${placeholders})`).run(sessionId2, ...accepted);
|
|
4367
4367
|
}
|
|
4368
|
-
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(now,
|
|
4368
|
+
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(now, sessionId2);
|
|
4369
4369
|
}
|
|
4370
4370
|
function findLatestSessionForCommand(db, command) {
|
|
4371
4371
|
return getLatestCompletedSessionForCommand(db, command);
|
|
4372
4372
|
}
|
|
4373
|
-
function seedCDFFromPreviewResponse(db,
|
|
4373
|
+
function seedCDFFromPreviewResponse(db, sessionId2, removedItems) {
|
|
4374
4374
|
if (removedItems.length === 0)
|
|
4375
4375
|
return 0;
|
|
4376
4376
|
let totalSeeded = 0;
|
|
@@ -4380,7 +4380,7 @@ function seedCDFFromPreviewResponse(db, sessionId, removedItems) {
|
|
|
4380
4380
|
for (const item of removedItems) {
|
|
4381
4381
|
if (!item.fullProperties)
|
|
4382
4382
|
continue;
|
|
4383
|
-
const localComponent = db.prepare(`SELECT component_id FROM raw_components WHERE session_id = ? AND name = ?`).get(
|
|
4383
|
+
const localComponent = db.prepare(`SELECT component_id FROM raw_components WHERE session_id = ? AND name = ?`).get(sessionId2, item.name);
|
|
4384
4384
|
if (!localComponent)
|
|
4385
4385
|
continue;
|
|
4386
4386
|
const contentProps = new Set(item.contentProperties);
|
|
@@ -4388,13 +4388,13 @@ function seedCDFFromPreviewResponse(db, sessionId, removedItems) {
|
|
|
4388
4388
|
for (const [propName, propSummary] of Object.entries(item.fullProperties)) {
|
|
4389
4389
|
const cdfType = mapContentfulTypeToCdfType(propSummary.type);
|
|
4390
4390
|
const cdfCategory = resolveCdfCategory(propSummary.category, propName, contentProps, designProps);
|
|
4391
|
-
const result = updateStmt.run(cdfType, cdfCategory,
|
|
4391
|
+
const result = updateStmt.run(cdfType, cdfCategory, sessionId2, localComponent.component_id, propName);
|
|
4392
4392
|
totalSeeded += Number(result.changes);
|
|
4393
4393
|
}
|
|
4394
4394
|
}
|
|
4395
4395
|
return totalSeeded;
|
|
4396
4396
|
}
|
|
4397
|
-
function seedDefaultsFromChangedItems(db,
|
|
4397
|
+
function seedDefaultsFromChangedItems(db, sessionId2, changedItems) {
|
|
4398
4398
|
if (changedItems.length === 0)
|
|
4399
4399
|
return 0;
|
|
4400
4400
|
let totalSeeded = 0;
|
|
@@ -4405,7 +4405,7 @@ function seedDefaultsFromChangedItems(db, sessionId, changedItems) {
|
|
|
4405
4405
|
for (const { current } of changedItems) {
|
|
4406
4406
|
if (!current.fullProperties)
|
|
4407
4407
|
continue;
|
|
4408
|
-
const localComponent = db.prepare(`SELECT component_id FROM raw_components WHERE session_id = ? AND name = ?`).get(
|
|
4408
|
+
const localComponent = db.prepare(`SELECT component_id FROM raw_components WHERE session_id = ? AND name = ?`).get(sessionId2, current.name);
|
|
4409
4409
|
if (!localComponent)
|
|
4410
4410
|
continue;
|
|
4411
4411
|
const contentProps = new Set(current.contentProperties);
|
|
@@ -4413,38 +4413,38 @@ function seedDefaultsFromChangedItems(db, sessionId, changedItems) {
|
|
|
4413
4413
|
for (const [propName, propSummary] of Object.entries(current.fullProperties)) {
|
|
4414
4414
|
if (propSummary.default !== void 0 && propSummary.default !== null) {
|
|
4415
4415
|
const defaultStr = typeof propSummary.default === "string" ? propSummary.default : JSON.stringify(propSummary.default);
|
|
4416
|
-
const result2 = updateDefaultStmt.run(defaultStr,
|
|
4416
|
+
const result2 = updateDefaultStmt.run(defaultStr, sessionId2, localComponent.component_id, propName);
|
|
4417
4417
|
totalSeeded += Number(result2.changes);
|
|
4418
4418
|
}
|
|
4419
4419
|
const cdfType = mapContentfulTypeToCdfType(propSummary.type);
|
|
4420
4420
|
const cdfCategory = resolveCdfCategory(propSummary.category, propName, contentProps, designProps);
|
|
4421
|
-
const result = updateCDFStmt.run(cdfType, cdfCategory,
|
|
4421
|
+
const result = updateCDFStmt.run(cdfType, cdfCategory, sessionId2, localComponent.component_id, propName);
|
|
4422
4422
|
totalSeeded += Number(result.changes);
|
|
4423
4423
|
}
|
|
4424
4424
|
}
|
|
4425
4425
|
return totalSeeded;
|
|
4426
4426
|
}
|
|
4427
|
-
function backfillUnclassifiedProps(db,
|
|
4427
|
+
function backfillUnclassifiedProps(db, sessionId2) {
|
|
4428
4428
|
const withCategory = db.prepare(`UPDATE raw_props SET cdf_type = 'string', cdf_category = category
|
|
4429
4429
|
WHERE session_id = ? AND cdf_type IS NULL AND category IS NOT NULL
|
|
4430
4430
|
AND component_id IN (
|
|
4431
4431
|
SELECT component_id FROM raw_components WHERE session_id = ? AND status = 'generated'
|
|
4432
|
-
)`).run(
|
|
4432
|
+
)`).run(sessionId2, sessionId2);
|
|
4433
4433
|
const withoutCategory = db.prepare(`UPDATE raw_props SET cdf_type = 'string', cdf_category = 'content'
|
|
4434
4434
|
WHERE session_id = ? AND cdf_type IS NULL AND category IS NULL
|
|
4435
4435
|
AND component_id IN (
|
|
4436
4436
|
SELECT component_id FROM raw_components WHERE session_id = ? AND status = 'generated'
|
|
4437
|
-
)`).run(
|
|
4437
|
+
)`).run(sessionId2, sessionId2);
|
|
4438
4438
|
return Number(withCategory.changes) + Number(withoutCategory.changes);
|
|
4439
4439
|
}
|
|
4440
|
-
function computeMapTokensInputHash(db,
|
|
4440
|
+
function computeMapTokensInputHash(db, sessionId2, componentSourceRefs = []) {
|
|
4441
4441
|
const props = db.prepare(`SELECT rc.name AS component_name, rp.name AS prop_name, rp.cdf_token_kind, rp.default_value
|
|
4442
4442
|
FROM raw_props rp
|
|
4443
4443
|
JOIN raw_components rc ON rc.session_id = rp.session_id AND rc.component_id = rp.component_id
|
|
4444
4444
|
WHERE rp.session_id = ? AND rp.cdf_type = 'token' AND rp.cdf_category = 'design'
|
|
4445
|
-
ORDER BY rc.name, rp.name`).all(
|
|
4446
|
-
const tokens = db.prepare(`SELECT path, type FROM raw_tokens WHERE session_id = ? ORDER BY path`).all(
|
|
4447
|
-
const defaultMappings = db.prepare("SELECT raw_name, path, source FROM raw_token_name_paths WHERE session_id = ? ORDER BY raw_name").all(
|
|
4445
|
+
ORDER BY rc.name, rp.name`).all(sessionId2);
|
|
4446
|
+
const tokens = db.prepare(`SELECT path, type FROM raw_tokens WHERE session_id = ? ORDER BY path`).all(sessionId2);
|
|
4447
|
+
const defaultMappings = db.prepare("SELECT raw_name, path, source FROM raw_token_name_paths WHERE session_id = ? ORDER BY raw_name").all(sessionId2);
|
|
4448
4448
|
const payload = {
|
|
4449
4449
|
props: props.map((p) => ({
|
|
4450
4450
|
component: p.component_name,
|
|
@@ -4525,13 +4525,13 @@ function storeCaches(db, entries) {
|
|
|
4525
4525
|
throw e;
|
|
4526
4526
|
}
|
|
4527
4527
|
}
|
|
4528
|
-
function storeScannedFiles(db,
|
|
4528
|
+
function storeScannedFiles(db, sessionId2, filePaths) {
|
|
4529
4529
|
db.exec("BEGIN");
|
|
4530
4530
|
try {
|
|
4531
|
-
db.prepare("DELETE FROM scanned_files WHERE session_id = ?").run(
|
|
4531
|
+
db.prepare("DELETE FROM scanned_files WHERE session_id = ?").run(sessionId2);
|
|
4532
4532
|
const insert = db.prepare("INSERT INTO scanned_files (session_id, path) VALUES (?, ?)");
|
|
4533
4533
|
for (const path5 of filePaths) {
|
|
4534
|
-
insert.run(
|
|
4534
|
+
insert.run(sessionId2, path5);
|
|
4535
4535
|
}
|
|
4536
4536
|
db.exec("COMMIT");
|
|
4537
4537
|
} catch (e) {
|
|
@@ -4539,15 +4539,15 @@ function storeScannedFiles(db, sessionId, filePaths) {
|
|
|
4539
4539
|
throw e;
|
|
4540
4540
|
}
|
|
4541
4541
|
}
|
|
4542
|
-
function storeSlotCycles(db,
|
|
4542
|
+
function storeSlotCycles(db, sessionId2, cycles) {
|
|
4543
4543
|
db.exec("BEGIN");
|
|
4544
4544
|
try {
|
|
4545
|
-
db.prepare("DELETE FROM slot_cycles WHERE session_id = ?").run(
|
|
4545
|
+
db.prepare("DELETE FROM slot_cycles WHERE session_id = ?").run(sessionId2);
|
|
4546
4546
|
const insert = db.prepare(`INSERT INTO slot_cycles (session_id, cycle_index, path_json, edges_json, suggested_break_json)
|
|
4547
4547
|
VALUES (?, ?, ?, ?, ?)`);
|
|
4548
4548
|
for (let i = 0; i < cycles.length; i += 1) {
|
|
4549
4549
|
const cycle = cycles[i];
|
|
4550
|
-
insert.run(
|
|
4550
|
+
insert.run(sessionId2, i, JSON.stringify(cycle.path), JSON.stringify(cycle.edges), cycle.suggestedBreak ? JSON.stringify(cycle.suggestedBreak) : null);
|
|
4551
4551
|
}
|
|
4552
4552
|
db.exec("COMMIT");
|
|
4553
4553
|
} catch (e) {
|
|
@@ -4555,20 +4555,20 @@ function storeSlotCycles(db, sessionId, cycles) {
|
|
|
4555
4555
|
throw e;
|
|
4556
4556
|
}
|
|
4557
4557
|
}
|
|
4558
|
-
function loadSlotCycles(db,
|
|
4559
|
-
const rows = db.prepare("SELECT cycle_index, path_json, edges_json, suggested_break_json FROM slot_cycles WHERE session_id = ? ORDER BY cycle_index").all(
|
|
4558
|
+
function loadSlotCycles(db, sessionId2) {
|
|
4559
|
+
const rows = db.prepare("SELECT cycle_index, path_json, edges_json, suggested_break_json FROM slot_cycles WHERE session_id = ? ORDER BY cycle_index").all(sessionId2);
|
|
4560
4560
|
return rows.map((r) => ({
|
|
4561
4561
|
path: JSON.parse(r.path_json),
|
|
4562
4562
|
edges: JSON.parse(r.edges_json),
|
|
4563
4563
|
suggestedBreak: r.suggested_break_json ? JSON.parse(r.suggested_break_json) : null
|
|
4564
4564
|
}));
|
|
4565
4565
|
}
|
|
4566
|
-
function findUnknownSlotAllowedComponents(db,
|
|
4566
|
+
function findUnknownSlotAllowedComponents(db, sessionId2, allowedComponentNames2, componentId) {
|
|
4567
4567
|
const rows = db.prepare(`SELECT a.component_id, c.name AS component_name, a.slot_name, a.allowed_component
|
|
4568
4568
|
FROM raw_slot_allowed_components a
|
|
4569
4569
|
JOIN raw_components c ON c.session_id = a.session_id AND c.component_id = a.component_id
|
|
4570
4570
|
WHERE a.session_id = ? AND (? IS NULL OR a.component_id = ?)
|
|
4571
|
-
ORDER BY a.component_id, a.slot_name, a.position`).all(
|
|
4571
|
+
ORDER BY a.component_id, a.slot_name, a.position`).all(sessionId2, componentId ?? null, componentId ?? null);
|
|
4572
4572
|
return rows.filter((row) => !allowedComponentNames2.has(row.allowed_component)).map((row) => ({
|
|
4573
4573
|
componentId: row.component_id,
|
|
4574
4574
|
componentName: row.component_name,
|
|
@@ -4576,8 +4576,8 @@ function findUnknownSlotAllowedComponents(db, sessionId, allowedComponentNames2,
|
|
|
4576
4576
|
allowedComponent: row.allowed_component
|
|
4577
4577
|
}));
|
|
4578
4578
|
}
|
|
4579
|
-
function filterUnknownSlotAllowedComponents(db,
|
|
4580
|
-
const unknown5 = findUnknownSlotAllowedComponents(db,
|
|
4579
|
+
function filterUnknownSlotAllowedComponents(db, sessionId2, allowedComponentNames2) {
|
|
4580
|
+
const unknown5 = findUnknownSlotAllowedComponents(db, sessionId2, allowedComponentNames2);
|
|
4581
4581
|
if (unknown5.length === 0)
|
|
4582
4582
|
return unknown5;
|
|
4583
4583
|
db.exec("BEGIN");
|
|
@@ -4585,7 +4585,7 @@ function filterUnknownSlotAllowedComponents(db, sessionId, allowedComponentNames
|
|
|
4585
4585
|
const remove = db.prepare(`DELETE FROM raw_slot_allowed_components
|
|
4586
4586
|
WHERE session_id = ? AND component_id = ? AND slot_name = ? AND allowed_component = ?`);
|
|
4587
4587
|
for (const row of unknown5) {
|
|
4588
|
-
remove.run(
|
|
4588
|
+
remove.run(sessionId2, row.componentId, row.slotName, row.allowedComponent);
|
|
4589
4589
|
}
|
|
4590
4590
|
db.exec("COMMIT");
|
|
4591
4591
|
} catch (e) {
|
|
@@ -4733,7 +4733,7 @@ async function getCliCacheVersion() {
|
|
|
4733
4733
|
return _cliCacheVersionCache;
|
|
4734
4734
|
}
|
|
4735
4735
|
}
|
|
4736
|
-
function storeExtractCache(db, filePath, fileHash,
|
|
4736
|
+
function storeExtractCache(db, filePath, fileHash, cliVersion2, components) {
|
|
4737
4737
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4738
4738
|
const componentsJson = JSON.stringify(components);
|
|
4739
4739
|
db.prepare(`INSERT INTO extract_cache (file_path, file_hash, cli_version, created_at, updated_at, components_json)
|
|
@@ -4741,12 +4741,12 @@ function storeExtractCache(db, filePath, fileHash, cliVersion, components) {
|
|
|
4741
4741
|
ON CONFLICT(file_hash, cli_version) DO UPDATE SET
|
|
4742
4742
|
file_path = excluded.file_path,
|
|
4743
4743
|
updated_at = excluded.updated_at,
|
|
4744
|
-
components_json = excluded.components_json`).run(filePath, fileHash,
|
|
4744
|
+
components_json = excluded.components_json`).run(filePath, fileHash, cliVersion2, now, now, componentsJson);
|
|
4745
4745
|
}
|
|
4746
|
-
function lookupExtractCache(db, fileHash,
|
|
4746
|
+
function lookupExtractCache(db, fileHash, cliVersion2) {
|
|
4747
4747
|
const row = db.prepare(`SELECT file_path, file_hash, cli_version, created_at, updated_at, components_json
|
|
4748
4748
|
FROM extract_cache
|
|
4749
|
-
WHERE file_hash = ? AND cli_version = ?`).get(fileHash,
|
|
4749
|
+
WHERE file_hash = ? AND cli_version = ?`).get(fileHash, cliVersion2);
|
|
4750
4750
|
if (!row)
|
|
4751
4751
|
return null;
|
|
4752
4752
|
let components = [];
|
|
@@ -4764,31 +4764,31 @@ function lookupExtractCache(db, fileHash, cliVersion) {
|
|
|
4764
4764
|
components
|
|
4765
4765
|
};
|
|
4766
4766
|
}
|
|
4767
|
-
function storeCompositionCache(db, inputHash,
|
|
4767
|
+
function storeCompositionCache(db, inputHash, cliVersion2, agentOutput) {
|
|
4768
4768
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4769
4769
|
db.prepare(`INSERT INTO composition_cache (input_hash, cli_version, agent_output, created_at, updated_at)
|
|
4770
4770
|
VALUES (?, ?, ?, ?, ?)
|
|
4771
4771
|
ON CONFLICT(input_hash, cli_version) DO UPDATE SET
|
|
4772
4772
|
agent_output = excluded.agent_output,
|
|
4773
|
-
updated_at = excluded.updated_at`).run(inputHash,
|
|
4773
|
+
updated_at = excluded.updated_at`).run(inputHash, cliVersion2, agentOutput, now, now);
|
|
4774
4774
|
}
|
|
4775
|
-
function lookupCompositionCache(db, inputHash,
|
|
4776
|
-
const row = db.prepare(`SELECT agent_output FROM composition_cache WHERE input_hash = ? AND cli_version = ?`).get(inputHash,
|
|
4775
|
+
function lookupCompositionCache(db, inputHash, cliVersion2) {
|
|
4776
|
+
const row = db.prepare(`SELECT agent_output FROM composition_cache WHERE input_hash = ? AND cli_version = ?`).get(inputHash, cliVersion2);
|
|
4777
4777
|
return row ? row.agent_output : null;
|
|
4778
4778
|
}
|
|
4779
|
-
function storeSelectCache(db, componentHash, promptHash,
|
|
4779
|
+
function storeSelectCache(db, componentHash, promptHash, cliVersion2, decision, reason) {
|
|
4780
4780
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4781
4781
|
db.prepare(`INSERT INTO select_cache (component_hash, prompt_hash, cli_version, decision, reason, created_at, updated_at)
|
|
4782
4782
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
4783
4783
|
ON CONFLICT(component_hash, prompt_hash, cli_version) DO UPDATE SET
|
|
4784
4784
|
decision = excluded.decision,
|
|
4785
4785
|
reason = excluded.reason,
|
|
4786
|
-
updated_at = excluded.updated_at`).run(componentHash, promptHash,
|
|
4786
|
+
updated_at = excluded.updated_at`).run(componentHash, promptHash, cliVersion2, decision, reason, now, now);
|
|
4787
4787
|
}
|
|
4788
|
-
function lookupSelectCache(db, componentHash, promptHash,
|
|
4788
|
+
function lookupSelectCache(db, componentHash, promptHash, cliVersion2) {
|
|
4789
4789
|
const row = db.prepare(`SELECT component_hash, prompt_hash, cli_version, decision, reason, created_at, updated_at
|
|
4790
4790
|
FROM select_cache
|
|
4791
|
-
WHERE component_hash = ? AND prompt_hash = ? AND cli_version = ?`).get(componentHash, promptHash,
|
|
4791
|
+
WHERE component_hash = ? AND prompt_hash = ? AND cli_version = ?`).get(componentHash, promptHash, cliVersion2);
|
|
4792
4792
|
if (!row)
|
|
4793
4793
|
return null;
|
|
4794
4794
|
return {
|
|
@@ -12286,11 +12286,11 @@ async function loadReviewInput(components, options = {}) {
|
|
|
12286
12286
|
}
|
|
12287
12287
|
|
|
12288
12288
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/load-and-validate-for-review.js
|
|
12289
|
-
async function loadAndValidateForReview(
|
|
12289
|
+
async function loadAndValidateForReview(sessionId2, projectRoot) {
|
|
12290
12290
|
const db = openPipelineDb();
|
|
12291
12291
|
let rawComponents;
|
|
12292
12292
|
try {
|
|
12293
|
-
rawComponents = loadRawComponents(db,
|
|
12293
|
+
rawComponents = loadRawComponents(db, sessionId2);
|
|
12294
12294
|
} finally {
|
|
12295
12295
|
db.close();
|
|
12296
12296
|
}
|
|
@@ -12306,8 +12306,8 @@ import { access as access2, mkdir, readFile as readFile7, writeFile } from "node
|
|
|
12306
12306
|
|
|
12307
12307
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
|
|
12308
12308
|
import { resolve as resolve15 } from "node:path";
|
|
12309
|
-
async function getRefineSessionPaths(
|
|
12310
|
-
const sessionDir = resolve15(artifactsRoot,
|
|
12309
|
+
async function getRefineSessionPaths(sessionId2, artifactsRoot) {
|
|
12310
|
+
const sessionDir = resolve15(artifactsRoot, sessionId2);
|
|
12311
12311
|
return {
|
|
12312
12312
|
sessionDir,
|
|
12313
12313
|
eventsPath: resolve15(sessionDir, "events.jsonl"),
|
|
@@ -12316,8 +12316,8 @@ async function getRefineSessionPaths(sessionId, artifactsRoot) {
|
|
|
12316
12316
|
}
|
|
12317
12317
|
|
|
12318
12318
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
|
|
12319
|
-
async function ensureRefineSession(
|
|
12320
|
-
const paths = await getRefineSessionPaths(
|
|
12319
|
+
async function ensureRefineSession(sessionId2, artifactsRoot, initialSnapshot) {
|
|
12320
|
+
const paths = await getRefineSessionPaths(sessionId2, artifactsRoot);
|
|
12321
12321
|
await mkdir(paths.sessionDir, { recursive: true });
|
|
12322
12322
|
try {
|
|
12323
12323
|
await access2(paths.statePath);
|
|
@@ -12346,16 +12346,16 @@ async function saveReviewState(statePath, session) {
|
|
|
12346
12346
|
}
|
|
12347
12347
|
|
|
12348
12348
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
12349
|
-
async function mergePreviewValidationErrorsIntoReviewSession(
|
|
12349
|
+
async function mergePreviewValidationErrorsIntoReviewSession(sessionId2, errors, opts = {}) {
|
|
12350
12350
|
const artifactsRoot = opts.artifactsRoot ?? getRefineArtifactsRoot();
|
|
12351
|
-
const paths = await getRefineSessionPaths(
|
|
12351
|
+
const paths = await getRefineSessionPaths(sessionId2, artifactsRoot);
|
|
12352
12352
|
let snapshot;
|
|
12353
12353
|
try {
|
|
12354
12354
|
await access3(paths.statePath);
|
|
12355
12355
|
snapshot = JSON.parse(await readFile8(paths.statePath, "utf8"));
|
|
12356
12356
|
} catch {
|
|
12357
|
-
snapshot = await loadAndValidateForReview(
|
|
12358
|
-
snapshot = await ensureRefineSession(
|
|
12357
|
+
snapshot = await loadAndValidateForReview(sessionId2, void 0);
|
|
12358
|
+
snapshot = await ensureRefineSession(sessionId2, artifactsRoot, snapshot);
|
|
12359
12359
|
}
|
|
12360
12360
|
const errorsByName = /* @__PURE__ */ new Map();
|
|
12361
12361
|
for (const err of errors) {
|
|
@@ -12391,18 +12391,18 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
12391
12391
|
|
|
12392
12392
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/reject-components-by-name.js
|
|
12393
12393
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
12394
|
-
async function rejectComponentsByName(
|
|
12394
|
+
async function rejectComponentsByName(sessionId2, names, opts = {}) {
|
|
12395
12395
|
if (names.length === 0)
|
|
12396
12396
|
return;
|
|
12397
12397
|
const db = openPipelineDb();
|
|
12398
12398
|
try {
|
|
12399
12399
|
const placeholders = names.map(() => "?").join(",");
|
|
12400
|
-
db.prepare(`UPDATE raw_components SET status = 'generate-rejected' WHERE session_id = ? AND name IN (${placeholders})`).run(
|
|
12400
|
+
db.prepare(`UPDATE raw_components SET status = 'generate-rejected' WHERE session_id = ? AND name IN (${placeholders})`).run(sessionId2, ...names);
|
|
12401
12401
|
} finally {
|
|
12402
12402
|
db.close();
|
|
12403
12403
|
}
|
|
12404
12404
|
const artifactsRoot = opts.artifactsRoot ?? getRefineArtifactsRoot();
|
|
12405
|
-
const paths = await getRefineSessionPaths(
|
|
12405
|
+
const paths = await getRefineSessionPaths(sessionId2, artifactsRoot);
|
|
12406
12406
|
const nameSet = new Set(names);
|
|
12407
12407
|
let snapshot;
|
|
12408
12408
|
try {
|
|
@@ -12830,9 +12830,9 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
|
|
|
12830
12830
|
|
|
12831
12831
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/services/write-scope-decisions-snapshot.js
|
|
12832
12832
|
import { mkdir as mkdir3 } from "node:fs/promises";
|
|
12833
|
-
async function writeScopeDecisionsSnapshot(db,
|
|
12833
|
+
async function writeScopeDecisionsSnapshot(db, sessionId2, decisions) {
|
|
12834
12834
|
const acceptedSet = new Set(decisions.accepted);
|
|
12835
|
-
const rawComponents = loadRawComponents(db,
|
|
12835
|
+
const rawComponents = loadRawComponents(db, sessionId2);
|
|
12836
12836
|
const records = rawComponents.map((c2) => {
|
|
12837
12837
|
const status = acceptedSet.has(c2.name) ? "accepted" : "rejected";
|
|
12838
12838
|
const proposal = {
|
|
@@ -12855,17 +12855,17 @@ async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
|
|
|
12855
12855
|
status
|
|
12856
12856
|
};
|
|
12857
12857
|
});
|
|
12858
|
-
const paths = await getRefineSessionPaths(
|
|
12858
|
+
const paths = await getRefineSessionPaths(sessionId2, getRefineArtifactsRoot());
|
|
12859
12859
|
await mkdir3(paths.sessionDir, { recursive: true });
|
|
12860
12860
|
await saveReviewState(paths.statePath, { components: records });
|
|
12861
12861
|
}
|
|
12862
12862
|
|
|
12863
12863
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/load-accepted-names.js
|
|
12864
12864
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
12865
|
-
async function loadAcceptedNames(
|
|
12865
|
+
async function loadAcceptedNames(sessionId2) {
|
|
12866
12866
|
try {
|
|
12867
12867
|
const artifactsRoot = getRefineArtifactsRoot();
|
|
12868
|
-
const paths = await getRefineSessionPaths(
|
|
12868
|
+
const paths = await getRefineSessionPaths(sessionId2, artifactsRoot);
|
|
12869
12869
|
const raw = await readFile12(paths.statePath, "utf8");
|
|
12870
12870
|
const snapshot = JSON.parse(raw);
|
|
12871
12871
|
const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
|
|
@@ -12880,6 +12880,60 @@ async function loadAcceptedNames(sessionId) {
|
|
|
12880
12880
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/index.js
|
|
12881
12881
|
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
12882
12882
|
|
|
12883
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/generate-session-id.js
|
|
12884
|
+
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
12885
|
+
var ADJECTIVES2 = [
|
|
12886
|
+
"bright",
|
|
12887
|
+
"calm",
|
|
12888
|
+
"dark",
|
|
12889
|
+
"fast",
|
|
12890
|
+
"green",
|
|
12891
|
+
"happy",
|
|
12892
|
+
"keen",
|
|
12893
|
+
"light",
|
|
12894
|
+
"long",
|
|
12895
|
+
"loud",
|
|
12896
|
+
"pale",
|
|
12897
|
+
"quick",
|
|
12898
|
+
"sharp",
|
|
12899
|
+
"slow",
|
|
12900
|
+
"soft",
|
|
12901
|
+
"warm",
|
|
12902
|
+
"wild",
|
|
12903
|
+
"wise"
|
|
12904
|
+
];
|
|
12905
|
+
var NOUNS2 = [
|
|
12906
|
+
"cloud",
|
|
12907
|
+
"creek",
|
|
12908
|
+
"dawn",
|
|
12909
|
+
"dusk",
|
|
12910
|
+
"field",
|
|
12911
|
+
"flame",
|
|
12912
|
+
"frost",
|
|
12913
|
+
"grove",
|
|
12914
|
+
"hill",
|
|
12915
|
+
"lake",
|
|
12916
|
+
"leaf",
|
|
12917
|
+
"moon",
|
|
12918
|
+
"peak",
|
|
12919
|
+
"rain",
|
|
12920
|
+
"river",
|
|
12921
|
+
"rock",
|
|
12922
|
+
"snow",
|
|
12923
|
+
"star",
|
|
12924
|
+
"storm",
|
|
12925
|
+
"tide",
|
|
12926
|
+
"tree",
|
|
12927
|
+
"wave",
|
|
12928
|
+
"wind"
|
|
12929
|
+
];
|
|
12930
|
+
function generateSessionId2() {
|
|
12931
|
+
const adj = ADJECTIVES2[Math.floor(Math.random() * ADJECTIVES2.length)];
|
|
12932
|
+
const noun = NOUNS2[Math.floor(Math.random() * NOUNS2.length)];
|
|
12933
|
+
const hex = randomBytes3(2).toString("hex");
|
|
12934
|
+
return `${adj}-${noun}-${hex}`;
|
|
12935
|
+
}
|
|
12936
|
+
|
|
12883
12937
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/migration.js
|
|
12884
12938
|
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
12885
12939
|
|
|
@@ -14582,33 +14636,33 @@ function filterAllowedPaths(args) {
|
|
|
14582
14636
|
}
|
|
14583
14637
|
|
|
14584
14638
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/map-tokens/is-prop-reviewed.js
|
|
14585
|
-
function isPropReviewed(db,
|
|
14639
|
+
function isPropReviewed(db, sessionId2, componentId, propName) {
|
|
14586
14640
|
const row = db.prepare(`SELECT COUNT(*) AS count FROM raw_prop_token_paths
|
|
14587
14641
|
WHERE session_id = ? AND component_id = ? AND prop_name = ?
|
|
14588
|
-
AND source = 'review'`).get(
|
|
14642
|
+
AND source = 'review'`).get(sessionId2, componentId, propName);
|
|
14589
14643
|
return row.count > 0;
|
|
14590
14644
|
}
|
|
14591
14645
|
|
|
14592
14646
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/map-tokens/load-token-type-by-path.js
|
|
14593
|
-
function loadTokenTypeByPath(db,
|
|
14594
|
-
const rows = db.prepare("SELECT path, type FROM raw_tokens WHERE session_id = ?").all(
|
|
14647
|
+
function loadTokenTypeByPath(db, sessionId2) {
|
|
14648
|
+
const rows = db.prepare("SELECT path, type FROM raw_tokens WHERE session_id = ?").all(sessionId2);
|
|
14595
14649
|
return new Map(rows.map((r) => [r.path, r.type]));
|
|
14596
14650
|
}
|
|
14597
14651
|
|
|
14598
14652
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/map-tokens/apply-map-token-prop-calls.js
|
|
14599
|
-
function applyMapTokenPropCalls(db,
|
|
14653
|
+
function applyMapTokenPropCalls(db, sessionId2, calls, incomingWarnings) {
|
|
14600
14654
|
const warnings = [...incomingWarnings];
|
|
14601
14655
|
let applied = 0;
|
|
14602
|
-
const tokenTypeByPath = loadTokenTypeByPath(db,
|
|
14656
|
+
const tokenTypeByPath = loadTokenTypeByPath(db, sessionId2);
|
|
14603
14657
|
const findComponent = db.prepare("SELECT component_id FROM raw_components WHERE session_id = ? AND name = ?");
|
|
14604
14658
|
const findProp = db.prepare("SELECT cdf_type, cdf_category, cdf_token_kind FROM raw_props WHERE session_id = ? AND component_id = ? AND name = ?");
|
|
14605
14659
|
for (const call of calls) {
|
|
14606
|
-
const component = findComponent.get(
|
|
14660
|
+
const component = findComponent.get(sessionId2, call.component);
|
|
14607
14661
|
if (!component) {
|
|
14608
14662
|
warnings.push(`map_token_prop: unknown component '${call.component}' \u2014 skipped`);
|
|
14609
14663
|
continue;
|
|
14610
14664
|
}
|
|
14611
|
-
const prop = findProp.get(
|
|
14665
|
+
const prop = findProp.get(sessionId2, component.component_id, call.prop);
|
|
14612
14666
|
if (!prop) {
|
|
14613
14667
|
warnings.push(`map_token_prop '${call.component}.${call.prop}': unknown prop \u2014 skipped`);
|
|
14614
14668
|
continue;
|
|
@@ -14617,7 +14671,7 @@ function applyMapTokenPropCalls(db, sessionId, calls, incomingWarnings) {
|
|
|
14617
14671
|
warnings.push(`map_token_prop '${call.component}.${call.prop}': target is not a design-category token prop \u2014 skipped`);
|
|
14618
14672
|
continue;
|
|
14619
14673
|
}
|
|
14620
|
-
if (isPropReviewed(db,
|
|
14674
|
+
if (isPropReviewed(db, sessionId2, component.component_id, call.prop)) {
|
|
14621
14675
|
warnings.push(`map_token_prop '${call.component}.${call.prop}': a reviewer already set this restriction \u2014 skipped`);
|
|
14622
14676
|
continue;
|
|
14623
14677
|
}
|
|
@@ -14633,7 +14687,7 @@ function applyMapTokenPropCalls(db, sessionId, calls, incomingWarnings) {
|
|
|
14633
14687
|
warnings.push(`map_token_prop '${call.component}.${call.prop}': no valid token_allowed remain \u2014 skipped`);
|
|
14634
14688
|
continue;
|
|
14635
14689
|
}
|
|
14636
|
-
replaceRawPropTokenPaths(db,
|
|
14690
|
+
replaceRawPropTokenPaths(db, sessionId2, component.component_id, call.prop, filteredAllowed, "agent");
|
|
14637
14691
|
applied++;
|
|
14638
14692
|
}
|
|
14639
14693
|
return { applied, warnings };
|
|
@@ -14671,18 +14725,176 @@ function countMappableProps(cdfEntries) {
|
|
|
14671
14725
|
}
|
|
14672
14726
|
|
|
14673
14727
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/map-tokens/load-raw-defaults.js
|
|
14674
|
-
function loadRawDefaults(db,
|
|
14728
|
+
function loadRawDefaults(db, sessionId2) {
|
|
14675
14729
|
return db.prepare(`SELECT rp.default_value AS default_reference, rp.cdf_token_kind
|
|
14676
14730
|
FROM raw_props rp
|
|
14677
14731
|
JOIN raw_components rc ON rc.session_id = rp.session_id AND rc.component_id = rp.component_id
|
|
14678
14732
|
WHERE rp.session_id = ? AND rc.status = 'generated'
|
|
14679
14733
|
AND rp.cdf_type = 'token' AND rp.cdf_category = 'design'
|
|
14680
|
-
AND rp.default_value IS NOT NULL`).all(
|
|
14734
|
+
AND rp.default_value IS NOT NULL`).all(sessionId2);
|
|
14681
14735
|
}
|
|
14682
14736
|
|
|
14683
14737
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/map-tokens/load-token-leaves.js
|
|
14684
|
-
function loadTokenLeaves(db,
|
|
14685
|
-
return db.prepare("SELECT path, type FROM raw_tokens WHERE session_id = ? ORDER BY path").all(
|
|
14738
|
+
function loadTokenLeaves(db, sessionId2) {
|
|
14739
|
+
return db.prepare("SELECT path, type FROM raw_tokens WHERE session_id = ? ORDER BY path").all(sessionId2);
|
|
14740
|
+
}
|
|
14741
|
+
|
|
14742
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/client.js
|
|
14743
|
+
import { Analytics } from "@segment/analytics-node";
|
|
14744
|
+
var DEFAULT_WRITE_KEY = "6DmxiEPN3SV1vbRTTMcNqDzCvkfwT06N";
|
|
14745
|
+
var analyticsClient = null;
|
|
14746
|
+
var persistedDisabled = false;
|
|
14747
|
+
var cliVersionString = "0.0.0-unknown";
|
|
14748
|
+
function cliVersion() {
|
|
14749
|
+
return cliVersionString;
|
|
14750
|
+
}
|
|
14751
|
+
function analyticsEnabled() {
|
|
14752
|
+
return !persistedDisabled && !process.env["DISABLE_ANALYTICS"];
|
|
14753
|
+
}
|
|
14754
|
+
function resolveWriteKey() {
|
|
14755
|
+
const key = (process.env["SEGMENT_WRITE_KEY"] ?? "").trim();
|
|
14756
|
+
return key.length > 0 ? key : DEFAULT_WRITE_KEY;
|
|
14757
|
+
}
|
|
14758
|
+
function getClient() {
|
|
14759
|
+
if (!analyticsEnabled())
|
|
14760
|
+
return null;
|
|
14761
|
+
const writeKey = resolveWriteKey();
|
|
14762
|
+
if (!writeKey)
|
|
14763
|
+
return null;
|
|
14764
|
+
if (!analyticsClient) {
|
|
14765
|
+
analyticsClient = new Analytics({ writeKey });
|
|
14766
|
+
analyticsClient.on("error", () => {
|
|
14767
|
+
});
|
|
14768
|
+
}
|
|
14769
|
+
return analyticsClient;
|
|
14770
|
+
}
|
|
14771
|
+
async function trackEvent(event, properties, anonymousId, options) {
|
|
14772
|
+
const client2 = getClient();
|
|
14773
|
+
if (!client2)
|
|
14774
|
+
return;
|
|
14775
|
+
try {
|
|
14776
|
+
client2.track({
|
|
14777
|
+
event,
|
|
14778
|
+
properties,
|
|
14779
|
+
anonymousId,
|
|
14780
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
14781
|
+
});
|
|
14782
|
+
if (options?.flush)
|
|
14783
|
+
await flushAnalytics();
|
|
14784
|
+
} catch {
|
|
14785
|
+
}
|
|
14786
|
+
}
|
|
14787
|
+
async function flushAnalytics() {
|
|
14788
|
+
if (!analyticsClient)
|
|
14789
|
+
return;
|
|
14790
|
+
try {
|
|
14791
|
+
await analyticsClient.closeAndFlush();
|
|
14792
|
+
} catch {
|
|
14793
|
+
} finally {
|
|
14794
|
+
analyticsClient = null;
|
|
14795
|
+
}
|
|
14796
|
+
}
|
|
14797
|
+
|
|
14798
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/constants.js
|
|
14799
|
+
var ANALYTICS_SESSION_ENV = "EDS_ANALYTICS_SESSION_ID";
|
|
14800
|
+
var IMPORT_PIPELINE_ENV = "EDS_IMPORT_PIPELINE";
|
|
14801
|
+
|
|
14802
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/session.js
|
|
14803
|
+
function resolveAnalyticsSessionId(explicit) {
|
|
14804
|
+
const inherited = process.env[ANALYTICS_SESSION_ENV]?.trim();
|
|
14805
|
+
if (inherited)
|
|
14806
|
+
return inherited;
|
|
14807
|
+
const passed = explicit?.trim();
|
|
14808
|
+
if (passed)
|
|
14809
|
+
return passed;
|
|
14810
|
+
return generateSessionId2();
|
|
14811
|
+
}
|
|
14812
|
+
function isPipelineAnalyticsChild() {
|
|
14813
|
+
return Boolean(process.env[ANALYTICS_SESSION_ENV]?.trim());
|
|
14814
|
+
}
|
|
14815
|
+
|
|
14816
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/os.js
|
|
14817
|
+
var OS_NAMES2 = {
|
|
14818
|
+
android: "Android",
|
|
14819
|
+
aix: "Linux",
|
|
14820
|
+
darwin: "macOS",
|
|
14821
|
+
freebsd: "Linux",
|
|
14822
|
+
linux: "Linux",
|
|
14823
|
+
openbsd: "Linux",
|
|
14824
|
+
sunos: "Linux",
|
|
14825
|
+
win32: "Windows"
|
|
14826
|
+
};
|
|
14827
|
+
function getOsName() {
|
|
14828
|
+
return OS_NAMES2[process.platform] ?? "other";
|
|
14829
|
+
}
|
|
14830
|
+
|
|
14831
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/tracker.js
|
|
14832
|
+
var pending = null;
|
|
14833
|
+
var sessionId;
|
|
14834
|
+
var sessionStartedEmitted = false;
|
|
14835
|
+
function isPipelineStep() {
|
|
14836
|
+
return process.env[IMPORT_PIPELINE_ENV] === "1";
|
|
14837
|
+
}
|
|
14838
|
+
function buildBaseProps(command) {
|
|
14839
|
+
return {
|
|
14840
|
+
dsi_session_id: sessionId,
|
|
14841
|
+
command,
|
|
14842
|
+
...isPipelineStep() ? { is_pipeline_step: true } : {}
|
|
14843
|
+
};
|
|
14844
|
+
}
|
|
14845
|
+
function mergeContext(target, source) {
|
|
14846
|
+
if (source.space_key !== void 0)
|
|
14847
|
+
target.space_key = source.space_key;
|
|
14848
|
+
if (source.environment_key !== void 0)
|
|
14849
|
+
target.environment_key = source.environment_key;
|
|
14850
|
+
if (source.x_contentful_request_id !== void 0) {
|
|
14851
|
+
target.x_contentful_request_id = source.x_contentful_request_id;
|
|
14852
|
+
}
|
|
14853
|
+
}
|
|
14854
|
+
async function bindAnalyticsSessionId(explicit, context) {
|
|
14855
|
+
const id = resolveAnalyticsSessionId(explicit);
|
|
14856
|
+
await bindAnalyticsSession(id, context);
|
|
14857
|
+
return id;
|
|
14858
|
+
}
|
|
14859
|
+
function setCommandContext(context) {
|
|
14860
|
+
if (!pending)
|
|
14861
|
+
return;
|
|
14862
|
+
mergeContext(pending.context, context);
|
|
14863
|
+
mergeContext(pending.completion, context);
|
|
14864
|
+
}
|
|
14865
|
+
function enrichCommandResult(fields) {
|
|
14866
|
+
if (!pending)
|
|
14867
|
+
return;
|
|
14868
|
+
Object.assign(pending.completion, fields);
|
|
14869
|
+
mergeContext(pending.context, fields);
|
|
14870
|
+
}
|
|
14871
|
+
async function bindAnalyticsSession(id, context) {
|
|
14872
|
+
sessionId = id;
|
|
14873
|
+
if (context)
|
|
14874
|
+
setCommandContext(context);
|
|
14875
|
+
await emitInvokedIfReady();
|
|
14876
|
+
}
|
|
14877
|
+
async function emitSessionStarted(entryCommand) {
|
|
14878
|
+
if (!sessionId || sessionStartedEmitted)
|
|
14879
|
+
return;
|
|
14880
|
+
sessionStartedEmitted = true;
|
|
14881
|
+
await trackEvent("dsi_cli_session_started", {
|
|
14882
|
+
dsi_session_id: sessionId,
|
|
14883
|
+
entry_command: entryCommand,
|
|
14884
|
+
cli_version: cliVersion(),
|
|
14885
|
+
node_version: process.version,
|
|
14886
|
+
os_name: getOsName()
|
|
14887
|
+
}, sessionId, { flush: true });
|
|
14888
|
+
await emitInvokedIfReady();
|
|
14889
|
+
}
|
|
14890
|
+
async function emitInvokedIfReady() {
|
|
14891
|
+
if (!pending || pending.invoked || !sessionId)
|
|
14892
|
+
return;
|
|
14893
|
+
pending.invoked = true;
|
|
14894
|
+
await trackEvent("dsi_cli_command_invoked", {
|
|
14895
|
+
...buildBaseProps(pending.command),
|
|
14896
|
+
...pending.context
|
|
14897
|
+
}, sessionId, { flush: true });
|
|
14686
14898
|
}
|
|
14687
14899
|
|
|
14688
14900
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/map-tokens/run-map-tokens.js
|
|
@@ -14710,42 +14922,53 @@ async function runMapTokens(request) {
|
|
|
14710
14922
|
const timeoutMs = request.agentTimeoutMs ?? DEFAULT_TIMEOUT_MS2;
|
|
14711
14923
|
const db = openPipelineDb();
|
|
14712
14924
|
try {
|
|
14713
|
-
const
|
|
14714
|
-
if (!
|
|
14925
|
+
const sessionId2 = request.sessionId ?? findLatestSessionForCommand(db, "generate components");
|
|
14926
|
+
if (!sessionId2) {
|
|
14715
14927
|
throw new MapTokensRunFailure({ type: "no-session" });
|
|
14716
14928
|
}
|
|
14717
|
-
|
|
14929
|
+
await bindAnalyticsSessionId(sessionId2);
|
|
14930
|
+
const tokenLeaves = loadTokenLeaves(db, sessionId2);
|
|
14718
14931
|
const knownTokenPaths = new Set(tokenLeaves.map((t) => t.path));
|
|
14932
|
+
const diagnostics = [];
|
|
14719
14933
|
if (request.tokenMapInline) {
|
|
14720
14934
|
const validMappings = {};
|
|
14721
14935
|
for (const [rawName, path5] of Object.entries(request.tokenMapInline)) {
|
|
14722
|
-
if (knownTokenPaths.has(path5))
|
|
14936
|
+
if (knownTokenPaths.has(path5)) {
|
|
14723
14937
|
validMappings[rawName] = path5;
|
|
14938
|
+
} else {
|
|
14939
|
+
diagnostics.push(`Token map '${rawName}' -> '${path5}': path not found in session tokens \u2014 skipped.`);
|
|
14940
|
+
}
|
|
14724
14941
|
}
|
|
14725
|
-
replaceRawTokenNamePaths(db,
|
|
14942
|
+
replaceRawTokenNamePaths(db, sessionId2, validMappings, "manual");
|
|
14726
14943
|
}
|
|
14727
|
-
const rawDefaults = loadRawDefaults(db,
|
|
14944
|
+
const rawDefaults = loadRawDefaults(db, sessionId2);
|
|
14728
14945
|
const defaultResolution = resolveTokenDefaults(rawDefaults.map((row) => ({ rawDefault: row.default_reference, tokenKind: row.cdf_token_kind })), tokenLeaves);
|
|
14729
|
-
|
|
14946
|
+
for (const diagnostic of defaultResolution.diagnostics)
|
|
14947
|
+
diagnostics.push(diagnostic.message);
|
|
14948
|
+
const manualMappings = new Map(getRawTokenNamePathRows(db, sessionId2).filter((row) => row.source === "manual").map((row) => [row.rawName, row.path]));
|
|
14730
14949
|
const automaticMappings = {};
|
|
14731
14950
|
for (const [rawName, path5] of Object.entries(defaultResolution.mappings)) {
|
|
14732
|
-
|
|
14951
|
+
const manualPath = manualMappings.get(rawName);
|
|
14952
|
+
if (manualPath === void 0) {
|
|
14733
14953
|
automaticMappings[rawName] = path5;
|
|
14954
|
+
} else if (manualPath !== path5) {
|
|
14955
|
+
diagnostics.push(`Token default '${rawName}' automatically resolves to '${path5}', but manual mapping '${manualPath}' is retained.`);
|
|
14956
|
+
}
|
|
14734
14957
|
}
|
|
14735
|
-
replaceRawTokenNamePaths(db,
|
|
14736
|
-
const cdfEntries = loadCDFComponents(db,
|
|
14958
|
+
replaceRawTokenNamePaths(db, sessionId2, automaticMappings, "automatic");
|
|
14959
|
+
const cdfEntries = loadCDFComponents(db, sessionId2);
|
|
14737
14960
|
if (cdfEntries.length === 0) {
|
|
14738
|
-
throw new MapTokensRunFailure({ type: "no-components", sessionId });
|
|
14961
|
+
throw new MapTokensRunFailure({ type: "no-components", sessionId: sessionId2 });
|
|
14739
14962
|
}
|
|
14740
14963
|
const mappablePropCount = countMappableProps(cdfEntries);
|
|
14741
|
-
const { groups, tokens } = getDtcgTokensForSession(db,
|
|
14964
|
+
const { groups, tokens } = getDtcgTokensForSession(db, sessionId2);
|
|
14742
14965
|
const tokenCount = tokens.length;
|
|
14743
14966
|
if (mappablePropCount === 0 || tokenCount === 0) {
|
|
14744
|
-
return { type: "nothing-to-map", sessionId, mappablePropCount, tokenCount };
|
|
14967
|
+
return { type: "nothing-to-map", sessionId: sessionId2, mappablePropCount, tokenCount, diagnostics };
|
|
14745
14968
|
}
|
|
14746
14969
|
const generatedCdf = Object.fromEntries(cdfEntries.map((c2) => [c2.key, c2.entry]));
|
|
14747
14970
|
const tokenTree = rebuildDTCGTree(groups, tokens);
|
|
14748
|
-
const componentSourceRefs = await loadComponentSourceRefs(db,
|
|
14971
|
+
const componentSourceRefs = await loadComponentSourceRefs(db, sessionId2);
|
|
14749
14972
|
const buildMapPrompt = () => buildPrompt({
|
|
14750
14973
|
skill: "map-tokens",
|
|
14751
14974
|
mode: "autonomous",
|
|
@@ -14759,28 +14982,28 @@ async function runMapTokens(request) {
|
|
|
14759
14982
|
});
|
|
14760
14983
|
if (request.printPrompt) {
|
|
14761
14984
|
const prompt2 = await buildMapPrompt();
|
|
14762
|
-
return { type: "printed-prompt", sessionId, prompt: prompt2 };
|
|
14985
|
+
return { type: "printed-prompt", sessionId: sessionId2, prompt: prompt2, diagnostics };
|
|
14763
14986
|
}
|
|
14764
14987
|
if (request.skipAgent) {
|
|
14765
|
-
const stepId2 = createStep(db,
|
|
14988
|
+
const stepId2 = createStep(db, sessionId2, "map tokens", {
|
|
14766
14989
|
agent: request.agent,
|
|
14767
14990
|
model: request.model ?? "",
|
|
14768
14991
|
skipAgent: "true"
|
|
14769
14992
|
});
|
|
14770
14993
|
updateStep(db, stepId2, "complete", { applied: "0", skipAgent: "true" });
|
|
14771
|
-
return { type: "skipped", sessionId, stepId: stepId2 };
|
|
14994
|
+
return { type: "skipped", sessionId: sessionId2, stepId: stepId2, diagnostics };
|
|
14772
14995
|
}
|
|
14773
14996
|
const agent = request.agent;
|
|
14774
14997
|
const noCache = request.cache === false || process.env["EDS_NO_CACHE"] === "1";
|
|
14775
14998
|
const promptHash = await hashPromptForSkill("map-tokens", agent, request.model, request.skillPathOverride, request.existingEntitiesInline ? [hashContent(request.existingEntitiesInline)] : [], request.skillContentOverride);
|
|
14776
|
-
const inputHash = computeMapTokensInputHash(db,
|
|
14999
|
+
const inputHash = computeMapTokensInputHash(db, sessionId2, componentSourceRefs);
|
|
14777
15000
|
if (!noCache) {
|
|
14778
15001
|
const cached = lookupCache(db, inputHash, "token_mapping", "__map_tokens__", promptHash);
|
|
14779
15002
|
if (cached) {
|
|
14780
|
-
const applied2 = copyMapTokensFromCache(db, cached.sourceSessionId,
|
|
14781
|
-
const stepId2 = createStep(db,
|
|
15003
|
+
const applied2 = copyMapTokensFromCache(db, cached.sourceSessionId, sessionId2);
|
|
15004
|
+
const stepId2 = createStep(db, sessionId2, "map tokens", { agent, model: request.model ?? "" });
|
|
14782
15005
|
updateStep(db, stepId2, "complete", { cached: "true", applied: String(applied2) });
|
|
14783
|
-
return { type: "cached", sessionId, applied: applied2, stepId: stepId2 };
|
|
15006
|
+
return { type: "cached", sessionId: sessionId2, applied: applied2, stepId: stepId2, diagnostics };
|
|
14784
15007
|
}
|
|
14785
15008
|
}
|
|
14786
15009
|
const binary = resolveBinary(agent);
|
|
@@ -14792,22 +15015,22 @@ async function runMapTokens(request) {
|
|
|
14792
15015
|
skillPath: resolveSkillPath("map-tokens")
|
|
14793
15016
|
});
|
|
14794
15017
|
}
|
|
14795
|
-
const stepId = createStep(db,
|
|
15018
|
+
const stepId = createStep(db, sessionId2, "map tokens", { agent, model: request.model ?? "" });
|
|
14796
15019
|
const prompt = await buildMapPrompt();
|
|
14797
15020
|
const invoker = createLocalCliAgentInvoker();
|
|
14798
15021
|
const result = await invoker.invoke({ agent, model: request.model, prompt, timeoutMs });
|
|
14799
15022
|
if (result.timedOut || result.exitCode !== 0) {
|
|
14800
15023
|
const error = result.timedOut ? `timed out after ${timeoutMs / 6e4} minutes` : describeAgentFailure(result);
|
|
14801
15024
|
updateStep(db, stepId, "failed", {}, error);
|
|
14802
|
-
throw new MapTokensRunFailure({ type: "agent-failed", sessionId, stepId, error });
|
|
15025
|
+
throw new MapTokensRunFailure({ type: "agent-failed", sessionId: sessionId2, stepId, error });
|
|
14803
15026
|
}
|
|
14804
15027
|
const { calls, warnings: parseWarnings } = parseMapTokenPropToolCalls(result.stdout);
|
|
14805
|
-
const { applied, warnings } = applyMapTokenPropCalls(db,
|
|
15028
|
+
const { applied, warnings } = applyMapTokenPropCalls(db, sessionId2, calls, parseWarnings);
|
|
14806
15029
|
if (!noCache) {
|
|
14807
|
-
storeCache(db, inputHash, "token_mapping", "__map_tokens__",
|
|
15030
|
+
storeCache(db, inputHash, "token_mapping", "__map_tokens__", sessionId2, false, promptHash);
|
|
14808
15031
|
}
|
|
14809
15032
|
updateStep(db, stepId, "complete", { applied: String(applied), warnings: String(warnings.length) });
|
|
14810
|
-
return { type: "applied", sessionId, applied, warnings, stepId };
|
|
15033
|
+
return { type: "applied", sessionId: sessionId2, applied, warnings, stepId, diagnostics };
|
|
14811
15034
|
} finally {
|
|
14812
15035
|
db.close();
|
|
14813
15036
|
}
|
|
@@ -15870,14 +16093,14 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
15870
16093
|
}
|
|
15871
16094
|
|
|
15872
16095
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/persist-slot-cycles.js
|
|
15873
|
-
async function persistSlotCycles(db,
|
|
16096
|
+
async function persistSlotCycles(db, sessionId2, components) {
|
|
15874
16097
|
const graph = components.map((c2) => ({
|
|
15875
16098
|
name: c2.name,
|
|
15876
16099
|
slots: c2.slots.map((s) => ({ name: s.name, allowedComponents: s.allowedComponents }))
|
|
15877
16100
|
}));
|
|
15878
16101
|
const cycles = findSlotCycles(graph);
|
|
15879
16102
|
const withBreaks = cycles.map((cycle) => ({ ...cycle, suggestedBreak: suggestCycleBreakEdge(cycle, cycles) }));
|
|
15880
|
-
await retryDatabaseWrite(() => storeSlotCycles(db,
|
|
16103
|
+
await retryDatabaseWrite(() => storeSlotCycles(db, sessionId2, withBreaks));
|
|
15881
16104
|
}
|
|
15882
16105
|
|
|
15883
16106
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/resolve-composition.js
|
|
@@ -16021,20 +16244,23 @@ async function runExtractAndComposeSession(request) {
|
|
|
16021
16244
|
onDebugEvent
|
|
16022
16245
|
});
|
|
16023
16246
|
await mkdir4(outDir, { recursive: true });
|
|
16024
|
-
const { sessionId } = getOrCreateSession(db, void 0, void 0, {
|
|
16247
|
+
const { sessionId: sessionId2 } = getOrCreateSession(db, void 0, void 0, {
|
|
16025
16248
|
command: "analyze extract",
|
|
16026
16249
|
inputPath: projectPath,
|
|
16027
16250
|
outDir
|
|
16028
16251
|
});
|
|
16029
|
-
await onSessionCreated?.(
|
|
16030
|
-
|
|
16252
|
+
await onSessionCreated?.(sessionId2);
|
|
16253
|
+
await bindAnalyticsSessionId(sessionId2);
|
|
16254
|
+
if (!isPipelineAnalyticsChild())
|
|
16255
|
+
await emitSessionStarted("analyze_extract");
|
|
16256
|
+
const stepId = createStep(db, sessionId2, "analyze extract", { project: projectPath });
|
|
16031
16257
|
if (cacheHits === 0 && !noCache) {
|
|
16032
16258
|
await persistExtractCache(db, sourceFiles, extraction.components, cacheVersion);
|
|
16033
16259
|
}
|
|
16034
16260
|
emitPreClassificationExclusions(extraction, onExclusion);
|
|
16035
16261
|
const classifiedComponents = extraction.components.map(preClassifyComponent);
|
|
16036
16262
|
const { components: initialValidatedComponents, warnings: filterWarnings } = await evaluateExtractionQuality(classifiedComponents);
|
|
16037
|
-
storeRawComponents(db,
|
|
16263
|
+
storeRawComponents(db, sessionId2, initialValidatedComponents);
|
|
16038
16264
|
const sources = resolveCompositionSources({ noCache, compositionRefresh });
|
|
16039
16265
|
const composition = await resolveComposition({
|
|
16040
16266
|
db,
|
|
@@ -16050,12 +16276,13 @@ async function runExtractAndComposeSession(request) {
|
|
|
16050
16276
|
onProgress,
|
|
16051
16277
|
onDebugEvent
|
|
16052
16278
|
});
|
|
16053
|
-
await retryDatabaseWrite(() => storeRawComponents(db,
|
|
16054
|
-
await persistSlotCycles(db,
|
|
16055
|
-
storeScannedFiles(db,
|
|
16056
|
-
await retryDatabaseWrite(() => updateStep(db, stepId, "complete", { sessionId }));
|
|
16279
|
+
await retryDatabaseWrite(() => storeRawComponents(db, sessionId2, composition.components, { preserveStatus: true }));
|
|
16280
|
+
await persistSlotCycles(db, sessionId2, composition.components);
|
|
16281
|
+
storeScannedFiles(db, sessionId2, sourceFiles.map((f) => relative2(projectPath, f)));
|
|
16282
|
+
await retryDatabaseWrite(() => updateStep(db, stepId, "complete", { sessionId: sessionId2 }));
|
|
16283
|
+
enrichCommandResult({ extracted_component_count: composition.components.length });
|
|
16057
16284
|
return {
|
|
16058
|
-
sessionId,
|
|
16285
|
+
sessionId: sessionId2,
|
|
16059
16286
|
compositionPhase: composition.phase,
|
|
16060
16287
|
components: composition.components,
|
|
16061
16288
|
warnings: [...extraction.warnings, ...filterWarnings],
|
|
@@ -16082,11 +16309,11 @@ init_resolve_prompt_override();
|
|
|
16082
16309
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-tokens-session/helpers/write-tokens-file.js
|
|
16083
16310
|
import { mkdir as mkdir5, writeFile as writeFile5 } from "node:fs/promises";
|
|
16084
16311
|
import { join as join15 } from "node:path";
|
|
16085
|
-
async function writeTokensFile(db,
|
|
16312
|
+
async function writeTokensFile(db, sessionId2, outDir, onProgress) {
|
|
16086
16313
|
onProgress?.({ kind: "writing-file" });
|
|
16087
|
-
const result = getDtcgTokensForSession(db,
|
|
16314
|
+
const result = getDtcgTokensForSession(db, sessionId2);
|
|
16088
16315
|
if (result.tokens.length === 0) {
|
|
16089
|
-
throw new Error(`generate tokens: no tokens persisted for session ${
|
|
16316
|
+
throw new Error(`generate tokens: no tokens persisted for session ${sessionId2}`);
|
|
16090
16317
|
}
|
|
16091
16318
|
const tree = rebuildDTCGTree(result.groups, result.tokens);
|
|
16092
16319
|
const tokensPath = join15(outDir, "tokens.json");
|
|
@@ -16116,6 +16343,7 @@ async function runGenerateTokensSession(request) {
|
|
|
16116
16343
|
outDir
|
|
16117
16344
|
});
|
|
16118
16345
|
await onSessionCreated?.(tokenSessionId);
|
|
16346
|
+
await bindAnalyticsSessionId(tokenSessionId);
|
|
16119
16347
|
const tokenPromptHash = await hashPromptForSkill("tokens", agent, agentModel, skillPath);
|
|
16120
16348
|
const warnings = [];
|
|
16121
16349
|
onProgress?.({ kind: "resolving" });
|
|
@@ -16179,9 +16407,9 @@ init_create_local_cli_agent_invoker();
|
|
|
16179
16407
|
init_cache_keys();
|
|
16180
16408
|
|
|
16181
16409
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/build-empty-session-response.js
|
|
16182
|
-
function buildEmptySessionResponse(
|
|
16410
|
+
function buildEmptySessionResponse(sessionId2) {
|
|
16183
16411
|
return {
|
|
16184
|
-
sessionId,
|
|
16412
|
+
sessionId: sessionId2,
|
|
16185
16413
|
results: [],
|
|
16186
16414
|
allOk: true,
|
|
16187
16415
|
renamedSlotsCount: 0,
|
|
@@ -16203,11 +16431,11 @@ function collectDuplicateNames(components) {
|
|
|
16203
16431
|
}
|
|
16204
16432
|
|
|
16205
16433
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/filter-dropped-allowed-components.js
|
|
16206
|
-
function filterDroppedAllowedComponents(db,
|
|
16207
|
-
const dropped = filterUnknownSlotAllowedComponents(db,
|
|
16434
|
+
function filterDroppedAllowedComponents(db, sessionId2, components, allowedComponentNames2, acceptedNames) {
|
|
16435
|
+
const dropped = filterUnknownSlotAllowedComponents(db, sessionId2, allowedComponentNames2);
|
|
16208
16436
|
if (dropped.length === 0)
|
|
16209
16437
|
return { components, dropped: [] };
|
|
16210
|
-
return { components: loadRawComponents(db,
|
|
16438
|
+
return { components: loadRawComponents(db, sessionId2, acceptedNames), dropped };
|
|
16211
16439
|
}
|
|
16212
16440
|
|
|
16213
16441
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/read-existing-entities.js
|
|
@@ -16275,8 +16503,8 @@ function buildFailedComponentResult(componentName, error, renamedSlotsCount) {
|
|
|
16275
16503
|
var DEFAULT_TIMEOUT_MS4 = Number(process.env["EDS_AGENT_TIMEOUT_MS"] ?? 5 * 60 * 1e3);
|
|
16276
16504
|
var RETRY_BACKOFF_MS = Number(process.env["EDS_RETRY_BACKOFF_MS"] ?? 5e3);
|
|
16277
16505
|
async function runOneGenerateComponent(options, component, index, total) {
|
|
16278
|
-
const { db, sessionId, invoker, agent, model, tokensInline, tokenMapInline, verbose, noCache, skillPathOverride, skillContentOverride, promptHash, existingContentfulEntities, existingTokensInline, precomputedCachedNames, allowedComponentNames: allowedComponentNames2, onProgress } = options;
|
|
16279
|
-
const { renames } = renameEmptySlots(db,
|
|
16506
|
+
const { db, sessionId: sessionId2, invoker, agent, model, tokensInline, tokenMapInline, verbose, noCache, skillPathOverride, skillContentOverride, promptHash, existingContentfulEntities, existingTokensInline, precomputedCachedNames, allowedComponentNames: allowedComponentNames2, onProgress } = options;
|
|
16507
|
+
const { renames } = renameEmptySlots(db, sessionId2, component.component_id, component.name, component.slots.length);
|
|
16280
16508
|
let effectiveSlots = component.slots;
|
|
16281
16509
|
if (renames.length > 0) {
|
|
16282
16510
|
const renameMap = new Map(renames.map((r) => [r.oldName, r.newName]));
|
|
@@ -16299,7 +16527,7 @@ async function runOneGenerateComponent(options, component, index, total) {
|
|
|
16299
16527
|
if (!noCache) {
|
|
16300
16528
|
const resolution = resolveComponentCache(db, component, promptHash, allowedComponentNames2);
|
|
16301
16529
|
if (resolution && !resolution.humanEdited) {
|
|
16302
|
-
copyComponentFromCache(db, resolution.entry.sourceSessionId,
|
|
16530
|
+
copyComponentFromCache(db, resolution.entry.sourceSessionId, sessionId2, component.component_id, true, {
|
|
16303
16531
|
allowedComponentNames: allowedComponentNames2
|
|
16304
16532
|
});
|
|
16305
16533
|
storeCache(db, hashComponentShape(cacheComponent), "component", component.component_id, resolution.entry.sourceSessionId, resolution.entry.humanEdited, promptHash);
|
|
@@ -16307,7 +16535,7 @@ async function runOneGenerateComponent(options, component, index, total) {
|
|
|
16307
16535
|
return buildCachedComponentResult(component.name);
|
|
16308
16536
|
}
|
|
16309
16537
|
if (resolution?.humanEdited) {
|
|
16310
|
-
copyComponentFromCache(db, resolution.entry.sourceSessionId,
|
|
16538
|
+
copyComponentFromCache(db, resolution.entry.sourceSessionId, sessionId2, component.component_id, true, {
|
|
16311
16539
|
allowedComponentNames: allowedComponentNames2
|
|
16312
16540
|
});
|
|
16313
16541
|
onProgress?.({ kind: "component:cached", index, total, name: component.name, pinned: true });
|
|
@@ -16363,11 +16591,11 @@ async function runOneGenerateComponent(options, component, index, total) {
|
|
|
16363
16591
|
lastError = describeAgentFailure(result);
|
|
16364
16592
|
continue;
|
|
16365
16593
|
}
|
|
16366
|
-
const applied = applyToolCalls(db,
|
|
16594
|
+
const applied = applyToolCalls(db, sessionId2, component.component_id, component.name, calls, warnings, {
|
|
16367
16595
|
allowedComponentNames: allowedComponentNames2
|
|
16368
16596
|
});
|
|
16369
16597
|
if (!noCache) {
|
|
16370
|
-
storeCache(db, hashComponentShape(cacheComponent), "component", component.component_id,
|
|
16598
|
+
storeCache(db, hashComponentShape(cacheComponent), "component", component.component_id, sessionId2, false, promptHash);
|
|
16371
16599
|
}
|
|
16372
16600
|
onProgress?.({
|
|
16373
16601
|
kind: "component:completed",
|
|
@@ -16412,18 +16640,18 @@ async function runWithPool(items, concurrency, worker) {
|
|
|
16412
16640
|
init_cache_keys();
|
|
16413
16641
|
|
|
16414
16642
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/restore-cached-components.js
|
|
16415
|
-
async function restoreCachedComponents(db,
|
|
16643
|
+
async function restoreCachedComponents(db, sessionId2, cachedComponents, promptHash, allowedComponentNames2) {
|
|
16416
16644
|
const restorations = [];
|
|
16417
16645
|
const rekeyed = [];
|
|
16418
16646
|
const componentStatus = db.prepare("SELECT status FROM raw_components WHERE session_id = ? AND component_id = ?");
|
|
16419
16647
|
for (const { component, resolution } of cachedComponents) {
|
|
16420
|
-
const current = componentStatus.get(
|
|
16648
|
+
const current = componentStatus.get(sessionId2, component.component_id);
|
|
16421
16649
|
if (current?.status === "generated")
|
|
16422
16650
|
continue;
|
|
16423
|
-
renameEmptySlots(db,
|
|
16651
|
+
renameEmptySlots(db, sessionId2, component.component_id, component.name, component.slots.length);
|
|
16424
16652
|
restorations.push({
|
|
16425
16653
|
sourceSessionId: resolution.entry.sourceSessionId,
|
|
16426
|
-
targetSessionId:
|
|
16654
|
+
targetSessionId: sessionId2,
|
|
16427
16655
|
componentId: component.component_id
|
|
16428
16656
|
});
|
|
16429
16657
|
rekeyed.push({ component, cached: resolution.entry });
|
|
@@ -16492,6 +16720,7 @@ async function runGenerateComponentsSession(request) {
|
|
|
16492
16720
|
const existingTokensHash = existingTokensInline ? [hashContent(existingTokensInline)] : [];
|
|
16493
16721
|
const agent = request.agent;
|
|
16494
16722
|
const promptHash = await hashPromptForSkill("components", agent, request.agentModel, effectiveSkillPath, existingTokensHash, prompt.text);
|
|
16723
|
+
await bindAnalyticsSessionId(request.sessionId);
|
|
16495
16724
|
const db = openPipelineDb();
|
|
16496
16725
|
try {
|
|
16497
16726
|
const acceptedNames = await loadAcceptedNames(request.sessionId);
|
|
@@ -17191,7 +17420,7 @@ function ExtractionScreen({
|
|
|
17191
17420
|
}
|
|
17192
17421
|
|
|
17193
17422
|
// packages/experience-design-system-types/dist/src/config/index.js
|
|
17194
|
-
import { randomBytes as
|
|
17423
|
+
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
17195
17424
|
import { mkdir as mkdir6, readFile as readFile18, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
17196
17425
|
import { homedir as homedir3 } from "node:os";
|
|
17197
17426
|
import { dirname as dirname13, join as join17 } from "node:path";
|
|
@@ -17210,7 +17439,7 @@ async function readSettings2() {
|
|
|
17210
17439
|
async function writeSettings2(settings) {
|
|
17211
17440
|
const path5 = configFilePath2();
|
|
17212
17441
|
await mkdir6(dirname13(path5), { recursive: true });
|
|
17213
|
-
const tmp = `${path5}.${process.pid}.${
|
|
17442
|
+
const tmp = `${path5}.${process.pid}.${randomBytes4(4).toString("hex")}.tmp`;
|
|
17214
17443
|
await writeFile6(tmp, `${JSON.stringify(settings, null, 2)}
|
|
17215
17444
|
`, { mode: 384 });
|
|
17216
17445
|
await rename2(tmp, path5);
|
|
@@ -17256,13 +17485,13 @@ async function runSelection(options) {
|
|
|
17256
17485
|
const db = openPipelineDb();
|
|
17257
17486
|
let components;
|
|
17258
17487
|
const cachedDecisions = /* @__PURE__ */ new Map();
|
|
17259
|
-
const
|
|
17488
|
+
const cliVersion2 = await getCliCacheVersion();
|
|
17260
17489
|
const promptHash = await hashSelectPrompt(options);
|
|
17261
17490
|
try {
|
|
17262
17491
|
components = loadRawComponents(db, options.sessionId);
|
|
17263
17492
|
if (!options.noCache) {
|
|
17264
17493
|
for (const component of components) {
|
|
17265
|
-
const cached = lookupSelectCache(db, hashComponentShape(component), promptHash,
|
|
17494
|
+
const cached = lookupSelectCache(db, hashComponentShape(component), promptHash, cliVersion2);
|
|
17266
17495
|
if (cached) cachedDecisions.set(component.name, { decision: cached.decision, reason: cached.reason });
|
|
17267
17496
|
}
|
|
17268
17497
|
}
|
|
@@ -17317,7 +17546,7 @@ async function runSelection(options) {
|
|
|
17317
17546
|
writeDb,
|
|
17318
17547
|
hashComponentShape(component),
|
|
17319
17548
|
promptHash,
|
|
17320
|
-
|
|
17549
|
+
cliVersion2,
|
|
17321
17550
|
rejected ? "rejected" : "accepted",
|
|
17322
17551
|
rejected ? reason : null
|
|
17323
17552
|
);
|
|
@@ -17398,12 +17627,12 @@ async function runExtraction(input, onProgress, deps = realDeps) {
|
|
|
17398
17627
|
}) : null;
|
|
17399
17628
|
let selection = null;
|
|
17400
17629
|
let selectionError;
|
|
17401
|
-
const startSelection = (
|
|
17630
|
+
const startSelection = (sessionId2) => {
|
|
17402
17631
|
if (selection) return;
|
|
17403
17632
|
selection = (async () => {
|
|
17404
17633
|
if (entities) await entities;
|
|
17405
17634
|
await deps.runSelection({
|
|
17406
|
-
sessionId,
|
|
17635
|
+
sessionId: sessionId2,
|
|
17407
17636
|
agent: input.agent,
|
|
17408
17637
|
model: input.agentModel,
|
|
17409
17638
|
...selectionPrompt,
|
|
@@ -17424,7 +17653,7 @@ async function runExtraction(input, onProgress, deps = realDeps) {
|
|
|
17424
17653
|
promptOverrides: input.promptOverrides,
|
|
17425
17654
|
noCache: input.noCache,
|
|
17426
17655
|
onProgress: (event) => update(applyProgressEvent(progress, event)),
|
|
17427
|
-
onSessionCreated: (
|
|
17656
|
+
onSessionCreated: (sessionId2) => startSelection(sessionId2)
|
|
17428
17657
|
});
|
|
17429
17658
|
} catch (error) {
|
|
17430
17659
|
return fail("analyze extract", errorMessage2(error));
|
|
@@ -17765,11 +17994,11 @@ function CyclesPanel({ cycles, cursor }) {
|
|
|
17765
17994
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/panels/reject-prompt.tsx
|
|
17766
17995
|
import { Box as Box13, Text as Text14 } from "ink";
|
|
17767
17996
|
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
17768
|
-
function RejectPrompt({ pending }) {
|
|
17997
|
+
function RejectPrompt({ pending: pending2 }) {
|
|
17769
17998
|
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", borderStyle: "single", borderColor: PALETTE2.warning, paddingX: 1, marginTop: 1, children: [
|
|
17770
|
-
/* @__PURE__ */ jsx16(Text14, { bold: true, color: PALETTE2.warning, children: `Rejecting ${
|
|
17771
|
-
|
|
17772
|
-
|
|
17999
|
+
/* @__PURE__ */ jsx16(Text14, { bold: true, color: PALETTE2.warning, children: `Rejecting ${pending2.target} will:` }),
|
|
18000
|
+
pending2.ancestors.length > 0 && /* @__PURE__ */ jsx16(Text14, { children: `- Reject ancestors: ${pending2.ancestors.join(", ")}` }),
|
|
18001
|
+
pending2.descendants.length > 0 && /* @__PURE__ */ jsx16(Text14, { children: `- Deselect descendants: ${pending2.descendants.join(", ")}` }),
|
|
17773
18002
|
/* @__PURE__ */ jsx16(Text14, { children: "[y] confirm \xB7 [n]/[Esc] cancel" })
|
|
17774
18003
|
] });
|
|
17775
18004
|
}
|
|
@@ -20278,11 +20507,11 @@ async function checkGenerationCache(input) {
|
|
|
20278
20507
|
}
|
|
20279
20508
|
|
|
20280
20509
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/load.ts
|
|
20281
|
-
function loadScopeGate(
|
|
20510
|
+
function loadScopeGate(sessionId2) {
|
|
20282
20511
|
try {
|
|
20283
20512
|
const db = openPipelineDb();
|
|
20284
20513
|
try {
|
|
20285
|
-
const components = loadScopeComponents(db,
|
|
20514
|
+
const components = loadScopeComponents(db, sessionId2);
|
|
20286
20515
|
if (components.length === 0) {
|
|
20287
20516
|
return { ok: false, message: "No components found for this session. Please run the import again." };
|
|
20288
20517
|
}
|
|
@@ -20301,8 +20530,8 @@ function loadScopeGate(sessionId) {
|
|
|
20301
20530
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
20302
20531
|
var realDeps2 = { load: loadScopeGate, checkCache: checkGenerationCache };
|
|
20303
20532
|
function useScopeGateFlow(input, deps = realDeps2) {
|
|
20304
|
-
const
|
|
20305
|
-
const loaded = useMemo3(() =>
|
|
20533
|
+
const sessionId2 = input?.sessionId;
|
|
20534
|
+
const loaded = useMemo3(() => sessionId2 ? deps.load(sessionId2) : void 0, [sessionId2]);
|
|
20306
20535
|
const cacheCheck = useRef5(void 0);
|
|
20307
20536
|
const [confirmed, setConfirmed] = useState13();
|
|
20308
20537
|
useEffect8(() => {
|
|
@@ -20479,7 +20708,7 @@ async function runGeneration(input, onProgress, deps = realDeps3) {
|
|
|
20479
20708
|
update({ mapTokens: "running" });
|
|
20480
20709
|
try {
|
|
20481
20710
|
const mapTokensOptions = await buildMapTokensOptions(input);
|
|
20482
|
-
await deps.runMapTokens({
|
|
20711
|
+
const mapResult = await deps.runMapTokens({
|
|
20483
20712
|
sessionId: input.sessionId,
|
|
20484
20713
|
agent: input.agent,
|
|
20485
20714
|
...input.agentModel ? { model: input.agentModel } : {},
|
|
@@ -20487,6 +20716,11 @@ async function runGeneration(input, onProgress, deps = realDeps3) {
|
|
|
20487
20716
|
skillPathOverride: MAP_TOKENS_SKILL_PATH,
|
|
20488
20717
|
...mapTokensOptions
|
|
20489
20718
|
});
|
|
20719
|
+
if (mapResult.diagnostics.length > 0) {
|
|
20720
|
+
process.stderr.write(`Unresolved token defaults:
|
|
20721
|
+
${mapResult.diagnostics.map((d) => ` ${d}`).join("\n")}
|
|
20722
|
+
`);
|
|
20723
|
+
}
|
|
20490
20724
|
} catch (error) {
|
|
20491
20725
|
const message = error instanceof MapTokensRunFailure ? error.message : error instanceof Error ? error.message : String(error);
|
|
20492
20726
|
return fail2("map tokens", message);
|
|
@@ -23835,17 +24069,17 @@ var TimeoutError = class extends Error {
|
|
|
23835
24069
|
};
|
|
23836
24070
|
var DEFAULT_TIMEOUT_MS6 = 15e3;
|
|
23837
24071
|
async function runLivePreview(opts) {
|
|
23838
|
-
const { sessionId, tokensPath, spaceId, environmentId, cmaToken, host, generation } = opts;
|
|
24072
|
+
const { sessionId: sessionId2, tokensPath, spaceId, environmentId, cmaToken, host, generation } = opts;
|
|
23839
24073
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS6;
|
|
23840
24074
|
if (!spaceId || !environmentId || !cmaToken) {
|
|
23841
24075
|
return { generation, response: null };
|
|
23842
24076
|
}
|
|
23843
24077
|
let components = [];
|
|
23844
|
-
if (
|
|
24078
|
+
if (sessionId2) {
|
|
23845
24079
|
const db = openPipelineDb();
|
|
23846
24080
|
try {
|
|
23847
|
-
backfillUnclassifiedProps(db,
|
|
23848
|
-
components = loadCDFComponents(db,
|
|
24081
|
+
backfillUnclassifiedProps(db, sessionId2);
|
|
24082
|
+
components = loadCDFComponents(db, sessionId2);
|
|
23849
24083
|
} finally {
|
|
23850
24084
|
db.close();
|
|
23851
24085
|
}
|
|
@@ -24762,7 +24996,7 @@ function useReviewPreview({
|
|
|
24762
24996
|
components,
|
|
24763
24997
|
loading,
|
|
24764
24998
|
livePreview,
|
|
24765
|
-
sessionId,
|
|
24999
|
+
sessionId: sessionId2,
|
|
24766
25000
|
tokensPath,
|
|
24767
25001
|
spaceId,
|
|
24768
25002
|
environmentId,
|
|
@@ -24789,7 +25023,7 @@ function useReviewPreview({
|
|
|
24789
25023
|
);
|
|
24790
25024
|
const livePreviewHook = useLivePreview({
|
|
24791
25025
|
enabled: livePreview,
|
|
24792
|
-
sessionId,
|
|
25026
|
+
sessionId: sessionId2,
|
|
24793
25027
|
tokensPath,
|
|
24794
25028
|
spaceId,
|
|
24795
25029
|
environmentId,
|
|
@@ -25077,7 +25311,7 @@ function GenerateReviewStepView({
|
|
|
25077
25311
|
() => loadReviewSessionState({
|
|
25078
25312
|
extractSessionId,
|
|
25079
25313
|
tokenSessionId,
|
|
25080
|
-
loadExtra: (db,
|
|
25314
|
+
loadExtra: (db, sessionId2) => loadSlotCycles(db, sessionId2),
|
|
25081
25315
|
sortEntries: (entries, cycles) => {
|
|
25082
25316
|
const cycleParticipants = /* @__PURE__ */ new Set();
|
|
25083
25317
|
for (const cycle of cycles ?? []) {
|
|
@@ -27603,10 +27837,10 @@ function realFlowDeps() {
|
|
|
27603
27837
|
preview: realPreviewDeps(),
|
|
27604
27838
|
push: realPushDeps(log),
|
|
27605
27839
|
save: realSaveDeps(),
|
|
27606
|
-
loadAcceptedComponents: (
|
|
27840
|
+
loadAcceptedComponents: (sessionId2) => {
|
|
27607
27841
|
const db = openPipelineDb();
|
|
27608
27842
|
try {
|
|
27609
|
-
return loadCDFComponents(db,
|
|
27843
|
+
return loadCDFComponents(db, sessionId2);
|
|
27610
27844
|
} finally {
|
|
27611
27845
|
db.close();
|
|
27612
27846
|
}
|
|
@@ -28631,9 +28865,9 @@ function App({ importOptions, inkClear }) {
|
|
|
28631
28865
|
}
|
|
28632
28866
|
await startExtraction(launch, "generate", result);
|
|
28633
28867
|
};
|
|
28634
|
-
const chooseTokenStrategy = (
|
|
28868
|
+
const chooseTokenStrategy = (pending2, tokenStrategy) => {
|
|
28635
28869
|
setPendingLaunch(void 0);
|
|
28636
|
-
void startExtraction(
|
|
28870
|
+
void startExtraction(pending2.launch, tokenStrategy, pending2.credentials);
|
|
28637
28871
|
};
|
|
28638
28872
|
const startExtraction = async (launch, tokenStrategy, credentials) => {
|
|
28639
28873
|
const settings = await readSettings2();
|