Skip to content

Feat/improve connection usage#30

Merged
v3g42 merged 27 commits intomainfrom
feat/improve-connection-usage
Mar 26, 2026
Merged

Feat/improve connection usage#30
v3g42 merged 27 commits intomainfrom
feat/improve-connection-usage

Conversation

@v3g42
Copy link
Copy Markdown
Contributor

@v3g42 v3g42 commented Mar 20, 2026

No description provided.

v3g42 and others added 27 commits March 20, 2026 18:57
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…, Blocked status

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…points

- StepRequirement: unified skill-based model with native:* namespace
  for built-in capabilities and {provider}:{service} for connections
- StepStatus::Blocked + WorkflowStatus::Blocked for unmet requirements
- StepKind::ToolCall: single tool invocation without full agent loop
- Richer Script: cwd, env, timeout_secs, output_format, shell type
- AgentRun: skills, model override, max_iterations fields
- CheckpointStrategy: Internal (Redis/TTL) and External (tool call)
- is_stuck() detection for blocked workflow state
- Executor capability registration: supports() + available_skills()
- Requirement checking in WorkflowRunner.run_next()
- 37 comprehensive unit tests (up from 10)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- WorkflowStore trait in distri-types with CRUD + discovery methods
  (list_public, star, unstar, clone) following SkillStore patterns
- WorkflowRecord with definition as serde_json::Value (avoids crate dep)
- WorkflowListItem lightweight type for list endpoints
- InMemoryWorkflowStore in distri-stores for testing/OSS
- Workflow CRUD routes in distri-server (GET/POST /workflows, etc.)
- workflow_store field added to InitializedStores

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- DistriStepExecutor: real HTTP executor using Distri client
  - ApiCall: resolves context vars, makes real HTTP requests
  - ToolCall: delegates to server via client.call_tool()
  - Checkpoint: passes through
  - Script/AgentRun/Condition: placeholder (not yet wired)
  - Context template resolution ({context.key} in URLs and bodies)
- Client API: list/get/create/update/delete/push workflow methods
- CLI: workflow run (uses real executor), push, list, status
- Fix deepagent Cargo.toml paths (../../ -> ../)
- Generic test_workflow.json sample (API test, not WritePlace-specific)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Input validation:
- with_input() validates input JSON against input_schema (JSON Schema)
- Uses jsonschema crate for validation
- Rejects missing required fields, wrong types
- No schema = accepts anything (backward compatible)
- Sets status to Running on successful initialization

Events:
- WorkflowEvent enum: WorkflowStarted, StepStarted, StepCompleted,
  StepFailed, WorkflowCompleted
- EventSink trait: receives events during execution
- TracingEventSink: logs events via tracing
- NoopEventSink: default (no events)
- WorkflowRunner::with_events(store, executor, sink) to enable events
- run_all() emits started/completed events
- run_next() emits step started/completed/failed events

44 tests + 1 doc-test, all passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
WorkflowAgent executes a workflow DAG instead of an LLM loop:
- New AgentConfig::WorkflowAgent variant with WorkflowAgentDefinition
- Implements BaseAgent trait (invoke_stream, get_dag, etc.)
- ContextEventSink bridges WorkflowEvents to agent event channel
- ContextStepExecutor handles ApiCall, ToolCall, Checkpoint steps
- Input validation via JSON Schema (input_schema field)
- Streams step progress as text messages via SSE
- DAG visualization via get_dag() returns workflow step graph
- All existing match arms updated for new variant

44 workflow tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- WorkflowSession: wraps runner + event channel, public API for apps
  - new(client, workflow) → take_events() → run() / run_with_input()
  - Events emitted via mpsc channel as WorkflowEvent (SSE-compatible JSON)
- ChannelEventSink: bridges WorkflowRunner events to tokio mpsc channel
- Same event contract as server-side WorkflowAgent
- Client apps can: spawn runner in task, forward events as SSE to their
  own clients, distrijs renders them in Chat UI

Usage:
  let mut session = WorkflowSession::new(client, workflow);
  let mut rx = session.take_events().unwrap();
  tokio::spawn(async move { session.run().await });
  while let Some(event) = rx.recv().await {
      // Forward as SSE to frontend
  }

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- test_workflow_event_serialization: verifies SSE-compatible JSON format
  with "event" tag, round-trip serialization
- test_workflow_session_events: end-to-end against live server,
  verifies WorkflowStarted/StepStarted/StepCompleted/WorkflowCompleted
- test_workflow_session_with_input: context variable resolution from input

All 3 tests pass (1 unit + 2 integration against running distri-cloud).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion

- resolve.rs: centralized namespace resolution with {input.X}, {steps.X.Y}, {env.X}
  - Full-value references preserve types (arrays, objects, numbers)
  - Backward compat: {context.X} still works
  - resolve_step_input: explicit mapping or full context pass-through
  - 14 unit tests for resolution

- types.rs:
  - Add `input` field to WorkflowStep for explicit input mapping
  - `detect_cycles()` on WorkflowDefinition (DFS cycle detection)
  - All runtime fields default (status, context, current_step, notes, timestamps)
  - StepStatus/WorkflowStatus now Default (Pending)

- store.rs: auto-store step results at steps.<step_id> in structured context

- executor.rs: resolve step input before passing to executor, cycle check in run_all()

- workflow_agent.rs:
  - Save user message to thread on invocation
  - Save summary message on completion
  - Populate env namespace from executor context
  - Use centralized resolve (removed local copies)

- client workflow_executor.rs: use centralized resolve, updated tests

68 workflow tests + 5 client tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removed from: WorkflowDefinition, WorkflowEvent, WorkflowListItem,
WorkflowRecord, NewWorkflow, WorkflowFilter, all stores, all routes,
CLI, client, tests. Tags and name are sufficient for categorization.

68 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@v3g42 v3g42 merged commit 0f1fc2e into main Mar 26, 2026
@v3g42 v3g42 deleted the feat/improve-connection-usage branch March 26, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant