@aalis/plugin-session-settings 0.0.0-stage → 0.1.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doc.js","sourceRoot":"","sources":["../src/doc.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,oFAAoF;AACpF,oEAAoE;AACpE,kEAAkE;AAClE,0CAA0C;AAC1C,+DAA+D;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAczD,2EAA2E;AAC3E,MAAM,UAAU,WAAW,CAAC,IAAa;IACvC,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACpH,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAmB,EAAE,CAC1D,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEvE,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;AAQ9E,qCAAqC;AACrC,SAAS,KAAK,CAAC,KAAc,EAAE,IAAY,EAAE,GAAgB;IAC3D,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,GAAG,CAAC;IAC9B,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,WAAW,CAAC,CAAC;QAClC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAA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KAAK,IAAI;QAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;;QACnC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IAC1B,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC,EAAE;QAAE,OAAO,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrH,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;AACvC,CAAC"}
@@ -0,0 +1,13 @@
1
+ declare const _default: import("@aalis/core").PluginDefinition<{
2
+ sessionManager: import("@aalis/core").ServiceDescriptor<import("@aalis/api-session-manager").SessionManagerService, import("@aalis/api-session-manager").SessionManagerService>;
3
+ events: import("@aalis/core").ServiceDescriptor<(identity: symbol) => import("@aalis/core").Events, import("@aalis/core").Events>;
4
+ logger: import("@aalis/core").ServiceDescriptor<(identity: symbol) => import("@aalis/core").Logger, import("@aalis/core").Logger>;
5
+ provide: import("@aalis/core").ServiceDescriptor<(identity: symbol) => import("@aalis/core").Provide, import("@aalis/core").Provide>;
6
+ services: import("@aalis/core").ServiceDescriptor<(identity: symbol) => import("@aalis/core").Services, import("@aalis/core").Services>;
7
+ hostConfig: import("@aalis/core").OptionalUse<import("@aalis/api-host-config").HostConfig, import("@aalis/api-host-config").HostConfig>;
8
+ platform: import("@aalis/core").OptionalUse<import("@aalis/api-platform").PlatformAdapter, import("@aalis/api-platform").PlatformAdapter>;
9
+ authority: import("@aalis/core").OptionalUse<import("@aalis/api-authority").AuthorityService, import("@aalis/api-authority").AuthorityService>;
10
+ commands: import("@aalis/core").OptionalUse<import("@aalis/api-commands").CommandService, import("@aalis/api-commands").BoundCommands>;
11
+ }>;
12
+ export default _default;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAUA,wBAaG"}
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ import { sessionSettings } from '@aalis/api-session-settings';
2
+ import { definePlugin } from '@aalis/core';
3
+ import { uses } from './caps.js';
4
+ import { registerCommands } from './commands.js';
5
+ import { SessionSettingsProvider } from './provider.js';
6
+ import { t } from './texts.js';
7
+ // 会话设置:插件配置字段(configSchema 顶层写了 session 的)按平台档、平台类型档、场所与本会话覆盖。读取器在各插件
8
+ // 进程内解析(@aalis/api-session-settings),本插件交出各层的原样值、管写入与校验、建子会话时写下的那一层,并登记 /session 系列。
9
+ // 会话、场所的增删与字段登记的增减都发 session-settings:changed;宿主文档的变化由宿主发 host-config:changed,这里不转发。
10
+ export default definePlugin({
11
+ name: '@aalis/plugin-session-settings',
12
+ displayName: t('displayName'),
13
+ subsystem: 'session',
14
+ provides: [sessionSettings],
15
+ uses,
16
+ apply(caps) {
17
+ const provider = new SessionSettingsProvider(caps);
18
+ caps.provide.use(sessionSettings, provider, { label: t('displayName') });
19
+ caps.events.use.on('session:created', () => provider.changed());
20
+ caps.events.use.on('session:deleted', () => provider.changed());
21
+ registerCommands(caps, provider.editor);
22
+ },
23
+ });
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAa,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,CAAC,EAAE,MAAM,YAAY,CAAC;AAE/B,sEAAsE;AACtE,qFAAqF;AACrF,qFAAqF;AACrF,eAAe,YAAY,CAAC;IAC1B,IAAI,EAAE,gCAAgC;IACtC,WAAW,EAAE,CAAC,CAAC,aAAa,CAAC;IAC7B,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE,CAAC,eAAe,CAAC;IAC3B,IAAI;IACJ,KAAK,CAAC,IAAU;QACd,MAAM,QAAQ,GAAG,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QAChE,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,66 @@
1
+ declare const _default: {
2
+ readonly displayName: "Session settings";
3
+ readonly notRegistered: "No such setting: {item} (the plugin that provides it is not installed or enabled)";
4
+ readonly notSessionField: "{item} cannot be set per session";
5
+ readonly invalidValue: "Invalid value for {item}: {reason}";
6
+ readonly noSession: "Session not found: {id}";
7
+ readonly noPlace: "Place not found: {key}";
8
+ readonly placeOnly: "{item} can be set down to a place, not on a single session";
9
+ readonly notApplicable: "{item} does not apply to {kind, select, owner {owner sessions} room {rooms} task {child sessions} other {this kind of session}}";
10
+ readonly notForRooms: "{item} does not apply to rooms, so platform-type profiles do not take it";
11
+ readonly itemNamed: "{label} ({item})";
12
+ readonly badLayerName: "Invalid layer name: {name} (must be non-empty, without : and not *)";
13
+ readonly unknownLayer: "Unknown layer: {layer}";
14
+ readonly noHostConfig: "The host provides no config document, so the global layer and the platform and platform-type profiles cannot be saved";
15
+ readonly notObject: "{path} in the config file is not an object; fix it before writing this layer";
16
+ readonly unknownProvider: "{contextId}, set for {item}, is not a provider of {service}";
17
+ readonly workspacePlace: "Workspace “{name}”";
18
+ readonly windowPlace: "{type} “{name}”";
19
+ readonly notBoolean: "Write on, off, true, false, 1 or 0";
20
+ readonly notNumber: "Write a number";
21
+ readonly notChoice: "Write one of the allowed values";
22
+ readonly mapUnsupported: "This setting cannot be changed in chat; change it on the settings page";
23
+ readonly noTextForm: "This setting has no text form; change it on the settings page";
24
+ readonly unreadable: "Cannot read this value";
25
+ readonly on: "on";
26
+ readonly off: "off";
27
+ readonly listValue: "{items, list}";
28
+ readonly empty: "None";
29
+ readonly sessionDescription: "List the settings you can change here. Each line shows where the value comes from";
30
+ readonly setDescription: "Change a setting for this conversation. It takes effect from the next turn. --at writes to a higher layer such as the place, a platform-type or platform profile, or global; write a name shared by several plugins as <instance id>/<key>; -n renames the session";
31
+ readonly resetDescription: "Reset a setting to inherit. It takes effect from the next turn. Without a setting, clears everything you can change on this session or place layer";
32
+ readonly atDescription: "Which layer to write: session (this session, default), place, platformType, platform, global";
33
+ readonly nameDescription: "Session display name";
34
+ readonly itemArgument: "Setting: the field name, written as <instance id>/<key> when several plugins share it";
35
+ readonly valueArgument: "Value: the rest of the command, split by the command rules: quote it if it has spaces, line breaks or quotes; write every backslash twice; put -- before a value that starts with -. Write [] for an empty list or map and \"\" for empty text";
36
+ readonly authorityAbsent: "Changing settings in chat needs the authority plugin";
37
+ readonly notFiled: "This session has not been recorded yet, so it has no place layer";
38
+ readonly noPlatformType: "This session has no chat window, so it belongs to no platform-type profile";
39
+ readonly placeLayer: "{layer} “{name}”";
40
+ readonly namedLayer: "{layer} “{name}”";
41
+ readonly platformTypeLayer: "{layer} “{platform} · {type}”";
42
+ readonly noSuchItem: "No such setting: {item}";
43
+ readonly ambiguous: "Several plugins have {item}; write it as <instance id>/<key>: {items, list}";
44
+ readonly editable: "{layer}: you can change {items, list}";
45
+ readonly noneEditable: "{layer}: there is nothing you can change";
46
+ readonly layerOwnerOnly: "{layer}: only the owner can change it";
47
+ readonly layerLevel: "{layer}: changing it needs level {level}";
48
+ readonly needItem: "Say which setting to change";
49
+ readonly needValue: "Write a value for {item}";
50
+ readonly choices: "Allowed: {choices, list}";
51
+ readonly setDone: "{layer}: changed {item} to {value}, taking effect from the next turn";
52
+ readonly renamed: "Session renamed: {name}";
53
+ readonly resetDone: "{layer}: cleared {items, list} ({global, select, yes {back to the default} other {inherited again}}), taking effect from the next turn";
54
+ readonly resetNeedsItem: "{layer}: say which setting to clear";
55
+ readonly setHere: "Set on this layer: {items, list}";
56
+ readonly nothingToReset: "{layer}: there is nothing you can clear";
57
+ readonly sessionHeader: "Settings of {session}:";
58
+ readonly row: "{label} ({item}): {value} — from {source}";
59
+ readonly rowUnset: "{label} ({item}): {value}";
60
+ readonly unsetNow: "{unset} (now: {now})";
61
+ readonly unsetValue: "not set";
62
+ readonly sourceDefault: "default";
63
+ readonly onlyYours: "Only the settings you can change are listed";
64
+ };
65
+ export default _default;
66
+ //# sourceMappingURL=en.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/locales/en.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAqEG"}
@@ -0,0 +1,66 @@
1
+ import { defineLocale } from '@aalis/schema-i18n';
2
+ export default defineLocale()({
3
+ displayName: 'Session settings',
4
+ notRegistered: 'No such setting: {item} (the plugin that provides it is not installed or enabled)',
5
+ notSessionField: '{item} cannot be set per session',
6
+ invalidValue: 'Invalid value for {item}: {reason}',
7
+ noSession: 'Session not found: {id}',
8
+ noPlace: 'Place not found: {key}',
9
+ placeOnly: '{item} can be set down to a place, not on a single session',
10
+ notApplicable: '{item} does not apply to {kind, select, owner {owner sessions} room {rooms} task {child sessions} other {this kind of session}}',
11
+ notForRooms: '{item} does not apply to rooms, so platform-type profiles do not take it',
12
+ itemNamed: '{label} ({item})',
13
+ badLayerName: 'Invalid layer name: {name} (must be non-empty, without : and not *)',
14
+ unknownLayer: 'Unknown layer: {layer}',
15
+ noHostConfig: 'The host provides no config document, so the global layer and the platform and platform-type profiles cannot be saved',
16
+ notObject: '{path} in the config file is not an object; fix it before writing this layer',
17
+ unknownProvider: '{contextId}, set for {item}, is not a provider of {service}',
18
+ workspacePlace: 'Workspace “{name}”',
19
+ windowPlace: '{type} “{name}”',
20
+ notBoolean: 'Write on, off, true, false, 1 or 0',
21
+ notNumber: 'Write a number',
22
+ notChoice: 'Write one of the allowed values',
23
+ mapUnsupported: 'This setting cannot be changed in chat; change it on the settings page',
24
+ noTextForm: 'This setting has no text form; change it on the settings page',
25
+ unreadable: 'Cannot read this value',
26
+ on: 'on',
27
+ off: 'off',
28
+ listValue: '{items, list}',
29
+ empty: 'None',
30
+ sessionDescription: 'List the settings you can change here. Each line shows where the value comes from',
31
+ setDescription: 'Change a setting for this conversation. It takes effect from the next turn. --at writes to a higher layer such as the place, a platform-type or platform profile, or global; write a name shared by several plugins as <instance id>/<key>; -n renames the session',
32
+ resetDescription: 'Reset a setting to inherit. It takes effect from the next turn. Without a setting, clears everything you can change on this session or place layer',
33
+ atDescription: 'Which layer to write: session (this session, default), place, platformType, platform, global',
34
+ nameDescription: 'Session display name',
35
+ itemArgument: 'Setting: the field name, written as <instance id>/<key> when several plugins share it',
36
+ valueArgument: 'Value: the rest of the command, split by the command rules: quote it if it has spaces, line breaks or quotes; write every backslash twice; put -- before a value that starts with -. Write [] for an empty list or map and "" for empty text',
37
+ authorityAbsent: 'Changing settings in chat needs the authority plugin',
38
+ notFiled: 'This session has not been recorded yet, so it has no place layer',
39
+ noPlatformType: 'This session has no chat window, so it belongs to no platform-type profile',
40
+ placeLayer: '{layer} “{name}”',
41
+ namedLayer: '{layer} “{name}”',
42
+ platformTypeLayer: '{layer} “{platform} · {type}”',
43
+ noSuchItem: 'No such setting: {item}',
44
+ ambiguous: 'Several plugins have {item}; write it as <instance id>/<key>: {items, list}',
45
+ editable: '{layer}: you can change {items, list}',
46
+ noneEditable: '{layer}: there is nothing you can change',
47
+ layerOwnerOnly: '{layer}: only the owner can change it',
48
+ layerLevel: '{layer}: changing it needs level {level}',
49
+ needItem: 'Say which setting to change',
50
+ needValue: 'Write a value for {item}',
51
+ choices: 'Allowed: {choices, list}',
52
+ setDone: '{layer}: changed {item} to {value}, taking effect from the next turn',
53
+ renamed: 'Session renamed: {name}',
54
+ resetDone: '{layer}: cleared {items, list} ({global, select, yes {back to the default} other {inherited again}}), taking effect from the next turn',
55
+ resetNeedsItem: '{layer}: say which setting to clear',
56
+ setHere: 'Set on this layer: {items, list}',
57
+ nothingToReset: '{layer}: there is nothing you can clear',
58
+ sessionHeader: 'Settings of {session}:',
59
+ row: '{label} ({item}): {value} — from {source}',
60
+ rowUnset: '{label} ({item}): {value}',
61
+ unsetNow: '{unset} (now: {now})',
62
+ unsetValue: 'not set',
63
+ sourceDefault: 'default',
64
+ onlyYours: 'Only the settings you can change are listed',
65
+ });
66
+ //# sourceMappingURL=en.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/locales/en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,eAAe,YAAY,EAAU,CAAC;IACpC,WAAW,EAAE,kBAAkB;IAC/B,aAAa,EAAE,mFAAmF;IAClG,eAAe,EAAE,kCAAkC;IACnD,YAAY,EAAE,oCAAoC;IAClD,SAAS,EAAE,yBAAyB;IACpC,OAAO,EAAE,wBAAwB;IACjC,SAAS,EAAE,4DAA4D;IACvE,aAAa,EACX,iIAAiI;IACnI,WAAW,EAAE,0EAA0E;IACvF,SAAS,EA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AAE,wBAAwB;IACvC,GAAG,EAAE,2CAA2C;IAChD,QAAQ,EAAE,2BAA2B;IACrC,QAAQ,EAAE,sBAAsB;IAChC,UAAU,EAAE,SAAS;IACrB,aAAa,EAAE,SAAS;IACxB,SAAS,EAAE,6CAA6C;CACzD,CAAC,CAAC"}
@@ -0,0 +1,120 @@
1
+ import { type SessionInfo, type SessionKind, type SessionPlace } from '@aalis/api-session-manager';
2
+ import { type ActualValue, type SessionAt, type SessionChain, type SessionFieldEntry, type SessionFieldRow, type SessionLayerName, type SessionPlacement, type SessionSettingsLayer, type SessionSettingsLayerInfo, type SessionSettingsService } from '@aalis/api-session-settings';
3
+ import { type ConfigSchema, type SchemaField, type SessionFieldSpec } from '@aalis/schema-config';
4
+ import type { Caps } from './caps.js';
5
+ import { SettingsEditor } from './commands.js';
6
+ import { type Values } from './doc.js';
7
+ /** 带标记的字段 */
8
+ export type Field = SchemaField & {
9
+ session: SessionFieldSpec;
10
+ };
11
+ /** 一个已登记的项 */
12
+ export interface Item {
13
+ plugin: string;
14
+ key: string;
15
+ field: Field;
16
+ }
17
+ /**
18
+ * 一处取全局之外的哪几层:有平台的取平台档,平台与类型都有的取平台类型档,有场所的取场所,有会话记录的取本会话层。会话见
19
+ * contextOf;一层见 contextAt
20
+ */
21
+ export interface SessionContext {
22
+ session?: SessionInfo;
23
+ kind?: SessionKind;
24
+ platform?: string;
25
+ type?: string;
26
+ place?: SessionPlace;
27
+ }
28
+ export declare class SessionSettingsProvider implements SessionSettingsService {
29
+ private readonly caps;
30
+ /** 实例 id → 登记,按登记先后 */
31
+ private readonly entries;
32
+ private readonly warned;
33
+ /** 在聊天里看与改设置:指令与 setAs 共用 */
34
+ readonly editor: SettingsEditor;
35
+ constructor(caps: Caps);
36
+ private get sm();
37
+ private warnOnce;
38
+ /** 调声明字段的插件给的 actual 或 fromText:抛错时只这一项当没给出值,同一个错告警一次 */
39
+ private guarded;
40
+ /** 宿主文档以外的设置变了 */
41
+ changed(): void;
42
+ register(plugin: string, schema: ConfigSchema, readGlobal: () => Values, actual: Readonly<Record<string, ActualValue>>): () => void;
43
+ getAll(): SessionFieldEntry[];
44
+ /** 已登记的各项:按登记先后与 schema 键序 */
45
+ items(): Item[];
46
+ /**
47
+ * 一处收哪些项(一组行与指令认项共用):本会话收适用于会话种类(不在表里或空记录的没有种类,不筛)、不是只能设到场所的项;
48
+ * 场所按场所种类收;平台类型档只收房间与子会话会取的;平台档与全局全收
49
+ */
50
+ acceptsAt(name: SessionLayerName, { kind, place }: Pick<SessionContext, 'kind' | 'place'>): (field: Field) => boolean;
51
+ /**
52
+ * 一个会话取哪几层:子会话一律按根会话取平台、聊天窗口的类型与场所。不在表里的会话、根会话是空记录(或父会话链断了)的没有
53
+ * 种类、类型与场所,平台取入口平台;有记录的另带本会话层
54
+ */
55
+ contextOf(sessionId: string, at?: SessionAt): SessionContext;
56
+ /**
57
+ * 一层取哪几层:平台档只取平台档;平台类型档取平台档与平台类型档;窗口场所取平台档、平台类型档与场所,工作区场所只取场所;
58
+ * 全局什么都不取。场所不存在、层不认识时抛错
59
+ */
60
+ private contextAt;
61
+ /** 一处在全局之上的各层原样值(复制品),按层表先后 */
62
+ private chainOf;
63
+ chain(plugin: string, sessionId: string, at?: SessionAt): SessionChain;
64
+ /** 宿主文档里的两层:没有文档时为空 */
65
+ private readDoc;
66
+ /** 记录里的值:values 不是数组、条目缺 plugin、key 或 value(value 为 null 也算缺)的按缺失处理,每条记录告警一次 */
67
+ private recordValues;
68
+ private recordEntries;
69
+ private sessionValues;
70
+ private placeValues;
71
+ /** 全局层的原样值:插件配置里的,写了 preference 的项取声明它的插件的本插件偏好 */
72
+ private globalOf;
73
+ placements(plugin: string): SessionPlacement[];
74
+ layers(): SessionSettingsLayerInfo[];
75
+ /**
76
+ * 一组行:会话的(只列适用于它的种类、不是只能设到场所的项)或一层的(只列在这一层可写的项),各带这一处自己的原样值与
77
+ * 解析到这一处为止的生效值。窗口场所在全局、平台档、平台类型档之上,工作区场所只在全局之上,平台类型档在全局、平台档之上,
78
+ * 平台档只在全局之上
79
+ */
80
+ rows(target: {
81
+ sessionId: string;
82
+ at?: SessionAt;
83
+ } | {
84
+ layer: SessionSettingsLayer;
85
+ }): SessionFieldRow[];
86
+ update(target: {
87
+ sessionId: string;
88
+ } | {
89
+ layer: SessionSettingsLayer;
90
+ }, item: {
91
+ plugin: string;
92
+ key: string;
93
+ value: unknown;
94
+ }): Promise<{
95
+ saveError?: unknown;
96
+ }>;
97
+ private writeSession;
98
+ private writeLayer;
99
+ /** 记录里的值换掉这一项(stored 为 null 即删掉),不写 undefined;形状不对的条目不再写回 */
100
+ private written;
101
+ private host;
102
+ /** 落盘:失败不撤回(内存里的文档已生效),把原因交回 */
103
+ private save;
104
+ /** 改文档里的一处的一项:在现读的原样文档上只改这一项,读不懂的部分原样留着;路径上的值不是对象时拒收 */
105
+ private writeDoc;
106
+ /**
107
+ * 全局层:普通字段在最新文档上只改这一个键(null 时有 default 写 default,没有就删掉),不经 applyPluginConfig、插件不重载;
108
+ * 写了 preference 的字段改声明它的插件的本插件偏好(运行态与文档),contextId 要有提供者,null 即取消
109
+ */
110
+ private writeGlobal;
111
+ setAs(identity: {
112
+ platform: string;
113
+ userId: string;
114
+ }, sessionId: string, item: string, text: string): Promise<{
115
+ ok: boolean;
116
+ text: import("@aalis/schema-i18n").TextRef;
117
+ }>;
118
+ childMetadata(parentId: string, at?: SessionAt): Record<string, unknown>;
119
+ }
120
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAWA,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,WAAW,EAIhB,KAAK,SAAS,EACd,KAAK,YAAY,EAEjB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,gBAAgB,E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