semantic-atlas 0.1.3 → 0.2.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.
Files changed (60) hide show
  1. package/.agents/skills/semantic-atlas/SKILL.md +59 -43
  2. package/.agents/skills/semantic-atlas/references/graph-patch.md +22 -5
  3. package/.agents/skills/semantic-atlas/references/result-routing.md +32 -19
  4. package/.agents/skills/semantic-atlas/references/snapshot-bootstrap.md +17 -32
  5. package/README.md +34 -20
  6. package/README.zh-CN.md +30 -20
  7. package/dist/cli/argument-parser.js +41 -23
  8. package/dist/cli/bin.js +12 -15
  9. package/dist/cli/cli-application.d.ts +2 -2
  10. package/dist/cli/cli-application.d.ts.map +1 -1
  11. package/dist/cli/cli-application.js +40 -36
  12. package/dist/cli/standalone-cli.d.ts +3 -0
  13. package/dist/cli/standalone-cli.d.ts.map +1 -0
  14. package/dist/cli/standalone-cli.js +65 -0
  15. package/dist/cli/types.d.ts +7 -6
  16. package/dist/cli/types.d.ts.map +1 -1
  17. package/dist/contracts/cli.d.ts +370 -1360
  18. package/dist/contracts/cli.d.ts.map +1 -1
  19. package/dist/contracts/cli.js +58 -65
  20. package/dist/contracts/graph.d.ts +4 -0
  21. package/dist/contracts/graph.d.ts.map +1 -1
  22. package/dist/contracts/graph.js +2 -2
  23. package/dist/evaluation/contracts.d.ts +11 -2
  24. package/dist/evaluation/contracts.d.ts.map +1 -1
  25. package/dist/evaluation/contracts.js +7 -2
  26. package/dist/graph/graph-store.d.ts +3 -1
  27. package/dist/graph/graph-store.d.ts.map +1 -1
  28. package/dist/graph/graph-store.js +48 -2
  29. package/dist/graph/types.d.ts +30 -9
  30. package/dist/graph/types.d.ts.map +1 -1
  31. package/dist/index.d.ts +0 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/package-metadata.d.ts +2 -0
  34. package/dist/package-metadata.d.ts.map +1 -0
  35. package/dist/package-metadata.js +9 -0
  36. package/dist/runtime/sqlite-compatibility-process.d.ts +8 -0
  37. package/dist/runtime/sqlite-compatibility-process.d.ts.map +1 -0
  38. package/dist/runtime/sqlite-compatibility-process.js +20 -0
  39. package/dist/setup/skill-installer.d.ts +19 -0
  40. package/dist/setup/skill-installer.d.ts.map +1 -0
  41. package/dist/setup/skill-installer.js +156 -0
  42. package/dist/world/business-map-projector.d.ts +14 -0
  43. package/dist/world/business-map-projector.d.ts.map +1 -0
  44. package/dist/world/business-map-projector.js +178 -0
  45. package/dist/world/world-graph-query.d.ts +8 -13
  46. package/dist/world/world-graph-query.d.ts.map +1 -1
  47. package/dist/world/world-graph-query.js +26 -229
  48. package/docs/README.md +30 -0
  49. package/docs/architecture/codegraph-backend.md +2 -2
  50. package/docs/architecture/continuous-business-learning.md +240 -0
  51. package/docs/contracts/cli-v1.md +40 -17
  52. package/docs/contracts/graph-model.md +11 -7
  53. package/docs/contracts/graph-patch-v1.md +8 -1
  54. package/docs/evaluation.md +20 -15
  55. package/docs/index.md +41 -0
  56. package/docs/log.md +56 -0
  57. package/docs/product-contract.md +10 -5
  58. package/package.json +1 -1
  59. package/schemas/cli-envelope-v1.schema.json +365 -564
  60. package/schemas/evaluation-run-v1.schema.json +4 -1
@@ -1,5 +1,5 @@
1
1
  import { contentIdentifierSchema } from "../contracts/identifiers.js";
