yarramate 0.18.0 → 0.19.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 (65) hide show
  1. package/README.md +2 -1
  2. package/catalogues/core-enrichment.yaml +52 -1
  3. package/dist/adapters/graphify-cli.js +0 -0
  4. package/dist/adapters/likec4-cli.js +0 -0
  5. package/dist/adapters/mcp-cli.js +0 -0
  6. package/dist/adapters/visual/client.js +0 -1
  7. package/dist/adapters/visual/protocol-contract.d.ts +118 -35
  8. package/dist/adapters/visual/protocol-contract.js +1 -11
  9. package/dist/adapters/visual/protocol.d.ts +8 -1
  10. package/dist/adapters/visual/protocol.js +86 -46
  11. package/dist/adapters/visual/request.d.ts +37 -0
  12. package/dist/adapters/visual/request.js +131 -0
  13. package/dist/adapters/visual/session-server.d.ts +12 -14
  14. package/dist/adapters/visual/session-server.js +641 -283
  15. package/dist/adapters/visual/session-store.d.ts +28 -28
  16. package/dist/adapters/visual/session-store.js +32 -93
  17. package/dist/adapters/visual/wire.d.ts +36 -10
  18. package/dist/adapters/visual-cli.d.ts +3 -0
  19. package/dist/adapters/visual-cli.js +66 -1
  20. package/dist/apply-command.d.ts +10 -0
  21. package/dist/apply-command.js +399 -247
  22. package/dist/cli.js +0 -0
  23. package/dist/compiler.d.ts +13 -0
  24. package/dist/compiler.js +36 -2
  25. package/dist/graph-projection.d.ts +62 -0
  26. package/dist/graph-projection.js +222 -0
  27. package/dist/interrogate-command.d.ts +2 -0
  28. package/dist/interrogate-command.js +22 -0
  29. package/dist/kind-label.d.ts +8 -0
  30. package/dist/kind-label.js +8 -0
  31. package/dist/operations.d.ts +139 -0
  32. package/dist/operations.js +11 -0
  33. package/dist/projection.d.ts +2 -0
  34. package/dist/projection.js +8 -2
  35. package/dist/reconciliation.js +8 -7
  36. package/dist/source-document.d.ts +10 -0
  37. package/dist/source-document.js +21 -1
  38. package/dist/visual-app/assets/index-6oSR9RGM.js +354 -0
  39. package/dist/visual-app/assets/index-dwA9AOr5.css +1 -0
  40. package/dist/visual-app/index.html +2 -2
  41. package/docs/CONSUMING-YARRAMATE.md +25 -19
  42. package/package.json +6 -1
  43. package/schema/yarramate-adapter-mapping.schema.json +1 -1
  44. package/schema/yarramate-apply-result.schema.json +8 -2
  45. package/schema/yarramate-document.schema.json +1 -1
  46. package/schema/yarramate-operations.schema.json +203 -1
  47. package/schema/yarramate-projection.schema.json +12 -3
  48. package/schema/yarramate-question-catalogue.schema.json +15 -2
  49. package/schema/yarramate-visual-event.schema.json +143 -0
  50. package/schema/yarramate-visual-graph.schema.json +272 -0
  51. package/schema/yarramate-visual-layout.schema.json +41 -0
  52. package/schema/yarramate-visual-model.schema.json +6 -44
  53. package/schema/yarramate-visual-response.schema.json +170 -19
  54. package/schema/yarramate-visual-session-descriptor.schema.json +1 -1
  55. package/schema/yarramate-visual-session-request.schema.json +0 -70
  56. package/schema/yarramate-visual-session-started.schema.json +2 -9
  57. package/schema/yarramate-visual-status.schema.json +3 -2
  58. package/skills/yarramate-architecture/SKILL.md +20 -13
  59. package/skills/yarramate-architecture/references/journey-checklists.md +4 -2
  60. package/skills/yarramate-architecture/references/native-authoring.md +30 -0
  61. package/skills/yarramate-architecture/references/visual-conversations.md +149 -150
  62. package/dist/adapters/visual/likec4-compiler.d.ts +0 -55
  63. package/dist/adapters/visual/likec4-compiler.js +0 -460
  64. package/dist/visual-app/assets/index-CGvC8e3R.css +0 -1
  65. package/dist/visual-app/assets/index-CXuW1tOj.js +0 -209
