@suss/intent-ir 0.3.1 → 0.4.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/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # @suss/intent-ir
2
2
 
3
- The team-authored side of the loop: what the code was *meant* to do, in shapes that pair against the derived `BehavioralSummary` of what it *does*.
3
+ The team-authored side of the loop: what the code was *meant* to do, in a form that pairs against the derived `BehavioralSummary` of what it *does*.
4
4
 
5
5
  ## What this package is
6
6
 
7
7
  Two citizens, discriminated by `kind`, both built on `@suss/ir-core` so intent and behaviour describe boundaries the same way:
8
8
 
9
9
  - **System intent** (`kind: boundary`): what one boundary should do, as named outcomes. The boundary is REST **or** function-call; each outcome is a `response` (status + body), a `returns` (a function/handler return value), or a `throws` (an error). The function-call form is what lets suss check its own non-HTTP surface.
10
- - **Outcome intent** (`kind: prd`): human `when` / `expect` scenarios, each with an optional `link` to a system-intent outcome (`<intent-name>.<outcome-id>`). A scenario with no `link` is a valid pending-link state: fully readable, not yet machine-linked.
10
+ - **Outcome intent** (`kind: prd`): human `when` / `expect` scenarios, each with an optional `link` to a system-intent outcome (`<intent-name>.<outcome-id>`). A scenario with no `link` is a valid state to be in: it reads fully, and nothing has linked it to an outcome yet.
11
11
 
12
12
  ```ts
13
13
  import { IntentDocSchema, intentDocToSummary } from "@suss/intent-ir";
@@ -16,13 +16,13 @@ const doc = IntentDocSchema.parse(/* parsed YAML / JSON */);
16
16
  const summary = intentDocToSummary(doc); // normalised, checker-ready
17
17
  ```
18
18
 
19
- `schema.ts` is the authoring surface (friendly to write); `summary.ts` is the normalized shape the checker consumes (boundaries as `ir-core` `BoundaryBinding`s, bodies as `TypeShape`s, one flat outcome list) plus the transform between them. `source` provenance (`author` / `inferred` / `inferred, curated`) rides along for the inference path.
19
+ `schema.ts` is the authoring surface (friendly to write); `summary.ts` is the normalized form the checker consumes (boundaries as `ir-core` `BoundaryBinding`s, bodies as `TypeShape`s, one flat outcome list) plus the transform between them. `source` provenance (`author` / `inferred` / `inferred, curated`) travels along with it for the inference path.
20
20
 
21
21
  The design is documented in [`docs/internal/proposals/intent-specs.md`](../../docs/internal/proposals/intent-specs.md).
22
22
 
23
- ## Where it sits in suss
23
+ ## Where it fits in suss
24
24
 
25
- Peer to `@suss/behavioral-ir`; both build on `@suss/ir-core`. Readers (e.g. `@suss/contract-intent`) parse files into `IntentDoc` and call `intentDocToSummary`; the checker pairs the result against derived code summaries.
25
+ It is a peer of `@suss/behavioral-ir`; both build on `@suss/ir-core`. Readers (e.g. `@suss/contract-intent`) parse files into `IntentDoc` and call `intentDocToSummary`; the checker pairs the result against derived code summaries.
26
26
 
27
27
  ## Status
28
28
 
