@company-semantics/contracts 9.0.0 → 9.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 +6 -3
- package/src/__tests__/resource-keys.test.ts +30 -23
- package/src/admin/authz-simulate.ts +4 -4
- package/src/admin/direct-grants.ts +2 -2
- package/src/api/generated-spec-hash.ts +2 -2
- package/src/api/generated.ts +97 -0
- package/src/api/http/routes/ai-chat.ts +3 -3
- package/src/api/http/utils/resource-response.ts +5 -2
- package/src/api/index.ts +4 -4
- package/src/api/primitives.ts +6 -2
- package/src/auth/README.md +1 -0
- package/src/auth/index.ts +12 -5
- package/src/autotune.ts +5 -1
- package/src/billing/index.ts +1 -1
- package/src/billing/types.ts +1 -1
- package/src/chat/README.md +3 -0
- package/src/chat/__tests__/runtime-profile.test.ts +68 -48
- package/src/chat/index.ts +10 -4
- package/src/chat/runtime-profile.ts +25 -10
- package/src/chat/schemas.ts +49 -41
- package/src/chat/types.ts +48 -42
- package/src/ci-envelope/README.md +2 -0
- package/src/ci-envelope/__tests__/transitions.test.ts +56 -56
- package/src/ci-envelope/index.ts +2 -2
- package/src/ci-envelope/types.ts +20 -20
- package/src/ci-results/index.ts +2 -2
- package/src/ci-results/repo-ci-result.ts +15 -12
- package/src/compatibility.ts +6 -6
- package/src/content/index.ts +10 -4
- package/src/content/schemas.ts +42 -24
- package/src/dispatch/index.ts +18 -15
- package/src/email/__tests__/registry.test.ts +81 -77
- package/src/email/index.ts +3 -3
- package/src/email/registry.ts +25 -25
- package/src/email/types.ts +43 -43
- package/src/errors/index.ts +8 -8
- package/src/execution/__tests__/events.test.ts +42 -42
- package/src/execution/__tests__/lifecycle.test.ts +192 -190
- package/src/execution/__tests__/registry.test.ts +114 -114
- package/src/execution/audit-export.ts +4 -4
- package/src/execution/errors.ts +7 -7
- package/src/execution/event-metadata.ts +4 -4
- package/src/execution/events.ts +23 -21
- package/src/execution/expiry.ts +5 -5
- package/src/execution/hash-chain.ts +2 -2
- package/src/execution/index.ts +19 -28
- package/src/execution/kinds.ts +7 -7
- package/src/execution/lifecycle.ts +33 -33
- package/src/execution/registry.ts +63 -63
- package/src/execution/schemas.ts +31 -23
- package/src/execution/status.ts +45 -26
- package/src/execution/summary.ts +16 -17
- package/src/execution/timeline-ui.ts +9 -9
- package/src/execution/types.ts +31 -25
- package/src/generated/openapi-routes.ts +2 -0
- package/src/guards/config.ts +22 -18
- package/src/guards/index.ts +4 -4
- package/src/guards/types.ts +32 -24
- package/src/identity/__tests__/avatar.test.ts +68 -59
- package/src/identity/avatar.ts +8 -8
- package/src/identity/display-name.ts +3 -3
- package/src/identity/index.ts +8 -8
- package/src/identity/people-org-chart.ts +8 -4
- package/src/identity/schemas.ts +28 -18
- package/src/identity/types.ts +5 -5
- package/src/impersonation/index.ts +5 -5
- package/src/impersonation/schemas.ts +15 -9
- package/src/impersonation-events.ts +21 -21
- package/src/impersonation.ts +25 -24
- package/src/index.ts +118 -90
- package/src/interfaces/mcp/tools/help.ts +19 -19
- package/src/internal-admin.ts +6 -6
- package/src/mcp/README.md +2 -0
- package/src/mcp/__tests__/capability-graph.test.ts +290 -290
- package/src/mcp/capability-graph.ts +42 -40
- package/src/mcp/failure-context.ts +1 -3
- package/src/mcp/index.ts +69 -56
- package/src/mcp/resources.ts +9 -9
- package/src/meetings/index.ts +2 -2
- package/src/meetings/schemas.ts +51 -34
- package/src/message-parts/README.md +2 -0
- package/src/message-parts/__tests__/builder.test.ts +142 -142
- package/src/message-parts/__tests__/confirmation.test.ts +100 -86
- package/src/message-parts/__tests__/preview.test.ts +63 -63
- package/src/message-parts/__tests__/wire.test.ts +130 -124
- package/src/message-parts/builder.ts +23 -23
- package/src/message-parts/confirmation.ts +17 -14
- package/src/message-parts/execution.ts +7 -7
- package/src/message-parts/index.ts +10 -10
- package/src/message-parts/lifecycle.ts +25 -25
- package/src/message-parts/preview.ts +30 -30
- package/src/message-parts/types.ts +27 -27
- package/src/message-parts/wire.ts +24 -24
- package/src/mutations.ts +2 -2
- package/src/observability.ts +23 -11
- package/src/org/__tests__/org-units.test.ts +131 -96
- package/src/org/__tests__/tree-ordering.test.ts +57 -37
- package/src/org/__tests__/view-scopes.test.ts +40 -40
- package/src/org/domain.ts +9 -9
- package/src/org/index.ts +31 -21
- package/src/org/org-units.ts +34 -20
- package/src/org/schemas.ts +261 -124
- package/src/org/sharing.ts +17 -13
- package/src/org/tree-ordering.ts +3 -1
- package/src/org/types.ts +54 -47
- package/src/org/view-scopes.ts +9 -9
- package/src/permissions/access-levels.ts +7 -2
- package/src/permissions/access-source.ts +6 -6
- package/src/permissions/index.ts +5 -5
- package/src/permissions/orgchart-roles.ts +7 -7
- package/src/permissions/permission-introspection.ts +7 -5
- package/src/permissions/share-api.ts +19 -9
- package/src/pressure.ts +4 -4
- package/src/queryIntent.ts +21 -21
- package/src/ralph/__tests__/prd-groups.test.ts +159 -159
- package/src/ralph/__tests__/prd.test.ts +30 -30
- package/src/ralph/index.ts +3 -8
- package/src/ralph/prd.ts +33 -33
- package/src/ralph/progress.ts +1 -1
- package/src/rate-limit/README.md +4 -4
- package/src/rate-limit/index.ts +3 -3
- package/src/requests.ts +36 -8
- package/src/resource-keys.ts +207 -124
- package/src/resource-registry.ts +5 -5
- package/src/route-builder.ts +3 -3
- package/src/safe-mode.ts +2 -2
- package/src/security/index.ts +4 -4
- package/src/security/org-secrets.ts +13 -9
- package/src/security/secret.ts +3 -3
- package/src/sse.ts +3 -1
- package/src/system/README.md +3 -0
- package/src/system/capabilities.ts +22 -23
- package/src/system/diagram.ts +45 -45
- package/src/system/index.ts +14 -14
- package/src/tiers.ts +1 -1
- package/src/timeouts.ts +1 -1
- package/src/tracing.ts +30 -30
- package/src/types/analytics.ts +2 -2
- package/src/usage/README.md +3 -0
- package/src/usage/execution-types.ts +69 -69
- package/src/usage/types.ts +7 -3
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* @see decisions/ADR-CONT-026.md for design rationale
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import type { ToolListMessagePart } from
|
|
17
|
-
import type { PreviewPart } from
|
|
18
|
-
import type { ConfirmationPart } from
|
|
16
|
+
import type { ToolListMessagePart } from "../mcp/index";
|
|
17
|
+
import type { PreviewPart } from "./preview";
|
|
18
|
+
import type { ConfirmationPart } from "./confirmation";
|
|
19
19
|
|
|
20
20
|
// =============================================================================
|
|
21
21
|
// Narrative Parts (Streamable)
|
|
@@ -28,9 +28,9 @@ import type { ConfirmationPart } from './confirmation'
|
|
|
28
28
|
* Design: Aligns with AI SDK's TextPart for interoperability.
|
|
29
29
|
*/
|
|
30
30
|
export interface TextPart {
|
|
31
|
-
type:
|
|
31
|
+
type: "text";
|
|
32
32
|
/** The text content (may be partial during streaming) */
|
|
33
|
-
text: string
|
|
33
|
+
text: string;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// =============================================================================
|
|
@@ -40,18 +40,18 @@ export interface TextPart {
|
|
|
40
40
|
/**
|
|
41
41
|
* Re-export ToolListMessagePart as ToolListPart for consistency.
|
|
42
42
|
*/
|
|
43
|
-
export type ToolListPart = ToolListMessagePart
|
|
43
|
+
export type ToolListPart = ToolListMessagePart;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Status panel surface part.
|
|
47
47
|
* Displays system status, connection states, or progress indicators.
|
|
48
48
|
*/
|
|
49
49
|
export interface StatusPanelPart {
|
|
50
|
-
type:
|
|
50
|
+
type: "status-panel";
|
|
51
51
|
/** Panel title */
|
|
52
|
-
title: string
|
|
52
|
+
title: string;
|
|
53
53
|
/** Status entries */
|
|
54
|
-
entries: StatusPanelEntry[]
|
|
54
|
+
entries: StatusPanelEntry[];
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -59,11 +59,11 @@ export interface StatusPanelPart {
|
|
|
59
59
|
*/
|
|
60
60
|
export interface StatusPanelEntry {
|
|
61
61
|
/** Entry label */
|
|
62
|
-
label: string
|
|
62
|
+
label: string;
|
|
63
63
|
/** Current status */
|
|
64
|
-
status:
|
|
64
|
+
status: "ok" | "warning" | "error" | "pending";
|
|
65
65
|
/** Optional detail text */
|
|
66
|
-
detail?: string
|
|
66
|
+
detail?: string;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
@@ -71,23 +71,23 @@ export interface StatusPanelEntry {
|
|
|
71
71
|
* Renders a data visualization.
|
|
72
72
|
*/
|
|
73
73
|
export interface ChartPart {
|
|
74
|
-
type:
|
|
74
|
+
type: "chart";
|
|
75
75
|
/** Chart type */
|
|
76
|
-
chartType:
|
|
76
|
+
chartType: "bar" | "line" | "pie" | "area";
|
|
77
77
|
/** Chart title */
|
|
78
|
-
title?: string
|
|
78
|
+
title?: string;
|
|
79
79
|
/** Data points */
|
|
80
|
-
data: ChartDataPoint[]
|
|
80
|
+
data: ChartDataPoint[];
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* Single data point for charts.
|
|
85
85
|
*/
|
|
86
86
|
export interface ChartDataPoint {
|
|
87
|
-
label: string
|
|
88
|
-
value: number
|
|
87
|
+
label: string;
|
|
88
|
+
value: number;
|
|
89
89
|
/** Optional color (CSS color string) */
|
|
90
|
-
color?: string
|
|
90
|
+
color?: string;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
@@ -95,13 +95,13 @@ export interface ChartDataPoint {
|
|
|
95
95
|
* Renders tabular data.
|
|
96
96
|
*/
|
|
97
97
|
export interface TablePart {
|
|
98
|
-
type:
|
|
98
|
+
type: "table";
|
|
99
99
|
/** Table title */
|
|
100
|
-
title?: string
|
|
100
|
+
title?: string;
|
|
101
101
|
/** Column headers */
|
|
102
|
-
headers: string[]
|
|
102
|
+
headers: string[];
|
|
103
103
|
/** Row data (each row is an array of cell values) */
|
|
104
|
-
rows: string[][]
|
|
104
|
+
rows: string[][];
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// =============================================================================
|
|
@@ -118,13 +118,13 @@ export type SurfacePart =
|
|
|
118
118
|
| ChartPart
|
|
119
119
|
| TablePart
|
|
120
120
|
| ConfirmationPart
|
|
121
|
-
| PreviewPart
|
|
121
|
+
| PreviewPart;
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* All assistant message part types.
|
|
125
125
|
* Union of narrative (text) and surface parts.
|
|
126
126
|
*/
|
|
127
|
-
export type AssistantMessagePart = TextPart | SurfacePart
|
|
127
|
+
export type AssistantMessagePart = TextPart | SurfacePart;
|
|
128
128
|
|
|
129
129
|
// =============================================================================
|
|
130
130
|
// Type Guards
|
|
@@ -134,12 +134,12 @@ export type AssistantMessagePart = TextPart | SurfacePart
|
|
|
134
134
|
* Type guard for TextPart.
|
|
135
135
|
*/
|
|
136
136
|
export function isTextPart(part: AssistantMessagePart): part is TextPart {
|
|
137
|
-
return part.type ===
|
|
137
|
+
return part.type === "text";
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* Type guard for SurfacePart.
|
|
142
142
|
*/
|
|
143
143
|
export function isSurfacePart(part: AssistantMessagePart): part is SurfacePart {
|
|
144
|
-
return part.type !==
|
|
144
|
+
return part.type !== "text";
|
|
145
145
|
}
|
|
@@ -10,22 +10,19 @@
|
|
|
10
10
|
* @see decisions/ADR-CONT-026.md for design rationale
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import type { MCPToolDescriptor, ToolListDataPart } from
|
|
14
|
-
import type { PreviewDataPart, PreviewData } from
|
|
15
|
-
import type {
|
|
16
|
-
ConfirmationData,
|
|
17
|
-
ConfirmationDataPart,
|
|
18
|
-
} from './confirmation'
|
|
13
|
+
import type { MCPToolDescriptor, ToolListDataPart } from "../mcp/index";
|
|
14
|
+
import type { PreviewDataPart, PreviewData } from "./preview";
|
|
15
|
+
import type { ConfirmationData, ConfirmationDataPart } from "./confirmation";
|
|
19
16
|
import type {
|
|
20
17
|
ExecutionResultData,
|
|
21
18
|
ExecutionResultDataPart,
|
|
22
19
|
UndoResultData,
|
|
23
20
|
UndoResultDataPart,
|
|
24
|
-
} from
|
|
21
|
+
} from "./execution";
|
|
25
22
|
import type {
|
|
26
23
|
MessageStartDataPart,
|
|
27
24
|
MessageCompleteDataPart,
|
|
28
|
-
} from
|
|
25
|
+
} from "./lifecycle";
|
|
29
26
|
|
|
30
27
|
/**
|
|
31
28
|
* Factory for creating wire-format surface parts.
|
|
@@ -48,9 +45,9 @@ export const WireSurfaceBuilder = {
|
|
|
48
45
|
*/
|
|
49
46
|
toolList(tools: MCPToolDescriptor[]): ToolListDataPart {
|
|
50
47
|
return {
|
|
51
|
-
type:
|
|
48
|
+
type: "data-tool-list",
|
|
52
49
|
data: { tools },
|
|
53
|
-
}
|
|
50
|
+
};
|
|
54
51
|
},
|
|
55
52
|
|
|
56
53
|
/**
|
|
@@ -67,9 +64,9 @@ export const WireSurfaceBuilder = {
|
|
|
67
64
|
*/
|
|
68
65
|
preview(data: PreviewData): PreviewDataPart {
|
|
69
66
|
return {
|
|
70
|
-
type:
|
|
67
|
+
type: "data-preview",
|
|
71
68
|
data,
|
|
72
|
-
}
|
|
69
|
+
};
|
|
73
70
|
},
|
|
74
71
|
|
|
75
72
|
/**
|
|
@@ -85,9 +82,9 @@ export const WireSurfaceBuilder = {
|
|
|
85
82
|
*/
|
|
86
83
|
confirmation(data: ConfirmationData): ConfirmationDataPart {
|
|
87
84
|
return {
|
|
88
|
-
type:
|
|
85
|
+
type: "data-confirmation",
|
|
89
86
|
data,
|
|
90
|
-
}
|
|
87
|
+
};
|
|
91
88
|
},
|
|
92
89
|
|
|
93
90
|
/**
|
|
@@ -104,9 +101,9 @@ export const WireSurfaceBuilder = {
|
|
|
104
101
|
*/
|
|
105
102
|
executionResult(data: ExecutionResultData): ExecutionResultDataPart {
|
|
106
103
|
return {
|
|
107
|
-
type:
|
|
104
|
+
type: "data-execution-result",
|
|
108
105
|
data,
|
|
109
|
-
}
|
|
106
|
+
};
|
|
110
107
|
},
|
|
111
108
|
|
|
112
109
|
/**
|
|
@@ -123,9 +120,9 @@ export const WireSurfaceBuilder = {
|
|
|
123
120
|
*/
|
|
124
121
|
undoResult(data: UndoResultData): UndoResultDataPart {
|
|
125
122
|
return {
|
|
126
|
-
type:
|
|
123
|
+
type: "data-undo-result",
|
|
127
124
|
data,
|
|
128
|
-
}
|
|
125
|
+
};
|
|
129
126
|
},
|
|
130
127
|
|
|
131
128
|
// =========================================================================
|
|
@@ -145,13 +142,13 @@ export const WireSurfaceBuilder = {
|
|
|
145
142
|
*/
|
|
146
143
|
messageStart(messageId: string): MessageStartDataPart {
|
|
147
144
|
return {
|
|
148
|
-
type:
|
|
145
|
+
type: "data-message-start",
|
|
149
146
|
data: {
|
|
150
147
|
version: 1,
|
|
151
148
|
messageId,
|
|
152
149
|
timestamp: new Date().toISOString(),
|
|
153
150
|
},
|
|
154
|
-
}
|
|
151
|
+
};
|
|
155
152
|
},
|
|
156
153
|
|
|
157
154
|
/**
|
|
@@ -167,15 +164,18 @@ export const WireSurfaceBuilder = {
|
|
|
167
164
|
* @param narrativeLength - Total length of streamed narrative text
|
|
168
165
|
* @returns Wire-format message complete event
|
|
169
166
|
*/
|
|
170
|
-
messageComplete(
|
|
167
|
+
messageComplete(
|
|
168
|
+
messageId: string,
|
|
169
|
+
narrativeLength: number,
|
|
170
|
+
): MessageCompleteDataPart {
|
|
171
171
|
return {
|
|
172
|
-
type:
|
|
172
|
+
type: "data-message-complete",
|
|
173
173
|
data: {
|
|
174
174
|
version: 1,
|
|
175
175
|
messageId,
|
|
176
176
|
narrativeLength,
|
|
177
177
|
timestamp: new Date().toISOString(),
|
|
178
178
|
},
|
|
179
|
-
}
|
|
179
|
+
};
|
|
180
180
|
},
|
|
181
|
-
} as const
|
|
181
|
+
} as const;
|
package/src/mutations.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { MutationBehavior } from
|
|
1
|
+
export type { MutationBehavior } from "./requests";
|
|
2
2
|
|
|
3
3
|
export type MutationPolicy = {
|
|
4
4
|
/**
|
|
@@ -9,5 +9,5 @@ export type MutationPolicy = {
|
|
|
9
9
|
* parallel — independent mutations on different resourceIds may run concurrently;
|
|
10
10
|
* same-resource requests still serialize to avoid lost writes.
|
|
11
11
|
*/
|
|
12
|
-
behavior:
|
|
12
|
+
behavior: "collapse" | "queue" | "parallel";
|
|
13
13
|
};
|
package/src/observability.ts
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
export const REQUEST_ID_HEADER =
|
|
1
|
+
export const REQUEST_ID_HEADER = "x-request-id";
|
|
2
2
|
|
|
3
3
|
export type Labels = Record<string, string>;
|
|
4
4
|
export type MetricEnvelope =
|
|
5
|
-
| {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
| {
|
|
6
|
+
kind: "counter";
|
|
7
|
+
name: string;
|
|
8
|
+
value: number;
|
|
9
|
+
labels?: Labels;
|
|
10
|
+
ts: number;
|
|
11
|
+
}
|
|
12
|
+
| { kind: "gauge"; name: string; value: number; labels?: Labels; ts: number }
|
|
13
|
+
| {
|
|
14
|
+
kind: "histogram";
|
|
15
|
+
name: string;
|
|
16
|
+
value: number;
|
|
17
|
+
labels?: Labels;
|
|
18
|
+
ts: number;
|
|
19
|
+
};
|
|
8
20
|
|
|
9
21
|
export type SchedulerMetricName =
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
22
|
+
| "scheduler.inflight_requests"
|
|
23
|
+
| "scheduler.queue_depth"
|
|
24
|
+
| "scheduler.queue_wait_ms"
|
|
25
|
+
| "scheduler.dedupe_hits"
|
|
26
|
+
| "scheduler.heap_used_bytes"
|
|
27
|
+
| "scheduler.rss_bytes"
|
|
28
|
+
| "scheduler.fetch_latency_ms";
|