@suss/ir-core 0.19.0 → 0.21.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.
package/dist/schemas.cjs CHANGED
@@ -40,10 +40,10 @@ __export(schemas_exports, {
40
40
  withDefinitionsInlined: () => withDefinitionsInlined
41
41
  });
42
42
  module.exports = __toCommonJS(schemas_exports);
43
- var import_zod11 = require("zod");
43
+ var import_zod12 = require("zod");
44
44
 
45
45
  // src/semantics/registry.ts
46
- var import_zod10 = require("zod");
46
+ var import_zod11 = require("zod");
47
47
 
48
48
  // src/semantics/functionCall.ts
49
49
  var import_zod = require("zod");
@@ -58,6 +58,9 @@ function fnIdentityKey(packageName, exportPath) {
58
58
  function busIdentityKey(messageBus, subject) {
59
59
  return `bus:${messageBus} ${subject}`;
60
60
  }
61
+ function unitIdentityKey(deploymentTarget, instanceName) {
62
+ return `unit:${deploymentTarget} ${instanceName}`;
63
+ }
61
64
  function metricIdentityKey(metricSystem, metricType) {
62
65
  return `metric:${metricSystem} ${metricType}`;
63
66
  }
@@ -116,14 +119,24 @@ var functionCallSemantics = defineBoundarySemantics({
116
119
  */
117
120
  canPair: () => true,
118
121
  /**
119
- * `"fn:<package>::<exportPath>"` when both are set. Other in-process
120
- * function-call units, such as components and bare handlers inside
121
- * one repo, have no key at all.
122
+ * `"fn:<package>::<exportPath>"` when both are set, and
123
+ * `"fn:<module>::<exportName>"` for an in-repo unit that states its
124
+ * module, the way a server action does. Components and bare
125
+ * handlers state neither and have no key at all.
122
126
  */
127
+ rewritePaths(semantics, rewrite) {
128
+ if (semantics.module === void 0) {
129
+ return semantics;
130
+ }
131
+ return { ...semantics, module: rewrite(semantics.module) };
132
+ },
123
133
  identityKey(semantics) {
124
134
  if (semantics.package !== void 0 && semantics.exportPath !== void 0 && semantics.exportPath.length > 0) {
125
135
  return fnIdentityKey(semantics.package, semantics.exportPath);
126
136
  }
137
+ if (semantics.module !== void 0 && semantics.exportName !== void 0) {
138
+ return fnIdentityKey(semantics.module, [semantics.exportName]);
139
+ }
127
140
  return null;
128
141
  }
129
142
  }
@@ -487,6 +500,14 @@ var restSemantics = defineBoundarySemantics({
487
500
  }
488
501
  return routePathAdmits(semantics.path, path) ? "match" : "nomatch";
489
502
  },
503
+ /**
504
+ * A route the registration pattern admits is inside it. A route
505
+ * whose path this source never gave is left outside, because
506
+ * nothing here can show it is one the pattern covers.
507
+ */
508
+ withinScope(semantics, scope) {
509
+ return semantics.path !== null && routePathAdmits(scope, semantics.path);
510
+ },
490
511
  /**
491
512
  * A call whose base URL the deployment fills in, resolved to the
492
513
  * path it reaches.
@@ -619,12 +640,70 @@ var storageSemantics = defineBoundarySemantics({
619
640
  /** A query returns rows or items, not a status and a body. */
620
641
  exchangesHttpResponses: false,
621
642
  reportsUnpairedItself: false,
622
- identityKey: () => null
643
+ identityKey: () => null,
644
+ displayLabel: storageLabel
645
+ }
646
+ });
647
+ function storageLabel(semantics) {
648
+ return `${semantics.storageSystem}:${storageContainerLabel(semantics)}`;
649
+ }
650
+ function storageContainerLabel(semantics) {
651
+ const container = semantics.container ?? "<unnamed container>";
652
+ const addressed = semantics.accessPath === null ? container : `${container}#${semantics.accessPath}`;
653
+ return semantics.scope === "default" ? addressed : `${semantics.scope}/${addressed}`;
654
+ }
655
+
656
+ // src/semantics/unitInvocation.ts
657
+ var import_zod10 = require("zod");
658
+ var UnitInvocationSemanticsSchema = DeployableUnitSchema.extend({
659
+ name: import_zod10.z.literal("unit-invocation"),
660
+ instanceName: DeployableUnitSchema.shape.instanceName.nullable()
661
+ });
662
+ var unitInvocationSemantics = defineBoundarySemantics({
663
+ name: "unit-invocation",
664
+ schema: UnitInvocationSemanticsSchema,
665
+ // faas.name is the deployed function's own name and instanceName is
666
+ // the deployment template's logical id, which is a different string.
667
+ // Runtime config leaves the pair off for the same reason.
668
+ semconv: {},
669
+ behavior: {
670
+ /**
671
+ * A synchronous invoke gives back whatever the handler returned,
672
+ * which is a value rather than a status and a body. A handler's
673
+ * return only becomes an HTTP response under a proxy integration,
674
+ * and that route gets a REST binding instead of this one.
675
+ */
676
+ exchangesHttpResponses: false,
677
+ /**
678
+ * A unit nothing in the run invokes is the ordinary case, since
679
+ * most services are reached from a stack suss never read. So an
680
+ * uninvoked unit stays in the generic unmatched list rather than
681
+ * being reported as a problem here.
682
+ */
683
+ reportsUnpairedItself: false,
684
+ identityKey(semantics) {
685
+ if (semantics.instanceName === null) {
686
+ return null;
687
+ }
688
+ return unitIdentityKey(
689
+ semantics.deploymentTarget,
690
+ semantics.instanceName
691
+ );
692
+ },
693
+ displayLabel(semantics) {
694
+ if (semantics.instanceName === null) {
695
+ return `unit:${semantics.deploymentTarget} (named at runtime)`;
696
+ }
697
+ return unitIdentityKey(
698
+ semantics.deploymentTarget,
699
+ semantics.instanceName
700
+ );
701
+ }
623
702
  }
624
703
  });
