@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
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* @see decisions/ADR-CONT-026.md for design rationale
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import type { AssistantMessagePart, TextPart, SurfacePart } from
|
|
21
|
+
import type { AssistantMessagePart, TextPart, SurfacePart } from "./types";
|
|
22
22
|
|
|
23
23
|
// =============================================================================
|
|
24
24
|
// Builder State
|
|
@@ -30,13 +30,13 @@ import type { AssistantMessagePart, TextPart, SurfacePart } from './types'
|
|
|
30
30
|
*/
|
|
31
31
|
export interface PartBuilderState {
|
|
32
32
|
/** Collected parts in order */
|
|
33
|
-
readonly parts: readonly AssistantMessagePart[]
|
|
33
|
+
readonly parts: readonly AssistantMessagePart[];
|
|
34
34
|
/** Whether any surface part has been added (true = SurfaceState) */
|
|
35
|
-
readonly hasSurface: boolean
|
|
35
|
+
readonly hasSurface: boolean;
|
|
36
36
|
/** Whether dev mode is enabled (throws on invariant violation) */
|
|
37
|
-
readonly devMode: boolean
|
|
37
|
+
readonly devMode: boolean;
|
|
38
38
|
/** Count of dropped text parts (for logging) */
|
|
39
|
-
readonly droppedCount: number
|
|
39
|
+
readonly droppedCount: number;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
@@ -44,9 +44,9 @@ export interface PartBuilderState {
|
|
|
44
44
|
*/
|
|
45
45
|
export interface AddPartResult {
|
|
46
46
|
/** Updated builder state */
|
|
47
|
-
state: PartBuilderState
|
|
47
|
+
state: PartBuilderState;
|
|
48
48
|
/** Whether the part was accepted (false = dropped) */
|
|
49
|
-
accepted: boolean
|
|
49
|
+
accepted: boolean;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// =============================================================================
|
|
@@ -68,7 +68,7 @@ export function createPartBuilder(devMode = false): PartBuilderState {
|
|
|
68
68
|
hasSurface: false,
|
|
69
69
|
devMode,
|
|
70
70
|
droppedCount: 0,
|
|
71
|
-
}
|
|
71
|
+
};
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// =============================================================================
|
|
@@ -92,27 +92,27 @@ export function createPartBuilder(devMode = false): PartBuilderState {
|
|
|
92
92
|
* state = result.state;
|
|
93
93
|
*/
|
|
94
94
|
export function addText(state: PartBuilderState, text: string): AddPartResult {
|
|
95
|
-
const part: TextPart = { type:
|
|
95
|
+
const part: TextPart = { type: "text", text };
|
|
96
96
|
|
|
97
97
|
if (state.hasSurface) {
|
|
98
98
|
if (state.devMode) {
|
|
99
99
|
throw new Error(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
`Parts so far: ${state.parts.length}, dropped: ${state.droppedCount}
|
|
103
|
-
)
|
|
100
|
+
"PartBuilder invariant violation: text part added after surface part. " +
|
|
101
|
+
"Narrative content must come before structured surfaces. " +
|
|
102
|
+
`Parts so far: ${state.parts.length}, dropped: ${state.droppedCount}`,
|
|
103
|
+
);
|
|
104
104
|
}
|
|
105
105
|
// Prod mode: drop silently
|
|
106
106
|
return {
|
|
107
107
|
state: { ...state, droppedCount: state.droppedCount + 1 },
|
|
108
108
|
accepted: false,
|
|
109
|
-
}
|
|
109
|
+
};
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
return {
|
|
113
113
|
state: { ...state, parts: [...state.parts, part] },
|
|
114
114
|
accepted: true,
|
|
115
|
-
}
|
|
115
|
+
};
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
@@ -131,7 +131,7 @@ export function addText(state: PartBuilderState, text: string): AddPartResult {
|
|
|
131
131
|
*/
|
|
132
132
|
export function addSurface(
|
|
133
133
|
state: PartBuilderState,
|
|
134
|
-
part: SurfacePart
|
|
134
|
+
part: SurfacePart,
|
|
135
135
|
): AddPartResult {
|
|
136
136
|
return {
|
|
137
137
|
state: {
|
|
@@ -140,7 +140,7 @@ export function addSurface(
|
|
|
140
140
|
hasSurface: true,
|
|
141
141
|
},
|
|
142
142
|
accepted: true,
|
|
143
|
-
}
|
|
143
|
+
};
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
/**
|
|
@@ -153,12 +153,12 @@ export function addSurface(
|
|
|
153
153
|
*/
|
|
154
154
|
export function addPart(
|
|
155
155
|
state: PartBuilderState,
|
|
156
|
-
part: AssistantMessagePart
|
|
156
|
+
part: AssistantMessagePart,
|
|
157
157
|
): AddPartResult {
|
|
158
|
-
if (part.type ===
|
|
159
|
-
return addText(state, part.text)
|
|
158
|
+
if (part.type === "text") {
|
|
159
|
+
return addText(state, part.text);
|
|
160
160
|
}
|
|
161
|
-
return addSurface(state, part)
|
|
161
|
+
return addSurface(state, part);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
// =============================================================================
|
|
@@ -172,7 +172,7 @@ export function addPart(
|
|
|
172
172
|
* @returns Array of message parts in correct order
|
|
173
173
|
*/
|
|
174
174
|
export function buildParts(state: PartBuilderState): AssistantMessagePart[] {
|
|
175
|
-
return [...state.parts]
|
|
175
|
+
return [...state.parts];
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
@@ -182,5 +182,5 @@ export function buildParts(state: PartBuilderState): AssistantMessagePart[] {
|
|
|
182
182
|
* @returns Number of parts dropped due to invariant violations
|
|
183
183
|
*/
|
|
184
184
|
export function getDroppedCount(state: PartBuilderState): number {
|
|
185
|
-
return state.droppedCount
|
|
185
|
+
return state.droppedCount;
|
|
186
186
|
}
|
|
@@ -17,32 +17,36 @@
|
|
|
17
17
|
* @see decisions/ADR-CONT-037.md for design rationale
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import type { ExecutionKind } from
|
|
20
|
+
import type { ExecutionKind } from "../execution/kinds";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Choice options for confirmation.
|
|
24
24
|
*/
|
|
25
|
-
export type ConfirmationChoice =
|
|
25
|
+
export type ConfirmationChoice = "confirm" | "cancel";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Risk level for confirmation prompts.
|
|
29
29
|
* Uses 'moderate' (not 'medium') for semantic precision.
|
|
30
30
|
* 'irreversible' indicates destructive operations that cannot be undone.
|
|
31
31
|
*/
|
|
32
|
-
export type ConfirmationRiskLevel =
|
|
32
|
+
export type ConfirmationRiskLevel =
|
|
33
|
+
| "low"
|
|
34
|
+
| "moderate"
|
|
35
|
+
| "high"
|
|
36
|
+
| "irreversible";
|
|
33
37
|
|
|
34
38
|
/**
|
|
35
39
|
* Human-readable confirmation dialog titles for each execution kind.
|
|
36
40
|
* Exhaustive — TypeScript enforces completeness via Record type.
|
|
37
41
|
*/
|
|
38
42
|
export const CONFIRMATION_LABELS: Record<ExecutionKind, string> = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
"integration.connect": "Connect Integration",
|
|
44
|
+
"integration.disconnect": "Disconnect Integration",
|
|
45
|
+
"profile.update": "Update Profile",
|
|
46
|
+
"slack.send": "Send Slack Message",
|
|
47
|
+
"data.ingest": "Import Channel",
|
|
48
|
+
"data.scope": "Update Scope",
|
|
49
|
+
"system.cleanup": "Cleanup Connections",
|
|
46
50
|
};
|
|
47
51
|
|
|
48
52
|
/**
|
|
@@ -55,7 +59,7 @@ export function getConfirmationLabel(
|
|
|
55
59
|
if (executorKind && executorKind in CONFIRMATION_LABELS) {
|
|
56
60
|
return CONFIRMATION_LABELS[executorKind];
|
|
57
61
|
}
|
|
58
|
-
return fallbackTitle ??
|
|
62
|
+
return fallbackTitle ?? "Confirm Action";
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
export interface ConfirmationData {
|
|
@@ -86,7 +90,7 @@ export interface ConfirmationResponseData {
|
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
export interface ConfirmationPart {
|
|
89
|
-
type:
|
|
93
|
+
type: "confirmation";
|
|
90
94
|
data: ConfirmationData;
|
|
91
95
|
}
|
|
92
96
|
|
|
@@ -94,7 +98,6 @@ export interface ConfirmationPart {
|
|
|
94
98
|
* Confirmation request data part (wire format).
|
|
95
99
|
*/
|
|
96
100
|
export interface ConfirmationDataPart {
|
|
97
|
-
type:
|
|
101
|
+
type: "data-confirmation";
|
|
98
102
|
data: ConfirmationData;
|
|
99
103
|
}
|
|
100
|
-
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* @see decisions/ADR-CONT-037.md for design rationale
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
import type { PreviewArtifactKind } from
|
|
30
|
+
import type { PreviewArtifactKind } from "./preview";
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Status of a single artifact's execution.
|
|
@@ -35,7 +35,7 @@ import type { PreviewArtifactKind } from './preview';
|
|
|
35
35
|
export interface ExecutionArtifactStatus {
|
|
36
36
|
kind: PreviewArtifactKind;
|
|
37
37
|
label: string;
|
|
38
|
-
status:
|
|
38
|
+
status: "success" | "failed" | "skipped";
|
|
39
39
|
error?: string;
|
|
40
40
|
/** Human-readable result summary, e.g. 'Preferred name set to Ian' */
|
|
41
41
|
resultLabel?: string;
|
|
@@ -70,7 +70,7 @@ export interface ExecutionResultData {
|
|
|
70
70
|
/** Execution row ID — required for undo endpoint dispatch */
|
|
71
71
|
executionId: string;
|
|
72
72
|
/** Resolved from ExecutionState — single authority (INV-1) */
|
|
73
|
-
state:
|
|
73
|
+
state: "completed" | "failed";
|
|
74
74
|
artifacts: ExecutionArtifactStatus[];
|
|
75
75
|
/** Structured summary for generic UI rendering (executor-provided) */
|
|
76
76
|
summary: ExecutionResultSummary;
|
|
@@ -82,7 +82,7 @@ export interface ExecutionResultData {
|
|
|
82
82
|
* Execution result message part (semantic type).
|
|
83
83
|
*/
|
|
84
84
|
export interface ExecutionResultPart {
|
|
85
|
-
type:
|
|
85
|
+
type: "execution-result";
|
|
86
86
|
data: ExecutionResultData;
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -90,7 +90,7 @@ export interface ExecutionResultPart {
|
|
|
90
90
|
* Execution result data part (wire format).
|
|
91
91
|
*/
|
|
92
92
|
export interface ExecutionResultDataPart {
|
|
93
|
-
type:
|
|
93
|
+
type: "data-execution-result";
|
|
94
94
|
data: ExecutionResultData;
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -109,7 +109,7 @@ export interface UndoResultData {
|
|
|
109
109
|
executionId: string;
|
|
110
110
|
/** New undo audit row ID (append-only, INV-2) */
|
|
111
111
|
undoExecutionId: string;
|
|
112
|
-
status:
|
|
112
|
+
status: "success" | "failed";
|
|
113
113
|
error?: string;
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -117,6 +117,6 @@ export interface UndoResultData {
|
|
|
117
117
|
* Undo result data part (wire format).
|
|
118
118
|
*/
|
|
119
119
|
export interface UndoResultDataPart {
|
|
120
|
-
type:
|
|
120
|
+
type: "data-undo-result";
|
|
121
121
|
data: UndoResultData;
|
|
122
122
|
}
|
|
@@ -16,7 +16,7 @@ export type {
|
|
|
16
16
|
TablePart,
|
|
17
17
|
SurfacePart,
|
|
18
18
|
AssistantMessagePart,
|
|
19
|
-
} from
|
|
19
|
+
} from "./types";
|
|
20
20
|
|
|
21
21
|
// Preview types
|
|
22
22
|
export type {
|
|
@@ -28,7 +28,7 @@ export type {
|
|
|
28
28
|
PreviewData,
|
|
29
29
|
PreviewPart,
|
|
30
30
|
PreviewDataPart,
|
|
31
|
-
} from
|
|
31
|
+
} from "./preview";
|
|
32
32
|
|
|
33
33
|
// Confirmation types
|
|
34
34
|
export type {
|
|
@@ -38,10 +38,10 @@ export type {
|
|
|
38
38
|
ConfirmationResponseData,
|
|
39
39
|
ConfirmationPart,
|
|
40
40
|
ConfirmationDataPart,
|
|
41
|
-
} from
|
|
41
|
+
} from "./confirmation";
|
|
42
42
|
|
|
43
43
|
// Confirmation runtime values
|
|
44
|
-
export { CONFIRMATION_LABELS, getConfirmationLabel } from
|
|
44
|
+
export { CONFIRMATION_LABELS, getConfirmationLabel } from "./confirmation";
|
|
45
45
|
|
|
46
46
|
// Execution result types
|
|
47
47
|
export type {
|
|
@@ -53,7 +53,7 @@ export type {
|
|
|
53
53
|
ExecutionResultDataPart,
|
|
54
54
|
UndoResultData,
|
|
55
55
|
UndoResultDataPart,
|
|
56
|
-
} from
|
|
56
|
+
} from "./execution";
|
|
57
57
|
|
|
58
58
|
// Lifecycle types (Phase 1 streaming)
|
|
59
59
|
export type {
|
|
@@ -68,13 +68,13 @@ export type {
|
|
|
68
68
|
MessageStartDataPart,
|
|
69
69
|
MessageDeltaDataPart,
|
|
70
70
|
MessageCompleteDataPart,
|
|
71
|
-
} from
|
|
71
|
+
} from "./lifecycle";
|
|
72
72
|
|
|
73
73
|
// Type guards
|
|
74
|
-
export { isTextPart, isSurfacePart } from
|
|
74
|
+
export { isTextPart, isSurfacePart } from "./types";
|
|
75
75
|
|
|
76
76
|
// Builder functions
|
|
77
|
-
export type { PartBuilderState, AddPartResult } from
|
|
77
|
+
export type { PartBuilderState, AddPartResult } from "./builder";
|
|
78
78
|
export {
|
|
79
79
|
createPartBuilder,
|
|
80
80
|
addText,
|
|
@@ -82,7 +82,7 @@ export {
|
|
|
82
82
|
addPart,
|
|
83
83
|
buildParts,
|
|
84
84
|
getDroppedCount,
|
|
85
|
-
} from
|
|
85
|
+
} from "./builder";
|
|
86
86
|
|
|
87
87
|
// Wire format builder
|
|
88
|
-
export { WireSurfaceBuilder } from
|
|
88
|
+
export { WireSurfaceBuilder } from "./wire";
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* - streaming: Between message.start and message.complete
|
|
25
25
|
* - complete: After message.complete received
|
|
26
26
|
*/
|
|
27
|
-
export type StreamPhase =
|
|
27
|
+
export type StreamPhase = "idle" | "streaming" | "complete";
|
|
28
28
|
|
|
29
29
|
// =============================================================================
|
|
30
30
|
// Lifecycle Event Types
|
|
@@ -34,9 +34,9 @@ export type StreamPhase = 'idle' | 'streaming' | 'complete'
|
|
|
34
34
|
* Lifecycle event type discriminator.
|
|
35
35
|
*/
|
|
36
36
|
export type MessageLifecycleEventType =
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
37
|
+
| "message.start"
|
|
38
|
+
| "message.delta"
|
|
39
|
+
| "message.complete";
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Base interface for all message lifecycle events.
|
|
@@ -47,10 +47,10 @@ export type MessageLifecycleEventType =
|
|
|
47
47
|
* @property timestamp - ISO 8601 timestamp of event emission
|
|
48
48
|
*/
|
|
49
49
|
export interface MessageLifecycleEvent {
|
|
50
|
-
type: MessageLifecycleEventType
|
|
51
|
-
version: 1
|
|
52
|
-
messageId: string
|
|
53
|
-
timestamp: string
|
|
50
|
+
type: MessageLifecycleEventType;
|
|
51
|
+
version: 1;
|
|
52
|
+
messageId: string;
|
|
53
|
+
timestamp: string;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/**
|
|
@@ -58,7 +58,7 @@ export interface MessageLifecycleEvent {
|
|
|
58
58
|
* Emitted when a new message stream begins.
|
|
59
59
|
*/
|
|
60
60
|
export interface MessageStartEvent extends MessageLifecycleEvent {
|
|
61
|
-
type:
|
|
61
|
+
type: "message.start";
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
@@ -67,9 +67,9 @@ export interface MessageStartEvent extends MessageLifecycleEvent {
|
|
|
67
67
|
* Only contains narrative text, not surface parts.
|
|
68
68
|
*/
|
|
69
69
|
export interface MessageDeltaEvent extends MessageLifecycleEvent {
|
|
70
|
-
type:
|
|
70
|
+
type: "message.delta";
|
|
71
71
|
/** The text delta (narrative content only) */
|
|
72
|
-
delta: string
|
|
72
|
+
delta: string;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -78,9 +78,9 @@ export interface MessageDeltaEvent extends MessageLifecycleEvent {
|
|
|
78
78
|
* Signals that all narrative content has been streamed.
|
|
79
79
|
*/
|
|
80
80
|
export interface MessageCompleteEvent extends MessageLifecycleEvent {
|
|
81
|
-
type:
|
|
81
|
+
type: "message.complete";
|
|
82
82
|
/** Total length of narrative content for validation */
|
|
83
|
-
narrativeLength: number
|
|
83
|
+
narrativeLength: number;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// =============================================================================
|
|
@@ -99,21 +99,21 @@ export interface MessageCompleteEvent extends MessageLifecycleEvent {
|
|
|
99
99
|
* Examples: tool lists, cards, dashboards, MCP UI components
|
|
100
100
|
* Atomic, deterministic, never stream
|
|
101
101
|
*/
|
|
102
|
-
export type ToolResultRenderClass =
|
|
102
|
+
export type ToolResultRenderClass = "inline" | "surface";
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
* Tool result part with rendering classification.
|
|
106
106
|
*/
|
|
107
107
|
export interface ToolResultPart {
|
|
108
|
-
type:
|
|
108
|
+
type: "tool-result";
|
|
109
109
|
/** Tool identifier */
|
|
110
|
-
toolName: string
|
|
110
|
+
toolName: string;
|
|
111
111
|
/** Rendering classification */
|
|
112
|
-
render: ToolResultRenderClass
|
|
112
|
+
render: ToolResultRenderClass;
|
|
113
113
|
/** Tool-specific payload */
|
|
114
|
-
payload: unknown
|
|
114
|
+
payload: unknown;
|
|
115
115
|
/** Optional message correlation (enables out-of-band arrival, multi-message chains) */
|
|
116
|
-
messageId?: string
|
|
116
|
+
messageId?: string;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
// =============================================================================
|
|
@@ -125,8 +125,8 @@ export interface ToolResultPart {
|
|
|
125
125
|
* Follows AI SDK's data-{name} convention.
|
|
126
126
|
*/
|
|
127
127
|
export interface MessageStartDataPart {
|
|
128
|
-
type:
|
|
129
|
-
data: Omit<MessageStartEvent,
|
|
128
|
+
type: "data-message-start";
|
|
129
|
+
data: Omit<MessageStartEvent, "type">;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/**
|
|
@@ -134,14 +134,14 @@ export interface MessageStartDataPart {
|
|
|
134
134
|
* Note: Standard text-delta may be used instead for AI SDK compatibility.
|
|
135
135
|
*/
|
|
136
136
|
export interface MessageDeltaDataPart {
|
|
137
|
-
type:
|
|
138
|
-
data: Omit<MessageDeltaEvent,
|
|
137
|
+
type: "data-message-delta";
|
|
138
|
+
data: Omit<MessageDeltaEvent, "type">;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
142
|
* Wire format for message complete event.
|
|
143
143
|
*/
|
|
144
144
|
export interface MessageCompleteDataPart {
|
|
145
|
-
type:
|
|
146
|
-
data: Omit<MessageCompleteEvent,
|
|
145
|
+
type: "data-message-complete";
|
|
146
|
+
data: Omit<MessageCompleteEvent, "type">;
|
|
147
147
|
}
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
* Each kind represents a different type of action that could be executed.
|
|
23
23
|
*/
|
|
24
24
|
export type PreviewArtifactKind =
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
25
|
+
| "message" // Slack/chat message to send
|
|
26
|
+
| "api_call" // External API call
|
|
27
|
+
| "diff" // File or document change
|
|
28
|
+
| "notification" // Notification to user/team
|
|
29
|
+
| "task" // Task creation
|
|
30
|
+
| "calendar" // Calendar event
|
|
31
|
+
| "integration"; // Integration connect/disconnect action
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Integration provider types.
|
|
35
35
|
*/
|
|
36
|
-
export type IntegrationProvider =
|
|
36
|
+
export type IntegrationProvider = "slack" | "google" | "zoom";
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Application-level composite integration identifier.
|
|
@@ -43,7 +43,7 @@ export type IntegrationProvider = 'slack' | 'google' | 'zoom'
|
|
|
43
43
|
* - 'google_meet' → provider='google', service='meet'
|
|
44
44
|
* - 'zoom' → provider='zoom', service=''
|
|
45
45
|
*/
|
|
46
|
-
export type IntegrationKey =
|
|
46
|
+
export type IntegrationKey = "slack" | "google_drive" | "google_meet" | "zoom";
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Content structure for integration artifacts.
|
|
@@ -52,15 +52,15 @@ export type IntegrationKey = 'slack' | 'google_drive' | 'google_meet' | 'zoom'
|
|
|
52
52
|
*/
|
|
53
53
|
export interface IntegrationArtifactContent {
|
|
54
54
|
/** The integration action to perform */
|
|
55
|
-
action:
|
|
55
|
+
action: "connect" | "disconnect";
|
|
56
56
|
/** Target provider */
|
|
57
|
-
provider: IntegrationProvider
|
|
57
|
+
provider: IntegrationProvider;
|
|
58
58
|
/** Service within the provider (e.g. 'drive' for Google Drive). Empty string for monolithic providers. */
|
|
59
|
-
service?: string
|
|
59
|
+
service?: string;
|
|
60
60
|
/** Connection ID for disconnect (required for disconnect) */
|
|
61
|
-
connectionId?: string
|
|
61
|
+
connectionId?: string;
|
|
62
62
|
/** Workspace ID for multi-workspace providers */
|
|
63
|
-
workspaceId?: string
|
|
63
|
+
workspaceId?: string;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
@@ -69,18 +69,18 @@ export interface IntegrationArtifactContent {
|
|
|
69
69
|
*/
|
|
70
70
|
export interface PreviewArtifact {
|
|
71
71
|
/** The kind of action this artifact represents */
|
|
72
|
-
kind: PreviewArtifactKind
|
|
72
|
+
kind: PreviewArtifactKind;
|
|
73
73
|
/** Human-readable label for this artifact */
|
|
74
|
-
label: string
|
|
74
|
+
label: string;
|
|
75
75
|
/** The exact payload that would be executed - must be JSON-safe */
|
|
76
|
-
content: unknown
|
|
76
|
+
content: unknown;
|
|
77
77
|
/** Optional metadata for display purposes */
|
|
78
78
|
metadata?: {
|
|
79
79
|
/** Target system (e.g., "slack", "google-calendar") */
|
|
80
|
-
target?: string
|
|
80
|
+
target?: string;
|
|
81
81
|
/** Estimated impact level */
|
|
82
|
-
impact?:
|
|
83
|
-
}
|
|
82
|
+
impact?: "low" | "medium" | "high";
|
|
83
|
+
};
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/**
|
|
@@ -88,26 +88,26 @@ export interface PreviewArtifact {
|
|
|
88
88
|
*/
|
|
89
89
|
export interface PreviewData {
|
|
90
90
|
/** Stable identifier for this preview - used for confirmation tracking */
|
|
91
|
-
actionId: string
|
|
91
|
+
actionId: string;
|
|
92
92
|
/** Human-readable summary of what will happen */
|
|
93
|
-
title: string
|
|
93
|
+
title: string;
|
|
94
94
|
/** Optional detailed explanation */
|
|
95
|
-
description?: string
|
|
95
|
+
description?: string;
|
|
96
96
|
/** The artifacts that would be created/sent/modified */
|
|
97
|
-
artifacts: PreviewArtifact[]
|
|
97
|
+
artifacts: PreviewArtifact[];
|
|
98
98
|
/** Action type for bridge routing and executor dispatch (e.g. 'update_profile', 'send_message', 'manage_integration') */
|
|
99
|
-
actionType?: string
|
|
99
|
+
actionType?: string;
|
|
100
100
|
/** Top-level execution target for bridge routing and executor dispatch.
|
|
101
101
|
* Distinct from PreviewArtifact.metadata.target (per-artifact UI metadata). */
|
|
102
|
-
target?: string
|
|
102
|
+
target?: string;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* Preview message part (semantic type).
|
|
107
107
|
*/
|
|
108
108
|
export interface PreviewPart {
|
|
109
|
-
type:
|
|
110
|
-
data: PreviewData
|
|
109
|
+
type: "preview";
|
|
110
|
+
data: PreviewData;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
/**
|
|
@@ -115,6 +115,6 @@ export interface PreviewPart {
|
|
|
115
115
|
* Uses AI SDK's data-{name} convention.
|
|
116
116
|
*/
|
|
117
117
|
export interface PreviewDataPart {
|
|
118
|
-
type:
|
|
119
|
-
data: PreviewData
|
|
118
|
+
type: "data-preview";
|
|
119
|
+
data: PreviewData;
|
|
120
120
|
}
|