run402-mcp 4.152.1 → 4.154.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/docs/llms-sdk.txt +17 -9
  2. package/dist/tools/deploy.d.ts +18 -3
  3. package/dist/tools/deploy.d.ts.map +1 -1
  4. package/dist/tools/deploy.js +10 -4
  5. package/dist/tools/deploy.js.map +1 -1
  6. package/package.json +6 -4
  7. package/schemas/release-spec.v1.json +41 -17
  8. package/sdk/README.md +2 -2
  9. package/sdk/dist/ci-credentials.js +2 -2
  10. package/sdk/dist/ci-credentials.js.map +1 -1
  11. package/sdk/dist/config.d.ts.map +1 -1
  12. package/sdk/dist/config.js +0 -1
  13. package/sdk/dist/config.js.map +1 -1
  14. package/sdk/dist/control-plane-credentials.d.ts +1 -1
  15. package/sdk/dist/control-plane-credentials.js +2 -2
  16. package/sdk/dist/control-plane-credentials.js.map +1 -1
  17. package/sdk/dist/credentials.d.ts +1 -6
  18. package/sdk/dist/credentials.d.ts.map +1 -1
  19. package/sdk/dist/index.d.ts.map +1 -1
  20. package/sdk/dist/index.js +1 -3
  21. package/sdk/dist/index.js.map +1 -1
  22. package/sdk/dist/kernel.d.ts +0 -2
  23. package/sdk/dist/kernel.d.ts.map +1 -1
  24. package/sdk/dist/kernel.js +4 -12
  25. package/sdk/dist/kernel.js.map +1 -1
  26. package/sdk/dist/namespaces/admin.d.ts +0 -7
  27. package/sdk/dist/namespaces/admin.d.ts.map +1 -1
  28. package/sdk/dist/namespaces/admin.js +0 -9
  29. package/sdk/dist/namespaces/admin.js.map +1 -1
  30. package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
  31. package/sdk/dist/namespaces/deploy.js +38 -51
  32. package/sdk/dist/namespaces/deploy.js.map +1 -1
  33. package/sdk/dist/namespaces/deploy.types.d.ts +23 -8
  34. package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -1
  35. package/sdk/dist/namespaces/deploy.types.js.map +1 -1
  36. package/sdk/dist/namespaces/functions.d.ts +29 -4
  37. package/sdk/dist/namespaces/functions.d.ts.map +1 -1
  38. package/sdk/dist/namespaces/functions.js +142 -11
  39. package/sdk/dist/namespaces/functions.js.map +1 -1
  40. package/sdk/dist/namespaces/functions.types.d.ts +56 -10
  41. package/sdk/dist/namespaces/functions.types.d.ts.map +1 -1
  42. package/sdk/dist/namespaces/projects.d.ts.map +1 -1
  43. package/sdk/dist/namespaces/projects.js +0 -2
  44. package/sdk/dist/namespaces/projects.js.map +1 -1
  45. package/sdk/dist/namespaces/projects.types.d.ts +5 -4
  46. package/sdk/dist/namespaces/projects.types.d.ts.map +1 -1
  47. package/sdk/dist/namespaces/repos.d.ts +0 -2
  48. package/sdk/dist/namespaces/repos.d.ts.map +1 -1
  49. package/sdk/dist/namespaces/repos.js +0 -1
  50. package/sdk/dist/namespaces/repos.js.map +1 -1
  51. package/sdk/dist/node/actions-node.d.ts.map +1 -1
  52. package/sdk/dist/node/actions-node.js +0 -2
  53. package/sdk/dist/node/actions-node.js.map +1 -1
  54. package/sdk/dist/node/credentials.d.ts +0 -1
  55. package/sdk/dist/node/credentials.d.ts.map +1 -1
  56. package/sdk/dist/node/credentials.js +0 -3
  57. package/sdk/dist/node/credentials.js.map +1 -1
  58. package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
  59. package/sdk/dist/node/deploy-manifest.js +0 -3
  60. package/sdk/dist/node/deploy-manifest.js.map +1 -1
  61. package/sdk/dist/node/index.d.ts +1 -1
  62. package/sdk/dist/node/index.js +1 -1
  63. package/sdk/dist/node/paid-fetch.d.ts.map +1 -1
  64. package/sdk/dist/node/paid-fetch.js +14 -1
  65. package/sdk/dist/node/paid-fetch.js.map +1 -1
  66. package/sdk/dist/scoped.d.ts +3 -1
  67. package/sdk/dist/scoped.d.ts.map +1 -1
  68. package/sdk/dist/scoped.js +6 -0
  69. package/sdk/dist/scoped.js.map +1 -1
