skedyul 0.2.148 → 0.2.149

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/.build-stamp CHANGED
@@ -1 +1 @@
1
- 1770684891920
1
+ 1770690573798
package/dist/errors.d.ts CHANGED
@@ -75,3 +75,26 @@ export declare class InvalidConfigurationError extends InstallError {
75
75
  export declare class ConnectionError extends InstallError {
76
76
  constructor(message?: string);
77
77
  }
78
+ /**
79
+ * Error thrown when app authentication/authorization is invalid and needs re-validation.
80
+ *
81
+ * Any app integration can throw this error to signal that the installation's
82
+ * auth status should be set to INVALID, triggering re-authorization flow.
83
+ *
84
+ * The error code 'APP_AUTH_INVALID' is used by the workflow to detect and handle
85
+ * this error generically, regardless of which app throws it.
86
+ *
87
+ * The redirect URL is constructed by the workflow after catching this error,
88
+ * so apps don't need to provide it.
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * if (tokenExpired) {
93
+ * throw new AppAuthInvalidError('Access token has expired. Please re-authorize the app.')
94
+ * }
95
+ * ```
96
+ */
97
+ export declare class AppAuthInvalidError extends Error {
98
+ readonly code = "APP_AUTH_INVALID";
99
+ constructor(message: string);
100
+ }
package/dist/errors.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * that the frontend can display inline on the install form.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ConnectionError = exports.InvalidConfigurationError = exports.AuthenticationError = exports.MissingRequiredFieldError = exports.InstallError = void 0;
10
+ exports.AppAuthInvalidError = exports.ConnectionError = exports.InvalidConfigurationError = exports.AuthenticationError = exports.MissingRequiredFieldError = exports.InstallError = void 0;
11
11
  /**
12
12
  * Base error class for install handler errors.
13
13
  *
@@ -97,3 +97,30 @@ class ConnectionError extends InstallError {
97
97
  }
98
98
  }
99
99
  exports.ConnectionError = ConnectionError;
100
+ /**
101
+ * Error thrown when app authentication/authorization is invalid and needs re-validation.
102
+ *
103
+ * Any app integration can throw this error to signal that the installation's
104
+ * auth status should be set to INVALID, triggering re-authorization flow.
105
+ *
106
+ * The error code 'APP_AUTH_INVALID' is used by the workflow to detect and handle
107
+ * this error generically, regardless of which app throws it.
108
+ *
109
+ * The redirect URL is constructed by the workflow after catching this error,
110
+ * so apps don't need to provide it.
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * if (tokenExpired) {
115
+ * throw new AppAuthInvalidError('Access token has expired. Please re-authorize the app.')
116
+ * }
117
+ * ```
118
+ */
119
+ class AppAuthInvalidError extends Error {
120
+ constructor(message) {
121
+ super(message);
122
+ this.code = 'APP_AUTH_INVALID';
123
+ this.name = 'AppAuthInvalidError';
124
+ }
125
+ }
126
+ exports.AppAuthInvalidError = AppAuthInvalidError;
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { ToolResponseMetaSchema } from './types';
4
4
  export * from './schemas';
5
5
  export { server } from './server';
6
6
  export { DEFAULT_DOCKERFILE } from './dockerfile';
7
- export { InstallError, MissingRequiredFieldError, AuthenticationError, InvalidConfigurationError, ConnectionError, } from './errors';
7
+ export { InstallError, MissingRequiredFieldError, AuthenticationError, InvalidConfigurationError, ConnectionError, AppAuthInvalidError, } from './errors';
8
8
  export type { InstallErrorCode } from './errors';
9
9
  export { z };
10
10
  export { workplace, communicationChannel, instance, token, file, webhook, resource, contactAssociationLink, configure, getConfig, runWithConfig, } from './core/client';
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.getRequiredInstallEnvKeys = exports.getAllEnvKeys = exports.CONFIG_FILE_NAMES = exports.validateConfig = exports.loadConfig = exports.defineConfig = exports.runWithConfig = exports.getConfig = exports.configure = exports.contactAssociationLink = exports.resource = exports.webhook = exports.file = exports.token = exports.instance = exports.communicationChannel = exports.workplace = exports.z = exports.ConnectionError = exports.InvalidConfigurationError = exports.AuthenticationError = exports.MissingRequiredFieldError = exports.InstallError = exports.DEFAULT_DOCKERFILE = exports.server = exports.ToolResponseMetaSchema = void 0;
17
+ exports.getRequiredInstallEnvKeys = exports.getAllEnvKeys = exports.CONFIG_FILE_NAMES = exports.validateConfig = exports.loadConfig = exports.defineConfig = exports.runWithConfig = exports.getConfig = exports.configure = exports.contactAssociationLink = exports.resource = exports.webhook = exports.file = exports.token = exports.instance = exports.communicationChannel = exports.workplace = exports.z = exports.AppAuthInvalidError = exports.ConnectionError = exports.InvalidConfigurationError = exports.AuthenticationError = exports.MissingRequiredFieldError = exports.InstallError = exports.DEFAULT_DOCKERFILE = exports.server = exports.ToolResponseMetaSchema = void 0;
18
18
  const zod_1 = require("zod");
19
19
  Object.defineProperty(exports, "z", { enumerable: true, get: function () { return zod_1.z; } });
20
20
  __exportStar(require("./types"), exports);
@@ -32,6 +32,7 @@ Object.defineProperty(exports, "MissingRequiredFieldError", { enumerable: true,
32
32
  Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return errors_1.AuthenticationError; } });
