diff --git a/lib/src/generated/chain/v1/hub.pb.dart b/lib/src/generated/chain/v1/hub.pb.dart index ce3afcb..a5767df 100644 --- a/lib/src/generated/chain/v1/hub.pb.dart +++ b/lib/src/generated/chain/v1/hub.pb.dart @@ -82,10 +82,12 @@ class SubmitRequest extends $pb.GeneratedMessage { factory SubmitRequest({ $core.List<$core.int>? flowYaml, $core.Iterable<$core.MapEntry<$core.String, $2.Payload>>? inputs, + $core.bool? detach, }) { final result = create(); if (flowYaml != null) result.flowYaml = flowYaml; if (inputs != null) result.inputs.addEntries(inputs); + if (detach != null) result.detach = detach; return result; } @@ -111,6 +113,7 @@ class SubmitRequest extends $pb.GeneratedMessage { valueCreator: $2.Payload.create, valueDefaultOrMaker: $2.Payload.getDefault, packageName: const $pb.PackageName('chain.v1')) + ..aOB(3, _omitFieldNames ? '' : 'detach') ..hasRequiredFields = false; @$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. @$pb.TagNumber(2) $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 { @@ -217,6 +234,608 @@ class SubmitResponse extends $pb.GeneratedMessage { $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(1, _omitFieldNames ? '' : 'stepStarted', + subBuilder: StepStarted.create) + ..aOM(2, _omitFieldNames ? '' : 'stepFinished', + subBuilder: StepFinished.create) + ..aOM(3, _omitFieldNames ? '' : 'moduleEvent', + subBuilder: ModuleEvent.create) + ..aOM(4, _omitFieldNames ? '' : 'finalResult', + subBuilder: SubmitResponse.create) + ..aOM(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(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(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(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(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(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(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(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(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 { factory ModuleList({ $core.Iterable? modules, @@ -3988,6 +4607,7 @@ class StoreEntry extends $pb.GeneratedMessage { $core.String? kind, $core.String? provider, $core.String? sourceKind, + $core.String? source, }) { final result = create(); if (name != null) result.name = name; @@ -4013,6 +4633,7 @@ class StoreEntry extends $pb.GeneratedMessage { if (kind != null) result.kind = kind; if (provider != null) result.provider = provider; if (sourceKind != null) result.sourceKind = sourceKind; + if (source != null) result.source = source; return result; } @@ -4050,6 +4671,7 @@ class StoreEntry extends $pb.GeneratedMessage { ..aOS(19, _omitFieldNames ? '' : 'kind') ..aOS(20, _omitFieldNames ? '' : 'provider') ..aOS(21, _omitFieldNames ? '' : 'sourceKind') + ..aOS(22, _omitFieldNames ? '' : 'source') ..hasRequiredFields = false; @$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); @$pb.TagNumber(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 " 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 { diff --git a/lib/src/generated/chain/v1/hub.pbenum.dart b/lib/src/generated/chain/v1/hub.pbenum.dart index 7cf495a..22405a3 100644 --- a/lib/src/generated/chain/v1/hub.pbenum.dart +++ b/lib/src/generated/chain/v1/hub.pbenum.dart @@ -14,6 +14,38 @@ import 'dart:core' as $core; 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 values = + [ + PHASE_UNKNOWN, + PENDING, + RUNNING, + SUCCEEDED, + FAILED, + CANCELLED, + ]; + + static final $core.List _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 { static const HealthStatus_State UNKNOWN = HealthStatus_State._(0, _omitEnumNames ? '' : 'UNKNOWN'); diff --git a/lib/src/generated/chain/v1/hub.pbgrpc.dart b/lib/src/generated/chain/v1/hub.pbgrpc.dart index e68db2d..3718a61 100644 --- a/lib/src/generated/chain/v1/hub.pbgrpc.dart +++ b/lib/src/generated/chain/v1/hub.pbgrpc.dart @@ -17,6 +17,7 @@ import 'package:grpc/service_api.dart' as $grpc; import 'package:protobuf/protobuf.dart' as $pb; 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; export 'hub.pb.dart'; @@ -42,6 +43,20 @@ class HubClient extends $grpc.Client { 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. $grpc.ResponseFuture<$0.ModuleList> listModules( $1.Empty request, { @@ -50,6 +65,31 @@ class HubClient extends $grpc.Client { 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. $grpc.ResponseFuture<$0.HealthStatus> health( $1.Empty request, { @@ -65,10 +105,30 @@ class HubClient extends $grpc.Client { '/chain.v1.Hub/Submit', ($0.SubmitRequest value) => value.writeToBuffer(), $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>( '/chain.v1.Hub/ListModules', ($1.Empty value) => value.writeToBuffer(), $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>( '/chain.v1.Hub/Health', ($1.Empty value) => value.writeToBuffer(), @@ -87,6 +147,13 @@ abstract class HubServiceBase extends $grpc.Service { false, ($core.List<$core.int> value) => $0.SubmitRequest.fromBuffer(value), ($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>( 'ListModules', listModules_Pre, @@ -94,6 +161,28 @@ abstract class HubServiceBase extends $grpc.Service { false, ($core.List<$core.int> value) => $1.Empty.fromBuffer(value), ($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>( 'Health', health_Pre, @@ -111,6 +200,14 @@ abstract class HubServiceBase extends $grpc.Service { $async.Future<$0.SubmitResponse> submit( $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( $grpc.ServiceCall $call, $async.Future<$1.Empty> $request) async { return listModules($call, await $request); @@ -119,6 +216,30 @@ abstract class HubServiceBase extends $grpc.Service { $async.Future<$0.ModuleList> listModules( $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( $grpc.ServiceCall $call, $async.Future<$1.Empty> $request) async { return health($call, await $request); diff --git a/lib/src/generated/chain/v1/hub.pbjson.dart b/lib/src/generated/chain/v1/hub.pbjson.dart index 5e2fd83..f786685 100644 --- a/lib/src/generated/chain/v1/hub.pbjson.dart +++ b/lib/src/generated/chain/v1/hub.pbjson.dart @@ -41,6 +41,7 @@ const SubmitRequest$json = { '6': '.chain.v1.SubmitRequest.InputsEntry', '10': 'inputs' }, + {'1': 'detach', '3': 3, '4': 1, '5': 8, '10': 'detach'}, ], '3': [SubmitRequest_InputsEntry$json], }; @@ -65,9 +66,9 @@ const SubmitRequest_InputsEntry$json = { /// Descriptor for `SubmitRequest`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List submitRequestDescriptor = $convert.base64Decode( 'Cg1TdWJtaXRSZXF1ZXN0EhsKCWZsb3dfeWFtbBgBIAEoDFIIZmxvd1lhbWwSOwoGaW5wdXRzGA' - 'IgAygLMiMuY2hhaW4udjEuU3VibWl0UmVxdWVzdC5JbnB1dHNFbnRyeVIGaW5wdXRzGkwKC0lu' - 'cHV0c0VudHJ5EhAKA2tleRgBIAEoCVIDa2V5EicKBXZhbHVlGAIgASgLMhEuY2hhaW4udjEuUG' - 'F5bG9hZFIFdmFsdWU6AjgB'); + 'IgAygLMiMuY2hhaW4udjEuU3VibWl0UmVxdWVzdC5JbnB1dHNFbnRyeVIGaW5wdXRzEhYKBmRl' + 'dGFjaBgDIAEoCFIGZGV0YWNoGkwKC0lucHV0c0VudHJ5EhAKA2tleRgBIAEoCVIDa2V5EicKBX' + 'ZhbHVlGAIgASgLMhEuY2hhaW4udjEuUGF5bG9hZFIFdmFsdWU6AjgB'); @$core.Deprecated('Use submitResponseDescriptor instead') const SubmitResponse$json = { @@ -117,6 +118,189 @@ final $typed_data.Uint8List submitResponseDescriptor = $convert.base64Decode( 'dFJlc3BvbnNlLk91dHB1dHNFbnRyeVIHb3V0cHV0cxpNCgxPdXRwdXRzRW50cnkSEAoDa2V5GA' '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') const ModuleList$json = { '1': 'ModuleList', @@ -1077,6 +1261,7 @@ const StoreEntry$json = { {'1': 'kind', '3': 19, '4': 1, '5': 9, '10': 'kind'}, {'1': 'provider', '3': 20, '4': 1, '5': 9, '10': 'provider'}, {'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' 'b3RVcmxzEhkKCGRvY3NfdXJsGBIgASgJUgdkb2NzVXJsEhIKBGtpbmQYEyABKAlSBGtpbmQSGg' 'oIcHJvdmlkZXIYFCABKAlSCHByb3ZpZGVyEh8KC3NvdXJjZV9raW5kGBUgASgJUgpzb3VyY2VL' - 'aW5k'); + 'aW5kEhYKBnNvdXJjZRgWIAEoCVIGc291cmNl'); @$core.Deprecated('Use channelStatusResponseDescriptor instead') const ChannelStatusResponse$json = { diff --git a/lib/src/hub_client.dart b/lib/src/hub_client.dart index ce02381..81aaaab 100644 --- a/lib/src/hub_client.dart +++ b/lib/src/hub_client.dart @@ -86,6 +86,11 @@ typedef StoreSearchResponse = pb.StoreSearchResponse; typedef InstallModuleResponse = pb.InstallModuleResponse; typedef Payload = pb_common.Payload; 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 F∆I Hub gRPC surface. Construct once, /// reuse for the process lifetime, call [close] on shutdown. @@ -779,8 +784,80 @@ class HubClient { Map fileInputs = const {}, Map jsonInputs = const {}, Map fileMimeTypes = const {}, + bool detach = false, }) 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 submitStreaming({ + required String flowYaml, + Map textInputs = const {}, + Map fileInputs = const {}, + Map jsonInputs = const {}, + Map 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 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 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 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 textInputs, + required Map fileInputs, + required Map jsonInputs, + required Map fileMimeTypes, + bool detach = false, + }) { + final req = pb.SubmitRequest() + ..flowYaml = utf8.encode(flowYaml) + ..detach = detach; for (final entry in textInputs.entries) { 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); } - return _hub.submit(req); + return req; } /// Closes the gRPC channel. Idempotent.