@sanity/context 0.0.2 → 0.0.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.
package/dist/studio.d.ts CHANGED
@@ -1,23 +1,4 @@
1
- import {DocumentDefinition} from 'sanity'
2
1
  import {Plugin as Plugin_2} from 'sanity'
3
- import {PreviewConfig} from 'sanity'
4
-
5
- /**
6
- * The name of the agent context schema type.
7
- * @beta
8
- */
9
- export declare const AGENT_CONTEXT_SCHEMA_TYPE_NAME = 'agentContext'
10
-
11
- /**
12
- * The schema for the agent context document.
13
- * @beta
14
- */
15
- export declare const agentContextSchema: {
16
- type: 'document'
17
- name: 'agentContext'
18
- } & Omit<DocumentDefinition, 'preview'> & {
19
- preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
20
- }
21
2
 
22
3
  /**
23
4
  * The plugin for the agent context.
package/dist/studio.js CHANGED
@@ -1,11 +1,11 @@
1
- import { DatabaseIcon, CopyIcon } from "@sanity/icons";
2
- import { defineType, defineField, useDataset, useProjectId, getValueAtPath, definePlugin } from "sanity";
3
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { defineType, defineField, useDataset, useProjectId, getValueAtPath, definePlugin } from "sanity";
4
3
  import { structureTool } from "sanity/structure";
4
+ import { DatabaseIcon, CopyIcon } from "@sanity/icons";
5
5
  import { useToast, Stack, Card, Text, Flex, Button, Box } from "@sanity/ui";
6
- const AGENT_CONTEXT_SCHEMA_TYPE_NAME = "agentContext", agentContextSchema = defineType({
6
+ const AGENT_CONTEXT_SCHEMA_TYPE_NAME = "sanity.agentContext", AGENT_CONTEXT_SCHEMA_TITLE = "Agent Context", agentContextSchema = defineType({
7
7
  name: AGENT_CONTEXT_SCHEMA_TYPE_NAME,
8
- title: "Agent context",
8
+ title: AGENT_CONTEXT_SCHEMA_TITLE,
9
9
  type: "document",
10
10
  icon: DatabaseIcon,
11
11
  fields: [
@@ -76,7 +76,18 @@ function AgentDocumentInput(props) {
76
76
  const contextPlugin = definePlugin({
77
77
  name: "sanity/context/plugin",
78
78
  schema: {
79
- types: [agentContextSchema]
79
+ types: [agentContextSchema],
80
+ // Add template configuration for the `sanity.agentContext` type
81
+ // as the sanity.* namespace is filtered by default.
82
+ templates: (prev) => [
83
+ ...prev,
84
+ {
85
+ id: AGENT_CONTEXT_SCHEMA_TYPE_NAME,
86
+ title: AGENT_CONTEXT_SCHEMA_TITLE,
87
+ schemaType: AGENT_CONTEXT_SCHEMA_TYPE_NAME,
88
+ value: {}
89
+ }
90
+ ]
80
91
  },
81
92
  form: {
82
93
  components: {
@@ -85,17 +96,19 @@ const contextPlugin = definePlugin({
85
96
  },
86
97
  plugins: [
87
98
  structureTool({
88
- title: "Agent Context",
89
- name: "agent-context",
90
- structure: (S) => S.list().title("Agent Contexts").items([
91
- S.listItem().title("Contexts").child(S.documentTypeList(AGENT_CONTEXT_SCHEMA_TYPE_NAME).title("Contexts"))
99
+ title: AGENT_CONTEXT_SCHEMA_TITLE,
100
+ name: "agent-context-structure",
101
+ structure: (S) => S.list().title("Content").items([
102
+ S.listItem().title(AGENT_CONTEXT_SCHEMA_TITLE).child(
103
+ S.documentTypeList(AGENT_CONTEXT_SCHEMA_TYPE_NAME).title(
104
+ AGENT_CONTEXT_SCHEMA_TITLE
105
+ )
106
+ )
92
107
  ])
93
108
  })
94
109
  ]
95
110
  });
96
111
  export {
97
- AGENT_CONTEXT_SCHEMA_TYPE_NAME,
98
- agentContextSchema,
99
112
  contextPlugin
100
113
  };
101
114
  //# sourceMappingURL=studio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"studio.js","sources":["../src/studio/context-plugin/agentContextSchema.ts","../src/studio/context-plugin/AgentDocumentInput.tsx","../src/studio/context-plugin/plugin.tsx"],"sourcesContent":["import {DatabaseIcon} from '@sanity/icons'\nimport {defineField, defineType} from 'sanity'\n\n/**\n * The name of the agent context schema type.\n * @beta\n */\nexport const AGENT_CONTEXT_SCHEMA_TYPE_NAME = 'agentContext'\n\n/**\n * The schema for the agent context document.\n * @beta\n */\nexport const agentContextSchema = defineType({\n name: AGENT_CONTEXT_SCHEMA_TYPE_NAME,\n title: 'Agent context',\n type: 'document',\n icon: DatabaseIcon,\n fields: [\n defineField({\n name: 'name',\n title: 'Name',\n type: 'string',\n }),\n defineField({\n name: 'slug',\n title: 'Slug',\n type: 'slug',\n options: {\n source: 'name',\n },\n }),\n defineField({\n name: 'organizationId',\n title: 'Organization ID',\n type: 'string',\n }),\n defineField({\n name: 'projectId',\n title: 'Project ID',\n type: 'string',\n }),\n defineField({\n name: 'dataset',\n title: 'Dataset',\n type: 'string',\n }),\n defineField({\n name: 'groqFilter',\n title: 'GROQ filter',\n type: 'text',\n }),\n ],\n})\n","import {CopyIcon} from '@sanity/icons'\nimport {Box, Button, Card, Flex, Stack, Text, useToast} from '@sanity/ui'\nimport {getValueAtPath, type InputProps, useDataset, useProjectId} from 'sanity'\n\nexport function AgentDocumentInput(props: InputProps) {\n const dataset = useDataset()\n const projectId = useProjectId()\n const toast = useToast()\n\n const slug = getValueAtPath(props.value, ['slug'])\n const currentSlug = slug && typeof slug === 'object' && 'current' in slug ? slug.current : ''\n const MCP_URL = `https://context-mcp.sanity.io/${projectId}/${dataset}/${currentSlug}`\n\n const handleCopy = () => {\n try {\n navigator.clipboard.writeText(MCP_URL)\n toast.push({\n title: 'Copied to clipboard',\n description: 'The MCP URL has been copied to your clipboard',\n status: 'success',\n closable: true,\n })\n } catch {\n toast.push({\n title: 'Error copying to clipboard',\n description: 'Please copy the MCP URL manually',\n status: 'error',\n closable: true,\n })\n }\n }\n\n return (\n <Stack space={4}>\n <Card shadow={1} padding={4} paddingLeft={4} radius={2} tone=\"primary\">\n <Stack space={4}>\n <Text size={1} muted weight=\"medium\">\n Context MCP URL\n </Text>\n\n {slug ? (\n <Flex align=\"center\" gap={2}>\n <Button icon={CopyIcon} mode=\"bleed\" fontSize={1} padding={2} onClick={handleCopy} />\n\n <Box flex={1}>\n <Text size={1} muted>\n {MCP_URL}\n </Text>\n </Box>\n </Flex>\n ) : (\n <Box paddingY={2}>\n <Text size={1} muted>\n No slug found. Please generate a slug to see the Context MCP URL.\n </Text>\n </Box>\n )}\n </Stack>\n </Card>\n\n {props.renderDefault(props)}\n </Stack>\n )\n}\n","import {definePlugin} from 'sanity'\nimport {type StructureBuilder, structureTool} from 'sanity/structure'\n\nimport {AGENT_CONTEXT_SCHEMA_TYPE_NAME, agentContextSchema} from './agentContextSchema'\nimport {AgentDocumentInput} from './AgentDocumentInput'\n\n/**\n * The plugin for the agent context.\n * @beta\n */\nexport const contextPlugin = definePlugin({\n name: 'sanity/context/plugin',\n\n schema: {\n types: [agentContextSchema],\n },\n\n form: {\n components: {\n input: (props) => {\n if (props.schemaType.name === AGENT_CONTEXT_SCHEMA_TYPE_NAME) {\n return <AgentDocumentInput {...props} />\n }\n\n return props.renderDefault(props)\n },\n },\n },\n\n plugins: [\n structureTool({\n title: 'Agent Context',\n name: 'agent-context',\n structure: (S: StructureBuilder) => {\n return S.list()\n .title('Agent Contexts')\n .items([\n S.listItem()\n .title('Contexts')\n .child(S.documentTypeList(AGENT_CONTEXT_SCHEMA_TYPE_NAME).title('Contexts')),\n ])\n },\n }),\n ],\n})\n"],"names":[],"mappings":";;;;;AAOO,MAAM,iCAAiC,gBAMjC,qBAAqB,WAAW;AAAA,EAC3C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,IACN,YAAY;AAAA,MACV,MAAM;AAAA,MACN,OAAO;AAAA,MACP,MAAM;AAAA,IAAA,CACP;AAAA,IACD,YAAY;AAAA,MACV,MAAM;AAAA,MACN,OAAO;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,QACP,QAAQ;AAAA,MAAA;AAAA,IACV,CACD;AAAA,IACD,YAAY;AAAA,MACV,MAAM;AAAA,MACN,OAAO;AAAA,MACP,MAAM;AAAA,IAAA,CACP;AAAA,IACD,YAAY;AAAA,MACV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F,oBAAC,KAAA,EAAI,MAAM,GACT,UAAA,oBAAC,MAAA,EAAK,MAAM,GAAG,OAAK,IACjB,UAAA,QAAA,CACH,EAAA,CACF;AAAA,MAAA,EAAA,CACF,IAEA,oBAAC,KAAA,EAAI,UAAU,GACb,UAAA,oBAAC,MAAA,EAAK,MAAM,GAAG,OAAK,IAAC,UAAA,oEAAA,CAErB,EAAA,CACF;AAAA,IAAA,EAAA,CAEJ,EAAA,CACF;AAAA,IAEC,MAAM,cAAc,KAAK;AAAA,EAAA,GAC5B;AAEJ;ACrDO,MAAM,gBAAgB,aAAa;AAAA,EACxC,MAAM;AAAA,EAEN,QAAQ;AAAA,IACN,OAAO,CAAC,kBAAkB;AAAA,EAAA;AAAA,EAG5B,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,OAAO,CAAC,UACF,MAAM,WAAW,SAAS,iCACrB,oBAAC,oBAAA,EAAoB,GAAG,MAAA,CAAO,IAGjC,MAAM,cAAc,KAAK;AAAA,IAAA;AAAA,EAEpC;AAAA,EAGF,SAAS;AAAA,IACP,cAAc;AAAA,MACZ,OAAO;AAAA,MACP,MAAM;AAAA,MACN,WAAW,CAAC,MACH,EAAE,OACN,MAAM,gBAAgB,EACtB,MAAM;AAAA,QACL,EAAE,SAAA,EACC,MAAM,UAAU,EAChB,MAAM,EAAE,iBAAiB,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAAA,MAAA,CAC9E;AAAA,IAAA,CAEN;AAAA,EAAA;AAEL,CAAC;"}