package/dist/index.cjs CHANGED
@@ -47,7 +47,7 @@ var IntentFindingKindSchema = import_zod.z.enum([
47
47
  // code produces a REST status the intent doesn't declare
48
48
  "unkeyableBoundary",
49
49
  // intent boundary can't be keyed, so it can't be checked
50
- // Outcome intent (kind: prd) — scenario link coverage against system
50
+ // Outcome intent (kind: prd), scenario link coverage against system
51
51
  // intent. These concretise the proposal's "scenario not linked /
52
52
  // dangling / ambiguous" set (docs/internal/proposals/intent-specs.md);
53
53
  // the proposal deferred concrete names to implementation time.
@@ -76,7 +76,7 @@ var IntentFindingSchema = import_zod.z.object({
76
76
  kind: IntentFindingKindSchema,
77
77
  severity: IntentFindingSeveritySchema,
78
78
  /**
79
- * Human-readable boundary label — e.g. `GET /users/:id` or
79
+ * Human-readable boundary label: e.g. `GET /users/:id` or
80
80
  * `fn:@suss/cli::contract`. The key the intent and code were paired on.
81
81
  */
82
82
  boundary: import_zod.z.string(),
@@ -88,11 +88,11 @@ var IntentFindingSchema = import_zod.z.object({
88
88
  */
89
89
  code: import_zod.z.string().optional(),
90
90
  /**
91
- * PRD-scenario extension — present only on outcome-intent findings
91
+ * PRD-scenario extension: present only on outcome-intent findings
92
92
  * (unlinkedScenario / danglingScenarioLink / ambiguousScenarioLink).
93
93
  * Identifies the scenario (by its optional title) and the qualified
94
94
  * outcome ref (`<intent-name>.<outcome-id>`) that failed to resolve.
95
- * The peer / boundary findings leave it unset — this is the "intent
95
+ * The peer / boundary findings leave it unset. This is the "intent
96
96
  * finding extension" decision 2 of the proposal anticipated.
97
97
  */
98
98
  scenario: import_zod.z.object({
@@ -201,11 +201,11 @@ var PrdScenarioSchema = import_zod2.z.object({
201
201
  * (`<intent-name>.<outcome-id>`). A scenario without `link` is a
202
202
  * valid pending-link state: fully human-readable, not yet machine-
203
203
  * linked. The link is filled in later by a facilitator (a person, a
204
- * platform, or an LLM at authoring time) — never required to author.
204
+ * platform, or an LLM at authoring time), never required to author.
205
205
  *
206
206
  * (The human-readable parts are `when` / `expect`; the field is named
207
207
  * `link`, not `then`, because a data object with a `then` property is
208
- * treated as a thenable by Promise resolution — a latent footgun.)
208
+ * treated as a thenable by Promise resolution, a latent footgun.)
209
209
  */
210
210
  link: import_zod2.z.union([import_zod2.z.string().min(1), import_zod2.z.array(import_zod2.z.string().min(1)).min(1)]).optional()
211
211
  });
package/dist/index.d.cts CHANGED
@@ -117,20 +117,20 @@ declare const BoundarySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
117
117
  declare const BoundaryTransitionSchema: z.ZodObject<{
118
118
  id: z.ZodString;
119
119
  when: z.ZodString;
120
- response: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
120
+ response: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
121
121
  status: z.ZodNumber;
122
122
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
123
123
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
124
124
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
125
125
  }, z.core.$strip>]>>;
126
126
  }, z.core.$strip>>>;
127
- returns: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
127
+ returns: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
128
128
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
129
129
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
130
130
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
131
131
  }, z.core.$strip>]>>;
132
132
  }, z.core.$strip>>>;
133
- throws: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
133
+ throws: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
134
134
  errorType: z.ZodOptional<z.ZodString>;
135
135
  }, z.core.$strip>>>;
136
136
  }, z.core.$strip>;
@@ -160,20 +160,20 @@ declare const BoundaryIntentSchema: z.ZodObject<{
160
160
  transitions: z.ZodArray<z.ZodObject<{
161
161
  id: z.ZodString;
162
162
  when: z.ZodString;
163
- response: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
163
+ response: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
164
164
  status: z.ZodNumber;
165
165
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
166
166
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
167
167
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
168
168
  }, z.core.$strip>]>>;
169
169
  }, z.core.$strip>>>;
170
- returns: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
170
+ returns: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
171
171
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
172
172
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
173
173
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
174
174
  }, z.core.$strip>]>>;
175
175
  }, z.core.$strip>>>;
176
- throws: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
176
+ throws: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
177
177
  errorType: z.ZodOptional<z.ZodString>;
