@openai/agents-core 0.8.5 → 0.9.1
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 +22 -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 +152 -57
- package/dist/run.js.map +1 -1
- package/dist/run.mjs +153 -58
- package/dist/run.mjs.map +1 -1
- package/dist/runState.d.ts +110 -3
- package/dist/runState.js +414 -53
- package/dist/runState.js.map +1 -1
- package/dist/runState.mjs +412 -53
- 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/sessionPersistence.js +33 -12
- package/dist/runner/sessionPersistence.js.map +1 -1
- package/dist/runner/sessionPersistence.mjs +33 -12
- package/dist/runner/sessionPersistence.mjs.map +1 -1
- package/dist/runner/streamReconciliation.d.ts +14 -0
- package/dist/runner/streamReconciliation.js +80 -0
- package/dist/runner/streamReconciliation.js.map +1 -0
- package/dist/runner/streamReconciliation.mjs +72 -0
- package/dist/runner/streamReconciliation.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/toolUseTracker.d.ts +3 -1
- package/dist/runner/toolUseTracker.js +2 -2
- package/dist/runner/toolUseTracker.js.map +1 -1
- package/dist/runner/toolUseTracker.mjs +2 -2
- package/dist/runner/toolUseTracker.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,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shell = shell;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const errors_1 = require("../../errors.js");
|
|
6
|
+
const tool_1 = require("../../tool.js");
|
|
7
|
+
const spans_1 = require("../runtime/spans.js");
|
|
8
|
+
const base_1 = require("./base.js");
|
|
9
|
+
const DEFAULT_EXEC_YIELD_TIME_MS = 10_000;
|
|
10
|
+
const DEFAULT_WRITE_STDIN_YIELD_TIME_MS = 250;
|
|
11
|
+
const SHELL_INSTRUCTIONS = [
|
|
12
|
+
'When using the shell:',
|
|
13
|
+
'- Use `exec_command` for shell execution.',
|
|
14
|
+
'- If available, use `write_stdin` to interact with or poll running sessions.',
|
|
15
|
+
'- To interrupt a long-running process via `write_stdin`, start it with `tty=true` and send Ctrl-C (`\\u0003`).',
|
|
16
|
+
'- Prefer `rg` and `rg --files` for text/file discovery when available.',
|
|
17
|
+
'- Avoid using Python scripts just to print large file chunks.',
|
|
18
|
+
].join('\n');
|
|
19
|
+
class ShellCapability extends base_1.Capability {
|
|
20
|
+
type = 'shell';
|
|
21
|
+
configureTools;
|
|
22
|
+
constructor(args = {}) {
|
|
23
|
+
super();
|
|
24
|
+
this.configureTools = args.configureTools;
|
|
25
|
+
}
|
|
26
|
+
tools() {
|
|
27
|
+
const session = (0, base_1.requireBoundSession)(this.type, this._session);
|
|
28
|
+
if (!session.execCommand) {
|
|
29
|
+
throw new errors_1.UserError('Shell sandbox sessions must provide execCommand().');
|
|
30
|
+
}
|
|
31
|
+
const tools = [
|
|
32
|
+
(0, tool_1.tool)({
|
|
33
|
+
name: 'exec_command',
|
|
34
|
+
description: 'Runs a command in a PTY, returning output or a session ID for ongoing interaction.',
|
|
35
|
+
parameters: zod_1.z.object({
|
|
36
|
+
cmd: zod_1.z.string().min(1).describe('Shell command to execute.'),
|
|
37
|
+
workdir: zod_1.z
|
|
38
|
+
.string()
|
|
39
|
+
.optional()
|
|
40
|
+
.describe('Optional working directory to run the command in; defaults to the turn cwd.'),
|
|
41
|
+
shell: zod_1.z
|
|
42
|
+
.string()
|
|
43
|
+
.optional()
|
|
44
|
+
.describe("Shell binary to launch. Defaults to the user's default shell."),
|
|
45
|
+
login: zod_1.z
|
|
46
|
+
.boolean()
|
|
47
|
+
.default(true)
|
|
48
|
+
.describe('Whether to run the shell with -l/-i semantics. Defaults to true.'),
|
|
49
|
+
tty: zod_1.z
|
|
50
|
+
.boolean()
|
|
51
|
+
.default(false)
|
|
52
|
+
.describe('Whether to allocate a TTY for the command. Defaults to false (plain pipes); set to true to open a PTY and access TTY process.'),
|
|
53
|
+
yield_time_ms: zod_1.z
|
|
54
|
+
.number()
|
|
55
|
+
.int()
|
|
56
|
+
.min(0)
|
|
57
|
+
.default(DEFAULT_EXEC_YIELD_TIME_MS)
|
|
58
|
+
.describe('How long to wait (in milliseconds) for output before yielding.'),
|
|
59
|
+
max_output_tokens: zod_1.z
|
|
60
|
+
.number()
|
|
61
|
+
.int()
|
|
62
|
+
.min(1)
|
|
63
|
+
.optional()
|
|
64
|
+
.describe('Maximum number of tokens to return. Excess output will be truncated.'),
|
|
65
|
+
}),
|
|
66
|
+
execute: async ({ cmd, workdir, shell, login, tty, yield_time_ms, max_output_tokens, }) => await (0, spans_1.withSandboxSpan)('sandbox.exec', {
|
|
67
|
+
cmd,
|
|
68
|
+
workdir,
|
|
69
|
+
shell,
|
|
70
|
+
login,
|
|
71
|
+
tty,
|
|
72
|
+
run_as: this._runAs,
|
|
73
|
+
}, async () => await session.execCommand({
|
|
74
|
+
cmd,
|
|
75
|
+
workdir,
|
|
76
|
+
shell,
|
|
77
|
+
login,
|
|
78
|
+
tty,
|
|
79
|
+
yieldTimeMs: yield_time_ms,
|
|
80
|
+
maxOutputTokens: max_output_tokens,
|
|
81
|
+
runAs: this._runAs,
|
|
82
|
+
})),
|
|
83
|
+
}),
|
|
84
|
+
];
|
|
85
|
+
if (session.supportsPty?.() && session.writeStdin) {
|
|
86
|
+
tools.push((0, tool_1.tool)({
|
|
87
|
+
name: 'write_stdin',
|
|
88
|
+
description: 'Writes characters to an existing unified exec session and returns recent output.',
|
|
89
|
+
parameters: zod_1.z.object({
|
|
90
|
+
session_id: zod_1.z
|
|
91
|
+
.number()
|
|
92
|
+
.int()
|
|
93
|
+
.describe('Identifier of the running unified exec session.'),
|
|
94
|
+
chars: zod_1.z
|
|
95
|
+
.string()
|
|
96
|
+
.default('')
|
|
97
|
+
.describe('Bytes to write to stdin (may be empty to poll).'),
|
|
98
|
+
yield_time_ms: zod_1.z
|
|
99
|
+
.number()
|
|
100
|
+
.int()
|
|
101
|
+
.min(0)
|
|
102
|
+
.default(DEFAULT_WRITE_STDIN_YIELD_TIME_MS)
|
|
103
|
+
.describe('How long to wait (in milliseconds) for output before yielding.'),
|
|
104
|
+
max_output_tokens: zod_1.z
|
|
105
|
+
.number()
|
|
106
|
+
.int()
|
|
107
|
+
.min(1)
|
|
108
|
+
.optional()
|
|
109
|
+
.describe('Maximum number of tokens to return. Excess output will be truncated.'),
|
|
110
|
+
}),
|
|
111
|
+
execute: async ({ session_id, chars, yield_time_ms, max_output_tokens, }) => await (0, spans_1.withSandboxSpan)('sandbox.write_stdin', {
|
|
112
|
+
session_id,
|
|
113
|
+
}, async () => await session.writeStdin({
|
|
114
|
+
sessionId: session_id,
|
|
115
|
+
chars,
|
|
116
|
+
yieldTimeMs: yield_time_ms,
|
|
117
|
+
maxOutputTokens: max_output_tokens,
|
|
118
|
+
})),
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
return this.configureTools ? this.configureTools([...tools]) : tools;
|
|
122
|
+
}
|
|
123
|
+
instructions() {
|
|
124
|
+
return SHELL_INSTRUCTIONS;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function shell(args = {}) {
|
|
128
|
+
return new ShellCapability(args);
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../src/sandbox/capabilities/shell.ts"],"names":[],"mappings":";;AA0MA,sBAEC;AA5MD,6BAAwB;AACxB,4CAAyC;AACzC,wCAA6C;AAE7C,+CAAmD;AACnD,oCAIgB;AAEhB,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAC1C,MAAM,iCAAiC,GAAG,GAAG,CAAC;AAE9C,MAAM,kBAAkB,GAAG;IACzB,uBAAuB;IACvB,2CAA2C;IAC3C,8EAA8E;IAC9E,gHAAgH;IAChH,wEAAwE;IACxE,+DAA+D;CAChE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAMb,MAAM,eAAgB,SAAQ,iBAAU;IAC7B,IAAI,GAAG,OAAO,CAAC;IACP,cAAc,CAA4B;IAE3D,YAAY,OAAkB,EAAE;QAC9B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAC5C,CAAC;IAEQ,KAAK;QACZ,MAAM,OAAO,GAAG,IAAA,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K,EACL,aAAa,EACb,iBAAiB,GAMlB,EAAmB,EAAE,CACpB,MAAM,IAAA,uBAAe,EACnB,qBAAqB,EACrB;oBACE,UAAU;iBACX,EACD,KAAK,IAAI,EAAE,CACT,MAAM,OAAO,CAAC,UAAW,CAAC;oBACxB,SAAS,EAAE,UAAU;oBACrB,KAAK;oBACL,WAAW,EAAE,aAAa;oBAC1B,eAAe,EAAE,iBAAiB;iBACV,CAAC,CAC9B;aACJ,CAAC,CACH,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACvE,CAAC;IAEQ,YAAY;QACnB,OAAO,kBAAkB,CAAC;IAC5B,CAAC;CACF;AAID,SAAgB,KAAK,CAAC,OAAkB,EAAE;IACxC,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserError } from "../../errors.mjs";
|
|
3
|
+
import { tool } from "../../tool.mjs";
|
|
4
|
+
import { withSandboxSpan } from "../runtime/spans.mjs";
|
|
5
|
+
import { Capability, requireBoundSession, } from "./base.mjs";
|
|
6
|
+
const DEFAULT_EXEC_YIELD_TIME_MS = 10_000;
|
|
7
|
+
const DEFAULT_WRITE_STDIN_YIELD_TIME_MS = 250;
|
|
8
|
+
const SHELL_INSTRUCTIONS = [
|
|
9
|
+
'When using the shell:',
|
|
10
|
+
'- Use `exec_command` for shell execution.',
|
|
11
|
+
'- If available, use `write_stdin` to interact with or poll running sessions.',
|
|
12
|
+
'- To interrupt a long-running process via `write_stdin`, start it with `tty=true` and send Ctrl-C (`\\u0003`).',
|
|
13
|
+
'- Prefer `rg` and `rg --files` for text/file discovery when available.',
|
|
14
|
+
'- Avoid using Python scripts just to print large file chunks.',
|
|
15
|
+
].join('\n');
|
|
16
|
+
class ShellCapability extends Capability {
|
|
17
|
+
type = 'shell';
|
|
18
|
+
configureTools;
|
|
19
|
+
constructor(args = {}) {
|
|
20
|
+
super();
|
|
21
|
+
this.configureTools = args.configureTools;
|
|
22
|
+
}
|
|
23
|
+
tools() {
|
|
24
|
+
const session = requireBoundSession(this.type, this._session);
|
|
25
|
+
if (!session.execCommand) {
|
|
26
|
+
throw new UserError('Shell sandbox sessions must provide execCommand().');
|
|
27
|
+
}
|
|
28
|
+
const tools = [
|
|
29
|
+
tool({
|
|
30
|
+
name: 'exec_command',
|
|
31
|
+
description: 'Runs a command in a PTY, returning output or a session ID for ongoing interaction.',
|
|
32
|
+
parameters: z.object({
|
|
33
|
+
cmd: z.string().min(1).describe('Shell command to execute.'),
|
|
34
|
+
workdir: z
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('Optional working directory to run the command in; defaults to the turn cwd.'),
|
|
38
|
+
shell: z
|
|
39
|
+
.string()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe("Shell binary to launch. Defaults to the user's default shell."),
|
|
42
|
+
login: z
|
|
43
|
+
.boolean()
|
|
44
|
+
.default(true)
|
|
45
|
+
.describe('Whether to run the shell with -l/-i semantics. Defaults to true.'),
|
|
46
|
+
tty: z
|
|
47
|
+
.boolean()
|
|
48
|
+
.default(false)
|
|
49
|
+
.describe('Whether to allocate a TTY for the command. Defaults to false (plain pipes); set to true to open a PTY and access TTY process.'),
|
|
50
|
+
yield_time_ms: z
|
|
51
|
+
.number()
|
|
52
|
+
.int()
|
|
53
|
+
.min(0)
|
|
54
|
+
.default(DEFAULT_EXEC_YIELD_TIME_MS)
|
|
55
|
+
.describe('How long to wait (in milliseconds) for output before yielding.'),
|
|
56
|
+
max_output_tokens: z
|
|
57
|
+
.number()
|
|
58
|
+
.int()
|
|
59
|
+
.min(1)
|
|
60
|
+
.optional()
|
|
61
|
+
.describe('Maximum number of tokens to return. Excess output will be truncated.'),
|
|
62
|
+
}),
|
|
63
|
+
execute: async ({ cmd, workdir, shell, login, tty, yield_time_ms, max_output_tokens, }) => await withSandboxSpan('sandbox.exec', {
|
|
64
|
+
cmd,
|
|
65
|
+
workdir,
|
|
66
|
+
shell,
|
|
67
|
+
login,
|
|
68
|
+
tty,
|
|
69
|
+
run_as: this._runAs,
|
|
70
|
+
}, async () => await session.execCommand({
|
|
71
|
+
cmd,
|
|
72
|
+
workdir,
|
|
73
|
+
shell,
|
|
74
|
+
login,
|
|
75
|
+
tty,
|
|
76
|
+
yieldTimeMs: yield_time_ms,
|
|
77
|
+
maxOutputTokens: max_output_tokens,
|
|
78
|
+
runAs: this._runAs,
|
|
79
|
+
})),
|
|
80
|
+
}),
|
|
81
|
+
];
|
|
82
|
+
if (session.supportsPty?.() && session.writeStdin) {
|
|
83
|
+
tools.push(tool({
|
|
84
|
+
name: 'write_stdin',
|
|
85
|
+
description: 'Writes characters to an existing unified exec session and returns recent output.',
|
|
86
|
+
parameters: z.object({
|
|
87
|
+
session_id: z
|
|
88
|
+
.number()
|
|
89
|
+
.int()
|
|
90
|
+
.describe('Identifier of the running unified exec session.'),
|
|
91
|
+
chars: z
|
|
92
|
+
.string()
|
|
93
|
+
.default('')
|
|
94
|
+
.describe('Bytes to write to stdin (may be empty to poll).'),
|
|
95
|
+
yield_time_ms: z
|
|
96
|
+
.number()
|
|
97
|
+
.int()
|
|
98
|
+
.min(0)
|
|
99
|
+
.default(DEFAULT_WRITE_STDIN_YIELD_TIME_MS)
|
|
100
|
+
.describe('How long to wait (in milliseconds) for output before yielding.'),
|
|
101
|
+
max_output_tokens: z
|
|
102
|
+
.number()
|
|
103
|
+
.int()
|
|
104
|
+
.min(1)
|
|
105
|
+
.optional()
|
|
106
|
+
.describe('Maximum number of tokens to return. Excess output will be truncated.'),
|
|
107
|
+
}),
|
|
108
|
+
execute: async ({ session_id, chars, yield_time_ms, max_output_tokens, }) => await withSandboxSpan('sandbox.write_stdin', {
|
|
109
|
+
session_id,
|
|
110
|
+
}, async () => await session.writeStdin({
|
|
111
|
+
sessionId: session_id,
|
|
112
|
+
chars,
|
|
113
|
+
yieldTimeMs: yield_time_ms,
|
|
114
|
+
maxOutputTokens: max_output_tokens,
|
|
115
|
+
})),
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
return this.configureTools ? this.configureTools([...tools]) : tools;
|
|
119
|
+
}
|
|
120
|
+
instructions() {
|
|
121
|
+
return SHELL_INSTRUCTIONS;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export function shell(args = {}) {
|
|
125
|
+
return new ShellCapability(args);
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=shell.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.mjs","sourceRoot":"","sources":["../../../src/sandbox/capabilities/shell.ts"],"names":[],"mappings":"OAAO,EAAE,CAAC,EAAE,MAAM,KAAK;OAChB,EAAE,SAAS,EAAE;OACb,EAAE,IAAI,EAAa;OAEnB,EAAE,eAAe,EAAE;OACnB,EACL,UAAU,EAEV,mBAAmB,GACpB;AAED,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAC1C,MAAM,iCAAiC,GAAG,GAAG,CAAC;AAE9C,MAAM,kBAAkB,GAAG;IACzB,uBAAuB;IACvB,2CAA2C;IAC3C,8EAA8E;IAC9E,gHAAgH;IAChH,wEAAwE;IACxE,+DAA+D;CAChE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAMb,MAAM,eAAgB,SAAQ,UAAU;IAC7B,IAAI,GAAG,OAAO,CAAC;IACP,cAAc,CAA4B;IAE3D,YAAY,OAAkB,EAAE;QAC9B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAC5C,CAAC;IAEQ,KAAK;QACZ,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9D,IAAI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,EACD,KAAK,IAAI,EAAE,CACT,MAAM,OAAO,CAAC,UAAW,CAAC;oBACxB,SAAS,EAAE,UAAU;oBACrB,KAAK;oBACL,WAAW,EAAE,aAAa;oBAC1B,eAAe,EAAE,iBAAiB;iBACV,CAAC,CAC9B;aACJ,CAAC,CACH,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACvE,CAAC;IAEQ,YAAY;QACnB,OAAO,kBAAkB,CAAC;IAC5B,CAAC;CACF;AAID,MAAM,UAAU,KAAK,CAAC,OAAkB,EAAE;IACxC,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type Tool } from '../../tool';
|
|
2
|
+
import { type Dir, type Entry, type File, type GitRepo, type LocalDir, type LocalFile } from '../entries';
|
|
3
|
+
import { type Manifest } from '../manifest';
|
|
4
|
+
import { Capability } from './base';
|
|
5
|
+
export type SkillIndexEntry = {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
};
|
|
10
|
+
export type LocalDirLazySkillSource = {
|
|
11
|
+
source: Dir | LocalDir | GitRepo;
|
|
12
|
+
index?: SkillIndexEntry[];
|
|
13
|
+
};
|
|
14
|
+
export type SkillDescriptor = {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
content: string | Uint8Array | File | LocalFile;
|
|
18
|
+
scripts?: Record<string, Entry>;
|
|
19
|
+
references?: Record<string, Entry>;
|
|
20
|
+
assets?: Record<string, Entry>;
|
|
21
|
+
compatibility?: string[];
|
|
22
|
+
deferred?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type SkillsArgs = {
|
|
25
|
+
skills?: SkillDescriptor[];
|
|
26
|
+
from?: Entry;
|
|
27
|
+
lazyFrom?: LocalDirLazySkillSource;
|
|
28
|
+
index?: SkillIndexEntry[];
|
|
29
|
+
skillsPath?: string;
|
|
30
|
+
};
|
|
31
|
+
declare class SkillsCapability extends Capability {
|
|
32
|
+
readonly type = "skills";
|
|
33
|
+
readonly skills: SkillDescriptor[];
|
|
34
|
+
readonly from?: Entry;
|
|
35
|
+
readonly lazyFrom?: LocalDirLazySkillSource;
|
|
36
|
+
readonly index?: SkillIndexEntry[];
|
|
37
|
+
readonly skillsPath: string;
|
|
38
|
+
constructor(args: SkillsArgs);
|
|
39
|
+
tools(): Tool<any>[];
|
|
40
|
+
processManifest(manifest: Manifest): Manifest;
|
|
41
|
+
instructions(manifest: Manifest): Promise<string | null>;
|
|
42
|
+
private resolveRuntimeMetadata;
|
|
43
|
+
}
|
|
44
|
+
export type Skills = SkillsCapability;
|
|
45
|
+
export declare function skills(args: SkillsArgs): Skills;
|
|
46
|
+
export declare function parseSkillFrontmatter(markdown: string): Record<string, string>;
|
|
47
|
+
export {};
|