@joplo-app/core 0.2.9 → 0.2.12

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,88 @@
1
+ /** Node 端本地评审文件:每个会话独占文件,不同进程不能覆盖彼此的会话。 */
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import crypto from 'node:crypto';
5
+ import { LOCAL_REVIEW_MAX_FILE_BYTES, LocalReviewId, LocalReviewSession } from "./local-review.js";
6
+ import { JoploError } from "./result.js";
7
+ export const localReviewDir = (dir) => path.join(dir, '.joplo', 'reviews');
8
+ export function localReviewFile(dir, sessionId) {
9
+ if (!LocalReviewId.safeParse(sessionId).success)
10
+ throw new JoploError('USAGE', 'Invalid local review session id');
11
+ return path.join(localReviewDir(dir), `${sessionId}.json`);
12
+ }
13
+ /** 先完整写入并 fsync,再 rename;读者只会看到完整的新快照。 */
14
+ export function writeLocalReview(file, value) {
15
+ fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
16
+ const tmp = `${file}.${crypto.randomUUID()}.tmp`;
17
+ let fd;
18
+ try {
19
+ fd = fs.openSync(tmp, 'wx', 0o600);
20
+ fs.writeFileSync(fd, JSON.stringify(value) + '\n');
21
+ fs.fsyncSync(fd);
22
+ fs.closeSync(fd);
23
+ fd = undefined;
24
+ fs.renameSync(tmp, file);
25
+ }
26
+ finally {
27
+ if (fd !== undefined)
28
+ fs.closeSync(fd);
29
+ fs.rmSync(tmp, { force: true });
30
+ }
31
+ }
32
+ export function readLocalReview(dir, sessionId) {
33
+ const file = localReviewFile(dir, sessionId);
34
+ if (fs.statSync(file).size > LOCAL_REVIEW_MAX_FILE_BYTES)
35
+ throw new JoploError('INVALID_SCHEMA', 'Local review file exceeds 16 MiB');
36
+ const result = LocalReviewSession.safeParse(JSON.parse(fs.readFileSync(file, 'utf8')));
37
+ if (!result.success || result.data.id !== sessionId || result.data.projectDir !== fs.realpathSync(dir))
38
+ throw new JoploError('INVALID_SCHEMA', `Invalid local review file: ${file}`);
39
+ return result.data;
40
+ }
41
+ export function listLocalReviews(dir) {
42
+ let files;
43
+ try {
44
+ files = fs.readdirSync(localReviewDir(dir));
45
+ }
46
+ catch (e) {
47
+ if (e.code === 'ENOENT')
48
+ return [];
49
+ throw e;
50
+ }
51
+ return files.filter(f => /^rv_[a-f0-9]{32}\.json$/.test(f)).map(f => readLocalReview(dir, f.slice(0, -5)))
52
+ .sort((a, b) => b.createdAt.localeCompare(a.createdAt));
53
+ }
54
+ export function localReviewOwnerAlive(session) {
55
+ try {
56
+ process.kill(session.ownerPid, 0);
57
+ return true;
58
+ }
59
+ catch (e) {
60
+ return e.code === 'EPERM';
61
+ }
62
+ }
63
+ /** CLI 的短期租约仅用于显示“正在监听”;评审结果始终由事件文件决定。 */
64
+ export const localReviewWatcherDir = (dir, id) => path.join(localReviewDir(dir), 'watchers', id);
65
+ export function localReviewWatcherCount(dir, id, now = Date.now()) {
66
+ const folder = localReviewWatcherDir(dir, id);
67
+ let names;
68
+ try {
69
+ names = fs.readdirSync(folder);
70
+ }
71
+ catch {
72
+ return 0;
73
+ }
74
+ let count = 0;
75
+ for (const name of names) {
76
+ if (!name.endsWith('.json'))
77
+ continue;
78
+ try {
79
+ const lease = JSON.parse(fs.readFileSync(path.join(folder, name), 'utf8'));
80
+ if (typeof lease.expiresAt === 'number' && lease.expiresAt > now && typeof lease.pid === 'number' && Number.isSafeInteger(lease.pid) && lease.pid > 0) {
81
+ process.kill(lease.pid, 0);
82
+ count++;
83
+ }
84
+ }
85
+ catch { /* 已退出的监听器或不完整的租约不算在线。 */ }
86
+ }
87
+ return count;
88
+ }
@@ -0,0 +1,134 @@
1
+ /** 本地评审的持久化契约。浏览器、服务端和 CLI 共用;不依赖 Node。 */
2
+ import { z } from 'zod';
3
+ export declare const LOCAL_REVIEW_MAX_BODY = 10000;
4
+ export declare const LOCAL_REVIEW_MAX_EVENTS = 1000;
5
+ export declare const LOCAL_REVIEW_MAX_FILE_BYTES: number;
6
+ export declare const LocalReviewId: z.ZodString;
7
+ export declare const LocalReviewLocation: z.ZodObject<{
8
+ scenarioId: z.ZodNullable<z.ZodString>;
9
+ position: z.ZodNumber;
10
+ sceneId: z.ZodString;
11
+ }, z.core.$strict>;
12
+ export type LocalReviewLocation = z.infer<typeof LocalReviewLocation>;
13
+ export declare const LocalReviewContext: z.ZodObject<{
14
+ scenarioId: z.ZodNullable<z.ZodString>;
15
+ position: z.ZodNumber;
16
+ sceneId: z.ZodString;
17
+ route: z.ZodString;
18
+ stepId: z.ZodNullable<z.ZodString>;
19
+ source: z.ZodNullable<z.ZodString>;
20
+ pageTitle: z.ZodString;
21
+ scenarioName: z.ZodNullable<z.ZodString>;
22
+ }, z.core.$strict>;
23
+ export type LocalReviewContext = z.infer<typeof LocalReviewContext>;
24
+ export declare const LocalReviewEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
25
+ type: z.ZodLiteral<"feedback">;
26
+ body: z.ZodString;
27
+ context: z.ZodObject<{
28
+ scenarioId: z.ZodNullable<z.ZodString>;
29
+ position: z.ZodNumber;
30
+ sceneId: z.ZodString;
31
+ route: z.ZodString;
32
+ stepId: z.ZodNullable<z.ZodString>;
33
+ source: z.ZodNullable<z.ZodString>;
34
+ pageTitle: z.ZodString;
35
+ scenarioName: z.ZodNullable<z.ZodString>;
36
+ }, z.core.$strict>;
37
+ sessionId: z.ZodString;
38
+ seq: z.ZodNumber;
39
+ requestId: z.ZodString;
40
+ createdAt: z.ZodISODateTime;
41
+ }, z.core.$strict>, z.ZodObject<{
42
+ type: z.ZodLiteral<"approved">;
43
+ sessionId: z.ZodString;
44
+ seq: z.ZodNumber;
45
+ requestId: z.ZodString;
46
+ createdAt: z.ZodISODateTime;
47
+ }, z.core.$strict>, z.ZodObject<{
48
+ type: z.ZodLiteral<"closed">;
49
+ reason: z.ZodEnum<{
50
+ source_changed: "source_changed";
51
+ compile_error: "compile_error";
52
+ option_removed: "option_removed";
53
+ server_stopped: "server_stopped";
54
+ }>;
55
+ sessionId: z.ZodString;
56
+ seq: z.ZodNumber;
57
+ requestId: z.ZodString;
58
+ createdAt: z.ZodISODateTime;
59
+ }, z.core.$strict>], "type">;
60
+ export type LocalReviewEvent = z.infer<typeof LocalReviewEvent>;
61
+ export declare const LocalReviewSession: z.ZodObject<{
62
+ v: z.ZodLiteral<1>;
63
+ id: z.ZodString;
64
+ instanceId: z.ZodString;
65
+ ownerPid: z.ZodNumber;
66
+ projectId: z.ZodString;
67
+ projectDir: z.ZodString;
68
+ projectName: z.ZodString;
69
+ featureId: z.ZodString;
70
+ featureName: z.ZodString;
71
+ optionId: z.ZodString;
72
+ optionName: z.ZodString;
73
+ revision: z.ZodString;
74
+ createdAt: z.ZodISODateTime;
75
+ url: z.ZodString;
76
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
77
+ type: z.ZodLiteral<"feedback">;
78
+ body: z.ZodString;
79
+ context: z.ZodObject<{
80
+ scenarioId: z.ZodNullable<z.ZodString>;
81
+ position: z.ZodNumber;
82
+ sceneId: z.ZodString;
83
+ route: z.ZodString;
84
+ stepId: z.ZodNullable<z.ZodString>;
85
+ source: z.ZodNullable<z.ZodString>;
86
+ pageTitle: z.ZodString;
87
+ scenarioName: z.ZodNullable<z.ZodString>;
88
+ }, z.core.$strict>;
89
+ sessionId: z.ZodString;
90
+ seq: z.ZodNumber;
91
+ requestId: z.ZodString;
92
+ createdAt: z.ZodISODateTime;
93
+ }, z.core.$strict>, z.ZodObject<{
94
+ type: z.ZodLiteral<"approved">;
95
+ sessionId: z.ZodString;
96
+ seq: z.ZodNumber;
97
+ requestId: z.ZodString;
98
+ createdAt: z.ZodISODateTime;
99
+ }, z.core.$strict>, z.ZodObject<{
100
+ type: z.ZodLiteral<"closed">;
101
+ reason: z.ZodEnum<{
102
+ source_changed: "source_changed";
103
+ compile_error: "compile_error";
104
+ option_removed: "option_removed";
105
+ server_stopped: "server_stopped";
106
+ }>;
107
+ sessionId: z.ZodString;
108
+ seq: z.ZodNumber;
109
+ requestId: z.ZodString;
110
+ createdAt: z.ZodISODateTime;
111
+ }, z.core.$strict>], "type">>;
112
+ }, z.core.$strict>;
113
+ export type LocalReviewSession = z.infer<typeof LocalReviewSession>;
114
+ export declare const LocalReviewWrite: z.ZodDiscriminatedUnion<[z.ZodObject<{
115
+ sessionId: z.ZodString;
116
+ requestId: z.ZodString;
117
+ type: z.ZodLiteral<"feedback">;
118
+ body: z.ZodString;
119
+ context: z.ZodObject<{
120
+ scenarioId: z.ZodNullable<z.ZodString>;
121
+ position: z.ZodNumber;
122
+ sceneId: z.ZodString;
123
+ }, z.core.$strict>;
124
+ }, z.core.$strict>, z.ZodObject<{
125
+ sessionId: z.ZodString;
126
+ requestId: z.ZodString;
127
+ type: z.ZodLiteral<"approved">;
128
+ }, z.core.$strict>], "type">;
129
+ export type LocalReviewWrite = z.infer<typeof LocalReviewWrite>;
130
+ export type LocalReviewState = {
131
+ session: LocalReviewSession;
132
+ watchers: number;
133
+ };
134
+ export declare function localReviewStatus(session: LocalReviewSession): 'open' | 'approved' | 'closed';
@@ -0,0 +1,62 @@
1
+ /** 本地评审的持久化契约。浏览器、服务端和 CLI 共用;不依赖 Node。 */
2
+ import { z } from 'zod';
3
+ export const LOCAL_REVIEW_MAX_BODY = 10_000;
4
+ export const LOCAL_REVIEW_MAX_EVENTS = 1000;
5
+ export const LOCAL_REVIEW_MAX_FILE_BYTES = 16 * 1024 * 1024;
6
+ export const LocalReviewId = z.string().regex(/^rv_[a-f0-9]{32}$/);
7
+ const ref = z.string().min(1).max(300);
8
+ export const LocalReviewLocation = z.strictObject({
9
+ scenarioId: ref.nullable(),
10
+ position: z.number().int().min(0).max(10000),
11
+ sceneId: ref,
12
+ });
13
+ export const LocalReviewContext = LocalReviewLocation.extend({
14
+ route: z.string().min(1).max(2000),
15
+ stepId: ref.nullable(),
16
+ source: z.string().max(2000).nullable(),
17
+ pageTitle: z.string().max(2000),
18
+ scenarioName: z.string().max(2000).nullable(),
19
+ });
20
+ const eventBase = {
21
+ sessionId: LocalReviewId,
22
+ seq: z.number().int().positive(),
23
+ requestId: z.string().uuid(),
24
+ createdAt: z.iso.datetime(),
25
+ };
26
+ export const LocalReviewEvent = z.discriminatedUnion('type', [
27
+ z.strictObject({ ...eventBase, type: z.literal('feedback'), body: z.string().trim().min(1).max(LOCAL_REVIEW_MAX_BODY), context: LocalReviewContext }),
28
+ z.strictObject({ ...eventBase, type: z.literal('approved') }),
29
+ z.strictObject({ ...eventBase, type: z.literal('closed'), reason: z.enum(['source_changed', 'compile_error', 'option_removed', 'server_stopped']) }),
30
+ ]);
31
+ export const LocalReviewSession = z.strictObject({
32
+ v: z.literal(1),
33
+ id: LocalReviewId,
34
+ instanceId: z.string().uuid(),
35
+ ownerPid: z.number().int().positive(),
36
+ projectId: ref,
37
+ projectDir: z.string().min(1),
38
+ projectName: z.string(),
39
+ featureId: ref,
40
+ featureName: z.string(),
41
+ optionId: ref,
42
+ optionName: z.string(),
43
+ revision: z.string().regex(/^[a-f0-9]{64}$/),
44
+ createdAt: z.iso.datetime(),
45
+ url: z.string().url(),
46
+ events: z.array(LocalReviewEvent).max(LOCAL_REVIEW_MAX_EVENTS),
47
+ }).superRefine((s, ctx) => {
48
+ const requests = new Set();
49
+ s.events.forEach((e, i) => {
50
+ if (e.sessionId !== s.id || e.seq !== i + 1 || requests.has(e.requestId) || (e.type !== 'feedback' && i !== s.events.length - 1))
51
+ ctx.addIssue({ code: 'custom', message: 'Invalid review event order, session, or request id', path: ['events', i] });
52
+ requests.add(e.requestId);
53
+ });
54
+ });
55
+ export const LocalReviewWrite = z.discriminatedUnion('type', [
56
+ z.strictObject({ sessionId: LocalReviewId, requestId: z.string().uuid(), type: z.literal('feedback'), body: z.string().trim().min(1).max(LOCAL_REVIEW_MAX_BODY), context: LocalReviewLocation }),
57
+ z.strictObject({ sessionId: LocalReviewId, requestId: z.string().uuid(), type: z.literal('approved') }),
58
+ ]);
59
+ export function localReviewStatus(session) {
60
+ const last = session.events.at(-1);
61
+ return last?.type === 'approved' ? 'approved' : last?.type === 'closed' ? 'closed' : 'open';
62
+ }
package/dist/node.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /** 仅限 Node 端的入口(文件系统加载)。浏览器端只用 `@joplo-app/core`。 */
2
2
  export * from './load.js';
