// SPDX-License-Identifier: MIT
package greentic:component@0.6.0;
interface control {
should-cancel: func() -> bool;
yield-now: func();
}
interface node {
use greentic:types-core/core@0.6.0.{capability-id, component-id, flow-id, node-error, step-id, tenant-ctx};
record invocation-envelope {
ctx: tenant-ctx,
flow-id: flow-id,
step-id: step-id,
component-id: component-id,
attempt: u32,
payload-cbor: list<u8>,
metadata-cbor: option<list<u8>>,
}
record invocation-result {
ok: bool,
output-cbor: list<u8>,
output-metadata-cbor: option<list<u8>>,
}
variant schema-source {
cbor-schema-id(string),
inline-cbor(list<u8>),
ref-pack-path(string),
ref-uri(string),
}
record io-schema {
schema: schema-source,
content-type: string,
schema-version: option<string>,
}
record example {
title: string,
input-cbor: list<u8>,
output-cbor: list<u8>,
}
record schema-ref {
id: string,
content-type: string,
blake3-hash: string,
version: string,
bytes: option<list<u8>>,
uri: option<string>,
}
record setup-example {
title: string,
answers-cbor: list<u8>,
}
record setup-template-scaffold {
template-ref: string,
output-layout: option<string>,
}
variant setup-output {
config-only,
template-scaffold(setup-template-scaffold),
}
record setup-contract {
qa-spec: schema-source,
answers-schema: schema-source,
examples: list<setup-example>,
outputs: list<setup-output>,
}
record op {
name: string,
summary: option<string>,
input: io-schema,
output: io-schema,
examples: list<example>,
}
record component-descriptor {
name: string,
version: string,
summary: option<string>,
capabilities: list<capability-id>,
ops: list<op>,
schemas: list<schema-ref>,
setup: option<setup-contract>,
}
describe: func() -> component-descriptor;
invoke: func(op: string, envelope: invocation-envelope) -> result<invocation-result, node-error>;
}
interface component-qa {
enum qa-mode {
default,
setup,
update,
remove,
}
qa-spec: func(mode: qa-mode) -> list<u8>;
apply-answers: func(mode: qa-mode, current-config: list<u8>, answers: list<u8>) -> list<u8>;
}
interface component-i18n {
i18n-keys: func() -> list<string>;
}
world component {
import control;
export node;
}
world component-qa-support {
export component-qa;
}
world component-i18n-support {
export component-i18n;
}