@ai-agent-forge/plugin-process-exec 0.88.10 → 0.88.12

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/README.md CHANGED
@@ -16,7 +16,7 @@ hosts get no tool registration at all.
16
16
  agent-forge plugin install ./plugins/process-exec
17
17
 
18
18
  # from npm
19
- agent-forge plugin install @agent-forge/plugin-process-exec
19
+ agent-forge plugin install @ai-agent-forge/plugin-process-exec
20
20
  ```
21
21
 
22
22
  The package ships two manifests: `agent-forge.json` (ecosystem manifest for the deterministic plugin resolver) and
package/agent-forge.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "packageFormatVersion": 1,
3
3
  "id": "agent-forge.plugin.process-exec",
4
- "pluginVersion": "0.88.10",
4
+ "pluginVersion": "0.88.12",
5
5
  "apiVersion": "1",
6
6
  "minHostVersion": "0.84.4",
7
7
  "capabilityRefs": [
@@ -1 +1 @@
1
- {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAU3E,OAAO,KAAK,EAAE,oBAAoB,EAA6C,MAAM,YAAY,CAAC;AAiLlG,gEAAgE;AAChE,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,oBAAoB,GAAG,2BAA2B,CAmD/G","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport type { CapabilityPluginSyncFactory } from \"@agent-forge/plugin-sdk\";\nimport { validatePluginErrorV1 } from \"@agent-forge/plugin-sdk\";\nimport { Type } from \"typebox\";\nimport { Value } from \"typebox/value\";\nimport {\n\tPROCESS_EXEC_MAX_OPERATION_ID_CHARS_V1,\n\tPROCESS_EXEC_MAX_OUTPUT_BYTES_V1,\n\tPROCESS_EXEC_MAX_PREVIEW_BYTES_V1,\n\tsanitizeProcessTextV1,\n} from \"./node-adapter.ts\";\nimport type { ProcessExecAdapterV1, ProcessExecRequestV1, ProcessExecResultV1 } from \"./types.ts\";\n\nconst requestSchema = Type.Object(\n\t{\n\t\tcommand: Type.String({ minLength: 1, maxLength: 512, pattern: \"^[^\\\\u0000\\\\r\\\\n]+$\" }),\n\t\targs: Type.Array(Type.String({ maxLength: 4096, pattern: \"^[^\\\\u0000\\\\r\\\\n]*$\" }), { maxItems: 256 }),\n\t\ttimeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: 120_000 })),\n\t},\n\t{ additionalProperties: false },\n);\nconst inputSchema = Type.Object({ request: requestSchema }, { additionalProperties: false });\n\nconst INVALID_ERROR = Symbol(\"process-exec-invalid-error\");\n\nfunction generatedOperationId(): string {\n\treturn `profile-runtime-tool-call-${randomUUID()}`;\n}\n\nfunction objectInput(first: unknown, second: unknown): Record<string, unknown> {\n\t// Shape-based dual-convention read (aligned with subagent-delegate): the\n\t// runtime invoke face passes the input object first and the host\n\t// CapabilityToolContext second; the agent tool face passes the tool call\n\t// id (a string) first and the params object second.\n\tconst value = first !== null && typeof first === \"object\" && !Array.isArray(first) ? first : second;\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value))\n\t\tthrow new Error(\"Process input must be an object\");\n\treturn value as Record<string, unknown>;\n}\n\nfunction operationIdFor(first: unknown, second: unknown): string {\n\tconst explicitOperationId = typeof first === \"string\" && second !== undefined ? first : undefined;\n\treturn typeof explicitOperationId === \"string\" &&\n\t\texplicitOperationId.trim() !== \"\" &&\n\t\texplicitOperationId.length <= PROCESS_EXEC_MAX_OPERATION_ID_CHARS_V1 &&\n\t\t![...explicitOperationId].some((character) => /[\\u0000-\\u001f\\u007f]/u.test(character))\n\t\t? explicitOperationId\n\t\t: generatedOperationId();\n}\n\nfunction invocation(\n\tfirst: unknown,\n\tsecond: unknown,\n): { readonly input: Record<string, unknown>; readonly operationId: string } {\n\treturn {\n\t\tinput: objectInput(first, second),\n\t\toperationId: operationIdFor(first, second),\n\t};\n}\n\nfunction signalFrom(value: unknown): AbortSignal | undefined {\n\treturn value instanceof AbortSignal ? value : undefined;\n}\n\nfunction cancelled(operationId: string): ProcessExecResultV1 {\n\treturn {\n\t\tversion: 1,\n\t\toperationId,\n\t\tstatus: \"cancelled\",\n\t\tsummary: \"Process execution was cancelled\",\n\t\tstdoutBytes: 0,\n\t\tstderrBytes: 0,\n\t\tstdoutPreview: \"\",\n\t\tstderrPreview: \"\",\n\t\tstdoutTruncated: false,\n\t\tstderrTruncated: false,\n\t\terror: { version: 1, code: \"cancelled\", message: \"Process execution was cancelled\" },\n\t};\n}\n\nfunction malformed(operationId: string): ProcessExecResultV1 {\n\treturn {\n\t\t...cancelled(operationId),\n\t\tstatus: \"failed\",\n\t\tsummary: \"Process adapter returned an invalid result\",\n\t\terror: { version: 1, code: \"adapter_failed\", message: \"Process adapter returned an invalid result\" },\n\t};\n}\n\nfunction invalidInput(operationId: string): ProcessExecResultV1 {\n\treturn {\n\t\t...cancelled(operationId),\n\t\tstatus: \"failed\",\n\t\tsummary: \"Process request was invalid\",\n\t\terror: { version: 1, code: \"invalid_input\", message: \"Process request was invalid\" },\n\t};\n}\n\nfunction boundedError(value: unknown): ProcessExecResultV1[\"error\"] | typeof INVALID_ERROR | undefined {\n\tif (value === undefined) return undefined;\n\ttry {\n\t\tconst error = validatePluginErrorV1(value, \"Process adapter error\");\n\t\tif (\n\t\t\terror.code.length > 128 ||\n\t\t\terror.message.length > 512 ||\n\t\t\t(error.causeCode !== undefined && error.causeCode.length > 128)\n\t\t)\n\t\t\treturn INVALID_ERROR;\n\t\treturn {\n\t\t\tversion: 1,\n\t\t\tcode: error.code,\n\t\t\tmessage: sanitizeProcessTextV1(error.message, 512),\n\t\t\t...(error.causeCode === undefined ? {} : { causeCode: error.causeCode }),\n\t\t};\n\t} catch {\n\t\treturn INVALID_ERROR;\n\t}\n}\n\nfunction boundedResult(value: unknown, operationId: string): ProcessExecResultV1 {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) return malformed(operationId);\n\tconst result = value as Record<string, unknown>;\n\tconst exitCode = result.exitCode;\n\tconst stdoutBytes = typeof result.stdoutBytes === \"number\" ? result.stdoutBytes : undefined;\n\tconst stderrBytes = typeof result.stderrBytes === \"number\" ? result.stderrBytes : undefined;\n\tif (\n\t\tresult.version !== 1 ||\n\t\tresult.operationId !== operationId ||\n\t\ttypeof result.status !== \"string\" ||\n\t\t![\"succeeded\", \"failed\", \"cancelled\", \"needs_user\", \"unsupported\"].includes(result.status) ||\n\t\ttypeof result.summary !== \"string\" ||\n\t\tresult.summary.length > 2048 ||\n\t\tstdoutBytes === undefined ||\n\t\tstderrBytes === undefined ||\n\t\t!Number.isSafeInteger(stdoutBytes) ||\n\t\t!Number.isSafeInteger(stderrBytes) ||\n\t\tstdoutBytes < 0 ||\n\t\tstderrBytes < 0 ||\n\t\tstdoutBytes > PROCESS_EXEC_MAX_OUTPUT_BYTES_V1 ||\n\t\tstderrBytes > PROCESS_EXEC_MAX_OUTPUT_BYTES_V1 ||\n\t\ttypeof result.stdoutPreview !== \"string\" ||\n\t\ttypeof result.stderrPreview !== \"string\" ||\n\t\tresult.stdoutPreview.length > PROCESS_EXEC_MAX_PREVIEW_BYTES_V1 ||\n\t\tresult.stderrPreview.length > PROCESS_EXEC_MAX_PREVIEW_BYTES_V1 ||\n\t\t(stdoutBytes === 0 && result.stdoutPreview.length !== 0) ||\n\t\t(stderrBytes === 0 && result.stderrPreview.length !== 0) ||\n\t\ttypeof result.stdoutTruncated !== \"boolean\" ||\n\t\ttypeof result.stderrTruncated !== \"boolean\"\n\t)\n\t\treturn malformed(operationId);\n\tconst status = result.status as ProcessExecResultV1[\"status\"];\n\tif (\n\t\t(exitCode !== undefined && (typeof exitCode !== \"number\" || !Number.isSafeInteger(exitCode) || exitCode < 0)) ||\n\t\t(status === \"succeeded\" && result.error !== undefined)\n\t)\n\t\treturn malformed(operationId);\n\tconst error = boundedError(result.error);\n\tif (error === INVALID_ERROR || (status !== \"succeeded\" && error === undefined)) return malformed(operationId);\n\tconst projected: ProcessExecResultV1 = {\n\t\tversion: 1,\n\t\toperationId,\n\t\tstatus,\n\t\tsummary: sanitizeProcessTextV1(result.summary as string, 2048),\n\t\t...(exitCode === undefined ? {} : { exitCode: exitCode as number }),\n\t\tstdoutBytes,\n\t\tstderrBytes,\n\t\tstdoutPreview: sanitizeProcessTextV1(result.stdoutPreview as string),\n\t\tstderrPreview: sanitizeProcessTextV1(result.stderrPreview as string),\n\t\tstdoutTruncated: result.stdoutTruncated as boolean,\n\t\tstderrTruncated: result.stderrTruncated as boolean,\n\t\t...(error === undefined ? {} : { error }),\n\t};\n\tif (new TextEncoder().encode(JSON.stringify(projected)).byteLength > 64 * 1024) return malformed(operationId);\n\treturn projected;\n}\n\nasync function runWithCancellation(\n\trun: () => Promise<ProcessExecResultV1>,\n\tsignal: AbortSignal | undefined,\n\toperationId: string,\n): Promise<ProcessExecResultV1> {\n\t// The adapter owns cancellation and must settle after it has drained its\n\t// child/process resources. Do not race the adapter with a local cancellation\n\t// promise: that would return before the host has finished cleanup.\n\tconst output = await run();\n\treturn signal?.aborted && output.status !== \"cancelled\" ? cancelled(operationId) : output;\n}\n\n/** Registers process execution only for a full-control host. */\nexport function createProcessExecCapabilityFactoryV1(runtime: ProcessExecAdapterV1): CapabilityPluginSyncFactory {\n\treturn (api) => {\n\t\tif (api.host.mode === \"readonly\") return;\n\t\tapi.registerTool({\n\t\t\tname: \"process_exec\",\n\t\t\tlabel: \"Process exec\",\n\t\t\tdescription: \"Run an argv command through the selected host process adapter with bounded output\",\n\t\t\tparameters: inputSchema,\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tlet invocationResult: { readonly input: Record<string, unknown>; readonly operationId: string };\n\t\t\t\ttry {\n\t\t\t\t\tinvocationResult = invocation(first, second);\n\t\t\t\t} catch {\n\t\t\t\t\treturn invalidInput(operationIdFor(first, second));\n\t\t\t\t}\n\t\t\t\tconst { input, operationId } = invocationResult;\n\t\t\t\tconst signal = signalFrom(third);\n\t\t\t\tif (signal?.aborted) return cancelled(operationId);\n\t\t\t\tlet request: ProcessExecRequestV1;\n\t\t\t\ttry {\n\t\t\t\t\tif (!Value.Check(inputSchema, input)) return invalidInput(operationId);\n\t\t\t\t\tconst requestInput = objectInput(input.request, undefined);\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof requestInput.command !== \"string\" ||\n\t\t\t\t\t\trequestInput.command.trim() === \"\" ||\n\t\t\t\t\t\t!Array.isArray(requestInput.args) ||\n\t\t\t\t\t\trequestInput.args.some((arg) => typeof arg !== \"string\")\n\t\t\t\t\t)\n\t\t\t\t\t\treturn invalidInput(operationId);\n\t\t\t\t\tconst command = requestInput.command as string;\n\t\t\t\t\tconst args = requestInput.args as string[];\n\t\t\t\t\tconst timeoutMs = requestInput.timeoutMs as number | undefined;\n\t\t\t\t\trequest = {\n\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\toperationId,\n\t\t\t\t\t\tcommand,\n\t\t\t\t\t\targs,\n\t\t\t\t\t\t...(timeoutMs === undefined ? {} : { timeoutMs }),\n\t\t\t\t\t};\n\t\t\t\t} catch {\n\t\t\t\t\treturn invalidInput(operationId);\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst output = await runWithCancellation(() => runtime.run(request, signal), signal, operationId);\n\t\t\t\t\treturn boundedResult(output, operationId);\n\t\t\t\t} catch {\n\t\t\t\t\treturn signal?.aborted ? cancelled(operationId) : malformed(operationId);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t};\n}\n"]}
1
+ {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAS3E,OAAO,KAAK,EAAE,oBAAoB,EAA6C,MAAM,YAAY,CAAC;AA+KlG,gEAAgE;AAChE,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,oBAAoB,GAAG,2BAA2B,CAmD/G","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport type { CapabilityPluginSyncFactory } from \"@agent-forge/plugin-sdk\";\nimport { validatePluginErrorV1 } from \"@agent-forge/plugin-sdk\";\nimport { Type } from \"typebox\";\nimport { Value } from \"typebox/value\";\nimport {\n\tPROCESS_EXEC_MAX_OPERATION_ID_CHARS_V1,\n\tPROCESS_EXEC_MAX_PREVIEW_BYTES_V1,\n\tsanitizeProcessTextV1,\n} from \"./node-adapter.ts\";\nimport type { ProcessExecAdapterV1, ProcessExecRequestV1, ProcessExecResultV1 } from \"./types.ts\";\n\nconst requestSchema = Type.Object(\n\t{\n\t\tcommand: Type.String({ minLength: 1, maxLength: 512, pattern: \"^[^\\\\u0000\\\\r\\\\n]+$\" }),\n\t\targs: Type.Array(Type.String({ maxLength: 4096, pattern: \"^[^\\\\u0000\\\\r\\\\n]*$\" }), { maxItems: 256 }),\n\t\ttimeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: 120_000 })),\n\t},\n\t{ additionalProperties: false },\n);\nconst inputSchema = Type.Object({ request: requestSchema }, { additionalProperties: false });\n\nconst INVALID_ERROR = Symbol(\"process-exec-invalid-error\");\n\nfunction generatedOperationId(): string {\n\treturn `profile-runtime-tool-call-${randomUUID()}`;\n}\n\nfunction objectInput(first: unknown, second: unknown): Record<string, unknown> {\n\t// Shape-based dual-convention read (aligned with subagent-delegate): the\n\t// runtime invoke face passes the input object first and the host\n\t// CapabilityToolContext second; the agent tool face passes the tool call\n\t// id (a string) first and the params object second.\n\tconst value = first !== null && typeof first === \"object\" && !Array.isArray(first) ? first : second;\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value))\n\t\tthrow new Error(\"Process input must be an object\");\n\treturn value as Record<string, unknown>;\n}\n\nfunction operationIdFor(first: unknown, second: unknown): string {\n\tconst explicitOperationId = typeof first === \"string\" && second !== undefined ? first : undefined;\n\treturn typeof explicitOperationId === \"string\" &&\n\t\texplicitOperationId.trim() !== \"\" &&\n\t\texplicitOperationId.length <= PROCESS_EXEC_MAX_OPERATION_ID_CHARS_V1 &&\n\t\t![...explicitOperationId].some((character) => /[\\u0000-\\u001f\\u007f]/u.test(character))\n\t\t? explicitOperationId\n\t\t: generatedOperationId();\n}\n\nfunction invocation(\n\tfirst: unknown,\n\tsecond: unknown,\n): { readonly input: Record<string, unknown>; readonly operationId: string } {\n\treturn {\n\t\tinput: objectInput(first, second),\n\t\toperationId: operationIdFor(first, second),\n\t};\n}\n\nfunction signalFrom(value: unknown): AbortSignal | undefined {\n\treturn value instanceof AbortSignal ? value : undefined;\n}\n\nfunction cancelled(operationId: string): ProcessExecResultV1 {\n\treturn {\n\t\tversion: 1,\n\t\toperationId,\n\t\tstatus: \"cancelled\",\n\t\tsummary: \"Process execution was cancelled\",\n\t\tstdoutBytes: 0,\n\t\tstderrBytes: 0,\n\t\tstdoutPreview: \"\",\n\t\tstderrPreview: \"\",\n\t\tstdoutTruncated: false,\n\t\tstderrTruncated: false,\n\t\terror: { version: 1, code: \"cancelled\", message: \"Process execution was cancelled\" },\n\t};\n}\n\nfunction malformed(operationId: string): ProcessExecResultV1 {\n\treturn {\n\t\t...cancelled(operationId),\n\t\tstatus: \"failed\",\n\t\tsummary: \"Process adapter returned an invalid result\",\n\t\terror: { version: 1, code: \"adapter_failed\", message: \"Process adapter returned an invalid result\" },\n\t};\n}\n\nfunction invalidInput(operationId: string): ProcessExecResultV1 {\n\treturn {\n\t\t...cancelled(operationId),\n\t\tstatus: \"failed\",\n\t\tsummary: \"Process request was invalid\",\n\t\terror: { version: 1, code: \"invalid_input\", message: \"Process request was invalid\" },\n\t};\n}\n\nfunction boundedError(value: unknown): ProcessExecResultV1[\"error\"] | typeof INVALID_ERROR | undefined {\n\tif (value === undefined) return undefined;\n\ttry {\n\t\tconst error = validatePluginErrorV1(value, \"Process adapter error\");\n\t\tif (\n\t\t\terror.code.length > 128 ||\n\t\t\terror.message.length > 512 ||\n\t\t\t(error.causeCode !== undefined && error.causeCode.length > 128)\n\t\t)\n\t\t\treturn INVALID_ERROR;\n\t\treturn {\n\t\t\tversion: 1,\n\t\t\tcode: error.code,\n\t\t\tmessage: sanitizeProcessTextV1(error.message, 512),\n\t\t\t...(error.causeCode === undefined ? {} : { causeCode: error.causeCode }),\n\t\t};\n\t} catch {\n\t\treturn INVALID_ERROR;\n\t}\n}\n\nfunction boundedResult(value: unknown, operationId: string): ProcessExecResultV1 {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) return malformed(operationId);\n\tconst result = value as Record<string, unknown>;\n\tconst exitCode = result.exitCode;\n\tconst stdoutBytes = typeof result.stdoutBytes === \"number\" ? result.stdoutBytes : undefined;\n\tconst stderrBytes = typeof result.stderrBytes === \"number\" ? result.stderrBytes : undefined;\n\tif (\n\t\tresult.version !== 1 ||\n\t\tresult.operationId !== operationId ||\n\t\ttypeof result.status !== \"string\" ||\n\t\t![\"succeeded\", \"failed\", \"cancelled\", \"needs_user\", \"unsupported\"].includes(result.status) ||\n\t\ttypeof result.summary !== \"string\" ||\n\t\tresult.summary.length > 2048 ||\n\t\tstdoutBytes === undefined ||\n\t\tstderrBytes === undefined ||\n\t\t!Number.isSafeInteger(stdoutBytes) ||\n\t\t!Number.isSafeInteger(stderrBytes) ||\n\t\tstdoutBytes < 0 ||\n\t\tstderrBytes < 0 ||\n\t\ttypeof result.stdoutPreview !== \"string\" ||\n\t\ttypeof result.stderrPreview !== \"string\" ||\n\t\tresult.stdoutPreview.length > PROCESS_EXEC_MAX_PREVIEW_BYTES_V1 ||\n\t\tresult.stderrPreview.length > PROCESS_EXEC_MAX_PREVIEW_BYTES_V1 ||\n\t\t(stdoutBytes === 0 && result.stdoutPreview.length !== 0) ||\n\t\t(stderrBytes === 0 && result.stderrPreview.length !== 0) ||\n\t\ttypeof result.stdoutTruncated !== \"boolean\" ||\n\t\ttypeof result.stderrTruncated !== \"boolean\"\n\t)\n\t\treturn malformed(operationId);\n\tconst status = result.status as ProcessExecResultV1[\"status\"];\n\tif (\n\t\t(exitCode !== undefined && (typeof exitCode !== \"number\" || !Number.isSafeInteger(exitCode) || exitCode < 0)) ||\n\t\t(status === \"succeeded\" && result.error !== undefined)\n\t)\n\t\treturn malformed(operationId);\n\tconst error = boundedError(result.error);\n\tif (error === INVALID_ERROR || (status !== \"succeeded\" && error === undefined)) return malformed(operationId);\n\tconst projected: ProcessExecResultV1 = {\n\t\tversion: 1,\n\t\toperationId,\n\t\tstatus,\n\t\tsummary: sanitizeProcessTextV1(result.summary as string, 2048),\n\t\t...(exitCode === undefined ? {} : { exitCode: exitCode as number }),\n\t\tstdoutBytes,\n\t\tstderrBytes,\n\t\tstdoutPreview: sanitizeProcessTextV1(result.stdoutPreview as string),\n\t\tstderrPreview: sanitizeProcessTextV1(result.stderrPreview as string),\n\t\tstdoutTruncated: result.stdoutTruncated as boolean,\n\t\tstderrTruncated: result.stderrTruncated as boolean,\n\t\t...(error === undefined ? {} : { error }),\n\t};\n\tif (new TextEncoder().encode(JSON.stringify(projected)).byteLength > 64 * 1024) return malformed(operationId);\n\treturn projected;\n}\n\nasync function runWithCancellation(\n\trun: () => Promise<ProcessExecResultV1>,\n\tsignal: AbortSignal | undefined,\n\toperationId: string,\n): Promise<ProcessExecResultV1> {\n\t// The adapter owns cancellation and must settle after it has drained its\n\t// child/process resources. Do not race the adapter with a local cancellation\n\t// promise: that would return before the host has finished cleanup.\n\tconst output = await run();\n\treturn signal?.aborted && output.status !== \"cancelled\" ? cancelled(operationId) : output;\n}\n\n/** Registers process execution only for a full-control host. */\nexport function createProcessExecCapabilityFactoryV1(runtime: ProcessExecAdapterV1): CapabilityPluginSyncFactory {\n\treturn (api) => {\n\t\tif (api.host.mode === \"readonly\") return;\n\t\tapi.registerTool({\n\t\t\tname: \"process_exec\",\n\t\t\tlabel: \"Process exec\",\n\t\t\tdescription: \"Run an argv command through the selected host process adapter with bounded output\",\n\t\t\tparameters: inputSchema,\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tlet invocationResult: { readonly input: Record<string, unknown>; readonly operationId: string };\n\t\t\t\ttry {\n\t\t\t\t\tinvocationResult = invocation(first, second);\n\t\t\t\t} catch {\n\t\t\t\t\treturn invalidInput(operationIdFor(first, second));\n\t\t\t\t}\n\t\t\t\tconst { input, operationId } = invocationResult;\n\t\t\t\tconst signal = signalFrom(third);\n\t\t\t\tif (signal?.aborted) return cancelled(operationId);\n\t\t\t\tlet request: ProcessExecRequestV1;\n\t\t\t\ttry {\n\t\t\t\t\tif (!Value.Check(inputSchema, input)) return invalidInput(operationId);\n\t\t\t\t\tconst requestInput = objectInput(input.request, undefined);\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof requestInput.command !== \"string\" ||\n\t\t\t\t\t\trequestInput.command.trim() === \"\" ||\n\t\t\t\t\t\t!Array.isArray(requestInput.args) ||\n\t\t\t\t\t\trequestInput.args.some((arg) => typeof arg !== \"string\")\n\t\t\t\t\t)\n\t\t\t\t\t\treturn invalidInput(operationId);\n\t\t\t\t\tconst command = requestInput.command as string;\n\t\t\t\t\tconst args = requestInput.args as string[];\n\t\t\t\t\tconst timeoutMs = requestInput.timeoutMs as number | undefined;\n\t\t\t\t\trequest = {\n\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\toperationId,\n\t\t\t\t\t\tcommand,\n\t\t\t\t\t\targs,\n\t\t\t\t\t\t...(timeoutMs === undefined ? {} : { timeoutMs }),\n\t\t\t\t\t};\n\t\t\t\t} catch {\n\t\t\t\t\treturn invalidInput(operationId);\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst output = await runWithCancellation(() => runtime.run(request, signal), signal, operationId);\n\t\t\t\t\treturn boundedResult(output, operationId);\n\t\t\t\t} catch {\n\t\t\t\t\treturn signal?.aborted ? cancelled(operationId) : malformed(operationId);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t};\n}\n"]}
@@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto";
2
2
  import { validatePluginErrorV1 } from "@agent-forge/plugin-sdk";
3
3
  import { Type } from "typebox";
4
4
  import { Value } from "typebox/value";
5
- import { PROCESS_EXEC_MAX_OPERATION_ID_CHARS_V1, PROCESS_EXEC_MAX_OUTPUT_BYTES_V1, PROCESS_EXEC_MAX_PREVIEW_BYTES_V1, sanitizeProcessTextV1, } from "./node-adapter.js";
5
+ import { PROCESS_EXEC_MAX_OPERATION_ID_CHARS_V1, PROCESS_EXEC_MAX_PREVIEW_BYTES_V1, sanitizeProcessTextV1, } from "./node-adapter.js";
6
6
  const requestSchema = Type.Object({
7
7
  command: Type.String({ minLength: 1, maxLength: 512, pattern: "^[^\\u0000\\r\\n]+$" }),
8
8
  args: Type.Array(Type.String({ maxLength: 4096, pattern: "^[^\\u0000\\r\\n]*$" }), { maxItems: 256 }),
@@ -111,8 +111,6 @@ function boundedResult(value, operationId) {
111
111
  !Number.isSafeInteger(stderrBytes) ||
112
112
  stdoutBytes < 0 ||
113
113
  stderrBytes < 0 ||
114
- stdoutBytes > PROCESS_EXEC_MAX_OUTPUT_BYTES_V1 ||
115
- stderrBytes > PROCESS_EXEC_MAX_OUTPUT_BYTES_V1 ||
116
114
  typeof result.stdoutPreview !== "string" ||
117
115
  typeof result.stderrPreview !== "string" ||
118
116
  result.stdoutPreview.length > PROCESS_EXEC_MAX_PREVIEW_BYTES_V1 ||
@@ -1 +1 @@
1
- {"version":3,"file":"capability.js","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EACN,sCAAsC,EACtC,gCAAgC,EAChC,iCAAiC,EACjC,qBAAqB,GACrB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAChC;IACC,OAAO,EAAE,IAAI,CAAC,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,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;qBACjD,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;oBACR,OAAO,YAAY,CAAC,WAAW,CAAC,CAAC;gBAClC,CAAC;gBACD,IAAI,CAAC;oBACJ,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;oBAClG,OAAO,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;gBAC3C,CAAC;gBAAC,MAAM,CAAC;oBACR,OAAO,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;gBAC1E,CAAC;YAAA,CACD;SACD,CAAC,CAAC;IAAA,CACH,CAAC;AAAA,CACF","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport type { CapabilityPluginSyncFactory } from \"@agent-forge/plugin-sdk\";\nimport { validatePluginErrorV1 } from \"@agent-forge/plugin-sdk\";\nimport { Type } from \"typebox\";\nimport { Value } from \"typebox/value\";\nimport {\n\tPROCESS_EXEC_MAX_OPERATION_ID_CHARS_V1,\n\tPROCESS_EXEC_MAX_OUTPUT_BYTES_V1,\n\tPROCESS_EXEC_MAX_PREVIEW_BYTES_V1,\n\tsanitizeProcessTextV1,\n} from \"./node-adapter.ts\";\nimport type { ProcessExecAdapterV1, ProcessExecRequestV1, ProcessExecResultV1 } from \"./types.ts\";\n\nconst requestSchema = Type.Object(\n\t{\n\t\tcommand: Type.String({ minLength: 1, maxLength: 512, pattern: \"^[^\\\\u0000\\\\r\\\\n]+$\" }),\n\t\targs: Type.Array(Type.String({ maxLength: 4096, pattern: \"^[^\\\\u0000\\\\r\\\\n]*$\" }), { maxItems: 256 }),\n\t\ttimeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: 120_000 })),\n\t},\n\t{ additionalProperties: false },\n);\nconst inputSchema = Type.Object({ request: requestSchema }, { additionalProperties: false });\n\nconst INVALID_ERROR = Symbol(\"process-exec-invalid-error\");\n\nfunction generatedOperationId(): string {\n\treturn `profile-runtime-tool-call-${randomUUID()}`;\n}\n\nfunction objectInput(first: unknown, second: unknown): Record<string, unknown> {\n\t// Shape-based dual-convention read (aligned with subagent-delegate): the\n\t// runtime invoke face passes the input object first and the host\n\t// CapabilityToolContext second; the agent tool face passes the tool call\n\t// id (a string) first and the params object second.\n\tconst value = first !== null && typeof first === \"object\" && !Array.isArray(first) ? first : second;\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value))\n\t\tthrow new Error(\"Process input must be an object\");\n\treturn value as Record<string, unknown>;\n}\n\nfunction operationIdFor(first: unknown, second: unknown): string {\n\tconst explicitOperationId = typeof first === \"string\" && second !== undefined ? first : undefined;\n\treturn typeof explicitOperationId === \"string\" &&\n\t\texplicitOperationId.trim() !== \"\" &&\n\t\texplicitOperationId.length <= PROCESS_EXEC_MAX_OPERATION_ID_CHARS_V1 &&\n\t\t![...explicitOperationId].some((character) => /[\\u0000-\\u001f\\u007f]/u.test(character))\n\t\t? explicitOperationId\n\t\t: generatedOperationId();\n}\n\nfunction invocation(\n\tfirst: unknown,\n\tsecond: unknown,\n): { readonly input: Record<string, unknown>; readonly operationId: string } {\n\treturn {\n\t\tinput: objectInput(first, second),\n\t\toperationId: operationIdFor(first, second),\n\t};\n}\n\nfunction signalFrom(value: unknown): AbortSignal | undefined {\n\treturn value instanceof AbortSignal ? value : undefined;\n}\n\nfunction cancelled(operationId: string): ProcessExecResultV1 {\n\treturn {\n\t\tversion: 1,\n\t\toperationId,\n\t\tstatus: \"cancelled\",\n\t\tsummary: \"Process execution was cancelled\",\n\t\tstdoutBytes: 0,\n\t\tstderrBytes: 0,\n\t\tstdoutPreview: \"\",\n\t\tstderrPreview: \"\",\n\t\tstdoutTruncated: false,\n\t\tstderrTruncated: false,\n\t\terror: { version: 1, code: \"cancelled\", message: \"Process execution was cancelled\" },\n\t};\n}\n\nfunction malformed(operationId: string): ProcessExecResultV1 {\n\treturn {\n\t\t...cancelled(operationId),\n\t\tstatus: \"failed\",\n\t\tsummary: \"Process adapter returned an invalid result\",\n\t\terror: { version: 1, code: \"adapter_failed\", message: \"Process adapter returned an invalid result\" },\n\t};\n}\n\nfunction invalidInput(operationId: string): ProcessExecResultV1 {\n\treturn {\n\t\t...cancelled(operationId),\n\t\tstatus: \"failed\",\n\t\tsummary: \"Process request was invalid\",\n\t\terror: { version: 1, code: \"invalid_input\", message: \"Process request was invalid\" },\n\t};\n}\n\nfunction boundedError(value: unknown): ProcessExecResultV1[\"error\"] | typeof INVALID_ERROR | undefined {\n\tif (value === undefined) return undefined;\n\ttry {\n\t\tconst error = validatePluginErrorV1(value, \"Process adapter error\");\n\t\tif (\n\t\t\terror.code.length > 128 ||\n\t\t\terror.message.length > 512 ||\n\t\t\t(error.causeCode !== undefined && error.causeCode.length > 128)\n\t\t)\n\t\t\treturn INVALID_ERROR;\n\t\treturn {\n\t\t\tversion: 1,\n\t\t\tcode: error.code,\n\t\t\tmessage: sanitizeProcessTextV1(error.message, 512),\n\t\t\t...(error.causeCode === undefined ? {} : { causeCode: error.causeCode }),\n\t\t};\n\t} catch {\n\t\treturn INVALID_ERROR;\n\t}\n}\n\nfunction boundedResult(value: unknown, operationId: string): ProcessExecResultV1 {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) return malformed(operationId);\n\tconst result = value as Record<string, unknown>;\n\tconst exitCode = result.exitCode;\n\tconst stdoutBytes = typeof result.stdoutBytes === \"number\" ? result.stdoutBytes : undefined;\n\tconst stderrBytes = typeof result.stderrBytes === \"number\" ? result.stderrBytes : undefined;\n\tif (\n\t\tresult.version !== 1 ||\n\t\tresult.operationId !== operationId ||\n\t\ttypeof result.status !== \"string\" ||\n\t\t![\"succeeded\", \"failed\", \"cancelled\", \"needs_user\", \"unsupported\"].includes(result.status) ||\n\t\ttypeof result.summary !== \"string\" ||\n\t\tresult.summary.length > 2048 ||\n\t\tstdoutBytes === undefined ||\n\t\tstderrBytes === undefined ||\n\t\t!Number.isSafeInteger(stdoutBytes) ||\n\t\t!Number.isSafeInteger(stderrBytes) ||\n\t\tstdoutBytes < 0 ||\n\t\tstderrBytes < 0 ||\n\t\tstdoutBytes > PROCESS_EXEC_MAX_OUTPUT_BYTES_V1 ||\n\t\tstderrBytes > PROCESS_EXEC_MAX_OUTPUT_BYTES_V1 ||\n\t\ttypeof result.stdoutPreview !== \"string\" ||\n\t\ttypeof result.stderrPreview !== \"string\" ||\n\t\tresult.stdoutPreview.length > PROCESS_EXEC_MAX_PREVIEW_BYTES_V1 ||\n\t\tresult.stderrPreview.length > PROCESS_EXEC_MAX_PREVIEW_BYTES_V1 ||\n\t\t(stdoutBytes === 0 && result.stdoutPreview.length !== 0) ||\n\t\t(stderrBytes === 0 && result.stderrPreview.length !== 0) ||\n\t\ttypeof result.stdoutTruncated !== \"boolean\" ||\n\t\ttypeof result.stderrTruncated !== \"boolean\"\n\t)\n\t\treturn malformed(operationId);\n\tconst status = result.status as ProcessExecResultV1[\"status\"];\n\tif (\n\t\t(exitCode !== undefined && (typeof exitCode !== \"number\" || !Number.isSafeInteger(exitCode) || exitCode < 0)) ||\n\t\t(status === \"succeeded\" && result.error !== undefined)\n\t)\n\t\treturn malformed(operationId);\n\tconst error = boundedError(result.error);\n\tif (error === INVALID_ERROR || (status !== \"succeeded\" && error === undefined)) return malformed(operationId);\n\tconst projected: ProcessExecResultV1 = {\n\t\tversion: 1,\n\t\toperationId,\n\t\tstatus,\n\t\tsummary: sanitizeProcessTextV1(result.summary as string, 2048),\n\t\t...(exitCode === undefined ? {} : { exitCode: exitCode as number }),\n\t\tstdoutBytes,\n\t\tstderrBytes,\n\t\tstdoutPreview: sanitizeProcessTextV1(result.stdoutPreview as string),\n\t\tstderrPreview: sanitizeProcessTextV1(result.stderrPreview as string),\n\t\tstdoutTruncated: result.stdoutTruncated as boolean,\n\t\tstderrTruncated: result.stderrTruncated as boolean,\n\t\t...(error === undefined ? {} : { error }),\n\t};\n\tif (new TextEncoder().encode(JSON.stringify(projected)).byteLength > 64 * 1024) return malformed(operationId);\n\treturn projected;\n}\n\nasync function runWithCancellation(\n\trun: () => Promise<ProcessExecResultV1>,\n\tsignal: AbortSignal | undefined,\n\toperationId: string,\n): Promise<ProcessExecResultV1> {\n\t// The adapter owns cancellation and must settle after it has drained its\n\t// child/process resources. Do not race the adapter with a local cancellation\n\t// promise: that would return before the host has finished cleanup.\n\tconst output = await run();\n\treturn signal?.aborted && output.status !== \"cancelled\" ? cancelled(operationId) : output;\n}\n\n/** Registers process execution only for a full-control host. */\nexport function createProcessExecCapabilityFactoryV1(runtime: ProcessExecAdapterV1): CapabilityPluginSyncFactory {\n\treturn (api) => {\n\t\tif (api.host.mode === \"readonly\") return;\n\t\tapi.registerTool({\n\t\t\tname: \"process_exec\",\n\t\t\tlabel: \"Process exec\",\n\t\t\tdescription: \"Run an argv command through the selected host process adapter with bounded output\",\n\t\t\tparameters: inputSchema,\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tlet invocationResult: { readonly input: Record<string, unknown>; readonly operationId: string };\n\t\t\t\ttry {\n\t\t\t\t\tinvocationResult = invocation(first, second);\n\t\t\t\t} catch {\n\t\t\t\t\treturn invalidInput(operationIdFor(first, second));\n\t\t\t\t}\n\t\t\t\tconst { input, operationId } = invocationResult;\n\t\t\t\tconst signal = signalFrom(third);\n\t\t\t\tif (signal?.aborted) return cancelled(operationId);\n\t\t\t\tlet request: ProcessExecRequestV1;\n\t\t\t\ttry {\n\t\t\t\t\tif (!Value.Check(inputSchema, input)) return invalidInput(operationId);\n\t\t\t\t\tconst requestInput = objectInput(input.request, undefined);\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof requestInput.command !== \"string\" ||\n\t\t\t\t\t\trequestInput.command.trim() === \"\" ||\n\t\t\t\t\t\t!Array.isArray(requestInput.args) ||\n\t\t\t\t\t\trequestInput.args.some((arg) => typeof arg !== \"string\")\n\t\t\t\t\t)\n\t\t\t\t\t\treturn invalidInput(operationId);\n\t\t\t\t\tconst command = requestInput.command as string;\n\t\t\t\t\tconst args = requestInput.args as string[];\n\t\t\t\t\tconst timeoutMs = requestInput.timeoutMs as number | undefined;\n\t\t\t\t\trequest = {\n\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\toperationId,\n\t\t\t\t\t\tcommand,\n\t\t\t\t\t\targs,\n\t\t\t\t\t\t...(timeoutMs === undefined ? {} : { timeoutMs }),\n\t\t\t\t\t};\n\t\t\t\t} catch {\n\t\t\t\t\treturn invalidInput(operationId);\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst output = await runWithCancellation(() => runtime.run(request, signal), signal, operationId);\n\t\t\t\t\treturn boundedResult(output, operationId);\n\t\t\t\t} catch {\n\t\t\t\t\treturn signal?.aborted ? cancelled(operationId) : malformed(operationId);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t};\n}\n"]}
1
+ {"version":3,"file":"capability.js","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EACN,sCAAsC,EACtC,iCAAiC,EACjC,qBAAqB,GACrB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAChC;IACC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACtF,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,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AAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;oBAClG,OAAO,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;gBAC3C,CAAC;gBAAC,MAAM,CAAC;oBACR,OAAO,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;gBAC1E,CAAC;YAAA,CACD;SACD,CAAC,CAAC;IAAA,CACH,CAAC;AAAA,CACF","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport type { CapabilityPluginSyncFactory } from \"@agent-forge/plugin-sdk\";\nimport { validatePluginErrorV1 } from \"@agent-forge/plugin-sdk\";\nimport { Type } from \"typebox\";\nimport { Value } from \"typebox/value\";\nimport {\n\tPROCESS_EXEC_MAX_OPERATION_ID_CHARS_V1,\n\tPROCESS_EXEC_MAX_PREVIEW_BYTES_V1,\n\tsanitizeProcessTextV1,\n} from \"./node-adapter.ts\";\nimport type { ProcessExecAdapterV1, ProcessExecRequestV1, ProcessExecResultV1 } from \"./types.ts\";\n\nconst requestSchema = Type.Object(\n\t{\n\t\tcommand: Type.String({ minLength: 1, maxLength: 512, pattern: \"^[^\\\\u0000\\\\r\\\\n]+$\" }),\n\t\targs: Type.Array(Type.String({ maxLength: 4096, pattern: \"^[^\\\\u0000\\\\r\\\\n]*$\" }), { maxItems: 256 }),\n\t\ttimeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: 120_000 })),\n\t},\n\t{ additionalProperties: false },\n);\nconst inputSchema = Type.Object({ request: requestSchema }, { additionalProperties: false });\n\nconst INVALID_ERROR = Symbol(\"process-exec-invalid-error\");\n\nfunction generatedOperationId(): string {\n\treturn `profile-runtime-tool-call-${randomUUID()}`;\n}\n\nfunction objectInput(first: unknown, second: unknown): Record<string, unknown> {\n\t// Shape-based dual-convention read (aligned with subagent-delegate): the\n\t// runtime invoke face passes the input object first and the host\n\t// CapabilityToolContext second; the agent tool face passes the tool call\n\t// id (a string) first and the params object second.\n\tconst value = first !== null && typeof first === \"object\" && !Array.isArray(first) ? first : second;\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value))\n\t\tthrow new Error(\"Process input must be an object\");\n\treturn value as Record<string, unknown>;\n}\n\nfunction operationIdFor(first: unknown, second: unknown): string {\n\tconst explicitOperationId = typeof first === \"string\" && second !== undefined ? first : undefined;\n\treturn typeof explicitOperationId === \"string\" &&\n\t\texplicitOperationId.trim() !== \"\" &&\n\t\texplicitOperationId.length <= PROCESS_EXEC_MAX_OPERATION_ID_CHARS_V1 &&\n\t\t![...explicitOperationId].some((character) => /[\\u0000-\\u001f\\u007f]/u.test(character))\n\t\t? explicitOperationId\n\t\t: generatedOperationId();\n}\n\nfunction invocation(\n\tfirst: unknown,\n\tsecond: unknown,\n): { readonly input: Record<string, unknown>; readonly operationId: string } {\n\treturn {\n\t\tinput: objectInput(first, second),\n\t\toperationId: operationIdFor(first, second),\n\t};\n}\n\nfunction signalFrom(value: unknown): AbortSignal | undefined {\n\treturn value instanceof AbortSignal ? value : undefined;\n}\n\nfunction cancelled(operationId: string): ProcessExecResultV1 {\n\treturn {\n\t\tversion: 1,\n\t\toperationId,\n\t\tstatus: \"cancelled\",\n\t\tsummary: \"Process execution was cancelled\",\n\t\tstdoutBytes: 0,\n\t\tstderrBytes: 0,\n\t\tstdoutPreview: \"\",\n\t\tstderrPreview: \"\",\n\t\tstdoutTruncated: false,\n\t\tstderrTruncated: false,\n\t\terror: { version: 1, code: \"cancelled\", message: \"Process execution was cancelled\" },\n\t};\n}\n\nfunction malformed(operationId: string): ProcessExecResultV1 {\n\treturn {\n\t\t...cancelled(operationId),\n\t\tstatus: \"failed\",\n\t\tsummary: \"Process adapter returned an invalid result\",\n\t\terror: { version: 1, code: \"adapter_failed\", message: \"Process adapter returned an invalid result\" },\n\t};\n}\n\nfunction invalidInput(operationId: string): ProcessExecResultV1 {\n\treturn {\n\t\t...cancelled(operationId),\n\t\tstatus: \"failed\",\n\t\tsummary: \"Process request was invalid\",\n\t\terror: { version: 1, code: \"invalid_input\", message: \"Process request was invalid\" },\n\t};\n}\n\nfunction boundedError(value: unknown): ProcessExecResultV1[\"error\"] | typeof INVALID_ERROR | undefined {\n\tif (value === undefined) return undefined;\n\ttry {\n\t\tconst error = validatePluginErrorV1(value, \"Process adapter error\");\n\t\tif (\n\t\t\terror.code.length > 128 ||\n\t\t\terror.message.length > 512 ||\n\t\t\t(error.causeCode !== undefined && error.causeCode.length > 128)\n\t\t)\n\t\t\treturn INVALID_ERROR;\n\t\treturn {\n\t\t\tversion: 1,\n\t\t\tcode: error.code,\n\t\t\tmessage: sanitizeProcessTextV1(error.message, 512),\n\t\t\t...(error.causeCode === undefined ? {} : { causeCode: error.causeCode }),\n\t\t};\n\t} catch {\n\t\treturn INVALID_ERROR;\n\t}\n}\n\nfunction boundedResult(value: unknown, operationId: string): ProcessExecResultV1 {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) return malformed(operationId);\n\tconst result = value as Record<string, unknown>;\n\tconst exitCode = result.exitCode;\n\tconst stdoutBytes = typeof result.stdoutBytes === \"number\" ? result.stdoutBytes : undefined;\n\tconst stderrBytes = typeof result.stderrBytes === \"number\" ? result.stderrBytes : undefined;\n\tif (\n\t\tresult.version !== 1 ||\n\t\tresult.operationId !== operationId ||\n\t\ttypeof result.status !== \"string\" ||\n\t\t![\"succeeded\", \"failed\", \"cancelled\", \"needs_user\", \"unsupported\"].includes(result.status) ||\n\t\ttypeof result.summary !== \"string\" ||\n\t\tresult.summary.length > 2048 ||\n\t\tstdoutBytes === undefined ||\n\t\tstderrBytes === undefined ||\n\t\t!Number.isSafeInteger(stdoutBytes) ||\n\t\t!Number.isSafeInteger(stderrBytes) ||\n\t\tstdoutBytes < 0 ||\n\t\tstderrBytes < 0 ||\n\t\ttypeof result.stdoutPreview !== \"string\" ||\n\t\ttypeof result.stderrPreview !== \"string\" ||\n\t\tresult.stdoutPreview.length > PROCESS_EXEC_MAX_PREVIEW_BYTES_V1 ||\n\t\tresult.stderrPreview.length > PROCESS_EXEC_MAX_PREVIEW_BYTES_V1 ||\n\t\t(stdoutBytes === 0 && result.stdoutPreview.length !== 0) ||\n\t\t(stderrBytes === 0 && result.stderrPreview.length !== 0) ||\n\t\ttypeof result.stdoutTruncated !== \"boolean\" ||\n\t\ttypeof result.stderrTruncated !== \"boolean\"\n\t)\n\t\treturn malformed(operationId);\n\tconst status = result.status as ProcessExecResultV1[\"status\"];\n\tif (\n\t\t(exitCode !== undefined && (typeof exitCode !== \"number\" || !Number.isSafeInteger(exitCode) || exitCode < 0)) ||\n\t\t(status === \"succeeded\" && result.error !== undefined)\n\t)\n\t\treturn malformed(operationId);\n\tconst error = boundedError(result.error);\n\tif (error === INVALID_ERROR || (status !== \"succeeded\" && error === undefined)) return malformed(operationId);\n\tconst projected: ProcessExecResultV1 = {\n\t\tversion: 1,\n\t\toperationId,\n\t\tstatus,\n\t\tsummary: sanitizeProcessTextV1(result.summary as string, 2048),\n\t\t...(exitCode === undefined ? {} : { exitCode: exitCode as number }),\n\t\tstdoutBytes,\n\t\tstderrBytes,\n\t\tstdoutPreview: sanitizeProcessTextV1(result.stdoutPreview as string),\n\t\tstderrPreview: sanitizeProcessTextV1(result.stderrPreview as string),\n\t\tstdoutTruncated: result.stdoutTruncated as boolean,\n\t\tstderrTruncated: result.stderrTruncated as boolean,\n\t\t...(error === undefined ? {} : { error }),\n\t};\n\tif (new TextEncoder().encode(JSON.stringify(projected)).byteLength > 64 * 1024) return malformed(operationId);\n\treturn projected;\n}\n\nasync function runWithCancellation(\n\trun: () => Promise<ProcessExecResultV1>,\n\tsignal: AbortSignal | undefined,\n\toperationId: string,\n): Promise<ProcessExecResultV1> {\n\t// The adapter owns cancellation and must settle after it has drained its\n\t// child/process resources. Do not race the adapter with a local cancellation\n\t// promise: that would return before the host has finished cleanup.\n\tconst output = await run();\n\treturn signal?.aborted && output.status !== \"cancelled\" ? cancelled(operationId) : output;\n}\n\n/** Registers process execution only for a full-control host. */\nexport function createProcessExecCapabilityFactoryV1(runtime: ProcessExecAdapterV1): CapabilityPluginSyncFactory {\n\treturn (api) => {\n\t\tif (api.host.mode === \"readonly\") return;\n\t\tapi.registerTool({\n\t\t\tname: \"process_exec\",\n\t\t\tlabel: \"Process exec\",\n\t\t\tdescription: \"Run an argv command through the selected host process adapter with bounded output\",\n\t\t\tparameters: inputSchema,\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tlet invocationResult: { readonly input: Record<string, unknown>; readonly operationId: string };\n\t\t\t\ttry {\n\t\t\t\t\tinvocationResult = invocation(first, second);\n\t\t\t\t} catch {\n\t\t\t\t\treturn invalidInput(operationIdFor(first, second));\n\t\t\t\t}\n\t\t\t\tconst { input, operationId } = invocationResult;\n\t\t\t\tconst signal = signalFrom(third);\n\t\t\t\tif (signal?.aborted) return cancelled(operationId);\n\t\t\t\tlet request: ProcessExecRequestV1;\n\t\t\t\ttry {\n\t\t\t\t\tif (!Value.Check(inputSchema, input)) return invalidInput(operationId);\n\t\t\t\t\tconst requestInput = objectInput(input.request, undefined);\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof requestInput.command !== \"string\" ||\n\t\t\t\t\t\trequestInput.command.trim() === \"\" ||\n\t\t\t\t\t\t!Array.isArray(requestInput.args) ||\n\t\t\t\t\t\trequestInput.args.some((arg) => typeof arg !== \"string\")\n\t\t\t\t\t)\n\t\t\t\t\t\treturn invalidInput(operationId);\n\t\t\t\t\tconst command = requestInput.command as string;\n\t\t\t\t\tconst args = requestInput.args as string[];\n\t\t\t\t\tconst timeoutMs = requestInput.timeoutMs as number | undefined;\n\t\t\t\t\trequest = {\n\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\toperationId,\n\t\t\t\t\t\tcommand,\n\t\t\t\t\t\targs,\n\t\t\t\t\t\t...(timeoutMs === undefined ? {} : { timeoutMs }),\n\t\t\t\t\t};\n\t\t\t\t} catch {\n\t\t\t\t\treturn invalidInput(operationId);\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst output = await runWithCancellation(() => runtime.run(request, signal), signal, operationId);\n\t\t\t\t\treturn boundedResult(output, operationId);\n\t\t\t\t} catch {\n\t\t\t\t\treturn signal?.aborted ? cancelled(operationId) : malformed(operationId);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t};\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -11,7 +11,8 @@ export interface ProcessExecRequestV1 {
11
11
  readonly timeoutMs?: number;
12
12
  }
13
13
  /**
14
- * A bounded process result. stdout/stderr are previews only; the host may keep
14
+ * A bounded process result. stdout/stderr byte counts are observed totals and
15
+ * may exceed the termination budget; previews are bounded. The host may keep
15
16
  * complete logs in a private artifact, but never returns them through this DTO.
16
17
  */
17
18
  export interface ProcessExecResultV1 {
@@ -20,7 +21,9 @@ export interface ProcessExecResultV1 {
20
21
  readonly status: PluginResultStatusV1;
21
22
  readonly summary: string;
22
23
  readonly exitCode?: number;
24
+ /** Non-negative safe-integer count of observed stdout bytes; may exceed the budget while the stream drains. */
23
25
  readonly stdoutBytes: number;
26
+ /** Non-negative safe-integer count of observed stderr bytes; may exceed the budget while the stream drains. */
24
27
  readonly stderrBytes: number;
25
28
  readonly stdoutPreview: string;
26
29
  readonly stderrPreview: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEnF,eAAO,MAAM,yBAAyB,mCAA6C,CAAC;AACpF,eAAO,MAAM,kCAAkC,GAAa,CAAC;AAC7D,eAAO,MAAM,+BAA+B,qBAA+B,CAAC;AAC5E,eAAO,MAAM,oCAAoC,SAAmB,CAAC;AAErE,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,OAAO,EAAE,CAAC,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EAAE,SAAS;QAAE,QAAQ,CAAC,EAAE,EAAE,cAAc,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;KAAE,EAAE,CAAC;CACzF","sourcesContent":["import type { PluginErrorV1, PluginResultStatusV1 } from \"@agent-forge/plugin-sdk\";\n\nexport const PROCESS_EXEC_PLUGIN_ID_V1 = \"agent-forge.plugin.process-exec\" as const;\nexport const PROCESS_EXEC_CAPABILITY_VERSION_V1 = 1 as const;\nexport const PROCESS_EXEC_HOST_ADAPTER_ID_V1 = \"node-process-exec\" as const;\nexport const PROCESS_EXEC_HOST_ADAPTER_VERSION_V1 = \"1.0.0\" as const;\n\nexport interface ProcessExecRequestV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly command: string;\n\treadonly args: readonly string[];\n\treadonly timeoutMs?: number;\n}\n\n/**\n * A bounded process result. stdout/stderr are previews only; the host may keep\n * complete logs in a private artifact, but never returns them through this DTO.\n */\nexport interface ProcessExecResultV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly status: PluginResultStatusV1;\n\treadonly summary: string;\n\treadonly exitCode?: number;\n\treadonly stdoutBytes: number;\n\treadonly stderrBytes: number;\n\treadonly stdoutPreview: string;\n\treadonly stderrPreview: string;\n\treadonly stdoutTruncated: boolean;\n\treadonly stderrTruncated: boolean;\n\treadonly error?: PluginErrorV1;\n}\n\nexport interface ProcessExecAdapterV1 {\n\treadonly adapterId: string;\n\treadonly adapterVersion: string;\n\treadonly run: (request: ProcessExecRequestV1, signal?: AbortSignal) => Promise<ProcessExecResultV1>;\n}\n\nexport interface ProcessExecPluginManifestV1 {\n\treadonly id: typeof PROCESS_EXEC_PLUGIN_ID_V1;\n\treadonly pluginVersion: string;\n\treadonly apiVersion: \"1\";\n\treadonly capabilityRefs: readonly { readonly id: \"process.exec\"; readonly version: 1 }[];\n}\n"]}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,O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AChC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACpG;AAED,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,EAAE,EAAE,OAAO,yBAAyB,CAAC;IAC9C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,SAAS;QAAE,QAAQ,CAAC,EAAE,EAAE,cAAc,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;KAAE,EAAE,CAAC;CACzF","sourcesContent":["import type { PluginErrorV1, PluginResultStatusV1 } from \"@agent-forge/plugin-sdk\";\n\nexport const PROCESS_EXEC_PLUGIN_ID_V1 = \"agent-forge.plugin.process-exec\" as const;\nexport const PROCESS_EXEC_CAPABILITY_VERSION_V1 = 1 as const;\nexport const PROCESS_EXEC_HOST_ADAPTER_ID_V1 = \"node-process-exec\" as const;\nexport const PROCESS_EXEC_HOST_ADAPTER_VERSION_V1 = \"1.0.0\" as const;\n\nexport interface ProcessExecRequestV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly command: string;\n\treadonly args: readonly string[];\n\treadonly timeoutMs?: number;\n}\n\n/**\n * A bounded process result. stdout/stderr byte counts are observed totals and\n * may exceed the termination budget; previews are bounded. The host may keep\n * complete logs in a private artifact, but never returns them through this DTO.\n */\nexport interface ProcessExecResultV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly status: PluginResultStatusV1;\n\treadonly summary: string;\n\treadonly exitCode?: number;\n\t/** Non-negative safe-integer count of observed stdout bytes; may exceed the budget while the stream drains. */\n\treadonly stdoutBytes: number;\n\t/** Non-negative safe-integer count of observed stderr bytes; may exceed the budget while the stream drains. */\n\treadonly stderrBytes: number;\n\treadonly stdoutPreview: string;\n\treadonly stderrPreview: string;\n\treadonly stdoutTruncated: boolean;\n\treadonly stderrTruncated: boolean;\n\treadonly error?: PluginErrorV1;\n}\n\nexport interface ProcessExecAdapterV1 {\n\treadonly adapterId: string;\n\treadonly adapterVersion: string;\n\treadonly run: (request: ProcessExecRequestV1, signal?: AbortSignal) => Promise<ProcessExecResultV1>;\n}\n\nexport interface ProcessExecPluginManifestV1 {\n\treadonly id: typeof PROCESS_EXEC_PLUGIN_ID_V1;\n\treadonly pluginVersion: string;\n\treadonly apiVersion: \"1\";\n\treadonly capabilityRefs: readonly { readonly id: \"process.exec\"; readonly version: 1 }[];\n}\n"]}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,yBAAyB,GAAG,iCAA0C,CAAC;AACpF,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAU,CAAC;AAC7D,MAAM,CAAC,MAAM,+BAA+B,GAAG,mBAA4B,CAAC;AAC5E,MAAM,CAAC,MAAM,oCAAoC,GAAG,OAAgB,CAAC","sourcesContent":["import type { PluginErrorV1, PluginResultStatusV1 } from \"@agent-forge/plugin-sdk\";\n\nexport const PROCESS_EXEC_PLUGIN_ID_V1 = \"agent-forge.plugin.process-exec\" as const;\nexport const PROCESS_EXEC_CAPABILITY_VERSION_V1 = 1 as const;\nexport const PROCESS_EXEC_HOST_ADAPTER_ID_V1 = \"node-process-exec\" as const;\nexport const PROCESS_EXEC_HOST_ADAPTER_VERSION_V1 = \"1.0.0\" as const;\n\nexport interface ProcessExecRequestV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly command: string;\n\treadonly args: readonly string[];\n\treadonly timeoutMs?: number;\n}\n\n/**\n * A bounded process result. stdout/stderr are previews only; the host may keep\n * complete logs in a private artifact, but never returns them through this DTO.\n */\nexport interface ProcessExecResultV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly status: PluginResultStatusV1;\n\treadonly summary: string;\n\treadonly exitCode?: number;\n\treadonly stdoutBytes: number;\n\treadonly stderrBytes: number;\n\treadonly stdoutPreview: string;\n\treadonly stderrPreview: string;\n\treadonly stdoutTruncated: boolean;\n\treadonly stderrTruncated: boolean;\n\treadonly error?: PluginErrorV1;\n}\n\nexport interface ProcessExecAdapterV1 {\n\treadonly adapterId: string;\n\treadonly adapterVersion: string;\n\treadonly run: (request: ProcessExecRequestV1, signal?: AbortSignal) => Promise<ProcessExecResultV1>;\n}\n\nexport interface ProcessExecPluginManifestV1 {\n\treadonly id: typeof PROCESS_EXEC_PLUGIN_ID_V1;\n\treadonly pluginVersion: string;\n\treadonly apiVersion: \"1\";\n\treadonly capabilityRefs: readonly { readonly id: \"process.exec\"; readonly version: 1 }[];\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,yBAAyB,GAAG,iCAA0C,CAAC;AACpF,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAU,CAAC;AAC7D,MAAM,CAAC,MAAM,+BAA+B,GAAG,mBAA4B,CAAC;AAC5E,MAAM,CAAC,MAAM,oCAAoC,GAAG,OAAgB,CAAC","sourcesContent":["import type { PluginErrorV1, PluginResultStatusV1 } from \"@agent-forge/plugin-sdk\";\n\nexport const PROCESS_EXEC_PLUGIN_ID_V1 = \"agent-forge.plugin.process-exec\" as const;\nexport const PROCESS_EXEC_CAPABILITY_VERSION_V1 = 1 as const;\nexport const PROCESS_EXEC_HOST_ADAPTER_ID_V1 = \"node-process-exec\" as const;\nexport const PROCESS_EXEC_HOST_ADAPTER_VERSION_V1 = \"1.0.0\" as const;\n\nexport interface ProcessExecRequestV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly command: string;\n\treadonly args: readonly string[];\n\treadonly timeoutMs?: number;\n}\n\n/**\n * A bounded process result. stdout/stderr byte counts are observed totals and\n * may exceed the termination budget; previews are bounded. The host may keep\n * complete logs in a private artifact, but never returns them through this DTO.\n */\nexport interface ProcessExecResultV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly status: PluginResultStatusV1;\n\treadonly summary: string;\n\treadonly exitCode?: number;\n\t/** Non-negative safe-integer count of observed stdout bytes; may exceed the budget while the stream drains. */\n\treadonly stdoutBytes: number;\n\t/** Non-negative safe-integer count of observed stderr bytes; may exceed the budget while the stream drains. */\n\treadonly stderrBytes: number;\n\treadonly stdoutPreview: string;\n\treadonly stderrPreview: string;\n\treadonly stdoutTruncated: boolean;\n\treadonly stderrTruncated: boolean;\n\treadonly error?: PluginErrorV1;\n}\n\nexport interface ProcessExecAdapterV1 {\n\treadonly adapterId: string;\n\treadonly adapterVersion: string;\n\treadonly run: (request: ProcessExecRequestV1, signal?: AbortSignal) => Promise<ProcessExecResultV1>;\n}\n\nexport interface ProcessExecPluginManifestV1 {\n\treadonly id: typeof PROCESS_EXEC_PLUGIN_ID_V1;\n\treadonly pluginVersion: string;\n\treadonly apiVersion: \"1\";\n\treadonly capabilityRefs: readonly { readonly id: \"process.exec\"; readonly version: 1 }[];\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-agent-forge/plugin-process-exec",
3
- "version": "0.88.10",
3
+ "version": "0.88.12",
4
4
  "description": "Process execution capability plugin for Agent Forge (full-control process_exec tool)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,7 +21,8 @@
21
21
  "clean": "shx rm -rf dist",
22
22
  "build": "tsgo -p tsconfig.build.json",
23
23
  "test": "vitest --run",
24
- "prepublishOnly": "npm run clean && npm run build"
24
+ "prepublishOnly": "npm run clean && npm run build",
25
+ "test:coverage": "vitest --run --coverage"
25
26
  },
26
27
  "keywords": [
27
28
  "agent-forge",
@@ -45,10 +46,10 @@
45
46
  },
46
47
  "dependencies": {
47
48
  "typebox": "1.3.27",
48
- "@ai-agent-forge/plugin-sdk": "^0.88.10"
49
+ "@ai-agent-forge/plugin-sdk": "^0.88.12"
49
50
  },
50
51
  "devDependencies": {
51
- "shx": "0.4.0",
52
+ "shx": "0.3.4",
52
53
  "vitest": "4.1.11"
53
54
  }
54
55
  }
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "agent-forge.plugin.process-exec",
3
- "version": "0.88.10",
3
+ "version": "0.88.12",
4
4
  "apiVersion": "1-draft",
5
5
  "entry": "./dist/entry.js",
6
6
  "hostVersion": ">=0.84.4",