@treeseed/sdk 0.6.16 → 0.6.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/db/d1.d.ts +3493 -0
  2. package/dist/db/d1.js +8 -0
  3. package/dist/db/index.d.ts +2 -0
  4. package/dist/db/index.js +2 -0
  5. package/dist/db/node-sqlite.d.ts +3544 -0
  6. package/dist/db/node-sqlite.js +119 -0
  7. package/dist/db/schema.d.ts +6272 -0
  8. package/dist/db/schema.js +231 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.js +1 -0
  11. package/dist/operations/providers/default.js +1 -0
  12. package/dist/operations/services/commit-message-provider.d.ts +33 -1
  13. package/dist/operations/services/commit-message-provider.js +228 -51
  14. package/dist/operations/services/config-runtime.js +0 -1
  15. package/dist/operations/services/deploy.d.ts +19 -5
  16. package/dist/operations/services/deploy.js +75 -36
  17. package/dist/operations/services/github-actions-verification.d.ts +123 -0
  18. package/dist/operations/services/github-actions-verification.js +440 -0
  19. package/dist/operations/services/mailpit-runtime.d.ts +5 -0
  20. package/dist/operations/services/mailpit-runtime.js +2 -2
  21. package/dist/operations/services/repository-save-orchestrator.js +64 -8
  22. package/dist/operations/services/runtime-tools.d.ts +6 -0
  23. package/dist/operations/services/runtime-tools.js +11 -0
  24. package/dist/operations-registry.js +1 -0
  25. package/dist/platform/contracts.d.ts +6 -0
  26. package/dist/platform/deploy-config.js +17 -0
  27. package/dist/reconcile/builtin-adapters.js +2 -16
  28. package/dist/reconcile/contracts.d.ts +1 -1
  29. package/dist/reconcile/desired-state.d.ts +6 -0
  30. package/dist/reconcile/desired-state.js +1 -13
  31. package/dist/reconcile/engine.d.ts +12 -0
  32. package/dist/reconcile/state.js +2 -1
  33. package/dist/reconcile/units.js +0 -1
  34. package/dist/scripts/tenant-d1-migrate-local.js +5 -2
  35. package/dist/scripts/tenant-destroy.js +3 -1
  36. package/dist/sdk.js +2 -6
  37. package/dist/types/cloudflare.d.ts +0 -1
  38. package/dist/workflow/operations.d.ts +2 -1
  39. package/dist/workflow/operations.js +115 -35
  40. package/dist/workflow-support.d.ts +1 -0
  41. package/dist/workflow-support.js +6 -0
  42. package/dist/workflow.d.ts +24 -2
  43. package/dist/workflow.js +6 -0
  44. package/package.json +19 -5
  45. package/templates/github/deploy.workflow.yml +4 -0
  46. package/dist/wrangler-d1.d.ts +0 -25
  47. package/dist/wrangler-d1.js +0 -89
@@ -1,5 +1,7 @@
1
1
  const DEFAULT_COMMIT_AI_MODEL = "@cf/google/gemma-4-26b-a4b-it";
2
2
  const allowedTypes = /* @__PURE__ */ new Set(["feat", "fix", "refactor", "test", "docs", "build", "ci", "chore"]);