3
+ export * from './local-review-files.js';
3
4
  /** 编译期图表布局引擎(elkjs,D69):compile(src, mode, { layout: elkLayout })。 */
4
5
  export { elkLayout, runElk } from './diagram/elk.js';
package/dist/node.js CHANGED
@@ -1,4 +1,5 @@
1
1
  /** 仅限 Node 端的入口(文件系统加载)。浏览器端只用 `@joplo-app/core`。 */
2
2
  export * from "./load.js";
3
+ export * from "./local-review-files.js";
3
4
  /** 编译期图表布局引擎(elkjs,D69):compile(src, mode, { layout: elkLayout })。 */
4
5
  export { elkLayout, runElk } from "./diagram/elk.js";
package/dist/schema.d.ts CHANGED
@@ -342,6 +342,8 @@ export declare const Step: z.ZodObject<{
342
342
  }>>;
343
343
  }, z.core.$strict>>>;
344
344
  hold: z.ZodOptional<z.ZodNumber>;
345
+ say: z.ZodOptional<z.ZodString>;
346
+ narrate: z.ZodOptional<z.ZodString>;
345
347
  source: z.ZodOptional<z.ZodString>;
346
348
  }, z.core.$strict>;
347
349
  export declare const Scenario: z.ZodObject<{
@@ -508,6 +510,8 @@ export declare const Scenario: z.ZodObject<{
508
510
  }>>;
509
511
  }, z.core.$strict>>>;