1
+ {"version":3,"file":"studio.js","sources":["../src/studio/context-plugin/agentContextSchema.ts","../src/studio/context-plugin/AgentDocumentInput.tsx","../src/studio/context-plugin/plugin.tsx"],"sourcesContent":["import {DatabaseIcon} from '@sanity/icons'\nimport {defineField, defineType} from 'sanity'\n\n/**\n * The name of the agent context schema type.\n */\nexport const AGENT_CONTEXT_SCHEMA_TYPE_NAME = 'sanity.agentContext'\n\n/**\n * The title of the agent context schema type.\n */\nexport const AGENT_CONTEXT_SCHEMA_TITLE = 'Agent Context'\n\n/**\n * The schema for the agent context document.\n * @beta\n */\nexport const agentContextSchema = defineType({\n name: AGENT_CONTEXT_SCHEMA_TYPE_NAME,\n title: AGENT_CONTEXT_SCHEMA_TITLE,\n type: 'document',\n icon: DatabaseIcon,\n fields: [\n defineField({\n name: 'name',\n title: 'Name',\n type: 'string',\n }),\n defineField({\n name: 'slug',\n title: 'Slug',\n type: 'slug',\n options: {\n source: 'name',\n },\n }),\n defineField({\n name: 'organizationId',\n title: 'Organization ID',\n type: 'string',\n }),\n defineField({\n name: 'projectId',\n title: 'Project ID',\n type: 'string',\n }),\n defineField({\n name: 'dataset',\n title: 'Dataset',\n type: 'string',\n }),\n defineField({\n name: 'groqFilter',\n title: 'GROQ filter',\n type: 'text',\n }),\n ],\n})\n","import {CopyIcon} from '@sanity/icons'\nimport {Box, Button, Card, Flex, Stack, Text, useToast} from '@sanity/ui'\nimport {getValueAtPath, type InputProps, useDataset, useProjectId} from 'sanity'\n\nexport function AgentDocumentInput(props: InputProps) {\n const dataset = useDataset()\n const projectId = useProjectId()\n const toast = useToast()\n\n const slug = getValueAtPath(props.value, ['slug'])\n const currentSlug = slug && typeof slug === 'object' && 'current' in slug ? slug.current : ''\n const MCP_URL = `https://context-mcp.sanity.io/${projectId}/${dataset}/${currentSlug}`\n\n const handleCopy = () => {\n try {\n navigator.clipboard.writeText(MCP_URL)\n toast.push({\n title: 'Copied to clipboard',\n description: 'The MCP URL has been copied to your clipboard',\n status: 'success',\n closable: true,\n })\n } catch {\n toast.push({\n title: 'Error copying to clipboard',\n description: 'Please copy the MCP URL manually',\n status: 'error',\n closable: true,\n })\n }\n }\n\n return (\n <Stack space={4}>\n <Card shadow={1} padding={4} paddingLeft={4} radius={2} tone=\"primary\">\n <Stack space={4}>\n <Text size={1} muted weight=\"medium\">\n Context MCP URL\n </Text>\n\n {slug ? (\n <Flex align=\"center\" gap={2}>\n <Button icon={CopyIcon} mode=\"bleed\" fontSize={1} padding={2} onClick={handleCopy} />\n\n <Box flex={1}>\n <Text size={1} muted>\n {MCP_URL}\n </Text>\n </Box>\n </Flex>\n ) : (\n <Box paddingY={2}>\n <Text size={1} muted>\n No slug found. Please generate a slug to see the Context MCP URL.\n </Text>\n </Box>\n )}\n </Stack>\n </Card>\n\n {props.renderDefault(props)}\n </Stack>\n )\n}\n","import {definePlugin} from 'sanity'\nimport {type StructureBuilder, structureTool} from 'sanity/structure'\n\nimport {\n AGENT_CONTEXT_SCHEMA_TITLE,\n AGENT_CONTEXT_SCHEMA_TYPE_NAME,\n agentContextSchema,\n} from './agentContextSchema'\nimport {AgentDocumentInput} from './AgentDocumentInput'\n\n/**\n * The plugin for the agent context.\n * @beta\n */\nexport const contextPlugin = definePlugin({\n name: 'sanity/context/plugin',\n\n schema: {\n types: [agentContextSchema],\n\n // Add template configuration for the `sanity.agentContext` type\n // as the sanity.* namespace is filtered by default.\n templates: (prev) => [\n ...prev,\n {\n id: AGENT_CONTEXT_SCHEMA_TYPE_NAME,\n title: AGENT_CONTEXT_SCHEMA_TITLE,\n schemaType: AGENT_CONTEXT_SCHEMA_TYPE_NAME,\n value: {},\n },\n ],\n },\n\n form: {\n components: {\n input: (props) => {\n if (props.schemaType.name === AGENT_CONTEXT_SCHEMA_TYPE_NAME) {\n return <AgentDocumentInput {...props} />\n }\n\n return props.renderDefault(props)\n },\n },\n },\n\n plugins: [\n structureTool({\n title: AGENT_CONTEXT_SCHEMA_TITLE,\n name: 'agent-context-structure',\n structure: (S: StructureBuilder) => {\n return S.list()\n .title('Content')\n .items([\n S.listItem()\n .title(AGENT_CONTEXT_SCHEMA_TITLE)\n .child(\n S.documentTypeList(AGENT_CONTEXT_SCHEMA_TYPE_NAME).title(\n AGENT_CONTEXT_SCHEMA_TITLE,\n ),\n ),\n ])\n },\n }),\n ],\n})\n"],"names":[],"mappings":";;;;;AAMO,MAAM,iCAAiC,uBAKjC,6BAA6B,iBAM7B,qBAAqB,WAAW;AAAA,EAC3C,MAAM;AAAA,EAC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AO;AAAA,MACP,MAAM;AAAA,MACN,WAAW,CAAC,MACH,EAAE,OACN,MAAM,SAAS,EACf,MAAM;AAAA,QACL,EAAE,SAAA,EACC,MAAM,0BAA0B,EAChC;AAAA,UACC,EAAE,iBAAiB,8BAA8B,EAAE;AAAA,YACjD;AAAA,UAAA;AAAA,QACF;AAAA,MACF,CACH;AAAA,IAAA,CAEN;AAAA,EAAA;AAEL,CAAC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/context",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,8 +31,14 @@
31
31
  "dist",
32
32
  "src"
33
33
  ],
