@geminilight/mindos 1.1.58 → 1.1.60

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 (106) hide show
  1. package/README.md +62 -64
  2. package/README_zh.md +60 -62
  3. package/dist/agent/ledger/run-timeline-events.d.ts.map +1 -1
  4. package/dist/agent/ledger/run-timeline-events.js +16 -8
  5. package/dist/agent/ledger/run-timeline-events.js.map +1 -1
  6. package/dist/agent/runtime/adapters/index.d.ts +1 -0
  7. package/dist/agent/runtime/adapters/index.d.ts.map +1 -1
  8. package/dist/agent/runtime/adapters/index.js +1 -0
  9. package/dist/agent/runtime/adapters/index.js.map +1 -1
  10. package/dist/agent/runtime/adapters/session-transcripts/adapters/claude.d.ts +4 -0
  11. package/dist/agent/runtime/adapters/session-transcripts/adapters/claude.d.ts.map +1 -0
  12. package/dist/agent/runtime/adapters/session-transcripts/adapters/claude.js +83 -0
  13. package/dist/agent/runtime/adapters/session-transcripts/adapters/claude.js.map +1 -0
  14. package/dist/agent/runtime/adapters/session-transcripts/adapters/codebuddy-code.d.ts +4 -0
  15. package/dist/agent/runtime/adapters/session-transcripts/adapters/codebuddy-code.d.ts.map +1 -0
  16. package/dist/agent/runtime/adapters/session-transcripts/adapters/codebuddy-code.js +74 -0
  17. package/dist/agent/runtime/adapters/session-transcripts/adapters/codebuddy-code.js.map +1 -0
  18. package/dist/agent/runtime/adapters/session-transcripts/adapters/gemini.d.ts +4 -0
  19. package/dist/agent/runtime/adapters/session-transcripts/adapters/gemini.d.ts.map +1 -0
  20. package/dist/agent/runtime/adapters/session-transcripts/adapters/gemini.js +73 -0
  21. package/dist/agent/runtime/adapters/session-transcripts/adapters/gemini.js.map +1 -0
  22. package/dist/agent/runtime/adapters/session-transcripts/adapters/kimi.d.ts +4 -0
  23. package/dist/agent/runtime/adapters/session-transcripts/adapters/kimi.d.ts.map +1 -0
  24. package/dist/agent/runtime/adapters/session-transcripts/adapters/kimi.js +61 -0
  25. package/dist/agent/runtime/adapters/session-transcripts/adapters/kimi.js.map +1 -0
  26. package/dist/agent/runtime/adapters/session-transcripts/adapters/openclaw.d.ts +4 -0
  27. package/dist/agent/runtime/adapters/session-transcripts/adapters/openclaw.d.ts.map +1 -0
  28. package/dist/agent/runtime/adapters/session-transcripts/adapters/openclaw.js +156 -0
  29. package/dist/agent/runtime/adapters/session-transcripts/adapters/openclaw.js.map +1 -0
  30. package/dist/agent/runtime/adapters/session-transcripts/adapters/opencode.d.ts +4 -0
  31. package/dist/agent/runtime/adapters/session-transcripts/adapters/opencode.d.ts.map +1 -0
  32. package/dist/agent/runtime/adapters/session-transcripts/adapters/opencode.js +79 -0
  33. package/dist/agent/runtime/adapters/session-transcripts/adapters/opencode.js.map +1 -0
  34. package/dist/agent/runtime/adapters/session-transcripts/adapters/qwen-code.d.ts +4 -0
  35. package/dist/agent/runtime/adapters/session-transcripts/adapters/qwen-code.d.ts.map +1 -0
  36. package/dist/agent/runtime/adapters/session-transcripts/adapters/qwen-code.js +86 -0
  37. package/dist/agent/runtime/adapters/session-transcripts/adapters/qwen-code.js.map +1 -0
  38. package/dist/agent/runtime/adapters/session-transcripts/adapters/unverified.d.ts +4 -0
  39. package/dist/agent/runtime/adapters/session-transcripts/adapters/unverified.d.ts.map +1 -0
  40. package/dist/agent/runtime/adapters/session-transcripts/adapters/unverified.js +22 -0
  41. package/dist/agent/runtime/adapters/session-transcripts/adapters/unverified.js.map +1 -0
  42. package/dist/agent/runtime/adapters/session-transcripts/file-system.d.ts +24 -0
  43. package/dist/agent/runtime/adapters/session-transcripts/file-system.d.ts.map +1 -0
  44. package/dist/agent/runtime/adapters/session-transcripts/file-system.js +127 -0
  45. package/dist/agent/runtime/adapters/session-transcripts/file-system.js.map +1 -0
  46. package/dist/agent/runtime/adapters/session-transcripts/index.d.ts +4 -0
  47. package/dist/agent/runtime/adapters/session-transcripts/index.d.ts.map +1 -0
  48. package/dist/agent/runtime/adapters/session-transcripts/index.js +3 -0
  49. package/dist/agent/runtime/adapters/session-transcripts/index.js.map +1 -0
  50. package/dist/agent/runtime/adapters/session-transcripts/normalizer.d.ts +45 -0
  51. package/dist/agent/runtime/adapters/session-transcripts/normalizer.d.ts.map +1 -0
  52. package/dist/agent/runtime/adapters/session-transcripts/normalizer.js +331 -0
  53. package/dist/agent/runtime/adapters/session-transcripts/normalizer.js.map +1 -0
  54. package/dist/agent/runtime/adapters/session-transcripts/registry.d.ts +8 -0
  55. package/dist/agent/runtime/adapters/session-transcripts/registry.d.ts.map +1 -0
  56. package/dist/agent/runtime/adapters/session-transcripts/registry.js +73 -0
  57. package/dist/agent/runtime/adapters/session-transcripts/registry.js.map +1 -0
  58. package/dist/agent/runtime/adapters/session-transcripts/types.d.ts +51 -0
  59. package/dist/agent/runtime/adapters/session-transcripts/types.d.ts.map +1 -0
  60. package/dist/agent/runtime/adapters/session-transcripts/types.js +2 -0
  61. package/dist/agent/runtime/adapters/session-transcripts/types.js.map +1 -0
  62. package/dist/agent/tool/kb-tools.d.ts.map +1 -1
  63. package/dist/agent/tool/kb-tools.js +66 -2
  64. package/dist/agent/tool/kb-tools.js.map +1 -1
  65. package/dist/capabilities.d.ts +1 -1
  66. package/dist/capabilities.d.ts.map +1 -1
  67. package/dist/capabilities.js +8 -0
  68. package/dist/capabilities.js.map +1 -1
  69. package/dist/intelligence/cognition/human-modeling.d.ts +84 -0
  70. package/dist/intelligence/cognition/human-modeling.d.ts.map +1 -0
  71. package/dist/intelligence/cognition/human-modeling.js +314 -0
  72. package/dist/intelligence/cognition/human-modeling.js.map +1 -0
  73. package/dist/intelligence/cognition/index.d.ts +2 -0
  74. package/dist/intelligence/cognition/index.d.ts.map +1 -0
  75. package/dist/intelligence/cognition/index.js +2 -0
  76. package/dist/intelligence/cognition/index.js.map +1 -0
  77. package/dist/intelligence/index.d.ts +2 -0
  78. package/dist/intelligence/index.d.ts.map +1 -0
  79. package/dist/intelligence/index.js +2 -0
  80. package/dist/intelligence/index.js.map +1 -0
  81. package/dist/intelligence.d.ts +14 -0
  82. package/dist/intelligence.d.ts.map +1 -0
  83. package/dist/intelligence.js +11 -0
  84. package/dist/intelligence.js.map +1 -0
  85. package/dist/knowledge/content-integrity.d.ts +15 -0
  86. package/dist/knowledge/content-integrity.d.ts.map +1 -0
  87. package/dist/knowledge/content-integrity.js +55 -0
  88. package/dist/knowledge/content-integrity.js.map +1 -0
  89. package/dist/protocols/mcp-server/index.cjs +32 -32
  90. package/dist/protocols/mcp-server/index.js +34 -17
  91. package/dist/protocols/mcp-server/index.js.map +1 -1
  92. package/dist/server/handlers/file.d.ts.map +1 -1
  93. package/dist/server/handlers/file.js +70 -17
  94. package/dist/server/handlers/file.js.map +1 -1
  95. package/dist/server/handlers/mcp-install-skill.d.ts +25 -0
  96. package/dist/server/handlers/mcp-install-skill.d.ts.map +1 -1
  97. package/dist/server/handlers/mcp-install-skill.js +231 -9
  98. package/dist/server/handlers/mcp-install-skill.js.map +1 -1
  99. package/dist/server/http.js +4 -0
  100. package/dist/server/http.js.map +1 -1
  101. package/dist/server/provider-settings.js +4 -4
  102. package/dist/server/provider-settings.js.map +1 -1
  103. package/dist/server/route-ownership.d.ts.map +1 -1
  104. package/dist/server/route-ownership.js +2 -0
  105. package/dist/server/route-ownership.js.map +1 -1
  106. package/package.json +21 -9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../../../../../src/agent/runtime/adapters/session-transcripts/adapters/opencode.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,iCAAiC,EACjC,4BAA4B,EAE5B,+BAA+B,EAChC,MAAM,aAAa,CAAC;AA4ErB,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC,4BAA4B,EAAE,CAAC,CAuBzC;AAED,eAAO,MAAM,mCAAmC,EAAE,+BAQjD,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { existsSync } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { join, resolve } from 'node:path';
