Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.

Conversation

@afsalthaj
Copy link
Contributor

@afsalthaj afsalthaj commented Dec 17, 2025

Fixes #181

SDK standard result types had two issues: One is void was not supported similar to the bug in user defined result type. Second is, RPC never worked even after making it supported in type mappings. Both are fixed

Stderr:

thread '<unnamed>' (1) panicked at src/internal.rs:276:41:
Exception during awaiting call result for guest.invoke:
JavaScript error: Failed to invoke corge in agent bar-agent("foos")
Stack:
    at invokeAndAwait (@golemcloud/golem-ts-sdk:5824:27)
import {
    BaseAgent,
    Result,
    agent,
    prompt,
    description, Client,
} from '@golemcloud/golem-ts-sdk';

@agent()
class CounterAgent extends BaseAgent {
    private readonly name: string;
    private readonly client: Client<BarAgent>;

    constructor(name: string) {
        super()
        this.name = name;
        this.client = BarAgent.get(name);
    }

    async foo(input: Result<number, void>): Promise<Result<number, void>> {
        return await this.client.qux(input);
    }

    async bar(input: Result<void, number>): Promise<Result<void, number>> {
        return await this.client.corge(input);
    }

    async baz(input: Result<void, void>): Promise<Result<void, void>> {
        return await this.client.grault(input);
    }
}


@agent()
class BarAgent extends BaseAgent {
    private readonly name: string;
    private value: number = 0;

    constructor(name: string) {
        super()
        this.name = name;
    }

    async qux(input: Result<number, void>): Promise<Result<number, void>> {
        return input
    }

    async corge(input: Result<void, number>): Promise<Result<void, number>> {
        return input
    }

    async grault(input: Result<void, void>): Promise<Result<void, void>> {
        return input
    }

}
image

Once the new ts-sdk is released, will add these tests along with the ones in #216 (comment)

@afsalthaj afsalthaj changed the title support void in standard result type support void in standard result type, and fix RPC Dec 17, 2025
@afsalthaj
Copy link
Contributor Author

This is very similar to non sdk result type bug and same fixes. Merging and closing the issue

@afsalthaj afsalthaj merged commit 6ace47e into main Dec 17, 2025
2 checks passed
@afsalthaj afsalthaj deleted the void_in_sdk_result_type branch December 17, 2025 09:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK Result type using void in any channel is not supported as function argument

2 participants