@suss/ir-core 0.20.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/index.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  ConfidenceSourceSchema,
6
6
  CorroborationSchema,
7
7
  DeployableUnitSchema,
8
+ EVERY_FIELD,
8
9
  FunctionCallSemanticsSchema,
9
10
  GraphqlOperationSemanticsSchema,
10
11
  GraphqlResolverSemanticsSchema,
@@ -16,6 +17,7 @@ import {
16
17
  SourceLocationSchema,
17
18
  StorageSemanticsSchema,
18
19
  TypeShapeSchema,
20
+ UnitInvocationSemanticsSchema,
19
21
  allBehaviors,
20
22
  behaviorOf,
21
23
  busIdentityKey,
@@ -34,9 +36,12 @@ import {
34
36
  routePathAdmits,
35
37
  semconvMappingOf,
36
38
  statesAnOrigin,
39
+ storageContainerLabel,
40
+ storageLabel,
37
41
  typeDefinitionKey,
42
+ unitIdentityKey,
38
43
  withDefinitionsInlined
39
- } from "./chunk-52CH76PE.js";
44
+ } from "./chunk-QHFMZPEG.js";
40
45
 
41
46
  // src/semconv.ts
42
47
  function semconvAttributes(binding) {
@@ -58,6 +63,9 @@ function semconvAttributes(binding) {
58
63
  }
59
64
 
60
65
  // src/boundaryKey.ts
66
+ function bindingIs(binding, name) {
67
+ return binding?.semantics.name === name;
68
+ }
61
69
  function boundaryKey(binding) {
62
70
  return behaviorOf(binding.semantics).identityKey(binding.semantics);
63
71
  }
@@ -125,6 +133,10 @@ function servesRequest(binding, method, path) {
125
133
  }
126
134
  return serves(binding.semantics, method, path);
127
135
  }
136
+ function withinScope(binding, scope) {
137
+ const within = behaviorOf(binding.semantics).withinScope;
138
+ return within === void 0 ? false : within(binding.semantics, scope);
139
+ }
128
140
 
129
141
  // src/dispatch.ts
