@openai/agents-core 0.8.4 → 0.9.0
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/agentToolRunConfig.js +3 -0
- package/dist/agentToolRunConfig.js.map +1 -1
- package/dist/agentToolRunConfig.mjs +3 -0
- package/dist/agentToolRunConfig.mjs.map +1 -1
- package/dist/errors.d.ts +10 -0
- package/dist/errors.js +15 -1
- package/dist/errors.js.map +1 -1
- package/dist/errors.mjs +13 -0
- package/dist/errors.mjs.map +1 -1
- package/dist/handoff.js +1 -1
- package/dist/handoff.js.map +1 -1
- package/dist/handoff.mjs +1 -1
- package/dist/handoff.mjs.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/dist/items.d.ts +13 -0
- package/dist/items.js +15 -0
- package/dist/items.js.map +1 -1
- package/dist/items.mjs +15 -0
- package/dist/items.mjs.map +1 -1
- package/dist/memory/historyMutations.d.ts +6 -0
- package/dist/memory/historyMutations.js +32 -0
- package/dist/memory/historyMutations.js.map +1 -0
- package/dist/memory/historyMutations.mjs +29 -0
- package/dist/memory/historyMutations.mjs.map +1 -0
- package/dist/memory/memorySession.d.ts +3 -2
- package/dist/memory/memorySession.js +7 -0
- package/dist/memory/memorySession.js.map +1 -1
- package/dist/memory/memorySession.mjs +7 -0
- package/dist/memory/memorySession.mjs.map +1 -1
- package/dist/memory/session.d.ts +15 -0
- package/dist/memory/session.js +6 -0
- package/dist/memory/session.js.map +1 -1
- package/dist/memory/session.mjs +5 -0
- package/dist/memory/session.mjs.map +1 -1
- package/dist/metadata.js +2 -2
- package/dist/metadata.mjs +2 -2
- package/dist/model.d.ts +21 -0
- package/dist/run.d.ts +7 -1
- package/dist/run.js +116 -57
- package/dist/run.js.map +1 -1
- package/dist/run.mjs +117 -58
- package/dist/run.mjs.map +1 -1
- package/dist/runState.d.ts +83 -1
- package/dist/runState.js +96 -11
- package/dist/runState.js.map +1 -1
- package/dist/runState.mjs +95 -11
- package/dist/runState.mjs.map +1 -1
- package/dist/runner/errorHandlers.d.ts +13 -4
- package/dist/runner/errorHandlers.js +22 -4
- package/dist/runner/errorHandlers.js.map +1 -1
- package/dist/runner/errorHandlers.mjs +21 -4
- package/dist/runner/errorHandlers.mjs.map +1 -1
- package/dist/runner/items.js +11 -1
- package/dist/runner/items.js.map +1 -1
- package/dist/runner/items.mjs +11 -1
- package/dist/runner/items.mjs.map +1 -1
- package/dist/runner/modelPreparation.d.ts +1 -1
- package/dist/runner/modelPreparation.js +7 -7
- package/dist/runner/modelPreparation.js.map +1 -1
- package/dist/runner/modelPreparation.mjs +7 -7
- package/dist/runner/modelPreparation.mjs.map +1 -1
- package/dist/runner/runLoop.d.ts +2 -1
- package/dist/runner/runLoop.js +2 -2
- package/dist/runner/runLoop.js.map +1 -1
- package/dist/runner/runLoop.mjs +2 -2
- package/dist/runner/runLoop.mjs.map +1 -1
- package/dist/runner/sandbox.d.ts +33 -0
- package/dist/runner/sandbox.js +92 -0
- package/dist/runner/sandbox.js.map +1 -0
- package/dist/runner/sandbox.mjs +83 -0
- package/dist/runner/sandbox.mjs.map +1 -0
- package/dist/runner/toolExecution.js +25 -13
- package/dist/runner/toolExecution.js.map +1 -1
- package/dist/runner/toolExecution.mjs +25 -13
- package/dist/runner/toolExecution.mjs.map +1 -1
- package/dist/runner/tracing.js +1 -0
- package/dist/runner/tracing.js.map +1 -1
- package/dist/runner/tracing.mjs +1 -0
- package/dist/runner/tracing.mjs.map +1 -1
- package/dist/runner/turnPreparation.d.ts +2 -4
- package/dist/runner/turnPreparation.js +7 -3
- package/dist/runner/turnPreparation.js.map +1 -1
- package/dist/runner/turnPreparation.mjs +7 -3
- package/dist/runner/turnPreparation.mjs.map +1 -1
- package/dist/runner/turnResolution.js +158 -31
- package/dist/runner/turnResolution.js.map +1 -1
- package/dist/runner/turnResolution.mjs +160 -33
- package/dist/runner/turnResolution.mjs.map +1 -1
- package/dist/runner/types.d.ts +8 -8
- package/dist/sandbox/agent.d.ts +24 -0
- package/dist/sandbox/agent.js +68 -0
- package/dist/sandbox/agent.js.map +1 -0
- package/dist/sandbox/agent.mjs +64 -0
- package/dist/sandbox/agent.mjs.map +1 -0
- package/dist/sandbox/brand.d.ts +1 -0
- package/dist/sandbox/brand.js +5 -0
- package/dist/sandbox/brand.js.map +1 -0
- package/dist/sandbox/brand.mjs +2 -0
- package/dist/sandbox/brand.mjs.map +1 -0
- package/dist/sandbox/capabilities/base.d.ts +25 -0
- package/dist/sandbox/capabilities/base.js +89 -0
- package/dist/sandbox/capabilities/base.js.map +1 -0
- package/dist/sandbox/capabilities/base.mjs +84 -0
- package/dist/sandbox/capabilities/base.mjs.map +1 -0
- package/dist/sandbox/capabilities/compaction.d.ts +33 -0
- package/dist/sandbox/capabilities/compaction.js +172 -0
- package/dist/sandbox/capabilities/compaction.js.map +1 -0
- package/dist/sandbox/capabilities/compaction.mjs +164 -0
- package/dist/sandbox/capabilities/compaction.mjs.map +1 -0
- package/dist/sandbox/capabilities/filesystem.d.ts +14 -0
- package/dist/sandbox/capabilities/filesystem.js +447 -0
- package/dist/sandbox/capabilities/filesystem.js.map +1 -0
- package/dist/sandbox/capabilities/filesystem.mjs +444 -0
- package/dist/sandbox/capabilities/filesystem.mjs.map +1 -0
- package/dist/sandbox/capabilities/index.d.ts +19 -0
- package/dist/sandbox/capabilities/index.js +31 -0
- package/dist/sandbox/capabilities/index.js.map +1 -0
- package/dist/sandbox/capabilities/index.mjs +17 -0
- package/dist/sandbox/capabilities/index.mjs.map +1 -0
- package/dist/sandbox/capabilities/memory.d.ts +52 -0
- package/dist/sandbox/capabilities/memory.js +290 -0
- package/dist/sandbox/capabilities/memory.js.map +1 -0
- package/dist/sandbox/capabilities/memory.mjs +286 -0
- package/dist/sandbox/capabilities/memory.mjs.map +1 -0
- package/dist/sandbox/capabilities/shell.d.ts +15 -0
- package/dist/sandbox/capabilities/shell.js +130 -0
- package/dist/sandbox/capabilities/shell.js.map +1 -0
- package/dist/sandbox/capabilities/shell.mjs +127 -0
- package/dist/sandbox/capabilities/shell.mjs.map +1 -0
- package/dist/sandbox/capabilities/skills.d.ts +47 -0
- package/dist/sandbox/capabilities/skills.js +453 -0
- package/dist/sandbox/capabilities/skills.js.map +1 -0
- package/dist/sandbox/capabilities/skills.mjs +449 -0
- package/dist/sandbox/capabilities/skills.mjs.map +1 -0
- package/dist/sandbox/capabilities/transport.d.ts +3 -0
- package/dist/sandbox/capabilities/transport.js +33 -0
- package/dist/sandbox/capabilities/transport.js.map +1 -0
- package/dist/sandbox/capabilities/transport.mjs +28 -0
- package/dist/sandbox/capabilities/transport.mjs.map +1 -0
- package/dist/sandbox/client.d.ts +53 -0
- package/dist/sandbox/client.js +34 -0
- package/dist/sandbox/client.js.map +1 -0
- package/dist/sandbox/client.mjs +31 -0
- package/dist/sandbox/client.mjs.map +1 -0
- package/dist/sandbox/entries/factories.d.ts +17 -0
- package/dist/sandbox/entries/factories.js +112 -0
- package/dist/sandbox/entries/factories.js.map +1 -0
- package/dist/sandbox/entries/factories.mjs +94 -0
- package/dist/sandbox/entries/factories.mjs.map +1 -0
- package/dist/sandbox/entries/guards.d.ts +5 -0
- package/dist/sandbox/entries/guards.js +19 -0
- package/dist/sandbox/entries/guards.js.map +1 -0
- package/dist/sandbox/entries/guards.mjs +13 -0
- package/dist/sandbox/entries/guards.mjs.map +1 -0
- package/dist/sandbox/entries/index.d.ts +3 -0
- package/dist/sandbox/entries/index.js +26 -0
- package/dist/sandbox/entries/index.js.map +1 -0
- package/dist/sandbox/entries/index.mjs +3 -0
- package/dist/sandbox/entries/index.mjs.map +1 -0
- package/dist/sandbox/entries/types.d.ts +177 -0
- package/dist/sandbox/entries/types.js +3 -0
- package/dist/sandbox/entries/types.js.map +1 -0
- package/dist/sandbox/entries/types.mjs +2 -0
- package/dist/sandbox/entries/types.mjs.map +1 -0
- package/dist/sandbox/errors.d.ts +151 -0
- package/dist/sandbox/errors.js +303 -0
- package/dist/sandbox/errors.js.map +1 -0
- package/dist/sandbox/errors.mjs +251 -0
- package/dist/sandbox/errors.mjs.map +1 -0
- package/dist/sandbox/events.d.ts +51 -0
- package/dist/sandbox/events.js +104 -0
- package/dist/sandbox/events.js.map +1 -0
- package/dist/sandbox/events.mjs +95 -0
- package/dist/sandbox/events.mjs.map +1 -0
- package/dist/sandbox/index.d.ts +14 -0
- package/dist/sandbox/index.js +31 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/sandbox/index.mjs +15 -0
- package/dist/sandbox/index.mjs.map +1 -0
- package/dist/sandbox/internal.d.ts +7 -0
- package/dist/sandbox/internal.js +46 -0
- package/dist/sandbox/internal.js.map +1 -0
- package/dist/sandbox/internal.mjs +8 -0
- package/dist/sandbox/internal.mjs.map +1 -0
- package/dist/sandbox/local.d.ts +3 -0
- package/dist/sandbox/local.js +20 -0
- package/dist/sandbox/local.js.map +1 -0
- package/dist/sandbox/local.mjs +4 -0
- package/dist/sandbox/local.mjs.map +1 -0
- package/dist/sandbox/localSkills.d.ts +13 -0
- package/dist/sandbox/localSkills.js +62 -0
- package/dist/sandbox/localSkills.js.map +1 -0
- package/dist/sandbox/localSkills.mjs +59 -0
- package/dist/sandbox/localSkills.mjs.map +1 -0
- package/dist/sandbox/manifest.d.ts +86 -0
- package/dist/sandbox/manifest.js +553 -0
- package/dist/sandbox/manifest.js.map +1 -0
- package/dist/sandbox/manifest.mjs +545 -0
- package/dist/sandbox/manifest.mjs.map +1 -0
- package/dist/sandbox/memory/generation.d.ts +56 -0
- package/dist/sandbox/memory/generation.js +426 -0
- package/dist/sandbox/memory/generation.js.map +1 -0
- package/dist/sandbox/memory/generation.mjs +385 -0
- package/dist/sandbox/memory/generation.mjs.map +1 -0
- package/dist/sandbox/memory/prompts.d.ts +16 -0
- package/dist/sandbox/memory/prompts.js +1685 -0
- package/dist/sandbox/memory/prompts.js.map +1 -0
- package/dist/sandbox/memory/prompts.mjs +1679 -0
- package/dist/sandbox/memory/prompts.mjs.map +1 -0
- package/dist/sandbox/memory/rollouts.d.ts +33 -0
- package/dist/sandbox/memory/rollouts.js +228 -0
- package/dist/sandbox/memory/rollouts.js.map +1 -0
- package/dist/sandbox/memory/rollouts.mjs +221 -0
- package/dist/sandbox/memory/rollouts.mjs.map +1 -0
- package/dist/sandbox/memory/storage.d.ts +70 -0
- package/dist/sandbox/memory/storage.js +543 -0
- package/dist/sandbox/memory/storage.js.map +1 -0
- package/dist/sandbox/memory/storage.mjs +537 -0
- package/dist/sandbox/memory/storage.mjs.map +1 -0
- package/dist/sandbox/pathGrants.d.ts +11 -0
- package/dist/sandbox/pathGrants.js +28 -0
- package/dist/sandbox/pathGrants.js.map +1 -0
- package/dist/sandbox/pathGrants.mjs +25 -0
- package/dist/sandbox/pathGrants.mjs.map +1 -0
- package/dist/sandbox/permissions.d.ts +29 -0
- package/dist/sandbox/permissions.js +140 -0
- package/dist/sandbox/permissions.js.map +1 -0
- package/dist/sandbox/permissions.mjs +134 -0
- package/dist/sandbox/permissions.mjs.map +1 -0
- package/dist/sandbox/runtime/agentKeys.d.ts +7 -0
- package/dist/sandbox/runtime/agentKeys.js +76 -0
- package/dist/sandbox/runtime/agentKeys.js.map +1 -0
- package/dist/sandbox/runtime/agentKeys.mjs +69 -0
- package/dist/sandbox/runtime/agentKeys.mjs.map +1 -0
- package/dist/sandbox/runtime/agentPreparation.d.ts +20 -0
- package/dist/sandbox/runtime/agentPreparation.js +178 -0
- package/dist/sandbox/runtime/agentPreparation.js.map +1 -0
- package/dist/sandbox/runtime/agentPreparation.mjs +172 -0
- package/dist/sandbox/runtime/agentPreparation.mjs.map +1 -0
- package/dist/sandbox/runtime/index.d.ts +5 -0
- package/dist/sandbox/runtime/index.js +22 -0
- package/dist/sandbox/runtime/index.js.map +1 -0
- package/dist/sandbox/runtime/index.mjs +6 -0
- package/dist/sandbox/runtime/index.mjs.map +1 -0
- package/dist/sandbox/runtime/livePreservedSessions.d.ts +25 -0
- package/dist/sandbox/runtime/livePreservedSessions.js +58 -0
- package/dist/sandbox/runtime/livePreservedSessions.js.map +1 -0
- package/dist/sandbox/runtime/livePreservedSessions.mjs +51 -0
- package/dist/sandbox/runtime/livePreservedSessions.mjs.map +1 -0
- package/dist/sandbox/runtime/manager.d.ts +68 -0
- package/dist/sandbox/runtime/manager.js +704 -0
- package/dist/sandbox/runtime/manager.js.map +1 -0
- package/dist/sandbox/runtime/manager.mjs +697 -0
- package/dist/sandbox/runtime/manager.mjs.map +1 -0
- package/dist/sandbox/runtime/prompts.d.ts +6 -0
- package/dist/sandbox/runtime/prompts.js +108 -0
- package/dist/sandbox/runtime/prompts.js.map +1 -0
- package/dist/sandbox/runtime/prompts.mjs +101 -0
- package/dist/sandbox/runtime/prompts.mjs.map +1 -0
- package/dist/sandbox/runtime/providedSessionManifest.d.ts +3 -0
- package/dist/sandbox/runtime/providedSessionManifest.js +175 -0
- package/dist/sandbox/runtime/providedSessionManifest.js.map +1 -0
- package/dist/sandbox/runtime/providedSessionManifest.mjs +172 -0
- package/dist/sandbox/runtime/providedSessionManifest.mjs.map +1 -0
- package/dist/sandbox/runtime/runAsManifest.d.ts +4 -0
- package/dist/sandbox/runtime/runAsManifest.js +40 -0
- package/dist/sandbox/runtime/runAsManifest.js.map +1 -0
- package/dist/sandbox/runtime/runAsManifest.mjs +36 -0
- package/dist/sandbox/runtime/runAsManifest.mjs.map +1 -0
- package/dist/sandbox/runtime/sessionLifecycle.d.ts +6 -0
- package/dist/sandbox/runtime/sessionLifecycle.js +222 -0
- package/dist/sandbox/runtime/sessionLifecycle.js.map +1 -0
- package/dist/sandbox/runtime/sessionLifecycle.mjs +215 -0
- package/dist/sandbox/runtime/sessionLifecycle.mjs.map +1 -0
- package/dist/sandbox/runtime/sessionSerialization.d.ts +12 -0
- package/dist/sandbox/runtime/sessionSerialization.js +74 -0
- package/dist/sandbox/runtime/sessionSerialization.js.map +1 -0
- package/dist/sandbox/runtime/sessionSerialization.mjs +71 -0
- package/dist/sandbox/runtime/sessionSerialization.mjs.map +1 -0
- package/dist/sandbox/runtime/sessionState.d.ts +26 -0
- package/dist/sandbox/runtime/sessionState.js +113 -0
- package/dist/sandbox/runtime/sessionState.js.map +1 -0
- package/dist/sandbox/runtime/sessionState.mjs +104 -0
- package/dist/sandbox/runtime/sessionState.mjs.map +1 -0
- package/dist/sandbox/runtime/spans.d.ts +1 -0
- package/dist/sandbox/runtime/spans.js +51 -0
- package/dist/sandbox/runtime/spans.js.map +1 -0
- package/dist/sandbox/runtime/spans.mjs +48 -0
- package/dist/sandbox/runtime/spans.mjs.map +1 -0
- package/dist/sandbox/runtime/toolRehydration.d.ts +34 -0
- package/dist/sandbox/runtime/toolRehydration.js +207 -0
- package/dist/sandbox/runtime/toolRehydration.js.map +1 -0
- package/dist/sandbox/runtime/toolRehydration.mjs +200 -0
- package/dist/sandbox/runtime/toolRehydration.mjs.map +1 -0
- package/dist/sandbox/sandboxes/docker.d.ts +75 -0
- package/dist/sandbox/sandboxes/docker.js +2015 -0
- package/dist/sandbox/sandboxes/docker.js.map +1 -0
- package/dist/sandbox/sandboxes/docker.mjs +2010 -0
- package/dist/sandbox/sandboxes/docker.mjs.map +1 -0
- package/dist/sandbox/sandboxes/index.d.ts +3 -0
- package/dist/sandbox/sandboxes/index.js +20 -0
- package/dist/sandbox/sandboxes/index.js.map +1 -0
- package/dist/sandbox/sandboxes/index.mjs +4 -0
- package/dist/sandbox/sandboxes/index.mjs.map +1 -0
- package/dist/sandbox/sandboxes/shared/localSnapshotPaths.d.ts +1 -0
- package/dist/sandbox/sandboxes/shared/localSnapshotPaths.js +22 -0
- package/dist/sandbox/sandboxes/shared/localSnapshotPaths.js.map +1 -0
- package/dist/sandbox/sandboxes/shared/localSnapshotPaths.mjs +19 -0
- package/dist/sandbox/sandboxes/shared/localSnapshotPaths.mjs.map +1 -0
- package/dist/sandbox/sandboxes/shared/localSnapshots.d.ts +34 -0
- package/dist/sandbox/sandboxes/shared/localSnapshots.js +525 -0
- package/dist/sandbox/sandboxes/shared/localSnapshots.js.map +1 -0
- package/dist/sandbox/sandboxes/shared/localSnapshots.mjs +508 -0
- package/dist/sandbox/sandboxes/shared/localSnapshots.mjs.map +1 -0
- package/dist/sandbox/sandboxes/shared/localWorkspace.d.ts +27 -0
- package/dist/sandbox/sandboxes/shared/localWorkspace.js +693 -0
- package/dist/sandbox/sandboxes/shared/localWorkspace.js.map +1 -0
- package/dist/sandbox/sandboxes/shared/localWorkspace.mjs +684 -0
- package/dist/sandbox/sandboxes/shared/localWorkspace.mjs.map +1 -0
- package/dist/sandbox/sandboxes/shared/manifestPersistence.d.ts +15 -0
- package/dist/sandbox/sandboxes/shared/manifestPersistence.js +191 -0
- package/dist/sandbox/sandboxes/shared/manifestPersistence.js.map +1 -0
- package/dist/sandbox/sandboxes/shared/manifestPersistence.mjs +182 -0
- package/dist/sandbox/sandboxes/shared/manifestPersistence.mjs.map +1 -0
- package/dist/sandbox/sandboxes/shared/pty.d.ts +9 -0
- package/dist/sandbox/sandboxes/shared/pty.js +151 -0
- package/dist/sandbox/sandboxes/shared/pty.js.map +1 -0
- package/dist/sandbox/sandboxes/shared/pty.mjs +148 -0
- package/dist/sandbox/sandboxes/shared/pty.mjs.map +1 -0
- package/dist/sandbox/sandboxes/shared/runProcess.d.ts +16 -0
- package/dist/sandbox/sandboxes/shared/runProcess.js +90 -0
- package/dist/sandbox/sandboxes/shared/runProcess.js.map +1 -0
- package/dist/sandbox/sandboxes/shared/runProcess.mjs +86 -0
- package/dist/sandbox/sandboxes/shared/runProcess.mjs.map +1 -0
- package/dist/sandbox/sandboxes/shared/sessionStateValues.d.ts +18 -0
- package/dist/sandbox/sandboxes/shared/sessionStateValues.js +40 -0
- package/dist/sandbox/sandboxes/shared/sessionStateValues.js.map +1 -0
- package/dist/sandbox/sandboxes/shared/sessionStateValues.mjs +35 -0
- package/dist/sandbox/sandboxes/shared/sessionStateValues.mjs.map +1 -0
- package/dist/sandbox/sandboxes/shared/shellCommand.d.ts +17 -0
- package/dist/sandbox/sandboxes/shared/shellCommand.js +38 -0
- package/dist/sandbox/sandboxes/shared/shellCommand.js.map +1 -0
- package/dist/sandbox/sandboxes/shared/shellCommand.mjs +34 -0
- package/dist/sandbox/sandboxes/shared/shellCommand.mjs.map +1 -0
- package/dist/sandbox/sandboxes/types.d.ts +11 -0
- package/dist/sandbox/sandboxes/types.js +3 -0
- package/dist/sandbox/sandboxes/types.js.map +1 -0
- package/dist/sandbox/sandboxes/types.mjs +2 -0
- package/dist/sandbox/sandboxes/types.mjs.map +1 -0
- package/dist/sandbox/sandboxes/unixLocal.d.ts +95 -0
- package/dist/sandbox/sandboxes/unixLocal.js +863 -0
- package/dist/sandbox/sandboxes/unixLocal.js.map +1 -0
- package/dist/sandbox/sandboxes/unixLocal.mjs +858 -0
- package/dist/sandbox/sandboxes/unixLocal.mjs.map +1 -0
- package/dist/sandbox/session.d.ts +123 -0
- package/dist/sandbox/session.js +58 -0
- package/dist/sandbox/session.js.map +1 -0
- package/dist/sandbox/session.mjs +50 -0
- package/dist/sandbox/session.mjs.map +1 -0
- package/dist/sandbox/shared/compare.d.ts +2 -0
- package/dist/sandbox/shared/compare.js +13 -0
- package/dist/sandbox/shared/compare.js.map +1 -0
- package/dist/sandbox/shared/compare.mjs +9 -0
- package/dist/sandbox/shared/compare.mjs.map +1 -0
- package/dist/sandbox/shared/environment.d.ts +14 -0
- package/dist/sandbox/shared/environment.js +69 -0
- package/dist/sandbox/shared/environment.js.map +1 -0
- package/dist/sandbox/shared/environment.mjs +59 -0
- package/dist/sandbox/shared/environment.mjs.map +1 -0
- package/dist/sandbox/shared/hostPath.d.ts +4 -0
- package/dist/sandbox/shared/hostPath.js +22 -0
- package/dist/sandbox/shared/hostPath.js.map +1 -0
- package/dist/sandbox/shared/hostPath.mjs +16 -0
- package/dist/sandbox/shared/hostPath.mjs.map +1 -0
- package/dist/sandbox/shared/manifestCollections.d.ts +12 -0
- package/dist/sandbox/shared/manifestCollections.js +40 -0
- package/dist/sandbox/shared/manifestCollections.js.map +1 -0
- package/dist/sandbox/shared/manifestCollections.mjs +34 -0
- package/dist/sandbox/shared/manifestCollections.mjs.map +1 -0
- package/dist/sandbox/shared/media.d.ts +6 -0
- package/dist/sandbox/shared/media.js +126 -0
- package/dist/sandbox/shared/media.js.map +1 -0
- package/dist/sandbox/shared/media.mjs +119 -0
- package/dist/sandbox/shared/media.mjs.map +1 -0
- package/dist/sandbox/shared/output.d.ts +12 -0
- package/dist/sandbox/shared/output.js +108 -0
- package/dist/sandbox/shared/output.js.map +1 -0
- package/dist/sandbox/shared/output.mjs +103 -0
- package/dist/sandbox/shared/output.mjs.map +1 -0
- package/dist/sandbox/shared/posixPath.d.ts +7 -0
- package/dist/sandbox/shared/posixPath.js +90 -0
- package/dist/sandbox/shared/posixPath.js.map +1 -0
- package/dist/sandbox/shared/posixPath.mjs +81 -0
- package/dist/sandbox/shared/posixPath.mjs.map +1 -0
- package/dist/sandbox/shared/remoteMountCommandAllowlist.d.ts +3 -0
- package/dist/sandbox/shared/remoteMountCommandAllowlist.js +33 -0
- package/dist/sandbox/shared/remoteMountCommandAllowlist.js.map +1 -0
- package/dist/sandbox/shared/remoteMountCommandAllowlist.mjs +28 -0
- package/dist/sandbox/shared/remoteMountCommandAllowlist.mjs.map +1 -0
- package/dist/sandbox/shared/shell.d.ts +1 -0
- package/dist/sandbox/shared/shell.js +7 -0
- package/dist/sandbox/shared/shell.js.map +1 -0
- package/dist/sandbox/shared/shell.mjs +4 -0
- package/dist/sandbox/shared/shell.mjs.map +1 -0
- package/dist/sandbox/shared/stableJson.d.ts +12 -0
- package/dist/sandbox/shared/stableJson.js +40 -0
- package/dist/sandbox/shared/stableJson.js.map +1 -0
- package/dist/sandbox/shared/stableJson.mjs +35 -0
- package/dist/sandbox/shared/stableJson.mjs.map +1 -0
- package/dist/sandbox/shared/typeGuards.d.ts +6 -0
- package/dist/sandbox/shared/typeGuards.js +34 -0
- package/dist/sandbox/shared/typeGuards.js.map +1 -0
- package/dist/sandbox/shared/typeGuards.mjs +26 -0
- package/dist/sandbox/shared/typeGuards.mjs.map +1 -0
- package/dist/sandbox/snapshot.d.ts +60 -0
- package/dist/sandbox/snapshot.js +45 -0
- package/dist/sandbox/snapshot.js.map +1 -0
- package/dist/sandbox/snapshot.mjs +39 -0
- package/dist/sandbox/snapshot.mjs.map +1 -0
- package/dist/sandbox/users.d.ts +11 -0
- package/dist/sandbox/users.js +31 -0
- package/dist/sandbox/users.js.map +1 -0
- package/dist/sandbox/users.mjs +26 -0
- package/dist/sandbox/users.mjs.map +1 -0
- package/dist/sandbox/workspacePaths.d.ts +20 -0
- package/dist/sandbox/workspacePaths.js +73 -0
- package/dist/sandbox/workspacePaths.js.map +1 -0
- package/dist/sandbox/workspacePaths.mjs +69 -0
- package/dist/sandbox/workspacePaths.mjs.map +1 -0
- package/dist/tool.js +1 -1
- package/dist/tool.js.map +1 -1
- package/dist/tool.mjs +1 -1
- package/dist/tool.mjs.map +1 -1
- package/dist/types/protocol.d.ts +8 -0
- package/dist/types/protocol.js +1 -0
- package/dist/types/protocol.js.map +1 -1
- package/dist/types/protocol.mjs +1 -0
- package/dist/types/protocol.mjs.map +1 -1
- package/dist/utils/messages.d.ts +6 -0
- package/dist/utils/messages.js +21 -0
- package/dist/utils/messages.js.map +1 -1
- package/dist/utils/messages.mjs +20 -0
- package/dist/utils/messages.mjs.map +1 -1
- package/dist/utils/strictToolSchema.d.ts +4 -0
- package/dist/utils/strictToolSchema.js +358 -0
- package/dist/utils/strictToolSchema.js.map +1 -0
- package/dist/utils/strictToolSchema.mjs +353 -0
- package/dist/utils/strictToolSchema.mjs.map +1 -0
- package/dist/utils/tools.d.ts +3 -1
- package/dist/utils/tools.js +18 -7
- package/dist/utils/tools.js.map +1 -1
- package/dist/utils/tools.mjs +18 -7
- package/dist/utils/tools.mjs.map +1 -1
- package/dist/utils/zodJsonSchemaCompat.js +18 -16
- package/dist/utils/zodJsonSchemaCompat.js.map +1 -1
- package/dist/utils/zodJsonSchemaCompat.mjs +18 -16
- package/dist/utils/zodJsonSchemaCompat.mjs.map +1 -1
- package/package.json +25 -1
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LOCAL_SNAPSHOT_FINGERPRINT_VERSION = void 0;
|
|
4
|
+
exports.createLocalSnapshot = createLocalSnapshot;
|
|
5
|
+
exports.createRemoteSnapshot = createRemoteSnapshot;
|
|
6
|
+
exports.persistLocalSnapshot = persistLocalSnapshot;
|
|
7
|
+
exports.serializeLocalSnapshotSpec = serializeLocalSnapshotSpec;
|
|
8
|
+
exports.rehydrateLocalSnapshotSpec = rehydrateLocalSnapshotSpec;
|
|
9
|
+
exports.replaceLocalSnapshot = replaceLocalSnapshot;
|
|
10
|
+
exports.canReuseLocalSnapshotWorkspace = canReuseLocalSnapshotWorkspace;
|
|
11
|
+
exports.localSnapshotIsRestorable = localSnapshotIsRestorable;
|
|
12
|
+
exports.restoreLocalSnapshotToWorkspace = restoreLocalSnapshotToWorkspace;
|
|
13
|
+
exports.computeLocalSnapshotFingerprint = computeLocalSnapshotFingerprint;
|
|
14
|
+
exports.copyDirectory = copyDirectory;
|
|
15
|
+
exports.createWorkspaceArchive = createWorkspaceArchive;
|
|
16
|
+
exports.restoreWorkspaceArchive = restoreWorkspaceArchive;
|
|
17
|
+
exports.isRemoteSnapshotSpec = isRemoteSnapshotSpec;
|
|
18
|
+
const errors_1 = require("../../../errors.js");
|
|
19
|
+
const snapshot_1 = require("../../snapshot.js");
|
|
20
|
+
const promises_1 = require("node:fs/promises");
|
|
21
|
+
const node_fs_1 = require("node:fs");
|
|
22
|
+
const node_crypto_1 = require("node:crypto");
|
|
23
|
+
const node_path_1 = require("node:path");
|
|
24
|
+
const stableJson_1 = require("../../shared/stableJson.js");
|
|
25
|
+
const typeGuards_1 = require("../../shared/typeGuards.js");
|
|
26
|
+
const hostPath_1 = require("../../shared/hostPath.js");
|
|
27
|
+
const localSnapshotPaths_1 = require("./localSnapshotPaths.js");
|
|
28
|
+
const manifestPersistence_1 = require("./manifestPersistence.js");
|
|
29
|
+
exports.LOCAL_SNAPSHOT_FINGERPRINT_VERSION = 'workspace_tree_sha256_v1';
|
|
30
|
+
const SNAPSHOT_FILE_READ_FLAGS = node_fs_1.constants.O_RDONLY | node_fs_1.constants.O_NOFOLLOW;
|
|
31
|
+
const SNAPSHOT_FILE_WRITE_FLAGS = node_fs_1.constants.O_WRONLY |
|
|
32
|
+
node_fs_1.constants.O_CREAT |
|
|
33
|
+
node_fs_1.constants.O_TRUNC |
|
|
34
|
+
node_fs_1.constants.O_NOFOLLOW;
|
|
35
|
+
async function createLocalSnapshot(state, spec) {
|
|
36
|
+
const snapshotPath = await mkdtempForSnapshot(spec);
|
|
37
|
+
await copyDirectory(state.workspaceRootPath, snapshotPath, localSnapshotExcludedPaths(state));
|
|
38
|
+
return {
|
|
39
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
40
|
+
type: 'local',
|
|
41
|
+
path: snapshotPath,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
async function createRemoteSnapshot(state, spec) {
|
|
45
|
+
const data = await createWorkspaceArchive(state.workspaceRootPath, localSnapshotExcludedPaths(state));
|
|
46
|
+
const saved = await spec.store.save({
|
|
47
|
+
id: spec.id,
|
|
48
|
+
data,
|
|
49
|
+
metadata: spec.metadata,
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
id: saved.id,
|
|
53
|
+
type: 'remote',
|
|
54
|
+
...(saved.metadata ? { metadata: saved.metadata } : {}),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
async function persistLocalSnapshot(providerName, state, spec) {
|
|
58
|
+
if ((0, snapshot_1.isNoopSnapshotSpec)(spec)) {
|
|
59
|
+
await replaceLocalSnapshot(state, null);
|
|
60
|
+
replaceLocalSnapshotFingerprint(state, null);
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
if (isRemoteSnapshotSpec(spec)) {
|
|
64
|
+
const fingerprint = await computeLocalSnapshotFingerprint(state);
|
|
65
|
+
const snapshot = await createRemoteSnapshot(state, spec);
|
|
66
|
+
await replaceLocalSnapshot(state, snapshot);
|
|
67
|
+
replaceLocalSnapshotFingerprint(state, fingerprint);
|
|
68
|
+
return snapshot;
|
|
69
|
+
}
|
|
70
|
+
if (spec && spec.type !== 'local') {
|
|
71
|
+
throw new errors_1.UserError(`${providerName} does not support snapshot specs of type "${spec.type}".`);
|
|
72
|
+
}
|
|
73
|
+
const fingerprint = await computeLocalSnapshotFingerprint(state);
|
|
74
|
+
const snapshot = await createLocalSnapshot(state, spec ?? undefined);
|
|
75
|
+
await replaceLocalSnapshot(state, snapshot);
|
|
76
|
+
replaceLocalSnapshotFingerprint(state, fingerprint);
|
|
77
|
+
return snapshot;
|
|
78
|
+
}
|
|
79
|
+
function serializeLocalSnapshotSpec(spec) {
|
|
80
|
+
if (!spec) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
if (spec.type === 'remote') {
|
|
84
|
+
return {
|
|
85
|
+
type: 'remote',
|
|
86
|
+
...(typeof spec.id === 'string' ? { id: spec.id } : {}),
|
|
87
|
+
...(spec.metadata ? { metadata: structuredClone(spec.metadata) } : {}),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return structuredClone(spec);
|
|
91
|
+
}
|
|
92
|
+
function rehydrateLocalSnapshotSpec(serialized, configured) {
|
|
93
|
+
// Remote SnapshotStore implementations can carry functions or credentials, so
|
|
94
|
+
// serialized state stores only lookup fields and reattaches the live configured store.
|
|
95
|
+
if (!(0, typeGuards_1.isRecord)(serialized)) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
if (serialized.type !== 'remote') {
|
|
99
|
+
return structuredClone(serialized);
|
|
100
|
+
}
|
|
101
|
+
if (isRemoteSnapshotSpec(serialized)) {
|
|
102
|
+
return serialized;
|
|
103
|
+
}
|
|
104
|
+
if (!isRemoteSnapshotSpec(configured)) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
const id = typeof serialized.id === 'string' ? serialized.id : configured.id;
|
|
108
|
+
const metadata = (0, typeGuards_1.isRecord)(serialized.metadata)
|
|
109
|
+
? structuredClone(serialized.metadata)
|
|
110
|
+
: configured.metadata;
|
|
111
|
+
return {
|
|
112
|
+
type: 'remote',
|
|
113
|
+
store: configured.store,
|
|
114
|
+
...(id ? { id } : {}),
|
|
115
|
+
...(metadata ? { metadata } : {}),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
async function replaceLocalSnapshot(state, snapshot) {
|
|
119
|
+
const previousSnapshot = state.snapshot;
|
|
120
|
+
state.snapshot = snapshot;
|
|
121
|
+
if (previousSnapshot?.type === 'local' &&
|
|
122
|
+
previousSnapshot.path !== snapshot?.path &&
|
|
123
|
+
previousSnapshot.path !== state.workspaceRootPath) {
|
|
124
|
+
await (0, promises_1.rm)(previousSnapshot.path, { recursive: true, force: true });
|
|
125
|
+
}
|
|
126
|
+
if (previousSnapshot?.type === 'remote' &&
|
|
127
|
+
previousSnapshot.id !== snapshot?.id) {
|
|
128
|
+
const store = remoteSnapshotStoreFromSpec(state);
|
|
129
|
+
await store?.delete?.({ id: previousSnapshot.id }).catch(() => undefined);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async function canReuseLocalSnapshotWorkspace(state) {
|
|
133
|
+
if (!(await localSnapshotIsRestorable(state))) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
const storedFingerprint = state.snapshotFingerprint;
|
|
137
|
+
const storedVersion = state.snapshotFingerprintVersion;
|
|
138
|
+
if (!storedFingerprint ||
|
|
139
|
+
storedVersion !== exports.LOCAL_SNAPSHOT_FINGERPRINT_VERSION) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
const current = await computeLocalSnapshotFingerprint(state).catch(() => null);
|
|
143
|
+
// The fingerprint covers the persisted manifest plus durable workspace tree; ephemeral
|
|
144
|
+
// paths are intentionally ignored because they are rebuilt after resume.
|
|
145
|
+
return (current?.fingerprint === storedFingerprint &&
|
|
146
|
+
current.version === storedVersion);
|
|
147
|
+
}
|
|
148
|
+
async function localSnapshotIsRestorable(state) {
|
|
149
|
+
if (state.snapshot?.type === 'remote') {
|
|
150
|
+
const store = remoteSnapshotStoreFromSpec(state);
|
|
151
|
+
if (!store) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
if (store.exists) {
|
|
155
|
+
return await store.exists({ id: state.snapshot.id });
|
|
156
|
+
}
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
return Boolean(state.snapshot?.type === 'local' && (await pathExists(state.snapshot.path)));
|
|
160
|
+
}
|
|
161
|
+
async function restoreLocalSnapshotToWorkspace(state, workspaceRootPath) {
|
|
162
|
+
if (!(await localSnapshotIsRestorable(state))) {
|
|
163
|
+
throw new errors_1.UserError('No local snapshot is available to restore.');
|
|
164
|
+
}
|
|
165
|
+
if (state.snapshot?.type === 'remote') {
|
|
166
|
+
const store = remoteSnapshotStoreFromSpec(state);
|
|
167
|
+
if (!store) {
|
|
168
|
+
throw new errors_1.UserError('No remote snapshot store is available to restore.');
|
|
169
|
+
}
|
|
170
|
+
const restored = await store.load({ id: state.snapshot.id });
|
|
171
|
+
await restoreWorkspaceArchive(restored.data, workspaceRootPath);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
await replaceDirectoryContents(state.snapshot.path, workspaceRootPath);
|
|
175
|
+
}
|
|
176
|
+
state.workspaceRootPath = workspaceRootPath;
|
|
177
|
+
const fingerprint = await computeLocalSnapshotFingerprint(state).catch(() => null);
|
|
178
|
+
replaceLocalSnapshotFingerprint(state, fingerprint);
|
|
179
|
+
return state;
|
|
180
|
+
}
|
|
181
|
+
async function computeLocalSnapshotFingerprint(state) {
|
|
182
|
+
const hash = (0, node_crypto_1.createHash)('sha256');
|
|
183
|
+
appendHashFrame(hash, 'version', exports.LOCAL_SNAPSHOT_FINGERPRINT_VERSION);
|
|
184
|
+
appendHashFrame(hash, 'manifest', (0, stableJson_1.stableJsonStringify)((0, manifestPersistence_1.serializeManifest)(state.manifest), {
|
|
185
|
+
encodeBytes: (value) => ({
|
|
186
|
+
type: 'Uint8Array',
|
|
187
|
+
data: Buffer.from(value).toString('base64'),
|
|
188
|
+
}),
|
|
189
|
+
}));
|
|
190
|
+
await hashDirectory(hash, state.workspaceRootPath, localSnapshotExcludedPaths(state));
|
|
191
|
+
return {
|
|
192
|
+
fingerprint: hash.digest('hex'),
|
|
193
|
+
version: exports.LOCAL_SNAPSHOT_FINGERPRINT_VERSION,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function localSnapshotExcludedPaths(state) {
|
|
197
|
+
const paths = state.manifest.ephemeralPersistencePaths();
|
|
198
|
+
for (const path of state.snapshotExcludedPaths ?? []) {
|
|
199
|
+
paths.add(path);
|
|
200
|
+
}
|
|
201
|
+
return paths;
|
|
202
|
+
}
|
|
203
|
+
async function copyDirectory(sourceRoot, destinationRoot, excludedLogicalPaths = new Set(), currentRelativePath = '', expectedSourceStats, destinationRootPath = destinationRoot) {
|
|
204
|
+
const entries = await readStableSnapshotDirectoryEntries(sourceRoot, expectedSourceStats);
|
|
205
|
+
await assertSafeSnapshotDestinationPath(destinationRootPath, destinationRoot);
|
|
206
|
+
await (0, promises_1.mkdir)(destinationRoot, { recursive: true });
|
|
207
|
+
await assertSafeSnapshotDestinationPath(destinationRootPath, destinationRoot);
|
|
208
|
+
for (const entry of entries) {
|
|
209
|
+
const relativePath = currentRelativePath
|
|
210
|
+
? `${currentRelativePath}/${entry.name}`
|
|
211
|
+
: entry.name;
|
|
212
|
+
if (shouldSkipSnapshotPath(relativePath, excludedLogicalPaths)) {
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
const sourcePath = (0, node_path_1.join)(sourceRoot, entry.name);
|
|
216
|
+
const destinationPath = (0, node_path_1.join)(destinationRoot, entry.name);
|
|
217
|
+
const sourceStats = await (0, promises_1.lstat)(sourcePath);
|
|
218
|
+
if (sourceStats.isDirectory()) {
|
|
219
|
+
await copyDirectory(sourcePath, destinationPath, excludedLogicalPaths, relativePath, sourceStats, destinationRootPath);
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (!sourceStats.isFile()) {
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
await assertSafeSnapshotDestinationPath(destinationRootPath, (0, node_path_1.dirname)(destinationPath));
|
|
226
|
+
await (0, promises_1.mkdir)((0, node_path_1.dirname)(destinationPath), { recursive: true });
|
|
227
|
+
await assertSafeSnapshotDestinationPath(destinationRootPath, (0, node_path_1.dirname)(destinationPath));
|
|
228
|
+
await writeStableSnapshotFile(destinationRootPath, destinationPath, await readStableSnapshotFile(sourcePath, sourceStats), sourceStats.mode & 0o777);
|
|
229
|
+
const destinationStats = await (0, promises_1.lstat)(destinationPath);
|
|
230
|
+
if (!destinationStats.isFile()) {
|
|
231
|
+
await (0, promises_1.rm)(destinationPath, { recursive: true, force: true });
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
async function createWorkspaceArchive(sourceRoot, excludedLogicalPaths) {
|
|
236
|
+
// Remote SnapshotStore is provider-agnostic, so its portable fallback is a small
|
|
237
|
+
// JSON/base64 archive instead of relying on host tar availability.
|
|
238
|
+
const archive = {
|
|
239
|
+
version: 1,
|
|
240
|
+
directories: [],
|
|
241
|
+
files: [],
|
|
242
|
+
};
|
|
243
|
+
await appendWorkspaceArchiveEntries(archive, sourceRoot, excludedLogicalPaths);
|
|
244
|
+
return new TextEncoder().encode(JSON.stringify(archive));
|
|
245
|
+
}
|
|
246
|
+
async function appendWorkspaceArchiveEntries(archive, sourceRoot, excludedLogicalPaths, currentRelativePath = '', expectedSourceStats) {
|
|
247
|
+
const entries = await readStableSnapshotDirectoryEntries(sourceRoot, expectedSourceStats);
|
|
248
|
+
for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
249
|
+
const relativePath = currentRelativePath
|
|
250
|
+
? `${currentRelativePath}/${entry.name}`
|
|
251
|
+
: entry.name;
|
|
252
|
+
if (shouldSkipSnapshotPath(relativePath, excludedLogicalPaths)) {
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
const sourcePath = (0, node_path_1.join)(sourceRoot, entry.name);
|
|
256
|
+
const sourceStats = await (0, promises_1.lstat)(sourcePath);
|
|
257
|
+
if (sourceStats.isDirectory()) {
|
|
258
|
+
archive.directories.push(relativePath);
|
|
259
|
+
await appendWorkspaceArchiveEntries(archive, sourcePath, excludedLogicalPaths, relativePath, sourceStats);
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (!sourceStats.isFile()) {
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
archive.files.push({
|
|
266
|
+
path: relativePath,
|
|
267
|
+
data: Buffer.from(await readStableSnapshotFile(sourcePath, sourceStats)).toString('base64'),
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
async function restoreWorkspaceArchive(data, destinationRoot) {
|
|
272
|
+
const archive = JSON.parse(typeof data === 'string'
|
|
273
|
+
? data
|
|
274
|
+
: new TextDecoder().decode(workspaceArchiveDataToUint8Array(data)));
|
|
275
|
+
if (archive.version !== 1) {
|
|
276
|
+
throw new errors_1.UserError('Unsupported remote snapshot archive version.');
|
|
277
|
+
}
|
|
278
|
+
await (0, promises_1.mkdir)(destinationRoot, { recursive: true });
|
|
279
|
+
await clearDirectory(destinationRoot);
|
|
280
|
+
for (const directory of archive.directories) {
|
|
281
|
+
await writeSafeArchiveDirectory(destinationRoot, directory);
|
|
282
|
+
}
|
|
283
|
+
for (const file of archive.files) {
|
|
284
|
+
await writeSafeArchiveFile(destinationRoot, file.path, file.data);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function workspaceArchiveDataToUint8Array(data) {
|
|
288
|
+
if (data instanceof Uint8Array) {
|
|
289
|
+
return data;
|
|
290
|
+
}
|
|
291
|
+
return new Uint8Array(data);
|
|
292
|
+
}
|
|
293
|
+
async function writeSafeArchiveDirectory(destinationRoot, relativePath) {
|
|
294
|
+
const destinationPath = safeArchivePath(destinationRoot, relativePath);
|
|
295
|
+
await assertSafeSnapshotDestinationPath(destinationRoot, destinationPath);
|
|
296
|
+
await (0, promises_1.mkdir)(destinationPath, { recursive: true });
|
|
297
|
+
await assertSafeSnapshotDestinationPath(destinationRoot, destinationPath);
|
|
298
|
+
}
|
|
299
|
+
async function writeSafeArchiveFile(destinationRoot, relativePath, base64Data) {
|
|
300
|
+
const destinationPath = safeArchivePath(destinationRoot, relativePath);
|
|
301
|
+
await assertSafeSnapshotDestinationPath(destinationRoot, (0, node_path_1.dirname)(destinationPath));
|
|
302
|
+
await (0, promises_1.mkdir)((0, node_path_1.dirname)(destinationPath), { recursive: true });
|
|
303
|
+
await assertSafeSnapshotDestinationPath(destinationRoot, (0, node_path_1.dirname)(destinationPath));
|
|
304
|
+
await writeStableSnapshotFile(destinationRoot, destinationPath, Buffer.from(base64Data, 'base64'));
|
|
305
|
+
}
|
|
306
|
+
function safeArchivePath(destinationRoot, relativePath) {
|
|
307
|
+
const destinationPath = (0, node_path_1.join)(destinationRoot, relativePath);
|
|
308
|
+
if (!(0, hostPath_1.isHostPathStrictlyWithinRoot)(destinationRoot, destinationPath)) {
|
|
309
|
+
throw new errors_1.UserError(`Remote snapshot archive path escapes root: ${relativePath}`);
|
|
310
|
+
}
|
|
311
|
+
return destinationPath;
|
|
312
|
+
}
|
|
313
|
+
async function replaceDirectoryContents(sourceRoot, destinationRoot) {
|
|
314
|
+
await assertSafeSnapshotDestinationPath(destinationRoot, destinationRoot);
|
|
315
|
+
await (0, promises_1.mkdir)(destinationRoot, { recursive: true });
|
|
316
|
+
await assertSafeSnapshotDestinationPath(destinationRoot, destinationRoot);
|
|
317
|
+
await clearDirectory(destinationRoot);
|
|
318
|
+
await copyDirectory(sourceRoot, destinationRoot);
|
|
319
|
+
}
|
|
320
|
+
async function clearDirectory(destinationRoot) {
|
|
321
|
+
await assertSafeSnapshotDestinationPath(destinationRoot, destinationRoot);
|
|
322
|
+
const entries = await (0, promises_1.readdir)(destinationRoot);
|
|
323
|
+
await Promise.all(entries.map(async (entry) => {
|
|
324
|
+
await (0, promises_1.rm)((0, node_path_1.join)(destinationRoot, entry), { recursive: true, force: true });
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
327
|
+
function replaceLocalSnapshotFingerprint(state, fingerprint) {
|
|
328
|
+
state.snapshotFingerprint = fingerprint?.fingerprint ?? null;
|
|
329
|
+
state.snapshotFingerprintVersion = fingerprint?.version ?? null;
|
|
330
|
+
}
|
|
331
|
+
async function mkdtempForSnapshot(spec) {
|
|
332
|
+
const baseDir = spec?.baseDir ?? (0, localSnapshotPaths_1.defaultLocalSnapshotBaseDir)();
|
|
333
|
+
await (0, promises_1.mkdir)(baseDir, { recursive: true });
|
|
334
|
+
return await (0, promises_1.mkdtemp)((0, node_path_1.join)(baseDir, 'openai-agents-sandbox-snapshot-'));
|
|
335
|
+
}
|
|
336
|
+
function shouldSkipSnapshotPath(relativePath, excludedLogicalPaths) {
|
|
337
|
+
for (const excluded of excludedLogicalPaths) {
|
|
338
|
+
if (excluded === '' ||
|
|
339
|
+
relativePath === excluded ||
|
|
340
|
+
relativePath.startsWith(`${excluded}/`)) {
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
function isRemoteSnapshotSpec(spec) {
|
|
347
|
+
const store = spec?.store;
|
|
348
|
+
return (spec?.type === 'remote' &&
|
|
349
|
+
typeof store === 'object' &&
|
|
350
|
+
store !== null &&
|
|
351
|
+
typeof store.save === 'function' &&
|
|
352
|
+
typeof store.load === 'function');
|
|
353
|
+
}
|
|
354
|
+
function remoteSnapshotStoreFromSpec(state) {
|
|
355
|
+
const spec = state.snapshotSpec;
|
|
356
|
+
return isRemoteSnapshotSpec(spec) ? spec.store : undefined;
|
|
357
|
+
}
|
|
358
|
+
async function pathExists(path) {
|
|
359
|
+
try {
|
|
360
|
+
await (0, promises_1.stat)(path);
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
catch {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
async function hashDirectory(hash, rootPath, excludedLogicalPaths, currentRelativePath = '', expectedSourceStats) {
|
|
368
|
+
const entries = await readStableSnapshotDirectoryEntries(rootPath, expectedSourceStats);
|
|
369
|
+
for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
370
|
+
const relativePath = currentRelativePath
|
|
371
|
+
? `${currentRelativePath}/${entry.name}`
|
|
372
|
+
: entry.name;
|
|
373
|
+
if (shouldSkipSnapshotPath(relativePath, excludedLogicalPaths)) {
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
const entryPath = (0, node_path_1.join)(rootPath, entry.name);
|
|
377
|
+
const entryStats = await (0, promises_1.lstat)(entryPath);
|
|
378
|
+
if (entryStats.isDirectory()) {
|
|
379
|
+
appendHashFrame(hash, 'dir', relativePath);
|
|
380
|
+
await hashDirectory(hash, entryPath, excludedLogicalPaths, relativePath, entryStats);
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
if (!entryStats.isFile()) {
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
const content = await readStableSnapshotFile(entryPath, entryStats);
|
|
387
|
+
appendHashFrame(hash, 'file', relativePath);
|
|
388
|
+
appendHashFrame(hash, 'bytes', String(content.byteLength));
|
|
389
|
+
hash.update(content);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
async function readStableSnapshotDirectoryEntries(sourceRoot, expectedSourceStats) {
|
|
393
|
+
const sourceStats = await (0, promises_1.lstat)(sourceRoot);
|
|
394
|
+
if (!sourceStats.isDirectory() ||
|
|
395
|
+
(expectedSourceStats &&
|
|
396
|
+
!sameFilesystemEntry(sourceStats, expectedSourceStats))) {
|
|
397
|
+
throw snapshotPathChangedError(sourceRoot);
|
|
398
|
+
}
|
|
399
|
+
const entries = await (0, promises_1.readdir)(sourceRoot, { withFileTypes: true });
|
|
400
|
+
await assertStableSnapshotDirectory(sourceRoot, sourceStats);
|
|
401
|
+
return entries;
|
|
402
|
+
}
|
|
403
|
+
async function assertStableSnapshotDirectory(sourceRoot, expectedSourceStats) {
|
|
404
|
+
const sourceStats = await (0, promises_1.lstat)(sourceRoot);
|
|
405
|
+
if (!sourceStats.isDirectory() ||
|
|
406
|
+
!sameFilesystemEntry(sourceStats, expectedSourceStats)) {
|
|
407
|
+
throw snapshotPathChangedError(sourceRoot);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
async function readStableSnapshotFile(sourcePath, expectedSourceStats) {
|
|
411
|
+
const sourceStats = await (0, promises_1.lstat)(sourcePath);
|
|
412
|
+
if (!sourceStats.isFile() ||
|
|
413
|
+
!sameFilesystemEntry(sourceStats, expectedSourceStats)) {
|
|
414
|
+
throw snapshotPathChangedError(sourcePath);
|
|
415
|
+
}
|
|
416
|
+
let handle;
|
|
417
|
+
try {
|
|
418
|
+
handle = await (0, promises_1.open)(sourcePath, SNAPSHOT_FILE_READ_FLAGS);
|
|
419
|
+
}
|
|
420
|
+
catch (error) {
|
|
421
|
+
if (isPathChangedError(error)) {
|
|
422
|
+
throw snapshotPathChangedError(sourcePath);
|
|
423
|
+
}
|
|
424
|
+
throw error;
|
|
425
|
+
}
|
|
426
|
+
try {
|
|
427
|
+
const openedStats = await handle.stat();
|
|
428
|
+
if (!openedStats.isFile() ||
|
|
429
|
+
!sameFilesystemEntry(openedStats, sourceStats)) {
|
|
430
|
+
throw snapshotPathChangedError(sourcePath);
|
|
431
|
+
}
|
|
432
|
+
return await handle.readFile();
|
|
433
|
+
}
|
|
434
|
+
finally {
|
|
435
|
+
await handle.close();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
async function writeStableSnapshotFile(destinationRoot, destinationPath, content, mode) {
|
|
439
|
+
await assertSafeSnapshotDestinationPath(destinationRoot, destinationPath);
|
|
440
|
+
let handle;
|
|
441
|
+
try {
|
|
442
|
+
handle = await (0, promises_1.open)(destinationPath, SNAPSHOT_FILE_WRITE_FLAGS, mode);
|
|
443
|
+
}
|
|
444
|
+
catch (error) {
|
|
445
|
+
if (isPathChangedError(error)) {
|
|
446
|
+
throw snapshotPathChangedError(destinationPath);
|
|
447
|
+
}
|
|
448
|
+
throw error;
|
|
449
|
+
}
|
|
450
|
+
try {
|
|
451
|
+
await handle.writeFile(content);
|
|
452
|
+
if (mode !== undefined) {
|
|
453
|
+
await handle.chmod(mode);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
finally {
|
|
457
|
+
await handle.close();
|
|
458
|
+
}
|
|
459
|
+
await assertSafeSnapshotDestinationPath(destinationRoot, destinationPath);
|
|
460
|
+
}
|
|
461
|
+
async function assertSafeSnapshotDestinationPath(destinationRoot, destinationPath) {
|
|
462
|
+
const rootStats = await (0, promises_1.lstat)(destinationRoot).catch(() => undefined);
|
|
463
|
+
if (!rootStats?.isDirectory() || rootStats.isSymbolicLink()) {
|
|
464
|
+
throw snapshotPathChangedError(destinationRoot);
|
|
465
|
+
}
|
|
466
|
+
const rootRealPath = await (0, promises_1.realpath)(destinationRoot).catch(() => {
|
|
467
|
+
throw snapshotPathChangedError(destinationRoot);
|
|
468
|
+
});
|
|
469
|
+
const relativeDestination = (0, node_path_1.relative)(destinationRoot, destinationPath);
|
|
470
|
+
if ((0, hostPath_1.relativeHostPathEscapesRoot)(relativeDestination)) {
|
|
471
|
+
throw snapshotPathChangedError(destinationPath);
|
|
472
|
+
}
|
|
473
|
+
if (relativeDestination === '') {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
let current = destinationRoot;
|
|
477
|
+
for (const segment of relativeDestination.split(node_path_1.sep)) {
|
|
478
|
+
if (!segment) {
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
current = (0, node_path_1.join)(current, segment);
|
|
482
|
+
const currentStats = await (0, promises_1.lstat)(current).catch((error) => {
|
|
483
|
+
if (error.code === 'ENOENT') {
|
|
484
|
+
return undefined;
|
|
485
|
+
}
|
|
486
|
+
throw error;
|
|
487
|
+
});
|
|
488
|
+
if (!currentStats) {
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if (currentStats.isSymbolicLink()) {
|
|
492
|
+
throw snapshotPathChangedError(current);
|
|
493
|
+
}
|
|
494
|
+
const currentRealPath = await (0, promises_1.realpath)(current).catch(() => {
|
|
495
|
+
throw snapshotPathChangedError(current);
|
|
496
|
+
});
|
|
497
|
+
if (!(0, hostPath_1.isHostPathWithinRoot)(rootRealPath, currentRealPath)) {
|
|
498
|
+
throw snapshotPathChangedError(current);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function snapshotPathChangedError(path) {
|
|
503
|
+
return new errors_1.UserError(`Sandbox snapshot path changed while copying: ${path}`);
|
|
504
|
+
}
|
|
505
|
+
function isPathChangedError(error) {
|
|
506
|
+
return (typeof error === 'object' &&
|
|
507
|
+
error !== null &&
|
|
508
|
+
'code' in error &&
|
|
509
|
+
(error.code === 'ELOOP' ||
|
|
510
|
+
error.code === 'ENOENT' ||
|
|
511
|
+
error.code === 'ENOTDIR'));
|
|
512
|
+
}
|
|
513
|
+
function sameFilesystemEntry(left, right) {
|
|
514
|
+
return left.dev === right.dev && left.ino === right.ino;
|
|
515
|
+
}
|
|
516
|
+
function appendHashFrame(hash, label, value) {
|
|
517
|
+
// Length-delimited frames avoid collisions such as ["ab", "c"] vs ["a", "bc"].
|
|
518
|
+
hash.update(label);
|
|
519
|
+
hash.update('\0');
|
|
520
|
+
hash.update(String(value.length));
|
|
521
|
+
hash.update('\0');
|
|
522
|
+
hash.update(value);
|
|
523
|
+
hash.update('\0');
|
|
524
|
+
}
|
|
525
|
+
//# sourceMappingURL=localSnapshots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localSnapshots.js","sourceRoot":"","sources":["../../../../src/sandbox/sandboxes/shared/localSnapshots.ts"],"names":[],"mappings":";;;AA6DA,kDAeC;AAED,oDAkBC;AAED,oDA+BC;AAED,gEAcC;AAED,gEA4BC;AAED,oDAoBC;AAED,wEAyBC;AAED,8DAgBC;AAED,0EAwBC;AAED,0EAwBC;AAUD,sCA8DC;AAQD,wDAiBC;AAiDD,0DAqBC;AA2GD,oDAWC;AAnkBD,+CAA4C;AAC5C,gDAKwB;AAOxB,+CAS0B;AAC1B,qCAA6D;AAC7D,6CAAqD;AACrD,yCAAyD;AAGzD,2DAA8D;AAC9D,2DAAmD;AACnD,uDAI+B;AAC/B,gEAAmE;AACnE,kEAA0D;AAE7C,QAAA,kCAAkC,GAAG,0BAA0B,CAAC;AAC7E,MAAM,wBAAwB,GAAG,mBAAS,CAAC,QAAQ,GAAG,mBAAS,CAAC,UAAU,CAAC;AAC3E,MAAM,yBAAyB,GAC7B,mBAAS,CAAC,QAAQ;IAClB,mBAAS,CAAC,OAAO;IACjB,mBAAS,CAAC,OAAO;IACjB,mBAAS,CAAC,UAAU,CAAC;AAiBhB,KAAK,UAAU,mBAAmB,CACvC,KAAyB,EACzB,IAAwB;IAExB,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACpD,MAAM,aAAa,CACjB,KAAK,CAAC,iBAAiB,EACvB,YAAY,EACZ,0BAA0B,CAAC,KAAK,CAAC,CAClC,CAAC;IACF,OAAO;QACL,EAAE,EAAE,IAAA,wBAAU,GAAE;QAChB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,YAAY;KACnB,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,oBAAoB,CACxC,KAAyB,EACzB,IAAwB;IAExB,MAAM,IAAI,GAAG,MAAM,sBAAsB,CACvC,KAAK,CAAC,iBAAiB,EACvB,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