178
178
  }, z.core.$strip>>>;
179
179
  }, z.core.$strip>>;
@@ -227,20 +227,20 @@ declare const IntentDocSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
227
227
  transitions: z.ZodArray<z.ZodObject<{
228
228
  id: z.ZodString;
229
229
  when: z.ZodString;
230
- response: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
230
+ response: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
231
231
  status: z.ZodNumber;
232
232
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
233
233
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
234
234
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
235
235
  }, z.core.$strip>]>>;
236
236
  }, z.core.$strip>>>;
237
- returns: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
237
+ returns: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
238
238
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
239
239
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
240
240
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
241
241
  }, z.core.$strip>]>>;
242
242
  }, z.core.$strip>>>;
243
- throws: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
243
+ throws: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
244
244
  errorType: z.ZodOptional<z.ZodString>;
245
245
  }, z.core.$strip>>>;
246
246
  }, z.core.$strip>>;
@@ -279,7 +279,7 @@ declare const PrimitiveTypeName: z.ZodEnum<{
279
279
  }>;
280
280
  type PrimitiveTypeName = z.infer<typeof PrimitiveTypeName>;
281
281
 
282
- /** How a boundary outcome resolves — the cross-kind unification. */
282
+ /** How a boundary outcome resolves, the cross-kind unification. */
283
283
  type IntentOutcomeKind = "response" | "return" | "throw";
284
284
  interface IntentOutcome {
285
285
  /** Author-declared id PRD scenarios reference. */
package/dist/index.d.ts CHANGED
@@ -117,20 +117,20 @@ declare const BoundarySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
117
117
  declare const BoundaryTransitionSchema: z.ZodObject<{
118
118
  id: z.ZodString;
119
119
  when: z.ZodString;
120
- response: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
120
+ response: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
121
121
  status: z.ZodNumber;
122
122
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
123
123
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
124
124
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
125
125
  }, z.core.$strip>]>>;
126
126
  }, z.core.$strip>>>;
127
- returns: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
127
+ returns: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
128
128
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
129
129
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
130
130
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
131
131
  }, z.core.$strip>]>>;
132
132
  }, z.core.$strip>>>;
133
- throws: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
133
+ throws: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
134
134
  errorType: z.ZodOptional<z.ZodString>;
135
135
  }, z.core.$strip>>>;
136
136
  }, z.core.$strip>;
@@ -160,20 +160,20 @@ declare const BoundaryIntentSchema: z.ZodObject<{
160
160
  transitions: z.ZodArray<z.ZodObject<{
161
161
  id: z.ZodString;
162
162
  when: z.ZodString;
163
- response: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
163
+ response: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
164
164
  status: z.ZodNumber;
165
165
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
166
166
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
167
167
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
168
168
  }, z.core.$strip>]>>;
169
169
  }, z.core.$strip>>>;
170
- returns: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
170
+ returns: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
171
171
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
172
172
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
173
173
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
174
174
  }, z.core.$strip>]>>;
175
175
  }, z.core.$strip>>>;
176
- throws: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
176
+ throws: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
177
177
  errorType: z.ZodOptional<z.ZodString>;
178
178
  }, z.core.$strip>>>;
179
179
  }, z.core.$strip>>;
@@ -227,20 +227,20 @@ declare const IntentDocSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
227
227
  transitions: z.ZodArray<z.ZodObject<{
228
228
  id: z.ZodString;
229
229
  when: z.ZodString;
230
- response: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
230
+ response: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
231
231
  status: z.ZodNumber;
232
232
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
233
233
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
234
234
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
235
235
  }, z.core.$strip>]>>;
236
236
  }, z.core.$strip>>>;
237
- returns: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
237
+ returns: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
238
238
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
239
239
  properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
240
240
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
241
241
  }, z.core.$strip>]>>;
242
242
  }, z.core.$strip>>>;
243
- throws: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
243
+ throws: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
244
244
  errorType: z.ZodOptional<z.ZodString>;