5
+ import { promisify } from 'node:util';
6
+ import { parseOpenCodeTextRows, safeLimit, sortAndLimit, toExternalRecord, } from '../normalizer.js';
7
+ const execFileAsync = promisify(execFile);
8
+ function sqlString(value) {
9
+ return `'${value.replace(/'/g, "''")}'`;
10
+ }
11
+ async function runSqliteJson(dbPath, sql) {
12
+ if (!existsSync(dbPath))
13
+ return [];
14
+ try {
15
+ const { stdout } = await execFileAsync('sqlite3', ['-readonly', '-json', dbPath, sql], {
16
+ maxBuffer: 10 * 1024 * 1024,
17
+ });
18
+ const parsed = JSON.parse(stdout || '[]');
19
+ return Array.isArray(parsed) ? parsed.filter((item) => !!item && typeof item === 'object' && !Array.isArray(item)) : [];
20
+ }
21
+ catch {
22
+ return [];
23
+ }
24
+ }
25
+ function createOpenCodeSqliteCliReader(dbPath) {
26
+ return {
27
+ listSessions(options) {
28
+ const where = [];
29
+ if (options.cwd?.trim())
30
+ where.push(`directory = ${sqlString(resolve(options.cwd.trim()))}`);
31
+ if (options.sessionId?.trim())
32
+ where.push(`id = ${sqlString(options.sessionId.trim())}`);
33
+ return runSqliteJson(dbPath, `select id, directory, title, time_created, time_updated from session${where.length ? ` where ${where.join(' and ')}` : ''} order by time_updated desc limit ${safeLimit(options.limit)};`);
34
+ },
35
+ listTextRows(sessionId) {
36
+ return runSqliteJson(dbPath, `select m.id as message_id, m.time_created as message_time_created, m.data as message_data, p.time_created as part_time_created, p.data as part_data from message m join part p on p.message_id = m.id where m.session_id = ${sqlString(sessionId)} order by m.time_created, p.time_created;`);
37
+ },
38
+ };
39
+ }
40
+ function createOpenCodeDbReaders(dbPath) {
41
+ return [
42
+ createOpenCodeSqliteCliReader(dbPath),
43
+ ];
44
+ }
45
+ export async function listOpenCodeSessions(options) {
46
+ const home = options.homeDir ?? homedir();
47
+ const dbPath = join(home, '.local', 'share', 'opencode', 'opencode.db');
48
+ const [reader] = createOpenCodeDbReaders(dbPath);
49
+ if (!reader)
50
+ return [];
51
+ const rows = await reader.listSessions(options);
52
+ const records = [];
53
+ for (const row of rows) {
54
+ if (typeof row.id !== 'string')
55
+ continue;
56
+ const textRows = await reader.listTextRows(row.id);
57
+ const messages = parseOpenCodeTextRows(textRows);
58
+ records.push(toExternalRecord({
59
+ id: row.id,
60
+ title: typeof row.title === 'string' ? row.title : row.id,
61
+ cwd: typeof row.directory === 'string' ? row.directory : options.cwd,
62
+ createdAt: row.time_created,
63
+ updatedAt: row.time_updated,
64
+ messages,
65
+ transcriptSource: 'opencode',
66
+ }));
67
+ }
68
+ return sortAndLimit(records, options.limit);
69
+ }
70
+ export const OPENCODE_SESSION_TRANSCRIPT_ADAPTER = {
71
+ id: 'opencode',
72
+ aliases: ['opencode', 'open-code', 'opencode-cli'],
73
+ transcriptSource: 'opencode',
74
+ status: 'supported',
75
+ durable: true,
76
+ summary: 'Reads OpenCode native sessions from ~/.local/share/opencode/opencode.db.',
77
+ listSessions: listOpenCodeSessions,
78
+ };
79
+ //# sourceMappingURL=opencode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode.js","sourceRoot":"","sources":["../../../../../../src/agent/runtime/adapters/session-transcripts/adapters/opencode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAOtC,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,YAAY,EACZ,gBAAgB,GAEjB,MAAM,kBAAkB,CAAC;AAqB1B,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,I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G,CAAC,EAAE;YACV,KAAK,EAAE,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;YACzD,GAAG,EAAE,OAAO,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG;YACpE,SAAS,EAAE,GAAG,CAAC,YAAY;YAC3B,SAAS,EAAE,GAAG,CAAC,YAAY;YAC3B,QAAQ;YACR,gBAAgB,EAAE,UAAU;SAC7B,CAAC,CAAC,CAAC;IACN,CAAC;IACD,OAAO,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,CAAC,MAAM,mCAAmC,GAAoC;IAClF,EAAE,EAAE,UAAU;IACd,OAAO,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,cAAc,CAAC;IAClD,gBAAgB,EAAE,UAAU;IAC5B,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,0EAA0E;IACnF,YAAY,EAAE,oBAAoB;CACnC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ExternalRuntimeSessionListOptions, ExternalRuntimeSessionRecord, RuntimeSessionTranscriptAdapter } from '../types.js';
2
+ export declare function listQwenSessions(options: ExternalRuntimeSessionListOptions): Promise<ExternalRuntimeSessionRecord[]>;
3
+ export declare const QWEN_SESSION_TRANSCRIPT_ADAPTER: RuntimeSessionTranscriptAdapter;
4
+ //# sourceMappingURL=qwen-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qwen-code.d.ts","sourceRoot":"","sources":["../../../../../../src/agent/runtime/adapters/session-transcripts/adapters/qwen-code.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,iCAAiC,EACjC,4BAA4B,EAC5B,+BAA+B,EAChC,MAAM,aAAa,CAAC;AA8BrB,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC,4BAA4B,EAAE,CAAC,CA0DzC;AAED,eAAO,MAAM,+BAA+B,EAAE,+BAQ7C,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { readdir, stat } from 'node:fs/promises';
3
+ import { homedir } from 'node:os';
4
+ import { basename, join } from 'node:path';
5
+ import { directJsonlFiles, projectBaseFromCwd, readJsonl, sanitizedProjectDirNameFromCwd, shouldSkipForRequestedCwd, } from '../file-system.js';
6
+ import { firstStringFromRecords, firstTimestampFromRecords, firstUserMessage, lastUserMessage, newestTimestampField, parseVisibleMessagesFromRecords, sessionIdFromRecords, sortAndLimit, toExternalRecord, } from '../normalizer.js';
7
+ function qwenProjectDirMatches(projectDirName, cwd) {
8
+ const base = projectBaseFromCwd(cwd);
9
+ if (!base)
10
+ return true;
11
+ const sanitized = cwd?.trim() ? sanitizedProjectDirNameFromCwd(cwd).toLowerCase() : '';
12
+ const normalizedName = projectDirName.toLowerCase();
13
+ return normalizedName === base.toLowerCase()
14
+ || normalizedName.includes(base.toLowerCase())
15
+ || Boolean(sanitized && normalizedName === sanitized);
16
+ }
17
+ export async function listQwenSessions(options) {
18
+ const home = options.homeDir ?? homedir();
19
+ const root = join(home, '.qwen', 'projects');
20
+ if (!existsSync(root))
21
+ return [];
22
+ const projectDirs = await readdir(root, { withFileTypes: true }).catch(() => []);
23
+ const records = [];
24
+ for (const projectDir of projectDirs) {
25
+ if (!projectDir.isDirectory())
26
+ continue;
27
+ if (!options.sessionId && options.cwd?.trim() && !qwenProjectDirMatches(projectDir.name, options.cwd))
28
+ continue;
29
+ const chatsDir = join(root, projectDir.name, 'chats');
30
+ const files = await directJsonlFiles(chatsDir, options.sessionId);
31
+ for (const filePath of files) {
32
+ const recordsFromFile = await readJsonl(filePath);
33
+ const fallbackSessionId = basename(filePath).replace(/\.jsonl$/, '');
34
+ const sessionId = sessionIdFromRecords(recordsFromFile, fallbackSessionId);
35
+ if (options.sessionId && sessionId !== options.sessionId && fallbackSessionId !== options.sessionId)
36
+ continue;
37
+ const cwd = firstStringFromRecords(recordsFromFile, [
38
+ 'cwd',
39
+ 'projectRoot',
40
+ 'project_root',
41
+ 'workingDirectory',
42
+ 'working_directory',
43
+ ]) ?? options.cwd;
44
+ if (shouldSkipForRequestedCwd({
45
+ requestedCwd: options.cwd,
46
+ transcriptCwd: cwd,
47
+ sessionId: options.sessionId,
48
+ })) {
49
+ continue;
50
+ }
51
+ const fileStat = await stat(filePath).catch(() => null);
52
+ const messages = parseVisibleMessagesFromRecords(recordsFromFile);
53
+ if (messages.length === 0 && recordsFromFile.length === 0)
54
+ continue;
55
+ const firstUser = firstUserMessage(messages);
56
+ const lastUser = lastUserMessage(messages);
57
+ const title = firstStringFromRecords(recordsFromFile, ['customTitle', 'title', 'prompt'])
58
+ ?? (firstUser?.content ? firstUser.content.slice(0, 80) : sessionId);
59
+ records.push(toExternalRecord({
60
+ id: sessionId,
61
+ title,
62
+ preview: lastUser && lastUser !== firstUser ? lastUser.content.slice(0, 120) : undefined,
63
+ cwd,
64
+ createdAt: firstTimestampFromRecords(recordsFromFile, ['startTime', 'createdAt', 'created_at', 'timestamp'])
65
+ ?? fileStat?.birthtimeMs,
66
+ updatedAt: newestTimestampField(recordsFromFile, 'mtime')
67
+ ?? newestTimestampField(recordsFromFile, 'updatedAt')
68
+ ?? newestTimestampField(recordsFromFile, 'timestamp')
69
+ ?? fileStat?.mtimeMs,
70
+ messages,
71
+ transcriptSource: 'qwen-code',
72
+ }));
73
+ }
74
+ }
75
+ return sortAndLimit(records, options.limit);
76
+ }
77
+ export const QWEN_SESSION_TRANSCRIPT_ADAPTER = {
78
+ id: 'qwen-code',
79
+ aliases: ['qwen', 'qwen-code', 'qwen-cli'],
80
+ transcriptSource: 'qwen-code',
81
+ status: 'supported',
82
+ durable: true,
83
+ summary: 'Reads Qwen Code chat transcripts under ~/.qwen/projects/*/chats.',
84
+ listSessions: listQwenSessions,
85
+ };
86
+ //# sourceMappingURL=qwen-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qwen-code.js","sourceRoot":"","sources":["../../../../../../src/agent/runtime/adapters/session-transcripts/adapters/qwen-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAM3C,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,8BAA8B,EAC9B,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,+BAA+B,EAC/B,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,SAAS,qBAAqB,CAAC,cAAsB,EAAE,GAAY;IACjE,MAAM,IAAI,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,MAAM,SAAS,GAAG,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,8BAA8B,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACvF,MAAM,cAAc,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;IACpD,OAAO,cAAc,KAAK,IAAI,CAAC,WAAW,EAAE;WACvC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;WAC3C,OAAO,CAAC,SAAS,IAAI,cAAc,KAAK,SAAS,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,CAAC,KAA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AC,SAAS;gBACxF,GAAG;gBACH,SAAS,EAAE,yBAAyB,CAAC,eAAe,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;uBACvG,QAAQ,EAAE,WAAW;gBAC1B,SAAS,EAAE,oBAAoB,CAAC,eAAe,EAAE,OAAO,CAAC;uBACpD,oBAAoB,CAAC,eAAe,EAAE,WAAW,CAAC;uBAClD,oBAAoB,CAAC,eAAe,EAAE,WAAW,CAAC;uBAClD,QAAQ,EAAE,OAAO;gBACtB,QAAQ;gBACR,gBAAgB,EAAE,WAAW;aAC9B,CAAC,CAAC,CAAC;QACN,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAoC;IAC9E,EAAE,EAAE,WAAW;IACf,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC;IAC1C,gBAAgB,EAAE,WAAW;IAC7B,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,kEAAkE;IAC3E,YAAY,EAAE,gBAAgB;CAC/B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RuntimeSessionTranscriptAdapter } from '../types.js';
2
+ export declare const CURSOR_SESSION_TRANSCRIPT_ADAPTER: RuntimeSessionTranscriptAdapter;
3
+ export declare const HERMES_SESSION_TRANSCRIPT_ADAPTER: RuntimeSessionTranscriptAdapter;
4
+ //# sourceMappingURL=unverified.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unverified.d.ts","sourceRoot":"","sources":["../../../../../../src/agent/runtime/adapters/session-transcripts/adapters/unverified.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,+BAA+B,EAChC,MAAM,aAAa,CAAC;AAQrB,eAAO,MAAM,iCAAiC,EAAE,+BAQ/C,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,+BAQ/C,CAAC"}
@@ -0,0 +1,22 @@
1
+ async function emptySessions(_options) {
2
+ return [];
3
+ }
4
+ export const CURSOR_SESSION_TRANSCRIPT_ADAPTER = {
5
+ id: 'cursor',
6
+ aliases: ['cursor', 'cursor-agent'],
7
+ transcriptSource: 'cursor',
8
+ status: 'unverified',
9
+ durable: false,
10
+ summary: 'Cursor is recognized as an agent runtime, but MindOS does not yet have a verified durable native transcript reader for Cursor sessions.',
11
+ listSessions: emptySessions,
12
+ };
13
+ export const HERMES_SESSION_TRANSCRIPT_ADAPTER = {
14
+ id: 'hermes',
15
+ aliases: ['hermes', 'hermes-code'],
16
+ transcriptSource: 'hermes',
17
+ status: 'unverified',
18
+ durable: false,
19
+ summary: 'Hermes is recognized as an agent runtime, but MindOS does not yet have a verified durable native transcript reader for Hermes sessions.',
20
+ listSessions: emptySessions,
21
+ };
22
+ //# sourceMappingURL=unverified.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unverified.js","sourceRoot":"","sources":["../../../../../../src/agent/runtime/adapters/session-transcripts/adapters/unverified.ts"],"names":[],"mappings":"AAMA,KAAK,UAAU,aAAa,CAC1B,QAA2C;IAE3C,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,CAAC,MAAM,iCAAiC,GAAoC;IAChF,EAAE,EAAE,QAAQ;IACZ,OAAO,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC;IACnC,gBAAgB,EAAE,QAAQ;IAC1B,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,yIAAyI;IAClJ,YAAY,EAAE,aAAa;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAoC;IAChF,EAAE,EAAE,QAAQ;IACZ,OAAO,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC;IAClC,gBAAgB,EAAE,QAAQ;IAC1B,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,yIAAyI;IAClJ,YAAY,EAAE,aAAa;CAC5B,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { MaybeRecord } from './types.js';
2
+ export declare const MAX_JSONL_LINES = 20000;
3
+ export declare const MAX_DISCOVERED_TRANSCRIPTS = 500;
4
+ export declare function readJsonFile(path: string): Promise<MaybeRecord | null>;
5
+ export declare function readJsonl(path: string): Promise<MaybeRecord[]>;
6
+ export declare function projectBaseFromCwd(cwd?: string): string | null;
7
+ export declare function claudeProjectDirNameFromCwd(cwd: string): string;
8
+ export declare function jsonlFileNameFromSessionId(sessionId?: string): string | null;
9
+ export declare function sanitizedProjectDirNameFromCwd(cwd: string): string;
10
+ export declare function sameResolvedPath(a: string, b: string): boolean;
11
+ export declare function shouldSkipForRequestedCwd(input: {
12
+ requestedCwd?: string;
13
+ transcriptCwd?: string;
14
+ sessionId?: string;
15
+ }): boolean;
16
+ export declare function pathInside(parent: string, child: string): boolean;
17
+ export declare function directJsonlFiles(dir: string, sessionId?: string): Promise<string[]>;
18
+ export declare function discoverJsonlFiles(input: {
19
+ root: string;
20
+ sessionId?: string;
21
+ maxDepth: number;
22
+ skipDir?: (name: string) => boolean;
23
+ }): Promise<string[]>;
24
+ //# sourceMappingURL=file-system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system.d.ts","sourceRoot":"","sources":["../../../../../src/agent/runtime/adapters/session-transcripts/file-system.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C,eAAO,MAAM,eAAe,QAAS,CAAC;AACtC,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAO5E;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAkBpE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI9D;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,wBAAgB,0BAA0B,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK5E;AAED,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAM9D;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAMV;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAIjE;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAYzF;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACrC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAyBpB"}
@@ -0,0 +1,127 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { readdir, readFile } from 'node:fs/promises';
3
+ import { basename, join, resolve } from 'node:path';
4
+ import { isRecord } from './normalizer.js';
5
+ export const MAX_JSONL_LINES = 20_000;
6
+ export const MAX_DISCOVERED_TRANSCRIPTS = 500;
7
+ export async function readJsonFile(path) {
8
+ try {
9
+ const parsed = JSON.parse(await readFile(path, 'utf8'));
10
+ return isRecord(parsed) ? parsed : null;
11
+ }
12
+ catch {
13
+ return null;
14
+ }
15
+ }
16
+ export async function readJsonl(path) {
17
+ try {
18
+ const text = await readFile(path, 'utf8');
19
+ const records = [];
20
+ for (const line of text.split(/\r?\n/).slice(0, MAX_JSONL_LINES)) {
21
+ const trimmed = line.trim();
22
+ if (!trimmed)
23
+ continue;
24
+ try {
25
+ const parsed = JSON.parse(trimmed);
26
+ if (isRecord(parsed))
27
+ records.push(parsed);
28
+ }
29
+ catch {
30
+ // Ignore malformed tail lines from in-progress CLI writes.
31
+ }
32
+ }
33
+ return records;
34
+ }
35
+ catch {
36
+ return [];
37
+ }
38
+ }
39
+ export function projectBaseFromCwd(cwd) {
40
+ if (!cwd?.trim())
41
+ return null;
42
+ const base = basename(resolve(cwd.trim()));
43
+ return base || null;
44
+ }
45
+ export function claudeProjectDirNameFromCwd(cwd) {
46
+ return resolve(cwd.trim()).replace(/[^A-Za-z0-9_-]/g, '-');
47
+ }
48
+ export function jsonlFileNameFromSessionId(sessionId) {
49
+ const trimmed = sessionId?.trim();
50
+ if (!trimmed)
51
+ return null;
52
+ if (trimmed === '.' || trimmed === '..' || trimmed.includes('/') || trimmed.includes('\\'))
53
+ return null;
54
+ return `${trimmed}.jsonl`;
55
+ }
56
+ export function sanitizedProjectDirNameFromCwd(cwd) {
57
+ return resolve(cwd.trim()).replace(/[^A-Za-z0-9_-]/g, '-');
58
+ }
59
+ export function sameResolvedPath(a, b) {
60
+ try {
61
+ return resolve(a.trim()) === resolve(b.trim());
62
+ }
63
+ catch {
64
+ return a.trim() === b.trim();
65
+ }
66
+ }
67
+ export function shouldSkipForRequestedCwd(input) {
68
+ const requested = input.requestedCwd?.trim();
69
+ if (!requested)
70
+ return false;
71
+ const transcriptCwd = input.transcriptCwd?.trim();
72
+ if (!transcriptCwd)
73
+ return !input.sessionId?.trim();
74
+ return !sameResolvedPath(transcriptCwd, requested);
75
+ }
76
+ export function pathInside(parent, child) {
77
+ const parentPath = resolve(parent);
78
+ const childPath = resolve(child);
79
+ return childPath === parentPath || childPath.startsWith(`${parentPath}/`);
80
+ }
81
+ export async function directJsonlFiles(dir, sessionId) {
82
+ if (!existsSync(dir))
83
+ return [];
84
+ if (sessionId?.trim()) {
85
+ const fileName = jsonlFileNameFromSessionId(sessionId);
86
+ if (!fileName)
87
+ return [];
88
+ const filePath = join(dir, fileName);
89
+ return existsSync(filePath) ? [filePath] : [];
90
+ }
91
+ const entries = await readdir(dir, { withFileTypes: true }).catch(() => []);
92
+ return entries
93
+ .filter((entry) => entry.isFile() && entry.name.endsWith('.jsonl'))
94
+ .map((entry) => join(dir, entry.name));
95
+ }
96
+ export async function discoverJsonlFiles(input) {
97
+ if (!existsSync(input.root))
98
+ return [];
99
+ const result = [];
100
+ const wantedName = input.sessionId?.trim() ? jsonlFileNameFromSessionId(input.sessionId) : null;
101
+ if (input.sessionId?.trim() && !wantedName)
102
+ return [];
103
+ async function visit(dir, depth) {
104
+ if (result.length >= MAX_DISCOVERED_TRANSCRIPTS)
105
+ return;
106
+ const entries = await readdir(dir, { withFileTypes: true }).catch(() => []);
107
+ for (const entry of entries) {
108
+ if (result.length >= MAX_DISCOVERED_TRANSCRIPTS)
109
+ return;
110
+ const path = join(dir, entry.name);
111
+ if (entry.isDirectory()) {
112
+ if (depth >= input.maxDepth || input.skipDir?.(entry.name))
113
+ continue;
114
+ await visit(path, depth + 1);
115
+ continue;
116
+ }
117
+ if (!entry.isFile() || !entry.name.endsWith('.jsonl'))
118
+ continue;
119
+ if (wantedName && entry.name !== wantedName)
120
+ continue;
121
+ result.push(path);
122
+ }
123
+ }
124
+ await visit(input.root, 0);
125
+ return result;
126
+ }
127
+ //# sourceMappingURL=file-system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system.js","sourceRoot":"","sources":["../../../../../src/agent/runtime/adapters/session-transcripts/file-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,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AC,IAAI,CAAC,CAAC;YACnC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,IAAI,KAAK,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;oBAAE,SAAS;gBACrE,MAAM,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;gBAC7B,SAAS;YACX,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAAE,SAAS;YAChE,IAAI,UAAU,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;gBAAE,SAAS;YACtD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAED,MAAM,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3B,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type { ExternalRuntimeSessionListOptions, ExternalRuntimeSessionRecord, ImportedRuntimeSessionMessage, ImportedRuntimeSessionRole, RuntimeSessionTranscriptAdapter, RuntimeSessionTranscriptRuntimeIdentity, RuntimeSessionTranscriptRuntimeKind, RuntimeSessionTranscriptSource, RuntimeSessionTranscriptSupportStatus, RuntimeSessionTranscriptTarget, } from './types.js';
2
+ export { parseClaudeMessagesFromRecords, parseGeminiMessagesFromRecords, parseKimiWireMessages, parseOpenCodeTextRows, parseVisibleMessagesFromRecords, type OpenCodeTextRow, } from './normalizer.js';
3
+ export { getRuntimeSessionTranscriptAdapter, listRuntimeSessionTranscriptAdapters, listRuntimeSessionTranscripts, normalizeRuntimeSessionTranscriptId, resolveRuntimeSessionTranscriptTarget, RUNTIME_SESSION_TRANSCRIPT_ADAPTERS, } from './registry.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/agent/runtime/adapters/session-transcripts/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iCAAiC,EACjC,4BAA4B,EAC5B,6BAA6B,EAC7B,0BAA0B,EAC1B,+BAA+B,EAC/B,uCAAuC,EACvC,mCAAmC,EACnC,8BAA8B,EAC9B,qCAAqC,EACrC,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,EAC9B,qBAAqB,EACrB,qBAAqB,EACrB,+BAA+B,EAC/B,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kCAAkC,EAClC,oCAAoC,EACpC,6BAA6B,EAC7B,mCAAmC,EACnC,qCAAqC,EACrC,mCAAmC,GACpC,MAAM,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { parseClaudeMessagesFromRecords, parseGeminiMessagesFromRecords, parseKimiWireMessages, parseOpenCodeTextRows, parseVisibleMessagesFromRecords, } from './normalizer.js';
2
+ export { getRuntimeSessionTranscriptAdapter, listRuntimeSessionTranscriptAdapters, listRuntimeSessionTranscripts, normalizeRuntimeSessionTranscriptId, resolveRuntimeSessionTranscriptTarget, RUNTIME_SESSION_TRANSCRIPT_ADAPTERS, } from './registry.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/agent/runtime/adapters/session-transcripts/index.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,EAC9B,qBAAqB,EACrB,qBAAqB,EACrB,+BAA+B,GAEhC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kCAAkC,EAClC,oCAAoC,EACpC,6BAA6B,EAC7B,mCAAmC,EACnC,qCAAqC,EACrC,mCAAmC,GACpC,MAAM,eAAe,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { ExternalRuntimeSessionRecord, ImportedRuntimeSessionMessage, ImportedRuntimeSessionRole, MaybeRecord } from './types.js';
2
+ export declare const DEFAULT_RUNTIME_SESSION_TRANSCRIPT_LIMIT = 30;
3
+ export declare const MAX_RUNTIME_SESSION_TEXT_LENGTH = 80000;
4
+ export declare const VISIBLE_TEXT_PART_TYPES: Set<string>;
5
+ export type OpenCodeTextRow = {
6
+ session_id?: string;
7
+ message_id?: string;
8
+ message_time_created?: number;
9
+ message_data?: string;
10
+ part_time_created?: number;
11
+ part_data?: string;
12
+ };
13
+ export declare function isRecord(value: unknown): value is MaybeRecord;
14
+ export declare function safeLimit(value: number | undefined): number;
15
+ export declare function timestampMs(value: unknown): number | undefined;
16
+ export declare function timestampField(value: unknown): string | number | undefined;
17
+ export declare function truncateContent(value: string): string;
18
+ export declare function textFromContent(value: unknown): string;
19
+ export declare function textFromVisibleContent(value: unknown): string;
20
+ export declare function pushMessage(messages: ImportedRuntimeSessionMessage[], role: ImportedRuntimeSessionRole, content: string, timestamp?: number): void;
21
+ export declare function parseGeminiMessagesFromRecords(records: MaybeRecord[]): ImportedRuntimeSessionMessage[];
22
+ export declare function parseKimiWireMessages(records: MaybeRecord[]): ImportedRuntimeSessionMessage[];
23
+ export declare function parseOpenCodeTextRows(rows: OpenCodeTextRow[]): ImportedRuntimeSessionMessage[];
24
+ export declare function parseVisibleMessagesFromRecords(records: MaybeRecord[]): ImportedRuntimeSessionMessage[];
25
+ export declare function parseClaudeMessagesFromRecords(records: MaybeRecord[]): ImportedRuntimeSessionMessage[];
26
+ export declare function firstStringField(records: MaybeRecord[], key: string): string | undefined;
27
+ export declare function newestTimestampField(records: MaybeRecord[], key: string): string | number | undefined;
28
+ export declare function firstStringFromRecords(records: MaybeRecord[], keys: string[]): string | undefined;
29
+ export declare function firstTimestampFromRecords(records: MaybeRecord[], keys: string[]): string | number | undefined;
30
+ export declare function sessionHeaderRecord(records: MaybeRecord[]): MaybeRecord | undefined;
31
+ export declare function sessionIdFromRecords(records: MaybeRecord[], fallback: string): string;
32
+ export declare function firstUserMessage(messages: ImportedRuntimeSessionMessage[]): ImportedRuntimeSessionMessage | undefined;
33
+ export declare function lastUserMessage(messages: ImportedRuntimeSessionMessage[]): ImportedRuntimeSessionMessage | undefined;
34
+ export declare function toExternalRecord(input: {
35
+ id: string;
36
+ title?: string | null;
37
+ preview?: string;
38
+ cwd?: string;
39
+ createdAt?: string | number;
40
+ updatedAt?: string | number;
41
+ messages: ImportedRuntimeSessionMessage[];
42
+ transcriptSource: ExternalRuntimeSessionRecord['transcriptSource'];
43
+ }): ExternalRuntimeSessionRecord;
44
+ export declare function sortAndLimit(records: ExternalRuntimeSessionRecord[], limit?: number): ExternalRuntimeSessionRecord[];
45
+ //# sourceMappingURL=normalizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../../../src/agent/runtime/adapters/session-transcripts/normalizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,6BAA6B,EAC7B,0BAA0B,EAC1B,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,wCAAwC,KAAK,CAAC;AAC3D,eAAO,MAAM,+BAA+B,QAAS,CAAC;AACtD,eAAO,MAAM,uBAAuB,aAA+C,CAAC;AAEpF,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAE7D;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAG3D;AAED,wBAA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