@company-semantics/contracts 0.137.0 → 0.139.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "0.137.0",
3
+ "version": "0.139.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.ts CHANGED
@@ -612,3 +612,10 @@ export type {
612
612
  RequestDescriptor,
613
613
  SchedulerEvent,
614
614
  } from './requests'
615
+
616
+ // Mutation policy types (lane behavior semantics)
617
+ export type { MutationPolicy } from './mutations'
618
+
619
+ // Observability envelope types (shared metric shape)
620
+ export { REQUEST_ID_HEADER } from './observability'
621
+ export type { Labels, MetricEnvelope, SchedulerMetricName } from './observability'
@@ -0,0 +1,13 @@
1
+ export type { MutationBehavior } from './requests';
2
+
3
+ export type MutationPolicy = {
4
+ /**
5
+ * collapse — the newer mutation supersedes older in-flight or queued mutations
6
+ * on the same resource lane. Use for idempotent field sets (rename).
7
+ * queue — FIFO lane per resource. No collapse. Use when each mutation carries
8
+ * meaningful intent that must be preserved (reorder, append, toggle-sequence).
9
+ * parallel — independent mutations on different resourceIds may run concurrently;
10
+ * same-resource requests still serialize to avoid lost writes.
11
+ */
12
+ behavior: 'collapse' | 'queue' | 'parallel';
13
+ };
@@ -0,0 +1,16 @@
1
+ export const REQUEST_ID_HEADER = 'x-request-id';
2
+
3
+ export type Labels = Record<string, string>;
4
+ export type MetricEnvelope =
5
+ | { kind: 'counter'; name: string; value: number; labels?: Labels; ts: number }
6
+ | { kind: 'gauge'; name: string; value: number; labels?: Labels; ts: number }
7
+ | { kind: 'histogram'; name: string; value: number; labels?: Labels; ts: number };
8
+
9
+ export type SchedulerMetricName =
10
+ | 'scheduler.inflight_requests'
11
+ | 'scheduler.queue_depth'
12
+ | 'scheduler.queue_wait_ms'
13
+ | 'scheduler.dedupe_hits'
14
+ | 'scheduler.heap_used_bytes'
15
+ | 'scheduler.rss_bytes'
16
+ | 'scheduler.fetch_latency_ms';