@notionhq/workers 0.5.0 → 0.6.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.
Files changed (189) hide show
  1. package/dist/alpha/builder.d.ts +149 -0
  2. package/dist/alpha/builder.d.ts.map +1 -0
  3. package/dist/alpha/builder.js +260 -0
  4. package/dist/alpha/builder.test.d.ts +2 -0
  5. package/dist/alpha/builder.test.d.ts.map +1 -0
  6. package/dist/alpha/cli/build.d.ts +13 -0
  7. package/dist/alpha/cli/build.d.ts.map +1 -0
  8. package/dist/alpha/cli/build.js +36 -0
  9. package/dist/alpha/cli/build.test.d.ts +2 -0
  10. package/dist/alpha/cli/build.test.d.ts.map +1 -0
  11. package/dist/alpha/cli/codegen.d.ts +10 -0
  12. package/dist/alpha/cli/codegen.d.ts.map +1 -0
  13. package/dist/alpha/cli/codegen.js +41 -0
  14. package/dist/alpha/cli/codegen.test.d.ts +2 -0
  15. package/dist/alpha/cli/codegen.test.d.ts.map +1 -0
  16. package/dist/alpha/cli/discover.d.ts +35 -0
  17. package/dist/alpha/cli/discover.d.ts.map +1 -0
  18. package/dist/alpha/cli/discover.js +39 -0
  19. package/dist/alpha/cli/discover.test.d.ts +2 -0
  20. package/dist/alpha/cli/discover.test.d.ts.map +1 -0
  21. package/dist/alpha/cli/emit-manifest.d.ts +33 -0
  22. package/dist/alpha/cli/emit-manifest.d.ts.map +1 -0
  23. package/dist/alpha/cli/emit-manifest.js +266 -0
  24. package/dist/alpha/cli/emit-manifest.test.d.ts +2 -0
  25. package/dist/alpha/cli/emit-manifest.test.d.ts.map +1 -0
  26. package/dist/alpha/cli/index.d.ts +3 -0
  27. package/dist/alpha/cli/index.d.ts.map +1 -0
  28. package/dist/alpha/cli/index.js +36 -0
  29. package/dist/alpha/context.d.ts +8 -0
  30. package/dist/alpha/context.d.ts.map +1 -0
  31. package/dist/alpha/context.js +33 -0
  32. package/dist/alpha/database.d.ts +90 -0
  33. package/dist/alpha/database.d.ts.map +1 -0
  34. package/dist/alpha/database.js +9 -0
  35. package/dist/alpha/error.d.ts +41 -0
  36. package/dist/alpha/error.d.ts.map +1 -0
  37. package/dist/alpha/error.js +25 -0
  38. package/dist/alpha/icon-names.d.ts +6 -0
  39. package/dist/alpha/icon-names.d.ts.map +1 -0
  40. package/dist/alpha/icon-names.js +0 -0
  41. package/dist/alpha/json-schema.d.ts +117 -0
  42. package/dist/alpha/json-schema.d.ts.map +1 -0
  43. package/dist/alpha/json-schema.js +0 -0
  44. package/dist/alpha/manifest.d.ts +44 -0
  45. package/dist/alpha/manifest.d.ts.map +1 -0
  46. package/dist/alpha/manifest.js +0 -0
  47. package/dist/alpha/output.d.ts +7 -0
  48. package/dist/alpha/output.d.ts.map +1 -0
  49. package/dist/alpha/output.js +8 -0
  50. package/dist/alpha/pacer.d.ts +74 -0
  51. package/dist/alpha/pacer.d.ts.map +1 -0
  52. package/dist/alpha/pacer.js +66 -0
  53. package/dist/alpha/pacer.test.d.ts +2 -0
  54. package/dist/alpha/pacer.test.d.ts.map +1 -0
  55. package/dist/alpha/schedule.d.ts +6 -0
  56. package/dist/alpha/schedule.d.ts.map +1 -0
  57. package/dist/alpha/schedule.js +43 -0
  58. package/dist/alpha/schedule.test.d.ts +2 -0
  59. package/dist/alpha/schedule.test.d.ts.map +1 -0
  60. package/dist/alpha/schema-builder.d.ts +79 -0
  61. package/dist/alpha/schema-builder.d.ts.map +1 -0
  62. package/dist/alpha/schema-builder.js +135 -0
  63. package/dist/alpha/schema.d.ts +185 -0
  64. package/dist/alpha/schema.d.ts.map +1 -0
  65. package/dist/alpha/schema.js +115 -0
  66. package/dist/alpha/sync.d.ts +233 -0
  67. package/dist/alpha/sync.d.ts.map +1 -0
  68. package/dist/alpha/sync.js +70 -0
  69. package/dist/alpha/sync.test.d.ts +2 -0
  70. package/dist/alpha/sync.test.d.ts.map +1 -0
  71. package/dist/alpha/tool.d.ts +132 -0
  72. package/dist/alpha/tool.d.ts.map +1 -0
  73. package/dist/alpha/tool.js +156 -0
  74. package/dist/alpha/tool.test.d.ts +2 -0
  75. package/dist/alpha/tool.test.d.ts.map +1 -0
  76. package/dist/alpha/triggers.d.ts +365 -0
  77. package/dist/alpha/triggers.d.ts.map +1 -0
  78. package/dist/alpha/triggers.generated.d.ts +246 -0
  79. package/dist/alpha/triggers.generated.d.ts.map +1 -0
  80. package/dist/alpha/triggers.generated.js +239 -0
  81. package/dist/alpha/triggers.js +0 -0
  82. package/dist/alpha/types.d.ts +228 -0
  83. package/dist/alpha/types.d.ts.map +1 -0
  84. package/dist/alpha/types.js +0 -0
  85. package/dist/alpha/workflow.d.ts +70 -0
  86. package/dist/alpha/workflow.d.ts.map +1 -0
  87. package/dist/alpha/workflow.js +39 -0
  88. package/dist/alpha/workflow.test.d.ts +2 -0
  89. package/dist/alpha/workflow.test.d.ts.map +1 -0
  90. package/dist/builder.d.ts.map +1 -1
  91. package/dist/builder.js +2 -6
  92. package/dist/capabilities/ai_connector.d.ts.map +1 -1
  93. package/dist/capabilities/automation.d.ts.map +1 -1
  94. package/dist/capabilities/context.d.ts.map +1 -1
  95. package/dist/capabilities/custom-block.d.ts +124 -0
  96. package/dist/capabilities/custom-block.d.ts.map +1 -0
  97. package/dist/capabilities/custom-block.js +22 -0
  98. package/dist/capabilities/oauth.d.ts.map +1 -1
  99. package/dist/capabilities/output.d.ts.map +1 -1
  100. package/dist/capabilities/output.js +2 -4
  101. package/dist/capabilities/stateful-capability.d.ts.map +1 -1
  102. package/dist/capabilities/stateful-capability.js +2 -6
  103. package/dist/capabilities/sync.d.ts.map +1 -1
  104. package/dist/capabilities/sync.js +2 -8
  105. package/dist/capabilities/tool.d.ts.map +1 -1
  106. package/dist/capabilities/tool.js +6 -20
  107. package/dist/capabilities/webhook.d.ts.map +1 -1
  108. package/dist/capabilities/workflow.d.ts +2 -2
  109. package/dist/capabilities/workflow.d.ts.map +1 -1
  110. package/dist/index.d.ts +3 -2
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/index.js +1 -7
  113. package/dist/json-schema.d.ts.map +1 -1
  114. package/dist/schema-builder.d.ts.map +1 -1
  115. package/dist/schema.d.ts.map +1 -1
  116. package/dist/types.d.ts.map +1 -1
  117. package/dist/worker.d.ts +41 -1
  118. package/dist/worker.d.ts.map +1 -1
  119. package/dist/worker.js +51 -4
  120. package/package.json +74 -14
  121. package/src/alpha/ajv-formats.d.ts +7 -0
  122. package/src/alpha/builder.test.ts +197 -0
  123. package/src/alpha/builder.ts +338 -0
  124. package/src/alpha/cli/build.test.ts +240 -0
  125. package/src/alpha/cli/build.ts +57 -0
  126. package/src/alpha/cli/codegen.test.ts +31 -0
  127. package/src/alpha/cli/codegen.ts +51 -0
  128. package/src/alpha/cli/discover.test.ts +43 -0
  129. package/src/alpha/cli/discover.ts +81 -0
  130. package/src/alpha/cli/emit-manifest.test.ts +45 -0
  131. package/src/alpha/cli/emit-manifest.ts +409 -0
  132. package/src/alpha/cli/index.ts +41 -0
  133. package/src/alpha/context.ts +61 -0
  134. package/src/alpha/database.ts +102 -0
  135. package/src/alpha/error.ts +49 -0
  136. package/src/alpha/icon-names.ts +890 -0
  137. package/src/alpha/json-schema.ts +180 -0
  138. package/src/alpha/manifest.ts +47 -0
  139. package/src/alpha/output.ts +8 -0
  140. package/src/alpha/pacer.test.ts +81 -0
  141. package/src/alpha/pacer.ts +181 -0
  142. package/src/alpha/schedule.test.ts +31 -0
  143. package/src/alpha/schedule.ts +53 -0
  144. package/src/alpha/schema-builder.ts +193 -0
  145. package/src/alpha/schema.ts +222 -0
  146. package/src/alpha/sync.test.ts +191 -0
  147. package/src/alpha/sync.ts +340 -0
  148. package/src/alpha/tool.test.ts +116 -0
  149. package/src/alpha/tool.ts +319 -0
  150. package/src/alpha/triggers.generated.ts +489 -0
  151. package/src/alpha/triggers.ts +500 -0
  152. package/src/alpha/types.ts +284 -0
  153. package/src/alpha/workflow.test.ts +84 -0
  154. package/src/alpha/workflow.ts +131 -0
  155. package/src/builder.test.ts +28 -60
  156. package/src/builder.ts +3 -10
  157. package/src/capabilities/ai_connector.test.ts +9 -32
  158. package/src/capabilities/ai_connector.ts +5 -17
  159. package/src/capabilities/automation.test.ts +3 -12
  160. package/src/capabilities/automation.ts +3 -11
  161. package/src/capabilities/context.ts +3 -6
  162. package/src/capabilities/custom-block.ts +181 -0
  163. package/src/capabilities/oauth.test.ts +1 -0
  164. package/src/capabilities/oauth.ts +1 -3
  165. package/src/capabilities/output.ts +1 -3
  166. package/src/capabilities/stateful-capability.test.ts +1 -0
  167. package/src/capabilities/stateful-capability.ts +2 -6
  168. package/src/capabilities/sync.test.ts +15 -45
  169. package/src/capabilities/sync.ts +10 -40
  170. package/src/capabilities/tool.test.ts +106 -146
  171. package/src/capabilities/tool.ts +17 -39
  172. package/src/capabilities/webhook.ts +3 -10
  173. package/src/capabilities/workflow.test.ts +10 -31
  174. package/src/capabilities/workflow.ts +5 -12
  175. package/src/index.ts +9 -12
  176. package/src/json-schema.test.ts +2 -4
  177. package/src/json-schema.ts +7 -6
  178. package/src/pacer.test.ts +1 -3
  179. package/src/pacer_internal.ts +1 -5
  180. package/src/schema-builder.test.ts +10 -35
  181. package/src/schema-builder.ts +5 -16
  182. package/src/schema.ts +2 -10
  183. package/src/types.ts +1 -7
  184. package/src/worker.test.ts +147 -0
  185. package/src/worker.ts +67 -35
  186. package/dist/block.d.ts +0 -321
  187. package/dist/block.d.ts.map +0 -1
  188. package/src/block.ts +0 -529
  189. /package/dist/{block.js → alpha/ajv-formats.d.js} +0 -0