@@ -1,4 +1,4 @@
1
- import { ATTESTATION_PREDICATE_PREFIX, parseAttestationClaimValue, } from './compiler.js';
1
+ import { ATTESTATION_PREDICATE_PREFIX, parseAttestationClaimValue, parseConstraintExpectsValue, } from './compiler.js';
2
2
  const assertedRelationshipsByClaim = (graph) => {
3
3
  const asserted = new Map();
4
4
  if (graph === undefined)
@@ -30,7 +30,8 @@ export const constraintExpectsPredicate = 'yarramate/constraint/expects';
30
30
  // A finding is now a union (ADR 0074); only the evidence arm can carry an
31
31
  // expectation, so ordering reads it through one narrowing helper.
32
32
  const expectationOf = (finding) => 'expectation' in finding ? finding.expectation : undefined;
33
- // Mirrors the compiler encoding (ADR 0075). Provider and key admit no
33
+ // The compiler's parseConstraintExpectsValue is the sole authority for
34
+ // decoding the encoded value (ADR 0075). Provider and key admit no
34
35
  // whitespace, so the first two spaces delimit them and everything after the
35
36
  // second space is the expected value verbatim, spaces included.
36
37
  const parseExpectation = (claim) => {
@@ -38,15 +39,15 @@ const parseExpectation = (claim) => {
38
39
  !('value' in claim.object)) {
39
40
  return undefined;
40
41
  }
41
- const match = /^(\S+) (\S+) ([\s\S]+)$/.exec(claim.object.value);
42
- if (match === null)
42
+ const parts = parseConstraintExpectsValue(claim.object.value);
43
+ if (parts === undefined)
43
44
  return undefined;
44
45
  return {
45
46
  claim: claim.id,
46
47
  subject: claim.subject,
47
- provider: match[1],
48
- key: match[2],
49
- expected: match[3],
48
+ provider: parts.provider,
49
+ key: parts.key,
50
+ expected: parts.value,
50
51
  declared: {
51
52
  document: claim.source.document,
52
53
  path: claim.source.path,
@@ -21,6 +21,16 @@ export type SourceDocumentResult<T> = {
21
21
  };
22
22
  export declare const diagnosticOrder: (left: Diagnostic, right: Diagnostic) => number;
23
23
  export declare const describeSchemaViolation: (error: Pick<ErrorObject, 'keyword' | 'message' | 'params'>) => string;
24
+ /**
25
+ * The errors worth reading, in the order Ajv found them.
26
+ *
27
+ * A discriminated union raises two errors when the tag itself is missing or
28
+ * mistyped: the `required`/`type` fault that names the property, and a
29
+ * `discriminator` row restating it. The second says nothing the first did not,
30
+ * so it is dropped. A tag that is present but names no branch keeps its row -
31
+ * that one is the only report of the fault.
32
+ */
33
+ export declare const readableSchemaErrors: <T extends Pick<ErrorObject, 'keyword' | 'params'>>(errors: readonly T[]) => readonly T[];
24
34
  export declare const closestCandidate: (value: string, candidates: Iterable<string>) => string | undefined;
25
35
  export declare function locateSourcePath(sourcePath: string, yaml: ReturnType<typeof parseDocument>, lineCounter: LineCounter, yamlPath: readonly (string | number)[], pointer: string): SourceLocation;
26
36
  export declare function loadSourceDocument<T>(source: WorkspaceSource, validate: ValidateFunction, schemaLabel: string): SourceDocumentResult<T>;
@@ -18,8 +18,28 @@ export const describeSchemaViolation = (error) => {
18
18
  .join(', ');
19
19
  return `${base}: ${shown}${allowed.length > 8 ? ', …' : ''}`;
20
20
  }
21
+ // The one pattern in these schemas that is a rule rather than a shape:
22
+ // `must match pattern "\S"` names the regex, not what the author did wrong.
23
+ if (error.keyword === 'pattern' && error.params.pattern === '\\S') {
24
+ return 'must not be blank';
25
+ }
26
+ // A tag naming no branch reads as a search failure ("must be in oneOf").
27
+ // Say what was named instead, since that is the value to correct.
28
+ if (error.keyword === 'discriminator' && error.params.error === 'mapping') {
29
+ return `unknown ${JSON.stringify(error.params.tag)} value ${JSON.stringify(error.params.tagValue)}`;
30
+ }
21
31
  return base;
22
32
  };
33
+ /**
34
+ * The errors worth reading, in the order Ajv found them.
35
+ *
36
+ * A discriminated union raises two errors when the tag itself is missing or
37
+ * mistyped: the `required`/`type` fault that names the property, and a
38
+ * `discriminator` row restating it. The second says nothing the first did not,
39
+ * so it is dropped. A tag that is present but names no branch keeps its row -
40
+ * that one is the only report of the fault.
41
+ */
42
+ export const readableSchemaErrors = (errors) => errors.filter((error) => error.keyword !== 'discriminator' || error.params.error === 'mapping');
23
43
  const editDistance = (left, right) => {
24
44
  const previous = Array.from({ length: right.length + 1 }, (_, index) => index);
25
45
  for (let i = 1; i <= left.length; i += 1) {
@@ -86,7 +106,7 @@ export function loadSourceDocument(source, validate, schemaLabel) {
86
106
  if (!validate(value)) {
87
107
  return {
88
108
  ok: false,
89
- diagnostics: (validate.errors ?? [])
109
+ diagnostics: readableSchemaErrors(validate.errors ?? [])
90
110
  .map((error) => {
91
111
  const property = error.keyword === 'additionalProperties'
92
112
  ? String(error.params.additionalProperty)