mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-19 23:01:32 +00:00
Fix up context check
This commit is contained in:
parent
8a96741441
commit
63bfe95c18
5 changed files with 19 additions and 29 deletions
|
|
@ -43,7 +43,7 @@ export class ArtifactsRuntimeProvider implements SandboxRuntimeProvider {
|
|||
|
||||
(window as any).listArtifacts = async (): Promise<string[]> => {
|
||||
// Online: ask extension
|
||||
if ((window as any).__isExtensionContext?.()) {
|
||||
if ((window as any).sendRuntimeMessage) {
|
||||
const response = await (window as any).sendRuntimeMessage({
|
||||
type: "artifact-operation",
|
||||
action: "list",
|
||||
|
|
@ -61,7 +61,7 @@ export class ArtifactsRuntimeProvider implements SandboxRuntimeProvider {
|
|||
let content: string;
|
||||
|
||||
// Online: ask extension
|
||||
if ((window as any).__isExtensionContext?.()) {
|
||||
if ((window as any).sendRuntimeMessage) {
|
||||
const response = await (window as any).sendRuntimeMessage({
|
||||
type: "artifact-operation",
|
||||
action: "get",
|
||||
|
|
@ -94,7 +94,7 @@ export class ArtifactsRuntimeProvider implements SandboxRuntimeProvider {
|
|||
content: any,
|
||||
mimeType?: string,
|
||||
): Promise<void> => {
|
||||
if (!(window as any).__isExtensionContext?.()) {
|
||||
if (!(window as any).sendRuntimeMessage) {
|
||||
throw new Error("Cannot create/update artifacts in offline mode (read-only)");
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ export class ArtifactsRuntimeProvider implements SandboxRuntimeProvider {
|
|||
};
|
||||
|
||||
(window as any).deleteArtifact = async (filename: string): Promise<void> => {
|
||||
if (!(window as any).__isExtensionContext?.()) {
|
||||
if (!(window as any).sendRuntimeMessage) {
|
||||
throw new Error("Cannot delete artifacts in offline mode (read-only)");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue