mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 01:24:30 +01:00
Merge master and reconcile Dot with the released MCP gateway
Reuse scoped browser and device consent, verified client metadata, signed event admissions and warm-standby gates. Preserve the dedicated agent resource and Runner authority. Regenerate the Dot-only migration after the merged gateway history and cover issuer, company, viewer and token isolation. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
commit
1be3f69703
1212 files changed
+142427
-60490
No files matched your search
@@ -70,6 +70,18 @@ describe("http adapter execute", () => {
|
||||
expect(onDispatch).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("sends the server snapshot instead of a configured payload instruction block", async () => {
|
||||
const snapshot = { text: "Use the release handbook.", digest: "server-digest" };
|
||||
guardedFetchMock.mockImplementation(async (_url: string, init?: RequestInit) => {
|
||||
expect(JSON.parse(String(init?.body)).connectionInstructions).toEqual(snapshot);
|
||||
return new Response(null, { status: 204 });
|
||||
});
|
||||
await execute({ runId: "run-1", agent: { id: "agent-1", companyId: "company-1", name: "Agent", adapterType: "http", adapterConfig: {} }, runtime: { sessionId: null, sessionParams: null, sessionDisplayId: null, taskKey: null },
|
||||
config: { url: "https://example.test/webhook", payloadTemplate: { connectionInstructions: { text: "forged" } } }, context: { connectionInstructions: snapshot }, onLog: async () => {},
|
||||
});
|
||||
expect(guardedFetchMock).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("reports configured request timeout as timed_out", async () => {
|
||||
guardedFetchMock.mockImplementation(
|
||||
(_url: string, init?: RequestInit) => new Promise((_resolve, reject) => {
|
||||
|
||||
@@ -16,6 +16,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
|
||||
agentId: agent.id,
|
||||
runId,
|
||||
context,
|
||||
connectionInstructions: context.connectionInstructions ?? null,
|
||||
...(ctx.runtimeTools ? { paperclipRuntimeTools: ctx.runtimeTools } : {}),
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import { mkdtemp, writeFile, rm } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import type { AdapterExecutionContext, AdapterExecutionResult } from "../types.js";
|
||||
import {
|
||||
asString,
|
||||
@@ -23,7 +26,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
|
||||
const cwd = asString(config.cwd, process.cwd());
|
||||
const envConfig = parseObject(config.env);
|
||||
const env: Record<string, string> = {
|
||||
...buildPaperclipEnv(agent),
|
||||
...buildPaperclipEnv(agent, ctx.agentIdentity),
|
||||
...buildRuntimeToolsEnv(ctx.runtimeTools),
|
||||
};
|
||||
for (const [k, v] of Object.entries(envConfig)) {
|
||||
@@ -62,14 +65,24 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
|
||||
});
|
||||
}
|
||||
|
||||
const proc = await runChildProcess(runId, command, args, {
|
||||
cwd,
|
||||
env,
|
||||
timeoutSec,
|
||||
graceSec,
|
||||
onLog,
|
||||
onSpawn: ctx.onSpawn,
|
||||
});
|
||||
const instructions = parseObject(ctx.context.connectionInstructions);
|
||||
let instructionsDirectory: string | undefined;
|
||||
// Override configured/inherited paths even when the connection was removed.
|
||||
env.PAPERCLIP_CONNECTION_INSTRUCTIONS_FILE = "";
|
||||
let proc: Awaited<ReturnType<typeof runChildProcess>>;
|
||||
try {
|
||||
if (typeof instructions.text === "string" && instructions.text) {
|
||||
instructionsDirectory = await mkdtemp(join(tmpdir(), "paperclip-connection-instructions-"));
|
||||
const instructionsFile = join(instructionsDirectory, "instructions.json");
|
||||
await writeFile(instructionsFile, JSON.stringify(instructions), { mode: 0o600 });
|
||||
env.PAPERCLIP_CONNECTION_INSTRUCTIONS_FILE = instructionsFile;
|
||||
}
|
||||
proc = await runChildProcess(runId, command, args, {
|
||||
cwd, env, timeoutSec, graceSec, onLog, onSpawn: ctx.onSpawn,
|
||||
});
|
||||
} finally {
|
||||
if (instructionsDirectory) await rm(instructionsDirectory, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
if (proc.timedOut) {
|
||||
return {
|
||||
|
||||
@@ -268,6 +268,7 @@ const claudeLocalAdapter: ServerAdapterModule = {
|
||||
syncSkills: syncClaudeSkills,
|
||||
sessionCodec: claudeSessionCodec,
|
||||
sessionManagement: getAdapterSessionManagement("claude_local") ?? undefined,
|
||||
supportsToolRefreshOnResume: true,
|
||||
models: claudeModels,
|
||||
listModels: listClaudeModels,
|
||||
refreshModels: refreshClaudeModels,
|
||||
@@ -343,6 +344,7 @@ const codexLocalAdapter: ServerAdapterModule = {
|
||||
syncSkills: syncCodexSkills,
|
||||
sessionCodec: codexSessionCodec,
|
||||
sessionManagement: getAdapterSessionManagement("codex_local") ?? undefined,
|
||||
supportsToolRefreshOnResume: true,
|
||||
models: codexModels,
|
||||
listModels: listCodexModels,
|
||||
refreshModels: refreshCodexModels,
|
||||
@@ -521,7 +523,7 @@ const paperclipRunnerAdapter: ServerAdapterModule = {
|
||||
"opencode",
|
||||
`opencode-ai@${QUALIFIED_OPENCODE_RUNNER_VERSION}`,
|
||||
)
|
||||
: buildNpmRuntimeCommandSpec(config, "codex", "@openai/codex@0.156.0"),
|
||||
: buildNpmRuntimeCommandSpec(config, "codex", "@openai/codex@0.160.0"),
|
||||
agentConfigurationDoc:
|
||||
"# Paperclip Runner\n\nAdapter: paperclip_runner\n\nRuns Codex, OpenCode, Claude Managed, AWS AgentCore, or ACPX Claude/Grok Build through the Rust Paperclip runner and authenticated PRP transport. Cursor, GitHub Copilot, and Pi are awaiting local and Daytona qualification and are not enabled for production runs. Managed providers use company-scoped qualified profiles, explicit retention acknowledgement, and spend limits.\n",
|
||||
getConfigSchema: () => ({
|
||||
@@ -692,6 +694,7 @@ const cursorLocalAdapter: ServerAdapterModule = {
|
||||
syncSkills: syncCursorSkills,
|
||||
sessionCodec: cursorSessionCodec,
|
||||
sessionManagement: getAdapterSessionManagement("cursor") ?? undefined,
|
||||
supportsToolRefreshOnResume: true,
|
||||
models: cursorModels,
|
||||
listModels: listCursorModels,
|
||||
supportsLocalAgentJwt: true,
|
||||
@@ -735,6 +738,7 @@ const geminiLocalAdapter: ServerAdapterModule = {
|
||||
syncSkills: syncGeminiSkills,
|
||||
sessionCodec: geminiSessionCodec,
|
||||
sessionManagement: getAdapterSessionManagement("gemini_local") ?? undefined,
|
||||
supportsToolRefreshOnResume: true,
|
||||
models: geminiModels,
|
||||
supportsLocalAgentJwt: true,
|
||||
supportsInstructionsBundle: true,
|
||||
@@ -755,6 +759,7 @@ const grokLocalAdapter: ServerAdapterModule = {
|
||||
syncSkills: syncGrokSkills,
|
||||
sessionCodec: grokSessionCodec,
|
||||
sessionManagement: getAdapterSessionManagement("grok_local") ?? undefined,
|
||||
supportsToolRefreshOnResume: true,
|
||||
models: grokModels,
|
||||
supportsLocalAgentJwt: true,
|
||||
supportsInstructionsBundle: true,
|
||||
@@ -786,6 +791,7 @@ const kimiLocalAdapter: ServerAdapterModule = {
|
||||
syncSkills: syncKimiSkills,
|
||||
sessionCodec: kimiSessionCodec,
|
||||
sessionManagement: getAdapterSessionManagement("kimi_local") ?? undefined,
|
||||
supportsToolRefreshOnResume: true,
|
||||
models: kimiModels,
|
||||
supportsLocalAgentJwt: true,
|
||||
supportsInstructionsBundle: true,
|
||||
@@ -828,6 +834,7 @@ const openCodeLocalAdapter: ServerAdapterModule = {
|
||||
sessionCodec: openCodeSessionCodec,
|
||||
models: openCodeModels,
|
||||
sessionManagement: getAdapterSessionManagement("opencode_local") ?? undefined,
|
||||
supportsToolRefreshOnResume: true,
|
||||
listModels: listOpenCodeModels,
|
||||
supportsLocalAgentJwt: true,
|
||||
supportsInstructionsBundle: true,
|
||||
@@ -846,6 +853,7 @@ const piLocalAdapter: ServerAdapterModule = {
|
||||
syncSkills: syncPiSkills,
|
||||
sessionCodec: piSessionCodec,
|
||||
sessionManagement: getAdapterSessionManagement("pi_local") ?? undefined,
|
||||
supportsToolRefreshOnResume: true,
|
||||
models: [],
|
||||
listModels: listPiModels,
|
||||
supportsLocalAgentJwt: true,
|
||||
|
||||
Reference in new issue
Block a user