@dainprotocol/service-sdk 2.0.76 → 2.0.77

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.
@@ -13,6 +13,10 @@ import { forwardTriggerToAutomationCore, type TriggerForwardingConfig, type Trig
13
13
  import { HITLHandler, routeActionToService, type HITLConfig, type HITLResult } from "./hitl";
14
14
  import { ActionableToolBaseSchema, ActionSchema, MetadataSchema, extendActionableSchema, buildActionableTool, validateActionableSchema, type ActionableToolInput, type Action, type AutomationMetadata } from "./actionable-tools";
15
15
  import { DirectAuthSetupManager, type DirectAuthAdapter, type OnboardingUI, type PendingSetup, type SetupCompletionResult } from "./direct-auth-setup";
16
+ /**
17
+ * Auto-detect runtime and use appropriate service implementation.
18
+ * Supports Node.js, Deno, and Cloudflare Workers.
19
+ */
16
20
  export declare const defineDAINService: (config: DAINServiceConfig) => DAINService;
17
21
  export { defineNodeService, defineDenoService, defineCloudflareService, createNextDainService, createTool, createService, createToolbox, CoreUtils, createOAuth2Tool, createAgent, ProcessHandler, RedisProcessStore, MemoryProcessStore, requireScope, hasScope, hasAllScopes, hasAnyScope, WebhookTriggerRegistry, createWebhookTriggerRegistry, createSimpleTrigger, createTypedTrigger, type WebhookTrigger, type WebhookTriggerDefinition, type WebhookProcessResult, SkillRegistry, createSkillRegistry, createGetSkillTool, type Skill, forwardTriggerToAutomationCore, type TriggerForwardingConfig, type TriggerForwardResult, HITLHandler, routeActionToService, type HITLConfig, type HITLResult, ActionableToolBaseSchema, ActionSchema, MetadataSchema, extendActionableSchema, buildActionableTool, validateActionableSchema, type ActionableToolInput, type Action, type AutomationMetadata, DirectAuthSetupManager, type DirectAuthAdapter, type OnboardingUI, type PendingSetup, type SetupCompletionResult, };
18
22
  export * from './types';
@@ -51,8 +51,21 @@ Object.defineProperty(exports, "buildActionableTool", { enumerable: true, get: f
51
51
  Object.defineProperty(exports, "validateActionableSchema", { enumerable: true, get: function () { return actionable_tools_1.validateActionableSchema; } });
52
52
  const direct_auth_setup_1 = require("./direct-auth-setup");
53
53
  Object.defineProperty(exports, "DirectAuthSetupManager", { enumerable: true, get: function () { return direct_auth_setup_1.DirectAuthSetupManager; } });
54
+ /**
55
+ * Auto-detect runtime and use appropriate service implementation.
56
+ * Supports Node.js, Deno, and Cloudflare Workers.
57
+ */
54
58
  const defineDAINService = (config) => {
55
- throw new Error("This is a fallback implementation. Use the appropriate runtime-specific import.");
59
+ // Detect Deno runtime
60
+ if (typeof globalThis.Deno !== 'undefined') {
61
+ return (0, denoService_1.defineDAINService)(config);
62
+ }
63
+ // Detect Node.js runtime (process.versions.node exists)
64
+ if (typeof process !== 'undefined' && process.versions?.node) {
65
+ return (0, nodeService_1.defineDAINService)(config);
66
+ }
67
+ // Default to Cloudflare Workers for other environments
68
+ return (0, cloudflareService_1.defineDAINService)(config);
56
69
  };
57
70
  exports.defineDAINService = defineDAINService;
58
71
  // Re-export all types
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":";AAAA,6BAA6B;;;;AAG7B,+CAAuE;AA0DrE,kGA1D4B,+BAAiB,OA0D5B;AAzDnB,+CAAuE;AA0DrE,kGA1D4B,+BAAiB,OA0D5B;AAzDnB,2DAAmF;AA0DjF,wGA1D4B,qCAAuB,OA0D5B;AAzDzB,+CAAsD;AA0DpD,sGA1DO,mCAAqB,OA0DP;AAzDvB,iCAA4G;AA0D1G,2FA1DO,iBAAU,OA0DP;AACV,8FA3DmB,oBAAa,OA2DnB;AACb,8FA5DkC,oBAAa,OA4DlC;AACb,0FA7DiD,gBAAS,OA6DjD;AACT,iGA9D4D,uBAAgB,OA8D5D;AAChB,4FA/D8E,kBAAW,OA+D9E;AA9Db,2CAAoF;AA+DlF,+FA/DO,0BAAc,OA+DP;AACd,kGAhEuB,6BAAiB,OAgEvB;AACjB,mGAjE0C,8BAAkB,OAiE1C;AAhEpB,qCAAwC;AAiEtC,6FAjEO,qBAAY,OAiEP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BAAiB,EAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,wDAAwD;IACxD,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC7D,OAAO,IAAA,+BAAiB,EAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,uDAAuD;IACvD,OAAO,IAAA,qCAAuB,EAAC,MAAM,CAAC,CAAC;AACzC,CAAC,CAAC;AAbW,QAAA,iBAAiB,qBAa5B;AA4DF,sBAAsB;AACtB,kDAAwB;AAExB,wDAA8B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dainprotocol/service-sdk",
3
- "version": "2.0.76",
3
+ "version": "2.0.77",
4
4
  "description": "DAIN Service SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -106,14 +106,6 @@
106
106
  ]
107
107
  }
108
108
  },
109
- "scripts": {
110
- "build": "tsc",
111
- "build:types": "tsc --emitDeclarationOnly",
112
- "test": "jest",
113
- "test:watch": "jest --watch",
114
- "prepublishOnly": "npm run build && npm run build:types",
115
- "test:streaming": "ts-node src/standalone-streaming-test.ts"
116
- },
117
109
  "keywords": [
118
110
  "dain",
119
111
  "sdk",
@@ -167,5 +159,12 @@
167
159
  "files": [
168
160
  "dist",
169
161
  "README.md"
170
- ]
171
- }
162
+ ],
163
+ "scripts": {
164
+ "build": "tsc",
165
+ "build:types": "tsc --emitDeclarationOnly",
166
+ "test": "jest",
167
+ "test:watch": "jest --watch",
168
+ "test:streaming": "ts-node src/standalone-streaming-test.ts"
169
+ }
170
+ }