@daf-sdk/runtime 1.0.0 → 1.0.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.
- package/dist/{chunk-HT5X5ZSB.mjs → chunk-OV7BGP6V.mjs} +104 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +104 -2
- package/dist/index.mjs +1 -1
- package/dist/runtime/index.d.mts +9 -2
- package/dist/runtime/index.d.ts +9 -2
- package/dist/runtime/index.js +104 -2
- package/dist/runtime/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -281,6 +281,26 @@ Web search powered by Tavily's AI search API. Returns pre-extracted clean conten
|
|
|
281
281
|
- \`includeAnswer\` (boolean, optional): Include a short AI-generated answer at the top (default: false)
|
|
282
282
|
|
|
283
283
|
**Note:** Use \`searchDepth: "basic"\` for speed; \`"advanced"\` for more comprehensive results.`,
|
|
284
|
+
DESC_CHECK_DOMAIN: `**Check Domain Availability**
|
|
285
|
+
|
|
286
|
+
**JSON Format:**
|
|
287
|
+
"{
|
|
288
|
+
"type": "action",
|
|
289
|
+
"variant": "checkDomain",
|
|
290
|
+
"parameters": {
|
|
291
|
+
"domains": ["example.com", "example.io"]
|
|
292
|
+
}
|
|
293
|
+
}"
|
|
294
|
+
|
|
295
|
+
*(Quotation marks added to escape execution - this is documentation only)*
|
|
296
|
+
|
|
297
|
+
**Description:**
|
|
298
|
+
Checks whether domain names are registered or available, using the RDAP registry protocol (with DNS as fallback). No API key required. Use this instead of web search whenever the user asks if a domain is taken or can be registered.
|
|
299
|
+
|
|
300
|
+
**Parameters:**
|
|
301
|
+
- \`domains\` (string[], required): One or more domain names to check (max 25 per call). Bare domains like \`"gadgetai.com"\` \u2014 no protocol or path.
|
|
302
|
+
|
|
303
|
+
**Result:** Per-domain status: \`available\`, \`registered\` (with registrar when known), or \`unknown\`.`,
|
|
284
304
|
DESC_READ_DOCUMENT: `**Read Document**
|
|
285
305
|
|
|
286
306
|
**JSON Format:**
|
|
@@ -1448,6 +1468,10 @@ $DESC_TAVILY_SEARCH
|
|
|
1448
1468
|
|
|
1449
1469
|
---
|
|
1450
1470
|
|
|
1471
|
+
$DESC_CHECK_DOMAIN
|
|
1472
|
+
|
|
1473
|
+
---
|
|
1474
|
+
|
|
1451
1475
|
$DESC_READ_DOCUMENT
|
|
1452
1476
|
|
|
1453
1477
|
---
|
|
@@ -2109,7 +2133,6 @@ function extractActionsFromMessage(message) {
|
|
|
2109
2133
|
const actions = [];
|
|
2110
2134
|
console.log("[extractActionsFromMessage] Received message length:", message.length);
|
|
2111
2135
|
console.log("[extractActionsFromMessage] First 200 chars:", message.substring(0, 200));
|
|
2112
|
-
const jsonRegex = /\{[^{}]*"type"\s*:\s*"(scrape|search|previewSearch|tavilySearch|crawl|sendEmail|readDocument|writeDocument|formatDocument|removeDocument|addDocument|dbFind|dbInsert|dbUpdate|dbDelete)"[^{}]*(?:\{[^{}]*\}[^{}]*)*\}/g;
|
|
2113
2136
|
let braceLevel = 0;
|
|
2114
2137
|
let currentJson = "";
|
|
2115
2138
|
let inString = false;
|
|
@@ -2214,6 +2237,8 @@ function isValidAction(obj) {
|
|
|
2214
2237
|
return isValidQuickSearchAction(obj);
|
|
2215
2238
|
case "tavilySearch":
|
|
2216
2239
|
return isValidTavilySearchAction(obj);
|
|
2240
|
+
case "checkDomain":
|
|
2241
|
+
return isValidCheckDomainAction(obj);
|
|
2217
2242
|
case "newsSearch":
|
|
2218
2243
|
return isValidNewsSearchAction(obj);
|
|
2219
2244
|
case "readDocument":
|
|
@@ -2314,6 +2339,9 @@ function isValidTavilySearchAction(obj) {
|
|
|
2314
2339
|
if (includeAnswer !== void 0 && typeof includeAnswer !== "boolean") return false;
|
|
2315
2340
|
return true;
|
|
2316
2341
|
}
|
|
2342
|
+
function isValidCheckDomainAction(obj) {
|
|
2343
|
+
return obj.type === "action" && obj.variant === "checkDomain" && obj.parameters && Array.isArray(obj.parameters.domains) && obj.parameters.domains.length > 0 && obj.parameters.domains.every((d) => typeof d === "string" && d.trim().length > 0);
|
|
2344
|
+
}
|
|
2317
2345
|
function isValidNewsSearchAction(obj) {
|
|
2318
2346
|
if (!obj.parameters) return false;
|
|
2319
2347
|
const { query, limit, ignoreInvalidURLs, scrapeOptions } = obj.parameters;
|
|
@@ -2499,6 +2527,8 @@ async function executeAction(action, userId, adapter, processId, parentProcessId
|
|
|
2499
2527
|
return await executeQuickSearchAction(action, userId);
|
|
2500
2528
|
case "tavilySearch":
|
|
2501
2529
|
return await executeTavilySearchAction(action, userId);
|
|
2530
|
+
case "checkDomain":
|
|
2531
|
+
return await executeCheckDomainAction(action);
|
|
2502
2532
|
case "newsSearch":
|
|
2503
2533
|
return await executeNewsSearchAction(action, userId);
|
|
2504
2534
|
case "readDocument":
|
|
@@ -3374,6 +3404,78 @@ Answer: ${data.answer}`;
|
|
|
3374
3404
|
};
|
|
3375
3405
|
}
|
|
3376
3406
|
}
|
|
3407
|
+
async function executeCheckDomainAction(action) {
|
|
3408
|
+
const normalize = (d) => d.trim().toLowerCase().replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/^www\./, "");
|
|
3409
|
+
async function checkOne(rawDomain) {
|
|
3410
|
+
const domain = normalize(rawDomain);
|
|
3411
|
+
if (!/^[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(domain)) {
|
|
3412
|
+
return { domain, available: null, status: "invalid", detail: "Not a valid domain name" };
|
|
3413
|
+
}
|
|
3414
|
+
try {
|
|
3415
|
+
const controller = new AbortController();
|
|
3416
|
+
const timeout = setTimeout(() => controller.abort(), 8e3);
|
|
3417
|
+
const res = await fetch(`https://rdap.org/domain/${encodeURIComponent(domain)}`, {
|
|
3418
|
+
signal: controller.signal,
|
|
3419
|
+
headers: { Accept: "application/rdap+json" },
|
|
3420
|
+
redirect: "follow"
|
|
3421
|
+
});
|
|
3422
|
+
clearTimeout(timeout);
|
|
3423
|
+
if (res.status === 404) {
|
|
3424
|
+
return { domain, available: true, status: "available", detail: "No registration found (RDAP)" };
|
|
3425
|
+
}
|
|
3426
|
+
if (res.ok) {
|
|
3427
|
+
let registrar;
|
|
3428
|
+
try {
|
|
3429
|
+
const data = await res.json();
|
|
3430
|
+
const registrarEntity = (data.entities || []).find((e) => (e.roles || []).includes("registrar"));
|
|
3431
|
+
registrar = registrarEntity?.vcardArray?.[1]?.find((v) => v[0] === "fn")?.[3];
|
|
3432
|
+
} catch {
|
|
3433
|
+
}
|
|
3434
|
+
return {
|
|
3435
|
+
domain,
|
|
3436
|
+
available: false,
|
|
3437
|
+
status: "registered",
|
|
3438
|
+
detail: registrar ? `Registered via ${registrar}` : "Registered (RDAP)"
|
|
3439
|
+
};
|
|
3440
|
+
}
|
|
3441
|
+
} catch {
|
|
3442
|
+
}
|
|
3443
|
+
try {
|
|
3444
|
+
const dns = await import("dns");
|
|
3445
|
+
await dns.promises.resolve(domain, "NS");
|
|
3446
|
+
return { domain, available: false, status: "registered", detail: "Has DNS records (NS)" };
|
|
3447
|
+
} catch (err) {
|
|
3448
|
+
if (err?.code === "ENOTFOUND" || err?.code === "NXDOMAIN" || err?.code === "ENODATA") {
|
|
3449
|
+
return { domain, available: true, status: "probably-available", detail: "No DNS records found (RDAP was unavailable, so verify with a registrar)" };
|
|
3450
|
+
}
|
|
3451
|
+
return { domain, available: null, status: "unknown", detail: "Could not determine availability" };
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
try {
|
|
3455
|
+
const domains = action.parameters.domains.slice(0, 25);
|
|
3456
|
+
console.log(`[Check Domain Action] Checking ${domains.length} domain(s)`);
|
|
3457
|
+
const results = await Promise.all(domains.map(checkOne));
|
|
3458
|
+
const available = results.filter((r) => r.available === true).map((r) => r.domain);
|
|
3459
|
+
const taken = results.filter((r) => r.available === false).map((r) => r.domain);
|
|
3460
|
+
const unknown = results.filter((r) => r.available === null).map((r) => r.domain);
|
|
3461
|
+
let message = `Domain availability check (${results.length} domain${results.length === 1 ? "" : "s"}):`;
|
|
3462
|
+
for (const r of results) {
|
|
3463
|
+
const icon = r.available === true ? "AVAILABLE" : r.available === false ? "TAKEN" : "UNKNOWN";
|
|
3464
|
+
message += `
|
|
3465
|
+
- ${r.domain}: ${icon} \u2014 ${r.detail}`;
|
|
3466
|
+
}
|
|
3467
|
+
return {
|
|
3468
|
+
success: true,
|
|
3469
|
+
message,
|
|
3470
|
+
data: { results, summary: { available, taken, unknown } }
|
|
3471
|
+
};
|
|
3472
|
+
} catch (error) {
|
|
3473
|
+
return {
|
|
3474
|
+
success: false,
|
|
3475
|
+
error: error instanceof Error ? error.message : "Domain check failed"
|
|
3476
|
+
};
|
|
3477
|
+
}
|
|
3478
|
+
}
|
|
3377
3479
|
async function getAccessibleResources(processId, userId, adapter, parentProcessIds = []) {
|
|
3378
3480
|
try {
|
|
3379
3481
|
const allProcessIds = [processId, ...parentProcessIds];
|
|
@@ -5281,7 +5383,7 @@ async function processMessageActions(message, userId, adapter, processId, parent
|
|
|
5281
5383
|
}
|
|
5282
5384
|
|
|
5283
5385
|
// src/runtime/executor.ts
|
|
5284
|
-
var MAX_STEPS_EXECUTED =
|
|
5386
|
+
var MAX_STEPS_EXECUTED = 300;
|
|
5285
5387
|
var PauseSignal = class {
|
|
5286
5388
|
constructor(remaining, question) {
|
|
5287
5389
|
this.remainingSteps = remaining;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ACTION_TYPES, ActionVariant, AddDocumentParams, AddFolderParams, CreateDatabaseParams, DAFAction, DAFDocument, DAFDocumentBuilder, DAFEditorAction, DAFProcess, DAFResource, DAFStep, DAF_VERSION, DEFAULT_SCRAPE_TIMEOUT, DEFAULT_SEARCH_LIMIT, DeleteDatabaseParams, DirectiveParams, DuplicateDatabaseParams, DuplicateDocumentParams, EDITOR_ACTION_TYPES, EditorActionBaseParams, EditorActionVariant, FormatDocumentParams, LOOP_TYPES, LoopType, MAX_PROCESS_DEPTH, NewsSearchParams, PROCESS_TYPES, PreviewSearchParams, ProcessBuilder, ProcessType, RESOURCE_TYPES, ReadDatabaseParams, ReadDocumentParams, ReadFolderParams, RemoveDocumentParams, RemoveFolderParams, RenameDocumentParams, RenameFolderParams, ResourceType, STEP_TYPES, SUPPORTED_VERSIONS, ScrapeParams, SearchParams, SendEmailParams, StepType, TavilySearchParams, TranslateParams, UpdateDatabaseParams, ValidationError, ValidationResult, WRITE_OPERATIONS, WriteDatabaseParams, WriteDocumentParams, WriteOperation, actionSchema, addDocumentAction, addFolderAction, completeSentenceAction, completionWithoutPromptStep, conditionalLoopStep, createDatabaseAction, dafDocumentSchema, deleteDatabaseAction, directiveAction, directiveParamsSchema, duplicateDatabaseAction, duplicateDocumentAction, editorActionBaseParamsSchema, editorActionSchema, extendTextAction, fixSpellingGrammarAction, fixedLoopStep, formatDocumentAction, formatTextAction, googleDocResource, googleDriveFolderResource, isValidAction, isValidDAFDocument, isValidEditorAction, isValidProcess, isValidResource, isValidStep, newsSearchAction, newsSearchParamsSchema, notionPageResource, previewSearchAction, previewSearchParamsSchema, processSchema, processStep, promptStep, readDatabaseAction, readDocumentAction, readDocumentParamsSchema, readFolderAction, reduceTextAction, removeDocumentAction, removeFolderAction, renameDocumentAction, renameFolderAction, resourceSchema, rewriteAction, scrapeAction, scrapeParamsSchema, searchAction, searchParamsSchema, sendEmailAction, sendEmailParamsSchema, simplifyAction, skipCompletionStep, stepSchema, tavilySearchAction, tavilySearchParamsSchema, translateAction, translateParamsSchema, updateDatabaseAction, userFeedbackStep, validateAction, validateDAFDocument, validateEditorAction, validateProcess, validateResource, validateStep, writeDatabaseAction, writeDocumentAction, writeDocumentParamsSchema } from './protocol/index.mjs';
|
|
2
|
-
export { Action, ActionConfig, ActionResult, AddDocumentAction, AddFolderAction, AskUserInputAction, CrawlAction, CreateDatabaseAction, DAFEmailIntegration, DAFGoogleIntegration, DAFNotionIntegration, DAFProcessRecord, DAFResourceRecord, DAFRunRecord, DAFStorageAdapter, DAFUserRecord, DbDeleteAction, DbFindAction, DbInsertAction, DbUpdateAction, DeleteDatabaseAction, DuplicateDatabaseAction, DuplicateDocumentAction, EditorTransformAction, ExecutionContext, FirecrawlActionType, FormatDocumentAction, GENERIC_VARIABLES, GenericVariable, JsonFormatOptions, LocationSettings, MODEL_PRICING, NewsSearchAction, QuickSearchAction, ReadDatabaseAction, ReadDocumentAction, ReadFolderAction, RemoveDocumentAction, RemoveFolderAction, RenameDocumentAction, RenameFolderAction, ScrapeAction, ScrapeFormat, ScreenshotFormatOptions, SearchAction, SendEmailAction, TIER_TOKEN_LIMITS, TavilySearchAction, TokenUsage, UpdateDatabaseAction, UserProviderSettings, WebhookConfig, WriteDatabaseAction, WriteDocumentAction, appendGoogleDoc, appendNotionPage, buildTokenUsage, calculateTokenCost, canUserAffordApiCall, checkAndUpdateCostLimit, createGoogleDocInFolder, createGoogleDriveFolder, createNotionDatabase, createNotionDatabasePage, createNotionSubpage, deleteGoogleDoc, deleteGoogleDriveFolder, deleteNotionDatabase, deleteNotionPage, duplicateGoogleDoc, duplicateNotionDatabase, duplicateNotionPage, exchangeGoogleCode, exchangeNotionCode, executeAction, executeChatTurn, executeProcess, executeProcessInRun, extractActionsFromMessage, extractDatabaseIdFromUrl, extractDocIdFromUrl, extractFolderIdFromUrl, extractPageIdFromUrl, formatActionResult, formatGoogleDoc, getDescAllActions, getDescChatActions, getDescEditorActions, getGenericVariable, getGenericVariableNames, getGenericVariables, getGoogleAccessToken, getGoogleAuthUrl, getGoogleOAuth2Client, getModelProvider, getNotionAccessToken, getNotionAuthUrl, getNotionDatabase, getNotionPageTitle, getProviderFromModel, isGenericVariable, listGoogleDriveFolderContents, listNotionPageChildren, mergeVariables, processMessageActions, queryNotionDatabase, readGoogleDoc, readNotionDatabase, readNotionPage, refreshGoogleToken, renameGoogleDoc, renameGoogleDriveFolder, renameNotionPage, resumeProcessExecution, selectiveUpdateGoogleDoc, selectiveUpdateNotionPage, substituteVariables, updateNotionDatabase, updateNotionDatabasePage, writeGoogleDoc, writeNotionPage } from './runtime/index.mjs';
|
|
2
|
+
export { Action, ActionConfig, ActionResult, AddDocumentAction, AddFolderAction, AskUserInputAction, CheckDomainAction, CrawlAction, CreateDatabaseAction, DAFEmailIntegration, DAFGoogleIntegration, DAFNotionIntegration, DAFProcessRecord, DAFResourceRecord, DAFRunRecord, DAFStorageAdapter, DAFUserRecord, DbDeleteAction, DbFindAction, DbInsertAction, DbUpdateAction, DeleteDatabaseAction, DuplicateDatabaseAction, DuplicateDocumentAction, EditorTransformAction, ExecutionContext, FirecrawlActionType, FormatDocumentAction, GENERIC_VARIABLES, GenericVariable, JsonFormatOptions, LocationSettings, MODEL_PRICING, NewsSearchAction, QuickSearchAction, ReadDatabaseAction, ReadDocumentAction, ReadFolderAction, RemoveDocumentAction, RemoveFolderAction, RenameDocumentAction, RenameFolderAction, ScrapeAction, ScrapeFormat, ScreenshotFormatOptions, SearchAction, SendEmailAction, TIER_TOKEN_LIMITS, TavilySearchAction, TokenUsage, UpdateDatabaseAction, UserProviderSettings, WebhookConfig, WriteDatabaseAction, WriteDocumentAction, appendGoogleDoc, appendNotionPage, buildTokenUsage, calculateTokenCost, canUserAffordApiCall, checkAndUpdateCostLimit, createGoogleDocInFolder, createGoogleDriveFolder, createNotionDatabase, createNotionDatabasePage, createNotionSubpage, deleteGoogleDoc, deleteGoogleDriveFolder, deleteNotionDatabase, deleteNotionPage, duplicateGoogleDoc, duplicateNotionDatabase, duplicateNotionPage, exchangeGoogleCode, exchangeNotionCode, executeAction, executeChatTurn, executeProcess, executeProcessInRun, extractActionsFromMessage, extractDatabaseIdFromUrl, extractDocIdFromUrl, extractFolderIdFromUrl, extractPageIdFromUrl, formatActionResult, formatGoogleDoc, getDescAllActions, getDescChatActions, getDescEditorActions, getGenericVariable, getGenericVariableNames, getGenericVariables, getGoogleAccessToken, getGoogleAuthUrl, getGoogleOAuth2Client, getModelProvider, getNotionAccessToken, getNotionAuthUrl, getNotionDatabase, getNotionPageTitle, getProviderFromModel, isGenericVariable, listGoogleDriveFolderContents, listNotionPageChildren, mergeVariables, processMessageActions, queryNotionDatabase, readGoogleDoc, readNotionDatabase, readNotionPage, refreshGoogleToken, renameGoogleDoc, renameGoogleDriveFolder, renameNotionPage, resumeProcessExecution, selectiveUpdateGoogleDoc, selectiveUpdateNotionPage, substituteVariables, updateNotionDatabase, updateNotionDatabasePage, writeGoogleDoc, writeNotionPage } from './runtime/index.mjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '@ai-sdk/provider';
|
|
5
5
|
import 'google-auth-library';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ACTION_TYPES, ActionVariant, AddDocumentParams, AddFolderParams, CreateDatabaseParams, DAFAction, DAFDocument, DAFDocumentBuilder, DAFEditorAction, DAFProcess, DAFResource, DAFStep, DAF_VERSION, DEFAULT_SCRAPE_TIMEOUT, DEFAULT_SEARCH_LIMIT, DeleteDatabaseParams, DirectiveParams, DuplicateDatabaseParams, DuplicateDocumentParams, EDITOR_ACTION_TYPES, EditorActionBaseParams, EditorActionVariant, FormatDocumentParams, LOOP_TYPES, LoopType, MAX_PROCESS_DEPTH, NewsSearchParams, PROCESS_TYPES, PreviewSearchParams, ProcessBuilder, ProcessType, RESOURCE_TYPES, ReadDatabaseParams, ReadDocumentParams, ReadFolderParams, RemoveDocumentParams, RemoveFolderParams, RenameDocumentParams, RenameFolderParams, ResourceType, STEP_TYPES, SUPPORTED_VERSIONS, ScrapeParams, SearchParams, SendEmailParams, StepType, TavilySearchParams, TranslateParams, UpdateDatabaseParams, ValidationError, ValidationResult, WRITE_OPERATIONS, WriteDatabaseParams, WriteDocumentParams, WriteOperation, actionSchema, addDocumentAction, addFolderAction, completeSentenceAction, completionWithoutPromptStep, conditionalLoopStep, createDatabaseAction, dafDocumentSchema, deleteDatabaseAction, directiveAction, directiveParamsSchema, duplicateDatabaseAction, duplicateDocumentAction, editorActionBaseParamsSchema, editorActionSchema, extendTextAction, fixSpellingGrammarAction, fixedLoopStep, formatDocumentAction, formatTextAction, googleDocResource, googleDriveFolderResource, isValidAction, isValidDAFDocument, isValidEditorAction, isValidProcess, isValidResource, isValidStep, newsSearchAction, newsSearchParamsSchema, notionPageResource, previewSearchAction, previewSearchParamsSchema, processSchema, processStep, promptStep, readDatabaseAction, readDocumentAction, readDocumentParamsSchema, readFolderAction, reduceTextAction, removeDocumentAction, removeFolderAction, renameDocumentAction, renameFolderAction, resourceSchema, rewriteAction, scrapeAction, scrapeParamsSchema, searchAction, searchParamsSchema, sendEmailAction, sendEmailParamsSchema, simplifyAction, skipCompletionStep, stepSchema, tavilySearchAction, tavilySearchParamsSchema, translateAction, translateParamsSchema, updateDatabaseAction, userFeedbackStep, validateAction, validateDAFDocument, validateEditorAction, validateProcess, validateResource, validateStep, writeDatabaseAction, writeDocumentAction, writeDocumentParamsSchema } from './protocol/index.js';
|
|
2
|
-
export { Action, ActionConfig, ActionResult, AddDocumentAction, AddFolderAction, AskUserInputAction, CrawlAction, CreateDatabaseAction, DAFEmailIntegration, DAFGoogleIntegration, DAFNotionIntegration, DAFProcessRecord, DAFResourceRecord, DAFRunRecord, DAFStorageAdapter, DAFUserRecord, DbDeleteAction, DbFindAction, DbInsertAction, DbUpdateAction, DeleteDatabaseAction, DuplicateDatabaseAction, DuplicateDocumentAction, EditorTransformAction, ExecutionContext, FirecrawlActionType, FormatDocumentAction, GENERIC_VARIABLES, GenericVariable, JsonFormatOptions, LocationSettings, MODEL_PRICING, NewsSearchAction, QuickSearchAction, ReadDatabaseAction, ReadDocumentAction, ReadFolderAction, RemoveDocumentAction, RemoveFolderAction, RenameDocumentAction, RenameFolderAction, ScrapeAction, ScrapeFormat, ScreenshotFormatOptions, SearchAction, SendEmailAction, TIER_TOKEN_LIMITS, TavilySearchAction, TokenUsage, UpdateDatabaseAction, UserProviderSettings, WebhookConfig, WriteDatabaseAction, WriteDocumentAction, appendGoogleDoc, appendNotionPage, buildTokenUsage, calculateTokenCost, canUserAffordApiCall, checkAndUpdateCostLimit, createGoogleDocInFolder, createGoogleDriveFolder, createNotionDatabase, createNotionDatabasePage, createNotionSubpage, deleteGoogleDoc, deleteGoogleDriveFolder, deleteNotionDatabase, deleteNotionPage, duplicateGoogleDoc, duplicateNotionDatabase, duplicateNotionPage, exchangeGoogleCode, exchangeNotionCode, executeAction, executeChatTurn, executeProcess, executeProcessInRun, extractActionsFromMessage, extractDatabaseIdFromUrl, extractDocIdFromUrl, extractFolderIdFromUrl, extractPageIdFromUrl, formatActionResult, formatGoogleDoc, getDescAllActions, getDescChatActions, getDescEditorActions, getGenericVariable, getGenericVariableNames, getGenericVariables, getGoogleAccessToken, getGoogleAuthUrl, getGoogleOAuth2Client, getModelProvider, getNotionAccessToken, getNotionAuthUrl, getNotionDatabase, getNotionPageTitle, getProviderFromModel, isGenericVariable, listGoogleDriveFolderContents, listNotionPageChildren, mergeVariables, processMessageActions, queryNotionDatabase, readGoogleDoc, readNotionDatabase, readNotionPage, refreshGoogleToken, renameGoogleDoc, renameGoogleDriveFolder, renameNotionPage, resumeProcessExecution, selectiveUpdateGoogleDoc, selectiveUpdateNotionPage, substituteVariables, updateNotionDatabase, updateNotionDatabasePage, writeGoogleDoc, writeNotionPage } from './runtime/index.js';
|
|
2
|
+
export { Action, ActionConfig, ActionResult, AddDocumentAction, AddFolderAction, AskUserInputAction, CheckDomainAction, CrawlAction, CreateDatabaseAction, DAFEmailIntegration, DAFGoogleIntegration, DAFNotionIntegration, DAFProcessRecord, DAFResourceRecord, DAFRunRecord, DAFStorageAdapter, DAFUserRecord, DbDeleteAction, DbFindAction, DbInsertAction, DbUpdateAction, DeleteDatabaseAction, DuplicateDatabaseAction, DuplicateDocumentAction, EditorTransformAction, ExecutionContext, FirecrawlActionType, FormatDocumentAction, GENERIC_VARIABLES, GenericVariable, JsonFormatOptions, LocationSettings, MODEL_PRICING, NewsSearchAction, QuickSearchAction, ReadDatabaseAction, ReadDocumentAction, ReadFolderAction, RemoveDocumentAction, RemoveFolderAction, RenameDocumentAction, RenameFolderAction, ScrapeAction, ScrapeFormat, ScreenshotFormatOptions, SearchAction, SendEmailAction, TIER_TOKEN_LIMITS, TavilySearchAction, TokenUsage, UpdateDatabaseAction, UserProviderSettings, WebhookConfig, WriteDatabaseAction, WriteDocumentAction, appendGoogleDoc, appendNotionPage, buildTokenUsage, calculateTokenCost, canUserAffordApiCall, checkAndUpdateCostLimit, createGoogleDocInFolder, createGoogleDriveFolder, createNotionDatabase, createNotionDatabasePage, createNotionSubpage, deleteGoogleDoc, deleteGoogleDriveFolder, deleteNotionDatabase, deleteNotionPage, duplicateGoogleDoc, duplicateNotionDatabase, duplicateNotionPage, exchangeGoogleCode, exchangeNotionCode, executeAction, executeChatTurn, executeProcess, executeProcessInRun, extractActionsFromMessage, extractDatabaseIdFromUrl, extractDocIdFromUrl, extractFolderIdFromUrl, extractPageIdFromUrl, formatActionResult, formatGoogleDoc, getDescAllActions, getDescChatActions, getDescEditorActions, getGenericVariable, getGenericVariableNames, getGenericVariables, getGoogleAccessToken, getGoogleAuthUrl, getGoogleOAuth2Client, getModelProvider, getNotionAccessToken, getNotionAuthUrl, getNotionDatabase, getNotionPageTitle, getProviderFromModel, isGenericVariable, listGoogleDriveFolderContents, listNotionPageChildren, mergeVariables, processMessageActions, queryNotionDatabase, readGoogleDoc, readNotionDatabase, readNotionPage, refreshGoogleToken, renameGoogleDoc, renameGoogleDriveFolder, renameNotionPage, resumeProcessExecution, selectiveUpdateGoogleDoc, selectiveUpdateNotionPage, substituteVariables, updateNotionDatabase, updateNotionDatabasePage, writeGoogleDoc, writeNotionPage } from './runtime/index.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '@ai-sdk/provider';
|
|
5
5
|
import 'google-auth-library';
|
package/dist/index.js
CHANGED
|
@@ -2273,6 +2273,26 @@ Web search powered by Tavily's AI search API. Returns pre-extracted clean conten
|
|
|
2273
2273
|
- \`includeAnswer\` (boolean, optional): Include a short AI-generated answer at the top (default: false)
|
|
2274
2274
|
|
|
2275
2275
|
**Note:** Use \`searchDepth: "basic"\` for speed; \`"advanced"\` for more comprehensive results.`,
|
|
2276
|
+
DESC_CHECK_DOMAIN: `**Check Domain Availability**
|
|
2277
|
+
|
|
2278
|
+
**JSON Format:**
|
|
2279
|
+
"{
|
|
2280
|
+
"type": "action",
|
|
2281
|
+
"variant": "checkDomain",
|
|
2282
|
+
"parameters": {
|
|
2283
|
+
"domains": ["example.com", "example.io"]
|
|
2284
|
+
}
|
|
2285
|
+
}"
|
|
2286
|
+
|
|
2287
|
+
*(Quotation marks added to escape execution - this is documentation only)*
|
|
2288
|
+
|
|
2289
|
+
**Description:**
|
|
2290
|
+
Checks whether domain names are registered or available, using the RDAP registry protocol (with DNS as fallback). No API key required. Use this instead of web search whenever the user asks if a domain is taken or can be registered.
|
|
2291
|
+
|
|
2292
|
+
**Parameters:**
|
|
2293
|
+
- \`domains\` (string[], required): One or more domain names to check (max 25 per call). Bare domains like \`"gadgetai.com"\` \u2014 no protocol or path.
|
|
2294
|
+
|
|
2295
|
+
**Result:** Per-domain status: \`available\`, \`registered\` (with registrar when known), or \`unknown\`.`,
|
|
2276
2296
|
DESC_READ_DOCUMENT: `**Read Document**
|
|
2277
2297
|
|
|
2278
2298
|
**JSON Format:**
|
|
@@ -3440,6 +3460,10 @@ $DESC_TAVILY_SEARCH
|
|
|
3440
3460
|
|
|
3441
3461
|
---
|
|
3442
3462
|
|
|
3463
|
+
$DESC_CHECK_DOMAIN
|
|
3464
|
+
|
|
3465
|
+
---
|
|
3466
|
+
|
|
3443
3467
|
$DESC_READ_DOCUMENT
|
|
3444
3468
|
|
|
3445
3469
|
---
|
|
@@ -4102,7 +4126,6 @@ function extractActionsFromMessage(message) {
|
|
|
4102
4126
|
const actions = [];
|
|
4103
4127
|
console.log("[extractActionsFromMessage] Received message length:", message.length);
|
|
4104
4128
|
console.log("[extractActionsFromMessage] First 200 chars:", message.substring(0, 200));
|
|
4105
|
-
const jsonRegex = /\{[^{}]*"type"\s*:\s*"(scrape|search|previewSearch|tavilySearch|crawl|sendEmail|readDocument|writeDocument|formatDocument|removeDocument|addDocument|dbFind|dbInsert|dbUpdate|dbDelete)"[^{}]*(?:\{[^{}]*\}[^{}]*)*\}/g;
|
|
4106
4129
|
let braceLevel = 0;
|
|
4107
4130
|
let currentJson = "";
|
|
4108
4131
|
let inString = false;
|
|
@@ -4207,6 +4230,8 @@ function isValidAction2(obj) {
|
|
|
4207
4230
|
return isValidQuickSearchAction(obj);
|
|
4208
4231
|
case "tavilySearch":
|
|
4209
4232
|
return isValidTavilySearchAction(obj);
|
|
4233
|
+
case "checkDomain":
|
|
4234
|
+
return isValidCheckDomainAction(obj);
|
|
4210
4235
|
case "newsSearch":
|
|
4211
4236
|
return isValidNewsSearchAction(obj);
|
|
4212
4237
|
case "readDocument":
|
|
@@ -4307,6 +4332,9 @@ function isValidTavilySearchAction(obj) {
|
|
|
4307
4332
|
if (includeAnswer !== void 0 && typeof includeAnswer !== "boolean") return false;
|
|
4308
4333
|
return true;
|
|
4309
4334
|
}
|
|
4335
|
+
function isValidCheckDomainAction(obj) {
|
|
4336
|
+
return obj.type === "action" && obj.variant === "checkDomain" && obj.parameters && Array.isArray(obj.parameters.domains) && obj.parameters.domains.length > 0 && obj.parameters.domains.every((d) => typeof d === "string" && d.trim().length > 0);
|
|
4337
|
+
}
|
|
4310
4338
|
function isValidNewsSearchAction(obj) {
|
|
4311
4339
|
if (!obj.parameters) return false;
|
|
4312
4340
|
const { query, limit, ignoreInvalidURLs, scrapeOptions } = obj.parameters;
|
|
@@ -4492,6 +4520,8 @@ async function executeAction(action, userId, adapter, processId, parentProcessId
|
|
|
4492
4520
|
return await executeQuickSearchAction(action, userId);
|
|
4493
4521
|
case "tavilySearch":
|
|
4494
4522
|
return await executeTavilySearchAction(action, userId);
|
|
4523
|
+
case "checkDomain":
|
|
4524
|
+
return await executeCheckDomainAction(action);
|
|
4495
4525
|
case "newsSearch":
|
|
4496
4526
|
return await executeNewsSearchAction(action, userId);
|
|
4497
4527
|
case "readDocument":
|
|
@@ -5367,6 +5397,78 @@ Answer: ${data.answer}`;
|
|
|
5367
5397
|
};
|
|
5368
5398
|
}
|
|
5369
5399
|
}
|
|
5400
|
+
async function executeCheckDomainAction(action) {
|
|
5401
|
+
const normalize = (d) => d.trim().toLowerCase().replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/^www\./, "");
|
|
5402
|
+
async function checkOne(rawDomain) {
|
|
5403
|
+
const domain = normalize(rawDomain);
|
|
5404
|
+
if (!/^[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(domain)) {
|
|
5405
|
+
return { domain, available: null, status: "invalid", detail: "Not a valid domain name" };
|
|
5406
|
+
}
|
|
5407
|
+
try {
|
|
5408
|
+
const controller = new AbortController();
|
|
5409
|
+
const timeout = setTimeout(() => controller.abort(), 8e3);
|
|
5410
|
+
const res = await fetch(`https://rdap.org/domain/${encodeURIComponent(domain)}`, {
|
|
5411
|
+
signal: controller.signal,
|
|
5412
|
+
headers: { Accept: "application/rdap+json" },
|
|
5413
|
+
redirect: "follow"
|
|
5414
|
+
});
|
|
5415
|
+
clearTimeout(timeout);
|
|
5416
|
+
if (res.status === 404) {
|
|
5417
|
+
return { domain, available: true, status: "available", detail: "No registration found (RDAP)" };
|
|
5418
|
+
}
|
|
5419
|
+
if (res.ok) {
|
|
5420
|
+
let registrar;
|
|
5421
|
+
try {
|
|
5422
|
+
const data = await res.json();
|
|
5423
|
+
const registrarEntity = (data.entities || []).find((e) => (e.roles || []).includes("registrar"));
|
|
5424
|
+
registrar = registrarEntity?.vcardArray?.[1]?.find((v) => v[0] === "fn")?.[3];
|
|
5425
|
+
} catch {
|
|
5426
|
+
}
|
|
5427
|
+
return {
|
|
5428
|
+
domain,
|
|
5429
|
+
available: false,
|
|
5430
|
+
status: "registered",
|
|
5431
|
+
detail: registrar ? `Registered via ${registrar}` : "Registered (RDAP)"
|
|
5432
|
+
};
|
|
5433
|
+
}
|
|
5434
|
+
} catch {
|
|
5435
|
+
}
|
|
5436
|
+
try {
|
|
5437
|
+
const dns = await import("dns");
|
|
5438
|
+
await dns.promises.resolve(domain, "NS");
|
|
5439
|
+
return { domain, available: false, status: "registered", detail: "Has DNS records (NS)" };
|
|
5440
|
+
} catch (err) {
|
|
5441
|
+
if (err?.code === "ENOTFOUND" || err?.code === "NXDOMAIN" || err?.code === "ENODATA") {
|
|
5442
|
+
return { domain, available: true, status: "probably-available", detail: "No DNS records found (RDAP was unavailable, so verify with a registrar)" };
|
|
5443
|
+
}
|
|
5444
|
+
return { domain, available: null, status: "unknown", detail: "Could not determine availability" };
|
|
5445
|
+
}
|
|
5446
|
+
}
|
|
5447
|
+
try {
|
|
5448
|
+
const domains = action.parameters.domains.slice(0, 25);
|
|
5449
|
+
console.log(`[Check Domain Action] Checking ${domains.length} domain(s)`);
|
|
5450
|
+
const results = await Promise.all(domains.map(checkOne));
|
|
5451
|
+
const available = results.filter((r) => r.available === true).map((r) => r.domain);
|
|
5452
|
+
const taken = results.filter((r) => r.available === false).map((r) => r.domain);
|
|
5453
|
+
const unknown = results.filter((r) => r.available === null).map((r) => r.domain);
|
|
5454
|
+
let message = `Domain availability check (${results.length} domain${results.length === 1 ? "" : "s"}):`;
|
|
5455
|
+
for (const r of results) {
|
|
5456
|
+
const icon = r.available === true ? "AVAILABLE" : r.available === false ? "TAKEN" : "UNKNOWN";
|
|
5457
|
+
message += `
|
|
5458
|
+
- ${r.domain}: ${icon} \u2014 ${r.detail}`;
|
|
5459
|
+
}
|
|
5460
|
+
return {
|
|
5461
|
+
success: true,
|
|
5462
|
+
message,
|
|
5463
|
+
data: { results, summary: { available, taken, unknown } }
|
|
5464
|
+
};
|
|
5465
|
+
} catch (error) {
|
|
5466
|
+
return {
|
|
5467
|
+
success: false,
|
|
5468
|
+
error: error instanceof Error ? error.message : "Domain check failed"
|
|
5469
|
+
};
|
|
5470
|
+
}
|
|
5471
|
+
}
|
|
5370
5472
|
async function getAccessibleResources(processId, userId, adapter, parentProcessIds = []) {
|
|
5371
5473
|
try {
|
|
5372
5474
|
const allProcessIds = [processId, ...parentProcessIds];
|
|
@@ -7274,7 +7376,7 @@ async function processMessageActions(message, userId, adapter, processId, parent
|
|
|
7274
7376
|
}
|
|
7275
7377
|
|
|
7276
7378
|
// src/runtime/executor.ts
|
|
7277
|
-
var MAX_STEPS_EXECUTED =
|
|
7379
|
+
var MAX_STEPS_EXECUTED = 300;
|
|
7278
7380
|
var PauseSignal = class {
|
|
7279
7381
|
constructor(remaining, question) {
|
|
7280
7382
|
this.remainingSteps = remaining;
|
package/dist/index.mjs
CHANGED
package/dist/runtime/index.d.mts
CHANGED
|
@@ -556,6 +556,13 @@ interface TavilySearchAction {
|
|
|
556
556
|
includeAnswer?: boolean;
|
|
557
557
|
};
|
|
558
558
|
}
|
|
559
|
+
interface CheckDomainAction {
|
|
560
|
+
type: 'action';
|
|
561
|
+
variant: 'checkDomain';
|
|
562
|
+
parameters: {
|
|
563
|
+
domains: string[];
|
|
564
|
+
};
|
|
565
|
+
}
|
|
559
566
|
interface WebhookConfig {
|
|
560
567
|
url: string;
|
|
561
568
|
metadata?: Record<string, any>;
|
|
@@ -652,7 +659,7 @@ interface AskUserInputAction {
|
|
|
652
659
|
message?: string;
|
|
653
660
|
};
|
|
654
661
|
}
|
|
655
|
-
type Action = SendEmailAction | ScrapeAction | SearchAction | NewsSearchAction | QuickSearchAction | TavilySearchAction | CrawlAction | ReadDocumentAction | WriteDocumentAction | FormatDocumentAction | RemoveDocumentAction | RenameDocumentAction | DuplicateDocumentAction | AddFolderAction | RemoveFolderAction | ReadFolderAction | RenameFolderAction | AddDocumentAction | CreateDatabaseAction | ReadDatabaseAction | UpdateDatabaseAction | DeleteDatabaseAction | WriteDatabaseAction | DuplicateDatabaseAction | DbFindAction | DbInsertAction | DbUpdateAction | DbDeleteAction | EditorTransformAction | AskUserInputAction;
|
|
662
|
+
type Action = SendEmailAction | ScrapeAction | SearchAction | NewsSearchAction | QuickSearchAction | TavilySearchAction | CheckDomainAction | CrawlAction | ReadDocumentAction | WriteDocumentAction | FormatDocumentAction | RemoveDocumentAction | RenameDocumentAction | DuplicateDocumentAction | AddFolderAction | RemoveFolderAction | ReadFolderAction | RenameFolderAction | AddDocumentAction | CreateDatabaseAction | ReadDatabaseAction | UpdateDatabaseAction | DeleteDatabaseAction | WriteDatabaseAction | DuplicateDatabaseAction | DbFindAction | DbInsertAction | DbUpdateAction | DbDeleteAction | EditorTransformAction | AskUserInputAction;
|
|
656
663
|
interface ActionResult {
|
|
657
664
|
success: boolean;
|
|
658
665
|
error?: string;
|
|
@@ -954,4 +961,4 @@ declare function duplicateNotionDatabase(databaseId: string, accessToken: string
|
|
|
954
961
|
*/
|
|
955
962
|
declare function updateNotionDatabasePage(pageId: string, accessToken: string, properties?: Record<string, any>, content?: string): Promise<void>;
|
|
956
963
|
|
|
957
|
-
export { type Action, type ActionConfig, type ActionResult, type AddDocumentAction, type AddFolderAction, type AskUserInputAction, type CrawlAction, type CreateDatabaseAction, type DAFEmailIntegration, type DAFGoogleIntegration, type DAFNotionIntegration, type DAFProcessRecord, type DAFResourceRecord, type DAFRunRecord, type DAFStorageAdapter, type DAFUserRecord, type DbDeleteAction, type DbFindAction, type DbInsertAction, type DbUpdateAction, type DeleteDatabaseAction, type DuplicateDatabaseAction, type DuplicateDocumentAction, type EditorTransformAction, type ExecutionContext, type FirecrawlActionType, type FormatDocumentAction, GENERIC_VARIABLES, type GenericVariable, type JsonFormatOptions, type LocationSettings, MODEL_PRICING, type NewsSearchAction, type QuickSearchAction, type ReadDatabaseAction, type ReadDocumentAction, type ReadFolderAction, type RemoveDocumentAction, type RemoveFolderAction, type RenameDocumentAction, type RenameFolderAction, type ScrapeAction, type ScrapeFormat, type ScreenshotFormatOptions, type SearchAction, type SendEmailAction, TIER_TOKEN_LIMITS, type TavilySearchAction, type TokenUsage, type UpdateDatabaseAction, type UserProviderSettings, type WebhookConfig, type WriteDatabaseAction, type WriteDocumentAction, appendGoogleDoc, appendNotionPage, buildTokenUsage, calculateTokenCost, canUserAffordApiCall, checkAndUpdateCostLimit, createGoogleDocInFolder, createGoogleDriveFolder, createNotionDatabase, createNotionDatabasePage, createNotionSubpage, deleteGoogleDoc, deleteGoogleDriveFolder, deleteNotionDatabase, deleteNotionPage, duplicateGoogleDoc, duplicateNotionDatabase, duplicateNotionPage, exchangeGoogleCode, exchangeNotionCode, executeAction, executeChatTurn, executeProcess, executeProcessInRun, extractActionsFromMessage, extractDatabaseIdFromUrl, extractDocIdFromUrl, extractFolderIdFromUrl, extractPageIdFromUrl, formatActionResult, formatGoogleDoc, getDescAllActions, getDescChatActions, getDescEditorActions, getGenericVariable, getGenericVariableNames, getGenericVariables, getGoogleAccessToken, getGoogleAuthUrl, getGoogleOAuth2Client, getModelProvider, getNotionAccessToken, getNotionAuthUrl, getNotionDatabase, getNotionPageTitle, getProviderFromModel, isGenericVariable, listGoogleDriveFolderContents, listNotionPageChildren, mergeVariables, processMessageActions, queryNotionDatabase, readGoogleDoc, readNotionDatabase, readNotionPage, refreshGoogleToken, renameGoogleDoc, renameGoogleDriveFolder, renameNotionPage, resumeProcessExecution, selectiveUpdateGoogleDoc, selectiveUpdateNotionPage, substituteVariables, updateNotionDatabase, updateNotionDatabasePage, writeGoogleDoc, writeNotionPage };
|
|
964
|
+
export { type Action, type ActionConfig, type ActionResult, type AddDocumentAction, type AddFolderAction, type AskUserInputAction, type CheckDomainAction, type CrawlAction, type CreateDatabaseAction, type DAFEmailIntegration, type DAFGoogleIntegration, type DAFNotionIntegration, type DAFProcessRecord, type DAFResourceRecord, type DAFRunRecord, type DAFStorageAdapter, type DAFUserRecord, type DbDeleteAction, type DbFindAction, type DbInsertAction, type DbUpdateAction, type DeleteDatabaseAction, type DuplicateDatabaseAction, type DuplicateDocumentAction, type EditorTransformAction, type ExecutionContext, type FirecrawlActionType, type FormatDocumentAction, GENERIC_VARIABLES, type GenericVariable, type JsonFormatOptions, type LocationSettings, MODEL_PRICING, type NewsSearchAction, type QuickSearchAction, type ReadDatabaseAction, type ReadDocumentAction, type ReadFolderAction, type RemoveDocumentAction, type RemoveFolderAction, type RenameDocumentAction, type RenameFolderAction, type ScrapeAction, type ScrapeFormat, type ScreenshotFormatOptions, type SearchAction, type SendEmailAction, TIER_TOKEN_LIMITS, type TavilySearchAction, type TokenUsage, type UpdateDatabaseAction, type UserProviderSettings, type WebhookConfig, type WriteDatabaseAction, type WriteDocumentAction, appendGoogleDoc, appendNotionPage, buildTokenUsage, calculateTokenCost, canUserAffordApiCall, checkAndUpdateCostLimit, createGoogleDocInFolder, createGoogleDriveFolder, createNotionDatabase, createNotionDatabasePage, createNotionSubpage, deleteGoogleDoc, deleteGoogleDriveFolder, deleteNotionDatabase, deleteNotionPage, duplicateGoogleDoc, duplicateNotionDatabase, duplicateNotionPage, exchangeGoogleCode, exchangeNotionCode, executeAction, executeChatTurn, executeProcess, executeProcessInRun, extractActionsFromMessage, extractDatabaseIdFromUrl, extractDocIdFromUrl, extractFolderIdFromUrl, extractPageIdFromUrl, formatActionResult, formatGoogleDoc, getDescAllActions, getDescChatActions, getDescEditorActions, getGenericVariable, getGenericVariableNames, getGenericVariables, getGoogleAccessToken, getGoogleAuthUrl, getGoogleOAuth2Client, getModelProvider, getNotionAccessToken, getNotionAuthUrl, getNotionDatabase, getNotionPageTitle, getProviderFromModel, isGenericVariable, listGoogleDriveFolderContents, listNotionPageChildren, mergeVariables, processMessageActions, queryNotionDatabase, readGoogleDoc, readNotionDatabase, readNotionPage, refreshGoogleToken, renameGoogleDoc, renameGoogleDriveFolder, renameNotionPage, resumeProcessExecution, selectiveUpdateGoogleDoc, selectiveUpdateNotionPage, substituteVariables, updateNotionDatabase, updateNotionDatabasePage, writeGoogleDoc, writeNotionPage };
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -556,6 +556,13 @@ interface TavilySearchAction {
|
|
|
556
556
|
includeAnswer?: boolean;
|
|
557
557
|
};
|
|
558
558
|
}
|
|
559
|
+
interface CheckDomainAction {
|
|
560
|
+
type: 'action';
|
|
561
|
+
variant: 'checkDomain';
|
|
562
|
+
parameters: {
|
|
563
|
+
domains: string[];
|
|
564
|
+
};
|
|
565
|
+
}
|
|
559
566
|
interface WebhookConfig {
|
|
560
567
|
url: string;
|
|
561
568
|
metadata?: Record<string, any>;
|
|
@@ -652,7 +659,7 @@ interface AskUserInputAction {
|
|
|
652
659
|
message?: string;
|
|
653
660
|
};
|
|
654
661
|
}
|
|
655
|
-
type Action = SendEmailAction | ScrapeAction | SearchAction | NewsSearchAction | QuickSearchAction | TavilySearchAction | CrawlAction | ReadDocumentAction | WriteDocumentAction | FormatDocumentAction | RemoveDocumentAction | RenameDocumentAction | DuplicateDocumentAction | AddFolderAction | RemoveFolderAction | ReadFolderAction | RenameFolderAction | AddDocumentAction | CreateDatabaseAction | ReadDatabaseAction | UpdateDatabaseAction | DeleteDatabaseAction | WriteDatabaseAction | DuplicateDatabaseAction | DbFindAction | DbInsertAction | DbUpdateAction | DbDeleteAction | EditorTransformAction | AskUserInputAction;
|
|
662
|
+
type Action = SendEmailAction | ScrapeAction | SearchAction | NewsSearchAction | QuickSearchAction | TavilySearchAction | CheckDomainAction | CrawlAction | ReadDocumentAction | WriteDocumentAction | FormatDocumentAction | RemoveDocumentAction | RenameDocumentAction | DuplicateDocumentAction | AddFolderAction | RemoveFolderAction | ReadFolderAction | RenameFolderAction | AddDocumentAction | CreateDatabaseAction | ReadDatabaseAction | UpdateDatabaseAction | DeleteDatabaseAction | WriteDatabaseAction | DuplicateDatabaseAction | DbFindAction | DbInsertAction | DbUpdateAction | DbDeleteAction | EditorTransformAction | AskUserInputAction;
|
|
656
663
|
interface ActionResult {
|
|
657
664
|
success: boolean;
|
|
658
665
|
error?: string;
|
|
@@ -954,4 +961,4 @@ declare function duplicateNotionDatabase(databaseId: string, accessToken: string
|
|
|
954
961
|
*/
|
|
955
962
|
declare function updateNotionDatabasePage(pageId: string, accessToken: string, properties?: Record<string, any>, content?: string): Promise<void>;
|
|
956
963
|
|
|
957
|
-
export { type Action, type ActionConfig, type ActionResult, type AddDocumentAction, type AddFolderAction, type AskUserInputAction, type CrawlAction, type CreateDatabaseAction, type DAFEmailIntegration, type DAFGoogleIntegration, type DAFNotionIntegration, type DAFProcessRecord, type DAFResourceRecord, type DAFRunRecord, type DAFStorageAdapter, type DAFUserRecord, type DbDeleteAction, type DbFindAction, type DbInsertAction, type DbUpdateAction, type DeleteDatabaseAction, type DuplicateDatabaseAction, type DuplicateDocumentAction, type EditorTransformAction, type ExecutionContext, type FirecrawlActionType, type FormatDocumentAction, GENERIC_VARIABLES, type GenericVariable, type JsonFormatOptions, type LocationSettings, MODEL_PRICING, type NewsSearchAction, type QuickSearchAction, type ReadDatabaseAction, type ReadDocumentAction, type ReadFolderAction, type RemoveDocumentAction, type RemoveFolderAction, type RenameDocumentAction, type RenameFolderAction, type ScrapeAction, type ScrapeFormat, type ScreenshotFormatOptions, type SearchAction, type SendEmailAction, TIER_TOKEN_LIMITS, type TavilySearchAction, type TokenUsage, type UpdateDatabaseAction, type UserProviderSettings, type WebhookConfig, type WriteDatabaseAction, type WriteDocumentAction, appendGoogleDoc, appendNotionPage, buildTokenUsage, calculateTokenCost, canUserAffordApiCall, checkAndUpdateCostLimit, createGoogleDocInFolder, createGoogleDriveFolder, createNotionDatabase, createNotionDatabasePage, createNotionSubpage, deleteGoogleDoc, deleteGoogleDriveFolder, deleteNotionDatabase, deleteNotionPage, duplicateGoogleDoc, duplicateNotionDatabase, duplicateNotionPage, exchangeGoogleCode, exchangeNotionCode, executeAction, executeChatTurn, executeProcess, executeProcessInRun, extractActionsFromMessage, extractDatabaseIdFromUrl, extractDocIdFromUrl, extractFolderIdFromUrl, extractPageIdFromUrl, formatActionResult, formatGoogleDoc, getDescAllActions, getDescChatActions, getDescEditorActions, getGenericVariable, getGenericVariableNames, getGenericVariables, getGoogleAccessToken, getGoogleAuthUrl, getGoogleOAuth2Client, getModelProvider, getNotionAccessToken, getNotionAuthUrl, getNotionDatabase, getNotionPageTitle, getProviderFromModel, isGenericVariable, listGoogleDriveFolderContents, listNotionPageChildren, mergeVariables, processMessageActions, queryNotionDatabase, readGoogleDoc, readNotionDatabase, readNotionPage, refreshGoogleToken, renameGoogleDoc, renameGoogleDriveFolder, renameNotionPage, resumeProcessExecution, selectiveUpdateGoogleDoc, selectiveUpdateNotionPage, substituteVariables, updateNotionDatabase, updateNotionDatabasePage, writeGoogleDoc, writeNotionPage };
|
|
964
|
+
export { type Action, type ActionConfig, type ActionResult, type AddDocumentAction, type AddFolderAction, type AskUserInputAction, type CheckDomainAction, type CrawlAction, type CreateDatabaseAction, type DAFEmailIntegration, type DAFGoogleIntegration, type DAFNotionIntegration, type DAFProcessRecord, type DAFResourceRecord, type DAFRunRecord, type DAFStorageAdapter, type DAFUserRecord, type DbDeleteAction, type DbFindAction, type DbInsertAction, type DbUpdateAction, type DeleteDatabaseAction, type DuplicateDatabaseAction, type DuplicateDocumentAction, type EditorTransformAction, type ExecutionContext, type FirecrawlActionType, type FormatDocumentAction, GENERIC_VARIABLES, type GenericVariable, type JsonFormatOptions, type LocationSettings, MODEL_PRICING, type NewsSearchAction, type QuickSearchAction, type ReadDatabaseAction, type ReadDocumentAction, type ReadFolderAction, type RemoveDocumentAction, type RemoveFolderAction, type RenameDocumentAction, type RenameFolderAction, type ScrapeAction, type ScrapeFormat, type ScreenshotFormatOptions, type SearchAction, type SendEmailAction, TIER_TOKEN_LIMITS, type TavilySearchAction, type TokenUsage, type UpdateDatabaseAction, type UserProviderSettings, type WebhookConfig, type WriteDatabaseAction, type WriteDocumentAction, appendGoogleDoc, appendNotionPage, buildTokenUsage, calculateTokenCost, canUserAffordApiCall, checkAndUpdateCostLimit, createGoogleDocInFolder, createGoogleDriveFolder, createNotionDatabase, createNotionDatabasePage, createNotionSubpage, deleteGoogleDoc, deleteGoogleDriveFolder, deleteNotionDatabase, deleteNotionPage, duplicateGoogleDoc, duplicateNotionDatabase, duplicateNotionPage, exchangeGoogleCode, exchangeNotionCode, executeAction, executeChatTurn, executeProcess, executeProcessInRun, extractActionsFromMessage, extractDatabaseIdFromUrl, extractDocIdFromUrl, extractFolderIdFromUrl, extractPageIdFromUrl, formatActionResult, formatGoogleDoc, getDescAllActions, getDescChatActions, getDescEditorActions, getGenericVariable, getGenericVariableNames, getGenericVariables, getGoogleAccessToken, getGoogleAuthUrl, getGoogleOAuth2Client, getModelProvider, getNotionAccessToken, getNotionAuthUrl, getNotionDatabase, getNotionPageTitle, getProviderFromModel, isGenericVariable, listGoogleDriveFolderContents, listNotionPageChildren, mergeVariables, processMessageActions, queryNotionDatabase, readGoogleDoc, readNotionDatabase, readNotionPage, refreshGoogleToken, renameGoogleDoc, renameGoogleDriveFolder, renameNotionPage, resumeProcessExecution, selectiveUpdateGoogleDoc, selectiveUpdateNotionPage, substituteVariables, updateNotionDatabase, updateNotionDatabasePage, writeGoogleDoc, writeNotionPage };
|
package/dist/runtime/index.js
CHANGED
|
@@ -1650,6 +1650,26 @@ Web search powered by Tavily's AI search API. Returns pre-extracted clean conten
|
|
|
1650
1650
|
- \`includeAnswer\` (boolean, optional): Include a short AI-generated answer at the top (default: false)
|
|
1651
1651
|
|
|
1652
1652
|
**Note:** Use \`searchDepth: "basic"\` for speed; \`"advanced"\` for more comprehensive results.`,
|
|
1653
|
+
DESC_CHECK_DOMAIN: `**Check Domain Availability**
|
|
1654
|
+
|
|
1655
|
+
**JSON Format:**
|
|
1656
|
+
"{
|
|
1657
|
+
"type": "action",
|
|
1658
|
+
"variant": "checkDomain",
|
|
1659
|
+
"parameters": {
|
|
1660
|
+
"domains": ["example.com", "example.io"]
|
|
1661
|
+
}
|
|
1662
|
+
}"
|
|
1663
|
+
|
|
1664
|
+
*(Quotation marks added to escape execution - this is documentation only)*
|
|
1665
|
+
|
|
1666
|
+
**Description:**
|
|
1667
|
+
Checks whether domain names are registered or available, using the RDAP registry protocol (with DNS as fallback). No API key required. Use this instead of web search whenever the user asks if a domain is taken or can be registered.
|
|
1668
|
+
|
|
1669
|
+
**Parameters:**
|
|
1670
|
+
- \`domains\` (string[], required): One or more domain names to check (max 25 per call). Bare domains like \`"gadgetai.com"\` \u2014 no protocol or path.
|
|
1671
|
+
|
|
1672
|
+
**Result:** Per-domain status: \`available\`, \`registered\` (with registrar when known), or \`unknown\`.`,
|
|
1653
1673
|
DESC_READ_DOCUMENT: `**Read Document**
|
|
1654
1674
|
|
|
1655
1675
|
**JSON Format:**
|
|
@@ -2817,6 +2837,10 @@ $DESC_TAVILY_SEARCH
|
|
|
2817
2837
|
|
|
2818
2838
|
---
|
|
2819
2839
|
|
|
2840
|
+
$DESC_CHECK_DOMAIN
|
|
2841
|
+
|
|
2842
|
+
---
|
|
2843
|
+
|
|
2820
2844
|
$DESC_READ_DOCUMENT
|
|
2821
2845
|
|
|
2822
2846
|
---
|
|
@@ -3479,7 +3503,6 @@ function extractActionsFromMessage(message) {
|
|
|
3479
3503
|
const actions = [];
|
|
3480
3504
|
console.log("[extractActionsFromMessage] Received message length:", message.length);
|
|
3481
3505
|
console.log("[extractActionsFromMessage] First 200 chars:", message.substring(0, 200));
|
|
3482
|
-
const jsonRegex = /\{[^{}]*"type"\s*:\s*"(scrape|search|previewSearch|tavilySearch|crawl|sendEmail|readDocument|writeDocument|formatDocument|removeDocument|addDocument|dbFind|dbInsert|dbUpdate|dbDelete)"[^{}]*(?:\{[^{}]*\}[^{}]*)*\}/g;
|
|
3483
3506
|
let braceLevel = 0;
|
|
3484
3507
|
let currentJson = "";
|
|
3485
3508
|
let inString = false;
|
|
@@ -3584,6 +3607,8 @@ function isValidAction(obj) {
|
|
|
3584
3607
|
return isValidQuickSearchAction(obj);
|
|
3585
3608
|
case "tavilySearch":
|
|
3586
3609
|
return isValidTavilySearchAction(obj);
|
|
3610
|
+
case "checkDomain":
|
|
3611
|
+
return isValidCheckDomainAction(obj);
|
|
3587
3612
|
case "newsSearch":
|
|
3588
3613
|
return isValidNewsSearchAction(obj);
|
|
3589
3614
|
case "readDocument":
|
|
@@ -3684,6 +3709,9 @@ function isValidTavilySearchAction(obj) {
|
|
|
3684
3709
|
if (includeAnswer !== void 0 && typeof includeAnswer !== "boolean") return false;
|
|
3685
3710
|
return true;
|
|
3686
3711
|
}
|
|
3712
|
+
function isValidCheckDomainAction(obj) {
|
|
3713
|
+
return obj.type === "action" && obj.variant === "checkDomain" && obj.parameters && Array.isArray(obj.parameters.domains) && obj.parameters.domains.length > 0 && obj.parameters.domains.every((d) => typeof d === "string" && d.trim().length > 0);
|
|
3714
|
+
}
|
|
3687
3715
|
function isValidNewsSearchAction(obj) {
|
|
3688
3716
|
if (!obj.parameters) return false;
|
|
3689
3717
|
const { query, limit, ignoreInvalidURLs, scrapeOptions } = obj.parameters;
|
|
@@ -3869,6 +3897,8 @@ async function executeAction(action, userId, adapter, processId, parentProcessId
|
|
|
3869
3897
|
return await executeQuickSearchAction(action, userId);
|
|
3870
3898
|
case "tavilySearch":
|
|
3871
3899
|
return await executeTavilySearchAction(action, userId);
|
|
3900
|
+
case "checkDomain":
|
|
3901
|
+
return await executeCheckDomainAction(action);
|
|
3872
3902
|
case "newsSearch":
|
|
3873
3903
|
return await executeNewsSearchAction(action, userId);
|
|
3874
3904
|
case "readDocument":
|
|
@@ -4744,6 +4774,78 @@ Answer: ${data.answer}`;
|
|
|
4744
4774
|
};
|
|
4745
4775
|
}
|
|
4746
4776
|
}
|
|
4777
|
+
async function executeCheckDomainAction(action) {
|
|
4778
|
+
const normalize = (d) => d.trim().toLowerCase().replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/^www\./, "");
|
|
4779
|
+
async function checkOne(rawDomain) {
|
|
4780
|
+
const domain = normalize(rawDomain);
|
|
4781
|
+
if (!/^[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(domain)) {
|
|
4782
|
+
return { domain, available: null, status: "invalid", detail: "Not a valid domain name" };
|
|
4783
|
+
}
|
|
4784
|
+
try {
|
|
4785
|
+
const controller = new AbortController();
|
|
4786
|
+
const timeout = setTimeout(() => controller.abort(), 8e3);
|
|
4787
|
+
const res = await fetch(`https://rdap.org/domain/${encodeURIComponent(domain)}`, {
|
|
4788
|
+
signal: controller.signal,
|
|
4789
|
+
headers: { Accept: "application/rdap+json" },
|
|
4790
|
+
redirect: "follow"
|
|
4791
|
+
});
|
|
4792
|
+
clearTimeout(timeout);
|
|
4793
|
+
if (res.status === 404) {
|
|
4794
|
+
return { domain, available: true, status: "available", detail: "No registration found (RDAP)" };
|
|
4795
|
+
}
|
|
4796
|
+
if (res.ok) {
|
|
4797
|
+
let registrar;
|
|
4798
|
+
try {
|
|
4799
|
+
const data = await res.json();
|
|
4800
|
+
const registrarEntity = (data.entities || []).find((e) => (e.roles || []).includes("registrar"));
|
|
4801
|
+
registrar = registrarEntity?.vcardArray?.[1]?.find((v) => v[0] === "fn")?.[3];
|
|
4802
|
+
} catch {
|
|
4803
|
+
}
|
|
4804
|
+
return {
|
|
4805
|
+
domain,
|
|
4806
|
+
available: false,
|
|
4807
|
+
status: "registered",
|
|
4808
|
+
detail: registrar ? `Registered via ${registrar}` : "Registered (RDAP)"
|
|
4809
|
+
};
|
|
4810
|
+
}
|
|
4811
|
+
} catch {
|
|
4812
|
+
}
|
|
4813
|
+
try {
|
|
4814
|
+
const dns = await import("dns");
|
|
4815
|
+
await dns.promises.resolve(domain, "NS");
|
|
4816
|
+
return { domain, available: false, status: "registered", detail: "Has DNS records (NS)" };
|
|
4817
|
+
} catch (err) {
|
|
4818
|
+
if (err?.code === "ENOTFOUND" || err?.code === "NXDOMAIN" || err?.code === "ENODATA") {
|
|
4819
|
+
return { domain, available: true, status: "probably-available", detail: "No DNS records found (RDAP was unavailable, so verify with a registrar)" };
|
|
4820
|
+
}
|
|
4821
|
+
return { domain, available: null, status: "unknown", detail: "Could not determine availability" };
|
|
4822
|
+
}
|
|
4823
|
+
}
|
|
4824
|
+
try {
|
|
4825
|
+
const domains = action.parameters.domains.slice(0, 25);
|
|
4826
|
+
console.log(`[Check Domain Action] Checking ${domains.length} domain(s)`);
|
|
4827
|
+
const results = await Promise.all(domains.map(checkOne));
|
|
4828
|
+
const available = results.filter((r) => r.available === true).map((r) => r.domain);
|
|
4829
|
+
const taken = results.filter((r) => r.available === false).map((r) => r.domain);
|
|
4830
|
+
const unknown = results.filter((r) => r.available === null).map((r) => r.domain);
|
|
4831
|
+
let message = `Domain availability check (${results.length} domain${results.length === 1 ? "" : "s"}):`;
|
|
4832
|
+
for (const r of results) {
|
|
4833
|
+
const icon = r.available === true ? "AVAILABLE" : r.available === false ? "TAKEN" : "UNKNOWN";
|
|
4834
|
+
message += `
|
|
4835
|
+
- ${r.domain}: ${icon} \u2014 ${r.detail}`;
|
|
4836
|
+
}
|
|
4837
|
+
return {
|
|
4838
|
+
success: true,
|
|
4839
|
+
message,
|
|
4840
|
+
data: { results, summary: { available, taken, unknown } }
|
|
4841
|
+
};
|
|
4842
|
+
} catch (error) {
|
|
4843
|
+
return {
|
|
4844
|
+
success: false,
|
|
4845
|
+
error: error instanceof Error ? error.message : "Domain check failed"
|
|
4846
|
+
};
|
|
4847
|
+
}
|
|
4848
|
+
}
|
|
4747
4849
|
async function getAccessibleResources(processId, userId, adapter, parentProcessIds = []) {
|
|
4748
4850
|
try {
|
|
4749
4851
|
const allProcessIds = [processId, ...parentProcessIds];
|
|
@@ -6651,7 +6753,7 @@ async function processMessageActions(message, userId, adapter, processId, parent
|
|
|
6651
6753
|
}
|
|
6652
6754
|
|
|
6653
6755
|
// src/runtime/executor.ts
|
|
6654
|
-
var MAX_STEPS_EXECUTED =
|
|
6756
|
+
var MAX_STEPS_EXECUTED = 300;
|
|
6655
6757
|
var PauseSignal = class {
|
|
6656
6758
|
constructor(remaining, question) {
|
|
6657
6759
|
this.remainingSteps = remaining;
|
package/dist/runtime/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daf-sdk/runtime",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "DAF (Defined Action Framework) — protocol types, validation, and agentic execution runtime",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -61,4 +61,4 @@
|
|
|
61
61
|
"nodemailer": "^8.0.10",
|
|
62
62
|
"zod": "^4.3.6"
|
|
63
63
|
}
|
|
64
|
-
}
|
|
64
|
+
}
|