130
142
  function dispatchByType(table, value) {
@@ -261,6 +273,57 @@ function referenceFromName(name) {
261
273
  return referenceOf(parseBoundaryName(name));
262
274
  }
263
275
 
276
+ // src/boundarySpelling.ts
277
+ function resourceNameIn(spelling) {
278
+ if (spelling.startsWith("arn:")) {
279
+ const segments2 = spelling.split(":");
280
+ return segments2[6] ?? segments2[5] ?? spelling;
281
+ }
282
+ const segments = spelling.split("/");
283
+ if (segments.length >= 4 && segments.length % 2 === 0) {
284
+ return segments[segments.length - 1] ?? spelling;
285
+ }
286
+ return spelling;
287
+ }
288
+ function spellingTokens(text) {
289
+ return text.toLowerCase().replace(/[{}]/g, " ").split(/[\s:#,()/]+/).filter((token) => token.length > 0);
290
+ }
291
+ function bindingTokens(binding) {
292
+ const tokens = new Set(spellingTokens(displayLabel(binding)));
293
+ for (const value of Object.values(binding.semantics)) {
294
+ if (typeof value === "string") {
295
+ for (const token of spellingTokens(value)) {
296
+ tokens.add(token);
297
+ }
298
+ }
299
+ }
300
+ for (const token of [...tokens]) {
301
+ for (const part of token.split(".")) {
302
+ tokens.add(part);
303
+ }
304
+ }
305
+ return tokens;
306
+ }
307
+ function namesBoundaryExactly(subject, binding) {
308
+ const wanted = new Set(spellingTokens(subject));
309
+ if (wanted.size === 0) {
310
+ return false;
311
+ }
312
+ const spelled = new Set(spellingTokens(displayLabel(binding)));
313
+ if (spelled.size !== wanted.size) {
314
+ return false;
315
+ }
316
+ return [...spelled].every((token) => wanted.has(token));
317
+ }
318
+ function namesBoundary(subject, binding) {
319
+ const wanted = spellingTokens(subject);
320
+ if (wanted.length === 0) {
321
+ return false;
322
+ }
323
+ const tokens = bindingTokens(binding);
324
+ return wanted.every((token) => tokens.has(token));
325
+ }
326
+
264
327
  // src/codeScope.ts
265
328
  function codeScopePath(raw) {
266
329
  return raw.trim().replace(/^\.\//, "").replace(/\/+$/, "");
@@ -274,26 +337,36 @@ function fileInCodeScope(file, scope) {
274
337
  return path === prefix || path.startsWith(`${prefix}/`);
275
338
  }
276
339
 
277
- // src/suppressions.ts
340
+ // src/relation.ts
278
341
  import { z } from "zod";
279
- var SuppressionSideSchema = z.object({
280
- summary: z.string().optional(),
281
- transitionId: z.string().optional()
342
+ var RelationSchema = z.enum([
343
+ "provides",
344
+ "reads",
345
+ "writes",
346
+ "invokes"
347
+ ]);
348
+ var EffectRelationSchema = RelationSchema.exclude(["provides"]);
349
+
350
+ // src/suppressions.ts
351
+ import { z as z2 } from "zod";
352
+ var SuppressionSideSchema = z2.object({
353
+ summary: z2.string().optional(),
354
+ transitionId: z2.string().optional()
282
355
  }).optional();
283
- var SuppressionRuleSchema = z.object({
356
+ var SuppressionRuleSchema = z2.object({
284
357
  /**
285
358
  * The finding kind to match, behavioural or intent. It is an open
286
359
  * string here because this package is below both IRs, and the loader
287
360
  * is what validates it against the published kind enums.
288
361
  */
289
- kind: z.string().optional(),
362
+ kind: z2.string().optional(),
290
363
  /**
291
364
  * Boundary as a human-readable key, e.g. "GET /pet/{petId}" or
292
365
  * "fn:@acme/api::getUser". REST keys are normalized via the same
293
366
  * path normalizer the checkers use, so `:id` and `{id}` compare
294
367
  * equal.
295
368
  */
296
- boundary: z.string().optional(),
369
+ boundary: z2.string().optional(),
297
370
  /**
298
371
  * Consumer-side discriminators, the narrowest useful match. These
299
372
  * mean something only for behavioural findings: a rule that
@@ -316,15 +389,15 @@ var SuppressionRuleSchema = z.object({
316
389
  * kind-only or boundary-only matches, which also silence future
317
390
  * regressions in that category.
318
391
  */
319
- scope: z.enum(["narrow", "broad"]).default("narrow"),
392
+ scope: z2.enum(["narrow", "broad"]).default("narrow"),
320
393
  /** Required human-written justification. */
321
- reason: z.string().min(1),
394
+ reason: z2.string().min(1),
322
395
  /** What to do when a finding matches. */
323
- effect: z.enum(["mark", "downgrade", "hide"]).default("mark")
396
+ effect: z2.enum(["mark", "downgrade", "hide"]).default("mark")
324
397
  }).strict();
325
- var SuppressionFileSchema = z.object({
326
- version: z.literal(1),
327
- rules: z.array(SuppressionRuleSchema)
398
+ var SuppressionFileSchema = z2.object({
399
+ version: z2.literal(1),
400
+ rules: z2.array(SuppressionRuleSchema)
328
401
  }).strict();
329
402
  function validateRule(rule) {
330
403
  if (rule.scope === "broad") {
@@ -614,6 +687,17 @@ function runtimeConfigBinding(opts) {
614
687
  recognition: opts.recognition
615
688
  };
616
689
  }
690
+ function unitInvocationBinding(opts) {
691
+ return {
692
+ transport: "invoke",
693
+ semantics: {
694
+ name: "unit-invocation",
695
+ deploymentTarget: opts.deploymentTarget,
696
+ instanceName: namedOrNull(opts.instanceName, "invoked unit")
697
+ },
698
+ recognition: opts.recognition
699
+ };
700
+ }
617
701
  function storageBinding(opts) {
618
702
  return {
619
703
  transport: opts.transport ?? opts.storageSystem,
@@ -656,11 +740,14 @@ export {
656
740
  ConfidenceSourceSchema,
657
741
  CorroborationSchema,
658
742
  DeployableUnitSchema,
743
+ EVERY_FIELD,
744
+ EffectRelationSchema,
659
745
  FunctionCallSemanticsSchema,
660
746
  GraphqlOperationSemanticsSchema,
661
747
  GraphqlResolverSemanticsSchema,
662
748
  MessageBusSemanticsSchema,
663
749
  MetricSemanticsSchema,
750
+ RelationSchema,
664
751
  RestSemanticsSchema,
665
752
  RuntimeConfigSemanticsSchema,
666
753
  SemanticsSchema,
@@ -669,7 +756,10 @@ export {
669
756
  SuppressionFileSchema,
670
757
  SuppressionRuleSchema,
671
758
  TypeShapeSchema,
759
+ UnitInvocationSemanticsSchema,
672
760
  applySuppressionsToFindings,
761
+ bindingIs,
762
+ bindingTokens,
673
763
  bodyShapesMatch,
674
764
  boundaryKey,
675
765
  boundaryLabel,
@@ -702,6 +792,8 @@ export {
702
792
  namePatternFromSub,
703
793
  namePatternKey,
704
794
  namesAgree,
795
+ namesBoundary,
796
+ namesBoundaryExactly,
705
797
  namesNothing,
706
798
  normalizePath,
707
799
  normalizeRuleBoundary,
@@ -716,6 +808,7 @@ export {
716
808
  referenceName,
717
809
  referenceOf,
718
810
  reportsUnpairedItself,
811
+ resourceNameIn,
719
812
  restBinding,
720
813
  routePathAdmits,
721
814
  ruleBoundaryMatchesKey,
@@ -723,10 +816,16 @@ export {
723
816
  semanticsAgree,
724
817
  semconvAttributes,
725
818
  servesRequest,
819
+ spellingTokens,
726
820
  statesAnOrigin,
727
821
  storageBinding,
822
+ storageContainerLabel,
823
+ storageLabel,
728
824
  typeDefinitionKey,
825
+ unitIdentityKey,
826
+ unitInvocationBinding,
729
827
  validateRule,
730
828
  withDefinitionsInlined,
731
- withRewrittenPaths
829
+ withRewrittenPaths,
830
+ withinScope
732
831
  };
@@ -155,6 +155,16 @@ declare const SemanticsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
155
155
  name: z.ZodLiteral<"metric">;
156
156
  metricSystem: z.ZodString;
157
157
  metricType: z.ZodNullable<z.ZodString>;
158
+ }, z.core.$strip>, z.ZodObject<{
159
+ deploymentTarget: z.ZodEnum<{
160
+ lambda: "lambda";
161
+ "ecs-task": "ecs-task";
162
+ container: "container";
163
+ "k8s-deployment": "k8s-deployment";
164
+ worker: "worker";
165
+ }>;
166
+ name: z.ZodLiteral<"unit-invocation">;
167
+ instanceName: z.ZodNullable<z.ZodString>;
158
168
  }, z.core.$strip>], "name">;
159
169
  type Semantics = z.infer<typeof SemanticsSchema>;
160
170
 
@@ -220,6 +230,22 @@ declare const StorageSemanticsSchema: z.ZodObject<{
220
230
  accessPath: z.ZodNullable<z.ZodString>;
221
231
  }, z.core.$strip>;
222
232
  type StorageSemantics = z.infer<typeof StorageSemanticsSchema>;
233
+ /**
234
+ * `postgresql:invoices`, `aws.dynamodb:editions#by-publication`. The
235
+ * pairing pass has no key to fall back on here, so a reader who types
236
+ * this back at `suss ask`, the pass that indexes accesses by it, and an
237
+ * intent doc that says which store a write reaches all read this one.
238
+ */
239
+ declare function storageLabel(semantics: StorageSemantics): string;
240
+ /**
241
+ * What an access writes for its columns when it asked for all of them,
242
+ * which is a query with no explicit projection. It covers every column
243
+ * rather than saying which one, so anything comparing column lists has
244
+ * to tell it apart from a list of columns.
245
+ */
246
+ declare const EVERY_FIELD = "*";
247
+ /** The store on its own, which a finding writes without the system. */
248
+ declare function storageContainerLabel(semantics: StorageSemantics): string;
223
249
 
224
250
  /**
225
251
  * @suss/ir-core schemas: primitives shared by every suss IR.
@@ -366,6 +392,16 @@ declare const BoundaryBindingSchema: z.ZodObject<{
366
392
  name: z.ZodLiteral<"metric">;
367
393
  metricSystem: z.ZodString;
368
394
  metricType: z.ZodNullable<z.ZodString>;
395
+ }, z.core.$strip>, z.ZodObject<{
396
+ deploymentTarget: z.ZodEnum<{
397
+ lambda: "lambda";
398
+ "ecs-task": "ecs-task";
399
+ container: "container";
400
+ "k8s-deployment": "k8s-deployment";
401
+ worker: "worker";
402
+ }>;
403
+ name: z.ZodLiteral<"unit-invocation">;
404
+ instanceName: z.ZodNullable<z.ZodString>;
369
405
  }, z.core.$strip>], "name">;
370
406
  recognition: z.ZodString;
371
407
  }, z.core.$strip>;
@@ -455,4 +491,4 @@ declare const TypeShapeSchema: z.ZodType<TypeShape>;
455
491
  */
456
492
  declare function withDefinitionsInlined(shape: TypeShape, definitions: Record<string, TypeShape> | undefined, depth?: number, inProgress?: ReadonlySet<string>): TypeShape;
457
493
 
458
- export { BoundaryBindingSchema as B, ConfidenceInfoSchema as C, type DeployableUnit as D, type FunctionCallSemantics as F, type GraphqlOperationSemantics as G, type MessageBusSemantics as M, type RestSemantics as R, type Semantics as S, type TypeShape as T, ConfidenceLevelSchema as a, ConfidenceSourceSchema as b, CorroborationSchema as c, SourceLocationSchema as d, type MessageBusTechnology as e, DeployableUnitSchema as f, FunctionCallSemanticsSchema as g, GraphqlOperationSemanticsSchema as h, type GraphqlResolverSemantics as i, GraphqlResolverSemanticsSchema as j, MessageBusSemanticsSchema as k, RestSemanticsSchema as l, type RuntimeConfigSemantics as m, RuntimeConfigSemanticsSchema as n, SemanticsSchema as o, type StorageSemantics as p, StorageSemanticsSchema as q, TypeShapeSchema as r, ecsContainerInstanceName as s, methodsAgree as t, normalizePath as u, pathShape as v, routePathAdmits as w, typeDefinitionKey as x, withDefinitionsInlined as y };
494
+ export { withDefinitionsInlined as A, BoundaryBindingSchema as B, ConfidenceInfoSchema as C, type DeployableUnit as D, EVERY_FIELD as E, type FunctionCallSemantics as F, type GraphqlOperationSemantics as G, type MessageBusSemantics as M, type RestSemantics as R, type Semantics as S, type TypeShape as T, ConfidenceLevelSchema as a, ConfidenceSourceSchema as b, CorroborationSchema as c, SourceLocationSchema as d, type MessageBusTechnology as e, DeployableUnitSchema as f, FunctionCallSemanticsSchema as g, GraphqlOperationSemanticsSchema as h, type GraphqlResolverSemantics as i, GraphqlResolverSemanticsSchema as j, MessageBusSemanticsSchema as k, RestSemanticsSchema as l, type RuntimeConfigSemantics as m, RuntimeConfigSemanticsSchema as n, SemanticsSchema as o, type StorageSemantics as p, StorageSemanticsSchema as q, TypeShapeSchema as r, ecsContainerInstanceName as s, methodsAgree as t, normalizePath as u, pathShape as v, routePathAdmits as w, storageContainerLabel as x, storageLabel as y, typeDefinitionKey as z };
@@ -155,6 +155,16 @@ declare const SemanticsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
155
155
  name: z.ZodLiteral<"metric">;
156
156
  metricSystem: z.ZodString;
157
157
  metricType: z.ZodNullable<z.ZodString>;
158
+ }, z.core.$strip>, z.ZodObject<{
159
+ deploymentTarget: z.ZodEnum<{
160
+ lambda: "lambda";
161
+ "ecs-task": "ecs-task";
162
+ container: "container";
163
+ "k8s-deployment": "k8s-deployment";
164
+ worker: "worker";
165
+ }>;
166
+ name: z.ZodLiteral<"unit-invocation">;
167
+ instanceName: z.ZodNullable<z.ZodString>;
158
168
  }, z.core.$strip>], "name">;
159
169
  type Semantics = z.infer<typeof SemanticsSchema>;
160
170
 
@@ -220,6 +230,22 @@ declare const StorageSemanticsSchema: z.ZodObject<{
220
230
  accessPath: z.ZodNullable<z.ZodString>;
221
231
  }, z.core.$strip>;
222
232
  type StorageSemantics = z.infer<typeof StorageSemanticsSchema>;
233
+ /**
234
+ * `postgresql:invoices`, `aws.dynamodb:editions#by-publication`. The
235
+ * pairing pass has no key to fall back on here, so a reader who types
236
+ * this back at `suss ask`, the pass that indexes accesses by it, and an
237
+ * intent doc that says which store a write reaches all read this one.
238
+ */
239
+ declare function storageLabel(semantics: StorageSemantics): string;
240
+ /**
241
+ * What an access writes for its columns when it asked for all of them,
242
+ * which is a query with no explicit projection. It covers every column
243
+ * rather than saying which one, so anything comparing column lists has
244
+ * to tell it apart from a list of columns.
245
+ */
246
+ declare const EVERY_FIELD = "*";
247
+ /** The store on its own, which a finding writes without the system. */
248
+ declare function storageContainerLabel(semantics: StorageSemantics): string;
223
249
 
224
250
  /**
225
251
  * @suss/ir-core schemas: primitives shared by every suss IR.
@@ -366,6 +392,16 @@ declare const BoundaryBindingSchema: z.ZodObject<{
366
392
  name: z.ZodLiteral<"metric">;
367
393
  metricSystem: z.ZodString;
368
394
  metricType: z.ZodNullable<z.ZodString>;
395
+ }, z.core.$strip>, z.ZodObject<{
396
+ deploymentTarget: z.ZodEnum<{
397
+ lambda: "lambda";
398
+ "ecs-task": "ecs-task";
399
+ container: "container";
400
+ "k8s-deployment": "k8s-deployment";
401
+ worker: "worker";
402
+ }>;
403
+ name: z.ZodLiteral<"unit-invocation">;
404
+ instanceName: z.ZodNullable<z.ZodString>;
369
405
  }, z.core.$strip>], "name">;
370
406
  recognition: z.ZodString;
371
407
  }, z.core.$strip>;
@@ -455,4 +491,4 @@ declare const TypeShapeSchema: z.ZodType<TypeShape>;
455
491
  */
456
492
  declare function withDefinitionsInlined(shape: TypeShape, definitions: Record<string, TypeShape> | undefined, depth?: number, inProgress?: ReadonlySet<string>): TypeShape;
457
493
 
458
- export { BoundaryBindingSchema as B, ConfidenceInfoSchema as C, type DeployableUnit as D, type FunctionCallSemantics as F, type GraphqlOperationSemantics as G, type MessageBusSemantics as M, type RestSemantics as R, type Semantics as S, type TypeShape as T, ConfidenceLevelSchema as a, ConfidenceSourceSchema as b, CorroborationSchema as c, SourceLocationSchema as d, type MessageBusTechnology as e, DeployableUnitSchema as f, FunctionCallSemanticsSchema as g, GraphqlOperationSemanticsSchema as h, type GraphqlResolverSemantics as i, GraphqlResolverSemanticsSchema as j, MessageBusSemanticsSchema as k, RestSemanticsSchema as l, type RuntimeConfigSemantics as m, RuntimeConfigSemanticsSchema as n, SemanticsSchema as o, type StorageSemantics as p, StorageSemanticsSchema as q, TypeShapeSchema as r, ecsContainerInstanceName as s, methodsAgree as t, normalizePath as u, pathShape as v, routePathAdmits as w, typeDefinitionKey as x, withDefinitionsInlined as y };
494
+ export { withDefinitionsInlined as A, BoundaryBindingSchema as B, ConfidenceInfoSchema as C, type DeployableUnit as D, EVERY_FIELD as E, type FunctionCallSemantics as F, type GraphqlOperationSemantics as G, type MessageBusSemantics as M, type RestSemantics as R, type Semantics as S, type TypeShape as T, ConfidenceLevelSchema as a, ConfidenceSourceSchema as b, CorroborationSchema as c, SourceLocationSchema as d, type MessageBusTechnology as e, DeployableUnitSchema as f, FunctionCallSemanticsSchema as g, GraphqlOperationSemanticsSchema as h, type GraphqlResolverSemantics as i, GraphqlResolverSemanticsSchema as j, MessageBusSemanticsSchema as k, RestSemanticsSchema as l, type RuntimeConfigSemantics as m, RuntimeConfigSemanticsSchema as n, SemanticsSchema as o, type StorageSemantics as p, StorageSemanticsSchema as q, TypeShapeSchema as r, ecsContainerInstanceName as s, methodsAgree as t, normalizePath as u, pathShape as v, routePathAdmits as w, storageContainerLabel as x, storageLabel as y, typeDefinitionKey as z };
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
  }
@@ -497,6 +500,14 @@ var restSemantics = defineBoundarySemantics({
497
500
  }
498
501
  return routePathAdmits(semantics.path, path) ? "match" : "nomatch";
499
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
+ },
500
511
  /**
501
512
  * A call whose base URL the deployment fills in, resolved to the
502
513
  * path it reaches.
@@ -629,12 +640,70 @@ var storageSemantics = defineBoundarySemantics({
629
640
  /** A query returns rows or items, not a status and a body. */
630
641
  exchangesHttpResponses: false,
631
642
  reportsUnpairedItself: false,
632
- 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
+ }
633
702
  }
634
703
  });
635
704
 
636
705
  // src/semantics/registry.ts
637
- var SemanticsSchema = import_zod10.z.discriminatedUnion("name", [
706
+ var SemanticsSchema = import_zod11.z.discriminatedUnion("name", [
638
707
  restSemantics.schema,
639
708
  functionCallSemantics.schema,
640
709
  graphqlResolverSemantics.schema,
@@ -642,7 +711,8 @@ var SemanticsSchema = import_zod10.z.discriminatedUnion("name", [
642
711
  runtimeConfigSemantics.schema,
643
712
  storageSemantics.schema,
644
713
  messageBusSemantics.schema,
645
- metricSemantics.schema
714
+ metricSemantics.schema,
715
+ unitInvocationSemantics.schema
646
716
  ]);
647
717
  var DEFINITIONS = [
648
718
  restSemantics,
@@ -652,38 +722,39 @@ var DEFINITIONS = [
652
722
  runtimeConfigSemantics,
653
723
  storageSemantics,
654
724
  messageBusSemantics,
655
- metricSemantics
725
+ metricSemantics,
726
+ unitInvocationSemantics
656
727
  ];
657
728
  var BY_NAME = new Map(
658
729
  DEFINITIONS.map((d) => [d.name, d])
659
730
  );
660
731
 
661
732
  // src/schemas.ts
662
- var ConfidenceSourceSchema = import_zod11.z.enum([
733
+ var ConfidenceSourceSchema = import_zod12.z.enum([
663
734
  "inferred_static",
664
735
  "inferred_ai",
665
736
  "declared",
666
737
  "derived"
667
738
  ]);
668
- var ConfidenceLevelSchema = import_zod11.z.enum(["high", "medium", "low"]);
669
- var CorroborationSchema = import_zod11.z.object({
670
- 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"]),
671
742
  /** Executions that produced a verdict for this claim. */
672
- runs: import_zod11.z.number(),
743
+ runs: import_zod12.z.number(),
673
744
  /** Present when refuted: the input and observation that disagreed. */
674
- counterexample: import_zod11.z.unknown().optional(),
745
+ counterexample: import_zod12.z.unknown().optional(),
675
746
  /** Present when untested: why no verdict was reachable. */
676
- reason: import_zod11.z.string().optional()
747
+ reason: import_zod12.z.string().optional()
677
748
  });
678
- var ConfidenceInfoSchema = import_zod11.z.object({
749
+ var ConfidenceInfoSchema = import_zod12.z.object({
679
750
  source: ConfidenceSourceSchema,
680
751
  level: ConfidenceLevelSchema,
681
752
  corroboration: CorroborationSchema.optional()
682
753
  });
683
- var SourceLocationSchema = import_zod11.z.object({
684
- file: import_zod11.z.string(),
754
+ var SourceLocationSchema = import_zod12.z.object({
755
+ file: import_zod12.z.string(),
685
756
  /** Line numbers, for a person reading the summary or an editor link. */
686
- range: import_zod11.z.object({ start: import_zod11.z.number(), end: import_zod11.z.number() }),
757
+ range: import_zod12.z.object({ start: import_zod12.z.number(), end: import_zod12.z.number() }),
687
758
  /**
688
759
  * Character offsets of the unit in its file. Identity and joins
689
760
  * measure with these, since two functions can share a line and never
@@ -691,8 +762,8 @@ var SourceLocationSchema = import_zod11.z.object({
691
762
  * same place. Absent on summaries no source position backs, a
692
763
  * contract artifact's say.
693
764
  */
694
- span: import_zod11.z.object({ start: import_zod11.z.number(), end: import_zod11.z.number() }).optional(),
695
- exportName: import_zod11.z.string().nullable(),
765
+ span: import_zod12.z.object({ start: import_zod12.z.number(), end: import_zod12.z.number() }).optional(),
766
+ exportName: import_zod12.z.string().nullable(),
696
767
  /**
697
768
  * The project the extract was pointed at, by the name that project
698
769
  * calls itself.
@@ -702,47 +773,47 @@ var SourceLocationSchema = import_zod11.z.object({
702
773
  * summaries puts them on top of each other. This field is what tells
703
774
  * them apart, and what a reader groups by.
704
775
  */
705
- workspace: import_zod11.z.string().optional()
776
+ workspace: import_zod12.z.string().optional()
706
777
  });
707
- var BoundaryBindingSchema = import_zod11.z.object({
708
- transport: import_zod11.z.string(),
778
+ var BoundaryBindingSchema = import_zod12.z.object({
779
+ transport: import_zod12.z.string(),
709
780
  semantics: SemanticsSchema,
710
- recognition: import_zod11.z.string()
781
+ recognition: import_zod12.z.string()
711
782
  });
712
783
  function typeDefinitionKey(ref) {
713
784
  return ref.def ?? null;
714
785
  }
715
- var TypeShapeSchema = import_zod11.z.lazy(
716
- () => import_zod11.z.discriminatedUnion("type", [
717
- import_zod11.z.object({
718
- type: import_zod11.z.literal("record"),
719
- properties: import_zod11.z.record(import_zod11.z.string(), TypeShapeSchema),
720
- 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()
721
792
  }),
722
- import_zod11.z.object({ type: import_zod11.z.literal("dictionary"), values: TypeShapeSchema }),
723
- import_zod11.z.object({ type: import_zod11.z.literal("array"), items: TypeShapeSchema }),
724
- import_zod11.z.object({
725
- type: import_zod11.z.literal("literal"),
726
- value: import_zod11.z.union([import_zod11.z.string(), import_zod11.z.number(), import_zod11.z.boolean()]),
727
- 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()
728
799
  }),
729
- import_zod11.z.object({ type: import_zod11.z.literal("text") }),
730
- import_zod11.z.object({ type: import_zod11.z.literal("integer") }),
731
- import_zod11.z.object({ type: import_zod11.z.literal("number") }),
732
- import_zod11.z.object({ type: import_zod11.z.literal("boolean") }),
733
- import_zod11.z.object({ type: import_zod11.z.literal("null") }),
734
- import_zod11.z.object({ type: import_zod11.z.literal("undefined") }),
735
- import_zod11.z.object({
736
- type: import_zod11.z.literal("union"),
737
- 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)
738
809
  }),
739
- import_zod11.z.object({
740
- type: import_zod11.z.literal("ref"),
741
- name: import_zod11.z.string(),
742
- from: import_zod11.z.string().optional(),
743
- 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()
744
815
  }),
745
- import_zod11.z.object({ type: import_zod11.z.literal("unknown") })
816
+ import_zod12.z.object({ type: import_zod12.z.literal("unknown") })
746
817
  ])
747
818
  );
748
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-Dt93kAZT.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-Dt93kAZT.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-52CH76PE.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.20.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": [