@automate.ax/integration-contracts 0.136.0 → 0.138.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/dist/anthropic/index.d.ts +128 -0
- package/dist/anthropic/index.js +261 -0
- package/dist/automate/index.d.ts +4 -4
- package/dist/close/events.d.ts +2 -2
- package/dist/close/schemas.d.ts +2 -2
- package/dist/gmail/schemas.d.ts +1 -1
- package/dist/google-drive/index.d.ts +3 -3
- package/dist/linear/schemas.d.ts +11 -11
- package/dist/notion/schemas.d.ts +172 -172
- package/dist/triggers.d.ts +2 -1
- package/dist/whatsapp/index.d.ts +2 -2
- package/dist/whatsapp/schemas.d.ts +5 -5
- package/package.json +10 -2
- package/src/anthropic/index.ts +500 -0
- package/src/triggers.ts +2 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { Beta } from "@anthropic-ai/sdk/resources/beta/beta";
|
|
2
|
+
import type { Encodable } from "@automate.ax/codec";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
import type { CamelCasedPropertiesDeep } from "type-fest";
|
|
5
|
+
export declare const ANTHROPIC_SESSION_WEBHOOK_TYPES: readonly ["session.status_run_started", "session.status_idled", "session.budget_reached", "session.status_rescheduled", "session.status_terminated", "session.thread_created", "session.thread_idled", "session.thread_terminated", "session.outcome_evaluation_ended", "session.updated", "session.deleted"];
|
|
6
|
+
export declare const ANTHROPIC_AGENT_WEBHOOK_TYPES: readonly ["agent.created", "agent.updated", "agent.archived", "agent.deleted"];
|
|
7
|
+
export declare const ANTHROPIC_ENVIRONMENT_WEBHOOK_TYPES: readonly ["environment.created", "environment.updated", "environment.archived", "environment.deleted"];
|
|
8
|
+
export declare const ANTHROPIC_WEBHOOK_TYPES: readonly ["session.status_run_started", "session.status_idled", "session.budget_reached", "session.status_rescheduled", "session.status_terminated", "session.thread_created", "session.thread_idled", "session.thread_terminated", "session.outcome_evaluation_ended", "session.updated", "session.deleted", "agent.created", "agent.updated", "agent.archived", "agent.deleted", "environment.created", "environment.updated", "environment.archived", "environment.deleted"];
|
|
9
|
+
export type AnthropicWebhookType = (typeof ANTHROPIC_WEBHOOK_TYPES)[number];
|
|
10
|
+
export declare const ANTHROPIC_TRIGGER_CONFIG_SCHEMA: z.ZodObject<{}, z.core.$strip>;
|
|
11
|
+
export declare const ANTHROPIC_IDLE_EVENT_SCHEMA: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
processedAt: z.ZodISODateTime;
|
|
14
|
+
stopReason: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
15
|
+
type: z.ZodLiteral<"end_turn">;
|
|
16
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
17
|
+
eventIds: z.ZodArray<z.ZodString>;
|
|
18
|
+
type: z.ZodLiteral<"requires_action">;
|
|
19
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
type: z.ZodLiteral<"budget_reached">;
|
|
21
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
22
|
+
type: z.ZodLiteral<"retries_exhausted">;
|
|
23
|
+
}, z.core.$strip>], "type">;
|
|
24
|
+
type: z.ZodLiteral<"session.status_idle">;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
/** Public camel-case form of an authoritative Managed Agents object. */
|
|
27
|
+
export type AnthropicAgentResource = CamelCasedPropertiesDeep<Beta.BetaManagedAgentsAgent> & Encodable;
|
|
28
|
+
/** Public camel-case form of an authoritative Managed Agents environment. */
|
|
29
|
+
export type AnthropicEnvironmentResource = CamelCasedPropertiesDeep<Beta.BetaEnvironment> & Encodable;
|
|
30
|
+
/** Public camel-case form of an authoritative Managed Agents session. */
|
|
31
|
+
export type AnthropicSessionResource = CamelCasedPropertiesDeep<Beta.BetaManagedAgentsSession> & Encodable;
|
|
32
|
+
/** Authoritative resource type carried by one provider event type. */
|
|
33
|
+
type AnthropicEventResource<TType extends AnthropicWebhookType> = TType extends `${string}.deleted` ? null : TType extends `agent.${string}` ? AnthropicAgentResource : TType extends `environment.${string}` ? AnthropicEnvironmentResource : AnthropicSessionResource;
|
|
34
|
+
/** Thread identifier presence carried by one provider event type. */
|
|
35
|
+
type AnthropicEventThreadId<TType extends AnthropicWebhookType> = TType extends "session.thread_created" | "session.thread_idled" | "session.thread_terminated" ? string : null;
|
|
36
|
+
/** Exact public payload for one Managed Agents webhook type. */
|
|
37
|
+
export type AnthropicSemanticEvent<TType extends AnthropicWebhookType> = TType extends AnthropicWebhookType ? {
|
|
38
|
+
createdAt: string;
|
|
39
|
+
id: string;
|
|
40
|
+
idleEvent: TType extends "session.status_idled" ? z.output<typeof ANTHROPIC_IDLE_EVENT_SCHEMA> : null;
|
|
41
|
+
organizationId: string;
|
|
42
|
+
providerEventType: TType;
|
|
43
|
+
resource: AnthropicEventResource<TType>;
|
|
44
|
+
resourceId: string;
|
|
45
|
+
sessionThreadId: AnthropicEventThreadId<TType>;
|
|
46
|
+
workspaceId: string;
|
|
47
|
+
} : never;
|
|
48
|
+
export type AnthropicAgentEvent = AnthropicSemanticEvent<(typeof ANTHROPIC_AGENT_WEBHOOK_TYPES)[number]>;
|
|
49
|
+
export type AnthropicEnvironmentEvent = AnthropicSemanticEvent<(typeof ANTHROPIC_ENVIRONMENT_WEBHOOK_TYPES)[number]>;
|
|
50
|
+
export type AnthropicSessionEvent = AnthropicSemanticEvent<(typeof ANTHROPIC_SESSION_WEBHOOK_TYPES)[number]>;
|
|
51
|
+
export type AnthropicEvent = AnthropicSemanticEvent<AnthropicWebhookType>;
|
|
52
|
+
export type AnthropicRunEvent = AnthropicSemanticEvent<"session.status_idled" | "session.status_terminated">;
|
|
53
|
+
export declare const ANTHROPIC_AGENT_EVENT_SCHEMA: z.ZodType<AnthropicAgentEvent>;
|
|
54
|
+
export declare const ANTHROPIC_ENVIRONMENT_EVENT_SCHEMA: z.ZodType<AnthropicEnvironmentEvent>;
|
|
55
|
+
export declare const ANTHROPIC_SESSION_EVENT_SCHEMA: z.ZodType<AnthropicSessionEvent>;
|
|
56
|
+
export declare const ANTHROPIC_RUN_EVENT_SCHEMA: z.ZodType<AnthropicRunEvent>;
|
|
57
|
+
export declare const ANTHROPIC_EVENT_SCHEMA: z.ZodType<AnthropicEvent>;
|
|
58
|
+
export declare const anthropicEventTypeMap: {
|
|
59
|
+
readonly "agent.archived": "anthropic.agent.archived";
|
|
60
|
+
readonly "agent.created": "anthropic.agent.created";
|
|
61
|
+
readonly "agent.deleted": "anthropic.agent.deleted";
|
|
62
|
+
readonly "agent.updated": "anthropic.agent.updated";
|
|
63
|
+
readonly "environment.archived": "anthropic.environment.archived";
|
|
64
|
+
readonly "environment.created": "anthropic.environment.created";
|
|
65
|
+
readonly "environment.deleted": "anthropic.environment.deleted";
|
|
66
|
+
readonly "environment.updated": "anthropic.environment.updated";
|
|
67
|
+
readonly "session.budget_reached": "anthropic.session.budgetReached";
|
|
68
|
+
readonly "session.deleted": "anthropic.session.deleted";
|
|
69
|
+
readonly "session.outcome_evaluation_ended": "anthropic.session.outcomeEvaluationEnded";
|
|
70
|
+
readonly "session.status_idled": "anthropic.session.idled";
|
|
71
|
+
readonly "session.status_rescheduled": "anthropic.session.rescheduled";
|
|
72
|
+
readonly "session.status_run_started": "anthropic.session.runStarted";
|
|
73
|
+
readonly "session.status_terminated": "anthropic.session.terminated";
|
|
74
|
+
readonly "session.thread_created": "anthropic.session.threadCreated";
|
|
75
|
+
readonly "session.thread_idled": "anthropic.session.threadIdled";
|
|
76
|
+
readonly "session.thread_terminated": "anthropic.session.threadTerminated";
|
|
77
|
+
readonly "session.updated": "anthropic.session.updated";
|
|
78
|
+
};
|
|
79
|
+
export declare const ANTHROPIC_BROAD_EVENT_TYPES: {
|
|
80
|
+
readonly agent: "anthropic.agent.event";
|
|
81
|
+
readonly environment: "anthropic.environment.event";
|
|
82
|
+
readonly session: "anthropic.session.event";
|
|
83
|
+
};
|
|
84
|
+
type AnthropicTriggerEventTypes = {
|
|
85
|
+
readonly "anthropic.agent.archived": AnthropicSemanticEvent<"agent.archived">;
|
|
86
|
+
readonly "anthropic.agent.created": AnthropicSemanticEvent<"agent.created">;
|
|
87
|
+
readonly "anthropic.agent.deleted": AnthropicSemanticEvent<"agent.deleted">;
|
|
88
|
+
readonly "anthropic.agent.event": AnthropicAgentEvent;
|
|
89
|
+
readonly "anthropic.agent.updated": AnthropicSemanticEvent<"agent.updated">;
|
|
90
|
+
readonly "anthropic.environment.archived": AnthropicSemanticEvent<"environment.archived">;
|
|
91
|
+
readonly "anthropic.environment.created": AnthropicSemanticEvent<"environment.created">;
|
|
92
|
+
readonly "anthropic.environment.deleted": AnthropicSemanticEvent<"environment.deleted">;
|
|
93
|
+
readonly "anthropic.environment.event": AnthropicEnvironmentEvent;
|
|
94
|
+
readonly "anthropic.environment.updated": AnthropicSemanticEvent<"environment.updated">;
|
|
95
|
+
readonly "anthropic.session.budgetReached": AnthropicSemanticEvent<"session.budget_reached">;
|
|
96
|
+
readonly "anthropic.session.deleted": AnthropicSemanticEvent<"session.deleted">;
|
|
97
|
+
readonly "anthropic.session.event": AnthropicSessionEvent;
|
|
98
|
+
readonly "anthropic.session.idled": AnthropicSemanticEvent<"session.status_idled">;
|
|
99
|
+
readonly "anthropic.session.outcomeEvaluationEnded": AnthropicSemanticEvent<"session.outcome_evaluation_ended">;
|
|
100
|
+
readonly "anthropic.session.rescheduled": AnthropicSemanticEvent<"session.status_rescheduled">;
|
|
101
|
+
readonly "anthropic.session.runStarted": AnthropicSemanticEvent<"session.status_run_started">;
|
|
102
|
+
readonly "anthropic.session.terminated": AnthropicSemanticEvent<"session.status_terminated">;
|
|
103
|
+
readonly "anthropic.session.threadCreated": AnthropicSemanticEvent<"session.thread_created">;
|
|
104
|
+
readonly "anthropic.session.threadIdled": AnthropicSemanticEvent<"session.thread_idled">;
|
|
105
|
+
readonly "anthropic.session.threadTerminated": AnthropicSemanticEvent<"session.thread_terminated">;
|
|
106
|
+
readonly "anthropic.session.updated": AnthropicSemanticEvent<"session.updated">;
|
|
107
|
+
};
|
|
108
|
+
/** Named trigger registry shape keeps declaration emission compact. */
|
|
109
|
+
type AnthropicTriggerContracts = {
|
|
110
|
+
readonly [TType in keyof AnthropicTriggerEventTypes]: {
|
|
111
|
+
readonly configSchema: typeof ANTHROPIC_TRIGGER_CONFIG_SCHEMA;
|
|
112
|
+
readonly eventSchema: z.ZodType<AnthropicTriggerEventTypes[TType]>;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export declare const anthropicTriggerContracts: AnthropicTriggerContracts;
|
|
116
|
+
/**
|
|
117
|
+
* Returns the broad and semantic event types for one verified delivery.
|
|
118
|
+
*
|
|
119
|
+
* @param type - Provider webhook event type.
|
|
120
|
+
*/
|
|
121
|
+
export declare function getAnthropicEventTypes(type: AnthropicWebhookType): readonly ["anthropic.agent.event" | "anthropic.environment.event" | "anthropic.session.event", "anthropic.agent.archived" | "anthropic.agent.created" | "anthropic.agent.deleted" | "anthropic.agent.updated" | "anthropic.environment.archived" | "anthropic.environment.created" | "anthropic.environment.deleted" | "anthropic.environment.updated" | "anthropic.session.budgetReached" | "anthropic.session.deleted" | "anthropic.session.outcomeEvaluationEnded" | "anthropic.session.idled" | "anthropic.session.rescheduled" | "anthropic.session.runStarted" | "anthropic.session.terminated" | "anthropic.session.threadCreated" | "anthropic.session.threadIdled" | "anthropic.session.threadTerminated" | "anthropic.session.updated"];
|
|
122
|
+
/**
|
|
123
|
+
* Converts Anthropic provider response keys to the public camelCase contract.
|
|
124
|
+
*
|
|
125
|
+
* @param value - Provider response value.
|
|
126
|
+
*/
|
|
127
|
+
export declare function normalizeAnthropicValue(value: unknown): unknown;
|
|
128
|
+
export {};
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { isPlainObject } from "@zachsents/zippy";
|
|
3
|
+
export const ANTHROPIC_SESSION_WEBHOOK_TYPES = [
|
|
4
|
+
"session.status_run_started",
|
|
5
|
+
"session.status_idled",
|
|
6
|
+
"session.budget_reached",
|
|
7
|
+
"session.status_rescheduled",
|
|
8
|
+
"session.status_terminated",
|
|
9
|
+
"session.thread_created",
|
|
10
|
+
"session.thread_idled",
|
|
11
|
+
"session.thread_terminated",
|
|
12
|
+
"session.outcome_evaluation_ended",
|
|
13
|
+
"session.updated",
|
|
14
|
+
"session.deleted",
|
|
15
|
+
];
|
|
16
|
+
export const ANTHROPIC_AGENT_WEBHOOK_TYPES = [
|
|
17
|
+
"agent.created",
|
|
18
|
+
"agent.updated",
|
|
19
|
+
"agent.archived",
|
|
20
|
+
"agent.deleted",
|
|
21
|
+
];
|
|
22
|
+
export const ANTHROPIC_ENVIRONMENT_WEBHOOK_TYPES = [
|
|
23
|
+
"environment.created",
|
|
24
|
+
"environment.updated",
|
|
25
|
+
"environment.archived",
|
|
26
|
+
"environment.deleted",
|
|
27
|
+
];
|
|
28
|
+
export const ANTHROPIC_WEBHOOK_TYPES = [
|
|
29
|
+
...ANTHROPIC_SESSION_WEBHOOK_TYPES,
|
|
30
|
+
...ANTHROPIC_AGENT_WEBHOOK_TYPES,
|
|
31
|
+
...ANTHROPIC_ENVIRONMENT_WEBHOOK_TYPES,
|
|
32
|
+
];
|
|
33
|
+
export const ANTHROPIC_TRIGGER_CONFIG_SCHEMA = z.object({});
|
|
34
|
+
export const ANTHROPIC_IDLE_EVENT_SCHEMA = z.object({
|
|
35
|
+
id: z.string(),
|
|
36
|
+
processedAt: z.iso.datetime(),
|
|
37
|
+
stopReason: z.discriminatedUnion("type", [
|
|
38
|
+
z.object({ type: z.literal("end_turn") }),
|
|
39
|
+
z.object({
|
|
40
|
+
eventIds: z.string().array(),
|
|
41
|
+
type: z.literal("requires_action"),
|
|
42
|
+
}),
|
|
43
|
+
z.object({ type: z.literal("budget_reached") }),
|
|
44
|
+
z.object({ type: z.literal("retries_exhausted") }),
|
|
45
|
+
]),
|
|
46
|
+
type: z.literal("session.status_idle"),
|
|
47
|
+
});
|
|
48
|
+
const ANTHROPIC_EVENT_FIELDS = {
|
|
49
|
+
createdAt: z.iso.datetime(),
|
|
50
|
+
id: z.string(),
|
|
51
|
+
organizationId: z.string(),
|
|
52
|
+
resourceId: z.string(),
|
|
53
|
+
workspaceId: z.string(),
|
|
54
|
+
};
|
|
55
|
+
const ANTHROPIC_RESOURCE_SCHEMA = z
|
|
56
|
+
.object({ id: z.string(), type: z.string() })
|
|
57
|
+
.catchall(z.json());
|
|
58
|
+
const ANTHROPIC_AGENT_RESOURCE_SCHEMA = z.custom((value) => ANTHROPIC_RESOURCE_SCHEMA.safeParse(value).success);
|
|
59
|
+
const ANTHROPIC_ENVIRONMENT_RESOURCE_SCHEMA = z.custom((value) => ANTHROPIC_RESOURCE_SCHEMA.safeParse(value).success);
|
|
60
|
+
const ANTHROPIC_SESSION_RESOURCE_SCHEMA = z.custom((value) => ANTHROPIC_RESOURCE_SCHEMA.safeParse(value).success);
|
|
61
|
+
/**
|
|
62
|
+
* Builds one exact non-deletion webhook payload schema.
|
|
63
|
+
*
|
|
64
|
+
* @param providerEventType - Exact provider event discriminator.
|
|
65
|
+
* @param resource - Authoritative resource schema for the event family.
|
|
66
|
+
*/
|
|
67
|
+
function resourceEventSchema(providerEventType, resource) {
|
|
68
|
+
return z.object({
|
|
69
|
+
...ANTHROPIC_EVENT_FIELDS,
|
|
70
|
+
idleEvent: z.null(),
|
|
71
|
+
providerEventType: z.literal(providerEventType),
|
|
72
|
+
resource,
|
|
73
|
+
sessionThreadId: z.null(),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Builds one exact deletion webhook payload schema.
|
|
78
|
+
*
|
|
79
|
+
* @param providerEventType - Exact provider event discriminator.
|
|
80
|
+
*/
|
|
81
|
+
function deletedEventSchema(providerEventType) {
|
|
82
|
+
return z.object({
|
|
83
|
+
...ANTHROPIC_EVENT_FIELDS,
|
|
84
|
+
idleEvent: z.null(),
|
|
85
|
+
providerEventType: z.literal(providerEventType),
|
|
86
|
+
resource: z.null(),
|
|
87
|
+
sessionThreadId: z.null(),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/** Builds the exact enriched session-idled payload schema. */
|
|
91
|
+
function sessionIdledEventSchema() {
|
|
92
|
+
return z.object({
|
|
93
|
+
...ANTHROPIC_EVENT_FIELDS,
|
|
94
|
+
idleEvent: ANTHROPIC_IDLE_EVENT_SCHEMA,
|
|
95
|
+
providerEventType: z.literal("session.status_idled"),
|
|
96
|
+
resource: ANTHROPIC_SESSION_RESOURCE_SCHEMA,
|
|
97
|
+
sessionThreadId: z.null(),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Builds an exact session-thread lifecycle payload schema.
|
|
102
|
+
*
|
|
103
|
+
* @param providerEventType - Exact thread event discriminator.
|
|
104
|
+
*/
|
|
105
|
+
function sessionThreadEventSchema(providerEventType) {
|
|
106
|
+
return z.object({
|
|
107
|
+
...ANTHROPIC_EVENT_FIELDS,
|
|
108
|
+
idleEvent: z.null(),
|
|
109
|
+
providerEventType: z.literal(providerEventType),
|
|
110
|
+
resource: ANTHROPIC_SESSION_RESOURCE_SCHEMA,
|
|
111
|
+
sessionThreadId: z.string(),
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
const ANTHROPIC_EVENT_SCHEMAS = {
|
|
115
|
+
"agent.archived": resourceEventSchema("agent.archived", ANTHROPIC_AGENT_RESOURCE_SCHEMA),
|
|
116
|
+
"agent.created": resourceEventSchema("agent.created", ANTHROPIC_AGENT_RESOURCE_SCHEMA),
|
|
117
|
+
"agent.deleted": deletedEventSchema("agent.deleted"),
|
|
118
|
+
"agent.updated": resourceEventSchema("agent.updated", ANTHROPIC_AGENT_RESOURCE_SCHEMA),
|
|
119
|
+
"environment.archived": resourceEventSchema("environment.archived", ANTHROPIC_ENVIRONMENT_RESOURCE_SCHEMA),
|
|
120
|
+
"environment.created": resourceEventSchema("environment.created", ANTHROPIC_ENVIRONMENT_RESOURCE_SCHEMA),
|
|
121
|
+
"environment.deleted": deletedEventSchema("environment.deleted"),
|
|
122
|
+
"environment.updated": resourceEventSchema("environment.updated", ANTHROPIC_ENVIRONMENT_RESOURCE_SCHEMA),
|
|
123
|
+
"session.budget_reached": resourceEventSchema("session.budget_reached", ANTHROPIC_SESSION_RESOURCE_SCHEMA),
|
|
124
|
+
"session.deleted": deletedEventSchema("session.deleted"),
|
|
125
|
+
"session.outcome_evaluation_ended": resourceEventSchema("session.outcome_evaluation_ended", ANTHROPIC_SESSION_RESOURCE_SCHEMA),
|
|
126
|
+
"session.status_idled": sessionIdledEventSchema(),
|
|
127
|
+
"session.status_rescheduled": resourceEventSchema("session.status_rescheduled", ANTHROPIC_SESSION_RESOURCE_SCHEMA),
|
|
128
|
+
"session.status_run_started": resourceEventSchema("session.status_run_started", ANTHROPIC_SESSION_RESOURCE_SCHEMA),
|
|
129
|
+
"session.status_terminated": resourceEventSchema("session.status_terminated", ANTHROPIC_SESSION_RESOURCE_SCHEMA),
|
|
130
|
+
"session.thread_created": sessionThreadEventSchema("session.thread_created"),
|
|
131
|
+
"session.thread_idled": sessionThreadEventSchema("session.thread_idled"),
|
|
132
|
+
"session.thread_terminated": sessionThreadEventSchema("session.thread_terminated"),
|
|
133
|
+
"session.updated": resourceEventSchema("session.updated", ANTHROPIC_SESSION_RESOURCE_SCHEMA),
|
|
134
|
+
};
|
|
135
|
+
export const ANTHROPIC_AGENT_EVENT_SCHEMA = z.union([
|
|
136
|
+
ANTHROPIC_EVENT_SCHEMAS["agent.archived"],
|
|
137
|
+
ANTHROPIC_EVENT_SCHEMAS["agent.created"],
|
|
138
|
+
ANTHROPIC_EVENT_SCHEMAS["agent.deleted"],
|
|
139
|
+
ANTHROPIC_EVENT_SCHEMAS["agent.updated"],
|
|
140
|
+
]);
|
|
141
|
+
export const ANTHROPIC_ENVIRONMENT_EVENT_SCHEMA = z.union([
|
|
142
|
+
ANTHROPIC_EVENT_SCHEMAS["environment.archived"],
|
|
143
|
+
ANTHROPIC_EVENT_SCHEMAS["environment.created"],
|
|
144
|
+
ANTHROPIC_EVENT_SCHEMAS["environment.deleted"],
|
|
145
|
+
ANTHROPIC_EVENT_SCHEMAS["environment.updated"],
|
|
146
|
+
]);
|
|
147
|
+
export const ANTHROPIC_SESSION_EVENT_SCHEMA = z.union([
|
|
148
|
+
ANTHROPIC_EVENT_SCHEMAS["session.budget_reached"],
|
|
149
|
+
ANTHROPIC_EVENT_SCHEMAS["session.deleted"],
|
|
150
|
+
ANTHROPIC_EVENT_SCHEMAS["session.outcome_evaluation_ended"],
|
|
151
|
+
ANTHROPIC_EVENT_SCHEMAS["session.status_idled"],
|
|
152
|
+
ANTHROPIC_EVENT_SCHEMAS["session.status_rescheduled"],
|
|
153
|
+
ANTHROPIC_EVENT_SCHEMAS["session.status_run_started"],
|
|
154
|
+
ANTHROPIC_EVENT_SCHEMAS["session.status_terminated"],
|
|
155
|
+
ANTHROPIC_EVENT_SCHEMAS["session.thread_created"],
|
|
156
|
+
ANTHROPIC_EVENT_SCHEMAS["session.thread_idled"],
|
|
157
|
+
ANTHROPIC_EVENT_SCHEMAS["session.thread_terminated"],
|
|
158
|
+
ANTHROPIC_EVENT_SCHEMAS["session.updated"],
|
|
159
|
+
]);
|
|
160
|
+
export const ANTHROPIC_RUN_EVENT_SCHEMA = z.union([
|
|
161
|
+
ANTHROPIC_EVENT_SCHEMAS["session.status_idled"],
|
|
162
|
+
ANTHROPIC_EVENT_SCHEMAS["session.status_terminated"],
|
|
163
|
+
]);
|
|
164
|
+
export const ANTHROPIC_EVENT_SCHEMA = z.union([
|
|
165
|
+
ANTHROPIC_AGENT_EVENT_SCHEMA,
|
|
166
|
+
ANTHROPIC_ENVIRONMENT_EVENT_SCHEMA,
|
|
167
|
+
ANTHROPIC_SESSION_EVENT_SCHEMA,
|
|
168
|
+
]);
|
|
169
|
+
export const anthropicEventTypeMap = {
|
|
170
|
+
"agent.archived": "anthropic.agent.archived",
|
|
171
|
+
"agent.created": "anthropic.agent.created",
|
|
172
|
+
"agent.deleted": "anthropic.agent.deleted",
|
|
173
|
+
"agent.updated": "anthropic.agent.updated",
|
|
174
|
+
"environment.archived": "anthropic.environment.archived",
|
|
175
|
+
"environment.created": "anthropic.environment.created",
|
|
176
|
+
"environment.deleted": "anthropic.environment.deleted",
|
|
177
|
+
"environment.updated": "anthropic.environment.updated",
|
|
178
|
+
"session.budget_reached": "anthropic.session.budgetReached",
|
|
179
|
+
"session.deleted": "anthropic.session.deleted",
|
|
180
|
+
"session.outcome_evaluation_ended": "anthropic.session.outcomeEvaluationEnded",
|
|
181
|
+
"session.status_idled": "anthropic.session.idled",
|
|
182
|
+
"session.status_rescheduled": "anthropic.session.rescheduled",
|
|
183
|
+
"session.status_run_started": "anthropic.session.runStarted",
|
|
184
|
+
"session.status_terminated": "anthropic.session.terminated",
|
|
185
|
+
"session.thread_created": "anthropic.session.threadCreated",
|
|
186
|
+
"session.thread_idled": "anthropic.session.threadIdled",
|
|
187
|
+
"session.thread_terminated": "anthropic.session.threadTerminated",
|
|
188
|
+
"session.updated": "anthropic.session.updated",
|
|
189
|
+
};
|
|
190
|
+
export const ANTHROPIC_BROAD_EVENT_TYPES = {
|
|
191
|
+
agent: "anthropic.agent.event",
|
|
192
|
+
environment: "anthropic.environment.event",
|
|
193
|
+
session: "anthropic.session.event",
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Binds one event schema to the shared Managed Agents trigger configuration.
|
|
197
|
+
*
|
|
198
|
+
* @param eventSchema - Family or semantic event schema.
|
|
199
|
+
*/
|
|
200
|
+
function triggerContract(eventSchema) {
|
|
201
|
+
return { configSchema: ANTHROPIC_TRIGGER_CONFIG_SCHEMA, eventSchema };
|
|
202
|
+
}
|
|
203
|
+
export const anthropicTriggerContracts = {
|
|
204
|
+
"anthropic.agent.archived": triggerContract(ANTHROPIC_EVENT_SCHEMAS["agent.archived"]),
|
|
205
|
+
"anthropic.agent.created": triggerContract(ANTHROPIC_EVENT_SCHEMAS["agent.created"]),
|
|
206
|
+
"anthropic.agent.deleted": triggerContract(ANTHROPIC_EVENT_SCHEMAS["agent.deleted"]),
|
|
207
|
+
"anthropic.agent.event": triggerContract(ANTHROPIC_AGENT_EVENT_SCHEMA),
|
|
208
|
+
"anthropic.agent.updated": triggerContract(ANTHROPIC_EVENT_SCHEMAS["agent.updated"]),
|
|
209
|
+
"anthropic.environment.archived": triggerContract(ANTHROPIC_EVENT_SCHEMAS["environment.archived"]),
|
|
210
|
+
"anthropic.environment.created": triggerContract(ANTHROPIC_EVENT_SCHEMAS["environment.created"]),
|
|
211
|
+
"anthropic.environment.deleted": triggerContract(ANTHROPIC_EVENT_SCHEMAS["environment.deleted"]),
|
|
212
|
+
"anthropic.environment.event": triggerContract(ANTHROPIC_ENVIRONMENT_EVENT_SCHEMA),
|
|
213
|
+
"anthropic.environment.updated": triggerContract(ANTHROPIC_EVENT_SCHEMAS["environment.updated"]),
|
|
214
|
+
"anthropic.session.budgetReached": triggerContract(ANTHROPIC_EVENT_SCHEMAS["session.budget_reached"]),
|
|
215
|
+
"anthropic.session.deleted": triggerContract(ANTHROPIC_EVENT_SCHEMAS["session.deleted"]),
|
|
216
|
+
"anthropic.session.event": triggerContract(ANTHROPIC_SESSION_EVENT_SCHEMA),
|
|
217
|
+
"anthropic.session.idled": triggerContract(ANTHROPIC_EVENT_SCHEMAS["session.status_idled"]),
|
|
218
|
+
"anthropic.session.outcomeEvaluationEnded": triggerContract(ANTHROPIC_EVENT_SCHEMAS["session.outcome_evaluation_ended"]),
|
|
219
|
+
"anthropic.session.rescheduled": triggerContract(ANTHROPIC_EVENT_SCHEMAS["session.status_rescheduled"]),
|
|
220
|
+
"anthropic.session.runStarted": triggerContract(ANTHROPIC_EVENT_SCHEMAS["session.status_run_started"]),
|
|
221
|
+
"anthropic.session.terminated": triggerContract(ANTHROPIC_EVENT_SCHEMAS["session.status_terminated"]),
|
|
222
|
+
"anthropic.session.threadCreated": triggerContract(ANTHROPIC_EVENT_SCHEMAS["session.thread_created"]),
|
|
223
|
+
"anthropic.session.threadIdled": triggerContract(ANTHROPIC_EVENT_SCHEMAS["session.thread_idled"]),
|
|
224
|
+
"anthropic.session.threadTerminated": triggerContract(ANTHROPIC_EVENT_SCHEMAS["session.thread_terminated"]),
|
|
225
|
+
"anthropic.session.updated": triggerContract(ANTHROPIC_EVENT_SCHEMAS["session.updated"]),
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Returns the broad and semantic event types for one verified delivery.
|
|
229
|
+
*
|
|
230
|
+
* @param type - Provider webhook event type.
|
|
231
|
+
*/
|
|
232
|
+
export function getAnthropicEventTypes(type) {
|
|
233
|
+
return [
|
|
234
|
+
type.startsWith("agent.")
|
|
235
|
+
? ANTHROPIC_BROAD_EVENT_TYPES.agent
|
|
236
|
+
: type.startsWith("environment.")
|
|
237
|
+
? ANTHROPIC_BROAD_EVENT_TYPES.environment
|
|
238
|
+
: ANTHROPIC_BROAD_EVENT_TYPES.session,
|
|
239
|
+
anthropicEventTypeMap[type],
|
|
240
|
+
];
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Converts Anthropic provider response keys to the public camelCase contract.
|
|
244
|
+
*
|
|
245
|
+
* @param value - Provider response value.
|
|
246
|
+
*/
|
|
247
|
+
export function normalizeAnthropicValue(value) {
|
|
248
|
+
if (Array.isArray(value))
|
|
249
|
+
return value.map(normalizeAnthropicValue);
|
|
250
|
+
if (!isPlainObject(value))
|
|
251
|
+
return value;
|
|
252
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => {
|
|
253
|
+
const publicKey = key.replace(/_([a-z0-9])/g, (_match, character) => character.toUpperCase());
|
|
254
|
+
return [
|
|
255
|
+
publicKey,
|
|
256
|
+
["input", "inputSchema", "metadata"].includes(publicKey)
|
|
257
|
+
? item
|
|
258
|
+
: normalizeAnthropicValue(item),
|
|
259
|
+
];
|
|
260
|
+
}));
|
|
261
|
+
}
|
package/dist/automate/index.d.ts
CHANGED
|
@@ -249,8 +249,8 @@ export declare const AUTOMATE_EXECUTION_EVENT_SCHEMA: z.ZodObject<{
|
|
|
249
249
|
id: z.ZodString;
|
|
250
250
|
settledAt: z.ZodNullable<z.ZodDate>;
|
|
251
251
|
status: z.ZodEnum<{
|
|
252
|
-
failed: "failed";
|
|
253
252
|
running: "running";
|
|
253
|
+
failed: "failed";
|
|
254
254
|
settled: "settled";
|
|
255
255
|
}>;
|
|
256
256
|
}, z.core.$strip>;
|
|
@@ -385,9 +385,9 @@ export declare const AUTOMATE_ACTION_ATTEMPT_EVENT_SCHEMA: z.ZodObject<{
|
|
|
385
385
|
retryAt: z.ZodNullable<z.ZodDate>;
|
|
386
386
|
startedAt: z.ZodDate;
|
|
387
387
|
status: z.ZodEnum<{
|
|
388
|
+
running: "running";
|
|
388
389
|
succeeded: "succeeded";
|
|
389
390
|
failed: "failed";
|
|
390
|
-
running: "running";
|
|
391
391
|
retrying: "retrying";
|
|
392
392
|
indeterminate: "indeterminate";
|
|
393
393
|
}>;
|
|
@@ -860,9 +860,9 @@ export declare const automateTriggerContracts: {
|
|
|
860
860
|
retryAt: z.ZodNullable<z.ZodDate>;
|
|
861
861
|
startedAt: z.ZodDate;
|
|
862
862
|
status: z.ZodEnum<{
|
|
863
|
+
running: "running";
|
|
863
864
|
succeeded: "succeeded";
|
|
864
865
|
failed: "failed";
|
|
865
|
-
running: "running";
|
|
866
866
|
retrying: "retrying";
|
|
867
867
|
indeterminate: "indeterminate";
|
|
868
868
|
}>;
|
|
@@ -1167,8 +1167,8 @@ export declare const automateTriggerContracts: {
|
|
|
1167
1167
|
id: z.ZodString;
|
|
1168
1168
|
settledAt: z.ZodNullable<z.ZodDate>;
|
|
1169
1169
|
status: z.ZodEnum<{
|
|
1170
|
-
failed: "failed";
|
|
1171
1170
|
running: "running";
|
|
1171
|
+
failed: "failed";
|
|
1172
1172
|
settled: "settled";
|
|
1173
1173
|
}>;
|
|
1174
1174
|
}, z.core.$strip>;
|
package/dist/close/events.d.ts
CHANGED
|
@@ -120,8 +120,8 @@ export declare const closeTriggerContracts: {
|
|
|
120
120
|
External: "External";
|
|
121
121
|
}>>;
|
|
122
122
|
status: z.ZodOptional<z.ZodEnum<{
|
|
123
|
-
failed: "failed";
|
|
124
123
|
created: "created";
|
|
124
|
+
failed: "failed";
|
|
125
125
|
completed: "completed";
|
|
126
126
|
timeout: "timeout";
|
|
127
127
|
busy: "busy";
|
|
@@ -193,8 +193,8 @@ export declare const closeTriggerContracts: {
|
|
|
193
193
|
External: "External";
|
|
194
194
|
}>>;
|
|
195
195
|
status: z.ZodOptional<z.ZodEnum<{
|
|
196
|
-
failed: "failed";
|
|
197
196
|
created: "created";
|
|
197
|
+
failed: "failed";
|
|
198
198
|
completed: "completed";
|
|
199
199
|
timeout: "timeout";
|
|
200
200
|
busy: "busy";
|
package/dist/close/schemas.d.ts
CHANGED
|
@@ -836,8 +836,8 @@ export declare const CLOSE_CALL_SCHEMA: z.ZodObject<{
|
|
|
836
836
|
External: "External";
|
|
837
837
|
}>;
|
|
838
838
|
status: z.ZodEnum<{
|
|
839
|
-
failed: "failed";
|
|
840
839
|
created: "created";
|
|
840
|
+
failed: "failed";
|
|
841
841
|
completed: "completed";
|
|
842
842
|
timeout: "timeout";
|
|
843
843
|
busy: "busy";
|
|
@@ -1066,8 +1066,8 @@ export declare const CLOSE_ACTIVITY_SCHEMA: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
1066
1066
|
External: "External";
|
|
1067
1067
|
}>;
|
|
1068
1068
|
status: z.ZodEnum<{
|
|
1069
|
-
failed: "failed";
|
|
1070
1069
|
created: "created";
|
|
1070
|
+
failed: "failed";
|
|
1071
1071
|
completed: "completed";
|
|
1072
1072
|
timeout: "timeout";
|
|
1073
1073
|
busy: "busy";
|
package/dist/gmail/schemas.d.ts
CHANGED
|
@@ -842,8 +842,8 @@ export declare const LABEL_SCHEMA: z.ZodObject<{
|
|
|
842
842
|
threadsTotal: z.ZodOptional<z.ZodNumber>;
|
|
843
843
|
threadsUnread: z.ZodOptional<z.ZodNumber>;
|
|
844
844
|
type: z.ZodOptional<z.ZodEnum<{
|
|
845
|
-
user: "user";
|
|
846
845
|
system: "system";
|
|
846
|
+
user: "user";
|
|
847
847
|
}>>;
|
|
848
848
|
}, z.core.$strip>;
|
|
849
849
|
export declare const PROFILE_SCHEMA: z.ZodObject<{
|
|
@@ -40,8 +40,8 @@ export declare const GOOGLE_DRIVE_PROVIDER_EVENT_TYPES: {
|
|
|
40
40
|
export type GoogleDriveProviderEventType = (typeof GOOGLE_DRIVE_PROVIDER_EVENT_TYPES)[GoogleDriveTriggerType];
|
|
41
41
|
export declare const GOOGLE_DRIVE_EVENT_SCHEMA: z.ZodObject<{
|
|
42
42
|
action: z.ZodEnum<{
|
|
43
|
-
cancelled: "cancelled";
|
|
44
43
|
created: "created";
|
|
44
|
+
cancelled: "cancelled";
|
|
45
45
|
completed: "completed";
|
|
46
46
|
deleted: "deleted";
|
|
47
47
|
moved: "moved";
|
|
@@ -954,8 +954,8 @@ export declare const googleDriveTriggerContracts: {
|
|
|
954
954
|
}, z.core.$strip>;
|
|
955
955
|
eventSchema: z.ZodObject<{
|
|
956
956
|
action: z.ZodEnum<{
|
|
957
|
-
cancelled: "cancelled";
|
|
958
957
|
created: "created";
|
|
958
|
+
cancelled: "cancelled";
|
|
959
959
|
completed: "completed";
|
|
960
960
|
deleted: "deleted";
|
|
961
961
|
moved: "moved";
|
|
@@ -1038,7 +1038,7 @@ export declare function toGoogleDriveTriggerType(providerEventType: string): Goo
|
|
|
1038
1038
|
* @param eventType - Stable internal semantic event type.
|
|
1039
1039
|
*/
|
|
1040
1040
|
export declare function parseGoogleDriveTriggerType(eventType: GoogleDriveTriggerType): {
|
|
1041
|
-
action: "
|
|
1041
|
+
action: "created" | "cancelled" | "completed" | "deleted" | "moved" | "contentChanged" | "edited" | "reopened" | "renamed" | "reset" | "resolved" | "responded" | "reviewersChanged" | "trashed" | "untrashed";
|
|
1042
1042
|
resourceType: "file" | "reply" | "comment" | "accessProposal" | "approval" | "permission";
|
|
1043
1043
|
};
|
|
1044
1044
|
export {};
|
package/dist/linear/schemas.d.ts
CHANGED
|
@@ -4392,7 +4392,9 @@ export declare const LINEAR_ISSUE_RELATION_SCHEMA: z.ZodObject<{
|
|
|
4392
4392
|
}, z.core.$strip>;
|
|
4393
4393
|
export declare const LINEAR_PROVIDER_PROJECT_SCHEMA: z.ZodObject<{
|
|
4394
4394
|
id: z.ZodString;
|
|
4395
|
-
|
|
4395
|
+
description: z.ZodString;
|
|
4396
|
+
name: z.ZodString;
|
|
4397
|
+
scope: z.ZodNumber;
|
|
4396
4398
|
status: z.ZodObject<{
|
|
4397
4399
|
color: z.ZodString;
|
|
4398
4400
|
description: z.ZodNullable<z.ZodString>;
|
|
@@ -4401,12 +4403,12 @@ export declare const LINEAR_PROVIDER_PROJECT_SCHEMA: z.ZodObject<{
|
|
|
4401
4403
|
type: z.ZodString;
|
|
4402
4404
|
}, z.core.$strip>;
|
|
4403
4405
|
createdAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
+
archivedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4407
|
+
updatedAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
4408
|
+
startedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4406
4409
|
completedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4407
4410
|
url: z.ZodString;
|
|
4408
4411
|
priority: z.ZodNumber;
|
|
4409
|
-
updatedAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
4410
4412
|
state: z.ZodString;
|
|
4411
4413
|
color: z.ZodString;
|
|
4412
4414
|
content: z.ZodNullable<z.ZodString>;
|
|
@@ -4428,9 +4430,7 @@ export declare const LINEAR_PROVIDER_PROJECT_SCHEMA: z.ZodObject<{
|
|
|
4428
4430
|
id: z.ZodString;
|
|
4429
4431
|
name: z.ZodString;
|
|
4430
4432
|
}, z.core.$strip>>;
|
|
4431
|
-
scope: z.ZodNumber;
|
|
4432
4433
|
progress: z.ZodNumber;
|
|
4433
|
-
archivedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4434
4434
|
canceledAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4435
4435
|
priorityLabel: z.ZodString;
|
|
4436
4436
|
slugId: z.ZodString;
|
|
@@ -4470,10 +4470,12 @@ export declare const LINEAR_PROVIDER_PROJECT_SCHEMA: z.ZodObject<{
|
|
|
4470
4470
|
export declare const LINEAR_PROVIDER_ISSUE_SCHEMA: z.ZodObject<{
|
|
4471
4471
|
number: z.ZodNumber;
|
|
4472
4472
|
id: z.ZodString;
|
|
4473
|
-
startedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4474
|
-
createdAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
4475
|
-
title: z.ZodString;
|
|
4476
4473
|
description: z.ZodNullable<z.ZodString>;
|
|
4474
|
+
title: z.ZodString;
|
|
4475
|
+
createdAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
4476
|
+
archivedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4477
|
+
updatedAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
4478
|
+
startedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4477
4479
|
project: z.ZodNullable<z.ZodObject<{
|
|
4478
4480
|
id: z.ZodString;
|
|
4479
4481
|
name: z.ZodString;
|
|
@@ -4483,7 +4485,6 @@ export declare const LINEAR_PROVIDER_ISSUE_SCHEMA: z.ZodObject<{
|
|
|
4483
4485
|
completedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4484
4486
|
url: z.ZodString;
|
|
4485
4487
|
priority: z.ZodNumber;
|
|
4486
|
-
updatedAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
4487
4488
|
state: z.ZodObject<{
|
|
4488
4489
|
color: z.ZodString;
|
|
4489
4490
|
id: z.ZodString;
|
|
@@ -4520,7 +4521,6 @@ export declare const LINEAR_PROVIDER_ISSUE_SCHEMA: z.ZodObject<{
|
|
|
4520
4521
|
name: z.ZodString;
|
|
4521
4522
|
}, z.core.$strip>>;
|
|
4522
4523
|
trashed: z.ZodNullable<z.ZodBoolean>;
|
|
4523
|
-
archivedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4524
4524
|
identifier: z.ZodString;
|
|
4525
4525
|
canceledAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4526
4526
|
estimate: z.ZodNullable<z.ZodNumber>;
|