Files
docs/dagpipe/mcp/modules/dagpipe.state.json
Vishesh 'ironeagle' Bangotra 9929f05334 refactor: serve MCP bundles under <name>/mcp with nginx guard; rename core->mcp_server
- collect.py: copy repo MCP bundles to ROOT/<name>/mcp (instead of ROOT/mcp/<name>); add nginx location guard to deny /<name>/mcp/
- config.py: bundle roots now point to <repo>/mcp and standards/mcp for static bundles
- Rename core.py -> mcp_server.py and update imports in main.py and registry.py
- Dockerfile: per-repo MCP COPYs under /app/<name>/mcp, drop blog copy; add ports 8008/8009 in .drone.yml
- Restore standards/mcp/libraries.json from git for registry server
2026-10-11 23:37:46 +05:30

190 lines
11 KiB
JSON

{
"module": "dagpipe.state",
"content": {
"path": "dagpipe.state",
"docstring": "# Summary\n\nDefines the core `State` object used by `dagpipe`.\n\nThe `State` represents a single point in pipeline execution. It contains\narbitrary data and metadata and is designed to be immutable. Instead of\nmodifying an existing state, nodes create new child states via `fork()`.\n\n---\n\n# Design principles\n\n- **Immutability:** States must never be modified after creation.\n All transformations must create a new state via `fork()`.\n- **Cheap cloning:** Forking must be efficient since branching may create many states.\n- **Lineage tracking:** Each state maintains a reference to its parent and\n execution metadata for debugging and observability.\n- **Domain agnostic:** State contains generic key-value data and does not\n assume any schema.\n- **Engine-friendly:** State contains execution metadata such as depth and history.",
"objects": {
"Payload": {
"name": "Payload",
"kind": "class",
"path": "dagpipe.state.Payload",
"signature": "Payload(_data: Mapping[str, Any])",
"docstring": "Immutable hierarchical container with dot-path access.\n\nAttributes:\n _data (Mapping[str, Any]):\n Immutable hierarchical data structure.\n\nNotes:\n **Responsibilities:**\n\n - Stores execution data used by `State`.\n - Supports efficient atomic updates without modifying existing instances.\n - `Payload` instances are fully thread-safe due to immutability.",
"members": {
"iter_paths": {
"name": "iter_paths",
"kind": "function",
"path": "dagpipe.state.Payload.iter_paths",
"signature": "iter_paths(data: Mapping[str, Any], prefix: str = '') -> Iterable[str]",
"docstring": "Recursively yield dot-paths for all leaf nodes.\n\nArgs:\n data (Mapping[str, Any]):\n The mapping to iterate over.\n prefix (str, optional):\n Current path prefix.\n\nYields:\n str:\n Dot-path for each leaf node."
},
"get": {
"name": "get",
"kind": "function",
"path": "dagpipe.state.Payload.get",
"signature": "get(path: str, default: Any = None) -> Any",
"docstring": "Retrieve value using dot-path.\n\nArgs:\n path (str):\n Dot-separated path to the value.\n default (Any, optional):\n Default value if path doesn't exist.\n\nReturns:\n Any:\n The retrieved value or default."
},
"has": {
"name": "has",
"kind": "function",
"path": "dagpipe.state.Payload.has",
"signature": "has(path: str) -> bool",
"docstring": "Return True if path exists.\n\nArgs:\n path (str):\n Dot-separated path to check.\n\nReturns:\n bool:\n Existence of the path."
},
"update": {
"name": "update",
"kind": "function",
"path": "dagpipe.state.Payload.update",
"signature": "update(updates: Mapping[str, Any]) -> Payload",
"docstring": "Create a new `Payload` with dot-path updates applied.\n\nArgs:\n updates (Mapping[str, Any]):\n Dot-path to value mapping.\n\nReturns:\n Payload:\n New immutable payload instance with updates.\n\nNotes:\n **Guarantees:**\n\n - Preserves existing data by copying only modified branches.\n - Returns a new immutable `Payload`."
},
"keys": {
"name": "keys",
"kind": "function",
"path": "dagpipe.state.Payload.keys",
"signature": "keys() -> Iterable[str]",
"docstring": "Return top-level keys.\n\nReturns:\n Iterable[str]:\n Iterator over top-level keys."
},
"as_dict": {
"name": "as_dict",
"kind": "function",
"path": "dagpipe.state.Payload.as_dict",
"signature": "as_dict() -> Mapping[str, Any]",
"docstring": "Return underlying mapping.\n\nReturns:\n Mapping[str, Any]:\n Read-only view of the underlying data."
}
}
},
"SchemaNode": {
"name": "SchemaNode",
"kind": "attribute",
"path": "dagpipe.state.SchemaNode",
"signature": null,
"docstring": null
},
"Schema": {
"name": "Schema",
"kind": "class",
"path": "dagpipe.state.Schema",
"signature": "Schema(tree: Mapping[str, SchemaNode])",
"docstring": "Immutable hierarchical schema defining allowed payload structure.\n\nAttributes:\n tree (Mapping[str, SchemaNode]):\n Hierarchical schema definition.\n\nNotes:\n **Responsibilities:**\n\n - Validates `State` payloads and updates.\n - Reusable across all `State` instances.\n - Fully thread-safe due to immutability.",
"members": {
"tree": {
"name": "tree",
"kind": "attribute",
"path": "dagpipe.state.Schema.tree",
"signature": null,
"docstring": null
},
"validate_payload": {
"name": "validate_payload",
"kind": "function",
"path": "dagpipe.state.Schema.validate_payload",
"signature": "validate_payload(payload: Payload) -> None",
"docstring": "Validate complete payload structure.\n\nArgs:\n payload (Payload):\n Payload to validate.\n\nRaises:\n SchemaError:\n If payload violates schema."
},
"validate_update": {
"name": "validate_update",
"kind": "function",
"path": "dagpipe.state.Schema.validate_update",
"signature": "validate_update(updates: Mapping[str, Any]) -> None",
"docstring": "Validate payload update paths.\n\nArgs:\n updates (Mapping[str, Any]):\n Dot-path updates to validate.\n\nRaises:\n SchemaError:\n If any path is invalid according to the schema."
}
}
},
"SchemaError": {
"name": "SchemaError",
"kind": "class",
"path": "dagpipe.state.SchemaError",
"signature": null,
"docstring": "Raised when payload data violates the declared schema.\n\nIndicates invalid structure, invalid path, or invalid type."
},
"State": {
"name": "State",
"kind": "class",
"path": "dagpipe.state.State",
"signature": "State(payload: Payload, confidence: float = 1.0, parent: State | None = None, depth: int = 0, history: tuple[str, ...] = tuple(), metadata: dict[str, Any] = dict())",
"docstring": "Immutable execution state propagated through dagpipe pipeline.\n\nAttributes:\n payload (Payload):\n Execution data container.\n\n schema (ClassVar[Schema]):\n Payload validation schema.\n\n confidence (float):\n Execution confidence score.\n\n parent (Optional[State]):\n Parent state reference.\n\n depth (int):\n Execution depth.\n\n history (Tuple[str, ...]):\n Ordered node execution lineage.\n\n metadata (Dict[str, Any]):\n Execution metadata.\n\nNotes:\n **Responsibilities:**\n\n - Represents a complete execution snapshot at a specific point in\n pipeline traversal.\n - Fundamental unit of execution in `dagpipe`.\n - Fully thread-safe due to immutability.",
"members": {
"payload": {
"name": "payload",
"kind": "attribute",
"path": "dagpipe.state.State.payload",
"signature": null,
"docstring": null
},
"schema": {
"name": "schema",
"kind": "attribute",
"path": "dagpipe.state.State.schema",
"signature": null,
"docstring": null
},
"confidence": {
"name": "confidence",
"kind": "attribute",
"path": "dagpipe.state.State.confidence",
"signature": null,
"docstring": null
},
"parent": {
"name": "parent",
"kind": "attribute",
"path": "dagpipe.state.State.parent",
"signature": null,
"docstring": null
},
"depth": {
"name": "depth",
"kind": "attribute",
"path": "dagpipe.state.State.depth",
"signature": null,
"docstring": null
},
"history": {
"name": "history",
"kind": "attribute",
"path": "dagpipe.state.State.history",
"signature": null,
"docstring": null
},
"metadata": {
"name": "metadata",
"kind": "attribute",
"path": "dagpipe.state.State.metadata",
"signature": null,
"docstring": null
},
"fork": {
"name": "fork",
"kind": "function",
"path": "dagpipe.state.State.fork",
"signature": "fork(*, payload_update: Mapping[str, Any] | None = None, confidence_delta: float = 0.0, node_id: str | None = None, metadata_update: Mapping[str, Any] | None = None) -> State",
"docstring": "Create a new child `State` derived from this state.\n\nArgs:\n payload_update (Mapping[str, Any] | None, optional):\n Dot-path updates applied to the payload.\n\n confidence_delta (float, optional):\n Adjustment applied to current confidence.\n\n node_id (str | None, optional):\n Identifier of the node creating this state.\n\n metadata_update (Mapping[str, Any] | None, optional):\n Updates merged into state metadata.\n\nReturns:\n State:\n A new immutable `State` instance.\n\nNotes:\n **Guarantees:**\n\n - This is the only supported mechanism for modifying execution data.\n - Validates payload updates, preserves lineage, increments depth,\n and appends to history."
},
"lineage": {
"name": "lineage",
"kind": "function",
"path": "dagpipe.state.State.lineage",
"signature": "lineage() -> tuple[State, ...]",
"docstring": "Return lineage from root to this State.\n\nReturns:\n tuple[State, ...]:\n Ordered execution lineage (root first)."
},
"get": {
"name": "get",
"kind": "function",
"path": "dagpipe.state.State.get",
"signature": "get(key: str, default: Any = None) -> Any",
"docstring": "Retrieve payload value.\n\nArgs:\n key (str):\n Dot-path key.\n default (Any, optional):\n Fallback value.\n\nReturns:\n Any:\n Stored value or default."
},
"has": {
"name": "has",
"kind": "function",
"path": "dagpipe.state.State.has",
"signature": "has(key: str) -> bool",
"docstring": "Check whether payload contains key.\n\nArgs:\n key (str):\n Dot-path key.\n\nReturns:\n bool:\n Existence of the key."
}
}
}
}
}
}