Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

dphelper

Package Overview
Dependencies
Maintainers
1
Versions
391
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dphelper - npm Package Compare versions

Comparing version
3.0.7
to
3.1.0
+1
index.d.ts
/// <reference path="./types/dphelper.d.ts" />
interface SandboxOptions {
timeout?: number
memoryLimit?: number
allowGlobals?: boolean
allowConsole?: boolean
}
interface AgentSandboxOptions {
maxTokens?: number
maxOperations?: number
allowRead?: boolean
allowWrite?: boolean
allowNetwork?: boolean
blockedAPIs?: string[]
}
interface AgentContext {
id: string
created: number
operations: number
tokens: number
blocked: boolean
data: Record<string, any>
}
interface IsolatedSandbox {
run: (code: string) => any
eval: (expr: string) => any
setGlobal: (key: string, value: any) => void
getGlobal: (key: string) => any
}
interface SandboxTool {
run: (code: string, options?: SandboxOptions) => Promise<any>
eval: (expr: string) => any
createAgent: (options?: AgentSandboxOptions) => string
agentRun: (agentId: string, code: string) => Promise<any>
blockFS: () => void
blockNetwork: () => void
isolate: (globals?: Record<string, any>) => IsolatedSandbox
reset: () => void
listAgents: () => AgentContext[]
killAgent: (agentId: string) => boolean
}
+2
-3
{
"name": "dphelper",
"version": "3.0.7",
"version": "3.1.0",
"type": "module",

@@ -79,3 +79,2 @@ "main": "index.js",

"npm:publish": "npm run build && npm publish ./dist --access public",
"postinstall": "node postinstall.mjs",
"test": "cd tests && npm run test",

@@ -88,3 +87,3 @@ "lint": "cd tests && npm run lint",

"@types/crypto-js": "4.2.2",
"@types/node": "^25.3.0",
"@types/node": "^25.3.1",
"crypto-js": "4.2.0",

@@ -91,0 +90,0 @@ "esbuild": "0.27.3",

+0
-0

@@ -0,0 +0,0 @@ interface AiTool {

interface TriggersTool {
click(elem: string): void
change(elem: string): void
input(elem: string): void
/**
* Add a trigger for custom events.
* @param event - The event name
* @param callback - The callback to execute when the event is triggered
*/
add: (event: string, callback: (...args: any[]) => void) => void
/**
* Listen for a trigger event (alias for add).
*/
on: (event: string, callback: (...args: any[]) => void) => void
/**
* Emit a trigger event and call all registered callbacks.
* @param event - The event name
* @param args - Arguments to pass to the callbacks
*/
emit: (event: string, ...args: any[]) => void
/**
* Remove a trigger event and all its callbacks.
* @param event - The event name
*/
remove: (event: string) => void
/**
* Remove a specific callback from an event.
* @param event - The event name
* @param callback - The callback to remove
*/
off: (event: string, callback: (...args: any[]) => void) => void
/**
* Clear all triggers.
*/
clear: () => void
/**
* List all registered trigger events.
* @returns Array of event names
*/
list: () => string[]
}

@@ -341,2 +341,48 @@ /*!

// --- sandbox ---
interface SandboxOptions {
timeout?: number
memoryLimit?: number
allowGlobals?: boolean
allowConsole?: boolean
}
interface AgentSandboxOptions {
maxTokens?: number
maxOperations?: number
allowRead?: boolean
allowWrite?: boolean
allowNetwork?: boolean
blockedAPIs?: string[]
}
interface AgentContext {
id: string
created: number
operations: number
tokens: number
blocked: boolean
data: Record<string, any>
}
interface IsolatedSandbox {
run: (code: string) => any
eval: (expr: string) => any
setGlobal: (key: string, value: any) => void
getGlobal: (key: string) => any
}
interface SandboxTool {
run: (code: string, options?: SandboxOptions) => Promise<any>
eval: (expr: string) => any
createAgent: (options?: AgentSandboxOptions) => string
agentRun: (agentId: string, code: string) => Promise<any>
blockFS: () => void
blockNetwork: () => void
isolate: (globals?: Record<string, any>) => IsolatedSandbox
reset: () => void
listAgents: () => AgentContext[]
killAgent: (agentId: string) => boolean
}
// --- sanitize ---

@@ -490,5 +536,44 @@ interface SanitizeTool {

interface TriggersTool {
click(elem: string): void
change(elem: string): void
input(elem: string): void
/**
* Add a trigger for custom events.
* @param event - The event name
* @param callback - The callback to execute when the event is triggered
*/
add: (event: string, callback: (...args: any[]) => void) => void
/**
* Listen for a trigger event (alias for add).
*/
on: (event: string, callback: (...args: any[]) => void) => void
/**
* Emit a trigger event and call all registered callbacks.
* @param event - The event name
* @param args - Arguments to pass to the callbacks
*/
emit: (event: string, ...args: any[]) => void
/**
* Remove a trigger event and all its callbacks.
* @param event - The event name
*/
remove: (event: string) => void
/**
* Remove a specific callback from an event.
* @param event - The event name
* @param callback - The callback to remove
*/
off: (event: string, callback: (...args: any[]) => void) => void
/**
* Clear all triggers.
*/
clear: () => void
/**
* List all registered trigger events.
* @returns Array of event names
*/
list: () => string[]
}

@@ -554,2 +639,3 @@

promise: PromiseTool
sandbox: SandboxTool
sanitize: SanitizeTool

@@ -556,0 +642,0 @@ screen: ScreenTool

// dphelper postinstall
// Creates node_modules/@types/dphelper/index.d.ts automatically so TypeScript
// discovers dphelper's global types without any configuration in the consumer project.
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const
__dirname = path.dirname(fileURLToPath(import.meta.url)),
// When postinstall runs, cwd is the consuming project root.
// __dirname is node_modules/dphelper/
atTypesDir = path.join(__dirname, '..', '@types', 'dphelper'),
atTypesFile = path.join(atTypesDir, 'index.d.ts'),
reference = '/// <reference path="../../dphelper/types/dphelper.d.ts" />\n'
try {
fs.mkdirSync(atTypesDir, { recursive: true })
fs.writeFileSync(atTypesFile, reference, 'utf8')
console.debug('[dphelper] Global types registered at node_modules/@types/dphelper/index.d.ts')
} catch (e) {
// Non-fatal: types can still be referenced manually
console.debug('[dphelper] Could not auto-register types:', e)
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display