Skip to content
API reference

app-method-runtime

Import
import * as api from "@fungi.computer/puffball/app-method-runtime";
Kind Export Description
type alias HostActor The host’s verified member, Agent or Team-key identity.
type alias WorkflowAttestation Workflow attribution shared by invocation frames and Git writers.
type alias AppMethodCallContext Trusted attribution delivered separately from App method arguments.
constant appApiReservedMethodNames Reserved JavaScript, RPC and lifecycle names are never App method names.
constant hostActorSchema Actor identity attested by the host, shared by calls and Workflow arming.
constant workflowAttestationSchema Host-held Workflow attribution, delivered separately from guest input.
constant appMethodCallerSchema Sole grammar for the host-minted Computer pin and actor attribution.
function parseAppMethodCallContext() Decode trusted host attribution through the sole runtime-neutral grammar.
function isAppApiMethodName() Shared domain grammar for generated RPC method names.
function backgroundSyncAllowed() A continuation must cover every write method’s requirements, and itself be a write.

HostActortype alias

Section titled “HostActor”
Signature
type HostActor = z.output<typeof hostActorSchema>;

The host’s verified member, Agent or Team-key identity.


WorkflowAttestationtype alias

Section titled “WorkflowAttestation”
Signature
type WorkflowAttestation = z.output<typeof workflowAttestationSchema>;

Workflow attribution shared by invocation frames and Git writers.


AppMethodCallContexttype alias

Section titled “AppMethodCallContext”
Signature
type AppMethodCallContext = z.output<typeof appMethodCallerSchema>;

Trusted attribution delivered separately from App method arguments.

appApiReservedMethodNamesconstant

Section titled “appApiReservedMethodNames”
Signature
const appApiReservedMethodNames: Readonly<{
intrinsic: readonly [
"constructor",
"toString",
"valueOf",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"toLocaleString",
];
rpc: readonly ["then", "dup", "connect", "id", "name"];
instance: readonly ["ctx", "env"];
lifecycle: readonly [
"gill",
"onGitPush",
"syncRefused",
"authorizeGitPush",
"fetch",
"alarm",
"queue",
"scheduled",
"tail",
"trace",
"email",
"test",
"tailStream",
"webSocketMessage",
"webSocketClose",
"webSocketError",
];
}>;

Reserved JavaScript, RPC and lifecycle names are never App method names.


hostActorSchemaconstant

Section titled “hostActorSchema”
Signature
const hostActorSchema: ZodMiniDiscriminatedUnion<
[
ZodMiniObject<
{
kind: ZodMiniLiteral<"member">;
memberId: ZodMiniString<string>;
},
$strip
>,
ZodMiniObject<
{
kind: ZodMiniLiteral<"agent">;
agentId: ZodMiniString<string>;
},
$strip
>,
ZodMiniObject<
{
kind: ZodMiniLiteral<"team-key">;
keyId: ZodMiniString<string>;
},
$strip
>,
],
"kind"
>;

Actor identity attested by the host, shared by calls and Workflow arming.


workflowAttestationSchemaconstant

Section titled “workflowAttestationSchema”
Signature
const workflowAttestationSchema: ZodMiniObject<
{
workflowId: ZodMiniString<string>;
runId: ZodMiniString<string>;
nodeId: ZodMiniString<string>;
armedBy: ZodMiniDiscriminatedUnion<
[
ZodMiniObject<
{
kind: ZodMiniLiteral<"member">;
memberId: ZodMiniString<string>;
},
$strip
>,
ZodMiniObject<
{
kind: ZodMiniLiteral<"agent">;
agentId: ZodMiniString<string>;
},
$strip
>,
ZodMiniObject<
{
kind: ZodMiniLiteral<"team-key">;
keyId: ZodMiniString<string>;
},
$strip
>,
],
"kind"
>;
},
$strip
>;

Host-held Workflow attribution, delivered separately from guest input.


appMethodCallerSchemaconstant

