Compare commits

...

2 commits

Author SHA1 Message Date
flemming-it
c46dc58ac3 feat: submitStreaming + detached-invocation client (T2/T3)
Some checks failed
Security / Security check (push) Failing after 2s
Regenerates the gRPC stubs from the updated proto and adds:
- HubClient.submitStreaming(...) -> Stream<SubmitStreamEvent>: follow a
  flow execution live (step markers, module emit-events, terminal
  result/error). Works over native gRPC and, on web, gRPC-Web (the
  same conditional channel factory the rest of the SDK uses).
- submit(..., detach: true) and getInvocationStatus /
  getInvocationResult / cancelInvocation wrappers (T3).
- SubmitStreamEvent + InvocationStatus re-exported as typedefs.

Shared _buildSubmitRequest between submit + submitStreaming. analyze
clean, tests pass.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
2026-07-06 01:56:43 +02:00
flemming-it
0d2e939867 chore(proto): regenerate hub stubs for StoreEntry.source (22)
Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
2026-06-22 00:59:50 +02:00
5 changed files with 1056 additions and 6 deletions

View file

@ -82,10 +82,12 @@ class SubmitRequest extends $pb.GeneratedMessage {
factory SubmitRequest({ factory SubmitRequest({
$core.List<$core.int>? flowYaml, $core.List<$core.int>? flowYaml,
$core.Iterable<$core.MapEntry<$core.String, $2.Payload>>? inputs, $core.Iterable<$core.MapEntry<$core.String, $2.Payload>>? inputs,
$core.bool? detach,
}) { }) {
final result = create(); final result = create();
if (flowYaml != null) result.flowYaml = flowYaml; if (flowYaml != null) result.flowYaml = flowYaml;
if (inputs != null) result.inputs.addEntries(inputs); if (inputs != null) result.inputs.addEntries(inputs);
if (detach != null) result.detach = detach;
return result; return result;
} }
@ -111,6 +113,7 @@ class SubmitRequest extends $pb.GeneratedMessage {
valueCreator: $2.Payload.create, valueCreator: $2.Payload.create,
valueDefaultOrMaker: $2.Payload.getDefault, valueDefaultOrMaker: $2.Payload.getDefault,
packageName: const $pb.PackageName('chain.v1')) packageName: const $pb.PackageName('chain.v1'))
..aOB(3, _omitFieldNames ? '' : 'detach')
..hasRequiredFields = false; ..hasRequiredFields = false;
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
@ -145,6 +148,20 @@ class SubmitRequest extends $pb.GeneratedMessage {
/// Named input values for the flow. /// Named input values for the flow.
@$pb.TagNumber(2) @$pb.TagNumber(2)
$pb.PbMap<$core.String, $2.Payload> get inputs => $_getMap(1); $pb.PbMap<$core.String, $2.Payload> get inputs => $_getMap(1);
/// When true (added 1.1), Submit returns immediately with the
/// invocation id and the flow keeps running in the background. Poll
/// GetInvocationStatus / fetch GetInvocationResult, or follow it live
/// via SubmitStream. Only detached invocations are retained; unary
/// detach=false is unchanged (synchronous, stateless).
@$pb.TagNumber(3)
$core.bool get detach => $_getBF(2);
@$pb.TagNumber(3)
set detach($core.bool value) => $_setBool(2, value);
@$pb.TagNumber(3)
$core.bool hasDetach() => $_has(2);
@$pb.TagNumber(3)
void clearDetach() => $_clearField(3);
} }
class SubmitResponse extends $pb.GeneratedMessage { class SubmitResponse extends $pb.GeneratedMessage {
@ -217,6 +234,608 @@ class SubmitResponse extends $pb.GeneratedMessage {
$pb.PbMap<$core.String, $2.Payload> get outputs => $_getMap(1); $pb.PbMap<$core.String, $2.Payload> get outputs => $_getMap(1);
} }
enum SubmitStreamEvent_Event {
stepStarted,
stepFinished,
moduleEvent,
finalResult,
error,
notSet
}
/// One event in a SubmitStream (added 1.1). Exactly one field is set.
class SubmitStreamEvent extends $pb.GeneratedMessage {
factory SubmitStreamEvent({
StepStarted? stepStarted,
StepFinished? stepFinished,
ModuleEvent? moduleEvent,
SubmitResponse? finalResult,
StreamError? error,
}) {
final result = create();
if (stepStarted != null) result.stepStarted = stepStarted;
if (stepFinished != null) result.stepFinished = stepFinished;
if (moduleEvent != null) result.moduleEvent = moduleEvent;
if (finalResult != null) result.finalResult = finalResult;
if (error != null) result.error = error;
return result;
}
SubmitStreamEvent._();
factory SubmitStreamEvent.fromBuffer($core.List<$core.int> data,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(data, registry);
factory SubmitStreamEvent.fromJson($core.String json,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(json, registry);
static const $core.Map<$core.int, SubmitStreamEvent_Event>
_SubmitStreamEvent_EventByTag = {
1: SubmitStreamEvent_Event.stepStarted,
2: SubmitStreamEvent_Event.stepFinished,
3: SubmitStreamEvent_Event.moduleEvent,
4: SubmitStreamEvent_Event.finalResult,
5: SubmitStreamEvent_Event.error,
0: SubmitStreamEvent_Event.notSet
};
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'SubmitStreamEvent',
package: const $pb.PackageName(_omitMessageNames ? '' : 'chain.v1'),
createEmptyInstance: create)
..oo(0, [1, 2, 3, 4, 5])
..aOM<StepStarted>(1, _omitFieldNames ? '' : 'stepStarted',
subBuilder: StepStarted.create)
..aOM<StepFinished>(2, _omitFieldNames ? '' : 'stepFinished',
subBuilder: StepFinished.create)
..aOM<ModuleEvent>(3, _omitFieldNames ? '' : 'moduleEvent',
subBuilder: ModuleEvent.create)
..aOM<SubmitResponse>(4, _omitFieldNames ? '' : 'finalResult',
subBuilder: SubmitResponse.create)
..aOM<StreamError>(5, _omitFieldNames ? '' : 'error',
subBuilder: StreamError.create)
..hasRequiredFields = false;
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
SubmitStreamEvent clone() => deepCopy();
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
SubmitStreamEvent copyWith(void Function(SubmitStreamEvent) updates) =>
super.copyWith((message) => updates(message as SubmitStreamEvent))
as SubmitStreamEvent;
@$core.override
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SubmitStreamEvent create() => SubmitStreamEvent._();
@$core.override
SubmitStreamEvent createEmptyInstance() => create();
@$core.pragma('dart2js:noInline')
static SubmitStreamEvent getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<SubmitStreamEvent>(create);
static SubmitStreamEvent? _defaultInstance;
@$pb.TagNumber(1)
@$pb.TagNumber(2)
@$pb.TagNumber(3)
@$pb.TagNumber(4)
@$pb.TagNumber(5)
SubmitStreamEvent_Event whichEvent() =>
_SubmitStreamEvent_EventByTag[$_whichOneof(0)]!;
@$pb.TagNumber(1)
@$pb.TagNumber(2)
@$pb.TagNumber(3)
@$pb.TagNumber(4)
@$pb.TagNumber(5)
void clearEvent() => $_clearField($_whichOneof(0));
@$pb.TagNumber(1)
StepStarted get stepStarted => $_getN(0);
@$pb.TagNumber(1)
set stepStarted(StepStarted value) => $_setField(1, value);
@$pb.TagNumber(1)
$core.bool hasStepStarted() => $_has(0);
@$pb.TagNumber(1)
void clearStepStarted() => $_clearField(1);
@$pb.TagNumber(1)
StepStarted ensureStepStarted() => $_ensure(0);
@$pb.TagNumber(2)
StepFinished get stepFinished => $_getN(1);
@$pb.TagNumber(2)
set stepFinished(StepFinished value) => $_setField(2, value);
@$pb.TagNumber(2)
$core.bool hasStepFinished() => $_has(1);
@$pb.TagNumber(2)
void clearStepFinished() => $_clearField(2);
@$pb.TagNumber(2)
StepFinished ensureStepFinished() => $_ensure(1);
@$pb.TagNumber(3)
ModuleEvent get moduleEvent => $_getN(2);
@$pb.TagNumber(3)
set moduleEvent(ModuleEvent value) => $_setField(3, value);
@$pb.TagNumber(3)
$core.bool hasModuleEvent() => $_has(2);
@$pb.TagNumber(3)
void clearModuleEvent() => $_clearField(3);
@$pb.TagNumber(3)
ModuleEvent ensureModuleEvent() => $_ensure(2);
/// Terminal success identical to the unary SubmitResponse.
@$pb.TagNumber(4)
SubmitResponse get finalResult => $_getN(3);
@$pb.TagNumber(4)
set finalResult(SubmitResponse value) => $_setField(4, value);
@$pb.TagNumber(4)
$core.bool hasFinalResult() => $_has(3);
@$pb.TagNumber(4)
void clearFinalResult() => $_clearField(4);
@$pb.TagNumber(4)
SubmitResponse ensureFinalResult() => $_ensure(3);
/// Terminal failure the flow (or a step) errored.
@$pb.TagNumber(5)
StreamError get error => $_getN(4);
@$pb.TagNumber(5)
set error(StreamError value) => $_setField(5, value);
@$pb.TagNumber(5)
$core.bool hasError() => $_has(4);
@$pb.TagNumber(5)
void clearError() => $_clearField(5);
@$pb.TagNumber(5)
StreamError ensureError() => $_ensure(4);
}
class StepStarted extends $pb.GeneratedMessage {
factory StepStarted({
$core.String? step,
$core.String? capability,
}) {
final result = create();
if (step != null) result.step = step;
if (capability != null) result.capability = capability;
return result;
}
StepStarted._();
factory StepStarted.fromBuffer($core.List<$core.int> data,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(data, registry);
factory StepStarted.fromJson($core.String json,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(json, registry);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'StepStarted',
package: const $pb.PackageName(_omitMessageNames ? '' : 'chain.v1'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'step')
..aOS(2, _omitFieldNames ? '' : 'capability')
..hasRequiredFields = false;
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
StepStarted clone() => deepCopy();
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
StepStarted copyWith(void Function(StepStarted) updates) =>
super.copyWith((message) => updates(message as StepStarted))
as StepStarted;
@$core.override
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static StepStarted create() => StepStarted._();
@$core.override
StepStarted createEmptyInstance() => create();
@$core.pragma('dart2js:noInline')
static StepStarted getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<StepStarted>(create);
static StepStarted? _defaultInstance;
@$pb.TagNumber(1)
$core.String get step => $_getSZ(0);
@$pb.TagNumber(1)
set step($core.String value) => $_setString(0, value);
@$pb.TagNumber(1)
$core.bool hasStep() => $_has(0);
@$pb.TagNumber(1)
void clearStep() => $_clearField(1);
/// Capability the step resolved to, e.g. "text.extract".
@$pb.TagNumber(2)
$core.String get capability => $_getSZ(1);
@$pb.TagNumber(2)
set capability($core.String value) => $_setString(1, value);
@$pb.TagNumber(2)
$core.bool hasCapability() => $_has(1);
@$pb.TagNumber(2)
void clearCapability() => $_clearField(2);
}
class StepFinished extends $pb.GeneratedMessage {
factory StepFinished({
$core.String? step,
$core.bool? ok,
$fixnum.Int64? durationMs,
}) {
final result = create();
if (step != null) result.step = step;
if (ok != null) result.ok = ok;
if (durationMs != null) result.durationMs = durationMs;
return result;
}
StepFinished._();
factory StepFinished.fromBuffer($core.List<$core.int> data,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(data, registry);
factory StepFinished.fromJson($core.String json,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(json, registry);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'StepFinished',
package: const $pb.PackageName(_omitMessageNames ? '' : 'chain.v1'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'step')
..aOB(2, _omitFieldNames ? '' : 'ok')
..aInt64(3, _omitFieldNames ? '' : 'durationMs')
..hasRequiredFields = false;
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
StepFinished clone() => deepCopy();
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
StepFinished copyWith(void Function(StepFinished) updates) =>
super.copyWith((message) => updates(message as StepFinished))
as StepFinished;
@$core.override
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static StepFinished create() => StepFinished._();
@$core.override
StepFinished createEmptyInstance() => create();
@$core.pragma('dart2js:noInline')
static StepFinished getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<StepFinished>(create);
static StepFinished? _defaultInstance;
@$pb.TagNumber(1)
$core.String get step => $_getSZ(0);
@$pb.TagNumber(1)
set step($core.String value) => $_setString(0, value);
@$pb.TagNumber(1)
$core.bool hasStep() => $_has(0);
@$pb.TagNumber(1)
void clearStep() => $_clearField(1);
@$pb.TagNumber(2)
$core.bool get ok => $_getBF(1);
@$pb.TagNumber(2)
set ok($core.bool value) => $_setBool(1, value);
@$pb.TagNumber(2)
$core.bool hasOk() => $_has(1);
@$pb.TagNumber(2)
void clearOk() => $_clearField(2);
@$pb.TagNumber(3)
$fixnum.Int64 get durationMs => $_getI64(2);
@$pb.TagNumber(3)
set durationMs($fixnum.Int64 value) => $_setInt64(2, value);
@$pb.TagNumber(3)
$core.bool hasDurationMs() => $_has(2);
@$pb.TagNumber(3)
void clearDurationMs() => $_clearField(3);
}
/// An ephemeral event a module emitted via host.emit-event (WIT 1.1).
/// Never written to the audit log.
class ModuleEvent extends $pb.GeneratedMessage {
factory ModuleEvent({
$core.String? step,
$core.String? name,
$2.Payload? payload,
}) {
final result = create();
if (step != null) result.step = step;
if (name != null) result.name = name;
if (payload != null) result.payload = payload;
return result;
}
ModuleEvent._();
factory ModuleEvent.fromBuffer($core.List<$core.int> data,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(data, registry);
factory ModuleEvent.fromJson($core.String json,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(json, registry);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'ModuleEvent',
package: const $pb.PackageName(_omitMessageNames ? '' : 'chain.v1'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'step')
..aOS(2, _omitFieldNames ? '' : 'name')
..aOM<$2.Payload>(3, _omitFieldNames ? '' : 'payload',
subBuilder: $2.Payload.create)
..hasRequiredFields = false;
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
ModuleEvent clone() => deepCopy();
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
ModuleEvent copyWith(void Function(ModuleEvent) updates) =>
super.copyWith((message) => updates(message as ModuleEvent))
as ModuleEvent;
@$core.override
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static ModuleEvent create() => ModuleEvent._();
@$core.override
ModuleEvent createEmptyInstance() => create();
@$core.pragma('dart2js:noInline')
static ModuleEvent getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<ModuleEvent>(create);
static ModuleEvent? _defaultInstance;
/// The step whose module emitted this.
@$pb.TagNumber(1)
$core.String get step => $_getSZ(0);
@$pb.TagNumber(1)
set step($core.String value) => $_setString(0, value);
@$pb.TagNumber(1)
$core.bool hasStep() => $_has(0);
@$pb.TagNumber(1)
void clearStep() => $_clearField(1);
/// Module-defined label, e.g. "progress" / "token".
@$pb.TagNumber(2)
$core.String get name => $_getSZ(1);
@$pb.TagNumber(2)
set name($core.String value) => $_setString(1, value);
@$pb.TagNumber(2)
$core.bool hasName() => $_has(1);
@$pb.TagNumber(2)
void clearName() => $_clearField(2);
/// Event body.
@$pb.TagNumber(3)
$2.Payload get payload => $_getN(2);
@$pb.TagNumber(3)
set payload($2.Payload value) => $_setField(3, value);
@$pb.TagNumber(3)
$core.bool hasPayload() => $_has(2);
@$pb.TagNumber(3)
void clearPayload() => $_clearField(3);
@$pb.TagNumber(3)
$2.Payload ensurePayload() => $_ensure(2);
}
class StreamError extends $pb.GeneratedMessage {
factory StreamError({
$core.String? message,
}) {
final result = create();
if (message != null) result.message = message;
return result;
}
StreamError._();
factory StreamError.fromBuffer($core.List<$core.int> data,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(data, registry);
factory StreamError.fromJson($core.String json,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(json, registry);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'StreamError',
package: const $pb.PackageName(_omitMessageNames ? '' : 'chain.v1'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'message')
..hasRequiredFields = false;
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
StreamError clone() => deepCopy();
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
StreamError copyWith(void Function(StreamError) updates) =>
super.copyWith((message) => updates(message as StreamError))
as StreamError;
@$core.override
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static StreamError create() => StreamError._();
@$core.override
StreamError createEmptyInstance() => create();
@$core.pragma('dart2js:noInline')
static StreamError getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<StreamError>(create);
static StreamError? _defaultInstance;
@$pb.TagNumber(1)
$core.String get message => $_getSZ(0);
@$pb.TagNumber(1)
set message($core.String value) => $_setString(0, value);
@$pb.TagNumber(1)
$core.bool hasMessage() => $_has(0);
@$pb.TagNumber(1)
void clearMessage() => $_clearField(1);
}
/// Lifecycle of a detached invocation (added 1.1).
class InvocationStatus extends $pb.GeneratedMessage {
factory InvocationStatus({
InvocationStatus_Phase? phase,
$core.String? currentStep,
$core.String? startedAt,
$core.String? finishedAt,
$core.String? error,
}) {
final result = create();
if (phase != null) result.phase = phase;
if (currentStep != null) result.currentStep = currentStep;
if (startedAt != null) result.startedAt = startedAt;
if (finishedAt != null) result.finishedAt = finishedAt;
if (error != null) result.error = error;
return result;
}
InvocationStatus._();
factory InvocationStatus.fromBuffer($core.List<$core.int> data,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(data, registry);
factory InvocationStatus.fromJson($core.String json,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(json, registry);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'InvocationStatus',
package: const $pb.PackageName(_omitMessageNames ? '' : 'chain.v1'),
createEmptyInstance: create)
..aE<InvocationStatus_Phase>(1, _omitFieldNames ? '' : 'phase',
enumValues: InvocationStatus_Phase.values)
..aOS(2, _omitFieldNames ? '' : 'currentStep')
..aOS(3, _omitFieldNames ? '' : 'startedAt')
..aOS(4, _omitFieldNames ? '' : 'finishedAt')
..aOS(5, _omitFieldNames ? '' : 'error')
..hasRequiredFields = false;
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
InvocationStatus clone() => deepCopy();
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
InvocationStatus copyWith(void Function(InvocationStatus) updates) =>
super.copyWith((message) => updates(message as InvocationStatus))
as InvocationStatus;
@$core.override
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static InvocationStatus create() => InvocationStatus._();
@$core.override
InvocationStatus createEmptyInstance() => create();
@$core.pragma('dart2js:noInline')
static InvocationStatus getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<InvocationStatus>(create);
static InvocationStatus? _defaultInstance;
@$pb.TagNumber(1)
InvocationStatus_Phase get phase => $_getN(0);
@$pb.TagNumber(1)
set phase(InvocationStatus_Phase value) => $_setField(1, value);
@$pb.TagNumber(1)
$core.bool hasPhase() => $_has(0);
@$pb.TagNumber(1)
void clearPhase() => $_clearField(1);
/// Step currently executing (RUNNING), empty otherwise.
@$pb.TagNumber(2)
$core.String get currentStep => $_getSZ(1);
@$pb.TagNumber(2)
set currentStep($core.String value) => $_setString(1, value);
@$pb.TagNumber(2)
$core.bool hasCurrentStep() => $_has(1);
@$pb.TagNumber(2)
void clearCurrentStep() => $_clearField(2);
/// RFC 3339 timestamps; finished_at empty until the flow ends.
@$pb.TagNumber(3)
$core.String get startedAt => $_getSZ(2);
@$pb.TagNumber(3)
set startedAt($core.String value) => $_setString(2, value);
@$pb.TagNumber(3)
$core.bool hasStartedAt() => $_has(2);
@$pb.TagNumber(3)
void clearStartedAt() => $_clearField(3);
@$pb.TagNumber(4)
$core.String get finishedAt => $_getSZ(3);
@$pb.TagNumber(4)
set finishedAt($core.String value) => $_setString(3, value);
@$pb.TagNumber(4)
$core.bool hasFinishedAt() => $_has(3);
@$pb.TagNumber(4)
void clearFinishedAt() => $_clearField(4);
/// Error message when phase == FAILED, empty otherwise.
@$pb.TagNumber(5)
$core.String get error => $_getSZ(4);
@$pb.TagNumber(5)
set error($core.String value) => $_setString(4, value);
@$pb.TagNumber(5)
$core.bool hasError() => $_has(4);
@$pb.TagNumber(5)
void clearError() => $_clearField(5);
}
class CancelInvocationResponse extends $pb.GeneratedMessage {
factory CancelInvocationResponse({
$core.bool? cancelled,
}) {
final result = create();
if (cancelled != null) result.cancelled = cancelled;
return result;
}
CancelInvocationResponse._();
factory CancelInvocationResponse.fromBuffer($core.List<$core.int> data,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromBuffer(data, registry);
factory CancelInvocationResponse.fromJson($core.String json,
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
create()..mergeFromJson(json, registry);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'CancelInvocationResponse',
package: const $pb.PackageName(_omitMessageNames ? '' : 'chain.v1'),
createEmptyInstance: create)
..aOB(1, _omitFieldNames ? '' : 'cancelled')
..hasRequiredFields = false;
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
CancelInvocationResponse clone() => deepCopy();
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
CancelInvocationResponse copyWith(
void Function(CancelInvocationResponse) updates) =>
super.copyWith((message) => updates(message as CancelInvocationResponse))
as CancelInvocationResponse;
@$core.override
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static CancelInvocationResponse create() => CancelInvocationResponse._();
@$core.override
CancelInvocationResponse createEmptyInstance() => create();
@$core.pragma('dart2js:noInline')
static CancelInvocationResponse getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<CancelInvocationResponse>(create);
static CancelInvocationResponse? _defaultInstance;
/// True if a running invocation was signalled to cancel; false if it
/// was already finished or unknown.
@$pb.TagNumber(1)
$core.bool get cancelled => $_getBF(0);
@$pb.TagNumber(1)
set cancelled($core.bool value) => $_setBool(0, value);
@$pb.TagNumber(1)
$core.bool hasCancelled() => $_has(0);
@$pb.TagNumber(1)
void clearCancelled() => $_clearField(1);
}
class ModuleList extends $pb.GeneratedMessage { class ModuleList extends $pb.GeneratedMessage {
factory ModuleList({ factory ModuleList({
$core.Iterable<ModuleSummary>? modules, $core.Iterable<ModuleSummary>? modules,
@ -3988,6 +4607,7 @@ class StoreEntry extends $pb.GeneratedMessage {
$core.String? kind, $core.String? kind,
$core.String? provider, $core.String? provider,
$core.String? sourceKind, $core.String? sourceKind,
$core.String? source,
}) { }) {
final result = create(); final result = create();
if (name != null) result.name = name; if (name != null) result.name = name;
@ -4013,6 +4633,7 @@ class StoreEntry extends $pb.GeneratedMessage {
if (kind != null) result.kind = kind; if (kind != null) result.kind = kind;
if (provider != null) result.provider = provider; if (provider != null) result.provider = provider;
if (sourceKind != null) result.sourceKind = sourceKind; if (sourceKind != null) result.sourceKind = sourceKind;
if (source != null) result.source = source;
return result; return result;
} }
@ -4050,6 +4671,7 @@ class StoreEntry extends $pb.GeneratedMessage {
..aOS(19, _omitFieldNames ? '' : 'kind') ..aOS(19, _omitFieldNames ? '' : 'kind')
..aOS(20, _omitFieldNames ? '' : 'provider') ..aOS(20, _omitFieldNames ? '' : 'provider')
..aOS(21, _omitFieldNames ? '' : 'sourceKind') ..aOS(21, _omitFieldNames ? '' : 'sourceKind')
..aOS(22, _omitFieldNames ? '' : 'source')
..hasRequiredFields = false; ..hasRequiredFields = false;
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
@ -4271,6 +4893,19 @@ class StoreEntry extends $pb.GeneratedMessage {
$core.bool hasSourceKind() => $_has(20); $core.bool hasSourceKind() => $_has(20);
@$pb.TagNumber(21) @$pb.TagNumber(21)
void clearSourceKind() => $_clearField(21); void clearSourceKind() => $_clearField(21);
/// Name of the store this entry was loaded from: "bundled" for the
/// built-in seed, otherwise the operator-added store's name. Distinct
/// from source_kind (the transport) this is the ORIGIN store. Studio
/// groups modules by it and shows a "from <store>" label.
@$pb.TagNumber(22)
$core.String get source => $_getSZ(21);
@$pb.TagNumber(22)
set source($core.String value) => $_setString(21, value);
@$pb.TagNumber(22)
$core.bool hasSource() => $_has(21);
@$pb.TagNumber(22)
void clearSource() => $_clearField(22);
} }
class ChannelStatusResponse extends $pb.GeneratedMessage { class ChannelStatusResponse extends $pb.GeneratedMessage {

View file

@ -14,6 +14,38 @@ import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb; import 'package:protobuf/protobuf.dart' as $pb;
class InvocationStatus_Phase extends $pb.ProtobufEnum {
static const InvocationStatus_Phase PHASE_UNKNOWN =
InvocationStatus_Phase._(0, _omitEnumNames ? '' : 'PHASE_UNKNOWN');
static const InvocationStatus_Phase PENDING =
InvocationStatus_Phase._(1, _omitEnumNames ? '' : 'PENDING');
static const InvocationStatus_Phase RUNNING =
InvocationStatus_Phase._(2, _omitEnumNames ? '' : 'RUNNING');
static const InvocationStatus_Phase SUCCEEDED =
InvocationStatus_Phase._(3, _omitEnumNames ? '' : 'SUCCEEDED');
static const InvocationStatus_Phase FAILED =
InvocationStatus_Phase._(4, _omitEnumNames ? '' : 'FAILED');
static const InvocationStatus_Phase CANCELLED =
InvocationStatus_Phase._(5, _omitEnumNames ? '' : 'CANCELLED');
static const $core.List<InvocationStatus_Phase> values =
<InvocationStatus_Phase>[
PHASE_UNKNOWN,
PENDING,
RUNNING,
SUCCEEDED,
FAILED,
CANCELLED,
];
static final $core.List<InvocationStatus_Phase?> _byValue =
$pb.ProtobufEnum.$_initByValueList(values, 5);
static InvocationStatus_Phase? valueOf($core.int value) =>
value < 0 || value >= _byValue.length ? null : _byValue[value];
const InvocationStatus_Phase._(super.value, super.name);
}
class HealthStatus_State extends $pb.ProtobufEnum { class HealthStatus_State extends $pb.ProtobufEnum {
static const HealthStatus_State UNKNOWN = static const HealthStatus_State UNKNOWN =
HealthStatus_State._(0, _omitEnumNames ? '' : 'UNKNOWN'); HealthStatus_State._(0, _omitEnumNames ? '' : 'UNKNOWN');

View file

@ -17,6 +17,7 @@ import 'package:grpc/service_api.dart' as $grpc;
import 'package:protobuf/protobuf.dart' as $pb; import 'package:protobuf/protobuf.dart' as $pb;
import 'package:protobuf/well_known_types/google/protobuf/empty.pb.dart' as $1; import 'package:protobuf/well_known_types/google/protobuf/empty.pb.dart' as $1;
import 'common.pb.dart' as $2;
import 'hub.pb.dart' as $0; import 'hub.pb.dart' as $0;
export 'hub.pb.dart'; export 'hub.pb.dart';
@ -42,6 +43,20 @@ class HubClient extends $grpc.Client {
return $createUnaryCall(_$submit, request, options: options); return $createUnaryCall(_$submit, request, options: options);
} }
/// Submit a flow and follow its execution live (added 1.1). Same
/// request as unary Submit; the response is a stream of step markers,
/// ephemeral module events (host.emit-event), and finally the result
/// or an error. Works over native gRPC and gRPC-Web (server
/// streaming). Unary Submit is unchanged for clients that don't care.
$grpc.ResponseStream<$0.SubmitStreamEvent> submitStream(
$0.SubmitRequest request, {
$grpc.CallOptions? options,
}) {
return $createStreamingCall(
_$submitStream, $async.Stream.fromIterable([request]),
options: options);
}
/// List modules known to this hub. /// List modules known to this hub.
$grpc.ResponseFuture<$0.ModuleList> listModules( $grpc.ResponseFuture<$0.ModuleList> listModules(
$1.Empty request, { $1.Empty request, {
@ -50,6 +65,31 @@ class HubClient extends $grpc.Client {
return $createUnaryCall(_$listModules, request, options: options); return $createUnaryCall(_$listModules, request, options: options);
} }
/// Detached-invocation lifecycle (added 1.1). Only invocations
/// submitted with detach=true are tracked; results are retained under
/// hard operator limits (size/count/TTL) and NOT persisted across a
/// hub restart.
$grpc.ResponseFuture<$0.InvocationStatus> getInvocationStatus(
$2.InvocationId request, {
$grpc.CallOptions? options,
}) {
return $createUnaryCall(_$getInvocationStatus, request, options: options);
}
$grpc.ResponseFuture<$0.SubmitResponse> getInvocationResult(
$2.InvocationId request, {
$grpc.CallOptions? options,
}) {
return $createUnaryCall(_$getInvocationResult, request, options: options);
}
$grpc.ResponseFuture<$0.CancelInvocationResponse> cancelInvocation(
$2.InvocationId request, {
$grpc.CallOptions? options,
}) {
return $createUnaryCall(_$cancelInvocation, request, options: options);
}
/// Liveness / readiness probe. /// Liveness / readiness probe.
$grpc.ResponseFuture<$0.HealthStatus> health( $grpc.ResponseFuture<$0.HealthStatus> health(
$1.Empty request, { $1.Empty request, {
@ -65,10 +105,30 @@ class HubClient extends $grpc.Client {
'/chain.v1.Hub/Submit', '/chain.v1.Hub/Submit',
($0.SubmitRequest value) => value.writeToBuffer(), ($0.SubmitRequest value) => value.writeToBuffer(),
$0.SubmitResponse.fromBuffer); $0.SubmitResponse.fromBuffer);
static final _$submitStream =
$grpc.ClientMethod<$0.SubmitRequest, $0.SubmitStreamEvent>(
'/chain.v1.Hub/SubmitStream',
($0.SubmitRequest value) => value.writeToBuffer(),
$0.SubmitStreamEvent.fromBuffer);
static final _$listModules = $grpc.ClientMethod<$1.Empty, $0.ModuleList>( static final _$listModules = $grpc.ClientMethod<$1.Empty, $0.ModuleList>(
'/chain.v1.Hub/ListModules', '/chain.v1.Hub/ListModules',
($1.Empty value) => value.writeToBuffer(), ($1.Empty value) => value.writeToBuffer(),
$0.ModuleList.fromBuffer); $0.ModuleList.fromBuffer);
static final _$getInvocationStatus =
$grpc.ClientMethod<$2.InvocationId, $0.InvocationStatus>(
'/chain.v1.Hub/GetInvocationStatus',
($2.InvocationId value) => value.writeToBuffer(),
$0.InvocationStatus.fromBuffer);
static final _$getInvocationResult =
$grpc.ClientMethod<$2.InvocationId, $0.SubmitResponse>(
'/chain.v1.Hub/GetInvocationResult',
($2.InvocationId value) => value.writeToBuffer(),
$0.SubmitResponse.fromBuffer);
static final _$cancelInvocation =
$grpc.ClientMethod<$2.InvocationId, $0.CancelInvocationResponse>(
'/chain.v1.Hub/CancelInvocation',
($2.InvocationId value) => value.writeToBuffer(),
$0.CancelInvocationResponse.fromBuffer);
static final _$health = $grpc.ClientMethod<$1.Empty, $0.HealthStatus>( static final _$health = $grpc.ClientMethod<$1.Empty, $0.HealthStatus>(
'/chain.v1.Hub/Health', '/chain.v1.Hub/Health',
($1.Empty value) => value.writeToBuffer(), ($1.Empty value) => value.writeToBuffer(),
@ -87,6 +147,13 @@ abstract class HubServiceBase extends $grpc.Service {
false, false,
($core.List<$core.int> value) => $0.SubmitRequest.fromBuffer(value), ($core.List<$core.int> value) => $0.SubmitRequest.fromBuffer(value),
($0.SubmitResponse value) => value.writeToBuffer())); ($0.SubmitResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.SubmitRequest, $0.SubmitStreamEvent>(
'SubmitStream',
submitStream_Pre,
false,
true,
($core.List<$core.int> value) => $0.SubmitRequest.fromBuffer(value),
($0.SubmitStreamEvent value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$1.Empty, $0.ModuleList>( $addMethod($grpc.ServiceMethod<$1.Empty, $0.ModuleList>(
'ListModules', 'ListModules',
listModules_Pre, listModules_Pre,
@ -94,6 +161,28 @@ abstract class HubServiceBase extends $grpc.Service {
false, false,
($core.List<$core.int> value) => $1.Empty.fromBuffer(value), ($core.List<$core.int> value) => $1.Empty.fromBuffer(value),
($0.ModuleList value) => value.writeToBuffer())); ($0.ModuleList value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$2.InvocationId, $0.InvocationStatus>(
'GetInvocationStatus',
getInvocationStatus_Pre,
false,
false,
($core.List<$core.int> value) => $2.InvocationId.fromBuffer(value),
($0.InvocationStatus value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$2.InvocationId, $0.SubmitResponse>(
'GetInvocationResult',
getInvocationResult_Pre,
false,
false,
($core.List<$core.int> value) => $2.InvocationId.fromBuffer(value),
($0.SubmitResponse value) => value.writeToBuffer()));
$addMethod(
$grpc.ServiceMethod<$2.InvocationId, $0.CancelInvocationResponse>(
'CancelInvocation',
cancelInvocation_Pre,
false,
false,
($core.List<$core.int> value) => $2.InvocationId.fromBuffer(value),
($0.CancelInvocationResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$1.Empty, $0.HealthStatus>( $addMethod($grpc.ServiceMethod<$1.Empty, $0.HealthStatus>(
'Health', 'Health',
health_Pre, health_Pre,
@ -111,6 +200,14 @@ abstract class HubServiceBase extends $grpc.Service {
$async.Future<$0.SubmitResponse> submit( $async.Future<$0.SubmitResponse> submit(
$grpc.ServiceCall call, $0.SubmitRequest request); $grpc.ServiceCall call, $0.SubmitRequest request);
$async.Stream<$0.SubmitStreamEvent> submitStream_Pre($grpc.ServiceCall $call,
$async.Future<$0.SubmitRequest> $request) async* {
yield* submitStream($call, await $request);
}
$async.Stream<$0.SubmitStreamEvent> submitStream(
$grpc.ServiceCall call, $0.SubmitRequest request);
$async.Future<$0.ModuleList> listModules_Pre( $async.Future<$0.ModuleList> listModules_Pre(
$grpc.ServiceCall $call, $async.Future<$1.Empty> $request) async { $grpc.ServiceCall $call, $async.Future<$1.Empty> $request) async {
return listModules($call, await $request); return listModules($call, await $request);
@ -119,6 +216,30 @@ abstract class HubServiceBase extends $grpc.Service {
$async.Future<$0.ModuleList> listModules( $async.Future<$0.ModuleList> listModules(
$grpc.ServiceCall call, $1.Empty request); $grpc.ServiceCall call, $1.Empty request);
$async.Future<$0.InvocationStatus> getInvocationStatus_Pre(
$grpc.ServiceCall $call, $async.Future<$2.InvocationId> $request) async {
return getInvocationStatus($call, await $request);
}
$async.Future<$0.InvocationStatus> getInvocationStatus(
$grpc.ServiceCall call, $2.InvocationId request);
$async.Future<$0.SubmitResponse> getInvocationResult_Pre(
$grpc.ServiceCall $call, $async.Future<$2.InvocationId> $request) async {
return getInvocationResult($call, await $request);
}
$async.Future<$0.SubmitResponse> getInvocationResult(
$grpc.ServiceCall call, $2.InvocationId request);
$async.Future<$0.CancelInvocationResponse> cancelInvocation_Pre(
$grpc.ServiceCall $call, $async.Future<$2.InvocationId> $request) async {
return cancelInvocation($call, await $request);
}
$async.Future<$0.CancelInvocationResponse> cancelInvocation(
$grpc.ServiceCall call, $2.InvocationId request);
$async.Future<$0.HealthStatus> health_Pre( $async.Future<$0.HealthStatus> health_Pre(
$grpc.ServiceCall $call, $async.Future<$1.Empty> $request) async { $grpc.ServiceCall $call, $async.Future<$1.Empty> $request) async {
return health($call, await $request); return health($call, await $request);

View file

@ -41,6 +41,7 @@ const SubmitRequest$json = {
'6': '.chain.v1.SubmitRequest.InputsEntry', '6': '.chain.v1.SubmitRequest.InputsEntry',
'10': 'inputs' '10': 'inputs'
}, },
{'1': 'detach', '3': 3, '4': 1, '5': 8, '10': 'detach'},
], ],
'3': [SubmitRequest_InputsEntry$json], '3': [SubmitRequest_InputsEntry$json],
}; };
@ -65,9 +66,9 @@ const SubmitRequest_InputsEntry$json = {
/// Descriptor for `SubmitRequest`. Decode as a `google.protobuf.DescriptorProto`. /// Descriptor for `SubmitRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List submitRequestDescriptor = $convert.base64Decode( final $typed_data.Uint8List submitRequestDescriptor = $convert.base64Decode(
'Cg1TdWJtaXRSZXF1ZXN0EhsKCWZsb3dfeWFtbBgBIAEoDFIIZmxvd1lhbWwSOwoGaW5wdXRzGA' 'Cg1TdWJtaXRSZXF1ZXN0EhsKCWZsb3dfeWFtbBgBIAEoDFIIZmxvd1lhbWwSOwoGaW5wdXRzGA'
'IgAygLMiMuY2hhaW4udjEuU3VibWl0UmVxdWVzdC5JbnB1dHNFbnRyeVIGaW5wdXRzGkwKC0lu' 'IgAygLMiMuY2hhaW4udjEuU3VibWl0UmVxdWVzdC5JbnB1dHNFbnRyeVIGaW5wdXRzEhYKBmRl'
'cHV0c0VudHJ5EhAKA2tleRgBIAEoCVIDa2V5EicKBXZhbHVlGAIgASgLMhEuY2hhaW4udjEuUG' 'dGFjaBgDIAEoCFIGZGV0YWNoGkwKC0lucHV0c0VudHJ5EhAKA2tleRgBIAEoCVIDa2V5EicKBX'
'F5bG9hZFIFdmFsdWU6AjgB'); 'ZhbHVlGAIgASgLMhEuY2hhaW4udjEuUGF5bG9hZFIFdmFsdWU6AjgB');
@$core.Deprecated('Use submitResponseDescriptor instead') @$core.Deprecated('Use submitResponseDescriptor instead')
const SubmitResponse$json = { const SubmitResponse$json = {
@ -117,6 +118,189 @@ final $typed_data.Uint8List submitResponseDescriptor = $convert.base64Decode(
'dFJlc3BvbnNlLk91dHB1dHNFbnRyeVIHb3V0cHV0cxpNCgxPdXRwdXRzRW50cnkSEAoDa2V5GA' 'dFJlc3BvbnNlLk91dHB1dHNFbnRyeVIHb3V0cHV0cxpNCgxPdXRwdXRzRW50cnkSEAoDa2V5GA'
'EgASgJUgNrZXkSJwoFdmFsdWUYAiABKAsyES5jaGFpbi52MS5QYXlsb2FkUgV2YWx1ZToCOAE='); 'EgASgJUgNrZXkSJwoFdmFsdWUYAiABKAsyES5jaGFpbi52MS5QYXlsb2FkUgV2YWx1ZToCOAE=');
@$core.Deprecated('Use submitStreamEventDescriptor instead')
const SubmitStreamEvent$json = {
'1': 'SubmitStreamEvent',
'2': [
{
'1': 'step_started',
'3': 1,
'4': 1,
'5': 11,
'6': '.chain.v1.StepStarted',
'9': 0,
'10': 'stepStarted'
},
{
'1': 'step_finished',
'3': 2,
'4': 1,
'5': 11,
'6': '.chain.v1.StepFinished',
'9': 0,
'10': 'stepFinished'
},
{
'1': 'module_event',
'3': 3,
'4': 1,
'5': 11,
'6': '.chain.v1.ModuleEvent',
'9': 0,
'10': 'moduleEvent'
},
{
'1': 'final_result',
'3': 4,
'4': 1,
'5': 11,
'6': '.chain.v1.SubmitResponse',
'9': 0,
'10': 'finalResult'
},
{
'1': 'error',
'3': 5,
'4': 1,
'5': 11,
'6': '.chain.v1.StreamError',
'9': 0,
'10': 'error'
},
],
'8': [
{'1': 'event'},
],
};
/// Descriptor for `SubmitStreamEvent`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List submitStreamEventDescriptor = $convert.base64Decode(
'ChFTdWJtaXRTdHJlYW1FdmVudBI6CgxzdGVwX3N0YXJ0ZWQYASABKAsyFS5jaGFpbi52MS5TdG'
'VwU3RhcnRlZEgAUgtzdGVwU3RhcnRlZBI9Cg1zdGVwX2ZpbmlzaGVkGAIgASgLMhYuY2hhaW4u'
'djEuU3RlcEZpbmlzaGVkSABSDHN0ZXBGaW5pc2hlZBI6Cgxtb2R1bGVfZXZlbnQYAyABKAsyFS'
'5jaGFpbi52MS5Nb2R1bGVFdmVudEgAUgttb2R1bGVFdmVudBI9CgxmaW5hbF9yZXN1bHQYBCAB'
'KAsyGC5jaGFpbi52MS5TdWJtaXRSZXNwb25zZUgAUgtmaW5hbFJlc3VsdBItCgVlcnJvchgFIA'
'EoCzIVLmNoYWluLnYxLlN0cmVhbUVycm9ySABSBWVycm9yQgcKBWV2ZW50');
@$core.Deprecated('Use stepStartedDescriptor instead')
const StepStarted$json = {
'1': 'StepStarted',
'2': [
{'1': 'step', '3': 1, '4': 1, '5': 9, '10': 'step'},
{'1': 'capability', '3': 2, '4': 1, '5': 9, '10': 'capability'},
],
};
/// Descriptor for `StepStarted`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List stepStartedDescriptor = $convert.base64Decode(
'CgtTdGVwU3RhcnRlZBISCgRzdGVwGAEgASgJUgRzdGVwEh4KCmNhcGFiaWxpdHkYAiABKAlSCm'
'NhcGFiaWxpdHk=');
@$core.Deprecated('Use stepFinishedDescriptor instead')
const StepFinished$json = {
'1': 'StepFinished',
'2': [
{'1': 'step', '3': 1, '4': 1, '5': 9, '10': 'step'},
{'1': 'ok', '3': 2, '4': 1, '5': 8, '10': 'ok'},
{'1': 'duration_ms', '3': 3, '4': 1, '5': 3, '10': 'durationMs'},
],
};
/// Descriptor for `StepFinished`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List stepFinishedDescriptor = $convert.base64Decode(
'CgxTdGVwRmluaXNoZWQSEgoEc3RlcBgBIAEoCVIEc3RlcBIOCgJvaxgCIAEoCFICb2sSHwoLZH'
'VyYXRpb25fbXMYAyABKANSCmR1cmF0aW9uTXM=');
@$core.Deprecated('Use moduleEventDescriptor instead')
const ModuleEvent$json = {
'1': 'ModuleEvent',
'2': [
{'1': 'step', '3': 1, '4': 1, '5': 9, '10': 'step'},
{'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'},
{
'1': 'payload',
'3': 3,
'4': 1,
'5': 11,
'6': '.chain.v1.Payload',
'10': 'payload'
},
],
};
/// Descriptor for `ModuleEvent`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List moduleEventDescriptor = $convert.base64Decode(
'CgtNb2R1bGVFdmVudBISCgRzdGVwGAEgASgJUgRzdGVwEhIKBG5hbWUYAiABKAlSBG5hbWUSKw'
'oHcGF5bG9hZBgDIAEoCzIRLmNoYWluLnYxLlBheWxvYWRSB3BheWxvYWQ=');
@$core.Deprecated('Use streamErrorDescriptor instead')
const StreamError$json = {
'1': 'StreamError',
'2': [
{'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
],
};
/// Descriptor for `StreamError`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List streamErrorDescriptor = $convert
.base64Decode('CgtTdHJlYW1FcnJvchIYCgdtZXNzYWdlGAEgASgJUgdtZXNzYWdl');
@$core.Deprecated('Use invocationStatusDescriptor instead')
const InvocationStatus$json = {
'1': 'InvocationStatus',
'2': [
{
'1': 'phase',
'3': 1,
'4': 1,
'5': 14,
'6': '.chain.v1.InvocationStatus.Phase',
'10': 'phase'
},
{'1': 'current_step', '3': 2, '4': 1, '5': 9, '10': 'currentStep'},
{'1': 'started_at', '3': 3, '4': 1, '5': 9, '10': 'startedAt'},
{'1': 'finished_at', '3': 4, '4': 1, '5': 9, '10': 'finishedAt'},
{'1': 'error', '3': 5, '4': 1, '5': 9, '10': 'error'},
],
'4': [InvocationStatus_Phase$json],
};
@$core.Deprecated('Use invocationStatusDescriptor instead')
const InvocationStatus_Phase$json = {
'1': 'Phase',
'2': [
{'1': 'PHASE_UNKNOWN', '2': 0},
{'1': 'PENDING', '2': 1},
{'1': 'RUNNING', '2': 2},
{'1': 'SUCCEEDED', '2': 3},
{'1': 'FAILED', '2': 4},
{'1': 'CANCELLED', '2': 5},
],
};
/// Descriptor for `InvocationStatus`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List invocationStatusDescriptor = $convert.base64Decode(
'ChBJbnZvY2F0aW9uU3RhdHVzEjYKBXBoYXNlGAEgASgOMiAuY2hhaW4udjEuSW52b2NhdGlvbl'
'N0YXR1cy5QaGFzZVIFcGhhc2USIQoMY3VycmVudF9zdGVwGAIgASgJUgtjdXJyZW50U3RlcBId'
'CgpzdGFydGVkX2F0GAMgASgJUglzdGFydGVkQXQSHwoLZmluaXNoZWRfYXQYBCABKAlSCmZpbm'
'lzaGVkQXQSFAoFZXJyb3IYBSABKAlSBWVycm9yIl4KBVBoYXNlEhEKDVBIQVNFX1VOS05PV04Q'
'ABILCgdQRU5ESU5HEAESCwoHUlVOTklORxACEg0KCVNVQ0NFRURFRBADEgoKBkZBSUxFRBAEEg'
'0KCUNBTkNFTExFRBAF');
@$core.Deprecated('Use cancelInvocationResponseDescriptor instead')
const CancelInvocationResponse$json = {
'1': 'CancelInvocationResponse',
'2': [
{'1': 'cancelled', '3': 1, '4': 1, '5': 8, '10': 'cancelled'},
],
};
/// Descriptor for `CancelInvocationResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List cancelInvocationResponseDescriptor =
$convert.base64Decode(
'ChhDYW5jZWxJbnZvY2F0aW9uUmVzcG9uc2USHAoJY2FuY2VsbGVkGAEgASgIUgljYW5jZWxsZW'
'Q=');
@$core.Deprecated('Use moduleListDescriptor instead') @$core.Deprecated('Use moduleListDescriptor instead')
const ModuleList$json = { const ModuleList$json = {
'1': 'ModuleList', '1': 'ModuleList',
@ -1077,6 +1261,7 @@ const StoreEntry$json = {
{'1': 'kind', '3': 19, '4': 1, '5': 9, '10': 'kind'}, {'1': 'kind', '3': 19, '4': 1, '5': 9, '10': 'kind'},
{'1': 'provider', '3': 20, '4': 1, '5': 9, '10': 'provider'}, {'1': 'provider', '3': 20, '4': 1, '5': 9, '10': 'provider'},
{'1': 'source_kind', '3': 21, '4': 1, '5': 9, '10': 'sourceKind'}, {'1': 'source_kind', '3': 21, '4': 1, '5': 9, '10': 'sourceKind'},
{'1': 'source', '3': 22, '4': 1, '5': 9, '10': 'source'},
], ],
}; };
@ -1094,7 +1279,7 @@ final $typed_data.Uint8List storeEntryDescriptor = $convert.base64Decode(
'9uX3VybBgQIAEoCVIHaWNvblVybBInCg9zY3JlZW5zaG90X3VybHMYESADKAlSDnNjcmVlbnNo' '9uX3VybBgQIAEoCVIHaWNvblVybBInCg9zY3JlZW5zaG90X3VybHMYESADKAlSDnNjcmVlbnNo'
'b3RVcmxzEhkKCGRvY3NfdXJsGBIgASgJUgdkb2NzVXJsEhIKBGtpbmQYEyABKAlSBGtpbmQSGg' 'b3RVcmxzEhkKCGRvY3NfdXJsGBIgASgJUgdkb2NzVXJsEhIKBGtpbmQYEyABKAlSBGtpbmQSGg'
'oIcHJvdmlkZXIYFCABKAlSCHByb3ZpZGVyEh8KC3NvdXJjZV9raW5kGBUgASgJUgpzb3VyY2VL' 'oIcHJvdmlkZXIYFCABKAlSCHByb3ZpZGVyEh8KC3NvdXJjZV9raW5kGBUgASgJUgpzb3VyY2VL'
'aW5k'); 'aW5kEhYKBnNvdXJjZRgWIAEoCVIGc291cmNl');
@$core.Deprecated('Use channelStatusResponseDescriptor instead') @$core.Deprecated('Use channelStatusResponseDescriptor instead')
const ChannelStatusResponse$json = { const ChannelStatusResponse$json = {

View file

@ -86,6 +86,11 @@ typedef StoreSearchResponse = pb.StoreSearchResponse;
typedef InstallModuleResponse = pb.InstallModuleResponse; typedef InstallModuleResponse = pb.InstallModuleResponse;
typedef Payload = pb_common.Payload; typedef Payload = pb_common.Payload;
typedef SubmitResponse = pb.SubmitResponse; typedef SubmitResponse = pb.SubmitResponse;
// Live-stream (T2) + detached-invocation (T3) wire types, re-exported
// so consumers of [HubClient.submitStreaming] don't import the
// generated package directly.
typedef SubmitStreamEvent = pb.SubmitStreamEvent;
typedef InvocationStatus = pb.InvocationStatus;
/// Typed client for the FI Hub gRPC surface. Construct once, /// Typed client for the FI Hub gRPC surface. Construct once,
/// reuse for the process lifetime, call [close] on shutdown. /// reuse for the process lifetime, call [close] on shutdown.
@ -779,8 +784,80 @@ class HubClient {
Map<String, Uint8List> fileInputs = const {}, Map<String, Uint8List> fileInputs = const {},
Map<String, Object?> jsonInputs = const {}, Map<String, Object?> jsonInputs = const {},
Map<String, String> fileMimeTypes = const {}, Map<String, String> fileMimeTypes = const {},
bool detach = false,
}) async { }) async {
final req = pb.SubmitRequest()..flowYaml = utf8.encode(flowYaml); return _hub.submit(_buildSubmitRequest(
flowYaml: flowYaml,
textInputs: textInputs,
fileInputs: fileInputs,
jsonInputs: jsonInputs,
fileMimeTypes: fileMimeTypes,
detach: detach,
));
}
/// Submit a flow and follow its execution live (server streaming).
///
/// Yields [pb.SubmitStreamEvent]s in order: `stepStarted` /
/// `stepFinished` markers, `moduleEvent`s (a module's ephemeral
/// `host.emit-event`s), and finally either `finalResult` (== the
/// unary [submit] response) or `error`. Works over native gRPC and,
/// on web targets, gRPC-Web. Same inputs as [submit].
///
/// ```dart
/// await for (final ev in hub.submitStreaming(flowYaml: yaml)) {
/// if (ev.hasModuleEvent()) print('${ev.moduleEvent.name}');
/// if (ev.hasFinalResult()) print(ev.finalResult.outputs);
/// }
/// ```
Stream<SubmitStreamEvent> submitStreaming({
required String flowYaml,
Map<String, String> textInputs = const {},
Map<String, Uint8List> fileInputs = const {},
Map<String, Object?> jsonInputs = const {},
Map<String, String> fileMimeTypes = const {},
}) {
return _hub.submitStream(_buildSubmitRequest(
flowYaml: flowYaml,
textInputs: textInputs,
fileInputs: fileInputs,
jsonInputs: jsonInputs,
fileMimeTypes: fileMimeTypes,
));
}
/// Status of a detached invocation (T3). Throws a [GrpcError] with
/// code `notFound` for an unknown id.
Future<InvocationStatus> getInvocationStatus(String invocationId) {
return _hub.getInvocationStatus(pb_common.InvocationId()..value = invocationId);
}
/// Retained result of a succeeded detached invocation (T3). Throws
/// `failedPrecondition` if it is still running / failed, `notFound`
/// if unknown or already evicted.
Future<SubmitResponse> getInvocationResult(String invocationId) {
return _hub.getInvocationResult(pb_common.InvocationId()..value = invocationId);
}
/// Cancel a running detached invocation (T3). Returns true if it was
/// running and got signalled, false if already finished or unknown.
Future<bool> cancelInvocation(String invocationId) async {
final r =
await _hub.cancelInvocation(pb_common.InvocationId()..value = invocationId);
return r.cancelled;
}
pb.SubmitRequest _buildSubmitRequest({
required String flowYaml,
required Map<String, String> textInputs,
required Map<String, Uint8List> fileInputs,
required Map<String, Object?> jsonInputs,
required Map<String, String> fileMimeTypes,
bool detach = false,
}) {
final req = pb.SubmitRequest()
..flowYaml = utf8.encode(flowYaml)
..detach = detach;
for (final entry in textInputs.entries) { for (final entry in textInputs.entries) {
req.inputs[entry.key] = pb_common.Payload()..text = entry.value; req.inputs[entry.key] = pb_common.Payload()..text = entry.value;
} }
@ -801,7 +878,7 @@ class HubClient {
} }
req.inputs[entry.key] = pb_common.Payload()..json = _structFromMap(value); req.inputs[entry.key] = pb_common.Payload()..json = _structFromMap(value);
} }
return _hub.submit(req); return req;
} }
/// Closes the gRPC channel. Idempotent. /// Closes the gRPC channel. Idempotent.