mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-02 19:08:33 +01:00
merge: integrate current master and preserve preview migration upgrades
Regenerate migration metadata after mainline claimed 0272. Preserve the work-folder SQL bytes under 0273 and exercise missing earlier migrations against saved preview data. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
commit
3dd2b51596
201 files changed
+62608
-3880
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { logger } from "../../middleware/logger.js";
|
||||
import { createHash, randomUUID } from "node:crypto";
|
||||
import { and, asc, desc, eq, gt, inArray, isNotNull, isNull, lte, notInArray, or, sql } from "drizzle-orm";
|
||||
import type { Db } from "@paperclipai/db";
|
||||
@@ -30,6 +31,7 @@ import { issueRecoveryActionService } from "../issue-recovery-actions.js";
|
||||
import { issueService } from "../issues.js";
|
||||
import { emitAgentTaskRun } from "../agent-task-run-telemetry.js";
|
||||
import { resumeNativeWorkspaceFinalization } from "./native-workspace-finalizer.js";
|
||||
import { dismissObsoleteNativePolicyReviews } from "./obsolete-policy-reviews.js";
|
||||
import {
|
||||
cleanupNativeWorkspaceSync,
|
||||
readNativeWorkspaceSyncReference,
|
||||
@@ -57,7 +59,6 @@ export type NativeReconciliationFacts = {
|
||||
newEvidenceSatisfiesContract?: boolean;
|
||||
dependencyResolved?: boolean;
|
||||
authorizedResume?: boolean;
|
||||
policyVersionChanged?: boolean;
|
||||
statusVersionAdvanced?: boolean;
|
||||
};
|
||||
|
||||
@@ -111,22 +112,6 @@ export function resolveNativeReconciliationStatus(input: {
|
||||
if (input.facts.authoritativeStatusChanged) {
|
||||
return preserve("prior_status_terminal_preserved", [{ kind: "append_superseding_assessment" }]);
|
||||
}
|
||||
if (input.facts.policyVersionChanged) {
|
||||
if (["done", "cancelled"].includes(input.priorIssueStatus)) {
|
||||
return preserve("prior_status_terminal_preserved", [{ kind: "append_superseding_assessment" }]);
|
||||
}
|
||||
return {
|
||||
policyVersion: NATIVE_STATUS_ARBITER_POLICY_VERSION,
|
||||
statusAction: "in_review",
|
||||
toStatus: "in_review",
|
||||
reasonCode: "completion_review_required",
|
||||
unblockDescriptor: null,
|
||||
effects: [
|
||||
{ kind: "bind_reviewer", prompt: "Review the superseding native policy assessment.", ownerUserId: null },
|
||||
{ kind: "append_superseding_assessment" },
|
||||
],
|
||||
};
|
||||
}
|
||||
if (input.facts.statusVersionAdvanced) {
|
||||
return preserve("arbitration_conflict_reloaded", [
|
||||
{ kind: "increment_status_version" },
|
||||
@@ -553,6 +538,9 @@ export async function reconcileNativeFinalizations(
|
||||
}) => Promise<void>;
|
||||
} = {},
|
||||
) {
|
||||
await dismissObsoleteNativePolicyReviews(db, runIds).catch((err) => {
|
||||
logger.warn({ err }, "Obsolete native policy review lookup failed; continuing native reconciliation");
|
||||
});
|
||||
const rows = await db
|
||||
.select({
|
||||
runId: heartbeatRuns.id,
|
||||
@@ -655,7 +643,6 @@ export async function reconcileNativeFinalizations(
|
||||
),
|
||||
)).limit(1).then((entries) => entries[0] ?? null)
|
||||
: null;
|
||||
const policyVersionChanged = assessment?.policyVersion !== NATIVE_STATUS_ARBITER_POLICY_VERSION;
|
||||
const currentDecision = row.decisionId
|
||||
? await db.select({
|
||||
assessmentId: statusDecisions.assessmentId,
|
||||
@@ -727,7 +714,7 @@ export async function reconcileNativeFinalizations(
|
||||
let reassessment = null;
|
||||
let resultRow = null;
|
||||
let contractRow = null;
|
||||
if (assessment && (policyVersionChanged || authoritativeStatusChanged || changedEvidence)) {
|
||||
if (assessment && (authoritativeStatusChanged || changedEvidence)) {
|
||||
[resultRow, contractRow] = await Promise.all([
|
||||
db.select().from(nativeRunResults).where(and(
|
||||
eq(nativeRunResults.id, assessment.resultId),
|
||||
@@ -758,11 +745,9 @@ export async function reconcileNativeFinalizations(
|
||||
&& reassessment.verificationPassed === true;
|
||||
const facts: NativeReconciliationFacts = authoritativeStatusChanged
|
||||
? { authoritativeStatusChanged: true }
|
||||
: policyVersionChanged
|
||||
? { policyVersionChanged: true }
|
||||
: newEvidenceSatisfiesContract
|
||||
? { newEvidenceSatisfiesContract: true }
|
||||
: {};
|
||||
: newEvidenceSatisfiesContract
|
||||
? { newEvidenceSatisfiesContract: true }
|
||||
: {};
|
||||
if (Object.keys(facts).length > 0) {
|
||||
if (!assessment || !reassessment || !resultRow || !contractRow) {
|
||||
throw new Error("native_reconciliation_reassessment_missing");
|
||||
|
||||
@@ -207,6 +207,7 @@ describe("native controller takeover fencing", () => {
|
||||
}),
|
||||
now,
|
||||
isProcessAlive,
|
||||
readProcessStartedAt: async () => recordedStart,
|
||||
}),
|
||||
).resolves.toEqual({ allowed: false, reason: "controller_still_alive" });
|
||||
expect(isProcessAlive).toHaveBeenCalledWith(123);
|
||||
|
||||
@@ -5799,26 +5799,31 @@ describe("native warm session supervision", () => {
|
||||
return result;
|
||||
});
|
||||
|
||||
await executePaperclipNativeSession({
|
||||
db: leaseDb(base),
|
||||
execution: base,
|
||||
runnerInstanceId: "runner",
|
||||
});
|
||||
await executePaperclipNativeSession({
|
||||
db: leaseDb(lowered),
|
||||
execution: lowered,
|
||||
runnerInstanceId: "runner",
|
||||
});
|
||||
expect(firstClose).toHaveBeenCalledWith({
|
||||
reason: "warm native session configuration changed",
|
||||
});
|
||||
await vi.waitFor(
|
||||
() =>
|
||||
expect(secondClose).toHaveBeenCalledWith({
|
||||
reason: "warm native session idle timeout",
|
||||
}),
|
||||
{ timeout: 500 },
|
||||
);
|
||||
// Filesystem work between calls can exceed the idle window on a busy host.
|
||||
// Advance that window only after proving the permission change closed it.
|
||||
vi.useFakeTimers({ toFake: ["setTimeout", "clearTimeout"] });
|
||||
try {
|
||||
await executePaperclipNativeSession({
|
||||
db: leaseDb(base),
|
||||
execution: base,
|
||||
runnerInstanceId: "runner",
|
||||
});
|
||||
await executePaperclipNativeSession({
|
||||
db: leaseDb(lowered),
|
||||
execution: lowered,
|
||||
runnerInstanceId: "runner",
|
||||
});
|
||||
expect(firstClose).toHaveBeenCalledWith({
|
||||
reason: "warm native session configuration changed",
|
||||
});
|
||||
expect(secondClose).not.toHaveBeenCalled();
|
||||
await vi.advanceTimersByTimeAsync(20);
|
||||
expect(secondClose).toHaveBeenCalledWith({
|
||||
reason: "warm native session idle timeout",
|
||||
});
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { remoteLeaseCleanupScope } from "../remote-execution-termination.js";
|
||||
import { resolveConnectorAssignments, isConnectorSkill } from "../connector-runtime.js";
|
||||
import {
|
||||
boundedExecutionCleanup,
|
||||
EXECUTION_CONTROL_DEADLINE_MS,
|
||||
@@ -6613,6 +6615,8 @@ export async function executePaperclipNativeSession(input: {
|
||||
db: Db;
|
||||
execution: NativeExecutionInput;
|
||||
runnerInstanceId: string;
|
||||
/** Configured total turn bound; zero/unset is unlimited. */
|
||||
turnTimeoutMs?: number;
|
||||
leaseOwner?: string;
|
||||
restartRecovery?: NativeRestartRecoveryClaim;
|
||||
onSpawn?: (meta: {
|
||||
@@ -6633,8 +6637,6 @@ export async function executePaperclipNativeSession(input: {
|
||||
onGoalCheckpoint?: (snapshot: PersistedNativeSession) => Promise<void>;
|
||||
sessionGoalControl?: NativeSessionGoalControl | null;
|
||||
resumeSessionGoalHeartbeat?: boolean;
|
||||
/** Internal test seam; production rolls over five minutes before runnerd's one-hour lease. */
|
||||
goalRolloverAtMs?: number;
|
||||
preparationSpans?: NativeRunHistoricalSpan[];
|
||||
/** Resolved adapter env; the runner transport applies a provider allowlist before spawn. */
|
||||
runnerEnvironment?: NodeJS.ProcessEnv;
|
||||
@@ -7611,6 +7613,14 @@ async function executePaperclipNativeSessionWithinScope(
|
||||
trace,
|
||||
})
|
||||
: null;
|
||||
const remoteCleanupLease = input.runnerExecutionTarget?.kind === "remote" &&
|
||||
input.runnerExecutionTarget.transport === "sandbox" && input.runnerExecutionTarget.leaseId
|
||||
? await input.db.select({ provider: environmentLeases.provider, providerLeaseId: environmentLeases.providerLeaseId })
|
||||
.from(environmentLeases).where(and(
|
||||
eq(environmentLeases.companyId, input.execution.binding.companyId),
|
||||
eq(environmentLeases.id, input.runnerExecutionTarget.leaseId),
|
||||
)).then(rows => rows[0])
|
||||
: null;
|
||||
nativeSessionExecuteStartedAtMs = Date.now();
|
||||
native = await trace.measure(
|
||||
"native.session.execute",
|
||||
@@ -7623,6 +7633,8 @@ async function executePaperclipNativeSessionWithinScope(
|
||||
const result = await trace.run(runnerSessionStartupScope, () =>
|
||||
executeNativeSession({
|
||||
input: runnerExecution,
|
||||
remoteCleanupScope: remoteCleanupLease ? remoteLeaseCleanupScope(remoteCleanupLease) : undefined,
|
||||
turnTimeoutMs: input.turnTimeoutMs,
|
||||
backend:
|
||||
input.backend ??
|
||||
runnerdBackend ??
|
||||
@@ -9606,7 +9618,11 @@ async function createRunnerdBackendWithinSessionClaim(
|
||||
input.db,
|
||||
input.execution.binding,
|
||||
);
|
||||
const pinnedSkills = new Set("runtimeContext" in input.execution ? input.execution.runtimeContext.skills.map((skill) => skill.key) : []);
|
||||
const connectorAssignments = [...pinnedSkills].some(isConnectorSkill)
|
||||
? await resolveConnectorAssignments(input.db, input.execution.binding) : [];
|
||||
const authority = new PaperclipRunnerToolAuthority(input.db, {
|
||||
connectorAssignments: connectorAssignments.filter((assignment) => pinnedSkills.has(assignment.skillKey)),
|
||||
companyId: input.execution.binding.companyId,
|
||||
issueId: input.execution.binding.issueId,
|
||||
runId: input.execution.binding.runId,
|
||||
|
||||
@@ -23,7 +23,7 @@ export function nativeToolContractFingerprintForTarget(
|
||||
return `sha256:${createHash("sha256")
|
||||
.update(
|
||||
JSON.stringify({
|
||||
schema: "paperclip.native-tool-contract.v10",
|
||||
schema: "paperclip.native-tool-contract.v12",
|
||||
executionTargetKind,
|
||||
advertisementPolicy: {
|
||||
// Direct provider threads retain declarations from thread/start.
|
||||
@@ -37,6 +37,7 @@ export function nativeToolContractFingerprintForTarget(
|
||||
structuredHumanInput:
|
||||
"always_advertised_run_issue_agent_binding_gated_current_task_description.v2",
|
||||
semanticCompletion: "finish_response_wake_user_facing_summary.v3",
|
||||
connectorTools: "assigned_resources_and_pinned_skill_bundle.v1",
|
||||
},
|
||||
tools: [
|
||||
...(executionTargetKind === "local"
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
import { and, eq, inArray, isNull, sql } from "drizzle-orm";
|
||||
import {
|
||||
approvals, issueApprovals, issueThreadInteractions, issues,
|
||||
nativeRunFinalizations, statusDecisionEffects, statusDecisions, workAssessments,
|
||||
type Db,
|
||||
} from "@paperclipai/db";
|
||||
import { logger } from "../../middleware/logger.js";
|
||||
import { issueService } from "../issues.js";
|
||||
import { issueThreadInteractionService } from "../issue-thread-interactions.js";
|
||||
import { enqueueTerminalIssueInteractionChatPublications } from "../chat-interaction-publications.js";
|
||||
import { persistActivity, publishActivity, type ActivityPublication } from "../activity-log.js";
|
||||
|
||||
const obsoletePrompt = "Review the superseding native policy assessment.";
|
||||
|
||||
/** Retire only the old version-change gate, never a real completion review. */
|
||||
export async function dismissObsoleteNativePolicyReviews(db: Db, runIds?: string[]) {
|
||||
const candidates = await db.select({
|
||||
interaction: issueThreadInteractions,
|
||||
decision: statusDecisions,
|
||||
priorDecisionId: workAssessments.priorDecisionId,
|
||||
}).from(issueThreadInteractions)
|
||||
.innerJoin(statusDecisionEffects, and(
|
||||
eq(statusDecisionEffects.companyId, issueThreadInteractions.companyId),
|
||||
eq(statusDecisionEffects.issueId, issueThreadInteractions.issueId),
|
||||
sql`${statusDecisionEffects.targetId} = ${issueThreadInteractions.id}::text`,
|
||||
eq(statusDecisionEffects.targetType, "issue_thread_interaction"),
|
||||
eq(statusDecisionEffects.effectKind, "bind_reviewer"),
|
||||
))
|
||||
.innerJoin(statusDecisions, and(
|
||||
eq(statusDecisions.id, statusDecisionEffects.decisionId),
|
||||
eq(statusDecisions.companyId, issueThreadInteractions.companyId),
|
||||
eq(statusDecisions.issueId, issueThreadInteractions.issueId),
|
||||
eq(statusDecisions.runId, issueThreadInteractions.sourceRunId),
|
||||
))
|
||||
.innerJoin(workAssessments, and(
|
||||
eq(workAssessments.id, statusDecisions.assessmentId),
|
||||
eq(workAssessments.companyId, statusDecisions.companyId),
|
||||
eq(workAssessments.issueId, statusDecisions.issueId),
|
||||
))
|
||||
.where(and(
|
||||
eq(issueThreadInteractions.status, "pending"),
|
||||
eq(issueThreadInteractions.kind, "request_confirmation"),
|
||||
isNull(issueThreadInteractions.createdByAgentId),
|
||||
isNull(issueThreadInteractions.createdByUserId),
|
||||
eq(statusDecisions.applicationState, "applied"),
|
||||
eq(statusDecisions.reasonCode, "completion_review_required"),
|
||||
eq(statusDecisions.toStatus, "in_review"),
|
||||
sql`${issueThreadInteractions.idempotencyKey} = 'native-review:' || ${statusDecisions.id}::text`,
|
||||
sql`${issueThreadInteractions.payload}->>'prompt' = ${obsoletePrompt}`,
|
||||
// Match the complete old decision, including its unique assessment-only effect.
|
||||
sql`${statusDecisions.decisionJson}->'effects' = ${JSON.stringify([
|
||||
{ kind: "bind_reviewer", prompt: obsoletePrompt, ownerUserId: null },
|
||||
{ kind: "append_superseding_assessment" },
|
||||
])}::jsonb`,
|
||||
...(runIds?.length ? [inArray(statusDecisions.runId, runIds)] : []),
|
||||
)).limit(100);
|
||||
|
||||
for (const { interaction, decision, priorDecisionId } of candidates) {
|
||||
const publications: ActivityPublication[] = [];
|
||||
try {
|
||||
await db.transaction(async (tx) => {
|
||||
// Same lock order as status commits: coordinator, issue, interaction.
|
||||
await tx.select({ runId: nativeRunFinalizations.runId }).from(nativeRunFinalizations)
|
||||
.where(and(eq(nativeRunFinalizations.runId, decision.runId),
|
||||
eq(nativeRunFinalizations.companyId, decision.companyId)))
|
||||
.for("update");
|
||||
const issue = await tx.select().from(issues).where(and(
|
||||
eq(issues.id, decision.issueId), eq(issues.companyId, decision.companyId),
|
||||
)).for("update").then((rows) => rows[0]);
|
||||
if (!issue) return;
|
||||
const now = new Date();
|
||||
const [cancelled] = await tx.update(issueThreadInteractions).set({
|
||||
status: "cancelled",
|
||||
result: { version: 1, outcome: "withdrawn", reason: "A Paperclip upgrade does not require completion review." },
|
||||
resolvedAt: now,
|
||||
updatedAt: now,
|
||||
}).where(and(
|
||||
eq(issueThreadInteractions.id, interaction.id),
|
||||
eq(issueThreadInteractions.companyId, decision.companyId),
|
||||
eq(issueThreadInteractions.status, "pending"),
|
||||
)).returning({ id: issueThreadInteractions.id });
|
||||
if (!cancelled) return;
|
||||
const terminalInteraction = await issueThreadInteractionService(tx as unknown as Db).getById(cancelled.id);
|
||||
if (terminalInteraction) {
|
||||
await enqueueTerminalIssueInteractionChatPublications(tx as unknown as Db, terminalInteraction);
|
||||
}
|
||||
|
||||
const pendingInteraction = await tx.select({ id: issueThreadInteractions.id })
|
||||
.from(issueThreadInteractions).where(and(
|
||||
eq(issueThreadInteractions.companyId, issue.companyId),
|
||||
eq(issueThreadInteractions.issueId, issue.id),
|
||||
eq(issueThreadInteractions.status, "pending"),
|
||||
)).limit(1);
|
||||
const pendingApproval = await tx.select({ id: approvals.id }).from(issueApprovals)
|
||||
.innerJoin(approvals, and(eq(approvals.id, issueApprovals.approvalId),
|
||||
eq(approvals.companyId, issue.companyId)))
|
||||
.where(and(eq(issueApprovals.companyId, issue.companyId), eq(issueApprovals.issueId, issue.id),
|
||||
inArray(approvals.status, ["pending", "revision_requested"]))).limit(1);
|
||||
const restoreStatus = issue.status === "in_review"
|
||||
&& issue.lastStatusDecisionId === decision.id
|
||||
&& issue.statusVersion === Number(decision.decisionJson.projectedStatusVersion ?? decision.decisionVersion)
|
||||
&& ["backlog", "todo", "in_progress", "blocked"].includes(decision.fromStatus)
|
||||
&& pendingInteraction.length === 0 && pendingApproval.length === 0
|
||||
&& issue.executionState?.status !== "pending";
|
||||
if (restoreStatus) {
|
||||
const priorDecision = priorDecisionId ? await tx.select().from(statusDecisions).where(and(
|
||||
eq(statusDecisions.id, priorDecisionId), eq(statusDecisions.companyId, issue.companyId),
|
||||
eq(statusDecisions.issueId, issue.id),
|
||||
)).then((rows) => rows[0]) : null;
|
||||
await issueService(tx as unknown as Db).update(issue.id, {
|
||||
status: decision.fromStatus,
|
||||
// This is an administrative correction, not a replay of the old decision.
|
||||
lastStatusDecisionId: null,
|
||||
unblockDescriptor: priorDecision?.decisionJson.unblockDescriptor as typeof issue.unblockDescriptor ?? null,
|
||||
}, tx, publications);
|
||||
}
|
||||
const { publication } = await persistActivity(tx as unknown as Db, {
|
||||
companyId: issue.companyId,
|
||||
actorType: "system",
|
||||
actorId: "native-policy-review-cleanup",
|
||||
action: restoreStatus ? "issue.updated" : "issue.interaction_cancelled",
|
||||
entityType: "issue",
|
||||
entityId: issue.id,
|
||||
issueId: issue.id,
|
||||
runId: decision.runId,
|
||||
details: {
|
||||
source: "obsolete_native_policy_review",
|
||||
interactionId: interaction.id,
|
||||
decisionId: decision.id,
|
||||
fromStatus: issue.status,
|
||||
toStatus: restoreStatus ? decision.fromStatus : issue.status,
|
||||
},
|
||||
});
|
||||
publications.push(publication);
|
||||
});
|
||||
} catch (err) {
|
||||
logger.warn({ err, interactionId: interaction.id, issueId: decision.issueId },
|
||||
"Failed to withdraw obsolete native policy review; will retry on the next pass");
|
||||
continue;
|
||||
}
|
||||
for (const publication of publications) {
|
||||
try {
|
||||
publishActivity(publication);
|
||||
} catch (err) {
|
||||
logger.warn({ err, interactionId: interaction.id, issueId: decision.issueId },
|
||||
"Obsolete native policy review cleanup committed; live activity publication failed, history is preserved");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { isConnectorTool, executeConnectorTool, type ConnectorAssignment } from "../connector-runtime.js";
|
||||
import { resolveNativeRuntimeMcpSnapshot } from "./runtime-context.js";
|
||||
import { connectionIntentService } from "../connection-intents.js";
|
||||
import { RUNTIME_CONNECTION_TOOL_DEFINITIONS } from "../connection-tool-definitions.js";
|
||||
@@ -86,6 +87,7 @@ type Binding = {
|
||||
apiUrl?: string;
|
||||
storage?: StorageService;
|
||||
/** Server-owned suppression for baseline evals; true never overrides operator opt-in. */
|
||||
connectorAssignments?: ConnectorAssignment[];
|
||||
apiToolsEnabled?: boolean;
|
||||
workMode?: "standard" | "planning" | "ask";
|
||||
workspaceRoot?: string;
|
||||
@@ -184,7 +186,7 @@ export class PaperclipRunnerToolAuthority {
|
||||
definitions.push(LIST_CHAT_ATTACHMENTS_TOOL_DEFINITION);
|
||||
definitions.push(REUSE_CHAT_ATTACHMENT_TOOL_DEFINITION);
|
||||
definitions.push(READ_CHAT_ATTACHMENT_TOOL_DEFINITION);
|
||||
return [...RUNTIME_CONNECTION_TOOL_DEFINITIONS, ...definitions];
|
||||
return [...RUNTIME_CONNECTION_TOOL_DEFINITIONS, ...(this.binding.connectorAssignments ?? []).flatMap((assignment) => assignment.tools), ...definitions];
|
||||
}
|
||||
|
||||
async execute(call: {
|
||||
@@ -192,6 +194,13 @@ export class PaperclipRunnerToolAuthority {
|
||||
callId: string;
|
||||
arguments: unknown;
|
||||
}): Promise<unknown> {
|
||||
if (isConnectorTool(call.tool)) {
|
||||
if (!(this.binding.connectorAssignments ?? []).some((assignment) => assignment.tools.some((tool) => tool.name === call.tool))) throw forbidden("Connector tool is not available to this run");
|
||||
const { run } = await this.#boundContext();
|
||||
const snapshot = record(run.contextSnapshot);
|
||||
if (isPaperclipExternalChatContractTurn(snapshot.paperclipWake) || String(snapshot.source ?? "").startsWith("chat:") || snapshot.paperclipExternalChatQuestionResponse) throw forbidden("Restricted chat runs cannot use email actions");
|
||||
return executeConnectorTool(this.db, this.binding, call.tool, call.arguments);
|
||||
}
|
||||
if (RUNTIME_CONNECTION_TOOL_DEFINITIONS.some((tool) => tool.name === call.tool)) {
|
||||
await this.#boundContext();
|
||||
const { run } = await captureRunIdentity(this.db, this.binding);
|
||||
@@ -1081,7 +1090,7 @@ export class PaperclipRunnerToolAuthority {
|
||||
eq(chatEndpoints.assignedAgentId, this.binding.agentId),
|
||||
),
|
||||
);
|
||||
if (!endpoint) {
|
||||
if (!endpoint || endpoint.provider === "agentmail") {
|
||||
throw new Error("paperclip_runner_chat_attachment_binding_denied");
|
||||
}
|
||||
provider = endpoint.provider;
|
||||
|
||||
@@ -87,7 +87,7 @@ async function verifyMaterializedAsset(
|
||||
}
|
||||
}
|
||||
|
||||
async function materializeAsset(files: AssetFile[]): Promise<NativeRuntimeAssetReference> {
|
||||
export async function materializeAsset(files: AssetFile[]): Promise<NativeRuntimeAssetReference> {
|
||||
const sorted = [...files].sort((a, b) => a.path.localeCompare(b.path));
|
||||
const manifestFiles = sorted.map((file) => ({ path: safeRelativePath(file.path, "runtime context path"), sha256: sha256(file.content), mode: file.mode & 0o555, size: file.content.byteLength }));
|
||||
const totalBytes = manifestFiles.reduce((sum, file) => sum + file.size, 0);
|
||||
|
||||
Reference in new issue
Block a user