Section titled “appMethodCallerSchema”
Signature
const appMethodCallerSchema: ZodMiniObject<
{
computerId: ZodMiniNullable<ZodMiniString<string>>;
actor: ZodMiniDiscriminatedUnion<
[
ZodMiniObject<
{
kind: ZodMiniLiteral<"member">;
memberId: ZodMiniString<string>;
},
$strip
>,
ZodMiniObject<
{
kind: ZodMiniLiteral<"agent">;
agentId: ZodMiniString<string>;
},
$strip
>,
ZodMiniObject<
{
kind: ZodMiniLiteral<"team-key">;
keyId: ZodMiniString<string>;
},
$strip
>,
],
"kind"
>;
backgroundLane: ZodMiniOptional<ZodMiniString<string>>;
backgroundOrigin: ZodMiniOptional<
ZodMiniLazy<
ZodMiniObject<
{
method: ZodMiniString<string>;
seal: ZodMiniString<string>;
},
$strict
>
>
>;
role: ZodMiniOptional<
ZodMiniEnum<{
member: "member";
owner: "owner";
}>
>;
soleMember: ZodMiniOptional<ZodMiniLiteral<true>>;
workflow: ZodMiniOptional<
ZodMiniObject<
{
workflowId: ZodMiniString<string>;
runId: ZodMiniString<string>;
nodeId: ZodMiniString<string>;
armedBy: ZodMiniDiscriminatedUnion<
[
ZodMiniObject<
{
kind: ZodMiniLiteral<"member">;
memberId: ZodMiniString<string>;
},
$strip
>,
ZodMiniObject<
{
kind: ZodMiniLiteral<"agent">;
agentId: ZodMiniString<string>;
},
$strip
>,
ZodMiniObject<
{
kind: ZodMiniLiteral<"team-key">;
keyId: ZodMiniString<string>;
},
$strip
>,
],
"kind"
>;
},
$strip
>
>;
idempotencyKey: ZodMiniOptional<ZodMiniString<string>>;
},
$strip
>;

Sole grammar for the host-minted Computer pin and actor attribution.

parseAppMethodCallContext()function

Section titled “parseAppMethodCallContext()”
Signature
function parseAppMethodCallContext(value, rejectUnknownKeys?): object;

Decode trusted host attribution through the sole runtime-neutral grammar.

Parameter Type Default value
value unknown undefined
rejectUnknownKeys boolean false
Name Type Default value Description
computerId string | null - -
actor | { kind: "member"; memberId: string; } | { kind: "agent"; agentId: string; } | { kind: "team-key"; keyId: string; } hostActorSchema -
backgroundLane? string - Host-attested enqueue eligibility for this ordinary write; absent otherwise.
backgroundOrigin? object - Host-sealed foreground method for durable jobs; paired with backgroundLane.
backgroundOrigin.method string - -
backgroundOrigin.seal string - -
role? "member" | "owner" - Team role attested by the host, never selected by App method input.
soleMember? true - The host attests that this member is currently the Team’s only member. Present only on a member’s own call; never on an Agent, Team key or Workflow node, and never selected by App method input.
workflow? object - Present only on a Workflow node invocation admitted by its host.
workflow.workflowId string identity Published Workflow selected by the run owner.
workflow.runId string identity Run identity held by the run owner.
workflow.nodeId string identity Node selected by the stored published Workflow.
workflow.armedBy | { kind: "member"; memberId: string; } | { kind: "agent"; agentId: string; } | { kind: "team-key"; keyId: string; } hostActorSchema Actor that armed the run, re-admitted by the host at dispatch.
idempotencyKey? string - The host’s stable key for this logical call (for example one Workflow node), the same on every retry. A method with side effects uses it to do its work at most once. Absent when the caller supplies its own request id.

isAppApiMethodName()function

Section titled “isAppApiMethodName()”
Signature
function isAppApiMethodName(name): boolean;

Shared domain grammar for generated RPC method names.

Parameter Type
name string

boolean


backgroundSyncAllowed()function

Section titled “backgroundSyncAllowed()”
Signature
function backgroundSyncAllowed(api, sync): boolean;

A continuation must cover every write method’s requirements, and itself be a write.

Parameter Type
api | Readonly<{ methods: Readonly<Record<string, Pick<AppApi["methods"][string], "effect" | "requires">>>; }> | undefined
sync | Readonly<{ method: string; }> | undefined

boolean