245
245
  }, z.core.$strip>>>;
246
246
  }, z.core.$strip>>;
@@ -279,7 +279,7 @@ declare const PrimitiveTypeName: z.ZodEnum<{
279
279
  }>;
280
280
  type PrimitiveTypeName = z.infer<typeof PrimitiveTypeName>;
281
281
 
282
- /** How a boundary outcome resolves — the cross-kind unification. */
282
+ /** How a boundary outcome resolves, the cross-kind unification. */
283
283
  type IntentOutcomeKind = "response" | "return" | "throw";
284
284
  interface IntentOutcome {
285
285
  /** Author-declared id PRD scenarios reference. */
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ var IntentFindingKindSchema = z.enum([
12
12
  // code produces a REST status the intent doesn't declare
13
13
  "unkeyableBoundary",
14
14
  // intent boundary can't be keyed, so it can't be checked
15
- // Outcome intent (kind: prd) — scenario link coverage against system
15
+ // Outcome intent (kind: prd), scenario link coverage against system
16
16
  // intent. These concretise the proposal's "scenario not linked /
17
17
  // dangling / ambiguous" set (docs/internal/proposals/intent-specs.md);
18
18
  // the proposal deferred concrete names to implementation time.
@@ -41,7 +41,7 @@ var IntentFindingSchema = z.object({
41
41
  kind: IntentFindingKindSchema,
42
42
  severity: IntentFindingSeveritySchema,
43
43
  /**
44
- * Human-readable boundary label — e.g. `GET /users/:id` or
44
+ * Human-readable boundary label: e.g. `GET /users/:id` or
45
45
  * `fn:@suss/cli::contract`. The key the intent and code were paired on.
46
46
  */
47
47
  boundary: z.string(),
@@ -53,11 +53,11 @@ var IntentFindingSchema = z.object({
53
53
  */
54
54
  code: z.string().optional(),
55
55
  /**
56
- * PRD-scenario extension — present only on outcome-intent findings
56
+ * PRD-scenario extension: present only on outcome-intent findings
57
57
  * (unlinkedScenario / danglingScenarioLink / ambiguousScenarioLink).
58
58
  * Identifies the scenario (by its optional title) and the qualified
59
59
  * outcome ref (`<intent-name>.<outcome-id>`) that failed to resolve.
60
- * The peer / boundary findings leave it unset — this is the "intent
60
+ * The peer / boundary findings leave it unset. This is the "intent
61
61
  * finding extension" decision 2 of the proposal anticipated.
62
62
  */
63
63
  scenario: z.object({
@@ -166,11 +166,11 @@ var PrdScenarioSchema = z2.object({
166
166
  * (`<intent-name>.<outcome-id>`). A scenario without `link` is a
167
167
  * valid pending-link state: fully human-readable, not yet machine-
168
168
  * linked. The link is filled in later by a facilitator (a person, a
169
- * platform, or an LLM at authoring time) — never required to author.
169
+ * platform, or an LLM at authoring time), never required to author.
170
170
  *
171
171
  * (The human-readable parts are `when` / `expect`; the field is named
172
172
  * `link`, not `then`, because a data object with a `then` property is
173
- * treated as a thenable by Promise resolution — a latent footgun.)
173
+ * treated as a thenable by Promise resolution, a latent footgun.)
174
174
  */
175
175
  link: z2.union([z2.string().min(1), z2.array(z2.string().min(1)).min(1)]).optional()
176
176
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/intent-ir",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "Intent IR for suss — the team-authored side of the loop. PRD (outcome) intent and system intent, in shapes that pair against derived behavioral summaries.",
6
6
  "keywords": [
@@ -47,7 +47,7 @@
47
47
  "zod": "^4.0.0"
48
48
  },
49
49
  "dependencies": {
50
- "@suss/ir-core": "0.3.1"
50
+ "@suss/ir-core": "0.4.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "tsup": "*",