34
+ "scripts": {
35
+ "build": "pkg build --strict --clean --check",
36
+ "dev": "pkg-utils watch",
37
+ "test": "echo \"No tests yet\""
38
+ },
34
39
  "browserslist": "extends @sanity/browserslist-config",
35
40
  "devDependencies": {
41
+ "@repo/eslint-config": "workspace:*",
36
42
  "@sanity/icons": "^3",
37
43
  "@sanity/pkg-utils": "^10.3.2",
38
44
  "@sanity/tsconfig": "^2.1.0",
@@ -43,8 +49,7 @@
43
49
  "react-dom": "^19",
44
50
  "sanity": "^5.3.1",
45
51
  "styled-components": "^6",
46
- "typescript": "^5.9.2",
47
- "@repo/eslint-config": "0.0.0"
52
+ "typescript": "^5.9.2"
48
53
  },
49
54
  "peerDependencies": {
50
55
  "@sanity/icons": "^3",
@@ -54,15 +59,11 @@
54
59
  "sanity": "^5",
55
60
  "styled-components": "^6"
56
61
  },
62
+ "packageManager": "pnpm@10.19.0",
57
63
  "engines": {
58
64
  "node": ">=20.19 <22 || >=22.12"
59
65
  },
60
66
  "publishConfig": {
61
67
  "access": "public"
62
- },
63
- "scripts": {
64
- "build": "pkg build --strict --clean --check",
65
- "dev": "pkg-utils watch",
66
- "test": "echo \"No tests yet\""
67
68
  }