@@ -1044,7 +1044,6 @@ function functionToCoreSpec(fn) {
1044
1044
  ...(fn.config !== undefined ? { config: fn.config } : {}),
1045
1045
  ...(fn.deps !== undefined ? { deps: fn.deps } : {}),
1046
1046
  ...(fn.triggers !== undefined ? { triggers: fn.triggers } : {}),
1047
- ...(fn.schedule !== undefined ? { schedule: fn.schedule } : {}),
1048
1047
  ...(fn.requireAuth !== undefined ? { requireAuth: fn.requireAuth } : {}),
1049
1048
  ...(fn.requireRole !== undefined ? { requireRole: fn.requireRole } : {}),
1050
1049
  ...(fn.class !== undefined ? { class: fn.class } : {}),
@@ -1067,7 +1066,6 @@ function functionToWire(fn) {
1067
1066
  : {}),
1068
1067
  ...(fn.deps !== undefined ? { deps: fn.deps } : {}),
1069
1068
  ...(fn.triggers !== undefined ? { triggers: fn.triggers } : {}),
1070
- ...(fn.schedule !== undefined ? { schedule: fn.schedule } : {}),
1071
1069
  ...(fn.requireAuth !== undefined ? { require_auth: fn.requireAuth } : {}),
1072
1070
  ...(fn.requireRole !== undefined
1073
1071
  ? { require_role: fn.requireRole === null ? null : requireRoleToWire(fn.requireRole) }
@@ -1384,7 +1382,7 @@ async function preflightTierFunctionLimits(client, spec, ciCredentials) {
1384
1382
  const intervalMinutes = estimateCronMinimumIntervalMinutes(trigger.cron);
1385
1383
  if (intervalMinutes !== null &&
1386
1384
  intervalMinutes < limits.minCronIntervalMinutes.value) {
1387
- const triggerLabel = trigger.id === "__legacy__" ? "schedule" : `trigger ${trigger.id}`;
1385
+ const triggerLabel = trigger.id ? `trigger ${trigger.id}` : "schedule trigger";
1388
1386
  throw tierLimitError(`Function ${entry.name} ${triggerLabel} runs every ${intervalMinutes} minute(s), below the ${limits.tier} tier minimum interval of ${limits.minCronIntervalMinutes.value} minutes.`, `${entry.fieldPrefix}.${trigger.fieldSuffix}`, trigger.cron, limits, limits.minCronIntervalMinutes, {
1389
1387
  interval_minutes: intervalMinutes,
1390
1388
  min_interval_minutes: limits.minCronIntervalMinutes.value,
@@ -1586,9 +1584,7 @@ function applyScheduledFunctionPatch(scheduled, patch) {
1586
1584
  scheduled.delete(name);
1587
1585
  }
1588
1586
  for (const [name, fn] of Object.entries(patch?.set ?? {})) {
1589
- if (fn.schedule === null)
1590
- scheduled.delete(name);
1591
- else if (scheduleTriggersForFunction(fn).length > 0)
1587
+ if (scheduleTriggersForFunction(fn).length > 0)
1592
1588
  scheduled.add(name);
1593
1589
  }
1594
1590
  }
@@ -1605,32 +1601,19 @@ async function readActiveScheduledFunctionNames(client, projectId) {
1605
1601
  }
1606
1602
  const scheduled = new Set();
1607
1603
  for (const fn of inventory.functions ?? []) {
1608
- if (isScheduledCron(fn.schedule) || scheduleTriggersForFunction(fn).length > 0)
1604
+ if (scheduleTriggersForFunction(fn).length > 0)
1609
1605
  scheduled.add(fn.name);
1610
1606
  }
1611
1607
  return scheduled;
1612
1608
  }
1613
1609
  function scheduleTriggersForFunction(fn) {
1614
- if (fn.triggers && fn.triggers.length > 0) {
1615
- return fn.triggers
1616
- .filter((trigger) => trigger.type === "schedule")
1617
- .map((trigger) => ({
1618
- ...trigger,
1619
- fieldSuffix: `triggers.${trigger.id}.cron`,
1620
- }));
1621
- }
1622
- return isScheduledCron(fn.schedule)
1623
- ? [{
1624
- id: "__legacy__",
1625
- type: "schedule",
1626
- cron: fn.schedule,
1627
- timezone: "UTC",
1628
- misfire_policy: "skip",
1629
- overlap_policy: "allow",
1630
- run: { event_type: "legacy.schedule", payload: {} },
1631
- fieldSuffix: "schedule",
1632
- }]
1633
- : [];
1610
+ return (fn.triggers ?? [])
1611
+ .map((trigger, index) => ({ trigger, index }))
1612
+ .filter((entry) => entry.trigger.type === "schedule")
1613
+ .map(({ trigger, index }) => ({
1614
+ ...trigger,
1615
+ fieldSuffix: `triggers[${index}].cron`,
1616
+ }));
1634
1617
  }
1635
1618
  function scheduledCountTierLimitError(count, limits, limit, countSource) {
1636
1619
  return tierLimitError(`Deploy would have ${count} scheduled function(s), exceeding the ${limits.tier} tier maximum of ${limit.value}.`, "functions.scheduled_count", count, limits, limit, {
@@ -1669,9 +1652,6 @@ function tierLimitError(message, field, value, limits, limit, extraDetails) {
1669
1652
  context: "validating deploy tier limits",
1670
1653
  });
1671
1654
  }
1672
- function isScheduledCron(value) {
1673
- return typeof value === "string" && value.trim().length > 0;
1674
- }
1675
1655
  function estimateCronMinimumIntervalMinutes(expression) {
1676
1656
  const parts = expression.trim().split(/\s+/);
1677
1657
  if (parts.length !== 5)
@@ -2734,12 +2714,17 @@ function validateFunctionTriggers(value, resource) {
2734
2714
  validateKnownFields(obj, path, FUNCTION_TRIGGER_FIELDS, {
2735
2715
  delivery: "Remove delivery; schedule triggers always start durable function runs.",
2736
2716
  });
2737
- if (typeof obj.id !== "string" || obj.id.trim() === "") {
2738
- throw invalidSpec(`ReleaseSpec.${path}.id is required for function triggers`, `${path}.id`);
2717
+ // A schedule trigger may omit its id (the gateway derives one from the
2718
+ // cron and timezone) and its run (D-scheduled-functions-5).
2719
+ const isSchedule = obj.type === "schedule";
2720
+ if (!(isSchedule && obj.id === undefined)) {
2721
+ if (typeof obj.id !== "string" || obj.id.trim() === "") {
2722
+ throw invalidSpec(`ReleaseSpec.${path}.id is required for ${String(obj.type)} triggers`, `${path}.id`);
2723
+ }
2724
+ if (seen.has(obj.id))
2725
+ throw invalidSpec(`ReleaseSpec.${path}.id duplicates ${JSON.stringify(obj.id)}`, `${path}.id`);
2726
+ seen.add(obj.id);
2739
2727
  }
2740
- if (seen.has(obj.id))
2741
- throw invalidSpec(`ReleaseSpec.${path}.id duplicates ${JSON.stringify(obj.id)}`, `${path}.id`);
2742
- seen.add(obj.id);
2743
2728
  if (obj.type !== "app_repo" && (obj.repo !== undefined || obj.paths !== undefined)) {
2744
2729
  throw invalidSpec(`ReleaseSpec.${path} ${String(obj.type)} triggers cannot include repo or paths`, path);
2745
2730
  }
@@ -2805,9 +2790,11 @@ function validateFunctionTriggers(value, resource) {
2805
2790
  else {
2806
2791
  throw invalidSpec(`ReleaseSpec.${path}.type must be "schedule", "email" or "app_repo"`, `${path}.type`);
2807
2792
  }
2793
+ if (isSchedule && obj.run === undefined)
2794
+ continue;
2808
2795
  const run = requireObject(obj.run, `${path}.run`);
2809
2796
  validateKnownFields(run, `${path}.run`, FUNCTION_TRIGGER_RUN_FIELDS);
2810
- if (typeof run.event_type !== "string" || run.event_type.trim() === "") {
2797
+ if (!(isSchedule && run.event_type === undefined) && (typeof run.event_type !== "string" || run.event_type.trim() === "")) {
2811
2798
  throw invalidSpec(`ReleaseSpec.${path}.run.event_type is required`, `${path}.run.event_type`);
2812
2799
  }
2813
2800
  if (run.payload !== undefined)
@@ -3901,8 +3888,6 @@ async function normalizeFunction(fn, remember) {
3901
3888
  out.deps = fn.deps;
3902
3889
  if (fn.triggers !== undefined)
3903
3890
  out.triggers = normalizeFunctionTriggers(fn.triggers);
3904
- if (fn.schedule !== undefined)
3905
- out.schedule = fn.schedule;
3906
3891
  if (fn.entrypoint)
3907
3892
  out.entrypoint = fn.entrypoint;
3908
3893
  if (fn.requireAuth !== undefined)
@@ -3923,23 +3908,23 @@ async function normalizeFunction(fn, remember) {
3923
3908
  return out;
3924
3909
  }
3925
3910
  function normalizeFunctionTriggers(triggers) {
3911
+ const runOf = (run) => ({
3912
+ ...(run.event_type !== undefined ? { event_type: run.event_type } : {}),
3913
+ payload: run.payload ?? {},
3914
+ ...(run.retry !== undefined ? { retry: { ...run.retry } } : {}),
3915
+ ...(run.expires_after_seconds !== undefined
3916
+ ? { expires_after_seconds: run.expires_after_seconds }
3917
+ : {}),
3918
+ });
3926
3919
  return triggers
3927
3920
  .map((trigger) => {
3928
- const run = {
3929
- event_type: trigger.run.event_type,
3930
- payload: trigger.run.payload ?? {},
3931
- ...(trigger.run.retry !== undefined ? { retry: { ...trigger.run.retry } } : {}),
3932
- ...(trigger.run.expires_after_seconds !== undefined
3933
- ? { expires_after_seconds: trigger.run.expires_after_seconds }
3934
- : {}),
3935
- };
3936
3921
  if (trigger.type === "email") {
3937
3922
  return {
3938
3923
  id: trigger.id,
3939
3924
  type: "email",
3940
3925
  mailbox: trigger.mailbox,
3941
3926
  events: [...trigger.events].sort(),
3942
- run,
3927
+ run: runOf(trigger.run),
3943
3928
  };
3944
3929
  }
3945
3930
  if (trigger.type === "app_repo") {
@@ -3948,20 +3933,22 @@ function normalizeFunctionTriggers(triggers) {
3948
3933
  type: "app_repo",
3949
3934
  repo: trigger.repo,
3950
3935
  ...(trigger.paths !== undefined ? { paths: [...trigger.paths] } : {}),
3951
- run,
3936
+ run: runOf(trigger.run),
3952
3937
  };
3953
3938
  }
3939
+ // A schedule trigger's id and run are the gateway's to default
3940
+ // (D-scheduled-functions-5): an omitted one is sent omitted.
3954
3941
  return {
3955
- id: trigger.id,
3942
+ ...(trigger.id !== undefined ? { id: trigger.id } : {}),
3956
3943
  type: "schedule",
3957
3944
  cron: trigger.cron,
3958
3945
  timezone: trigger.timezone ?? "UTC",
3959
3946
  misfire_policy: trigger.misfire_policy ?? "skip",
3960
3947
  overlap_policy: trigger.overlap_policy ?? "allow",
3961
- run,
3948
+ ...(trigger.run !== undefined ? { run: runOf(trigger.run) } : {}),
3962
3949
  };
3963
3950
  })
3964
- .sort((a, b) => a.id.localeCompare(b.id));
3951
+ .sort((a, b) => (a.id ?? "").localeCompare(b.id ?? ""));
3965
3952
  }
3966
3953
  async function normalizeFileSet(set, remember) {
3967
3954
  // `dir(path)` produces a LocalDirRef sentinel that is documented as a