skedyul 1.3.1 → 1.4.2

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.
@@ -970,6 +970,82 @@ export declare const ai: {
970
970
  */
971
971
  generateObject<S extends z.ZodTypeAny>(options: GenerateObjectOptions<S>): Promise<z.infer<S>>;
972
972
  };
973
+ export interface CallStartParams {
974
+ /** Communication channel (the Twilio number) this call belongs to */
975
+ communicationChannelId: string;
976
+ /** Caller number in E.164 */
977
+ fromNumber: string;
978
+ /** The dialed number (our Twilio number) in E.164 */
979
+ toNumber: string;
980
+ /** Number the call is forwarded/dialed to (the human agent leg) */
981
+ forwardedToNumber?: string | null;
982
+ direction?: 'INBOUND' | 'OUTBOUND';
983
+ /** Provider call id (Twilio CallSid) */
984
+ externalId?: string | null;
985
+ /** Raw provider status string (e.g. Twilio "ringing") */
986
+ externalStatus?: string | null;
987
+ /** Transcription provider/engine name (e.g. "deepgram", "google") */
988
+ transcriptionEngine?: string | null;
989
+ callerName?: string | null;
990
+ callerContactId?: string | null;
991
+ agentName?: string | null;
992
+ agentMemberId?: string | null;
993
+ }
994
+ export interface CallStartResult {
995
+ callSessionId: string;
996
+ threadId: string;
997
+ }
998
+ export interface CallAppendTranscriptParams {
999
+ callSessionId: string;
1000
+ /** Utterance text */
1001
+ content: string;
1002
+ track?: 'inbound_track' | 'outbound_track';
1003
+ speakerLabel?: string;
1004
+ confidence?: number;
1005
+ stability?: number;
1006
+ sequenceId?: number;
1007
+ isFinal?: boolean;
1008
+ externalId?: string | null;
1009
+ }
1010
+ export interface CallEndParams {
1011
+ callSessionId: string;
1012
+ status?: 'SCHEDULED' | 'RINGING' | 'IN_PROGRESS' | 'ON_HOLD' | 'ENDED' | 'MISSED' | 'DECLINED' | 'FAILED';
1013
+ externalStatus?: string | null;
1014
+ /** Call duration in seconds */
1015
+ duration?: number | null;
1016
+ endedAt?: string | null;
1017
+ recordingUrl?: string | null;
1018
+ recordingSid?: string | null;
1019
+ }
1020
+ export interface CallSummarizeResult {
1021
+ callSessionId: string;
1022
+ summary: string | null;
1023
+ }
1024
+ /**
1025
+ * Call client - manage a voice call session and its real-time transcript.
1026
+ *
1027
+ * Designed for the phone integration's Twilio Real-Time Transcription webhooks:
1028
+ * - `start` when the inbound call arrives (creates the CallSession + thread + CALL block)
1029
+ * - `appendTranscript` for each `transcription-content` event (stored as a tagged ThreadMessage)
1030
+ * - `end` on call completion / `transcription-stopped`
1031
+ * - `summarize` to generate and persist an end-of-call summary
1032
+ *
1033
+ * **Requires sk_wkp_ or sk_app_ token.**
1034
+ */
1035
+ export declare const call: {
1036
+ start(params: CallStartParams): Promise<CallStartResult>;
1037
+ appendTranscript(params: CallAppendTranscriptParams): Promise<{
1038
+ messageId: string;
1039
+ threadId: string;
1040
+ }>;
1041
+ end(params: CallEndParams): Promise<{
1042
+ callSessionId: string;
1043
+ threadId: string;
1044
+ }>;
1045
+ summarize(params: {
1046
+ callSessionId: string;
1047
+ }): Promise<CallSummarizeResult>;
1048
+ };
973
1049
  /**
974
1050
  * Parameters for report.generate().
975
1051
  */
@@ -3128,6 +3128,34 @@ var ai = {
3128
3128
  return data;
3129
3129
  }
3130
3130
  };
