content-agent 0.4.2 → 0.4.3

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.
Files changed (2) hide show
  1. package/README.md +55 -1
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -104,20 +104,74 @@ The model decides when to call your tools. `stopWhen` controls how many round-tr
104
104
 
105
105
  ## Configuration
106
106
 
107
- Pass settings to `.agent()` to configure capabilities:
107
+ Pass a `config` object to `.agent()` to control behavior:
108
108
 
109
109
  ```typescript
110
110
  const model = contentAgent.agent("my-thread", {
111
111
  application: { key: "your-application-key" },
112
112
  config: {
113
+ instruction: "You are a helpful content assistant for our marketing team.",
114
+ userMessageContext: {
115
+ "slack-channel": "#marketing",
116
+ "user-role": "editor",
117
+ },
113
118
  capabilities: {
114
119
  read: true,
115
120
  write: false,
116
121
  },
122
+ filter: {
123
+ read: '_type in ["post", "author", "category"]',
124
+ write: '_type == "post"',
125
+ },
117
126
  },
118
127
  });
119
128
  ```
120
129
 
130
+ ### Config fields
131
+
132
+ | Field | Type | Description |
133
+ | -------------------- | ------------------------ | ---------------------------------------------------------------- |
134
+ | `instruction` | `string` | Custom instruction included in the system prompt |
135
+ | `userMessageContext` | `Record<string, string>` | Key-value pairs appended to each user message as XML tags |
136
+ | `capabilities` | `object` | Controls what operations the agent can perform (`read`, `write`) |
137
+ | `filter` | `object` | GROQ boolean expressions for document access control |
138
+ | `perspectives` | `object` | Perspective locking for read and write operations |
139
+
140
+ ### User message context
141
+
142
+ Each entry in `userMessageContext` is rendered as an XML tag in the user message. This gives the model structured context it can reason about without polluting the conversation.
143
+
144
+ ```typescript
145
+ config: {
146
+ userMessageContext: {
147
+ "slack-channel": "#marketing",
148
+ "image-urls": "https://example.com/hero.png\nhttps://example.com/logo.jpg",
149
+ },
150
+ }
151
+ ```
152
+
153
+ The model sees:
154
+
155
+ ```xml
156
+ <slack-channel>#marketing</slack-channel>
157
+ <image-urls>
158
+ https://example.com/hero.png
159
+ https://example.com/logo.jpg
160
+ </image-urls>
161
+ ```
162
+
163
+ ### Capabilities
164
+
165
+ Each capability can be `true`, `false`, or a preset object:
166
+
167
+ ```typescript
168
+ // Read-only
169
+ config: { capabilities: { read: true, write: false } }
170
+
171
+ // Minimal write access
172
+ config: { capabilities: { read: true, write: { preset: "minimal" } } }
173
+ ```
174
+
121
175
  ## License
122
176
 
123
177
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "content-agent",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Vercel AI SDK provider for Sanity Content Agent API",
5
5
  "keywords": [
6
6
  "sanity",
@@ -30,7 +30,7 @@
30
30
  "@ai-sdk/provider": "^3.0.0",
31
31
  "@ai-sdk/provider-utils": "^2.2.8",
32
32
  "es-toolkit": "^1.32.0",
33
- "@sanity/agent-types": "0.0.80"
33
+ "@sanity/agent-types": "0.0.81"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@sanity/pkg-utils": "^10.4.1",