diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8235cd..ac031aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,7 +113,7 @@ jobs: run: | set -euo pipefail dex_log="$RUNNER_TEMP/dexcli.log" - PATH="$PWD/.cache/temporal-v1.8.2:$PATH" .cache/dexcli-v0.11.2 dev \ + PATH="$PWD/.cache/temporal-v1.8.2:$PATH" .cache/dexcli-v0.12.1 dev \ -open=false \ -blob-store-dir "$RUNNER_TEMP/dex-blobs" \ -sqlite-db-filename "$RUNNER_TEMP/dex.sqlite.db" \ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1378953..1c5b6d3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,7 +12,7 @@ against the installed released SDK and a version-matched runnable example or real-server compile-contract test. Snapshot, Stream, Channel size snapshot, and Attribute wait code target Dex Go -SDK `v0.11.2`. Workers negotiate the Server protocol before binding. Recheck +SDK `v0.12.1`. Workers negotiate the Server protocol before binding. Recheck the installed SDK source and the installed skill before changing resource projection or errors. Never infer an API from a design screenshot or unreleased branch. diff --git a/Makefile b/Makefile index 748a701..f057388 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ GO_BUILD_CACHE := $(CURDIR)/.cache/go-build GO_PACKAGES := ./agent/... ./cmd/... ./internal/... ./model/... ./toolcontract/... -DEXCLI_VERSION := v0.11.2 +DEXCLI_VERSION := v0.12.1 DEXCLI_BINARY := $(CURDIR)/.cache/dexcli-$(DEXCLI_VERSION) OSV_SCANNER_VERSION := v2.5.1 OSV_SCANNER_BINARY := $(CURDIR)/.cache/osv-scanner-$(OSV_SCANNER_VERSION) @@ -72,7 +72,7 @@ check-flow-definition: install-dexcli trap 'rm -r "$${flow_definition_tmp}"' EXIT; \ cd "$(CURDIR)"; \ flow_definition="$${flow_definition_tmp}/ai-agent.json"; \ - if ! GOCACHE=$(GO_BUILD_CACHE) "$(DEXCLI_BINARY)" visualize internal/agent/flow.go --language go --json \ + if ! GOCACHE=$(GO_BUILD_CACHE) GOWORK=off "$(DEXCLI_BINARY)" visualize internal/agent/flow.go --language go --json \ --out "$${flow_definition_tmp}/ai-agent"; then \ test ! -f "$${flow_definition}" || sed -n '/"diagnostics"/,$$p' "$${flow_definition}"; \ exit 1; \ diff --git a/README.md b/README.md index 3a45c39..d27223c 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ and resource model. - Go matching [`go.mod`](go.mod) - Node.js and npm compatible with [`web/package-lock.json`](web/package-lock.json) -- A Dex Server `v0.11.2` +- A Dex Server `v0.12.1` - A writable directory for disposable Dex BlobCache data ## Quick start @@ -131,7 +131,7 @@ make build-api make build-web ``` -Start a compatible Dex server. Dex Go SDK `v0.11.2` Workers require the Server +Start a compatible Dex server. Dex Go SDK `v0.12.1` Workers require the Server compatibility RPC, so upgrade the Server before the Worker. Then run the API and Worker: diff --git a/docs/flow-model.md b/docs/flow-model.md index 7b93a83..2762ffa 100644 --- a/docs/flow-model.md +++ b/docs/flow-model.md @@ -14,7 +14,7 @@ `GetArchivedMessages` - Browser synchronization Attribute: `WaitingInputRound` -The implementation requires Dex Go SDK `v0.11.2` and Server `v0.11.2`. Each +The implementation requires Dex Go SDK `v0.12.1` and Server `v0.12.1`. Each `WaitFor`, `Execute`, and RPC invocation is an independent Dex atomic commit. Provider and MCP calls are external effects and are not part of a Dex transaction. @@ -215,7 +215,7 @@ the Flow's ASYNC default. A long-running definition explicitly selects SYNC. ASYNC fallback changes where the attempt runs; it does not change that resolved durability. -Dex Server `v0.11.2` and Go SDK `v0.11.2` expose Channel size metadata in `WaitFor` and +Dex Server `v0.12.1` and Go SDK `v0.12.1` expose Channel size metadata in `WaitFor` and `Execute`. `AwaitUser.WaitFor` reads the sizes of `SteeredUserMessages`, `QueuedUserMessages`, and the current `PlanExecutions` instance without loading message payloads. It increments diff --git a/go.mod b/go.mod index 7b1d4f5..50c6db8 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/ogen-go/ogen v1.24.0 github.com/openai/openai-go/v3 v3.55.0 github.com/superdurable/dex/blob-cache-go v0.1.0 - github.com/superdurable/dex/sdk-go v0.11.2 + github.com/superdurable/dex/sdk-go v0.12.1 golang.org/x/net v0.58.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 42189d3..356c793 100644 --- a/go.sum +++ b/go.sum @@ -62,8 +62,8 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/superdurable/dex/blob-cache-go v0.1.0 h1:+c3H5YBWG3DlICOHbgT9IUM5vTlfLYGP5Vd5sWr7WTY= github.com/superdurable/dex/blob-cache-go v0.1.0/go.mod h1:Atepb7+sztvDCztVKmlvEKCSKFCkHKtDhoFYjaFmtEw= -github.com/superdurable/dex/sdk-go v0.11.2 h1:XiODrJ9JlTOKYM9jfUn5EIm8ZI7Be7i4+3tjmQ7cy3w= -github.com/superdurable/dex/sdk-go v0.11.2/go.mod h1:8Wj5wPf9dyb7hDnA40j8xISR/zjhX57NrUDVcXgf5x8= +github.com/superdurable/dex/sdk-go v0.12.1 h1:x5cBR4XRMdy/Hi16BDusMZ3MfHAt0+/LfRR7NNLFzmw= +github.com/superdurable/dex/sdk-go v0.12.1/go.mod h1:8Wj5wPf9dyb7hDnA40j8xISR/zjhX57NrUDVcXgf5x8= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.19.0 h1:xwxm7n691Uf3u5OFjzngavjGTh55KX5q/9w9xHW88JU= github.com/tidwall/gjson v1.19.0/go.mod h1:V37/opeE/JbLUOfH0QTXiNez2l0RUjYUhpT4szFQAfc= diff --git a/internal/agent/flow.go b/internal/agent/flow.go index 0d15899..73fdf1f 100644 --- a/internal/agent/flow.go +++ b/internal/agent/flow.go @@ -112,11 +112,9 @@ func NewFlow(modelClient ModelClient, tools ToolRegistry, options ...FlowOption) return flow } -const flowTypeAIAgent = "AIAgentFlow" - // GetFlowType pins the durable Flow identity. func (*Flow) GetFlowType() string { - return flowTypeAIAgent + return "AIAgentFlow" } // GetSteps registers the state-machine nodes. @@ -1911,35 +1909,11 @@ const ( continueExecuteTool continuation = "execute_tool" continueDurableWait continuation = "durable_wait" - stepTypeInit stepType = "Init" - stepTypeAwaitUser stepType = "AwaitUser" - stepTypeAnsweredInput stepType = "AnsweredInput" - stepTypeCompactContext stepType = "CompactContext" - stepTypeCallModel stepType = "CallModel" - stepTypeBeforeModelCall stepType = "BeforeModelCall" - stepTypeCallModelWithHooks stepType = "CallModelWithHooks" - stepTypeAfterModelCall stepType = "AfterModelCall" - stepTypeApplyModelResult stepType = "ApplyModelResult" - stepTypeCheckSteered stepType = "CheckSteered" - stepTypeRouteTool stepType = "RouteTool" - stepTypeAwaitApproval stepType = "AwaitToolApproval" - stepTypeExecuteTool stepType = "ExecuteTool" - stepTypeRecoverTool stepType = "RecoverToolExecution" - stepTypeExecuteParallel stepType = "ExecuteParallelTool" - stepTypeRecoverParallel stepType = "RecoverParallelToolExecution" - stepTypeAwaitParallel stepType = "AwaitParallelToolResults" - stepTypePrepareManualRecovery stepType = "PrepareManualToolRecovery" - stepTypeAwaitManualRecovery stepType = "AwaitManualToolRecovery" - stepTypeDurableWait stepType = "DurableWait" - stepTypeInactivityTimeout stepType = "InactivityTimeout" - maximumSteeringMessageCount = 2_147_483_647 maximumAutomaticPlanRecoveryCount = 1 ) type continuation string -type stepType string - type modelCallKind string const ( @@ -2149,7 +2123,7 @@ type initStep struct { var _ dex.Step[AgentConfig] = initStep{} -func (initStep) GetStepType() string { return string(stepTypeInit) } +func (initStep) GetStepType() string { return "Init" } func (initStep) GetStepOptions() *dex.StepOptions { return defaultStepOptions } @@ -2188,7 +2162,7 @@ type awaitUserStep struct { var _ dex.Step[dex.None] = awaitUserStep{} -func (awaitUserStep) GetStepType() string { return string(stepTypeAwaitUser) } +func (awaitUserStep) GetStepType() string { return "AwaitUser" } func (awaitUserStep) GetStepOptions() *dex.StepOptions { return awaitUserStepOptions } @@ -2360,7 +2334,7 @@ type answeredInputStep struct { var _ dex.Step[dex.None] = answeredInputStep{} -func (answeredInputStep) GetStepType() string { return string(stepTypeAnsweredInput) } +func (answeredInputStep) GetStepType() string { return "AnsweredInput" } func (answeredInputStep) GetStepOptions() *dex.StepOptions { return messageContextStepOptions } @@ -2391,7 +2365,7 @@ type compactContextStep struct { var _ dex.Step[Sequence] = compactContextStep{} -func (compactContextStep) GetStepType() string { return string(stepTypeCompactContext) } +func (compactContextStep) GetStepType() string { return "CompactContext" } func (compactContextStep) GetStepOptions() *dex.StepOptions { return modelStepOptions } @@ -2468,7 +2442,7 @@ type callModelStep struct { var _ dex.Step[dex.None] = callModelStep{} -func (callModelStep) GetStepType() string { return string(stepTypeCallModel) } +func (callModelStep) GetStepType() string { return "CallModel" } func (callModelStep) GetStepOptions() *dex.StepOptions { return modelStepOptions } @@ -2619,7 +2593,7 @@ type beforeModelCallStep struct { var _ dex.Step[modelCallPreparation] = beforeModelCallStep{} -func (beforeModelCallStep) GetStepType() string { return string(stepTypeBeforeModelCall) } +func (beforeModelCallStep) GetStepType() string { return "BeforeModelCall" } func (beforeModelCallStep) GetStepOptions() *dex.StepOptions { return modelStepOptions } @@ -2675,7 +2649,7 @@ type callModelWithHooksStep struct { var _ dex.Step[modelCallInput] = callModelWithHooksStep{} -func (callModelWithHooksStep) GetStepType() string { return string(stepTypeCallModelWithHooks) } +func (callModelWithHooksStep) GetStepType() string { return "CallModelWithHooks" } func (callModelWithHooksStep) GetStepOptions() *dex.StepOptions { return modelStepOptions } @@ -2706,7 +2680,7 @@ type afterModelCallStep struct { var _ dex.Step[modelCallResult] = afterModelCallStep{} -func (afterModelCallStep) GetStepType() string { return string(stepTypeAfterModelCall) } +func (afterModelCallStep) GetStepType() string { return "AfterModelCall" } func (afterModelCallStep) GetStepOptions() *dex.StepOptions { return modelStepOptions } @@ -2739,7 +2713,7 @@ type applyModelResultStep struct { var _ dex.Step[modelCallResult] = applyModelResultStep{} -func (applyModelResultStep) GetStepType() string { return string(stepTypeApplyModelResult) } +func (applyModelResultStep) GetStepType() string { return "ApplyModelResult" } func (applyModelResultStep) GetStepOptions() *dex.StepOptions { return modelStepOptions } @@ -3050,7 +3024,7 @@ type checkSteeredStep struct { var _ dex.Step[continuation] = checkSteeredStep{} -func (checkSteeredStep) GetStepType() string { return string(stepTypeCheckSteered) } +func (checkSteeredStep) GetStepType() string { return "CheckSteered" } func (checkSteeredStep) GetStepOptions() *dex.StepOptions { return messageContextStepOptions } @@ -3123,7 +3097,7 @@ type routeToolStep struct { var _ dex.Step[dex.None] = routeToolStep{} -func (routeToolStep) GetStepType() string { return string(stepTypeRouteTool) } +func (routeToolStep) GetStepType() string { return "RouteTool" } func (routeToolStep) GetStepOptions() *dex.StepOptions { return messageMutationStepOptions } @@ -3362,7 +3336,7 @@ type awaitToolApprovalStep struct { var _ dex.Step[dex.None] = awaitToolApprovalStep{} -func (awaitToolApprovalStep) GetStepType() string { return string(stepTypeAwaitApproval) } +func (awaitToolApprovalStep) GetStepType() string { return "AwaitToolApproval" } func (awaitToolApprovalStep) GetStepOptions() *dex.StepOptions { return messageMutationStepOptions } @@ -3566,7 +3540,7 @@ type executeToolStep struct { var _ dex.Step[dex.None] = executeToolStep{} -func (executeToolStep) GetStepType() string { return string(stepTypeExecuteTool) } +func (executeToolStep) GetStepType() string { return "ExecuteTool" } func (step executeToolStep) Execute(ctx dex.Context, _ dex.None) (*dex.StepDecision, error) { if err := step.flow.updateStatus(ctx, AgentStatusExecutingTool); err != nil { @@ -3639,7 +3613,7 @@ type recoverToolExecutionStep struct { var _ dex.Step[dex.None] = recoverToolExecutionStep{} -func (recoverToolExecutionStep) GetStepType() string { return string(stepTypeRecoverTool) } +func (recoverToolExecutionStep) GetStepType() string { return "RecoverToolExecution" } func (recoverToolExecutionStep) GetStepOptions() *dex.StepOptions { return messageMutationStepOptions @@ -3678,7 +3652,7 @@ type executeParallelToolStep struct { var _ dex.Step[parallelToolExecutionInput] = executeParallelToolStep{} -func (executeParallelToolStep) GetStepType() string { return string(stepTypeExecuteParallel) } +func (executeParallelToolStep) GetStepType() string { return "ExecuteParallelTool" } func (step executeParallelToolStep) Execute( ctx dex.Context, @@ -3750,7 +3724,7 @@ type recoverParallelToolExecutionStep struct { var _ dex.Step[parallelToolExecutionInput] = recoverParallelToolExecutionStep{} func (recoverParallelToolExecutionStep) GetStepType() string { - return string(stepTypeRecoverParallel) + return "RecoverParallelToolExecution" } func (recoverParallelToolExecutionStep) GetStepOptions() *dex.StepOptions { @@ -3788,7 +3762,7 @@ type awaitParallelToolResultsStep struct { var _ dex.Step[awaitParallelToolResultsInput] = awaitParallelToolResultsStep{} -func (awaitParallelToolResultsStep) GetStepType() string { return string(stepTypeAwaitParallel) } +func (awaitParallelToolResultsStep) GetStepType() string { return "AwaitParallelToolResults" } func (awaitParallelToolResultsStep) GetStepOptions() *dex.StepOptions { return messageMutationStepOptions @@ -3858,7 +3832,7 @@ type prepareManualToolRecoveryStep struct { var _ dex.Step[dex.None] = prepareManualToolRecoveryStep{} func (prepareManualToolRecoveryStep) GetStepType() string { - return string(stepTypePrepareManualRecovery) + return "PrepareManualToolRecovery" } func (prepareManualToolRecoveryStep) GetStepOptions() *dex.StepOptions { @@ -3910,7 +3884,7 @@ type awaitManualToolRecoveryStep struct { var _ dex.Step[toolBatchState] = awaitManualToolRecoveryStep{} func (awaitManualToolRecoveryStep) GetStepType() string { - return string(stepTypeAwaitManualRecovery) + return "AwaitManualToolRecovery" } func (awaitManualToolRecoveryStep) GetStepOptions() *dex.StepOptions { @@ -4177,7 +4151,7 @@ type durableWaitStep struct { var _ dex.Step[dex.None] = durableWaitStep{} -func (durableWaitStep) GetStepType() string { return string(stepTypeDurableWait) } +func (durableWaitStep) GetStepType() string { return "DurableWait" } func (durableWaitStep) GetStepOptions() *dex.StepOptions { return durableWaitStepOptions } @@ -4288,7 +4262,7 @@ type inactivityTimeoutStep struct { var _ dex.Step[time.Time] = inactivityTimeoutStep{} func (inactivityTimeoutStep) GetStepType() string { - return string(stepTypeInactivityTimeout) + return "InactivityTimeout" } func (inactivityTimeoutStep) GetStepOptions() *dex.StepOptions { diff --git a/internal/agent/flow_integration_test.go b/internal/agent/flow_integration_test.go index ee25b83..225306a 100644 --- a/internal/agent/flow_integration_test.go +++ b/internal/agent/flow_integration_test.go @@ -3531,17 +3531,17 @@ func waitForStepCompletionForTestOnly( t *testing.T, environment *agentIntegrationEnvironment, flowID FlowID, - step stepType, + stepType string, execution int32, ) { t.Helper() ctx, cancel := context.WithTimeout(t.Context(), integrationWaitTimeout) defer cancel() if err := environment.sdk.WaitForStepCompletion(ctx, string(flowID), dex.StepExecutionID{ - StepType: string(step), + StepType: stepType, ExecutionNumber: &execution, }, dex.WaitForStepCompletionOptions{}); err != nil { - t.Fatalf("wait for %s completion: %v", step, err) + t.Fatalf("wait for %s completion: %v", stepType, err) } } diff --git a/script/install-dexcli.sh b/script/install-dexcli.sh index 5abc7c4..54a5deb 100755 --- a/script/install-dexcli.sh +++ b/script/install-dexcli.sh @@ -22,10 +22,10 @@ esac archive_name="dexcli_${version}_${operating_system}_${architecture}.tar.gz" case "$archive_name" in - dexcli_v0.11.2_darwin_amd64.tar.gz) checksum=e4ed297423044e5789ad1693bb5242e776ca9dd92b858fefd77ad92b317f84bd ;; - dexcli_v0.11.2_darwin_arm64.tar.gz) checksum=6b22eae6069133b23e2ae0cd22a5d7302305ef3fbfc613c2c52953080f42e859 ;; - dexcli_v0.11.2_linux_amd64.tar.gz) checksum=b14b0717bee605599b3f216e0af5bf75af406987547b895896c36c081a4744e5 ;; - dexcli_v0.11.2_linux_arm64.tar.gz) checksum=a062c5a75a9e21b7ff33609a58d5e475199b42298e866fefee619c36f0982aef ;; + dexcli_v0.12.1_darwin_amd64.tar.gz) checksum=6c07a261cb187cd334acaf481b50845bf29635aac6fe7c396f42192c4821759d ;; + dexcli_v0.12.1_darwin_arm64.tar.gz) checksum=158d5af3b89b0b6d5cba859e63440f81b57d18ca0396dfc3f03663abef63ec4b ;; + dexcli_v0.12.1_linux_amd64.tar.gz) checksum=b0c7f93de0a8b15a0a81243de089b8a3428a8633ae98d412667423e26712df42 ;; + dexcli_v0.12.1_linux_arm64.tar.gz) checksum=63285e3f23448e46b1cc9427fa72d6f1a1b7f05abada8bd63295dd23548d754d ;; *) echo "no checksum is pinned for $archive_name" >&2; exit 1 ;; esac