@company-semantics/contracts 15.1.0 → 17.0.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/src/org/index.ts CHANGED
@@ -141,8 +141,9 @@ export {
141
141
  WorkspaceOverviewSchema,
142
142
  WorkspaceMembersResponseSchema,
143
143
  WorkspaceMemberDetailSchema,
144
- WorkspaceMemberManagesEntrySchema,
144
+ WorkspaceMemberUnitDesignationEntrySchema,
145
145
  OrgUnitDesignationSchema,
146
+ HomeUnitRoleSchema,
146
147
  RoleCatalogEntrySchema,
147
148
  RoleCatalogResponseSchema,
148
149
  WorkspaceAuthConfigSchema,
@@ -168,8 +169,9 @@ export type {
168
169
  WorkspaceAccessResponse,
169
170
  WorkspaceOverview as WorkspaceOverviewDto,
170
171
  WorkspaceMembersResponse,
171
- WorkspaceMemberManagesEntry,
172
+ WorkspaceMemberUnitDesignationEntry,
172
173
  OrgUnitDesignation,
174
+ HomeUnitRole,
173
175
  WorkspaceAuthConfig as WorkspaceAuthConfigDto,
174
176
  WorkspaceAuditEvent as WorkspaceAuditEventDto,
175
177
  WorkspaceResolvePathResponse,
@@ -28,7 +28,7 @@ const WorkspaceMemberUnitSummarySchema = z.object({
28
28
  /**
29
29
  * Designation a member holds over a unit they manage (ADR-CTRL-112).
30
30
  *
31
- * Precedence, highest-first: whole_org > admin > leader > delegate > member.
31
+ * Precedence, highest-first: whole_org > admin > unit_owner > delegate > member.
32
32
  * The org-wide designations (`whole_org`, `admin`) anchor to the org root
33
33
  * unit. This vocabulary is DISPLAY-ONLY — it summarizes management reach for
34
34
  * UI surfaces and is NEVER an authorization input (authority resolution uses
@@ -37,19 +37,19 @@ const WorkspaceMemberUnitSummarySchema = z.object({
37
37
  export const OrgUnitDesignationSchema = z.enum([
38
38
  "whole_org",
39
39
  "admin",
40
- "leader",
40
+ "unit_owner",
41
41
  "delegate",
42
42
  "member",
43
43
  ]);
44
44
  export type OrgUnitDesignation = z.infer<typeof OrgUnitDesignationSchema>;
45
45
 
46
- export const WorkspaceMemberManagesEntrySchema = z.object({
46
+ export const WorkspaceMemberUnitDesignationEntrySchema = z.object({
47
47
  unitId: z.string(),
48
48
  unitName: z.string(),
49
49
  designation: OrgUnitDesignationSchema,
50
50
  });
51
- export type WorkspaceMemberManagesEntry = z.infer<
52
- typeof WorkspaceMemberManagesEntrySchema
51
+ export type WorkspaceMemberUnitDesignationEntry = z.infer<
52
+ typeof WorkspaceMemberUnitDesignationEntrySchema
53
53
  >;
54
54
 
55
55
  const WorkspaceMemberSchema = z.object({
@@ -87,11 +87,13 @@ const WorkspaceMemberSchema = z.object({
87
87
  /** OrgUnit memberships for this member, capped at a small number server-side. */
88
88
  unitMemberships: z.array(WorkspaceMemberUnitSummarySchema),
89
89
  /**
90
- * Per-unit org-chart designations the member holds where they manage
91
- * (ADR-CTRL-112). Display-only summary of management reach; never an
92
- * authorization input. Empty array when the member manages nothing.
90
+ * Per-unit org-chart designations the member holds (ADR-CTRL-112). Carries
91
+ * BOTH management-reach entries (whole_org/admin/unit_owner/delegate) and
92
+ * plain contributor entries (`member`); consumers split by designation.
93
+ * Display-only summary; never an authorization input. Empty array when the
94
+ * member holds no per-unit designation.
93
95
  */
94
- manages: z.array(WorkspaceMemberManagesEntrySchema),
96
+ unitDesignations: z.array(WorkspaceMemberUnitDesignationEntrySchema),
95
97
  /** True when server truncated `unitMemberships`; detail endpoint returns the full list. */
96
98
  unitMembershipsTruncated: z.boolean(),
97
99
  /** Invite lifecycle status. `null` for members without an invite record. */
@@ -595,6 +597,15 @@ export type ScopeCheckBatchResponse = z.infer<
595
597
  // Invite sub-schema
596
598
  // ---------------------------------------------------------------------------
597
599
 
600
+ /**
601
+ * Role the invitee takes in their home unit on acceptance. `unit_owner` is a
602
+ * deferred structural-leadership grant applied at accept time. Source of truth
603
+ * for the hand-mirrored `OrgInvite`/`CreateInviteRequest` interface unions in
604
+ * `org/types.ts` (enforced by the `schema-type-mirror` guard).
605
+ */
606
+ export const HomeUnitRoleSchema = z.enum(["member", "unit_owner"]);
607
+ export type HomeUnitRole = z.infer<typeof HomeUnitRoleSchema>;
608
+
598
609
  const OrgInviteSchema = z.object({
599
610
  id: z.string(),
600
611
  orgId: z.string(),
@@ -605,9 +616,10 @@ const OrgInviteSchema = z.object({
605
616
  // Home unit the invitee is placed in on acceptance (users.primary_unit_id).
606
617
  // Optional/nullable: legacy invites predate this field.
607
618
  homeUnitId: z.string().uuid().optional(),
608
- // Role the invitee takes in homeUnitId on acceptance ('leader' is a deferred
609
- // structural-leadership grant). Optional/'member' for legacy + unit-less invites.
610
- homeUnitRole: z.enum(["member", "leader"]).optional(),
619
+ // Role the invitee takes in homeUnitId on acceptance ('unit_owner' is a
620
+ // deferred structural-leadership grant). Optional/'member' for legacy +
621
+ // unit-less invites.
622
+ homeUnitRole: HomeUnitRoleSchema.optional(),
611
623
  createdAt: z.string(),
612
624
  expiresAt: z.string(),
613
625
  acceptedAt: z.string().optional(),
package/src/org/types.ts CHANGED
@@ -420,11 +420,11 @@ export interface OrgInvite {
420
420
  homeUnitId?: string;
421
421
  /**
422
422
  * Role the invitee takes in `homeUnitId` on acceptance — a plain team member,
423
- * or a structural leader of that unit (a *deferred* leadership grant applied
423
+ * or a unit owner of that unit (a *deferred* leadership grant applied
424
424
  * at acceptance time). Distinct from the org-level {@link role}. Optional:
425
425
  * legacy invites and unit-less invites have none (treated as `member`).
426
426
  */
427
- homeUnitRole?: "member" | "leader";
427
+ homeUnitRole?: "member" | "unit_owner";
428
428
  createdAt: string;
429
429
  expiresAt: string;
430
430
  acceptedAt?: string;
@@ -444,12 +444,12 @@ export interface CreateInviteRequest {
444
444
  homeUnitId?: string;
445
445
  /**
446
446
  * Role the invitee takes in `homeUnitId` on acceptance: a plain team member
447
- * (default), or a structural leader of that unit. `leader` is a *deferred*
447
+ * (default), or a unit owner of that unit. `unit_owner` is a *deferred*
448
448
  * grant — the invite is sent now and the leadership is assigned when the
449
449
  * invitee accepts. Only meaningful when `homeUnitId` is set; the backend
450
- * rejects `leader` without a home unit. Optional/`member` for older callers.
450
+ * rejects `unit_owner` without a home unit. Optional/`member` for older callers.
451
451
  */
452
- homeUnitRole?: "member" | "leader";
452
+ homeUnitRole?: "member" | "unit_owner";
453
453
  }
454
454
 
455
455
  /**
@@ -24,7 +24,7 @@ import { z } from "zod";
24
24
 
25
25
  export const ORG_CHART_ROLES = [
26
26
  "owner",
27
- "leader",
27
+ "unit_owner",
28
28
  "delegate",
29
29
  "admin",
30
30
  ] as const;
@@ -44,7 +44,7 @@ export const OrgChartRoleSchema = z.enum(ORG_CHART_ROLES);
44
44
  */
45
45
  export const ORG_CHART_ROLE_LABELS: Record<OrgChartRole, string> = {
46
46
  owner: "CEO",
47
- leader: "Unit owner",
47
+ unit_owner: "Unit owner",
48
48
  delegate: "Delegate",
49
49
  admin: "Admin",
50
50
  };
@@ -12,31 +12,44 @@ TypeScript types for Ralph, an autonomous AI coding loop with graduated trust le
12
12
  - PRD `passes` field is the only field Ralph should modify during execution
13
13
  - Orchestration, prompts, and trust logic live in company-semantics-control, not here
14
14
 
15
- ## Public API
15
+ <!-- BEGIN GENERATED: readme-public-api — derived from code by `pnpm readme-api`. Do not edit. -->
16
16
 
17
- ### PRD Types
17
+ ## Public API
18
18
 
19
- - `RalphPRDCategory` — Category of feature item (`functional`, `architectural`, `integration`, `polish`)
20
- - `RalphPRDPriority` — Priority level (`high`, `medium`, `low`)
21
- - `RalphPRDItem` — Single feature item in a PRD
22
- - `RalphPRD` — Complete PRD document
19
+ - `AllowedRepo` _(type)_
20
+ - `REPO_PRECEDENCE`
21
+ - `RalphAcceptanceCriteria` _(type)_
22
+ - `RalphAgentContract` _(type)_
23
+ - `RalphCapabilities` _(type)_
24
+ - `RalphCommitPolicy` _(type)_
25
+ - `RalphExecutionPolicy` _(type)_
26
+ - `RalphFailurePolicy` _(type)_
27
+ - `RalphFeatureGroup` _(type)_
28
+ - `RalphInteractionFlow` _(type)_
29
+ - `RalphIteration` _(type)_
30
+ - `RalphMeta` _(type)_
31
+ - `RalphMode` _(type)_
32
+ - `RalphPRD` _(type)_
33
+ - `RalphPRDCategory` _(type)_
34
+ - `RalphPRDItem` _(type)_
35
+ - `RalphPRDPriority` _(type)_
36
+ - `RalphProgress` _(type)_
37
+ - `RalphReferenceImplementation` _(type)_
38
+ - `RalphScope` _(type)_
39
+ - `RalphSuccessCriteria` _(type)_
40
+
41
+ <!-- END GENERATED: readme-public-api -->
42
+
43
+ <!-- BEGIN GENERATED: readme-dependencies — derived from code by `pnpm readme-api`. Do not edit. -->
23
44
 
24
- ### Progress Types
45
+ ## Dependencies
25
46
 
26
- - `RalphIteration` — Record of a single iteration
27
- - `RalphMode` — Operation mode (`hitl`, `afk`)
28
- - `RalphProgress` — Complete session progress state
47
+ **Internal domains:**
29
48
 
30
- ### Trust Types
49
+ _None._
31
50
 
32
- - `RalphTrustLevel` — Trust level (0-3)
33
- - `RalphRunResult` — Run outcome (`success`, `failure`)
34
- - `RalphCIStatus` — CI status (`green`, `red`, `skipped`)
35
- - `RalphTrustLog` — Run outcome record for audit
36
- - `RalphTrustPolicy` — Trust policy configuration
37
- - `RalphDemotionReason` — Reasons for automatic demotion
51
+ **External packages:**
38
52
 
39
- ## Dependencies
53
+ _None._
40
54
 
41
- **Imports from:** (none leaf module)
42
- **Imported by:** company-semantics-control
55
+ <!-- END GENERATED: readme-dependencies -->
@@ -49,3 +49,27 @@ This is the canonical semantic across all Company Semantics repos.
49
49
 
50
50
  - PRD-00012: Foundational rate limiting implementation
51
51
  - PRD-00013: Contracts integration (this promotion)
52
+
53
+ <!-- BEGIN GENERATED: readme-public-api — derived from code by `pnpm readme-api`. Do not edit. -->
54
+
55
+ ## Public API
56
+
57
+ - `RateLimitConfig` _(type)_
58
+ - `RateLimitResult` _(type)_
59
+ - `RateLimitTier`
60
+
61
+ <!-- END GENERATED: readme-public-api -->
62
+
63
+ <!-- BEGIN GENERATED: readme-dependencies — derived from code by `pnpm readme-api`. Do not edit. -->
64
+
65
+ ## Dependencies
66
+
67
+ **Internal domains:**
68
+
69
+ _None._
70
+
71
+ **External packages:**
72
+
73
+ _None._
74
+
75
+ <!-- END GENERATED: readme-dependencies -->
@@ -18,28 +18,46 @@ Defines the semantic contract between backend (producer) and site (renderer).
18
18
  - No render hints in contracts — renderers decide presentation independently
19
19
  - `layer` metadata is semantic grouping, not layout instruction
20
20
 
21
+ <!-- BEGIN GENERATED: readme-public-api — derived from code by `pnpm readme-api`. Do not edit. -->
22
+
21
23
  ## Public API
22
24
 
23
- ### Source model (layer-based)
25
+ - `AggregatedCapabilities` _(type)_
26
+ - `CapabilityInvariants` _(type)_
27
+ - `CapabilityManifest` _(type)_
28
+ - `DiagramEdge` _(type)_
29
+ - `DiagramEdgeRelation` _(type)_
30
+ - `DiagramMode` _(type)_
31
+ - `DiagramNode` _(type)_
32
+ - `DiagramNodeKind` _(type)_
33
+ - `DiagramSnapshot` _(type)_
34
+ - `DiagramSpec` _(type)_
35
+ - `EdgeDirection` _(type)_
36
+ - `FeatureStatus` _(type)_
37
+ - `FlowStage` _(type)_
38
+ - `PipelinePhase` _(type)_
39
+ - `RepoCapability` _(type)_
40
+ - `RepoId` _(type)_
41
+ - `SystemCapability` _(type)_
42
+ - `SystemCapabilityManifest` _(type)_
43
+ - `SystemLayer` _(type)_
44
+
45
+ <!-- END GENERATED: readme-public-api -->
46
+
47
+ <!-- BEGIN GENERATED: readme-dependencies — derived from code by `pnpm readme-api`. Do not edit. -->
48
+
49
+ ## Dependencies
24
50
 
25
- - `FeatureStatus` — 'prod' | 'experimental' | 'disabled'
26
- - `SystemCapability` — individual feature definition
27
- - `SystemLayer` — logical layer grouping
28
- - `SystemCapabilityManifest` — full manifest structure (YAML representation)
51
+ **Internal domains:**
29
52
 
30
- ### Diagram graph
53
+ _None._
31
54
 
32
- - `DiagramNodeKind` — 'layer' | 'feature' | 'artifact'
33
- - `DiagramEdgeRelation` — 'contains' | 'flows_to' | 'depends_on'
34
- - `DiagramNode` — semantic node with optional layer grouping
35
- - `DiagramEdge` — semantic relationship between nodes
36
- - `DiagramSpec` — complete graph that crosses system boundaries
55
+ **External packages:**
37
56
 
38
- ## Dependencies
57
+ _None._
39
58
 
40
- **Imports from:** (none leaf module)
41
- **Imported by:** company-semantics (backend), company-semantics-site
59
+ <!-- END GENERATED: readme-dependencies -->
42
60
 
43
61
  ## Specification
44
62
 
45
- See [LIVING_ASCII_DIAGRAM_SPEC.md](../docs/LIVING_ASCII_DIAGRAM_SPEC.md) for the canonical system definition.
63
+ See [LIVING_ASCII_DIAGRAM_SPEC.md](../../docs/LIVING_ASCII_DIAGRAM_SPEC.md) for the canonical system definition.