@company-semantics/contracts 27.1.0 → 27.2.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": "27.1.0",
3
+ "version": "27.2.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED — do not edit. Run pnpm generate:spec-hash to regenerate.
2
- export const SPEC_HASH = '0a8d3435dba9' as const;
3
- export const SPEC_HASH_FULL = '0a8d3435dba94642fe2cf529b1743d868363875302393e23cf0b9238a4f5cd47' as const;
2
+ export const SPEC_HASH = '409ce57139cd' as const;
3
+ export const SPEC_HASH_FULL = '409ce57139cd78a8ec633efb516bc92ba81dd2cdaab0a4afe240d20c67bb6b1e' as const;
@@ -1338,6 +1338,40 @@ export interface paths {
1338
1338
  patch?: never;
1339
1339
  trace?: never;
1340
1340
  };
1341
+ "/api/integrations/bamboohr/inferences": {
1342
+ parameters: {
1343
+ query?: never;
1344
+ header?: never;
1345
+ path?: never;
1346
+ cookie?: never;
1347
+ };
1348
+ /** List the org’s pending org-structure reasoning inferences (review queue) */
1349
+ get: operations["listBambooHrInferences"];
1350
+ put?: never;
1351
+ post?: never;
1352
+ delete?: never;
1353
+ options?: never;
1354
+ head?: never;
1355
+ patch?: never;
1356
+ trace?: never;
1357
+ };
1358
+ "/api/integrations/bamboohr/inferences/{id}/decision": {
1359
+ parameters: {
1360
+ query?: never;
1361
+ header?: never;
1362
+ path?: never;
1363
+ cookie?: never;
1364
+ };
1365
+ get?: never;
1366
+ put?: never;
1367
+ /** Accept or reject one pending org-structure reasoning inference */
1368
+ post: operations["decideBambooHrInference"];
1369
+ delete?: never;
1370
+ options?: never;
1371
+ head?: never;
1372
+ patch?: never;
1373
+ trace?: never;
1374
+ };
1341
1375
  "/api/company-md/tree": {
1342
1376
  parameters: {
1343
1377
  query?: never;
@@ -4366,6 +4400,29 @@ export interface components {
4366
4400
  };
4367
4401
  };
4368
4402
  };
4403
+ OrgStructureReviewQueue: {
4404
+ items: {
4405
+ /** Format: uuid */
4406
+ id: string;
4407
+ inferenceType: string;
4408
+ payload: unknown;
4409
+ confidence: number;
4410
+ reason: string;
4411
+ /** Format: date-time */
4412
+ createdAt: string;
4413
+ }[];
4414
+ };
4415
+ OrgStructureInferenceDecisionResult: {
4416
+ /** Format: uuid */
4417
+ id: string;
4418
+ /** @enum {string} */
4419
+ status: "accepted" | "rejected";
4420
+ applied: boolean;
4421
+ };
4422
+ BambooHrInferenceDecision: {
4423
+ /** @enum {string} */
4424
+ decision: "accept" | "reject";
4425
+ };
4369
4426
  CompanyMdListResponse: {
4370
4427
  items: {
4371
4428
  id: string;
@@ -7799,6 +7856,66 @@ export interface operations {
7799
7856
  };
7800
7857
  };
7801
7858
  };