2
- import { businessKeySchema, structuralNodeIdSchema } from "../contracts/graph.js";
2
+ import { businessKeySchema } from "../contracts/graph.js";
3
3
  import { invalidInput } from "./cli-error.js";
4
4
  export function parseCliArguments(arguments_, currentDirectory) {
5
5
  const commandName = identifyCommand(arguments_);
@@ -57,18 +57,21 @@ function parseCommand(arguments_, identified) {
57
57
  if (command === "map") {
58
58
  return parseMap(subcommand, rest);
59
59
  }
60
+ if (command === "code") {
61
+ return parseCode(subcommand, rest);
62
+ }
60
63
  throw invalidInput("The command arguments are invalid.", identified);
61
64
  }
62
65
  function parseMap(subcommand, arguments_) {
63
- if (subcommand === "roots") {
64
- requireNoArguments(arguments_, "map.roots");
65
- return { name: "map.roots" };
66
- }
67
- if (subcommand === "children") {
68
- if (arguments_.length !== 1) {
69
- throw invalidInput("map children requires one node ID.", "map.children");
66
+ if (subcommand === "view") {
67
+ if (arguments_.length > 1) {
68
+ throw invalidInput("map view accepts at most one business key.", "map.view");
70
69
  }
71
- return { name: "map.children", nodeId: requireNodeId(arguments_[0], "map.children") };
70
+ const focusKey = arguments_[0];
71
+ return {
72
+ name: "map.view",
73
+ ...(focusKey === undefined ? {} : { focusKey: requireBusinessKey(focusKey, "map.view") }),
74
+ };
72
75
  }
73
76
  if (subcommand === "search") {
74
77
  const [query, ...options] = arguments_;
@@ -82,18 +85,30 @@ function parseMap(subcommand, arguments_) {
82
85
  };
83
86
  }
84
87
  if (subcommand === "show") {
85
- const [nodeId, ...options] = arguments_;
86
- if (nodeId === undefined) {
87
- throw invalidInput("map show requires one node ID.", "map.show");
88
+ if (arguments_.length !== 1) {
89
+ throw invalidInput("map show requires one business key.", "map.show");
88
90
  }
89
91
  return {
90
92
  name: "map.show",
91
- nodeId: requireNodeId(nodeId, "map.show"),
92
- depth: parsePositiveIntegerOption(options, "--depth", 1, "map.show", 3),
93
+ businessKey: requireBusinessKey(arguments_[0], "map.show"),
93
94
  };
94
95
  }
95
96
  throw invalidInput("The map command is invalid.", identifyMapCommand(subcommand));
96
97
  }
98
+ function parseCode(subcommand, arguments_) {
99
+ if (subcommand === "search") {
100
+ const [query, ...options] = arguments_;
101
+ if (query === undefined || query.trim().length === 0) {
102
+ throw invalidInput("code search requires a structural query.", "code.search");
103
+ }
104
+ return {
105
+ name: "code.search",
106
+ query,
107
+ limit: parsePositiveIntegerOption(options, "--limit", 20, "code.search"),
108
+ };
109
+ }
110
+ throw invalidInput("The code command is invalid.", identifyCodeCommand(subcommand));
111
+ }
97
112
  function parseChanges(arguments_) {
98
113
  let fromSnapshotId;
99
114
  let toSnapshotId;
@@ -134,14 +149,12 @@ function parsePositiveIntegerOption(arguments_, option, defaultValue, command, m
134
149
  }
135
150
  return value;
136
151
  }
137
- function requireNodeId(value, command) {
138
- const structural = structuralNodeIdSchema.safeParse(value);
139
- if (structural.success)
140
- return structural.data;
152
+ function requireBusinessKey(value, command) {
141
153
  const business = businessKeySchema.safeParse(value);
142
- if (business.success)
143
- return business.data;
144
- throw invalidInput("The node ID must be a structural ID or business key.", command);
154
+ if (!business.success) {
155
+ throw invalidInput("Expected a business key.", command);
156
+ }
157
+ return business.data;
145
158
  }
146
159
  function parseSnapshotId(value) {
147
160
  const result = contentIdentifierSchema.safeParse(value);
@@ -161,14 +174,19 @@ function identifyCommand(arguments_) {
161
174
  if (command === "status" || command === "index" || command === "learn" || command === "changes") {
162
175
  return command;
163
176
  }
164
- return command === "map" ? identifyMapCommand(subcommand) : null;
177
+ if (command === "map")
178
+ return identifyMapCommand(subcommand);
179
+ return command === "code" ? identifyCodeCommand(subcommand) : null;
165
180
  }
166
181
  function identifyMapCommand(subcommand) {
167
- if (subcommand === "roots" || subcommand === "children" || subcommand === "search" || subcommand === "show") {
182
+ if (subcommand === "view" || subcommand === "search" || subcommand === "show") {
168
183
  return `map.${subcommand}`;
169
184
  }
170
185
  return null;
171
186
  }
187
+ function identifyCodeCommand(subcommand) {
188
+ return subcommand === "search" ? "code.search" : null;
189
+ }
172
190
  function isDefined(value) {
173
191
  return value !== undefined;
174
192
  }
package/dist/cli/bin.js CHANGED
@@ -1,29 +1,26 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn } from "node:child_process";
3
3
  import { fileURLToPath } from "node:url";
4
+ import { createSqliteCompatibilityArguments, requiresSqliteCompatibilityProcess, } from "../runtime/sqlite-compatibility-process.js";
5
+ import { runStandaloneCli } from "./standalone-cli.js";
4
6
  const arguments_ = process.argv.slice(2);
5
- if (requiresSqliteCompatibilityProcess()) {
7
+ const standaloneExitCode = await runStandaloneCli(arguments_, { stdin: process.stdin, stdout: process.stdout, stderr: process.stderr });
8
+ if (standaloneExitCode !== undefined) {
9
+ process.exitCode = standaloneExitCode;
10
+ }
11
+ else if (requiresSqliteCompatibilityProcess({
12
+ nodeVersion: process.versions.node,
13
+ execArguments: process.execArgv,
14
+ sqliteAvailable: process.getBuiltinModule("node:sqlite") !== undefined,
15
+ })) {
6
16
  process.exitCode = await runWithExperimentalSqlite(arguments_);
7
17
  }
8
18
  else {
9
19
  const { runCli } = await import("./main.js");
10
20
  process.exitCode = await runCli(arguments_, { stdin: process.stdin, stdout: process.stdout, stderr: process.stderr }, process.cwd());
11
21
  }
12
- function requiresSqliteCompatibilityProcess() {
13
- const nodeMajor = Number.parseInt(process.versions.node, 10);
14
- const warningAlreadyDisabled = process.execArgv.some((argument) => (argument === "--no-warnings"
15
- || argument === "--disable-warning=ExperimentalWarning"));
16
- if (nodeMajor < 24 && !warningAlreadyDisabled)
17
- return true;
18
- return process.getBuiltinModule("node:sqlite") === undefined;
19
- }
20
22
  async function runWithExperimentalSqlite(arguments_) {
21
- const child = spawn(process.execPath, [
22
- "--experimental-sqlite",
23
- "--disable-warning=ExperimentalWarning",
24
- fileURLToPath(import.meta.url),
25
- ...arguments_,
26
- ], { stdio: "inherit" });
23
+ const child = spawn(process.execPath, createSqliteCompatibilityArguments(fileURLToPath(import.meta.url), arguments_), { stdio: "inherit" });
27
24
  return new Promise((resolve, reject) => {
28
25
  child.once("error", reject);
29
26
  child.once("close", (code) => resolve(code ?? 1));
@@ -26,9 +26,9 @@ export declare class CliApplication {
26
26
  };
27
27
  private status;
28
28
  private index;
29
- private mapRoots;
30
- private mapChildren;
29
+ private mapView;
31
30
  private mapSearch;
31
+ private codeSearch;
32
32
  private mapShow;
33
33
  private learn;
34
34
  private changes;
@@ -1 +1 @@
1
- {"version":3,"file":"cli-application.d.ts","sourceRoot":"","sources":["../../src/cli/cli-application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAK1E,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,8CAA8C,CAAC;AAItD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,w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AAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAoCjF,OAAO,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAqBzF,QAAQ,CACN,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,iBAAiB,GACzB,WAAW;IAYd,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG;QAC3C,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;QAC/C,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;KAC5C;IAOD,OAAO,CAAC,MAAM;YAwBA,KAAK;YAsDL,OAAO;YAmBP,SAAS;YAWT,UAAU;YAgBV,OAAO;YAiBP,KAAK;IAwBnB,OAAO,CAAC,OAAO;IAuCf,OAAO,CAAC,qBAAqB;IAS7B,OAAO,CAAC,mBAAmB;CAW5B"}
@@ -117,14 +117,14 @@ export class CliApplication {
117
117
  return this.status(context);
118
118
  case "index":
119
119
  return this.index(context);
120
- case "map.roots":
121
- return this.mapRoots(context);
122
- case "map.children":
123
- return this.mapChildren(command.nodeId, context);
120
+ case "map.view":
121
+ return this.mapView(command.focusKey, context);
124
122
  case "map.search":
125
123
  return this.mapSearch(command.query, command.limit, context);
126
124
  case "map.show":
127
- return this.mapShow(command.nodeId, command.depth, context);
125
+ return this.mapShow(command.businessKey, context);
126
+ case "code.search":
127
+ return this.codeSearch(command.query, command.limit, context);
128
128
  case "learn":
129
129
  return this.learn(context);
130
130
  case "changes":
@@ -216,13 +216,22 @@ export class CliApplication {
216
216
  warnings,
217
217
  };
218
218
  }
219
- async mapRoots(context) {
219
+ async mapView(focusKey, context) {
220
220
  const env_2 = { stack: [], error: void 0, hasError: false };
221
221
  try {
222
- this.requireCurrentWorld(context, "map.roots");
222
+ this.requireCurrentWorld(context, "map.view");
223
223
  const query = __addDisposableResource(env_2, new WorldGraphQuery(context.repository), false);
224
- const nodes = await query.roots();
225
- return mapResult({ command: "map.roots", nodes }, context.languages);
224
+ const view = await query.view(focusKey);
225
+ if (view === undefined) {
226
+ throw invalidInput(`Business node ${focusKey} was not found.`, "map.view");
227
+ }
228
+ const warnings = view.focus === null && view.regions.length === 0
229
+ ? [{
230
+ code: "BUSINESS_KNOWLEDGE_EMPTY",
231
+ message: "No business knowledge has been learned from engineering work yet.",
232
+ }]
233
+ : [];
234
+ return mapResult({ command: "map.view", ...view }, context.languages, warnings);
226
235
  }
227
236
  catch (e_2) {
228
237
  env_2.error = e_2;
@@ -232,17 +241,13 @@ export class CliApplication {
232
241
  __disposeResources(env_2);
233
242
  }
234
243
  }
235
- async mapChildren(nodeId, context) {
244
+ async mapSearch(lexicalQuery, limit, context) {
236
245
  const env_3 = { stack: [], error: void 0, hasError: false };
237
246
  try {
238
- this.requireCurrentWorld(context, "map.children");
247
+ this.requireCurrentWorld(context, "map.search");
239
248
  const query = __addDisposableResource(env_3, new WorldGraphQuery(context.repository), false);
240
- const reference = nodeReference(nodeId);
241
- const children = await query.children(reference);
242
- if (children === undefined) {
243
- throw invalidInput(`Map node ${nodeId} was not found.`, "map.children");
244
- }
245
- return mapResult({ command: "map.children", nodeId, children }, context.languages);
249
+ const results = await query.searchBusiness(lexicalQuery, { limit });
250
+ return mapResult({ command: "map.search", query: lexicalQuery, limit, results }, context.languages);
246
251
  }
247
252
  catch (e_3) {
248
253
  env_3.error = e_3;
@@ -252,13 +257,18 @@ export class CliApplication {
252
257
  __disposeResources(env_3);
253
258
  }
254
259
  }
255
- async mapSearch(lexicalQuery, limit, context) {
260
+ async codeSearch(structuralQuery, limit, context) {
256
261
  const env_4 = { stack: [], error: void 0, hasError: false };
257
262
  try {
258
- this.requireCurrentWorld(context, "map.search");
263
+ this.requireCurrentWorld(context, "code.search");
259
264
  const query = __addDisposableResource(env_4, new WorldGraphQuery(context.repository), false);
260
- const results = await query.search(lexicalQuery, { limit });
261
- return mapResult({ command: "map.search", query: lexicalQuery, limit, results }, context.languages);
265
+ const results = await query.searchCode(structuralQuery, { limit });
266
+ return mapResult({
267
+ command: "code.search",
268
+ query: structuralQuery,
269
+ limit,
270
+ results,
271
+ }, context.languages);
262
272
  }
263
273
  catch (e_4) {
264
274
  env_4.error = e_4;
@@ -268,23 +278,19 @@ export class CliApplication {
268
278
  __disposeResources(env_4);
269
279
  }
270
280
  }
271
- async mapShow(nodeId, depth, context) {
281
+ async mapShow(businessKey, context) {
272
282
  const env_5 = { stack: [], error: void 0, hasError: false };
273
283
  try {
274
284
  this.requireCurrentWorld(context, "map.show");
275
285
  const query = __addDisposableResource(env_5, new WorldGraphQuery(context.repository), false);
276
- const view = await query.show(nodeReference(nodeId), { maxDepth: depth });
286
+ const view = await query.showBusiness(businessKey);
277
287
  if (view === undefined) {
278
- throw invalidInput(`Map node ${nodeId} was not found.`, "map.show");
288
+ throw invalidInput(`Business node ${businessKey} was not found.`, "map.show");
279
289
  }
280
290
  return mapResult({
281
291
  command: "map.show",
282
292
  node: view.node,
283
- depth: view.depth,
284
- neighbors: view.neighbors.map(presentNeighbor),
285
- invariants: view.invariants,
286
- tests: view.tests,
287
- unknowns: view.unknowns,
293
+ relations: view.relations.map(presentNeighbor),
288
294
  }, context.languages);
289
295
  }
290
296
  catch (e_5) {
@@ -457,8 +463,11 @@ function unsupportedLanguageWarnings(languages) {
457
463
  ? [{ code: "UNSUPPORTED_LANGUAGE", message: language.reason, details: { language: language.language } }]
458
464
  : []));
459
465
  }
460
- function mapResult(data, languages) {
461
- const warnings = unsupportedLanguageWarnings(languages);
466
+ function mapResult(data, languages, additionalWarnings = []) {
467
+ const warnings = [
468
+ ...unsupportedLanguageWarnings(languages),
469
+ ...additionalWarnings,
470
+ ];
462
471
  if (containsUnknown(data)) {
463
472
  warnings.push({ code: "UNKNOWN_BOUNDARY", message: "The result contains unresolved structural behavior." });
464
473
  }
@@ -479,11 +488,6 @@ function presentNeighbor(neighbor) {
479
488
  depth: neighbor.depth,
480
489
  };
481
490
  }
482
- function nodeReference(nodeId) {
483
- return /^(?:repository|module|file|symbol|test|unknown):/u.test(nodeId)
484
- ? { domain: "structural", id: nodeId }
485
- : { domain: "business", key: nodeId };
486
- }
487
491
  function containsUnknown(data) {
488
492
  return JSON.stringify(data).includes('"validity":"unknown"');
489
493
  }
@@ -0,0 +1,3 @@
1
+ import type { CliIo } from "./types.js";
2
+ export declare function runStandaloneCli(arguments_: readonly string[], io: CliIo): Promise<number | undefined>;
3
+ //# sourceMappingURL=standalone-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standalone-cli.d.ts","sourceRoot":"","sources":["../../src/cli/standalone-cli.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAwBxC,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,EAAE,EAAE,KAAK,GACR,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkC7B"}
@@ -0,0 +1,65 @@
1
+ import { readPackageVersion } from "../package-metadata.js";
2
+ import { SkillInstaller } from "../setup/skill-installer.js";
3
+ const helpText = `Usage: semantic-atlas <command> [options]
4
+
5
+ Project understanding:
6
+ status Report Atlas state and freshness
7
+ index Publish the current project world
8
+ map view [business-key] View or zoom into business regions
9
+ map search <business-term> Search learned business vocabulary
10
+ map show <business-key> Show one business concept and evidence
11
+ code search <structural-term> Find bounded structural source evidence
12
+ learn --stdin Apply one GraphPatch JSON value
13
+ changes [--from id] [--to id] Report semantic changes
14
+
15
+ Installation and information:
16
+ setup Install or update the bundled user Skill
17
+ -h, --help Show this help
18
+ --version Print the installed package version
19
+
20
+ Global project options:
21
+ --repo <path> Select a Git worktree (default: cwd)
22
+ --pretty Indent JSON project-command output
23
+ `;
24
+ export async function runStandaloneCli(arguments_, io) {
25
+ const [command, ...rest] = arguments_;
26
+ if (command === "help" || command === "--help" || command === "-h") {
27
+ return writeArgumentFreeResult(rest, io, () => helpText);
28
+ }
29
+ if (command === "version" || command === "--version" || command === "-v") {
30
+ return writeArgumentFreeResult(rest, io, async () => `${await readPackageVersion()}\n`);
31
+ }
32
+ if (command === "setup") {
33
+ if (rest.length > 0) {
34
+ io.stderr.write("semantic-atlas setup does not accept arguments.\n");
35
+ return 2;
36
+ }
37
+ try {
38
+ const version = await readPackageVersion();
39
+ const result = await new SkillInstaller({ version }).install();
40
+ const action = result.outcome === "current"
41
+ ? "Semantic Atlas Skill is already current at"
42
+ : result.outcome === "installed"
43
+ ? "Installed Semantic Atlas Skill at"
44
+ : "Updated Semantic Atlas Skill at";
45
+ io.stdout.write(`${action} ${result.targetDirectory}\n`);
46
+ for (const directory of result.removedLegacyDirectories) {
47
+ io.stdout.write(`Removed legacy Semantic Atlas Skill at ${directory}\n`);
48
+ }
49
+ return 0;
50
+ }
51
+ catch (error) {
52
+ io.stderr.write(`Semantic Atlas setup failed: ${error instanceof Error ? error.message : String(error)}\n`);
53
+ return 1;
54
+ }
55
+ }
56
+ return undefined;
57
+ }
58
+ async function writeArgumentFreeResult(rest, io, contents) {
59
+ if (rest.length > 0) {
60
+ io.stderr.write("The command does not accept arguments.\n");
61
+ return 2;
62
+ }
63
+ io.stdout.write(await contents());
64
+ return 0;
65
+ }
@@ -5,18 +5,19 @@ export type ParsedCommand = {
5
5
  } | {
6
6
  readonly name: "index";
7
7
  } | {
8
- readonly name: "map.roots";
9
- } | {
10
- readonly name: "map.children";
11
- readonly nodeId: string;
8
+ readonly name: "map.view";
9
+ readonly focusKey?: string;
12
10
  } | {
13
11
  readonly name: "map.search";
14
12
  readonly query: string;
15
13
  readonly limit: number;
16
14
  } | {
17
15
  readonly name: "map.show";
18
- readonly nodeId: string;
19
- readonly depth: number;
16
+ readonly businessKey: string;
17
+ } | {
18
+ readonly name: "code.search";
19
+ readonly query: string;
20
+ readonly limit: number;
20
21
  } | {
21
22
  readonly name: "learn";
22
23
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../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