@thanh01.pmt/curriculum-kit 1.0.6 → 1.0.8

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.
@@ -116,6 +116,8 @@ interface MediaLedgerEntry {
116
116
  status: MediaLedgerStatus;
117
117
  /** Provider đã dùng (set khi done) */
118
118
  provider?: string;
119
+ /** Inline Markdown credit (tác giả + nguồn + license) — từ multimedia-kit AttributionBuilder */
120
+ attribution?: string;
119
121
  /** Path tương đối trong project sau khi done: _media/xxx.png */
120
122
  relPath?: string;
121
123
  /** Prompt cuối (đã enrich) — audit/debug */
@@ -144,6 +146,14 @@ declare class MediaLedger {
144
146
  setStatus(slug: string, status: MediaLedgerStatus, patch?: Partial<MediaLedgerEntry>): MediaLedgerEntry | undefined;
145
147
  /** Đếm ảnh đã done trong lesson — để Curator tôn trọng maxImages */
146
148
  doneCount(): number;
149
+ /**
150
+ * Scan artifact content và seed pending entries cho mọi placeholder [IMAGE: slug].
151
+ * Được gọi sau khi agent sinh artifact (trước khi Curator duyệt) — đây là cầu nối
152
+ * duy nhất giữa "agent chèn placeholder" và "sổ cái có entry để Curator/Fulfiller xử".
153
+ * Idempotent: slug đã có entry active (pending/approved/done) → giữ nguyên;
154
+ * chỉ re-describe khi entry trước bị rejected/failed.
155
+ */
156
+ seedFromArtifact(artifactId: string, content: string): MediaLedgerEntry[];
147
157
  }
148
158
 
149
159
  type MediaPolicyMode = 'search_only' | 'gen_only' | 'auto';
@@ -116,6 +116,8 @@ interface MediaLedgerEntry {
116
116
  status: MediaLedgerStatus;
117
117
  /** Provider đã dùng (set khi done) */
118
118
  provider?: string;
119
+ /** Inline Markdown credit (tác giả + nguồn + license) — từ multimedia-kit AttributionBuilder */
120
+ attribution?: string;
119
121
  /** Path tương đối trong project sau khi done: _media/xxx.png */
120
122
  relPath?: string;
121
123
  /** Prompt cuối (đã enrich) — audit/debug */
@@ -144,6 +146,14 @@ declare class MediaLedger {
144
146
  setStatus(slug: string, status: MediaLedgerStatus, patch?: Partial<MediaLedgerEntry>): MediaLedgerEntry | undefined;
145
147
  /** Đếm ảnh đã done trong lesson — để Curator tôn trọng maxImages */
146
148
  doneCount(): number;
149
+ /**
150
+ * Scan artifact content và seed pending entries cho mọi placeholder [IMAGE: slug].
151
+ * Được gọi sau khi agent sinh artifact (trước khi Curator duyệt) — đây là cầu nối
152
+ * duy nhất giữa "agent chèn placeholder" và "sổ cái có entry để Curator/Fulfiller xử".
153
+ * Idempotent: slug đã có entry active (pending/approved/done) → giữ nguyên;
154
+ * chỉ re-describe khi entry trước bị rejected/failed.
155
+ */
156
+ seedFromArtifact(artifactId: string, content: string): MediaLedgerEntry[];
147
157
  }
148
158
 
149
159
  type MediaPolicyMode = 'search_only' | 'gen_only' | 'auto';
@@ -228,6 +228,36 @@ var MediaLedger = class {
228
228
  doneCount() {
229
229
  return this.listByStatus("done").length;
230
230
  }
231
+ /**
232
+ * Scan artifact content và seed pending entries cho mọi placeholder [IMAGE: slug].
233
+ * Được gọi sau khi agent sinh artifact (trước khi Curator duyệt) — đây là cầu nối
234
+ * duy nhất giữa "agent chèn placeholder" và "sổ cái có entry để Curator/Fulfiller xử".
235
+ * Idempotent: slug đã có entry active (pending/approved/done) → giữ nguyên;
236
+ * chỉ re-describe khi entry trước bị rejected/failed.
237
+ */
238
+ seedFromArtifact(artifactId, content) {
239
+ const seeded = [];
240
+ const re = /\[IMAGE\s*:\s*([a-z0-9][a-z0-9-]*)\s*\]/gi;
241
+ const seen = /* @__PURE__ */ new Set();
242
+ let m;
243
+ while ((m = re.exec(content)) !== null) {
244
+ const slug = m[1].toLowerCase();
245
+ if (seen.has(slug)) continue;
246
+ seen.add(slug);
247
+ const existing = this.entries.get(slug);
248
+ const isActive = existing && (existing.status === "pending" || existing.status === "approved" || existing.status === "done");
249
+ if (isActive) continue;
250
+ seeded.push(this.upsert({
251
+ slug,
252
+ artifactId,
253
+ name: slug.replace(/^(img-|image-)/, "").replace(/-/g, " "),
254
+ description: `Placeholder ch\xE8n b\u1EDFi agent trong artifact ${artifactId} \u2014 ch\u1EDD Curator enrich (m\xF4 t\u1EA3 g\u1ED1c ch\u01B0a c\xF3).`,
255
+ mode: "generate",
256
+ status: "pending"
257
+ }));
258
+ }
259
+ return seeded;
260
+ }
231
261
  };
232
262
 
233
263
  // src/errors/index.ts