@@ -30,6 +30,17 @@ export const SystemAPISchema = z.object({
3030 getConfig : z . function ( ) . args ( z . string ( ) ) . returns ( z . promise ( z . any ( ) ) ) ,
3131} ) . describe ( 'Access to System Core' ) ;
3232
33+ export const ScopedStorageSchema = z . object ( {
34+ get : z . function ( ) . args ( z . string ( ) ) . returns ( z . promise ( z . any ( ) ) ) . describe ( 'Get value by key' ) ,
35+ set : z . function ( ) . args ( z . string ( ) , z . any ( ) ) . returns ( z . promise ( z . void ( ) ) ) . describe ( 'Set value for key' ) ,
36+ delete : z . function ( ) . args ( z . string ( ) ) . returns ( z . promise ( z . void ( ) ) ) . describe ( 'Delete key' ) ,
37+ } ) . describe ( 'Plugin Scoped Data Storage (KV)' ) ;
38+
39+ export const I18nContextSchema = z . object ( {
40+ t : z . function ( ) . args ( z . string ( ) , z . record ( z . any ( ) ) . optional ( ) ) . returns ( z . string ( ) ) . describe ( 'Translate a key' ) ,
41+ getLocale : z . function ( ) . returns ( z . string ( ) ) . describe ( 'Get current context locale' ) ,
42+ } ) . describe ( 'Internationalization Helper' ) ;
43+
3344/**
3445 * Plugin Context Schema
3546 *
@@ -76,6 +87,23 @@ export const PluginContextSchema = z.object({
7687 */
7788 logger : LoggerSchema ,
7889
90+ /**
91+ * Scoped Storage.
92+ * Key-Value store isolated for this plugin.
93+ *
94+ * @example
95+ * await context.storage.set('last_sync', Date.now());
96+ */
97+ storage : ScopedStorageSchema ,
98+
99+ /**
100+ * I18n Helper.
101+ *
102+ * @example
103+ * const msg = context.i18n.t('error.invalid_input');
104+ */
105+ i18n : I18nContextSchema ,
106+
79107 /**
80108 * Metadata registry.
81109 * Provides access to system metadata like object schemas, field definitions, etc.
0 commit comments