625
704
 
626
705
  // src/semantics/registry.ts
627
- var SemanticsSchema = import_zod10.z.discriminatedUnion("name", [
706
+ var SemanticsSchema = import_zod11.z.discriminatedUnion("name", [
628
707
  restSemantics.schema,
629
708
  functionCallSemantics.schema,
630
709
  graphqlResolverSemantics.schema,
@@ -632,7 +711,8 @@ var SemanticsSchema = import_zod10.z.discriminatedUnion("name", [
632
711
  runtimeConfigSemantics.schema,
633
712
  storageSemantics.schema,
634
713
  messageBusSemantics.schema,
635
- metricSemantics.schema
714
+ metricSemantics.schema,
715
+ unitInvocationSemantics.schema
636
716
  ]);
637
717
  var DEFINITIONS = [
638
718
  restSemantics,
@@ -642,38 +722,48 @@ var DEFINITIONS = [
642
722
  runtimeConfigSemantics,
643
723
  storageSemantics,
644
724
  messageBusSemantics,
645
- metricSemantics
725
+ metricSemantics,
726
+ unitInvocationSemantics
646
727
  ];
647
728
  var BY_NAME = new Map(
648
729
  DEFINITIONS.map((d) => [d.name, d])
649
730
  );
650
731
 
651
732
  // src/schemas.ts
652
- var ConfidenceSourceSchema = import_zod11.z.enum([
733
+ var ConfidenceSourceSchema = import_zod12.z.enum([
653
734
  "inferred_static",
654
735
  "inferred_ai",
655
736
  "declared",
656
737
  "derived"
657
738
  ]);
658
- var ConfidenceLevelSchema = import_zod11.z.enum(["high", "medium", "low"]);
659
- var CorroborationSchema = import_zod11.z.object({
660
- outcome: import_zod11.z.enum(["observed", "refuted", "untested"]),
739
+ var ConfidenceLevelSchema = import_zod12.z.enum(["high", "medium", "low"]);
740
+ var CorroborationSchema = import_zod12.z.object({
741
+ outcome: import_zod12.z.enum(["observed", "refuted", "untested"]),
661
742
  /** Executions that produced a verdict for this claim. */
662
- runs: import_zod11.z.number(),
743
+ runs: import_zod12.z.number(),
663
744
  /** Present when refuted: the input and observation that disagreed. */
664
- counterexample: import_zod11.z.unknown().optional(),
745
+ counterexample: import_zod12.z.unknown().optional(),
665
746
  /** Present when untested: why no verdict was reachable. */
666
- reason: import_zod11.z.string().optional()
747
+ reason: import_zod12.z.string().optional()
667
748
  });
668
- var ConfidenceInfoSchema = import_zod11.z.object({
749
+ var ConfidenceInfoSchema = import_zod12.z.object({
669
750
  source: ConfidenceSourceSchema,
670
751
  level: ConfidenceLevelSchema,
671
752
  corroboration: CorroborationSchema.optional()
672
753
  });
673
- var SourceLocationSchema = import_zod11.z.object({
674
- file: import_zod11.z.string(),
675
- range: import_zod11.z.object({ start: import_zod11.z.number(), end: import_zod11.z.number() }),
676
- exportName: import_zod11.z.string().nullable(),
754
+ var SourceLocationSchema = import_zod12.z.object({
755
+ file: import_zod12.z.string(),
756
+ /** Line numbers, for a person reading the summary or an editor link. */
757
+ range: import_zod12.z.object({ start: import_zod12.z.number(), end: import_zod12.z.number() }),
758
+ /**
759
+ * Character offsets of the unit in its file. Identity and joins
760
+ * measure with these, since two functions can share a line and never
761
+ * an offset range; the line `range` above is the presentation of the
762
+ * same place. Absent on summaries no source position backs, a
763
+ * contract artifact's say.
764
+ */
765
+ span: import_zod12.z.object({ start: import_zod12.z.number(), end: import_zod12.z.number() }).optional(),
766
+ exportName: import_zod12.z.string().nullable(),
677
767
  /**
678
768
  * The project the extract was pointed at, by the name that project
679
769
  * calls itself.
@@ -683,47 +773,47 @@ var SourceLocationSchema = import_zod11.z.object({
683
773
  * summaries puts them on top of each other. This field is what tells
684
774
  * them apart, and what a reader groups by.
685
775
  */
686
- workspace: import_zod11.z.string().optional()
776
+ workspace: import_zod12.z.string().optional()
687
777
  });
688
- var BoundaryBindingSchema = import_zod11.z.object({
689
- transport: import_zod11.z.string(),
778
+ var BoundaryBindingSchema = import_zod12.z.object({
779
+ transport: import_zod12.z.string(),
690
780
  semantics: SemanticsSchema,
691
- recognition: import_zod11.z.string()
781
+ recognition: import_zod12.z.string()
692
782
  });
693
783
  function typeDefinitionKey(ref) {
694
784
  return ref.def ?? null;
695
785
  }
696
- var TypeShapeSchema = import_zod11.z.lazy(
697
- () => import_zod11.z.discriminatedUnion("type", [
698
- import_zod11.z.object({
699
- type: import_zod11.z.literal("record"),
700
- properties: import_zod11.z.record(import_zod11.z.string(), TypeShapeSchema),
701
- spreads: import_zod11.z.array(import_zod11.z.object({ sourceText: import_zod11.z.string() })).optional()
786
+ var TypeShapeSchema = import_zod12.z.lazy(
787
+ () => import_zod12.z.discriminatedUnion("type", [
788
+ import_zod12.z.object({
789
+ type: import_zod12.z.literal("record"),
790
+ properties: import_zod12.z.record(import_zod12.z.string(), TypeShapeSchema),
791
+ spreads: import_zod12.z.array(import_zod12.z.object({ sourceText: import_zod12.z.string() })).optional()
702
792
  }),
703
- import_zod11.z.object({ type: import_zod11.z.literal("dictionary"), values: TypeShapeSchema }),
704
- import_zod11.z.object({ type: import_zod11.z.literal("array"), items: TypeShapeSchema }),
705
- import_zod11.z.object({
706
- type: import_zod11.z.literal("literal"),
707
- value: import_zod11.z.union([import_zod11.z.string(), import_zod11.z.number(), import_zod11.z.boolean()]),
708
- raw: import_zod11.z.string().optional()
793
+ import_zod12.z.object({ type: import_zod12.z.literal("dictionary"), values: TypeShapeSchema }),
794
+ import_zod12.z.object({ type: import_zod12.z.literal("array"), items: TypeShapeSchema }),
795
+ import_zod12.z.object({
796
+ type: import_zod12.z.literal("literal"),
797
+ value: import_zod12.z.union([import_zod12.z.string(), import_zod12.z.number(), import_zod12.z.boolean()]),
798
+ raw: import_zod12.z.string().optional()
709
799
  }),
710
- import_zod11.z.object({ type: import_zod11.z.literal("text") }),
711
- import_zod11.z.object({ type: import_zod11.z.literal("integer") }),
712
- import_zod11.z.object({ type: import_zod11.z.literal("number") }),
713
- import_zod11.z.object({ type: import_zod11.z.literal("boolean") }),
714
- import_zod11.z.object({ type: import_zod11.z.literal("null") }),
715
- import_zod11.z.object({ type: import_zod11.z.literal("undefined") }),
716
- import_zod11.z.object({
717
- type: import_zod11.z.literal("union"),
718
- variants: import_zod11.z.array(TypeShapeSchema)
800
+ import_zod12.z.object({ type: import_zod12.z.literal("text") }),
801
+ import_zod12.z.object({ type: import_zod12.z.literal("integer") }),
802
+ import_zod12.z.object({ type: import_zod12.z.literal("number") }),
803
+ import_zod12.z.object({ type: import_zod12.z.literal("boolean") }),
804
+ import_zod12.z.object({ type: import_zod12.z.literal("null") }),
805
+ import_zod12.z.object({ type: import_zod12.z.literal("undefined") }),
806
+ import_zod12.z.object({
807
+ type: import_zod12.z.literal("union"),
808
+ variants: import_zod12.z.array(TypeShapeSchema)
719
809
  }),
720
- import_zod11.z.object({
721
- type: import_zod11.z.literal("ref"),
722
- name: import_zod11.z.string(),
723
- from: import_zod11.z.string().optional(),
724
- def: import_zod11.z.string().optional()
810
+ import_zod12.z.object({
811
+ type: import_zod12.z.literal("ref"),
812
+ name: import_zod12.z.string(),
813
+ from: import_zod12.z.string().optional(),
814
+ def: import_zod12.z.string().optional()
725
815
  }),
726
- import_zod11.z.object({ type: import_zod11.z.literal("unknown") })
816
+ import_zod12.z.object({ type: import_zod12.z.literal("unknown") })
727
817
  ])
728
818
  );
729
819
  var MAX_DEFINITION_DEPTH = 6;
@@ -1,2 +1,2 @@
1
1
  import 'zod';
2
- export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, f as DeployableUnitSchema, g as FunctionCallSemanticsSchema, h as GraphqlOperationSemanticsSchema, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, l as RestSemanticsSchema, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, d as SourceLocationSchema, q as StorageSemanticsSchema, T as TypeShape, r as TypeShapeSchema, x as typeDefinitionKey, y as withDefinitionsInlined } from './schemas-k-169oiY.cjs';
2
+ export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, f as DeployableUnitSchema, g as FunctionCallSemanticsSchema, h as GraphqlOperationSemanticsSchema, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, l as RestSemanticsSchema, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, d as SourceLocationSchema, q as StorageSemanticsSchema, T as TypeShape, r as TypeShapeSchema, z as typeDefinitionKey, A as withDefinitionsInlined } from './schemas-Dn1AzzWd.cjs';
package/dist/schemas.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import 'zod';
2
- export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, f as DeployableUnitSchema, g as FunctionCallSemanticsSchema, h as GraphqlOperationSemanticsSchema, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, l as RestSemanticsSchema, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, d as SourceLocationSchema, q as StorageSemanticsSchema, T as TypeShape, r as TypeShapeSchema, x as typeDefinitionKey, y as withDefinitionsInlined } from './schemas-k-169oiY.js';
2
+ export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, f as DeployableUnitSchema, g as FunctionCallSemanticsSchema, h as GraphqlOperationSemanticsSchema, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, l as RestSemanticsSchema, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, d as SourceLocationSchema, q as StorageSemanticsSchema, T as TypeShape, r as TypeShapeSchema, z as typeDefinitionKey, A as withDefinitionsInlined } from './schemas-Dn1AzzWd.js';
package/dist/schemas.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  TypeShapeSchema,
18
18
  typeDefinitionKey,
19
19
  withDefinitionsInlined
20
- } from "./chunk-HSJYPBJU.js";
20
+ } from "./chunk-QHFMZPEG.js";
21
21
  export {
22
22
  BoundaryBindingSchema,
23
23
  ConfidenceInfoSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/ir-core",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "type": "module",
5
5
  "description": "Shared IR primitives for suss — type shapes, boundary bindings, source locations, and confidence. Imported by both @suss/behavioral-ir and @suss/intent-ir so neither depends on the other.",
6
6
  "keywords": [