@makinbakin/sdk 0.0.1-rc.24 → 0.0.1-rc.26

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.
@@ -30,4 +30,13 @@ export declare function healthUnknown(input: UnknownObservationFields): UnknownO
30
30
  export declare function healthObserved(observations: HealthNonEmptyArray<HealthObservationInput>): ObservedHealthCheckRunInput;
31
31
  /** Build an explicit successful not-applicable run. */
32
32
  export declare function healthNotApplicable(reason: string): NotApplicableHealthCheckRunInput;
33
+ /**
34
+ * Deterministically coerce arbitrary text (a filesystem path, a table
35
+ * name, a task id) into the contract's stable resource-id format
36
+ * (`^[a-z0-9][a-z0-9._:-]{0,127}$`). A raw path used as a resource id
37
+ * failed contract validation and nuked a REAL finding into a generic
38
+ * "could not be verified" card for three releases (field-diagnosed
39
+ * 2026-07-23). Put the human-readable original in `label`, never in `id`.
40
+ */
41
+ export declare function healthResourceId(raw: string): string;
33
42
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makinbakin/sdk",
3
- "version": "0.0.1-rc.24",
3
+ "version": "0.0.1-rc.26",
4
4
  "description": "SDK for building Bakin plugins — UI components, slot types, hooks, and the runtime registerPlugin helper.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
package/utils/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * needs. The `format*` helpers are re-exported from `@bakin/core/format`
6
6
  * so plugins have a single import path instead of reaching into `@/lib/*`.
7
7
  */
8
- export { healthError, healthHealthy, healthNotApplicable, healthObserved, healthUnknown, healthWarning, } from '../_internal/core/health/observation-builders';
8
+ export { healthError, healthHealthy, healthNotApplicable, healthObserved, healthResourceId, healthUnknown, healthWarning, } from '../_internal/core/health/observation-builders';
9
9
  /** Tailwind class merger (clsx + tailwind-merge). */
10
10
  export { cn } from '../_internal/app/lib/utils';
11
11
  /** Semantic tone for an outline status badge. */
package/utils/index.js CHANGED
@@ -12,6 +12,23 @@ function truncate(value, max) {
12
12
  end -= 1;
13
13
  return `${value.slice(0, end)}\u2026`;
14
14
  }
15
+ var RESOURCE_LABEL_MAX = 120;
16
+ var STABLE_ID_PATTERN = /^[a-z0-9][a-z0-9._:-]{0,127}$/;
17
+ function normalizeResources(resources) {
18
+ return resources.map((resource) => {
19
+ const next = { ...resource };
20
+ if (!STABLE_ID_PATTERN.test(next.id))
21
+ next.id = healthResourceId(next.id);
22
+ if (next.label !== undefined) {
23
+ const label = next.label.trim();
24
+ if (label.length === 0)
25
+ delete next.label;
26
+ else
27
+ next.label = truncate(label, RESOURCE_LABEL_MAX);
28
+ }
29
+ return next;
30
+ });
31
+ }
15
32
  function clampCopy(input) {
16
33
  const clamped = { ...input };
17
34
  const summary = clamped.summary.trim();
@@ -24,8 +41,13 @@ function clampCopy(input) {
24
41
  clamped.detail = truncate(detail, DETAIL_MAX);
25
42
  }
26
43
  }
27
- if (clamped.incident && clamped.incident.impact.length > IMPACT_MAX) {
28
- clamped.incident = { ...clamped.incident, impact: truncate(clamped.incident.impact, IMPACT_MAX) };
44
+ if (clamped.incident) {
45
+ const incident = { ...clamped.incident };
46
+ if (incident.impact.length > IMPACT_MAX)
47
+ incident.impact = truncate(incident.impact, IMPACT_MAX);
48
+ if (incident.resources)
49
+ incident.resources = normalizeResources(incident.resources);
50
+ clamped.incident = incident;
29
51
  }
30
52
  return clamped;
31
53
  }
@@ -47,6 +69,10 @@ function healthObserved(observations) {
47
69
  function healthNotApplicable(reason) {
48
70
  return { outcome: "not_applicable", reason };
49
71
  }
72
+ function healthResourceId(raw) {
73
+ const sanitized = raw.toLowerCase().replace(/[^a-z0-9._:-]+/g, "-").replace(/^[^a-z0-9]+/, "").replace(/-+$/, "").slice(0, 128);
74
+ return sanitized.length > 0 ? sanitized : "unknown";
75
+ }
50
76
  // node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
51
77
  function r(e) {
52
78
  var t, f, n = "";
@@ -2186,6 +2212,7 @@ export {
2186
2212
  humanizeKey,
2187
2213
  healthWarning,
2188
2214
  healthUnknown,
2215
+ healthResourceId,
2189
2216
  healthObserved,
2190
2217
  healthNotApplicable,
2191
2218
  healthHealthy,