@vertesia/common 1.0.0 → 1.1.0-dev.20260427.060440Z
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/lib/cjs/access-control.js +2 -0
- package/lib/cjs/access-control.js.map +1 -1
- package/lib/cjs/apikey.js.map +1 -1
- package/lib/cjs/apps.js +35 -0
- package/lib/cjs/apps.js.map +1 -1
- package/lib/cjs/audit-trail.js +7 -0
- package/lib/cjs/audit-trail.js.map +1 -1
- package/lib/cjs/cost-analytics.js +13 -0
- package/lib/cjs/cost-analytics.js.map +1 -0
- package/lib/cjs/group.js +2 -1
- package/lib/cjs/group.js.map +1 -1
- package/lib/cjs/index.js +3 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interaction.js +2 -0
- package/lib/cjs/interaction.js.map +1 -1
- package/lib/cjs/oauth-server.js +3 -0
- package/lib/cjs/oauth-server.js.map +1 -0
- package/lib/cjs/oauth.js +1 -1
- package/lib/cjs/project.js.map +1 -1
- package/lib/cjs/store/conversation-state.js.map +1 -1
- package/lib/cjs/store/rendering.js +4 -0
- package/lib/cjs/store/rendering.js.map +1 -1
- package/lib/cjs/store/schedule.js.map +1 -1
- package/lib/cjs/store/store.js +4 -1
- package/lib/cjs/store/store.js.map +1 -1
- package/lib/cjs/store/workflow.js.map +1 -1
- package/lib/cjs/user.js +1 -0
- package/lib/cjs/user.js.map +1 -1
- package/lib/esm/access-control.js +2 -0
- package/lib/esm/access-control.js.map +1 -1
- package/lib/esm/apikey.js.map +1 -1
- package/lib/esm/apps.js +30 -0
- package/lib/esm/apps.js.map +1 -1
- package/lib/esm/audit-trail.js +6 -1
- package/lib/esm/audit-trail.js.map +1 -1
- package/lib/esm/cost-analytics.js +10 -0
- package/lib/esm/cost-analytics.js.map +1 -0
- package/lib/esm/group.js +1 -0
- package/lib/esm/group.js.map +1 -1
- package/lib/esm/index.js +3 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interaction.js +2 -0
- package/lib/esm/interaction.js.map +1 -1
- package/lib/esm/oauth-server.js +2 -0
- package/lib/esm/oauth-server.js.map +1 -0
- package/lib/esm/oauth.js +1 -1
- package/lib/esm/project.js.map +1 -1
- package/lib/esm/store/conversation-state.js.map +1 -1
- package/lib/esm/store/rendering.js +3 -0
- package/lib/esm/store/rendering.js.map +1 -1
- package/lib/esm/store/schedule.js.map +1 -1
- package/lib/esm/store/store.js +3 -0
- package/lib/esm/store/store.js.map +1 -1
- package/lib/esm/store/workflow.js.map +1 -1
- package/lib/esm/user.js +1 -0
- package/lib/esm/user.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/access-control.d.ts +2 -0
- package/lib/types/access-control.d.ts.map +1 -1
- package/lib/types/analytics.d.ts +12 -6
- package/lib/types/analytics.d.ts.map +1 -1
- package/lib/types/apikey.d.ts +1 -0
- package/lib/types/apikey.d.ts.map +1 -1
- package/lib/types/apps.d.ts +351 -40
- package/lib/types/apps.d.ts.map +1 -1
- package/lib/types/ask-user.d.ts +0 -4
- package/lib/types/ask-user.d.ts.map +1 -1
- package/lib/types/audit-trail.d.ts +32 -5
- package/lib/types/audit-trail.d.ts.map +1 -1
- package/lib/types/cost-analytics.d.ts +154 -0
- package/lib/types/cost-analytics.d.ts.map +1 -0
- package/lib/types/group.d.ts +1 -0
- package/lib/types/group.d.ts.map +1 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/interaction.d.ts +33 -4
- package/lib/types/interaction.d.ts.map +1 -1
- package/lib/types/oauth-server.d.ts +224 -0
- package/lib/types/oauth-server.d.ts.map +1 -0
- package/lib/types/oauth.d.ts +29 -18
- package/lib/types/oauth.d.ts.map +1 -1
- package/lib/types/project.d.ts +87 -19
- package/lib/types/project.d.ts.map +1 -1
- package/lib/types/query.d.ts +7 -0
- package/lib/types/query.d.ts.map +1 -1
- package/lib/types/refs.d.ts +4 -0
- package/lib/types/refs.d.ts.map +1 -1
- package/lib/types/runs.d.ts +14 -0
- package/lib/types/runs.d.ts.map +1 -1
- package/lib/types/store/agent-run.d.ts +160 -2
- package/lib/types/store/agent-run.d.ts.map +1 -1
- package/lib/types/store/conversation-state.d.ts +21 -2
- package/lib/types/store/conversation-state.d.ts.map +1 -1
- package/lib/types/store/doc-analyzer.d.ts +10 -0
- package/lib/types/store/doc-analyzer.d.ts.map +1 -1
- package/lib/types/store/rendering.d.ts +6 -0
- package/lib/types/store/rendering.d.ts.map +1 -1
- package/lib/types/store/schedule.d.ts +2 -5
- package/lib/types/store/schedule.d.ts.map +1 -1
- package/lib/types/store/store.d.ts +9 -0
- package/lib/types/store/store.d.ts.map +1 -1
- package/lib/types/store/workflow.d.ts +2 -2
- package/lib/types/store/workflow.d.ts.map +1 -1
- package/lib/types/tool-execution.d.ts +4 -0
- package/lib/types/tool-execution.d.ts.map +1 -1
- package/lib/types/transient-tokens.d.ts +1 -1
- package/lib/types/transient-tokens.d.ts.map +1 -1
- package/lib/types/user.d.ts +1 -0
- package/lib/types/user.d.ts.map +1 -1
- package/lib/types/workflow-analytics.d.ts +12 -0
- package/lib/types/workflow-analytics.d.ts.map +1 -1
- package/lib/vertesia-common.js +1 -1
- package/lib/vertesia-common.js.map +1 -1
- package/package.json +4 -4
- package/src/access-control.ts +2 -0
- package/src/analytics.ts +13 -6
- package/src/apikey.ts +1 -0
- package/src/apps.ts +401 -40
- package/src/ask-user.ts +0 -4
- package/src/audit-trail.ts +44 -5
- package/src/cost-analytics.ts +165 -0
- package/src/group.ts +3 -1
- package/src/index.ts +3 -2
- package/src/interaction.ts +37 -3
- package/src/oauth-server.ts +248 -0
- package/src/oauth.ts +30 -18
- package/src/project.ts +94 -21
- package/src/query.ts +7 -0
- package/src/refs.ts +4 -0
- package/src/runs.ts +15 -0
- package/src/store/agent-run.ts +186 -2
- package/src/store/conversation-state.ts +24 -2
- package/src/store/doc-analyzer.ts +12 -0
- package/src/store/rendering.ts +10 -0
- package/src/store/schedule.ts +2 -6
- package/src/store/store.ts +11 -0
- package/src/store/workflow.ts +3 -2
- package/src/tool-execution.ts +4 -0
- package/src/transient-tokens.ts +1 -1
- package/src/user.ts +1 -0
- package/src/workflow-analytics.ts +12 -0
package/src/audit-trail.ts
CHANGED
|
@@ -1,14 +1,43 @@
|
|
|
1
1
|
export type AuditAction =
|
|
2
|
+
// CRUD operations
|
|
2
3
|
| 'create'
|
|
3
4
|
| 'update'
|
|
4
5
|
| 'delete'
|
|
5
6
|
| 'bulk_create'
|
|
7
|
+
| 'bulk_change_type'
|
|
6
8
|
| 'bulk_update'
|
|
7
9
|
| 'bulk_delete'
|
|
8
10
|
| 'attach'
|
|
9
11
|
| 'detach'
|
|
10
12
|
| 'publish'
|
|
11
|
-
| 'unpublish'
|
|
13
|
+
| 'unpublish'
|
|
14
|
+
// Billable operations
|
|
15
|
+
| 'inference'
|
|
16
|
+
| 'embedding'
|
|
17
|
+
| 'image_generation';
|
|
18
|
+
|
|
19
|
+
/** Billable audit actions for cost analytics queries */
|
|
20
|
+
export const BILLABLE_AUDIT_ACTIONS: AuditAction[] = [
|
|
21
|
+
'inference',
|
|
22
|
+
'embedding',
|
|
23
|
+
'image_generation',
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Generic metering entry attached to audit events.
|
|
28
|
+
* Used for cost attribution, usage tracking, and billing.
|
|
29
|
+
*
|
|
30
|
+
* Examples:
|
|
31
|
+
* { category: "tokens", type: "input", quantity: 1234 }
|
|
32
|
+
* { category: "tokens", type: "output", quantity: 567 }
|
|
33
|
+
* { category: "compute", type: "duration_ms", quantity: 2100 }
|
|
34
|
+
* { category: "processing", type: "pages", quantity: 12 }
|
|
35
|
+
*/
|
|
36
|
+
export interface AuditMeter {
|
|
37
|
+
category: string;
|
|
38
|
+
type: string;
|
|
39
|
+
quantity: number;
|
|
40
|
+
}
|
|
12
41
|
|
|
13
42
|
export interface AuditTrailEvent {
|
|
14
43
|
event_type: 'audit';
|
|
@@ -21,13 +50,19 @@ export interface AuditTrailEvent {
|
|
|
21
50
|
success: boolean;
|
|
22
51
|
principal_id: string | null;
|
|
23
52
|
principal_type: string | null;
|
|
24
|
-
|
|
53
|
+
effective_principal_id: string | null;
|
|
25
54
|
roles: string[];
|
|
26
55
|
account_id: string | null;
|
|
27
56
|
project_id: string | null;
|
|
28
57
|
tenant_id: string | null;
|
|
29
58
|
account_name: string | null;
|
|
30
59
|
project_name: string | null;
|
|
60
|
+
/** Provider type for billable/provider-backed events, e.g. vertexai, bedrock. */
|
|
61
|
+
provider?: string | null;
|
|
62
|
+
/** Generic metering data for cost attribution and usage tracking */
|
|
63
|
+
meters?: AuditMeter[];
|
|
64
|
+
/** Event-specific metadata — shape varies by action/resource_type */
|
|
65
|
+
details?: Record<string, unknown>;
|
|
31
66
|
}
|
|
32
67
|
|
|
33
68
|
export interface AuditTrailQuery {
|
|
@@ -37,10 +72,14 @@ export interface AuditTrailQuery {
|
|
|
37
72
|
resourceTypes?: string[];
|
|
38
73
|
/** Filter by resource ID */
|
|
39
74
|
resourceId?: string;
|
|
40
|
-
/** Filter by principal
|
|
75
|
+
/** Filter by exact actor principal ref (matches principal_id column). */
|
|
41
76
|
principalId?: string;
|
|
42
|
-
/** Filter by
|
|
43
|
-
|
|
77
|
+
/** Filter by top-level actor category (matches principal_type column). */
|
|
78
|
+
principalType?: string;
|
|
79
|
+
/** Filter by delegated/direct effective principal ref (matches effective_principal_id column). */
|
|
80
|
+
effectivePrincipalId?: string;
|
|
81
|
+
/** Filter by whether an event has an effective principal ref. */
|
|
82
|
+
hasEffectivePrincipal?: boolean;
|
|
44
83
|
/** Filter by project ID */
|
|
45
84
|
projectId?: string;
|
|
46
85
|
/** Start time (ISO string) */
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cost Analytics Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the cost attribution dashboard.
|
|
5
|
+
* Combines audit trail metering data with billing export pricing
|
|
6
|
+
* to compute per-org/project/env/model cost breakdowns.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { BILLABLE_AUDIT_ACTIONS } from './audit-trail.js';
|
|
10
|
+
|
|
11
|
+
export { BILLABLE_AUDIT_ACTIONS };
|
|
12
|
+
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Query
|
|
15
|
+
// ============================================================================
|
|
16
|
+
|
|
17
|
+
export interface CostAnalyticsQuery {
|
|
18
|
+
/** Start time (ISO string or epoch ms) */
|
|
19
|
+
from?: string | number;
|
|
20
|
+
/** End time (ISO string or epoch ms) */
|
|
21
|
+
to?: string | number;
|
|
22
|
+
/** Group results by this dimension */
|
|
23
|
+
group_by?: 'model' | 'environment' | 'account' | 'project' | 'project_tag' | 'provider' | 'interaction' | 'workflow';
|
|
24
|
+
/** Time series resolution */
|
|
25
|
+
resolution?: 'hour' | 'day' | 'week' | 'month';
|
|
26
|
+
/** Filter by model pattern */
|
|
27
|
+
model?: string;
|
|
28
|
+
/** Filter by environment ID */
|
|
29
|
+
environment_id?: string;
|
|
30
|
+
/** Filter by provider */
|
|
31
|
+
provider?: string;
|
|
32
|
+
/** Filter by project ID (optional, for org scope) */
|
|
33
|
+
project_id?: string;
|
|
34
|
+
/** Filter by workflow / agent run ID */
|
|
35
|
+
workflow_id?: string;
|
|
36
|
+
/** Filter by Temporal workflow run ID */
|
|
37
|
+
workflow_run_id?: string;
|
|
38
|
+
/** Filter by interaction execution run ID */
|
|
39
|
+
run_id?: string;
|
|
40
|
+
/** Filter by agent run ID */
|
|
41
|
+
agent_run_id?: string;
|
|
42
|
+
/** Filter by account ID (set automatically by server) */
|
|
43
|
+
account_id?: string;
|
|
44
|
+
/** Scope: 'project' (default, current project) or 'org' (all projects in account) */
|
|
45
|
+
scope?: 'project' | 'org';
|
|
46
|
+
/** Pricing source: 'list' (latest daily prices) or 'historical' (daily effective prices over the query range). Default: 'list' */
|
|
47
|
+
pricing_source?: 'list' | 'historical';
|
|
48
|
+
/** Skip cache and force fresh query */
|
|
49
|
+
no_cache?: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ============================================================================
|
|
53
|
+
// Response
|
|
54
|
+
// ============================================================================
|
|
55
|
+
|
|
56
|
+
export interface CostSummary {
|
|
57
|
+
total_cost: number;
|
|
58
|
+
total_input_tokens: number;
|
|
59
|
+
total_cached_input_tokens?: number;
|
|
60
|
+
total_cache_write_input_tokens?: number;
|
|
61
|
+
total_output_tokens: number;
|
|
62
|
+
total_calls: number;
|
|
63
|
+
total_duration_ms: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface CostByDimension {
|
|
67
|
+
dimension: string;
|
|
68
|
+
label?: string;
|
|
69
|
+
provider?: string;
|
|
70
|
+
cost: number;
|
|
71
|
+
input_tokens: number;
|
|
72
|
+
cached_input_tokens?: number;
|
|
73
|
+
cache_write_input_tokens?: number;
|
|
74
|
+
output_tokens: number;
|
|
75
|
+
calls: number;
|
|
76
|
+
periods?: CostTimeSeriesPoint[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface CostTimeSeriesPoint {
|
|
80
|
+
timestamp: string;
|
|
81
|
+
cost: number;
|
|
82
|
+
input_tokens: number;
|
|
83
|
+
cached_input_tokens?: number;
|
|
84
|
+
cache_write_input_tokens?: number;
|
|
85
|
+
output_tokens: number;
|
|
86
|
+
calls: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface ModelPricing {
|
|
90
|
+
model: string;
|
|
91
|
+
provider?: string;
|
|
92
|
+
provider_account_id?: string;
|
|
93
|
+
input_price_per_m_tokens: number;
|
|
94
|
+
cached_input_price_per_m_tokens?: number;
|
|
95
|
+
cache_write_input_price_per_m_tokens?: number;
|
|
96
|
+
output_price_per_m_tokens: number;
|
|
97
|
+
source: 'billing_export' | 'model_pricing_daily' | 'unavailable';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface ModelPriceComparison {
|
|
101
|
+
model: string;
|
|
102
|
+
provider?: string;
|
|
103
|
+
provider_account_id?: string;
|
|
104
|
+
list_price_date?: string;
|
|
105
|
+
effective_from?: string;
|
|
106
|
+
effective_to?: string;
|
|
107
|
+
input_list_price_per_m_tokens?: number;
|
|
108
|
+
input_effective_price_per_m_tokens?: number;
|
|
109
|
+
cached_input_list_price_per_m_tokens?: number;
|
|
110
|
+
cached_input_effective_price_per_m_tokens?: number;
|
|
111
|
+
cache_write_input_list_price_per_m_tokens?: number;
|
|
112
|
+
cache_write_input_effective_price_per_m_tokens?: number;
|
|
113
|
+
output_list_price_per_m_tokens?: number;
|
|
114
|
+
output_effective_price_per_m_tokens?: number;
|
|
115
|
+
source: 'model_pricing_daily';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface ModelPriceComparisonResponse {
|
|
119
|
+
prices: ModelPriceComparison[];
|
|
120
|
+
effective_range: { from: string; to: string };
|
|
121
|
+
list_price_date?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface CostAnalyticsResponse {
|
|
125
|
+
summary: CostSummary;
|
|
126
|
+
by_dimension: CostByDimension[];
|
|
127
|
+
time_series: CostTimeSeriesPoint[];
|
|
128
|
+
pricing: ModelPricing[];
|
|
129
|
+
query_range: { from: string; to: string };
|
|
130
|
+
cached: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface CostRunPriceQuery {
|
|
134
|
+
/** Interaction execution run ID */
|
|
135
|
+
run_id?: string;
|
|
136
|
+
/** Agent run ID */
|
|
137
|
+
agent_run_id?: string;
|
|
138
|
+
/** Workflow ID, when known */
|
|
139
|
+
workflow_id?: string;
|
|
140
|
+
/** Temporal workflow run ID, when known */
|
|
141
|
+
workflow_run_id?: string;
|
|
142
|
+
/** Optional lower bound for audit events */
|
|
143
|
+
from?: string | number;
|
|
144
|
+
/** Optional upper bound for audit events */
|
|
145
|
+
to?: string | number;
|
|
146
|
+
/** Pricing source. Defaults to historical effective prices for run pricing. */
|
|
147
|
+
pricing_source?: 'list' | 'historical';
|
|
148
|
+
/** Include the full pricing catalog for cross-model comparison. Defaults to false. */
|
|
149
|
+
include_comparison_pricing?: boolean;
|
|
150
|
+
/** Project filter; server fills current project by default */
|
|
151
|
+
project_id?: string;
|
|
152
|
+
/** Account filter; server fills current account */
|
|
153
|
+
account_id?: string;
|
|
154
|
+
/** Scope: 'project' (default, current project) or 'org' */
|
|
155
|
+
scope?: 'project' | 'org';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface CostRunPriceResponse {
|
|
159
|
+
summary: CostSummary;
|
|
160
|
+
by_model: CostByDimension[];
|
|
161
|
+
pricing?: ModelPricing[];
|
|
162
|
+
query_range?: { from: string; to: string };
|
|
163
|
+
pricing_source: 'list' | 'historical';
|
|
164
|
+
matched_events: number;
|
|
165
|
+
}
|
package/src/group.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './access-control.js';
|
|
2
2
|
export * from './analytics.js';
|
|
3
3
|
export * from './audit-trail.js';
|
|
4
|
+
export * from './cost-analytics.js';
|
|
4
5
|
export * from './apikey.js';
|
|
5
6
|
export * from './apps.js';
|
|
6
7
|
export * from './ask-user.js';
|
|
@@ -11,13 +12,14 @@ export * from './environment.js';
|
|
|
11
12
|
export * from "./facets.js";
|
|
12
13
|
export * from './group.js';
|
|
13
14
|
export * from './integrations.js';
|
|
14
|
-
export * from './oauth.js';
|
|
15
15
|
export * from './interaction.js';
|
|
16
16
|
export * from './pending-asks.js';
|
|
17
17
|
export * from './json-schema.js';
|
|
18
18
|
export * from './json.js';
|
|
19
19
|
export * from './meters.js';
|
|
20
|
+
export * from './oauth-server.js';
|
|
20
21
|
export * from './model_utility.js';
|
|
22
|
+
export * from './oauth.js';
|
|
21
23
|
export * from './payload.js';
|
|
22
24
|
export * from "./Progress.js";
|
|
23
25
|
export * from './project.js';
|
|
@@ -39,4 +41,3 @@ export * from './utils/schemas.js';
|
|
|
39
41
|
export type * from './utils/type-helpers.js';
|
|
40
42
|
export * from './versions.js';
|
|
41
43
|
export * from './workflow-analytics.js';
|
|
42
|
-
|
package/src/interaction.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { ExecutionRunDocRef } from "./runs.js";
|
|
|
26
26
|
import { ConversationState } from "./store/conversation-state.js";
|
|
27
27
|
import { AccountRef } from "./user.js";
|
|
28
28
|
import { LlmCallType } from "./workflow-analytics.js";
|
|
29
|
+
import type { MCPToolAnnotations } from "./apps.js";
|
|
29
30
|
|
|
30
31
|
export interface InteractionExecutionError {
|
|
31
32
|
code: string;
|
|
@@ -288,6 +289,11 @@ export interface InteractionEndpointQuery {
|
|
|
288
289
|
* Whether or not to return the result schema
|
|
289
290
|
*/
|
|
290
291
|
include_result_schema?: boolean;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* When true, filter results to only interactions with is_skill=true.
|
|
295
|
+
*/
|
|
296
|
+
is_skill?: boolean;
|
|
291
297
|
}
|
|
292
298
|
|
|
293
299
|
/**
|
|
@@ -362,6 +368,8 @@ export enum InteractionStatus {
|
|
|
362
368
|
draft = "draft",
|
|
363
369
|
published = "published",
|
|
364
370
|
archived = "archived",
|
|
371
|
+
code = "code", // for in-code interactions that are not stored in the database
|
|
372
|
+
unknown = "unknown", // for interactions with unknown status
|
|
365
373
|
}
|
|
366
374
|
|
|
367
375
|
export enum ExecutionRunStatus {
|
|
@@ -760,6 +768,18 @@ export interface AsyncConversationExecutionPayload extends AsyncExecutionPayload
|
|
|
760
768
|
*/
|
|
761
769
|
restart_from_workflow_run_id?: string;
|
|
762
770
|
|
|
771
|
+
/**
|
|
772
|
+
* The Temporal firstExecutionRunId of the original workflow being restarted/forked.
|
|
773
|
+
* Used by loadConversationForRestart to look up the original ExecutionRun
|
|
774
|
+
* so that token accumulation and status updates target a valid run.
|
|
775
|
+
*/
|
|
776
|
+
source_first_workflow_run_id?: string;
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* When true, indicates this is a fork (new ExecutionRun) rather than a restart (reuse original).
|
|
780
|
+
*/
|
|
781
|
+
is_fork?: boolean;
|
|
782
|
+
|
|
763
783
|
/**
|
|
764
784
|
* The AgentRun MongoDB _id. Used for artifact storage paths: agents/{agent_run_id}/
|
|
765
785
|
* Flows into ConversationState and down to workstreams.
|
|
@@ -1206,14 +1226,26 @@ export interface BuiltinToolDefinition {
|
|
|
1206
1226
|
name: string;
|
|
1207
1227
|
|
|
1208
1228
|
/**
|
|
1209
|
-
*
|
|
1229
|
+
* One-line summary shown in the tool selector UI
|
|
1210
1230
|
*/
|
|
1211
|
-
|
|
1231
|
+
summary?: string;
|
|
1212
1232
|
|
|
1213
1233
|
/**
|
|
1214
1234
|
* JSON schema for the tool's parameters
|
|
1215
1235
|
*/
|
|
1216
1236
|
params: JSONSchema;
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* Whether this tool is active by default when no explicit tool list is provided.
|
|
1240
|
+
* Tools with default: false are only activated by skills.
|
|
1241
|
+
*/
|
|
1242
|
+
default: boolean;
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
* Behavioral hints following the MCP ToolAnnotations spec.
|
|
1246
|
+
* Used for display purposes only — not sent to LLMs.
|
|
1247
|
+
*/
|
|
1248
|
+
annotations?: MCPToolAnnotations;
|
|
1217
1249
|
}
|
|
1218
1250
|
|
|
1219
1251
|
/**
|
|
@@ -1229,7 +1261,9 @@ export interface SystemSkillCatalogEntry {
|
|
|
1229
1261
|
title: string;
|
|
1230
1262
|
/** Description of what the skill unlocks */
|
|
1231
1263
|
description: string;
|
|
1232
|
-
/**
|
|
1264
|
+
/** Tools that become available when this skill is called */
|
|
1265
|
+
tools: string[];
|
|
1266
|
+
/** Related tools that complement this skill */
|
|
1233
1267
|
related_tools: string[];
|
|
1234
1268
|
}
|
|
1235
1269
|
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import type { AuthTokenPayload } from './apikey.js';
|
|
2
|
+
import type { ProjectRef } from './project.js';
|
|
3
|
+
|
|
4
|
+
export type OAuthClientType = 'public' | 'confidential';
|
|
5
|
+
export type OAuthClientStatus = 'active' | 'disabled';
|
|
6
|
+
export type OAuthRegistrationSource = 'admin' | 'dynamic';
|
|
7
|
+
export type OAuthProjectBindingMode = 'user_select' | 'fixed';
|
|
8
|
+
export type OAuthTokenEndpointAuthMethod = 'none' | 'client_secret_post' | 'client_secret_basic';
|
|
9
|
+
export type OAuthGrantType = 'authorization_code' | 'refresh_token';
|
|
10
|
+
export type OAuthResponseType = 'code';
|
|
11
|
+
export type OAuthAuthorizationRequestStatus = 'pending' | 'denied' | 'consumed';
|
|
12
|
+
export type OAuthClientRegistrationMode = 'registered' | 'client_id_metadata_document';
|
|
13
|
+
export type OAuthGrantStatus = 'active' | 'revoked' | 'expired';
|
|
14
|
+
export type OAuthGrantSortField = 'granted_at' | 'client_name' | 'user_name' | 'resource' | 'last_used_at' | 'expires_at' | 'status';
|
|
15
|
+
export type OAuthGrantSortOrder = 'asc' | 'desc';
|
|
16
|
+
|
|
17
|
+
export interface OAuthClientData {
|
|
18
|
+
client_name: string;
|
|
19
|
+
client_type: OAuthClientType;
|
|
20
|
+
redirect_uris: string[];
|
|
21
|
+
grant_types: OAuthGrantType[];
|
|
22
|
+
response_types: OAuthResponseType[];
|
|
23
|
+
token_endpoint_auth_method: OAuthTokenEndpointAuthMethod;
|
|
24
|
+
allowed_scopes: string[];
|
|
25
|
+
registration_source: OAuthRegistrationSource;
|
|
26
|
+
status: OAuthClientStatus;
|
|
27
|
+
project_binding_mode: OAuthProjectBindingMode;
|
|
28
|
+
fixed_project_id?: string;
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
30
|
+
created_by?: string;
|
|
31
|
+
client_secret_configured?: boolean;
|
|
32
|
+
created_at: string;
|
|
33
|
+
updated_at: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface OAuthClient extends OAuthClientData {
|
|
37
|
+
client_id: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface OAuthClientCreateResponse extends OAuthClient {
|
|
41
|
+
client_secret?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface OAuthGrant {
|
|
45
|
+
grant_id: string;
|
|
46
|
+
client_id: string;
|
|
47
|
+
client_name: string;
|
|
48
|
+
user_id: string;
|
|
49
|
+
user_name?: string;
|
|
50
|
+
user_email?: string;
|
|
51
|
+
account_id: string;
|
|
52
|
+
project_id: string;
|
|
53
|
+
resource: string;
|
|
54
|
+
scope: string[];
|
|
55
|
+
status: OAuthGrantStatus;
|
|
56
|
+
token_count: number;
|
|
57
|
+
granted_at: string;
|
|
58
|
+
created_at: string;
|
|
59
|
+
last_used_at?: string;
|
|
60
|
+
expires_at?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ListOAuthGrantsQuery {
|
|
64
|
+
account_id?: string;
|
|
65
|
+
project_id?: string;
|
|
66
|
+
user_id?: string;
|
|
67
|
+
client_id?: string;
|
|
68
|
+
resource?: string;
|
|
69
|
+
status?: OAuthGrantStatus | 'all';
|
|
70
|
+
limit?: number;
|
|
71
|
+
offset?: number;
|
|
72
|
+
sort_by?: OAuthGrantSortField;
|
|
73
|
+
sort_order?: OAuthGrantSortOrder;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface OAuthGrantListResponse {
|
|
77
|
+
grants: OAuthGrant[];
|
|
78
|
+
total_count: number;
|
|
79
|
+
limit: number;
|
|
80
|
+
offset: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface BulkRevokeOAuthGrantsPayload extends ListOAuthGrantsQuery {
|
|
84
|
+
grant_ids?: string[];
|
|
85
|
+
include_consent?: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface OAuthGrantRevokeResponse {
|
|
89
|
+
revoked_tokens: number;
|
|
90
|
+
revoked_consents: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface CreateOAuthClientPayload {
|
|
94
|
+
client_name: string;
|
|
95
|
+
client_type?: OAuthClientType;
|
|
96
|
+
redirect_uris: string[];
|
|
97
|
+
grant_types?: OAuthGrantType[];
|
|
98
|
+
response_types?: OAuthResponseType[];
|
|
99
|
+
token_endpoint_auth_method?: OAuthTokenEndpointAuthMethod;
|
|
100
|
+
allowed_scopes?: string[];
|
|
101
|
+
project_binding_mode?: OAuthProjectBindingMode;
|
|
102
|
+
fixed_project_id?: string;
|
|
103
|
+
client_secret?: string;
|
|
104
|
+
metadata?: Record<string, unknown>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface UpdateOAuthClientPayload {
|
|
108
|
+
client_name?: string;
|
|
109
|
+
redirect_uris?: string[];
|
|
110
|
+
grant_types?: OAuthGrantType[];
|
|
111
|
+
response_types?: OAuthResponseType[];
|
|
112
|
+
token_endpoint_auth_method?: OAuthTokenEndpointAuthMethod;
|
|
113
|
+
allowed_scopes?: string[];
|
|
114
|
+
status?: OAuthClientStatus;
|
|
115
|
+
project_binding_mode?: OAuthProjectBindingMode;
|
|
116
|
+
fixed_project_id?: string;
|
|
117
|
+
client_secret?: string;
|
|
118
|
+
metadata?: Record<string, unknown>;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface OAuthAuthorizationServerMetadata {
|
|
122
|
+
issuer: string;
|
|
123
|
+
authorization_endpoint: string;
|
|
124
|
+
token_endpoint: string;
|
|
125
|
+
jwks_uri: string;
|
|
126
|
+
registration_endpoint?: string;
|
|
127
|
+
revocation_endpoint?: string;
|
|
128
|
+
response_types_supported: string[];
|
|
129
|
+
grant_types_supported: string[];
|
|
130
|
+
code_challenge_methods_supported: string[];
|
|
131
|
+
token_endpoint_auth_methods_supported: string[];
|
|
132
|
+
scopes_supported: string[];
|
|
133
|
+
client_id_metadata_document_supported?: boolean;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface OAuthClientMetadataDocument {
|
|
137
|
+
client_id: string;
|
|
138
|
+
client_name?: string;
|
|
139
|
+
redirect_uris: string[];
|
|
140
|
+
grant_types?: OAuthGrantType[];
|
|
141
|
+
response_types?: OAuthResponseType[];
|
|
142
|
+
token_endpoint_auth_method?: OAuthTokenEndpointAuthMethod;
|
|
143
|
+
scope?: string;
|
|
144
|
+
client_uri?: string;
|
|
145
|
+
logo_uri?: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface OAuthAuthorizeQuery {
|
|
149
|
+
response_type: 'code';
|
|
150
|
+
client_id: string;
|
|
151
|
+
redirect_uri: string;
|
|
152
|
+
resource?: string;
|
|
153
|
+
scope?: string;
|
|
154
|
+
state?: string;
|
|
155
|
+
code_challenge: string;
|
|
156
|
+
code_challenge_method: 'S256';
|
|
157
|
+
project_id?: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface CreateOAuthAuthorizationRequestPayload extends OAuthAuthorizeQuery {}
|
|
161
|
+
|
|
162
|
+
export interface OAuthAuthorizationRequest {
|
|
163
|
+
request_id: string;
|
|
164
|
+
client_id: string;
|
|
165
|
+
client_name: string;
|
|
166
|
+
client_registration_mode?: OAuthClientRegistrationMode;
|
|
167
|
+
redirect_uri: string;
|
|
168
|
+
redirect_origin: string;
|
|
169
|
+
resource?: string;
|
|
170
|
+
requested_scopes: string[];
|
|
171
|
+
requested_project_id?: string;
|
|
172
|
+
project_binding_mode: OAuthProjectBindingMode;
|
|
173
|
+
fixed_project_id?: string;
|
|
174
|
+
status: OAuthAuthorizationRequestStatus;
|
|
175
|
+
created_at: string;
|
|
176
|
+
expires_at: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface ApproveOAuthAuthorizationRequestPayload {
|
|
180
|
+
project_id?: string;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface OAuthAuthorizationDecisionResponse {
|
|
184
|
+
redirect_url: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface OAuthTokenRequestAuthorizationCode {
|
|
188
|
+
grant_type: 'authorization_code';
|
|
189
|
+
code: string;
|
|
190
|
+
redirect_uri: string;
|
|
191
|
+
client_id: string;
|
|
192
|
+
resource?: string;
|
|
193
|
+
code_verifier: string;
|
|
194
|
+
client_secret?: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface OAuthTokenRequestRefreshToken {
|
|
198
|
+
grant_type: 'refresh_token';
|
|
199
|
+
refresh_token: string;
|
|
200
|
+
client_id: string;
|
|
201
|
+
resource?: string;
|
|
202
|
+
client_secret?: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export type OAuthTokenRequest = OAuthTokenRequestAuthorizationCode | OAuthTokenRequestRefreshToken;
|
|
206
|
+
|
|
207
|
+
export interface OAuthTokenResponse {
|
|
208
|
+
access_token: string;
|
|
209
|
+
token_type: 'Bearer';
|
|
210
|
+
expires_in: number;
|
|
211
|
+
scope: string;
|
|
212
|
+
refresh_token?: string;
|
|
213
|
+
id_token?: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface OAuthAuthorizationCodeRecord {
|
|
217
|
+
code: string;
|
|
218
|
+
client_id: string;
|
|
219
|
+
user_id: string;
|
|
220
|
+
account_id: string;
|
|
221
|
+
project_id: string;
|
|
222
|
+
resource: string;
|
|
223
|
+
scope: string[];
|
|
224
|
+
redirect_uri: string;
|
|
225
|
+
code_challenge: string;
|
|
226
|
+
code_challenge_method: 'S256';
|
|
227
|
+
expires_at: string;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface OAuthConsentRecord {
|
|
231
|
+
user_id: string;
|
|
232
|
+
client_id: string;
|
|
233
|
+
account_id: string;
|
|
234
|
+
project_id: string;
|
|
235
|
+
scope: string[];
|
|
236
|
+
granted_at: string;
|
|
237
|
+
revoked_at?: string;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export interface OAuthAccessTokenPayload extends Omit<AuthTokenPayload, 'type' | 'project'> {
|
|
241
|
+
type: 'oauth_access';
|
|
242
|
+
client_id: string;
|
|
243
|
+
scope: string;
|
|
244
|
+
user_id: string;
|
|
245
|
+
project: ProjectRef;
|
|
246
|
+
allowed_collections?: string[];
|
|
247
|
+
resource?: string;
|
|
248
|
+
}
|