3131
+ var call = {
3132
+ async start(params) {
3133
+ const { data } = await callCore("call.start", {
3134
+ ...params
3135
+ });
3136
+ return data;
3137
+ },
3138
+ async appendTranscript(params) {
3139
+ const { data } = await callCore(
3140
+ "call.appendTranscript",
3141
+ { ...params }
3142
+ );
3143
+ return data;
3144
+ },
3145
+ async end(params) {
3146
+ const { data } = await callCore(
3147
+ "call.end",
3148
+ { ...params }
3149
+ );
3150
+ return data;
3151
+ },
3152
+ async summarize(params) {
3153
+ const { data } = await callCore("call.summarize", {
3154
+ ...params
3155
+ });
3156
+ return data;
3157
+ }
3158
+ };
3131
3159
  var report = {
3132
3160
  /**
3133
3161
  * Generate a report from a template.
@@ -4740,24 +4768,24 @@ async function handleMcpBatchRoute(req, ctx) {
4740
4768
  };
4741
4769
  }
4742
4770
  const perCallTimeoutMs = deadline ? Math.min(deadline, 25e3) : 25e3;
4743
- const executeWithTimeout = async (call, timeoutMs) => {
4771
+ const executeWithTimeout = async (call2, timeoutMs) => {
4744
4772
  return new Promise(async (resolve4) => {
4745
4773
  const timeoutHandle = setTimeout(() => {
4746
4774
  resolve4({
4747
- id: call.id,
4775
+ id: call2.id,
4748
4776
  success: false,
4749
4777
  error: "Timeout",
4750
4778
  timedOut: true
4751
4779
  });
4752
4780
  }, timeoutMs);
4753
4781
  try {
4754
- const toolName = call.name;
4755
- const toolArgs = call.arguments ?? {};
4782
+ const toolName = call2.name;
4783
+ const toolArgs = call2.arguments ?? {};
4756
4784
  const found = findToolInRegistry(ctx.registry, toolName);
4757
4785
  if (!found) {
4758
4786
  clearTimeout(timeoutHandle);
4759
4787
  resolve4({
4760
- id: call.id,
4788
+ id: call2.id,
4761
4789
  success: false,
4762
4790
  error: `Tool "${toolName}" not found`
4763
4791
  });
@@ -4775,13 +4803,13 @@ async function handleMcpBatchRoute(req, ctx) {
4775
4803
  const isFailure2 = "success" in toolResult && toolResult.success === false || "error" in toolResult && toolResult.error != null;
4776
4804
  if (isFailure2) {
4777
4805
  resolve4({
4778
- id: call.id,
4806
+ id: call2.id,
4779
4807
  success: false,
4780
4808
  error: "error" in toolResult && toolResult.error ? typeof toolResult.error === "string" ? toolResult.error : JSON.stringify(toolResult.error) : "Tool execution failed"
4781
4809
  });
4782
4810
  } else {
4783
4811
  resolve4({
4784
- id: call.id,
4812
+ id: call2.id,
4785
4813
  success: true,
4786
4814
  result: "output" in toolResult ? toolResult.output : toolResult
4787
4815
  });
@@ -4789,7 +4817,7 @@ async function handleMcpBatchRoute(req, ctx) {
4789
4817
  } catch (err) {
4790
4818
  clearTimeout(timeoutHandle);
4791
4819
  resolve4({
4792
- id: call.id,
4820
+ id: call2.id,
4793
4821
  success: false,
4794
4822
  error: err instanceof Error ? err.message : String(err)
4795
4823
  });
@@ -4797,7 +4825,7 @@ async function handleMcpBatchRoute(req, ctx) {
4797
4825
  });
4798
4826
  };
4799
4827
  const results = await Promise.all(
4800
- calls.map((call) => executeWithTimeout(call, perCallTimeoutMs))
4828
+ calls.map((call2) => executeWithTimeout(call2, perCallTimeoutMs))
4801
4829
  );
4802
4830
  return {
4803
4831
  status: 200,
@@ -7579,6 +7607,7 @@ export {
7579
7607
  ai,
7580
7608
  buildAgentContext,
7581
7609
  calculateWaitTime,
7610
+ call,
7582
7611
  communicationChannel,
7583
7612
  compileAgent,
7584
7613
  compileWorkflow,
package/dist/index.d.ts CHANGED
@@ -6,8 +6,8 @@ export { DEFAULT_DOCKERFILE } from './dockerfile';
6
6
  export { InstallError, MissingRequiredFieldError, AuthenticationError, InvalidConfigurationError, ConnectionError, AppAuthInvalidError, } from './errors';
7
7
  export type { InstallErrorCode } from './errors';
8
8
  export { z };
9
- export { workplace, communicationChannel, instance, token, file, webhook, cron, event, resource, ai, report, configure, getConfig, runWithConfig, createInstanceClient, } from './core/client';
10
- export type { InstanceClient, InstanceContext, InstanceData, InstanceMeta, InstancePagination, InstanceListResult, InstanceListArgs, FileInfo, FileUrlResponse, FileUploadParams, FileUploadResult, WebhookCreateResult, WebhookListItem, WebhookDeleteByNameOptions, WebhookListOptions, CronSubscribeParams, CronSubscribeResult, CronSubscriptionItem, CronListOptions, EventCreateResult, EventCreateOptions, ResourceLinkParams, ResourceLinkResult, AITextContent, AIFileContent, AIImageContent, AIMessageContent, AIMessage, GenerateObjectOptions, GenerateObjectResult, ReportGenerateParams, ReportGenerateResult, ReportDefineParams, ReportDefineResult, ReportListParams, ReportListItem, ReportListResult, ReportDefinition, } from './core/client';
9
+ export { workplace, communicationChannel, instance, token, file, webhook, cron, event, resource, ai, call, report, configure, getConfig, runWithConfig, createInstanceClient, } from './core/client';
10
+ export type { InstanceClient, InstanceContext, InstanceData, InstanceMeta, InstancePagination, InstanceListResult, InstanceListArgs, FileInfo, FileUrlResponse, FileUploadParams, FileUploadResult, WebhookCreateResult, WebhookListItem, WebhookDeleteByNameOptions, WebhookListOptions, CallStartParams, CallStartResult, CallAppendTranscriptParams, CallEndParams, CallSummarizeResult, CronSubscribeParams, CronSubscribeResult, CronSubscriptionItem, CronListOptions, EventCreateResult, EventCreateOptions, ResourceLinkParams, ResourceLinkResult, AITextContent, AIFileContent, AIImageContent, AIMessageContent, AIMessage, GenerateObjectOptions, GenerateObjectResult, ReportGenerateParams, ReportGenerateResult, ReportDefineParams, ReportDefineResult, ReportListParams, ReportListItem, ReportListResult, ReportDefinition, } from './core/client';
11
11
  export { createContextLogger } from './server/logger';
12
12
  export type { ContextLogger } from './server/logger';
13
13
  declare const _default: {
package/dist/index.js CHANGED
@@ -241,6 +241,7 @@ __export(index_exports, {
241
241
  ai: () => ai,
242
242
  buildAgentContext: () => buildAgentContext,
243
243
  calculateWaitTime: () => calculateWaitTime,
244
+ call: () => call,
244
245
  communicationChannel: () => communicationChannel,
245
246
  compileAgent: () => compileAgent,
246
247
  compileWorkflow: () => compileWorkflow,
@@ -3453,6 +3454,34 @@ var ai = {
3453
3454
  return data;
3454
3455
  }
3455
3456
  };
3457
+ var call = {
3458
+ async start(params) {
3459
+ const { data } = await callCore("call.start", {
3460
+ ...params
3461
+ });
3462
+ return data;
3463
+ },
3464
+ async appendTranscript(params) {
3465
+ const { data } = await callCore(
3466
+ "call.appendTranscript",
3467
+ { ...params }
3468
+ );
3469
+ return data;
3470
+ },
3471
+ async end(params) {
3472
+ const { data } = await callCore(
3473
+ "call.end",
3474
+ { ...params }
3475
+ );
3476
+ return data;
3477
+ },
3478
+ async summarize(params) {
3479
+ const { data } = await callCore("call.summarize", {
3480
+ ...params
3481
+ });
3482
+ return data;
3483
+ }
3484
+ };
3456
3485
  var report = {
3457
3486
  /**
3458
3487
  * Generate a report from a template.
@@ -5065,24 +5094,24 @@ async function handleMcpBatchRoute(req, ctx) {
5065
5094
  };
5066
5095
  }
5067
5096
  const perCallTimeoutMs = deadline ? Math.min(deadline, 25e3) : 25e3;
5068
- const executeWithTimeout = async (call, timeoutMs) => {
5097
+ const executeWithTimeout = async (call2, timeoutMs) => {
5069
5098
  return new Promise(async (resolve4) => {
5070
5099
  const timeoutHandle = setTimeout(() => {
5071
5100
  resolve4({
5072
- id: call.id,
5101
+ id: call2.id,
5073
5102
  success: false,
5074
5103
  error: "Timeout",
5075
5104
  timedOut: true
5076
5105
  });
5077
5106
  }, timeoutMs);
5078
5107
  try {
5079
- const toolName = call.name;
5080
- const toolArgs = call.arguments ?? {};
5108
+ const toolName = call2.name;
5109
+ const toolArgs = call2.arguments ?? {};
5081
5110
  const found = findToolInRegistry(ctx.registry, toolName);
5082
5111
  if (!found) {
5083
5112
  clearTimeout(timeoutHandle);
5084
5113
  resolve4({
5085
- id: call.id,
5114
+ id: call2.id,
5086
5115
  success: false,
5087
5116
  error: `Tool "${toolName}" not found`
5088
5117
  });
@@ -5100,13 +5129,13 @@ async function handleMcpBatchRoute(req, ctx) {
5100
5129
  const isFailure2 = "success" in toolResult && toolResult.success === false || "error" in toolResult && toolResult.error != null;
5101
5130
  if (isFailure2) {
5102
5131
  resolve4({
5103
- id: call.id,
5132
+ id: call2.id,
5104
5133
  success: false,
5105
5134
  error: "error" in toolResult && toolResult.error ? typeof toolResult.error === "string" ? toolResult.error : JSON.stringify(toolResult.error) : "Tool execution failed"
5106
5135
  });
5107
5136
  } else {
5108
5137
  resolve4({
5109
- id: call.id,
5138
+ id: call2.id,
5110
5139
  success: true,
5111
5140
  result: "output" in toolResult ? toolResult.output : toolResult
5112
5141
  });
@@ -5114,7 +5143,7 @@ async function handleMcpBatchRoute(req, ctx) {
5114
5143
  } catch (err) {
5115
5144
  clearTimeout(timeoutHandle);
5116
5145
  resolve4({
5117
- id: call.id,
5146
+ id: call2.id,
5118
5147
  success: false,
5119
5148
  error: err instanceof Error ? err.message : String(err)
5120
5149
  });
@@ -5122,7 +5151,7 @@ async function handleMcpBatchRoute(req, ctx) {
5122
5151
  });
5123
5152
  };
5124
5153
  const results = await Promise.all(
5125
- calls.map((call) => executeWithTimeout(call, perCallTimeoutMs))
5154
+ calls.map((call2) => executeWithTimeout(call2, perCallTimeoutMs))
5126
5155
  );
5127
5156
  return {
5128
5157
  status: 200,
@@ -7905,6 +7934,7 @@ var index_default = { z: import_v413.z };
7905
7934
  ai,
7906
7935
  buildAgentContext,
7907
7936
  calculateWaitTime,
7937
+ call,
7908
7938
  communicationChannel,
7909
7939
  compileAgent,
7910
7940
  compileWorkflow,
@@ -251,10 +251,10 @@ export type WorkflowMetadata = z.infer<typeof WorkflowMetadataSchema>;
251
251
  * Workflow execution status
252
252
  */
253
253
  export declare const WorkflowExecutionStatusSchema: z.ZodEnum<{
254
+ FAILED: "FAILED";
254
255
  PENDING: "PENDING";
255
256
  RUNNING: "RUNNING";
256
257
  COMPLETED: "COMPLETED";
257
- FAILED: "FAILED";
258
258
  CANCELLED: "CANCELLED";
259
259
  WAITING: "WAITING";
260
260
  }>;
@@ -264,10 +264,10 @@ export type WorkflowExecutionStatus = z.infer<typeof WorkflowExecutionStatusSche
264
264
  */
265
265
  export declare const WorkflowExecutionResultSchema: z.ZodObject<{
266
266
  status: z.ZodEnum<{
267
+ FAILED: "FAILED";
267
268
  PENDING: "PENDING";
268
269
  RUNNING: "RUNNING";
269
270
  COMPLETED: "COMPLETED";
270
- FAILED: "FAILED";
271
271
  CANCELLED: "CANCELLED";
272
272
  WAITING: "WAITING";
273
273
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "1.3.1",
3
+ "version": "1.4.2",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",