@@ -0,0 +1,132 @@
1
+ import type { CapabilityContext } from "./context.js";
2
+ import type { AnyJSONSchema } from "./json-schema.js";
3
+ import type { SchemaBuilder } from "./schema-builder.js";
4
+ import type { HandlerOptions } from "./types.js";
5
+ /**
6
+ * Any JSON-serializable value.
7
+ */
8
+ export type JSONValue = string | number | boolean | null | JSONValue[] | {
9
+ [key: string]: JSONValue;
10
+ };
11
+ /**
12
+ * Hints describing a tool's behavior. Advisory metadata read by the platform
13
+ * (not the model) to decide whether a call is safe to auto-execute or
14
+ * requires user confirmation.
15
+ *
16
+ * Field names mirror the MCP tool annotation shape
17
+ * (`McpServerToolAnnotations`) so worker tools flow through the same
18
+ * confirmation / auto-execute machinery as MCP tools.
19
+ *
20
+ * Only hints with active consumers in the Notion client are included.
21
+ */
22
+ export interface ToolHints {
23
+ /**
24
+ * The tool only reads state and has no side effects. Safe to call
25
+ * repeatedly; safe to auto-execute under default policy. Tools without
26
+ * this hint are treated as write tools and prompt for confirmation.
27
+ */
28
+ readOnlyHint?: boolean;
29
+ }
30
+ /**
31
+ * Configuration passed to {@link createTool}.
32
+ */
33
+ export interface ToolConfiguration<I extends JSONValue, O extends JSONValue = JSONValue> {
34
+ title: string;
35
+ description: string;
36
+ schema: SchemaBuilder<I>;
37
+ outputSchema?: SchemaBuilder<O>;
38
+ hints?: ToolHints;
39
+ execute: (input: I, context: CapabilityContext) => O | Promise<O>;
40
+ }
41
+ /**
42
+ * An error returned when the input to a tool doesn't match the input schema.
43
+ */
44
+ export declare class InvalidToolInputError extends Error {
45
+ constructor(message: string);
46
+ toJSON(): {
47
+ name: string;
48
+ message: string;
49
+ trace: string | undefined;
50
+ };
51
+ }
52
+ /**
53
+ * An error returned when the output from a tool doesn't match the output schema.
54
+ */
55
+ export declare class InvalidToolOutputError extends Error {
56
+ constructor(message: string);
57
+ toJSON(): {
58
+ name: string;
59
+ message: string;
60
+ trace: string | undefined;
61
+ };
62
+ }
63
+ /**
64
+ * An error returned when the tool execution fails.
65
+ */
66
+ export declare class ToolExecutionError extends Error {
67
+ constructor(message: string);
68
+ toJSON(): {
69
+ name: string;
70
+ message: string;
71
+ trace: string | undefined;
72
+ };
73
+ }
74
+ type ToolErrorResult = {
75
+ _tag: "error";
76
+ error: {
77
+ name: string;
78
+ message: string;
79
+ trace: string | undefined;
80
+ };
81
+ };
82
+ /**
83
+ * The manifest-visible configuration of a tool: the metadata from
84
+ * {@link ToolConfiguration} with the schema builders resolved to plain
85
+ * JSON Schemas.
86
+ */
87
+ export type ToolManifestConfig = {
88
+ title: string;
89
+ description: string;
90
+ schema: AnyJSONSchema;
91
+ outputSchema: AnyJSONSchema | undefined;
92
+ hints: ToolHints | undefined;
93
+ };
94
+ /**
95
+ * A tool capability as returned by {@link createTool}.
96
+ *
97
+ * Note that a tool carries no key of its own — the build tool derives the
98
+ * capability key from the file the tool is default-exported from.
99
+ */
100
+ export type Tool<I extends JSONValue = JSONValue, O extends JSONValue = JSONValue> = {
101
+ _tag: "tool";
102
+ config: ToolManifestConfig;
103
+ handler: (input: I, options?: HandlerOptions) => Promise<O | {
104
+ _tag: "success";
105
+ value: O;
106
+ } | ToolErrorResult>;
107
+ };
108
+ /**
109
+ * Create a tool capability for use by an agent.
110
+ *
111
+ * Default-export the result from a file directly under `src/tools/` —
112
+ * the file's basename becomes the tool's key.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * // src/tools/sayHello.ts
117
+ * import { j } from "@notionhq/workers/alpha/schema-builder";
118
+ * import { createTool } from "@notionhq/workers/alpha/tool";
119
+ *
120
+ * export default createTool({
121
+ * title: "Say Hello",
122
+ * description: "Say hello to the user",
123
+ * schema: j.object({ name: j.string() }),
124
+ * execute: ({ name }) => {
125
+ * return `Hello, ${name}!`;
126
+ * },
127
+ * });
128
+ * ```
129
+ */
130
+ export declare function createTool<I extends JSONValue, O extends JSONValue = JSONValue>(config: ToolConfiguration<I, O>): Tool<I, O>;
131
+ export {};
132
+ //# sourceMappingURL=tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/alpha/tool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,kBAAkB,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAA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EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,aAAa,GAAG,SAAS,CAAC;IACxC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EAAE,CAAC,SAAS,SAAS,GAAG,SAAS,IAAI;IACpF,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,CACR,KAAK,EAAE,CAAC,EACR,OAAO,CAAC,EAAE,cAAc,KACpB,OAAO,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,CAAC,CAAA;KAAE,GAAG,eAAe,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,GAAG,SAAS,EAC9E,MAAM,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC7B,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAoGZ"}
@@ -0,0 +1,156 @@
1
+ import { Ajv } from "ajv";
2
+ import addFormats from "ajv-formats";
3
+ import { createCapabilityContext } from "./context.js";
4
+ import { writeOutput } from "./output.js";
5
+ import { getSchema } from "./schema-builder.js";
6
+ function validateRequiredProperties(schema, path = "") {
7
+ if ("type" in schema && schema.type === "object" && "properties" in schema) {
8
+ const propKeys = Object.keys(schema.properties).sort();
9
+ const required = [...schema.required ?? []].sort();
10
+ const missing = propKeys.filter((k) => !required.includes(k));
11
+ if (missing.length > 0) {
12
+ throw new Error(
13
+ `Invalid schema${path ? ` at ${path}` : ""}: properties [${missing.join(", ")}] must be listed in "required". Both model providers require all properties to be required. Use anyOf with { type: "null" } for optional fields.`
14
+ );
15
+ }
16
+ for (const [key, propSchema] of Object.entries(schema.properties)) {
17
+ validateRequiredProperties(
18
+ propSchema,
19
+ path ? `${path}.properties.${key}` : `properties.${key}`
20
+ );
21
+ }
22
+ if ("$defs" in schema && schema.$defs) {
23
+ for (const [key, defSchema] of Object.entries(schema.$defs)) {
24
+ validateRequiredProperties(defSchema, path ? `${path}.$defs.${key}` : `$defs.${key}`);
25
+ }
26
+ }
27
+ }
28
+ if ("type" in schema && schema.type === "array" && "items" in schema) {
29
+ validateRequiredProperties(schema.items, path ? `${path}.items` : "items");
30
+ }
31
+ if ("anyOf" in schema && Array.isArray(schema.anyOf)) {
32
+ for (let i = 0; i < schema.anyOf.length; i++) {
33
+ validateRequiredProperties(
34
+ schema.anyOf[i],
35
+ path ? `${path}.anyOf[${i}]` : `anyOf[${i}]`
36
+ );
37
+ }
38
+ }
39
+ }
40
+ class InvalidToolInputError extends Error {
41
+ constructor(message) {
42
+ super(message);
43
+ this.name = "InvalidToolInputError";
44
+ }
45
+ toJSON() {
46
+ return {
47
+ name: this.name,
48
+ message: this.message,
49
+ trace: this.stack
50
+ };
51
+ }
52
+ }
53
+ class InvalidToolOutputError extends Error {
54
+ constructor(message) {
55
+ super(message);
56
+ this.name = "InvalidToolOutputError";
57
+ }
58
+ toJSON() {
59
+ return {
60
+ name: this.name,
61
+ message: this.message,
62
+ trace: this.stack
63
+ };
64
+ }
65
+ }
66
+ class ToolExecutionError extends Error {
67
+ constructor(message) {
68
+ super(message);
69
+ this.name = "ToolExecutionError";
70
+ }
71
+ toJSON() {
72
+ return {
73
+ name: this.name,
74
+ message: this.message,
75
+ trace: this.stack
76
+ };
77
+ }
78
+ }
79
+ function createTool(config) {
80
+ const inputSchema = getSchema(config.schema);
81
+ validateRequiredProperties(inputSchema);
82
+ const outputSchema = config.outputSchema ? getSchema(config.outputSchema) : void 0;
83
+ if (outputSchema) {
84
+ validateRequiredProperties(outputSchema);
85
+ }
86
+ const ajv = new Ajv();
87
+ addFormats(ajv);
88
+ const validateInput = ajv.compile(inputSchema);
89
+ const validateOutput = outputSchema ? ajv.compile(outputSchema) : null;
90
+ async function handler(input, options) {
91
+ if (!validateInput(input)) {
92
+ if (validateInput.errors == null) {
93
+ throw new Error("Unexpected: No validation errors after failed validation");
94
+ }
95
+ const error = new InvalidToolInputError(JSON.stringify(validateInput.errors, null, 2));
96
+ if (options?.concreteOutput) {
97
+ throw error;
98
+ }
99
+ const result = {
100
+ _tag: "error",
101
+ error: { name: error.name, message: error.message, trace: error.stack }
102
+ };
103
+ writeOutput(result);
104
+ return result;
105
+ }
106
+ try {
107
+ const capabilityContext = createCapabilityContext("tool");
108
+ const result = await config.execute(input, capabilityContext);
109
+ if (validateOutput && !validateOutput(result)) {
110
+ const error = new InvalidToolOutputError(JSON.stringify(validateOutput.errors, null, 2));
111
+ if (options?.concreteOutput) {
112
+ throw error;
113
+ }
114
+ const errorResult = {
115
+ _tag: "error",
116
+ error: { name: error.name, message: error.message, trace: error.stack }
117
+ };
118
+ writeOutput(errorResult);
119
+ return errorResult;
120
+ }
121
+ if (options?.concreteOutput) {
122
+ return result;
123
+ }
124
+ writeOutput({ _tag: "success", value: result });
125
+ return { _tag: "success", value: result };
126
+ } catch (err) {
127
+ const error = new ToolExecutionError(err instanceof Error ? err.message : String(err));
128
+ if (options?.concreteOutput) {
129
+ throw error;
130
+ }
131
+ const result = {
132
+ _tag: "error",
133
+ error: { name: error.name, message: error.message, trace: error.stack }
134
+ };
135
+ writeOutput(result);
136
+ return result;
137
+ }
138
+ }
139
+ return {
140
+ _tag: "tool",
141
+ config: {
142
+ title: config.title,
143
+ description: config.description,
144
+ schema: inputSchema,
145
+ outputSchema,
146
+ hints: config.hints
147
+ },
148
+ handler
149
+ };
150
+ }
151
+ export {
152
+ InvalidToolInputError,
153
+ InvalidToolOutputError,
154
+ ToolExecutionError,
155
+ createTool
156
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tool.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.test.d.ts","sourceRoot":"","sources":["../../src/alpha/tool.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,365 @@
1
+ /**
2
+ * Agent Trigger Types — Public API
3
+ *
4
+ * Shared type definitions for agent triggers between @notionhq/workers and the Notion repository.
5
+ * This file MUST be kept identical in both repositories.
6
+ *
7
+ * Conventions:
8
+ * - Protocols define the standard fields every consumer can rely on.
9
+ * - Vendor-specific fields use `x-<vendor>-` prefix (e.g., "x-slack-threadId").
10
+ * - Only public URLs — no internal URIs.
11
+ * - No `data` sub-object — vendor fields live at the top level with `x-<vendor>-`.
12
+ * - Types only — no runtime values.
13
+ * - All fields are required. Nullable fields use `T | null` (no `?:`) so they
14
+ * map directly to required + nullable in JSON Schema for LLM structured output.
15
+ * - Conversions must always provide explicit values (use `null` when absent).
16
+ */
17
+ /** Allows arbitrary vendor-specific fields prefixed with `x-<vendor>-`. */
18
+ export type VendorExtensions = {
19
+ [key: `x-${string}`]: unknown;
20
+ };
21
+ /** Has a human-readable message / summary. */
22
+ export type MessageLike = {
23
+ message: string;
24
+ };
25
+ /** Has an actor who performed the action. */
26
+ export type ActorLike = {
27
+ actor: Actor | null;
28
+ };
29
+ /** Has a navigable URL. */
30
+ export type LinkLike = {
31
+ url: string | null;
32
+ };
33
+ /** Has a timestamp. */
34
+ export type TimestampLike = {
35
+ /** ISO 8601 */
36
+ timestamp: string | null;
37
+ };
38
+ /** Has a conversation thread. */
39
+ export type ThreadLike<M = ThreadMessage> = {
40
+ thread: Array<M>;
41
+ /** Whether this event is a follow-up in a previously subscribed thread. */
42
+ isFollowUpMessage: boolean | null;
43
+ };
44
+ /**
45
+ * A chat message. Any chat platform (Slack, Discord, MS Teams, etc.) implements this.
46
+ * Composes MessageLike, ActorLike, LinkLike, TimestampLike.
47
+ */
48
+ export type ChatMessageLike = MessageLike & ActorLike & LinkLike & TimestampLike & {
49
+ id: string;
50
+ channelId: string;
51
+ channelName: string | null;
52
+ };
53
+ /** An email message. Any mail provider (Gmail, Outlook, etc.) implements this. */
54
+ export type EmailMessageLike = MessageLike & LinkLike & TimestampLike & {
55
+ id: string;
56
+ subject: string;
57
+ from: string;
58
+ fromName: string | null;
59
+ to: Array<string>;
60
+ cc: Array<string> | null;
61
+ bcc: Array<string> | null;
62
+ /** Plain-text or HTML body content. */
63
+ body: string;
64
+ isRead: boolean | null;
65
+ hasAttachments: boolean | null;
66
+ labels: Array<string> | null;
67
+ };
68
+ /** An email thread. Any mail provider implements this. */
69
+ export type EmailThreadLike = {
70
+ id: string;
71
+ subject: string;
72
+ participants: Array<string>;
73
+ messageCount: number;
74
+ /** ISO 8601 */
75
+ lastMessageAt: string;
76
+ hasUnread: boolean;
77
+ };
78
+ /** A calendar event. Any calendar provider (Google, Outlook, iCal, etc.) implements this. */
79
+ export type CalendarEventLike = LinkLike & TimestampLike & {
80
+ eventId: string;
81
+ summary: string;
82
+ description: string | null;
83
+ location: string | null;
84
+ /** ISO 8601 */
85
+ startTime: string;
86
+ /** ISO 8601 */
87
+ endTime: string | null;
88
+ isAllDay: boolean | null;
89
+ isRecurring: boolean | null;
90
+ attendees: Array<Actor> | null;
91
+ calendarId: string;
92
+ accountId: string;
93
+ };
94
+ /**
95
+ * An actor who performed an action.
96
+ *
97
+ * `id` / `displayName` / `email` are the Notion-resolved identity.
98
+ * `vendorActor` carries the identity in the originating system.
99
+ */
100
+ export type Actor = {
101
+ /** Notion user ID (when resolved). */
102
+ id: string | null;
103
+ displayName: string | null;
104
+ email: string | null;
105
+ /** The actor's identity in the vendor system. */
106
+ vendorActor: VendorActor | null;
107
+ };
108
+ /** Vendor-specific actor identity. */
109
+ export type VendorActor = {
110
+ /** Vendor name: "slack", "gmail", "discord", "notion", etc. */
111
+ vendor: string;
112
+ /** Vendor-specific ID. */
113
+ id: string;
114
+ displayName: string | null;
115
+ /** Handle / username (e.g., Slack @handle). */
116
+ handle: string | null;
117
+ /** "user", "bot", or a vendor-specific string. */
118
+ type: "user" | "bot" | string | null;
119
+ /** URL to the actor's profile in the vendor system. */
120
+ url: string | null;
121
+ };
122
+ /**
123
+ * A single message inside a thread.
124
+ * Implements MessageLike, ActorLike, LinkLike, TimestampLike.
125
+ * Vendor-specific fields use `x-<vendor>-` prefix.
126
+ */
127
+ export type ThreadMessage = MessageLike & ActorLike & LinkLike & TimestampLike & VendorExtensions & {
128
+ id: string;
129
+ };
130
+ /** A chat thread message. Extends ChatMessageLike with VendorExtensions. */
131
+ export type ChatThreadMessage = ChatMessageLike & VendorExtensions;
132
+ /** An email message in a trigger. Extends EmailMessageLike with VendorExtensions. */
133
+ export type EmailTriggerMessage = EmailMessageLike & VendorExtensions;
134
+ /**
135
+ * Every trigger event has at least these fields.
136
+ * `message` is a human-readable summary of what happened.
137
+ */
138
+ export type TriggerEventBase = MessageLike & ActorLike & VendorExtensions & {
139
+ type: string;
140
+ vendor: string;
141
+ };
142
+ /**
143
+ * Base shape for chat trigger events (Slack, Discord, MS Teams, etc.).
144
+ * Parameterized on the message type so each platform can narrow
145
+ * `triggerMessage` and `thread` to its vendor-specific message shape.
146
+ */
147
+ type ChatEventBase<M extends ChatThreadMessage = ChatThreadMessage> = TriggerEventBase & LinkLike & TimestampLike & ThreadLike<M> & {
148
+ /** The message that fired the trigger. */
149
+ triggerMessage: M;
150
+ channelId: string;
151
+ channelName: string | null;
152
+ threadId: string | null;
153
+ };
154
+ export type SlackChatThreadMessage = ChatThreadMessage & {
155
+ "x-slack-fileUrls": Array<string> | null;
156
+ /** URLs extracted from the message text. */
157
+ "x-slack-urls": Array<string> | null;
158
+ };
159
+ export type SlackMessageEvent = ChatEventBase<SlackChatThreadMessage> & {
160
+ type: "slack.message";
161
+ vendor: "slack";
162
+ };
163
+ export type SlackReactionAddedEvent = ChatEventBase<SlackChatThreadMessage> & {
164
+ type: "slack.reaction.added";
165
+ vendor: "slack";
166
+ /** The emoji name (without colons), e.g. "thumbsup". */
167
+ "x-slack-reaction": string | null;
168
+ };
169
+ export type SlackAppMentionEvent = ChatEventBase<SlackChatThreadMessage> & {
170
+ type: "slack.app.mention";
171
+ vendor: "slack";
172
+ };
173
+ /** Base shape for all mail trigger events. */
174
+ type MailEventBase = TriggerEventBase & LinkLike & TimestampLike & {
175
+ vendor: "notionmail" | "gmail" | string;
176
+ /** The triggering email. */
177
+ email: EmailTriggerMessage;
178
+ /** The email thread this message belongs to. */
179
+ emailThread: EmailThreadLike;
180
+ /** The email address of the mailbox owner. */
181
+ userEmail: string;
182
+ };
183
+ export type MailEmailReceivedEvent = MailEventBase & {
184
+ type: "mail.email.received";
185
+ };
186
+ export type MailEmailSentEvent = MailEventBase & {
187
+ type: "mail.email.sent";
188
+ };
189
+ export type MailLabelAppliedEvent = MailEventBase & {
190
+ type: "mail.label.applied";
191
+ /** The label that was applied. */
192
+ appliedLabel: string;
193
+ };
194
+ /** Base shape for all calendar trigger events. */
195
+ type CalendarEventBase = TriggerEventBase & CalendarEventLike & {
196
+ vendor: "notion-calendar" | "google" | string;
197
+ };
198
+ export type CalendarEventCreatedEvent = CalendarEventBase & {
199
+ type: "calendar.event.created";
200
+ };
201
+ export type CalendarEventUpdatedEvent = CalendarEventBase & {
202
+ type: "calendar.event.updated";
203
+ /** Which fields changed. */
204
+ updatedFields: Array<string> | null;
205
+ };
206
+ export type CalendarEventCanceledEvent = CalendarEventBase & {
207
+ type: "calendar.event.canceled";
208
+ };
209
+ export type DiscordChatThreadMessage = ChatThreadMessage & {
210
+ "x-discord-guildId": string | null;
211
+ };
212
+ export type DiscordInteractionEvent = ChatEventBase<DiscordChatThreadMessage> & {
213
+ type: "discord.interaction";
214
+ vendor: "discord";
215
+ "x-discord-guildId": string | null;
216
+ };
217
+ /** A property edit with before/after snapshots. */
218
+ export type NotionPageEdit = {
219
+ before: Record<string, unknown> | null;
220
+ after: Record<string, unknown> | null;
221
+ afterContent: string | null;
222
+ contentChanged: boolean | null;
223
+ timestamp: number;
224
+ editedBy: Actor | null;
225
+ };
226
+ export type NotionPageCreatedEvent = TriggerEventBase & LinkLike & TimestampLike & {
227
+ type: "notion.page.created";
228
+ vendor: "notion";
229
+ /** Page properties as key-value pairs. */
230
+ page: Record<string, unknown>;
231
+ /** Rendered markdown content of the page. */
232
+ content: string;
233
+ edits: Array<NotionPageEdit> | null;
234
+ };
235
+ export type NotionPageUpdatedEvent = TriggerEventBase & LinkLike & TimestampLike & {
236
+ type: "notion.page.updated";
237
+ vendor: "notion";
238
+ /** Chronological array of edits (accumulated during debounce). */
239
+ edits: Array<NotionPageEdit>;
240
+ };
241
+ export type NotionPageDeletedEvent = TriggerEventBase & LinkLike & TimestampLike & {
242
+ type: "notion.page.deleted";
243
+ vendor: "notion";
244
+ page: Record<string, unknown>;
245
+ content: string;
246
+ };
247
+ export type NotionMeetingNoteSummaryCompletedEvent = TriggerEventBase & LinkLike & TimestampLike & {
248
+ type: "notion.meetingNote.summary.completed";
249
+ vendor: "notion";
250
+ page: Record<string, unknown>;
251
+ content: string;
252
+ meetingNoteBlockId: string;
253
+ };
254
+ export type NotionCommentAddedEvent = TriggerEventBase & LinkLike & TimestampLike & {
255
+ type: "notion.page.discussion.comment.added";
256
+ vendor: "notion";
257
+ /** The full discussion context. */
258
+ discussion: {
259
+ id: string;
260
+ pageId: string;
261
+ resolved: boolean;
262
+ context: "inline" | "block" | "page" | "databaseProperty" | null;
263
+ parentBlockId: string | null;
264
+ propertyId: string | null;
265
+ propertyName: string | null;
266
+ };
267
+ /** The new comment. */
268
+ comment: {
269
+ id: string;
270
+ text: string;
271
+ url: string;
272
+ timestamp: string;
273
+ actor: Actor | null;
274
+ };
275
+ };
276
+ export type NotionAgentMentionedEvent = TriggerEventBase & LinkLike & TimestampLike & {
277
+ type: "notion.agent.mentioned";
278
+ vendor: "notion";
279
+ page: Record<string, unknown>;
280
+ content: string;
281
+ mentionLocation: "page_content" | "person_property";
282
+ mentionBlockContent: string | null;
283
+ propertyId: string | null;
284
+ propertyName: string | null;
285
+ };
286
+ export type NotionButtonPressedEvent = TriggerEventBase & LinkLike & TimestampLike & {
287
+ type: "notion.button.pressed";
288
+ vendor: "notion";
289
+ blockUrl: string;
290
+ };
291
+ export type NotionDatabaseAgentUpdatedEvent = TriggerEventBase & TimestampLike & {
292
+ type: "notion.database.agent.updated";
293
+ vendor: "notion";
294
+ agentId: string;
295
+ runtimeInstructions: string;
296
+ shouldRunOverDatabase: boolean;
297
+ viewId: string | null;
298
+ };
299
+ export type WebhookEvent = TriggerEventBase & TimestampLike & {
300
+ type: "webhooks.webhook";
301
+ vendor: "webhooks";
302
+ triggerId: string;
303
+ verificationSchema: string;
304
+ eventType: string | null;
305
+ deliveryId: string | null;
306
+ payload: unknown;
307
+ };
308
+ export type GoogleDriveOauthFilesChangedEvent = TriggerEventBase & TimestampLike & {
309
+ type: "googleDriveOauth.filesChanged";
310
+ vendor: "google-drive";
311
+ /** The page token from before this poll. */
312
+ changeToken: string;
313
+ /** The page token after this poll. */
314
+ newChangeToken: string;
315
+ /** Number of changes detected. */
316
+ changeCount: number;
317
+ /** The folder or drive being watched. */
318
+ scope: {
319
+ type: "folder";
320
+ folderId: string;
321
+ } | {
322
+ type: "drive";
323
+ driveId: string;
324
+ };
325
+ /** Upper time bound for this poll window (ISO 8601). */
326
+ lastEventTimestamp: string;
327
+ };
328
+ export type RecurrenceFrequency = "hour" | "day" | "week" | "month" | "year";
329
+ export type RecurrenceEvent = TriggerEventBase & TimestampLike & {
330
+ type: "recurrence";
331
+ vendor: "notion";
332
+ frequency: RecurrenceFrequency;
333
+ interval: number;
334
+ timezone: string;
335
+ };
336
+ /** Map from trigger type string to its event shape. Single source of truth. */
337
+ export type TriggerEventMap = {
338
+ "slack.message": SlackMessageEvent;
339
+ "slack.reaction.added": SlackReactionAddedEvent;
340
+ "slack.app.mention": SlackAppMentionEvent;
341
+ "discord.interaction": DiscordInteractionEvent;
342
+ "mail.email.received": MailEmailReceivedEvent;
343
+ "mail.email.sent": MailEmailSentEvent;
344
+ "mail.label.applied": MailLabelAppliedEvent;
345
+ "calendar.event.created": CalendarEventCreatedEvent;
346
+ "calendar.event.updated": CalendarEventUpdatedEvent;
347
+ "calendar.event.canceled": CalendarEventCanceledEvent;
348
+ "notion.page.created": NotionPageCreatedEvent;
349
+ "notion.page.updated": NotionPageUpdatedEvent;
350
+ "notion.page.deleted": NotionPageDeletedEvent;
351
+ "notion.meetingNote.summary.completed": NotionMeetingNoteSummaryCompletedEvent;
352
+ "notion.page.discussion.comment.added": NotionCommentAddedEvent;
353
+ "notion.agent.mentioned": NotionAgentMentionedEvent;
354
+ "notion.button.pressed": NotionButtonPressedEvent;
355
+ "notion.database.agent.updated": NotionDatabaseAgentUpdatedEvent;
356
+ "webhooks.webhook": WebhookEvent;
357
+ "googleDriveOauth.filesChanged": GoogleDriveOauthFilesChangedEvent;
358
+ recurrence: RecurrenceEvent;
359
+ };
360
+ /** All trigger type strings. Derived from TriggerEventMap. */
361
+ export type TriggerType = keyof TriggerEventMap;
362
+ /** Discriminated union of all trigger events. Derived from TriggerEventMap. */
363
+ export type TriggerEvent = TriggerEventMap[TriggerType];
364
+ export {};
365
+ //# sourceMappingURL=triggers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../src/alpha/triggers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,2EAA2E;AAC3E,MAAM,MAAM,gBAAgB,GAAG;IAC9B,CAAC,GAAG,EAAE,KAAK,MAAM,EAAE,GAAG,OAAO,CAAC;CAC9B,CAAC;AAMF,8CAA8C;AAC9C,MAAM,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,6CAA6C;AAC7C,MAAM,MAAM,SAAS,GAAG;IACvB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACpB,CAAC;AAEF,2BAA2B;AAC3B,MAAM,MAAM,QAAQ,GAAG;IACtB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACnB,CAAC;AAEF,uBAAuB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