3
+ const allowedSectionHeadings = /* @__PURE__ */ new Set(["Intent", "Changes", "Integrated package changes", "Dependency and pointer updates"]);
4
+ const forbiddenSectionHeadings = /* @__PURE__ */ new Set(["Why", "Validation"]);
3
5
  const danglingSubjectEndings = /* @__PURE__ */ new Set([
4
6
  "a",
5
7
  "an",
@@ -29,6 +31,7 @@ const danglingSubjectEndings = /* @__PURE__ */ new Set([
29
31
  ]);
30
32
  const defaultTimeoutMs = 3e4;
31
33
  const defaultMaxDiffChars = 12e3;
34
+ const subjectMaxLength = 72;
32
35
  function envValue(env, key) {
33
36
  const value = env[key];
34
37
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
@@ -44,9 +47,31 @@ function stripControlCharacters(value) {
44
47
  function normalizeWhitespace(value) {
45
48
  return stripControlCharacters(value).replace(/\s+/gu, " ").trim();
46
49
  }
50
+ function compactValue(value, maxLength = 120) {
51
+ const normalized = normalizeWhitespace(String(value ?? ""));
52
+ if (normalized.length <= maxLength) return normalized;
53
+ return `${normalized.slice(0, maxLength - 1).trim()}...`;
54
+ }
55
+ function shortSha(value) {
56
+ const normalized = String(value ?? "").trim();
57
+ return normalized ? normalized.slice(0, 12) : "unknown";
58
+ }
47
59
  function changedPaths(changedFiles) {
48
60
  return changedFiles.split(/\r?\n/u).map((line) => line.trim()).filter(Boolean).map((line) => line.replace(/^([MADRCU?!]{1,2})\s+/u, "").trim()).filter(Boolean);
49
61
  }
62
+ function changedFileGroups(paths) {
63
+ const counts = /* @__PURE__ */ new Map();
64
+ for (const path of paths) {
65
+ const group = path.startsWith(".github/") || path.includes("/workflows/") ? "ci" : /(^|\/)(test|tests|__tests__)\/|\.test\.|\.spec\./u.test(path) ? "tests" : path.startsWith("docs/") || /\.(md|mdx|txt)$/u.test(path) ? "docs" : path.includes("workflow") || path.includes("repository-save-orchestrator") ? "workflow" : path.includes("package-reference") || path.includes("release") || path.includes("publish") ? "release" : /(^|\/)(package|package-lock)\.json$/u.test(path) || path.includes("build") || path.includes("scripts/") ? "build" : path.includes("config") || path.endsWith(".yaml") || path.endsWith(".yml") ? "config" : path.startsWith("migrations/") || path.includes("/db/") ? "database" : path.startsWith("src/pages/") || path.startsWith("src/layouts/") || path.includes("/ui/") ? "ui" : path.startsWith("src/api/") || path.includes("/api/") ? "api" : "source";
66
+ counts.set(group, (counts.get(group) ?? 0) + 1);
67
+ }
68
+ return [...counts.entries()].sort((left, right) => right[1] - left[1] || left[0].localeCompare(right[0]));
69
+ }
70
+ function formatGroups(paths) {
71
+ const groups = changedFileGroups(paths);
72
+ if (groups.length === 0) return "none";
73
+ return groups.map(([group, count]) => `${group}: ${count}`).join(", ");
74
+ }
50
75
  function conventionalParts(message) {
51
76
  const value = String(message ?? "").trim();
52
77
  const match = value.match(/^([a-z]+)(?:\(([a-z0-9-]+)\))?:\s*(.+)$/iu);
@@ -73,12 +98,9 @@ function inferType(context) {
73
98
  function inferScope(context) {
74
99
  const conventional = conventionalParts(context.userMessage);
75
100
  if (conventional?.scope) return conventional.scope;
76
- const counts = /* @__PURE__ */ new Map();
77
- for (const path of changedPaths(context.changedFiles)) {
78
- const scope = path.startsWith(".github/") ? "ci" : path.includes("workflow") || path.includes("repository-save-orchestrator") ? "workflow" : path.includes("package-reference") || path.includes("publish") || path.includes("release") ? "release" : path.includes("save") ? "save" : path.includes("cli/") || path.startsWith("src/cli") || path.includes("operations-registry") ? "cli" : path.includes("config") || path.endsWith(".yaml") || path.endsWith(".yml") ? "config" : path.includes("test") || path.includes("__tests__") ? "tests" : path.endsWith(".md") || path.endsWith(".mdx") ? "docs" : path.includes("package.json") || path.includes("package-lock.json") || path.includes("build") ? "build" : context.branchMode === "package-dev-save" ? "save" : "workflow";
79
- counts.set(scope, (counts.get(scope) ?? 0) + 1);
80
- }
81
- return [...counts.entries()].sort((left, right) => right[1] - left[1] || left[0].localeCompare(right[0]))[0]?.[0] ?? (context.branchMode === "package-release-main" ? "release" : "save");
101
+ if ((context.packageChanges?.length ?? 0) > 0 || (context.submodulePointers?.length ?? 0) > 0) return "deps";
102
+ const groups = changedFileGroups(changedPaths(context.changedFiles));
103
+ return groups[0]?.[0] ?? (context.branchMode === "package-release-main" ? "release" : "save");
82
104
  }
83
105
  function summaryFromHint(message) {
84
106
  const conventional = conventionalParts(message);
@@ -103,19 +125,19 @@ function repairSummaryEnding(summary, fallback = "record changes") {
103
125
  function fallbackSummary(context, type, scope) {
104
126
  const hint = summaryFromHint(context.userMessage);
105
127
  if (hint) return repairSummaryEnding(hint);
128
+ if ((context.packageChanges?.length ?? 0) > 0 || (context.submodulePointers?.length ?? 0) > 0) return "sync integrated package updates";
129
+ if ((context.dependencyUpdates?.length ?? 0) > 0) return "sync package dependency references";
106
130
  if (context.branchMode === "package-release-main") return "prepare stable release";
107
- if (scope === "cli") return "allow save without message";
108
- if (scope === "release" || scope === "ci") return "guard dev tags from publish";
109
- if (scope === "workflow" || scope === "save") return "generate save commit messages";
110
- if (type === "test") return "cover save workflow behavior";
111
- if (type === "docs") return "update workflow guidance";
112
- if (type === "build") return "update package build metadata";
113
- return "record workflow changes";
131
+ if (scope === "workflow" || scope === "save") return "update save workflow behavior";
132
+ if (type === "test") return "cover workflow behavior";
133
+ if (type === "docs") return "update workflow documentation";
134
+ if (type === "build") return "update package metadata";
135
+ return "record repository changes";
114
136
  }
115
137
  function truncateSubject(type, scope, summary) {
116
138
  const prefix = `${type}(${scope}): `;
117
139
  const cleanSummary = repairSummaryEnding(summary);
118
- const maxSummaryLength = Math.max(10, 50 - prefix.length);
140
+ const maxSummaryLength = Math.max(10, subjectMaxLength - prefix.length);
119
141
  if (cleanSummary.length <= maxSummaryLength) return `${prefix}${cleanSummary}`;
120
142
  const sliced = cleanSummary.slice(0, maxSummaryLength).replace(/\s+\S*$/u, "").trim();
121
143
  const repaired = repairSummaryEnding(sliced || cleanSummary.slice(0, maxSummaryLength).trim());
@@ -142,46 +164,163 @@ function formatBullet(text) {
142
164
  const lines = wrapText(text, 70);
143
165
  return lines.map((line, index) => `${index === 0 ? "-" : " "} ${line}`).join("\n");
144
166
  }
145
- function formatCommitMessage(type, scope, summary, bullets) {
167
+ function normalizeSectionBullets(values) {
168
+ return (values ?? []).map((value) => normalizeWhitespace(value)).filter(Boolean);
169
+ }
170
+ function normalizeSections(sections) {
171
+ if (Array.isArray(sections)) {
172
+ return { changes: normalizeSectionBullets(sections) };
173
+ }
174
+ return {
175
+ intent: normalizeSectionBullets(sections.intent),
176
+ changes: normalizeSectionBullets(sections.changes),
177
+ packageChanges: normalizeSectionBullets(sections.packageChanges),
178
+ dependencyUpdates: normalizeSectionBullets(sections.dependencyUpdates)
179
+ };
180
+ }
181
+ function formatSection(heading, bullets) {
182
+ if (bullets.length === 0) return null;
183
+ return [heading, ...bullets.map(formatBullet)].join("\n");
184
+ }
185
+ function formatCommitMessage(type, scope, summary, sections) {
146
186
  const normalizedType = allowedTypes.has(type) ? type : "chore";
147
187
  const normalizedScope = scope.toLowerCase().replace(/[^a-z0-9-]+/gu, "-").replace(/^-+|-+$/gu, "") || "workflow";
148
188
  const subject = truncateSubject(normalizedType, normalizedScope, summary);
149
- const body = bullets.map((bullet) => normalizeWhitespace(bullet)).filter(Boolean).slice(0, 3).map(formatBullet).join("\n");
189
+ const normalizedSections = normalizeSections(sections);
190
+ const changes = normalizedSections.changes.length > 0 ? normalizedSections.changes : ["Records the staged repository changes supplied to the save workflow."];
191
+ const body = [
192
+ formatSection("Intent:", normalizedSections.intent ?? []),
193
+ formatSection("Changes:", changes),
194
+ formatSection("Integrated package changes:", normalizedSections.packageChanges ?? []),
195
+ formatSection("Dependency and pointer updates:", normalizedSections.dependencyUpdates ?? [])
196
+ ].filter((section) => Boolean(section)).join("\n\n");
150
197
  return `${subject}
151
198
 
152
199
  ${body}`;
153
200
  }
201
+ function packageChangeBullet(change) {
202
+ const details = [
203
+ `${change.name} ${change.path}: ${shortSha(change.oldSha)} -> ${shortSha(change.newSha)}`,
204
+ change.tagName || change.version ? `tag ${change.tagName ?? change.version}` : null,
205
+ change.dependencySpec ? `dependency ${compactValue(change.dependencySpec, 96)}` : null,
206
+ change.commitSubject ? `child: ${compactValue(change.commitSubject, 96)}` : null
207
+ ].filter(Boolean);
208
+ return details.join(", ");
209
+ }
210
+ function dependencyUpdateBullet(update) {
211
+ const field = update.field ? `${update.field}.` : "";
212
+ const tag = update.tagName ? `, previous tag ${update.tagName}` : "";
213
+ return `${field}${update.packageName}: ${compactValue(update.from, 90)} -> ${compactValue(update.to, 90)}${tag}`;
214
+ }
215
+ function pointerUpdateBullet(pointer) {
216
+ const label = pointer.packageName ? `${pointer.packageName} ${pointer.path}` : pointer.path;
217
+ return `${label}: ${shortSha(pointer.oldSha)} -> ${shortSha(pointer.newSha)}`;
218
+ }
219
+ function fallbackChanges(context) {
220
+ const paths = changedPaths(context.changedFiles);
221
+ const bullets = [];
222
+ if (paths.length > 0) {
223
+ bullets.push(`Updates ${paths.length} file${paths.length === 1 ? "" : "s"} across ${formatGroups(paths)}.`);
224
+ bullets.push(`Touches ${paths.slice(0, 6).join(", ")}${paths.length > 6 ? ", ..." : ""}.`);
225
+ } else {
226
+ bullets.push("Records the staged repository changes supplied to the save workflow.");
227
+ }
228
+ if (context.plannedTag || context.plannedVersion) {
229
+ bullets.push(`Plans package version/tag ${context.plannedTag ?? context.plannedVersion} for ${context.repoName}.`);
230
+ }
231
+ return bullets;
232
+ }
154
233
  function generateFallbackCommitMessage(context) {
155
234
  const type = inferType(context);
156
235
  const scope = inferScope(context);
157
236
  const summary = fallbackSummary(context, type, scope);
158
- const bullets = [
159
- context.userMessage?.trim() ? `Uses the provided save hint to describe why the ${scope} checkpoint is necessary.` : `Records the current ${scope} changes in the standard save workflow.`,
160
- context.branchMode === "package-dev-save" ? "Keeps development package state on Git tags without publishing stable NPM releases." : context.branchMode === "package-release-main" ? "Prepares stable package metadata for the main branch release path." : "Preserves the project branch state for the parent workflow.",
161
- "Keeps the message deterministic when AI generation is unavailable."
237
+ const intent = context.userMessage?.trim() ? [`Save hint: ${summaryFromHint(context.userMessage) ?? normalizeWhitespace(context.userMessage)}`] : [];
238
+ const dependencyUpdates = [
239
+ ...(context.dependencyUpdates ?? []).map(dependencyUpdateBullet),
240
+ ...(context.submodulePointers ?? []).map(pointerUpdateBullet)
162
241
  ];
163
- return formatCommitMessage(type, scope, summary, bullets);
242
+ return formatCommitMessage(type, scope, summary, {
243
+ intent,
244
+ changes: fallbackChanges(context),
245
+ packageChanges: (context.packageChanges ?? []).map(packageChangeBullet),
246
+ dependencyUpdates
247
+ });
248
+ }
249
+ function sectionKey(heading) {
250
+ if (heading === "Intent") return "intent";
251
+ if (heading === "Changes") return "changes";
252
+ if (heading === "Integrated package changes") return "packageChanges";
253
+ if (heading === "Dependency and pointer updates") return "dependencyUpdates";
254
+ return null;
255
+ }
256
+ function parseCommitSections(lines) {
257
+ const sections = {
258
+ intent: [],
259
+ changes: [],
260
+ packageChanges: [],
261
+ dependencyUpdates: []
262
+ };
263
+ let current = null;
264
+ let lastBullet = null;
265
+ for (const rawLine of lines) {
266
+ const line = rawLine.trimEnd();
267
+ if (!line.trim()) continue;
268
+ const headingMatch = line.trim().match(/^([^:]+):$/u);
269
+ if (headingMatch) {
270
+ const heading = headingMatch[1].trim();
271
+ if (forbiddenSectionHeadings.has(heading)) {
272
+ throw new Error(`AI commit message included forbidden ${heading} section.`);
273
+ }
274
+ if (!allowedSectionHeadings.has(heading)) {
275
+ throw new Error(`AI commit message included unsupported ${heading} section.`);
276
+ }
277
+ current = sectionKey(heading);
278
+ lastBullet = null;
279
+ continue;
280
+ }
281
+ if (!current) {
282
+ throw new Error("AI commit message included body text before a supported section.");
283
+ }
284
+ if (line.trim().startsWith("- ")) {
285
+ lastBullet = line.trim().replace(/^-\s*/u, "");
286
+ sections[current].push(lastBullet);
287
+ continue;
288
+ }
289
+ if (/^\s+/u.test(line) && lastBullet != null) {
290
+ sections[current][sections[current].length - 1] = `${sections[current][sections[current].length - 1]} ${line.trim()}`;
291
+ continue;
292
+ }
293
+ throw new Error("AI commit message section content must use bullets.");
294
+ }
295
+ return sections;
164
296
  }
165
- function assertCommitTemplate(message) {
297
+ function assertCommitTemplate(message, context) {
166
298
  const normalized = stripControlCharacters(message).replace(/^```(?:text)?\s*/iu, "").replace(/```\s*$/u, "").trim();
167
299
  const [subject = "", ...rest] = normalized.split(/\r?\n/u);
168
- if (!/^(feat|fix|refactor|test|docs|build|ci|chore)\([a-z0-9-]+\): .+/u.test(subject.trim())) {
300
+ const subjectMatch = subject.trim().match(/^(feat|fix|refactor|test|docs|build|ci|chore)\(([a-z0-9-]+)\):\s*(.+)$/u);
301
+ if (!subjectMatch) {
169
302
  throw new Error("AI commit message did not use the required subject template.");
170
303
  }
171
- const summary = subject.replace(/^[a-z]+\([^)]+\):\s*/u, "").trim();
304
+ const [, type, scope, summary] = subjectMatch;
172
305
  if (danglingSubjectEndings.has(lastSummaryWord(summary))) {
173
306
  throw new Error("AI commit message subject appears truncated.");
174
307
  }
175
- const bullets = rest.map((line) => line.trim()).filter((line) => line.startsWith("- "));
176
- if (bullets.length === 0) {
177
- throw new Error("AI commit message did not include body bullets.");
308
+ const sections = parseCommitSections(rest);
309
+ if (sections.changes.length === 0) {
310
+ throw new Error("AI commit message did not include a Changes section.");
178
311
  }
179
- return formatCommitMessage(
180
- subject.split("(")[0],
181
- subject.match(/\(([^)]+)\)/u)?.[1] ?? "workflow",
182
- subject.replace(/^[a-z]+\([^)]+\):\s*/u, ""),
183
- bullets.map((line) => line.replace(/^-\s*/u, ""))
184
- );
312
+ if (sections.intent.length > 0 && !context.userMessage?.trim()) {
313
+ throw new Error("AI commit message included Intent without a save hint.");
314
+ }
315
+ if (context.userMessage?.trim() && sections.intent.length === 0) {
316
+ throw new Error("AI commit message omitted Intent for the provided save hint.");
317
+ }
318
+ return formatCommitMessage(type, scope, summary, {
319
+ intent: sections.intent,
320
+ changes: sections.changes,
321
+ packageChanges: sections.packageChanges,
322
+ dependencyUpdates: sections.dependencyUpdates
323
+ });
185
324
  }
186
325
  function cloudflareEndpoint(accountId, model, gatewayId) {
187
326
  const normalizedModel = model.replace(/^\/+/u, "");
@@ -190,33 +329,71 @@ function cloudflareEndpoint(accountId, model, gatewayId) {
190
329
  }
191
330
  return `https://api.cloudflare.com/client/v4/accounts/${encodeURIComponent(accountId)}/ai/run/${normalizedModel}`;
192
331
  }
332
+ function contextLines(context) {
333
+ const paths = changedPaths(context.changedFiles);
334
+ const dependencyUpdates = [
335
+ ...(context.dependencyUpdates ?? []).map(dependencyUpdateBullet),
336
+ ...(context.submodulePointers ?? []).map(pointerUpdateBullet)
337
+ ];
338
+ return [
339
+ "Repository context:",
340
+ `Repo: ${context.repoName}`,
341
+ `Path: ${context.repoPath}`,
342
+ `Branch: ${context.branch}`,
343
+ `Mode: ${context.branchMode}`,
344
+ `Kind: ${context.kind}`,
345
+ context.userMessage ? `User hint: ${context.userMessage}` : "User hint: none",
346
+ context.plannedVersion ? `Planned version: ${context.plannedVersion}` : null,
347
+ context.plannedTag ? `Planned tag: ${context.plannedTag}` : null,
348
+ "",
349
+ "Changed file groups:",
350
+ formatGroups(paths),
351
+ "",
352
+ "Changed files:",
353
+ paths.length > 0 ? paths.join("\n") : "(none)",
354
+ "",
355
+ "Integrated package changes:",
356
+ (context.packageChanges ?? []).length > 0 ? (context.packageChanges ?? []).map(packageChangeBullet).join("\n") : "(none)",
357
+ "",
358
+ "Dependency and pointer updates:",
359
+ dependencyUpdates.length > 0 ? dependencyUpdates.join("\n") : "(none)"
360
+ ].filter((line) => line !== null);
361
+ }
193
362
  function cloudflarePrompt(context, maxDiffChars) {
194
363
  return {
195
364
  system: [
196
- "Generate exactly one Git commit message.",
197
- "Use this template:",
198
- "type(scope): short imperative summary",
365
+ "You are an accurate repository historian generating one Git commit message.",
366
+ "You have no tool access. You cannot inspect files, history, tests, or prompts.",
367
+ "Use only the repository facts supplied in the user message.",
368
+ "Do not infer motivation, goals, test results, or validation results.",
369
+ "Do not include a Why section or a Validation section.",
199
370
  "",
200
- "- Explain why this change is necessary.",
201
- "- Mention any side effects or constraints.",
202
- "- Use 72 character wrap.",
371
+ "Required output shape:",
372
+ "type(scope): imperative summary",
373
+ "",
374
+ "Intent:",
375
+ '- Include this section only when User hint is not "none". Summarize the hint without inventing motivation.',
376
+ "",
377
+ "Changes:",
378
+ "- Describe concrete code, schema, config, docs, and test changes from the supplied facts.",
379
+ "",
380
+ "Integrated package changes:",
381
+ "- Include this section only when package changes are supplied.",
382
+ "",
383
+ "Dependency and pointer updates:",
384
+ "- Include this section only when dependency or submodule pointer updates are supplied.",
203
385
  "",
204
386
  "Use only these types: feat, fix, refactor, test, docs, build, ci, chore.",
205
387
  "Infer scope from the changed area, not from the repository name.",
206
- "Do not include repository name or package version in save messages.",
388
+ "Keep the subject concise; body lines should wrap at 72 characters.",
207
389
  "Return only the commit message."
208
390
  ].join("\n"),
209
391
  user: [
210
- `Branch: ${context.branch}`,
211
- `Mode: ${context.branchMode}`,
212
- `Kind: ${context.kind}`,
213
- context.userMessage ? `User hint: ${context.userMessage}` : "User hint: none",
214
- context.plannedTag ? `Planned tag: ${context.plannedTag}` : null,
215
- "Changed files:",
216
- context.changedFiles || "(none)",
217
- "Diff:",
392
+ ...contextLines(context),
393
+ "",
394
+ "Diff (truncated; structured context above is complete):",
218
395
  context.diff.slice(0, maxDiffChars) || "(none)"
219
- ].filter((line) => line !== null).join("\n")
396
+ ].join("\n")
220
397
  };
221
398
  }
222
399
  function extractCloudflareText(payload) {
@@ -268,7 +445,7 @@ async function generateCloudflareCommitMessage(context, env, fetchImpl) {
268
445
  if (!text) {
269
446
  throw new Error("Cloudflare commit AI returned an empty response.");
270
447
  }
271
- return assertCommitTemplate(text);
448
+ return assertCommitTemplate(text, context);
272
449
  } finally {
273
450
  clearTimeout(timeout);
274
451
  }
@@ -283,7 +460,7 @@ async function generateRepositoryCommitMessage(context, options = {}) {
283
460
  if (mode === "generated" && options.provider) {
284
461
  try {
285
462
  return {
286
- message: assertCommitTemplate(await Promise.resolve(options.provider.generate(context))),
463
+ message: assertCommitTemplate(await Promise.resolve(options.provider.generate(context)), context),
287
464
  provider: "cloudflare-workers-ai",
288
465
  fallbackUsed: false,
289
466
  error: null
@@ -191,7 +191,6 @@ function writeDeploySummary(write, summary) {
191
191
  write(` Account ID: ${summary.accountId}`);
192
192
  write(` D1: ${summary.siteDataDb.databaseName} (${summary.siteDataDb.databaseId})`);
193
193
  write(` KV FORM_GUARD_KV: ${summary.formGuardKv.id}`);
194
- write(` KV SESSION: ${summary.sessionKv.id}`);
195
194
  }
196
195
  function syncManagedServiceSettingsFromDeployConfig(tenantRoot) {
197
196
  const config = loadTreeseedMachineConfig(tenantRoot);
@@ -165,6 +165,9 @@ export declare function ensureGeneratedWranglerConfig(tenantRoot: any, options?:
165
165
  rootDir: string | undefined;
166
166
  publicBaseUrl: string | undefined;
167
167
  localBaseUrl: string | undefined;
168
+ local: {
169
+ runtime: string | undefined;
170
+ } | undefined;
168
171
  environments: {
169
172
  local: {
170
173
  baseUrl: string | undefined;
@@ -216,6 +219,9 @@ export declare function ensureGeneratedWranglerConfig(tenantRoot: any, options?:
216
219
  provider: string | undefined;
217
220
  rootDir: string | undefined;
218
221
  publicBaseUrl: string | undefined;
222
+ local: {
223
+ runtime: string | undefined;
224
+ } | undefined;
219
225
  cloudflare: {
220
226
  workerName: string | undefined;
221
227
  };
@@ -296,7 +302,6 @@ export declare function buildProvisioningSummary(deployConfig: any, state: any,
296
302
  dlq: any;
297
303
  database: any;
298
304
  formGuardKv: any;
299
- sessionKv: any;
300
305
  railwayProject: any;
301
306
  webDomain: any;
302
307
  apiDomain: any;
@@ -526,6 +531,9 @@ export declare function validateDeployPrerequisites(tenantRoot: any, { requireRe
526
531
  rootDir: string | undefined;
527
532
  publicBaseUrl: string | undefined;
528
533
  localBaseUrl: string | undefined;
534
+ local: {
535
+ runtime: string | undefined;
536
+ } | undefined;
529
537
  environments: {
530
538
  local: {
531
539
  baseUrl: string | undefined;
@@ -577,6 +585,9 @@ export declare function validateDeployPrerequisites(tenantRoot: any, { requireRe
577
585
  provider: string | undefined;
578
586
  rootDir: string | undefined;
579
587
  publicBaseUrl: string | undefined;
588
+ local: {
589
+ runtime: string | undefined;
590
+ } | undefined;
580
591
  cloudflare: {
581
592
  workerName: string | undefined;
582
593
  };
@@ -699,6 +710,9 @@ export declare function validateDestroyPrerequisites(tenantRoot: any, { requireR
699
710
  rootDir: string | undefined;
700
711
  publicBaseUrl: string | undefined;
701
712
  localBaseUrl: string | undefined;
713
+ local: {
714
+ runtime: string | undefined;
715
+ } | undefined;
702
716
  environments: {
703
717
  local: {
704
718
  baseUrl: string | undefined;
@@ -750,6 +764,9 @@ export declare function validateDestroyPrerequisites(tenantRoot: any, { requireR
750
764
  provider: string | undefined;
751
765
  rootDir: string | undefined;
752
766
  publicBaseUrl: string | undefined;
767
+ local: {
768
+ runtime: string | undefined;
769
+ } | undefined;
753
770
  cloudflare: {
754
771
  workerName: string | undefined;
755
772
  };
@@ -816,7 +833,6 @@ export declare function destroyCloudflareResources(tenantRoot: any, options?: {}
816
833
  dlq: any;
817
834
  database: any;
818
835
  formGuardKv: any;
819
- sessionKv: any;
820
836
  railwayProject: any;
821
837
  webDomain: any;
822
838
  apiDomain: any;
@@ -876,7 +892,7 @@ export declare function destroyCloudflareResources(tenantRoot: any, options?: {}
876
892
  status: string;
877
893
  id: any;
878
894
  preview: boolean;
879
- };
895
+ } | null;
880
896
  sessionPreview: {
881
897
  status: string;
882
898
  id: any;
@@ -912,7 +928,6 @@ export declare function provisionCloudflareResources(tenantRoot: any, options?:
912
928
  dlq: any;
913
929
  database: any;
914
930
  formGuardKv: any;
915
- sessionKv: any;
916
931
  railwayProject: any;
917
932
  webDomain: any;
918
933
  apiDomain: any;
@@ -948,7 +963,6 @@ export declare function verifyProvisionedCloudflareResources(tenantRoot: any, op
948
963
  checks: {
949
964
  pages: boolean;
950
965
  formGuardKv: boolean;
951
- sessionKv: boolean;
952
966
  d1: boolean;
953
967
  queue: boolean;
954
968
  dlq: boolean;