68
- }
69
+ }
@@ -3,9 +3,13 @@ import {defineField, defineType} from 'sanity'
3
3
 
4
4
  /**
5
5
  * The name of the agent context schema type.
6
- * @beta
7
6
  */
8
- export const AGENT_CONTEXT_SCHEMA_TYPE_NAME = 'agentContext'
7
+ export const AGENT_CONTEXT_SCHEMA_TYPE_NAME = 'sanity.agentContext'
8
+
9
+ /**
10
+ * The title of the agent context schema type.
11
+ */
12
+ export const AGENT_CONTEXT_SCHEMA_TITLE = 'Agent Context'
9
13
 
10
14
  /**
11
15
  * The schema for the agent context document.
@@ -13,7 +17,7 @@ export const AGENT_CONTEXT_SCHEMA_TYPE_NAME = 'agentContext'
13
17
  */
14
18
  export const agentContextSchema = defineType({
15
19
  name: AGENT_CONTEXT_SCHEMA_TYPE_NAME,
16
- title: 'Agent context',
20
+ title: AGENT_CONTEXT_SCHEMA_TITLE,
17
21
  type: 'document',
18
22
  icon: DatabaseIcon,
19
23
  fields: [
@@ -1,7 +1,11 @@
1
1
  import {definePlugin} from 'sanity'
2
2
  import {type StructureBuilder, structureTool} from 'sanity/structure'
3
3
 
4
- import {AGENT_CONTEXT_SCHEMA_TYPE_NAME, agentContextSchema} from './agentContextSchema'
4
+ import {
5
+ AGENT_CONTEXT_SCHEMA_TITLE,
6
+ AGENT_CONTEXT_SCHEMA_TYPE_NAME,
7
+ agentContextSchema,
8
+ } from './agentContextSchema'
5
9
  import {AgentDocumentInput} from './AgentDocumentInput'
6
10
 
7
11
  /**
@@ -13,6 +17,18 @@ export const contextPlugin = definePlugin({
13
17
 
14
18
  schema: {
15
19
  types: [agentContextSchema],
20
+
21
+ // Add template configuration for the `sanity.agentContext` type
22
+ // as the sanity.* namespace is filtered by default.
23
+ templates: (prev) => [
24
+ ...prev,
25
+ {
26
+ id: AGENT_CONTEXT_SCHEMA_TYPE_NAME,
27
+ title: AGENT_CONTEXT_SCHEMA_TITLE,
28
+ schemaType: AGENT_CONTEXT_SCHEMA_TYPE_NAME,
29
+ value: {},
30
+ },
31
+ ],
16
32
  },
17
33
 
18
34
  form: {
@@ -29,15 +45,19 @@ export const contextPlugin = definePlugin({
29
45
 
30
46
  plugins: [
31
47
  structureTool({
32
- title: 'Agent Context',
33
- name: 'agent-context',
48
+ title: AGENT_CONTEXT_SCHEMA_TITLE,
49
+ name: 'agent-context-structure',
34
50
  structure: (S: StructureBuilder) => {
35
51
  return S.list()
36
- .title('Agent Contexts')
52
+ .title('Content')
37
53
  .items([
38
54
  S.listItem()
39
- .title('Contexts')
40
- .child(S.documentTypeList(AGENT_CONTEXT_SCHEMA_TYPE_NAME).title('Contexts')),
55
+ .title(AGENT_CONTEXT_SCHEMA_TITLE)
56
+ .child(
57
+ S.documentTypeList(AGENT_CONTEXT_SCHEMA_TYPE_NAME).title(
58
+ AGENT_CONTEXT_SCHEMA_TITLE,
59
+ ),
60
+ ),
41
61
  ])
42
62
  },
43
63
  }),
@@ -1 +1 @@
1
- export * from './context-plugin'
1
+ export {contextPlugin} from './context-plugin/plugin'
@@ -1,2 +0,0 @@
1
- export * from './agentContextSchema'
2
- export * from './plugin'