mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
Introduces `workspace` as the isolation boundary for config, flows,
library, and knowledge data. Removes `user` as a schema-level field
throughout the code, API specs, and tests; workspace provides the
same separation more cleanly at the trusted flow.workspace layer
rather than through client-supplied message fields.
Design
------
- IAM tech spec (docs/tech-specs/iam.md) documents current state,
proposed auth/access model, and migration direction.
- Data ownership model (docs/tech-specs/data-ownership-model.md)
captures the workspace/collection/flow hierarchy.
Schema + messaging
------------------
- Drop `user` field from AgentRequest/Step, GraphRagQuery,
DocumentRagQuery, Triples/Graph/Document/Row EmbeddingsRequest,
Sparql/Rows/Structured QueryRequest, ToolServiceRequest.
- Keep collection/workspace routing via flow.workspace at the
service layer.
- Translators updated to not serialise/deserialise user.
API specs
---------
- OpenAPI schemas and path examples cleaned of user fields.
- Websocket async-api messages updated.
- Removed the unused parameters/User.yaml.
Services + base
---------------
- Librarian, collection manager, knowledge, config: all operations
scoped by workspace. Config client API takes workspace as first
positional arg.
- `flow.workspace` set at flow start time by the infrastructure;
no longer pass-through from clients.
- Tool service drops user-personalisation passthrough.
CLI + SDK
---------
- tg-init-workspace and workspace-aware import/export.
- All tg-* commands drop user args; accept --workspace.
- Python API/SDK (flow, socket_client, async_*, explainability,
library) drop user kwargs from every method signature.
MCP server
----------
- All tool endpoints drop user parameters; socket_manager no longer
keyed per user.
Flow service
------------
- Closure-based topic cleanup on flow stop: only delete topics
whose blueprint template was parameterised AND no remaining
live flow (across all workspaces) still resolves to that topic.
Three scopes fall out naturally from template analysis:
* {id} -> per-flow, deleted on stop
* {blueprint} -> per-blueprint, kept while any flow of the
same blueprint exists
* {workspace} -> per-workspace, kept while any flow in the
workspace exists
* literal -> global, never deleted (e.g. tg.request.librarian)
Fixes a bug where stopping a flow silently destroyed the global
librarian exchange, wedging all library operations until manual
restart.
RabbitMQ backend
----------------
- heartbeat=60, blocked_connection_timeout=300. Catches silently
dead connections (broker restart, orphaned channels, network
partitions) within ~2 heartbeat windows, so the consumer
reconnects and re-binds its queue rather than sitting forever
on a zombie connection.
Tests
-----
- Full test refresh: unit, integration, contract, provenance.
- Dropped user-field assertions and constructor kwargs across
~100 test files.
- Renamed user-collection isolation tests to workspace-collection.
116 lines
3.3 KiB
YAML
116 lines
3.3 KiB
YAML
post:
|
||
tags:
|
||
- Flow Services
|
||
summary: Text Load - load text documents
|
||
description: |
|
||
Load text documents into processing pipeline for indexing and embedding.
|
||
|
||
## Text Load Overview
|
||
|
||
Fire-and-forget document loading:
|
||
- **Input**: Text content (raw UTF-8 or base64 encoded)
|
||
- **Process**: Chunk, embed, store
|
||
- **Output**: None (202 Accepted)
|
||
|
||
Asynchronous processing - document queued for background processing.
|
||
|
||
## Processing Pipeline
|
||
|
||
Text documents go through:
|
||
1. **Chunking**: Split into overlapping chunks
|
||
2. **Embedding**: Generate vectors for each chunk
|
||
3. **Storage**: Store chunks + embeddings
|
||
4. **Indexing**: Make searchable via document-embeddings query
|
||
|
||
Pipeline runs asynchronously after request returns.
|
||
|
||
## Text Format
|
||
|
||
Text may be sent as raw UTF-8 text:
|
||
```
|
||
{
|
||
"text": "Cancer survival: 2.74× higher hazard ratio"
|
||
}
|
||
```
|
||
|
||
Older clients may still send base64 encoded text:
|
||
```
|
||
text_content = "This is the document..."
|
||
encoded = base64.b64encode(text_content.encode('utf-8'))
|
||
```
|
||
|
||
Default charset is UTF-8, specify `charset` if different.
|
||
|
||
## Metadata
|
||
|
||
Optional RDF triples describing document:
|
||
- Title, author, date
|
||
- Source URL
|
||
- Custom properties
|
||
- Used for organization and retrieval
|
||
|
||
## Use Cases
|
||
|
||
- **Document ingestion**: Add documents to knowledge base
|
||
- **Bulk loading**: Process multiple documents
|
||
- **Content updates**: Replace existing documents
|
||
- **Library integration**: Load from document library
|
||
|
||
## No Response Data
|
||
|
||
Returns 202 Accepted immediately:
|
||
- Document queued for processing
|
||
- No synchronous result
|
||
- No processing status
|
||
- Check document-embeddings query later to verify indexed
|
||
|
||
operationId: textLoadService
|
||
security:
|
||
- bearerAuth: []
|
||
parameters:
|
||
- name: flow
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
description: Flow instance ID
|
||
example: my-flow
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '../../components/schemas/loading/TextLoadRequest.yaml'
|
||
examples:
|
||
simpleLoad:
|
||
summary: Load text document
|
||
value:
|
||
text: This is the document text...
|
||
id: doc-123
|
||
collection: research
|
||
withMetadata:
|
||
summary: Load with RDF metadata using base64 text
|
||
value:
|
||
text: UXVhbnR1bSBjb21wdXRpbmcgdXNlcyBxdWFudHVtIG1lY2hhbmljcyBwcmluY2lwbGVzLi4u
|
||
id: doc-456
|
||
collection: research
|
||
metadata:
|
||
- s: {v: "doc-456", e: false}
|
||
p: {v: "http://purl.org/dc/terms/title", e: true}
|
||
o: {v: "Introduction to Quantum Computing", e: false}
|
||
- s: {v: "doc-456", e: false}
|
||
p: {v: "http://purl.org/dc/terms/creator", e: true}
|
||
o: {v: "Dr. Alice Smith", e: false}
|
||
responses:
|
||
'202':
|
||
description: Document accepted for processing
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties: {}
|
||
example: {}
|
||
'401':
|
||
$ref: '../../components/responses/Unauthorized.yaml'
|
||
'500':
|
||
$ref: '../../components/responses/Error.yaml'
|