33
33
  Object.defineProperty(exports, "InvalidConfigurationError", { enumerable: true, get: function () { return errors_1.InvalidConfigurationError; } });
34
34
  Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return errors_1.ConnectionError; } });
35
+ Object.defineProperty(exports, "AppAuthInvalidError", { enumerable: true, get: function () { return errors_1.AppAuthInvalidError; } });
35
36
  var client_1 = require("./core/client");
36
37
  Object.defineProperty(exports, "workplace", { enumerable: true, get: function () { return client_1.workplace; } });
37
38
  Object.defineProperty(exports, "communicationChannel", { enumerable: true, get: function () { return client_1.communicationChannel; } });
package/dist/server.js CHANGED
@@ -403,6 +403,24 @@ function createCallToolHandler(registry, state, onMaxRequests) {
403
403
  };
404
404
  }
405
405
  catch (error) {
406
+ // Check if it's an AppAuthInvalidError
407
+ if (error instanceof errors_1.AppAuthInvalidError) {
408
+ return {
409
+ output: null,
410
+ billing: { credits: 0 },
411
+ meta: {
412
+ success: false,
413
+ message: error.message,
414
+ toolName,
415
+ },
416
+ error: {
417
+ code: error.code,
418
+ message: error.message,
419
+ },
420
+ // Note: redirect URL will be added by workflow after detecting APP_AUTH_INVALID
421
+ };
422
+ }
423
+ // Generic error handling for other errors
406
424
  const errorMessage = error instanceof Error ? error.message : String(error ?? '');
407
425
  return {
408
426
  output: null,
@@ -412,7 +430,10 @@ function createCallToolHandler(registry, state, onMaxRequests) {
412
430
  message: errorMessage,
413
431
  toolName,
414
432
  },
415
- error: errorMessage,
433
+ error: {
434
+ code: 'TOOL_EXECUTION_ERROR',
435
+ message: errorMessage,
436
+ },
416
437
  };
417
438
  }
418
439
  finally {
package/dist/types.d.ts CHANGED
@@ -104,6 +104,14 @@ export interface ToolEffect {
104
104
  /** URL to navigate to after the tool completes */
105
105
  redirect?: string;
106
106
  }
107
+ /**
108
+ * Structured error information for tool execution results.
109
+ * Uses codes for serialization and workflow detection.
110
+ */
111
+ export interface ToolError {
112
+ code: string;
113
+ message: string;
114
+ }
107
115
  export interface ToolExecutionResult<Output = unknown> {
108
116
  /** Tool-specific output data. Null on error. */
109
117
  output: Output | null;
@@ -113,6 +121,8 @@ export interface ToolExecutionResult<Output = unknown> {
113
121
  meta: ToolResponseMeta;
114
122
  /** Optional client-side effects to execute */
115
123
  effect?: ToolEffect;
124
+ /** Structured error information (null/undefined if no error) */
125
+ error?: ToolError | null;
116
126
  }
117
127
  export interface ToolSchemaWithJson<Schema extends z.ZodTypeAny = z.ZodTypeAny> {
118
128
  zod: Schema;
@@ -300,7 +310,7 @@ export interface ToolCallResponse {
300
310
  output: unknown | null;
301
311
  billing: BillingInfo;
302
312
  meta: ToolResponseMeta;
303
- error?: string;
313
+ error?: ToolError | null;
304
314
  effect?: ToolEffect;
305
315
  }
306
316
  export interface DedicatedServerInstance {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "0.2.148",
3
+ "version": "0.2.149",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",