7859
+ listBambooHrInferences: {
7860
+ parameters: {
7861
+ query?: never;
7862
+ header?: never;
7863
+ path?: never;
7864
+ cookie?: never;
7865
+ };
7866
+ requestBody?: never;
7867
+ responses: {
7868
+ /** @description The org’s pending (review) org-structure inferences, newest first */
7869
+ 200: {
7870
+ headers: {
7871
+ [name: string]: unknown;
7872
+ };
7873
+ content: {
7874
+ "application/json": components["schemas"]["OrgStructureReviewQueue"];
7875
+ };
7876
+ };
7877
+ };
7878
+ };
7879
+ decideBambooHrInference: {
7880
+ parameters: {
7881
+ query?: never;
7882
+ header?: never;
7883
+ path: {
7884
+ id: string;
7885
+ };
7886
+ cookie?: never;
7887
+ };
7888
+ requestBody: {
7889
+ content: {
7890
+ "application/json": components["schemas"]["BambooHrInferenceDecision"];
7891
+ };
7892
+ };
7893
+ responses: {
7894
+ /** @description The decision outcome (status + whether the org graph was mutated) */
7895
+ 200: {
7896
+ headers: {
7897
+ [name: string]: unknown;
7898
+ };
7899
+ content: {
7900
+ "application/json": components["schemas"]["OrgStructureInferenceDecisionResult"];
7901
+ };
7902
+ };
7903
+ /** @description Invalid decision value */
7904
+ 400: {
7905
+ headers: {
7906
+ [name: string]: unknown;
7907
+ };
7908
+ content?: never;
7909
+ };
7910
+ /** @description Inference not found or already decided */
7911
+ 404: {
7912
+ headers: {
7913
+ [name: string]: unknown;
7914
+ };
7915
+ content?: never;
7916
+ };
7917
+ };
7918
+ };
7802
7919
  getCompanyMdTree: {
7803
7920
  parameters: {
7804
7921
  query?: {
@@ -62,6 +62,8 @@ export const openApiRoutes = {
62
62
  '/api/factory/kpis': ['GET'],
63
63
  '/api/factory/snapshot': ['GET'],
64
64
  '/api/ingestion/operations/{id}': ['GET'],
65
+ '/api/integrations/bamboohr/inferences': ['GET'],
66
+ '/api/integrations/bamboohr/inferences/{id}/decision': ['POST'],
65
67
  '/api/internal-admin/impersonate/end': ['POST'],
66
68
  '/api/internal-admin/impersonate/session': ['GET'],
67
69
  '/api/internal-admin/impersonate/start': ['POST'],
package/src/index.ts CHANGED
@@ -424,6 +424,20 @@ export type { SyncRunSummary } from "./org/index";
424
424
  export { ConflictRecordSchema } from "./org/index";
425
425
  export type { ConflictRecord } from "./org/index";
426
426
 
427
+ // Org-structure reasoning review queue: pending structure inferences an operator
428
+ // accepts/rejects, and the outcome of one decision. Published response shapes.
429
+ // Provider-agnostic store; BambooHR is the first surface. (ADR-CONT-095)
430
+ export {
431
+ OrgStructureReviewInferenceSchema,
432
+ OrgStructureReviewQueueSchema,
433
+ OrgStructureInferenceDecisionResultSchema,
434
+ } from "./org/index";
435
+ export type {
436
+ OrgStructureReviewInference,
437
+ OrgStructureReviewQueue,
438
+ OrgStructureInferenceDecisionResult,
439
+ } from "./org/index";
440
+
427
441
  // Canonical facts: the adapter-seam ingestion batch — external-keyed Canonical*
428
442
  // facts (each with provenance) plus a CanonicalFacts envelope. The reconciler
429
443
  // consumes the batch into the internal org graph. (ADR-CONT-085 / ADR-CTRL-183)
package/src/org/README.md CHANGED
@@ -159,6 +159,12 @@ Shared type vocabulary for organization ownership, type classification, and tran
159
159
  - `OrgOwnerIcon` _(type)_
160
160
  - `OrgOwnerIconSchema` — Icon options for the `owner` org-chart role.
161
161
  - `OrgScopedContext` _(type)_ — Validated organization-scoped context for policy implementations.
162
+ - `OrgStructureInferenceDecisionResult` _(type)_
163
+ - `OrgStructureInferenceDecisionResultSchema`
164
+ - `OrgStructureReviewInference` _(type)_
165
+ - `OrgStructureReviewInferenceSchema`
166
+ - `OrgStructureReviewQueue` _(type)_
167
+ - `OrgStructureReviewQueueSchema`
162
168
  - `OrgSystemEventsList` _(type)_
163
169
  - `OrgSystemEventsListSchema`
164
170
  - `OrgTreeResponse` _(type)_
package/src/org/index.ts CHANGED
@@ -136,6 +136,20 @@ export type { SyncRunSummary } from "./sync-run";
136
136
  export { ConflictRecordSchema } from "./conflict-record";
137
137
  export type { ConflictRecord } from "./conflict-record";
138
138
 
139
+ // Org-structure reasoning review queue: pending structure inferences an operator
140
+ // accepts/rejects, and the outcome of one decision. Published response shapes;
141
+ // provider-agnostic store, BambooHR is the first surface. (ADR-CONT-095)
142
+ export {
143
+ OrgStructureReviewInferenceSchema,
144
+ OrgStructureReviewQueueSchema,
145
+ OrgStructureInferenceDecisionResultSchema,
146
+ } from "./reasoning-review";
147
+ export type {
148
+ OrgStructureReviewInference,
149
+ OrgStructureReviewQueue,
150
+ OrgStructureInferenceDecisionResult,
151
+ } from "./reasoning-review";
152
+
139
153
  // Canonical facts: the adapter-seam ingestion batch. Each fact is keyed by
140
154
  // external identity (externalSourceId/externalSourceSystem) and carries a
141
155
  // FactProvenance envelope; the reconciler consumes the batch. (ADR-CONT-085 / ADR-CTRL-183)
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Org-structure reasoning review vocabulary — the operator review queue for
3
+ * proposed structure changes and the outcome of deciding one.
4
+ *
5
+ * An org-structure reasoning pass (the adapter → reasoning-engine pipeline,
6
+ * BambooHR being the guinea-pig source — control ADR-CTRL-159, backend
7
+ * ADR-BE-345) emits structure INFERENCES (nest a unit, place a report, ...) that
8
+ * are held in `review` rather than applied blindly. The review queue is the set
9
+ * of an org's pending inferences; an operator with integration-management
10
+ * authority ACCEPTS one (re-applying it to the live org graph) or REJECTS it.
11
+ *
12
+ * These are published RESPONSE shapes (ADR-CONT-029: response/published shapes
13
+ * live in contracts; the `decision` request body stays backend-local). They are
14
+ * provider-agnostic — the underlying store (`org_structure_inferences`) is not
15
+ * BambooHR-specific even though the first surface that reads it is the BambooHR
16
+ * integration route. `inferenceType` is an OPEN string (no enum) so new
17
+ * inference kinds need no schema change, mirroring the sibling org schemas
18
+ * ({@link ConflictRecordSchema}, {@link SyncRunSummarySchema}). `payload` is the
19
+ * inference-kind-specific body, modeled as unknown — its shape is keyed off
20
+ * `inferenceType` and is not part of the stable contract surface.
21
+ */
22
+ import { z } from "zod";
23
+
24
+ // ---------------------------------------------------------------------------
25
+ // OrgStructureReviewInference — one pending ('review') structure inference
26
+ // ---------------------------------------------------------------------------
27
+
28
+ export const OrgStructureReviewInferenceSchema = z.object({
29
+ /** Identifier of this inference within the org graph. */
30
+ id: z.string().uuid(),
31
+ /**
32
+ * Kind of structure inference (e.g. "NestOrgUnit", "PlaceReport"). An OPEN
33
+ * string so new inference kinds need no schema change.
34
+ */
35
+ inferenceType: z.string().min(1),
36
+ /**
37
+ * The inference-kind-specific body. Its shape is keyed off `inferenceType`
38
+ * and is intentionally unmodeled here — not part of the stable contract.
39
+ */
40
+ payload: z.unknown(),
41
+ /** Engine confidence in this inference, 0..1. */
42
+ confidence: z.number(),
43
+ /** Human-meaningful WHY the engine proposed this change. */
44
+ reason: z.string(),
45
+ /** ISO timestamp the inference was created. */
46
+ createdAt: z.string().datetime(),
47
+ });
48
+
49
+ export type OrgStructureReviewInference = z.infer<
50
+ typeof OrgStructureReviewInferenceSchema
51
+ >;
52
+
53
+ // ---------------------------------------------------------------------------
54
+ // OrgStructureReviewQueue — an org's pending review inferences (newest first)
55
+ // ---------------------------------------------------------------------------
56
+
57
+ export const OrgStructureReviewQueueSchema = z.object({
58
+ /** The org's pending ('review') inferences, newest first. */
59
+ items: z.array(OrgStructureReviewInferenceSchema),
60
+ });
61
+
62
+ export type OrgStructureReviewQueue = z.infer<
63
+ typeof OrgStructureReviewQueueSchema
64
+ >;
65
+
66
+ // ---------------------------------------------------------------------------
67
+ // OrgStructureInferenceDecisionResult — outcome of accepting/rejecting one
68
+ // ---------------------------------------------------------------------------
69
+
70
+ export const OrgStructureInferenceDecisionResultSchema = z.object({
71
+ /** Identifier of the decided inference. */
72
+ id: z.string().uuid(),
73
+ /** The terminal status the inference was moved to. */
74
+ status: z.enum(["accepted", "rejected"]),
75
+ /**
76
+ * Whether the decision mutated the live org graph. True on an accept that
77
+ * re-applied the inference; false on a reject (and on an accept that resolved
78
+ * to a no-op).
79
+ */
80
+ applied: z.boolean(),
81
+ });
82
+
83
+ export type OrgStructureInferenceDecisionResult = z.infer<
84
+ typeof OrgStructureInferenceDecisionResultSchema
85
+ >;