510
512
  hold: z.ZodOptional<z.ZodNumber>;
513
+ say: z.ZodOptional<z.ZodString>;
514
+ narrate: z.ZodOptional<z.ZodString>;
511
515
  source: z.ZodOptional<z.ZodString>;
512
516
  }, z.core.$strict>>>;
513
517
  expected: z.ZodDefault<z.ZodString>;
@@ -663,12 +667,37 @@ export declare const Issue: z.ZodObject<{
663
667
  refs: z.ZodDefault<z.ZodArray<z.ZodString>>;
664
668
  source: z.ZodOptional<z.ZodString>;
665
669
  }, z.core.$strict>;
670
+ /** 朗读配置(D74,来自 config({ voice })):只在 dev / review IR 里,发布站去掉。 */
671
+ export declare const VoiceConfig: z.ZodObject<{
672
+ profile: z.ZodOptional<z.ZodString>;
673
+ narrator: z.ZodOptional<z.ZodString>;
674
+ roles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
675
+ }, z.core.$strict>;
676
+ /**
677
+ * 发布站带上的朗读音频(D74,joplo build 写入):voices 是每个声音的指纹(旁白与各角色),
678
+ * clips 的键是 clipKey(指纹, 朗读文字),值是相对站点根目录的音频路径。没有时观众端用浏览器朗读。
679
+ */
680
+ export declare const VoiceIndex: z.ZodObject<{
681
+ narrator: z.ZodNullable<z.ZodString>;
682
+ roles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
683
+ clips: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
684
+ }, z.core.$strict>;
666
685
  export declare const Project: z.ZodObject<{
667
686
  schemaVersion: z.ZodLiteral<2>;
668
687
  name: z.ZodString;
669
688
  description: z.ZodDefault<z.ZodString>;
670
689
  theme: z.ZodDefault<z.ZodString>;
671
690
  autoFocus: z.ZodOptional<z.ZodBoolean>;
691
+ voiceConfig: z.ZodOptional<z.ZodObject<{
692
+ profile: z.ZodOptional<z.ZodString>;
693
+ narrator: z.ZodOptional<z.ZodString>;
694
+ roles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
695
+ }, z.core.$strict>>;
696
+ voiceIndex: z.ZodOptional<z.ZodObject<{
697
+ narrator: z.ZodNullable<z.ZodString>;
698
+ roles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
699
+ clips: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
700
+ }, z.core.$strict>>;
672
701
  themes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
673
702
  mode: z.ZodEnum<{
674
703
  publish: "publish";
@@ -969,6 +998,8 @@ export declare const Project: z.ZodObject<{
969
998
  }>>;
970
999
  }, z.core.$strict>>>;
971
1000
  hold: z.ZodOptional<z.ZodNumber>;
1001
+ say: z.ZodOptional<z.ZodString>;
1002
+ narrate: z.ZodOptional<z.ZodString>;
972
1003
  source: z.ZodOptional<z.ZodString>;
973
1004
  }, z.core.$strict>>>;
