graphjin 3.18.41 → 3.18.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ Works with PostgreSQL, MySQL, MongoDB, SQLite, Oracle, MSSQL, Snowflake, Redshif
|
|
|
19
19
|
- **Smart discovery before action** - Agents start with `query_catalog(search: "<user instruction>")`, `graphql_help`, relationship evidence, examples, config recipes, and safety notes before writing or running queries.
|
|
20
20
|
- **Guarded action, not raw access** - Source-mode access, query allow-lists, read-only boundaries, policy-aware MCP tools, local encrypted secrets, and `gj_config` preview/apply keep changes auditable.
|
|
21
21
|
- **Operational awareness** - `gj_security`, `gj_runtime`, and the built-in console expose policy and bounded runtime status so agents can check what is safe before they act.
|
|
22
|
+
- **Durable memory and standing questions** - Saved queries, fragments, and workflows live in the owner-scoped `gj_artifacts` store; cursor-backed watches (`gj_watch`) run standing questions under the owner's permissions, resume from persisted subscription cursors, and deliver fired events to a durable inbox (`gj_watch_event`), webhooks, or workflows. Normal watches are durable by default; explicit ephemeral watches use TTL leases.
|
|
22
23
|
|
|
23
24
|
## Installation
|
|
24
25
|
|
|
@@ -72,6 +73,12 @@ executable workflows:
|
|
|
72
73
|
graphjin serve --demo --path examples/coffee-roastery
|
|
73
74
|
```
|
|
74
75
|
|
|
76
|
+
More demo verticals — a MySQL corrugated-box plant with JWT roles, a PCB fab
|
|
77
|
+
spanning Postgres + Snowflake-emu + MongoDB + a file source + an OpenAPI
|
|
78
|
+
supplier API, and a zero-Docker SQLite clinic scheduler — live in
|
|
79
|
+
[examples/](examples/README.md), each with an end-to-end smoke suite
|
|
80
|
+
(`make smoke-all` runs them all).
|
|
81
|
+
|
|
75
82
|
You'll see output like this:
|
|
76
83
|
```
|
|
77
84
|
GraphJin started
|
|
@@ -517,6 +524,7 @@ federation:
|
|
|
517
524
|
| `/api/v1/openapi.json` | `GET` | OpenAPI 3 spec generated from your saved REST queries. |
|
|
518
525
|
| `/api/v1/mcp` | `POST` | MCP (Model Context Protocol) HTTP transport — Streamable HTTP, stateless. |
|
|
519
526
|
| `/api/v1/mcp/message` | `POST` | Legacy MCP message route for older local proxy/client integrations. New clients should use `/api/v1/mcp`. |
|
|
527
|
+
| `/api/v1/agent` | `POST` | Server-side agent: send one instruction, get a typed evidence-backed answer (only when `agent.enabled`). See [Server-Side Agent](#server-side-agent). |
|
|
520
528
|
| `/.well-known/oauth-protected-resource[/api/v1/mcp]` | `GET` | MCP OAuth protected-resource metadata (only when `mcp.oauth.enabled`). |
|
|
521
529
|
| `/.well-known/oauth-authorization-server` | `GET` | Built-in MCP OAuth authorization-server metadata (only when `mcp.oauth.enabled`). |
|
|
522
530
|
| `/api/v1/oauth/register` | `POST` | Built-in MCP OAuth dynamic client registration (only in builtin mode). |
|
|
@@ -547,6 +555,8 @@ GraphJin exposes a catalog-first MCP surface that guides AI models to discover b
|
|
|
547
555
|
- Act through governed GraphQL roots such as `gj_workflow_execution(insert)`, `gj_workflow(insert/update/delete)`, and `gj_config(id: "current", update: ...)` only when policy exposes them.
|
|
548
556
|
- In source mode, `gj_config` writes must run `mode: "preview"` with `expected_catalog_revision`, then resend the exact same payload with `mode: "apply"` and `preview_id`.
|
|
549
557
|
- Source access and GraphJin root changes should use `source_patches` by exact source name instead of rewriting the full `sources` array.
|
|
558
|
+
- Watches are managed through `gj_watch` / `gj_watch_event` and REST wrappers (`/api/v1/watches`, `/api/v1/watch-events/unseen`). MCP clients can subscribe to `graphjin://watch-events/unseen` for caller-scoped unseen-event notifications; unsubscribing does not pause or delete durable watches.
|
|
559
|
+
- Use `/api/v1/watches/cleanup-preview` before `/api/v1/watches/cleanup-apply`. Expired ephemeral watches can be expired automatically, but durable watch deletion is always explicit.
|
|
550
560
|
- Legacy discovery tools are migration shims and are disabled unless `mcp.legacy_discovery: true`.
|
|
551
561
|
|
|
552
562
|
Schema reloads, schema changes, where-clause validation, and query repair remain MCP action tools.
|
|
@@ -566,6 +576,19 @@ For JS orchestration, use:
|
|
|
566
576
|
|
|
567
577
|
Legacy prompts such as `write_query` and `fix_query_error` are available only when the caller's MCP surface lists them; in source mode their guidance lives in `graphql_help`, `query_catalog`, and GraphJin repair hints.
|
|
568
578
|
|
|
579
|
+
## Server-Side Agent
|
|
580
|
+
|
|
581
|
+
Optional: instead of your client chaining `query_catalog` → `validate_where_clause` → `execute_saved_query`, let GraphJin run the catalog-first discovery loop for you. When enabled, GraphJin exposes one MCP tool `ask_graphjin_agent` and one REST endpoint `POST /api/v1/agent` that take a single instruction and return a typed, evidence-backed answer (`status`, `answer`, `data`, `evidence`, `actions`, `next`).
|
|
582
|
+
|
|
583
|
+
- **Enable** by loading `agentic.yml` (`GO_ENV=agentic`) with `agent.enabled: true` plus a provider, model, and `api_key_env`.
|
|
584
|
+
- **Modes:** `safe` (discovery + approved saved queries/mutations), `discovery_only` (read-only), `raw_allowed` (adds raw GraphQL when `agent.allow_raw_graphql` and `mcp.allow_raw_queries` are set).
|
|
585
|
+
- **Caller-scoped:** the agent runs as the caller, so core roles + row-level security enforce access. The caller's role only changes which *guidance* the agent follows, never what it can read or write.
|
|
586
|
+
- **Grounded:** Go protocol guards keep every answer backed by real catalog/validation/execution evidence and downgrade to `blocked` (with evidence) when a step is skipped.
|
|
587
|
+
- **Machine-actionable refusals:** blocked responses carry a structured `refusal` (code, reasons, unblock steps, `policy_final`/`retryable`) so a calling agent can course-correct in one step instead of guessing.
|
|
588
|
+
- **Model sampling:** with `agent.sampling: auto` (or `require`), the agent borrows the calling MCP client's model via MCP sampling — no server-side model key needed; caller identity and permissions are unchanged.
|
|
589
|
+
|
|
590
|
+
It is an RLM loop — the model writes JavaScript that calls the discovery tools, and the typed result is parsed from `key: value` output. So it needs a model that is good at **code generation**, not provider tool-calling or structured-output modes; any OpenAI-compatible endpoint works via `agent.base_url`. See [AGENTIC.md](AGENTIC.md#server-side-agent) and [CONFIG.md](CONFIG.md#agent-configuration).
|
|
591
|
+
|
|
569
592
|
## JS Workflows (GraphQL + REST)
|
|
570
593
|
|
|
571
594
|
Workflows let an LLM run multi-step logic in JavaScript while still using GraphJin MCP tools for DB-aware operations.
|