@mondaydotcomorg/atp-server 0.19.11 → 0.19.13
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/client-sessions.d.ts.map +1 -1
- package/dist/client-sessions.js +2 -3
- package/dist/client-sessions.js.map +1 -1
- package/dist/controllers/execute.controller.js +2 -2
- package/dist/controllers/execute.controller.js.map +1 -1
- package/dist/controllers/stream.controller.js +2 -2
- package/dist/controllers/stream.controller.js.map +1 -1
- package/dist/create-server.d.ts +1 -0
- package/dist/create-server.d.ts.map +1 -1
- package/dist/create-server.js +4 -0
- package/dist/create-server.js.map +1 -1
- package/dist/executor/execution-error-handler.js +2 -2
- package/dist/executor/execution-error-handler.js.map +1 -1
- package/dist/executor/executor.js +2 -2
- package/dist/executor/executor.js.map +1 -1
- package/dist/handlers/execute.handler.d.ts.map +1 -1
- package/dist/handlers/execute.handler.js +11 -6
- package/dist/handlers/execute.handler.js.map +1 -1
- package/dist/handlers/init.handler.js +2 -2
- package/dist/handlers/init.handler.js.map +1 -1
- package/dist/handlers/resume.handler.js +2 -2
- package/dist/handlers/resume.handler.js.map +1 -1
- package/dist/http/request-handler.js +2 -2
- package/dist/http/request-handler.js.map +1 -1
- package/dist/index.cjs +20 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -13
- package/dist/index.js.map +1 -1
- package/package.json +6 -7
- package/src/client-sessions.ts +2 -3
- package/src/controllers/execute.controller.ts +2 -2
- package/src/controllers/stream.controller.ts +2 -2
- package/src/create-server.ts +4 -0
- package/src/executor/execution-error-handler.ts +2 -2
- package/src/executor/executor.ts +2 -2
- package/src/handlers/execute.handler.ts +11 -6
- package/src/handlers/init.handler.ts +2 -2
- package/src/handlers/resume.handler.ts +2 -2
- package/src/http/request-handler.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -5,8 +5,7 @@ import { createServer as createServer$1 } from 'http';
|
|
|
5
5
|
import { ProvenanceMode, ToolOperationType, ToolSensitivityLevel, CallbackType, ToolOperation, ExecutionStatus, sanitizeInput, MAX_CODE_SIZE, ExecutionErrorCode } from '@mondaydotcomorg/atp-protocol';
|
|
6
6
|
import { getProvenance, createProvenanceProxy, ProvenanceSource, setProvenanceExecutionId, SecurityPolicyEngine, createTrackingRuntime, registerProvenanceMetadata, instrumentCode, captureProvenanceSnapshot, cleanupProvenanceForExecution, clearProvenanceExecutionId, DynamicPolicyRegistry, getProvenanceForPrimitive, computeDigest, verifyProvenanceHints, restoreProvenanceSnapshot, markPrimitiveTainted, ProvenanceMode as ProvenanceMode$1, issueProvenanceToken } from '@mondaydotcomorg/atp-provenance';
|
|
7
7
|
export { ProvenanceMode, ProvenanceSecurityError, ProvenanceSource, SecurityPolicyEngine, auditSensitiveAccess, blockLLMRecipients, blockLLMRecipientsWithApproval, canRead, captureProvenanceState, cleanupProvenanceForExecution, clearProvenanceExecutionId, createCustomPolicy, createProvenanceProxy, createTrackingRuntime, getAllProvenance, getBuiltInPolicies, getBuiltInPoliciesWithApproval, getProvenance, getProvenanceForPrimitive, hasProvenance, instrumentCode, isPrimitiveTainted, markPrimitiveTainted, preventDataExfiltration, preventDataExfiltrationWithApproval, requireUserOrigin, requireUserOriginWithApproval, restoreProvenanceState, setProvenanceExecutionId } from '@mondaydotcomorg/atp-provenance';
|
|
8
|
-
import { randomBytes } from 'crypto';
|
|
9
|
-
import { nanoid } from 'nanoid';
|
|
8
|
+
import crypto, { randomBytes, randomUUID } from 'crypto';
|
|
10
9
|
import jwt from 'jsonwebtoken';
|
|
11
10
|
import ivm from 'isolated-vm';
|
|
12
11
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
@@ -6822,7 +6821,7 @@ var ClientSessionManager = class {
|
|
|
6822
6821
|
return jwt.sign({
|
|
6823
6822
|
clientId,
|
|
6824
6823
|
type: "client",
|
|
6825
|
-
jti:
|
|
6824
|
+
jti: randomUUID()
|
|
6826
6825
|
}, this.jwtSecret, {
|
|
6827
6826
|
expiresIn: 3600
|
|
6828
6827
|
});
|
|
@@ -9084,7 +9083,7 @@ function handleExecutionError(error, pauseError, context, executionId, callbackH
|
|
|
9084
9083
|
executionId,
|
|
9085
9084
|
status: ExecutionStatus.PAUSED,
|
|
9086
9085
|
needsCallbacks: batchErr.calls.map((call) => ({
|
|
9087
|
-
id:
|
|
9086
|
+
id: randomUUID(),
|
|
9088
9087
|
type: call.type,
|
|
9089
9088
|
operation: call.operation,
|
|
9090
9089
|
payload: call.payload
|
|
@@ -9352,7 +9351,7 @@ var SandboxExecutor = class {
|
|
|
9352
9351
|
this.compiler = compiler;
|
|
9353
9352
|
}
|
|
9354
9353
|
async execute(code, config, clientId, resumeData) {
|
|
9355
|
-
const executionId = resumeData?.executionId ||
|
|
9354
|
+
const executionId = resumeData?.executionId || randomUUID();
|
|
9356
9355
|
return runInExecutionContext(executionId, async () => {
|
|
9357
9356
|
return await this.executeInContext(executionId, clientId || "anonymous", code, config, resumeData);
|
|
9358
9357
|
});
|
|
@@ -10866,7 +10865,7 @@ async function handleHTTPRequest(req, res, deps, responseHeaders) {
|
|
|
10866
10865
|
path: ctx.path
|
|
10867
10866
|
});
|
|
10868
10867
|
}
|
|
10869
|
-
handleError(res, error,
|
|
10868
|
+
handleError(res, error, randomUUID(), headers);
|
|
10870
10869
|
} catch (handlerError) {
|
|
10871
10870
|
try {
|
|
10872
10871
|
if (!res.headersSent) {
|
|
@@ -10951,7 +10950,7 @@ async function handleInit(ctx, sessionManager, auditSink) {
|
|
|
10951
10950
|
const result = await sessionManager.initClient(request || {});
|
|
10952
10951
|
if (auditSink) {
|
|
10953
10952
|
const event = {
|
|
10954
|
-
eventId:
|
|
10953
|
+
eventId: randomUUID(),
|
|
10955
10954
|
timestamp: Date.now(),
|
|
10956
10955
|
clientId: result.clientId,
|
|
10957
10956
|
eventType: "client_init",
|
|
@@ -11200,7 +11199,7 @@ async function handleExecute(ctx, executor, stateManager, config, auditSink, ses
|
|
|
11200
11199
|
}
|
|
11201
11200
|
const onToolCall = auditSink ? (event) => {
|
|
11202
11201
|
const auditEvent = {
|
|
11203
|
-
eventId:
|
|
11202
|
+
eventId: crypto.randomUUID(),
|
|
11204
11203
|
timestamp: Date.now(),
|
|
11205
11204
|
clientId: ctx.clientId || "anonymous",
|
|
11206
11205
|
eventType: "tool_call",
|
|
@@ -11231,11 +11230,16 @@ async function handleExecute(ctx, executor, stateManager, config, auditSink, ses
|
|
|
11231
11230
|
provenanceMode: requestConfig.provenanceMode || config.execution.provenanceMode || ProvenanceMode.NONE,
|
|
11232
11231
|
securityPolicies: config.execution.securityPolicies || [],
|
|
11233
11232
|
provenanceHints: requestConfig.provenanceHints,
|
|
11234
|
-
requestContext:
|
|
11233
|
+
requestContext: {
|
|
11234
|
+
...requestConfig.requestContext,
|
|
11235
|
+
headers: ctx.headers,
|
|
11236
|
+
path: ctx.path,
|
|
11237
|
+
method: ctx.method
|
|
11238
|
+
},
|
|
11235
11239
|
onToolCall
|
|
11236
11240
|
};
|
|
11237
11241
|
let hintMap;
|
|
11238
|
-
const prelimExecutionId =
|
|
11242
|
+
const prelimExecutionId = crypto.randomUUID();
|
|
11239
11243
|
if (executionConfig.provenanceHints && executionConfig.provenanceHints.length > 0 && executionConfig.provenanceMode !== ProvenanceMode.NONE && ctx.cache) {
|
|
11240
11244
|
try {
|
|
11241
11245
|
if (executionConfig.provenanceHints.length > 1e3) {
|
|
@@ -11270,7 +11274,7 @@ async function handleExecute(ctx, executor, stateManager, config, auditSink, ses
|
|
|
11270
11274
|
const startTime = Date.now();
|
|
11271
11275
|
if (auditSink) {
|
|
11272
11276
|
const startEvent = {
|
|
11273
|
-
eventId:
|
|
11277
|
+
eventId: crypto.randomUUID(),
|
|
11274
11278
|
timestamp: startTime,
|
|
11275
11279
|
clientId: ctx.clientId || "anonymous",
|
|
11276
11280
|
eventType: "execution",
|
|
@@ -11336,7 +11340,7 @@ async function handleExecute(ctx, executor, stateManager, config, auditSink, ses
|
|
|
11336
11340
|
}
|
|
11337
11341
|
if (auditSink) {
|
|
11338
11342
|
const endEvent = {
|
|
11339
|
-
eventId:
|
|
11343
|
+
eventId: crypto.randomUUID(),
|
|
11340
11344
|
timestamp: Date.now(),
|
|
11341
11345
|
clientId: ctx.clientId || "anonymous",
|
|
11342
11346
|
eventType: "execution",
|
|
@@ -11399,7 +11403,7 @@ function tagCallbackResult(callbackRecord, result, provenanceMode) {
|
|
|
11399
11403
|
}
|
|
11400
11404
|
if (typeof value === "string" || typeof value === "number") {
|
|
11401
11405
|
const metadata = {
|
|
11402
|
-
id:
|
|
11406
|
+
id: randomUUID(),
|
|
11403
11407
|
source,
|
|
11404
11408
|
readers: {
|
|
11405
11409
|
type: "public"
|
|
@@ -21767,9 +21771,12 @@ var AgentToolProtocolServer = class {
|
|
|
21767
21771
|
targetGroup = {
|
|
21768
21772
|
name: groupName,
|
|
21769
21773
|
type: "custom",
|
|
21774
|
+
description: definition.groupDescription,
|
|
21770
21775
|
functions: []
|
|
21771
21776
|
};
|
|
21772
21777
|
this.apiGroups.push(targetGroup);
|
|
21778
|
+
} else if (definition.groupDescription && !targetGroup.description) {
|
|
21779
|
+
targetGroup.description = definition.groupDescription;
|
|
21773
21780
|
}
|
|
21774
21781
|
targetGroup.functions.push({
|
|
21775
21782
|
name,
|