974
1005
  expected: z.ZodDefault<z.ZodString>;
@@ -1007,3 +1038,5 @@ export type Fork = z.infer<typeof Fork>;
1007
1038
  export type Mark = z.infer<typeof Mark>;
1008
1039
  export type Cue = z.infer<typeof Cue>;
1009
1040
  export type Callout = z.infer<typeof Callout>;
1041
+ export type VoiceConfig = z.infer<typeof VoiceConfig>;
1042
+ export type VoiceIndex = z.infer<typeof VoiceIndex>;
package/dist/schema.js CHANGED
@@ -167,6 +167,10 @@ export const Step = z.strictObject({
167
167
  callouts: z.array(Callout).optional(),
168
168
  /** 自动播放时这一步至少停留的毫秒数(D70,来自 hold;未按速度缩放);没有时省略。 */
169
169
  hold: z.number().int().positive().max(30_000).optional(),
170
+ /** 角色台词(D74,来自 say(),多个按空格连接):用这一步角色的声音读;没有时省略。发布站保留。 */
171
+ say: z.string().min(1).optional(),
172
+ /** 旁白(D74,来自 narrate()):用旁白的声音读,优先于台词和字幕;没有时省略。发布站保留。 */
173
+ narrate: z.string().min(1).optional(),
170
174
  source: Source,
171
175
  });
172
176
  export const Scenario = z.strictObject({
@@ -269,6 +273,21 @@ export const Issue = z.strictObject({
269
273
  refs: z.array(z.string()).default([]),
270
274
  source: Source,
271
275
  });
276
+ /** 朗读配置(D74,来自 config({ voice })):只在 dev / review IR 里,发布站去掉。 */
277
+ export const VoiceConfig = z.strictObject({
278
+ profile: z.string().min(1).optional(),
279
+ narrator: z.string().min(1).optional(),
280
+ roles: z.record(z.string(), z.string().min(1)).optional(),
281
+ });
282
+ /**
283
+ * 发布站带上的朗读音频(D74,joplo build 写入):voices 是每个声音的指纹(旁白与各角色),
284
+ * clips 的键是 clipKey(指纹, 朗读文字),值是相对站点根目录的音频路径。没有时观众端用浏览器朗读。
285
+ */
286
+ export const VoiceIndex = z.strictObject({
287
+ narrator: z.string().min(1).nullable(),
288
+ roles: z.record(z.string(), z.string().min(1)).default({}),
289
+ clips: z.record(z.string(), z.string().min(1)).default({}),
290
+ });
272
291
  export const Project = z.strictObject({
273
292
  schemaVersion: z.literal(SCHEMA_VERSION),
274
293
  name: z.string().min(1),
@@ -277,6 +296,8 @@ export const Project = z.strictObject({
277
296
  theme: z.string().min(1).default('sketch'),
278
297
  /** 默认焦点行为(D70):缺省 = 开启;false = 只按作者写的镜头与提示呈现(config({ autoFocus: false }))。发布站保留。 */
279
298
  autoFocus: z.boolean().optional(),
299
+ voiceConfig: VoiceConfig.optional(),
300
+ voiceIndex: VoiceIndex.optional(),
280
301
  /** 作者主题(D51):主题名 → CSS 原文(themes/<name>.css);渲染时自动限定在舞台范围内。发布站同样打包。 */
281
302
  themes: z.record(z.string(), z.string()).default({}),
282
303
  /** dev = 含全部方案(本地看板);publish = 只含选定方案,且去掉创作侧信息(D33);review = 评审版:全部方案,同样去掉创作侧信息(D63)。 */
@@ -0,0 +1,50 @@
1
+ import type { Project, Step } from './schema.js';
2
+ /** 作者要分享的范围:场景 id 与功能 id(功能 = 这个功能选定方案的全部场景;评审版是全部方案的场景)。 */
3
+ export type ScopeRequest = {
4
+ scenarios?: readonly string[];
5
+ features?: readonly string[];
6
+ };
7
+ /** publish = 只发布选定方案;review = 评审版(全部方案)。 */
8
+ export type ScopeMode = 'publish' | 'review';
9
+ /** 因为被范围内步骤引用而带上的别的功能的内容(只给作者看:终端输出、看板浮层,不进分享)。 */
10
+ export type ScopeBorrowed = {
11
+ kind: 'element';
12
+ featureId: string;
13
+ featureName: string;
14
+ optionId: string;
15
+ elementId: string;
16
+ route: string;
17
+ refs: string[];
18
+ scenarios: string[];
19
+ } | {
20
+ kind: 'page';
21
+ featureId: string;
22
+ featureName: string;
23
+ optionId: string;
24
+ route: string;
25
+ scenarios: string[];
26
+ };
27
+ export type ScopeInfo = {
28
+ /** `.joplo/cloud.json` 里这个范围的键:排序后的场景 id,用逗号连接;评审版前缀 `review:`。 */
29
+ key: string;
30
+ scenarios: string[];
31
+ features: string[];
32
+ borrowed: ScopeBorrowed[];
33
+ };
34
+ export declare const hasScope: (r: ScopeRequest | undefined) => r is ScopeRequest;
35
+ export declare const scopeKey: (scenarios: readonly string[], mode: ScopeMode) => string;
36
+ /**
37
+ * 把作者写的范围解析成场景 id(保持 IR 里的顺序)。写错的场景或功能、没有选定方案、范围为空时报错,调用方不应发布任何东西。
38
+ */
39
+ export declare function resolveScope(project: Project, request: ScopeRequest, mode: ScopeMode): string[];
40
+ /** 一步里引用到的元素 id:操作目标、镜头、标注、焦点提示、标注气泡、trace。 */
41
+ export declare function stepRefs(st: Step): string[];
42
+ /**
43
+ * 裁剪到给定场景(先用 resolveScope 解析)。返回新的 IR(输入不变)和范围说明。
44
+ */
45
+ export declare function scopeProject(project: Project, scenarioIds: readonly string[], mode?: ScopeMode): {
46
+ project: Project;
47
+ info: ScopeInfo;
48
+ };
49
+ /** 一条借用的说明(英文,CLI 与看板共用)。 */
50
+ export declare function borrowedLine(b: ScopeBorrowed): string;