kibi-cli 2.10.0 → 2.12.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 (57) hide show
  1. package/dist/operations/bootstrap/candidates.d.ts +2 -1
  2. package/dist/operations/bootstrap/candidates.d.ts.map +1 -1
  3. package/dist/operations/bootstrap/candidates.js +2 -2
  4. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  5. package/dist/operations/bootstrap/generate.js +10 -3
  6. package/dist/operations/bootstrap/intent-claims.d.ts +2 -1
  7. package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -1
  8. package/dist/operations/bootstrap/intent-claims.js +6 -4
  9. package/dist/operations/bootstrap/markdown-candidates.d.ts +2 -1
  10. package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
  11. package/dist/operations/bootstrap/markdown-candidates.js +7 -5
  12. package/dist/operations/bootstrap/requirement-claims.d.ts +60 -2
  13. package/dist/operations/bootstrap/requirement-claims.d.ts.map +1 -1
  14. package/dist/operations/bootstrap/requirement-claims.js +324 -20
  15. package/dist/operations/modeling/predicate-applyplan.d.ts +13 -0
  16. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
  17. package/dist/operations/modeling/predicate-applyplan.js +56 -18
  18. package/dist/operations/modeling/predicate-binding-hints.d.ts +11 -0
  19. package/dist/operations/modeling/predicate-binding-hints.d.ts.map +1 -0
  20. package/dist/operations/modeling/predicate-binding-hints.js +97 -0
  21. package/dist/operations/modeling/predicate-bindings.d.ts +24 -1
  22. package/dist/operations/modeling/predicate-bindings.d.ts.map +1 -1
  23. package/dist/operations/modeling/predicate-bindings.js +129 -4
  24. package/dist/operations/modeling/predicate-catalog-1.d.ts.map +1 -1
  25. package/dist/operations/modeling/predicate-catalog-1.js +3 -0
  26. package/dist/operations/modeling/predicate-catalog-2.d.ts.map +1 -1
  27. package/dist/operations/modeling/predicate-catalog-2.js +3 -0
  28. package/dist/operations/modeling/predicate-catalog-3.d.ts.map +1 -1
  29. package/dist/operations/modeling/predicate-catalog-3.js +7 -0
  30. package/dist/operations/modeling/predicate-catalog-4.d.ts.map +1 -1
  31. package/dist/operations/modeling/predicate-catalog-4.js +2 -0
  32. package/dist/operations/modeling/predicate-closed-vocabularies.d.ts +104 -0
  33. package/dist/operations/modeling/predicate-closed-vocabularies.d.ts.map +1 -0
  34. package/dist/operations/modeling/predicate-closed-vocabularies.js +104 -0
  35. package/dist/operations/modeling/predicate-types.d.ts +19 -1
  36. package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
  37. package/dist/operations/modeling/predicate-utils.d.ts +11 -1
  38. package/dist/operations/modeling/predicate-utils.d.ts.map +1 -1
  39. package/dist/operations/modeling/predicate-utils.js +19 -3
  40. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  41. package/dist/operations/modeling/suggest-predicates.js +112 -16
  42. package/dist/operations/semantic-advisor/observation-plan.d.ts +7 -0
  43. package/dist/operations/semantic-advisor/observation-plan.d.ts.map +1 -1
  44. package/dist/operations/semantic-advisor/observation-plan.js +13 -14
  45. package/dist/public/operations/contracts.d.ts.map +1 -1
  46. package/dist/public/operations/contracts.js +4 -0
  47. package/dist/public/skills/kibi-bootstrap/SKILL.md +2 -2
  48. package/dist/public/skills/kibi-usage/SKILL.md +20 -7
  49. package/dist/public/skills/kibi-usage/resources/workflows.md +2 -2
  50. package/dist/utils/strict-modeling.d.ts +1 -0
  51. package/dist/utils/strict-modeling.d.ts.map +1 -1
  52. package/dist/utils/strict-modeling.js +1 -1
  53. package/package.json +2 -2
  54. package/src/public/operations/contracts.ts +5 -0
  55. package/src/public/skills/kibi-bootstrap/SKILL.md +2 -2
  56. package/src/public/skills/kibi-usage/SKILL.md +20 -7
  57. package/src/public/skills/kibi-usage/resources/workflows.md +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"predicate-bindings.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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ACjB,SAAS,UAAQ,EACjB,OAAO,GAAE,cAAmB,GAC3B,iBAAiB,CAmBnB;AAUD,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,iBAAiB,EAAE,GACnC,iBAAiB,CAQnB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAIrE"}
@@ -67,6 +67,20 @@ const DERIVED_CUE_ALIASES = {
67
67
  ],
68
68
  actionable_error: ["actionable", "clear error", "report", "error"],
69
69
  exception: ["exception", "except", "package-manager", "package manager"],
70
+ // Wording that names a closed-vocabulary constant without spelling it.
71
+ deny: [
72
+ "denied",
73
+ "must not",
74
+ "must never",
75
+ "forbidden",
76
+ "prohibited",
77
+ "not allowed",
78
+ "not be allowed",
79
+ ],
80
+ allow: ["is allowed", "are allowed", "permitted"],
81
+ on_demand: ["on demand", "on request"],
82
+ timeout: ["times out", "timed out", "time out"],
83
+ submit: ["submission", "submits", "submitted"],
70
84
  };
71
85
  function textContainsValue(text, value) {
72
86
  const lower = text.toLowerCase();
@@ -92,12 +106,122 @@ export function isGenericPlaceholder(value) {
92
106
  (normalized.endsWith("_policy") &&
93
107
  ["executable", "cwd", "environment", "stdio", "termination"].some((kind) => normalized.startsWith(kind))));
94
108
  }
95
- export function classifyBinding(value, text, explicit, canonical = false) {
109
+ /**
110
+ * Words that carry no domain meaning on their own: auxiliary and trivial
111
+ * verbs, articles, pronouns and filler. A binding made of one of them names
112
+ * no reviewed value, so it stays unbound.
113
+ */
114
+ const STOP_WORD_BINDINGS = new Set([
115
+ "a",
116
+ "an",
117
+ "the",
118
+ "be",
119
+ "is",
120
+ "are",
121
+ "was",
122
+ "were",
123
+ "been",
124
+ "being",
125
+ "am",
126
+ "do",
127
+ "does",
128
+ "did",
129
+ "done",
130
+ "have",
131
+ "has",
132
+ "had",
133
+ "it",
134
+ "its",
135
+ "this",
136
+ "that",
137
+ "these",
138
+ "those",
139
+ "they",
140
+ "them",
141
+ "there",
142
+ "thing",
143
+ "something",
144
+ "anything",
145
+ "some",
146
+ "any",
147
+ "of",
148
+ "to",
149
+ "in",
150
+ "at",
151
+ "by",
152
+ "for",
153
+ "with",
154
+ "and",
155
+ "or",
156
+ "not",
157
+ "null",
158
+ "nil",
159
+ "n_a",
160
+ "na",
161
+ "tbd",
162
+ "todo",
163
+ "x",
164
+ "xxx",
165
+ "foo",
166
+ "bar",
167
+ "example",
168
+ "placeholder",
169
+ ]);
170
+ /** A binding value in the snake_case form argument names use. */
171
+ export function bindingToken(value) {
172
+ return value
173
+ .trim()
174
+ .toLowerCase()
175
+ .replace(/[^a-z0-9]+/g, "_")
176
+ .replace(/^_+|_+$/g, "");
177
+ }
178
+ function claimNames(text, token) {
179
+ if (!text || !token)
180
+ return false;
181
+ const words = token.split("_").filter(Boolean);
182
+ if (words.length === 0)
183
+ return false;
184
+ return new RegExp(`\\b${words.join("[\\s_-]+")}\\b`, "i").test(text);
185
+ }
186
+ function matchesConstant(value, context) {
187
+ const token = bindingToken(value);
188
+ return (context.constants?.some((constant) => bindingToken(constant) === token) ??
189
+ false);
190
+ }
191
+ /**
192
+ * Why a value only stands in for a binding, or null when it can be a reviewed
193
+ * value: it repeats its own or another argument's name, or it is a bare stop
194
+ * word. Declared constants and the booleans `true`/`false` always pass.
195
+ */
196
+ // implements REQ-model-predicates-binding-placeholders
197
+ export function nameOrStopWordReason(value, context = {}) {
198
+ const token = bindingToken(value);
199
+ if (token === "true" || token === "false")
200
+ return null;
201
+ if (matchesConstant(value, context))
202
+ return null;
203
+ if (STOP_WORD_BINDINGS.has(token))
204
+ return `"${token}" is a stop word`;
205
+ const own = context.argumentName ? bindingToken(context.argumentName) : "";
206
+ const repeatsName = (own !== "" && token === own) ||
207
+ (context.argumentNames ?? []).some((name) => bindingToken(name) === token);
208
+ if (repeatsName && !claimNames(context.text, token))
209
+ return `it repeats the argument name ${token} and the claim does not name it`;
210
+ return null;
211
+ }
212
+ // implements REQ-mcp-suggest-predicates, REQ-model-predicates-binding-placeholders
213
+ export function classifyBinding(value, text, explicit, canonical = false, context = {}) {
96
214
  const normalized = value.trim();
97
- if (canonical && !isGenericPlaceholder(normalized))
215
+ // A value that only repeats an argument name or a stop word is unbound
216
+ // however it was supplied or extracted.
217
+ if (nameOrStopWordReason(normalized, { ...context, text }) !== null)
218
+ return "placeholder";
219
+ const constant = matchesConstant(normalized, context);
220
+ if (canonical && (constant || !isGenericPlaceholder(normalized)))
98
221
  return "extracted";
99
222
  if (explicit &&
100
- (!isGenericPlaceholder(normalized) ||
223
+ (constant ||
224
+ !isGenericPlaceholder(normalized) ||
101
225
  ["true", "false"].includes(normalized.toLowerCase())))
102
226
  return "explicit";
103
227
  if (!normalized || isGenericPlaceholder(normalized))
@@ -108,6 +232,7 @@ export function classifyBinding(value, text, explicit, canonical = false) {
108
232
  }
109
233
  const PROVENANCE_ORDER = [
110
234
  "explicit",
235
+ "requirement",
111
236
  "extracted",
112
237
  "inferred",
113
238
  "placeholder",
@@ -118,5 +243,5 @@ export function aggregateBindingProvenance(values) {
118
243
  : worst, "explicit");
119
244
  }
120
245
  export function bindingCanBeApplied(value) {
121
- return value === "explicit" || value === "extracted";
246
+ return (value === "explicit" || value === "requirement" || value === "extracted");
122
247
  }
@@ -1 +1 @@
1
- {"version":3,"file":"predicate-catalog-1.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-catalog-1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,eAAO,MAAM,mBAAmB,EAAE,wBAAwB,EAmNzD,CAAC"}
1
+ {"version":3,"file":"predicate-catalog-1.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-catalog-1.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,eAAO,MAAM,mBAAmB,EAAE,wBAAwB,EAqNzD,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { LIFECYCLE_ACTION_VOCABULARY, TRIGGER_VOCABULARY, closedArguments, } from "./predicate-closed-vocabularies.js";
1
2
  // implements REQ-mcp-suggest-predicates
2
3
  export const PREDICATE_CATALOG_1 = [
3
4
  {
@@ -18,6 +19,7 @@ export const PREDICATE_CATALOG_1 = [
18
19
  description: "A subject transitions between states because of a trigger.",
19
20
  argument_names: ["subject", "from_state", "to_state", "trigger"],
20
21
  argument_types: ["entity", "state", "state", "trigger"],
22
+ ...closedArguments({ trigger: TRIGGER_VOCABULARY }),
21
23
  keywords: [
22
24
  "transition",
23
25
  "enter",
@@ -193,6 +195,7 @@ export const PREDICATE_CATALOG_1 = [
193
195
  description: "An entity must be archived, deleted, expired, or lifecycle-transitioned after a duration.",
194
196
  argument_names: ["subject", "action", "duration", "unit"],
195
197
  argument_types: ["entity", "action", "number", "unit"],
198
+ ...closedArguments({ action: LIFECYCLE_ACTION_VOCABULARY }),
196
199
  keywords: ["archive", "archived", "delete", "deleted", "expire", "after"],
197
200
  examples: ["lifecycle_rule(expired_sessions, archived, 30, days)"],
198
201
  tags: ["lifecycle", "retention"],
@@ -1 +1 @@
1
- {"version":3,"file":"predicate-catalog-2.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-catalog-2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,eAAO,MAAM,mBAAmB,EAAE,wBAAwB,EAkOzD,CAAC"}
1
+ {"version":3,"file":"predicate-catalog-2.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-catalog-2.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,eAAO,MAAM,mBAAmB,EAAE,wBAAwB,EAoOzD,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { CODING_STANDARD_ACTION_VOCABULARY, ENVIRONMENT_DECISION_VOCABULARY, closedArguments, } from "./predicate-closed-vocabularies.js";
1
2
  // implements REQ-mcp-suggest-predicates
2
3
  export const PREDICATE_CATALOG_2 = [
3
4
  {
@@ -66,6 +67,7 @@ export const PREDICATE_CATALOG_2 = [
66
67
  description: "A named action is allowed or forbidden in a deployment environment.",
67
68
  argument_names: ["action", "decision", "environment"],
68
69
  argument_types: ["action", "decision", "environment"],
70
+ ...closedArguments({ decision: ENVIRONMENT_DECISION_VOCABULARY }),
69
71
  keywords: ["production", "staging", "forbidden", "destructive"],
70
72
  examples: [
71
73
  "environment_safety_rule(destructive_operations, forbidden, production)",
@@ -90,6 +92,7 @@ export const PREDICATE_CATALOG_2 = [
90
92
  description: "Developer-facing code must use or avoid a framework API, pattern, or documentation practice.",
91
93
  argument_names: ["subject", "action", "target"],
92
94
  argument_types: ["entity", "action", "api"],
95
+ ...closedArguments({ action: CODING_STANDARD_ACTION_VOCABULARY }),
93
96
  keywords: ["computed", "signals", "must use", "must not use"],
94
97
  examples: ["coding_standard_rule(derived_state, use, computed_signals)"],
95
98
  tags: ["coding-standard", "agent-guidance"],
@@ -1 +1 @@
1
- {"version":3,"file":"predicate-catalog-3.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-catalog-3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,eAAO,MAAM,mBAAmB,EAAE,wBAAwB,EA0NzD,CAAC"}
1
+ {"version":3,"file":"predicate-catalog-3.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-catalog-3.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,eAAO,MAAM,mBAAmB,EAAE,wBAAwB,EAgOzD,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { DECISION_VOCABULARY, OPERATOR_VOCABULARY, REFRESH_POLICY_VOCABULARY, RETENTION_UNIT_VOCABULARY, TRIGGER_VOCABULARY, closedArguments, } from "./predicate-closed-vocabularies.js";
1
2
  // implements REQ-mcp-suggest-predicates
2
3
  export const PREDICATE_CATALOG_3 = [
3
4
  {
@@ -20,6 +21,7 @@ export const PREDICATE_CATALOG_3 = [
20
21
  description: "A subject refreshes a target automatically or by a named policy.",
21
22
  argument_names: ["subject", "target", "policy"],
22
23
  argument_types: ["entity", "target", "policy"],
24
+ ...closedArguments({ policy: REFRESH_POLICY_VOCABULARY }),
23
25
  keywords: ["automatically refresh", "manual page reload", "refresh"],
24
26
  examples: ["refresh_policy_rule(dashboard, processing_videos, automatic)"],
25
27
  tags: ["refresh", "ui"],
@@ -31,6 +33,7 @@ export const PREDICATE_CATALOG_3 = [
31
33
  description: "A scoped actor is allowed or denied an action because of assignment, ownership, or membership.",
32
34
  argument_names: ["actor_scope", "action", "decision"],
33
35
  argument_types: ["actor_scope", "action", "decision"],
36
+ ...closedArguments({ decision: DECISION_VOCABULARY }),
34
37
  keywords: ["unassigned", "assigned", "denied", "scoped"],
35
38
  examples: [
36
39
  "scoped_authorization_rule(unassigned_instructors, signed_url_generation, deny)",
@@ -131,6 +134,7 @@ export const PREDICATE_CATALOG_3 = [
131
134
  description: "A trigger commits, saves, or persists a subject within a scope.",
132
135
  argument_names: ["subject", "trigger", "scope"],
133
136
  argument_types: ["entity", "trigger", "scope"],
137
+ ...closedArguments({ trigger: TRIGGER_VOCABULARY }),
134
138
  keywords: [
135
139
  "save",
136
140
  "saves",
@@ -153,6 +157,7 @@ export const PREDICATE_CATALOG_3 = [
153
157
  description: "A trigger discards or cancels changes for a subject within a scope.",
154
158
  argument_names: ["subject", "trigger", "scope"],
155
159
  argument_types: ["entity", "trigger", "scope"],
160
+ ...closedArguments({ trigger: TRIGGER_VOCABULARY }),
156
161
  keywords: ["discard", "cancel", "escape", "revert", "without save"],
157
162
  examples: ["discard_action(editor.annotation, escape, active_annotation)"],
158
163
  tags: ["persistence", "workflow"],
@@ -175,6 +180,7 @@ export const PREDICATE_CATALOG_3 = [
175
180
  description: "A subject is retained for a bounded duration.",
176
181
  argument_names: ["subject", "duration", "unit"],
177
182
  argument_types: ["entity", "number", "unit"],
183
+ ...closedArguments({ unit: RETENTION_UNIT_VOCABULARY }),
178
184
  keywords: ["retain", "retained", "retention", "days", "months", "years"],
179
185
  examples: ["retention_policy(customer.data, 7, years)"],
180
186
  tags: ["data", "policy"],
@@ -186,6 +192,7 @@ export const PREDICATE_CATALOG_3 = [
186
192
  description: "A subject constrains a resource by operator, threshold, and unit.",
187
193
  argument_names: ["subject", "resource", "operator", "threshold", "unit"],
188
194
  argument_types: ["entity", "resource", "operator", "number", "unit"],
195
+ ...closedArguments({ operator: OPERATOR_VOCABULARY }),
189
196
  keywords: [
190
197
  "limit",
191
198
  "maximum",
@@ -1 +1 @@
1
- {"version":3,"file":"predicate-catalog-4.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-catalog-4.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,eAAO,MAAM,mBAAmB,EAAE,wBAAwB,EAoTzD,CAAC"}
1
+ {"version":3,"file":"predicate-catalog-4.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-catalog-4.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,eAAO,MAAM,mBAAmB,EAAE,wBAAwB,EAqTzD,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { DECISION_VOCABULARY, closedArguments, } from "./predicate-closed-vocabularies.js";
1
2
  // implements REQ-mcp-suggest-predicates
2
3
  export const PREDICATE_CATALOG_4 = [
3
4
  {
@@ -201,6 +202,7 @@ export const PREDICATE_CATALOG_4 = [
201
202
  description: "An actor is allowed or denied an action against a resource.",
202
203
  argument_names: ["actor", "action", "resource", "decision"],
203
204
  argument_types: ["actor", "action", "resource", "decision"],
205
+ ...closedArguments({ decision: DECISION_VOCABULARY }),
204
206
  keywords: [
205
207
  "may",
206
208
  "can",
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Closed argument vocabularies shared by built-in predicate schemas. An
3
+ * argument with a natural closed vocabulary declares its constants, so
4
+ * kb_model binds a constant the claim names (or an alias of it) and lists the
5
+ * constants as `allowedValues` when the claim names none, instead of minting
6
+ * a new atom per requirement.
7
+ */
8
+ /** UI and workflow events that start a commit, discard or transition. */
9
+ export declare const TRIGGER_VOCABULARY: {
10
+ readonly constants: readonly ["escape", "cancel", "submit", "navigation", "click", "timeout"];
11
+ readonly aliases: {
12
+ readonly esc: "escape";
13
+ readonly escape_key: "escape";
14
+ readonly cancellation: "cancel";
15
+ readonly submission: "submit";
16
+ readonly navigate: "navigation";
17
+ readonly navigates: "navigation";
18
+ readonly navigating: "navigation";
19
+ readonly navigation_away: "navigation";
20
+ readonly clicks: "click";
21
+ readonly time_out: "timeout";
22
+ readonly timed_out: "timeout";
23
+ };
24
+ };
25
+ /** An authorization outcome. */
26
+ export declare const DECISION_VOCABULARY: {
27
+ readonly constants: readonly ["allow", "deny"];
28
+ readonly aliases: {
29
+ readonly assert: "allow";
30
+ readonly allowed: "allow";
31
+ readonly permit: "allow";
32
+ readonly permitted: "allow";
33
+ readonly denied: "deny";
34
+ readonly forbid: "deny";
35
+ readonly forbidden: "deny";
36
+ };
37
+ };
38
+ /** How a target is refreshed. */
39
+ export declare const REFRESH_POLICY_VOCABULARY: {
40
+ readonly constants: readonly ["automatic", "manual", "on_demand"];
41
+ readonly aliases: {
42
+ readonly auto: "automatic";
43
+ readonly automatically: "automatic";
44
+ readonly manually: "manual";
45
+ readonly "on-demand": "on_demand";
46
+ };
47
+ };
48
+ /** What an environment safety rule decides for an action. */
49
+ export declare const ENVIRONMENT_DECISION_VOCABULARY: {
50
+ readonly constants: readonly ["allowed", "forbidden", "read-only"];
51
+ readonly aliases: {
52
+ readonly allow: "allowed";
53
+ readonly deny: "forbidden";
54
+ readonly denied: "forbidden";
55
+ readonly read_only: "read-only";
56
+ readonly readonly: "read-only";
57
+ };
58
+ };
59
+ /** Comparison operators, as property_value facts spell them. */
60
+ export declare const OPERATOR_VOCABULARY: {
61
+ readonly constants: readonly ["lt", "lte", "eq", "neq", "gte", "gt"];
62
+ readonly aliases: {
63
+ readonly le: "lte";
64
+ readonly ge: "gte";
65
+ readonly ne: "neq";
66
+ };
67
+ };
68
+ /** Calendar units a retention period is stated in. */
69
+ export declare const RETENTION_UNIT_VOCABULARY: {
70
+ readonly constants: readonly ["days", "months", "years"];
71
+ readonly aliases: {
72
+ readonly day: "days";
73
+ readonly month: "months";
74
+ readonly year: "years";
75
+ };
76
+ };
77
+ /** The two directions of a coding standard. */
78
+ export declare const CODING_STANDARD_ACTION_VOCABULARY: {
79
+ readonly constants: readonly ["use", "avoid"];
80
+ readonly aliases: {};
81
+ };
82
+ /** What happens to a subject at the end of its lifecycle. */
83
+ export declare const LIFECYCLE_ACTION_VOCABULARY: {
84
+ readonly constants: readonly ["archived", "deleted", "expired"];
85
+ readonly aliases: {
86
+ readonly archive: "archived";
87
+ readonly delete: "deleted";
88
+ readonly expire: "expired";
89
+ };
90
+ };
91
+ type Vocabulary = Readonly<{
92
+ constants: readonly string[];
93
+ aliases: Readonly<Record<string, string>>;
94
+ }>;
95
+ /**
96
+ * The `argument_constants` and `argument_aliases` fields for a schema whose
97
+ * listed arguments use the given vocabularies.
98
+ */
99
+ export declare function closedArguments(byArgument: Readonly<Record<string, Vocabulary>>): {
100
+ argument_constants: Record<string, string[]>;
101
+ argument_aliases?: Record<string, Record<string, string>>;
102
+ };
103
+ export {};
104
+ //# sourceMappingURL=predicate-closed-vocabularies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predicate-closed-vocabularies.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-closed-vocabularies.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,yEAAyE;AAEzE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;CAerB,CAAC;AAEX,gCAAgC;AAEhC,eAAO,MAAM,mBAAmB;;;;;;;;;;;CAYtB,CAAC;AAEX,iCAAiC;AAEjC,eAAO,MAAM,yBAAyB;;;;;;;;CAQ5B,CAAC;AAEX,6DAA6D;AAE7D,eAAO,MAAM,+BAA+B;;;;;;;;;CASlC,CAAC;AAEX,gEAAgE;AAEhE,eAAO,MAAM,mBAAmB;;;;;;;CAGtB,CAAC;AAEX,sDAAsD;AAEtD,eAAO,MAAM,yBAAyB;;;;;;;CAG5B,CAAC;AAEX,+CAA+C;AAE/C,eAAO,MAAM,iCAAiC;;;CAGpC,CAAC;AAEX,6DAA6D;AAE7D,eAAO,MAAM,2BAA2B;;;;;;;CAG9B,CAAC;AAEX,KAAK,UAAU,GAAG,QAAQ,CAAC;IACzB,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3C,CAAC,CAAC;AAEH;;;GAGG;AAEH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAC/C;IACD,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3D,CAWA"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Closed argument vocabularies shared by built-in predicate schemas. An
3
+ * argument with a natural closed vocabulary declares its constants, so
4
+ * kb_model binds a constant the claim names (or an alias of it) and lists the
5
+ * constants as `allowedValues` when the claim names none, instead of minting
6
+ * a new atom per requirement.
7
+ */
8
+ /** UI and workflow events that start a commit, discard or transition. */
9
+ // implements REQ-model-predicates-closed-vocabularies
10
+ export const TRIGGER_VOCABULARY = {
11
+ constants: ["escape", "cancel", "submit", "navigation", "click", "timeout"],
12
+ aliases: {
13
+ esc: "escape",
14
+ escape_key: "escape",
15
+ cancellation: "cancel",
16
+ submission: "submit",
17
+ navigate: "navigation",
18
+ navigates: "navigation",
19
+ navigating: "navigation",
20
+ navigation_away: "navigation",
21
+ clicks: "click",
22
+ time_out: "timeout",
23
+ timed_out: "timeout",
24
+ },
25
+ };
26
+ /** An authorization outcome. */
27
+ // implements REQ-model-predicates-closed-vocabularies
28
+ export const DECISION_VOCABULARY = {
29
+ constants: ["allow", "deny"],
30
+ aliases: {
31
+ // permission_rule inference spells a granted permission as `assert`.
32
+ assert: "allow",
33
+ allowed: "allow",
34
+ permit: "allow",
35
+ permitted: "allow",
36
+ denied: "deny",
37
+ forbid: "deny",
38
+ forbidden: "deny",
39
+ },
40
+ };
41
+ /** How a target is refreshed. */
42
+ // implements REQ-model-predicates-closed-vocabularies
43
+ export const REFRESH_POLICY_VOCABULARY = {
44
+ constants: ["automatic", "manual", "on_demand"],
45
+ aliases: {
46
+ auto: "automatic",
47
+ automatically: "automatic",
48
+ manually: "manual",
49
+ "on-demand": "on_demand",
50
+ },
51
+ };
52
+ /** What an environment safety rule decides for an action. */
53
+ // implements REQ-model-predicates-closed-vocabularies
54
+ export const ENVIRONMENT_DECISION_VOCABULARY = {
55
+ constants: ["allowed", "forbidden", "read-only"],
56
+ aliases: {
57
+ allow: "allowed",
58
+ deny: "forbidden",
59
+ denied: "forbidden",
60
+ read_only: "read-only",
61
+ readonly: "read-only",
62
+ },
63
+ };
64
+ /** Comparison operators, as property_value facts spell them. */
65
+ // implements REQ-model-predicates-closed-vocabularies
66
+ export const OPERATOR_VOCABULARY = {
67
+ constants: ["lt", "lte", "eq", "neq", "gte", "gt"],
68
+ aliases: { le: "lte", ge: "gte", ne: "neq" },
69
+ };
70
+ /** Calendar units a retention period is stated in. */
71
+ // implements REQ-model-predicates-closed-vocabularies
72
+ export const RETENTION_UNIT_VOCABULARY = {
73
+ constants: ["days", "months", "years"],
74
+ aliases: { day: "days", month: "months", year: "years" },
75
+ };
76
+ /** The two directions of a coding standard. */
77
+ // implements REQ-model-predicates-closed-vocabularies
78
+ export const CODING_STANDARD_ACTION_VOCABULARY = {
79
+ constants: ["use", "avoid"],
80
+ aliases: {},
81
+ };
82
+ /** What happens to a subject at the end of its lifecycle. */
83
+ // implements REQ-model-predicates-closed-vocabularies
84
+ export const LIFECYCLE_ACTION_VOCABULARY = {
85
+ constants: ["archived", "deleted", "expired"],
86
+ aliases: { archive: "archived", delete: "deleted", expire: "expired" },
87
+ };
88
+ /**
89
+ * The `argument_constants` and `argument_aliases` fields for a schema whose
90
+ * listed arguments use the given vocabularies.
91
+ */
92
+ // implements REQ-model-predicates-closed-vocabularies
93
+ export function closedArguments(byArgument) {
94
+ const constants = {};
95
+ const aliases = {};
96
+ for (const [name, vocabulary] of Object.entries(byArgument)) {
97
+ constants[name] = [...vocabulary.constants];
98
+ if (Object.keys(vocabulary.aliases).length > 0)
99
+ aliases[name] = { ...vocabulary.aliases };
100
+ }
101
+ return Object.keys(aliases).length > 0
102
+ ? { argument_constants: constants, argument_aliases: aliases }
103
+ : { argument_constants: constants };
104
+ }
@@ -63,7 +63,7 @@ export interface PredicateSuggestion {
63
63
  usage_hints: PredicateUsageHints;
64
64
  };
65
65
  }
66
- export type BindingProvenance = "explicit" | "extracted" | "inferred" | "placeholder";
66
+ export type BindingProvenance = "explicit" | "requirement" | "extracted" | "inferred" | "placeholder";
67
67
  export interface PredicateScoreComponents {
68
68
  exact_pattern: number;
69
69
  keyword_hits: number;
@@ -86,6 +86,22 @@ export interface RecommendedPredicateSchema {
86
86
  rationale: string;
87
87
  reuse_scope: string;
88
88
  }
89
+ /**
90
+ * What an agent needs to bind one unbound predicate argument: its type, the
91
+ * declared constants of a closed vocabulary, schema example values and why
92
+ * the current value was not accepted.
93
+ */
94
+ export interface BindingHint {
95
+ argument: string;
96
+ position: number;
97
+ type: string;
98
+ description?: string;
99
+ allowedValues?: string[];
100
+ examples: string[];
101
+ currentValue: string;
102
+ provenance: BindingProvenance;
103
+ reason: string;
104
+ }
89
105
  /** A logical grounding relationship an existing requirement has for a claim. */
90
106
  export interface ExistingClaimGrounding {
91
107
  relationship: {
@@ -118,6 +134,8 @@ export interface SuggestPredicatesResult {
118
134
  relationshipTarget?: string | null;
119
135
  existingGrounding?: ExistingClaimGrounding[];
120
136
  replacementPlan?: Record<string, unknown> | null;
137
+ /** On provide_argument_bindings: one hint per unbound argument of the recommended candidate. */
138
+ bindingHints?: BindingHint[];
121
139
  warnings: string[];
122
140
  };
123
141
  applyPlan: Array<Record<string, unknown>>;
@@ -1 +1 @@
1
- {"version":3,"file":"predicate-types.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAGlD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAGD,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,wEAAwE;IACxE,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC9C,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,mGAAmG;IACnG,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,QAAQ,EA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,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC3C"}
@@ -4,7 +4,17 @@ export declare function clampInteger(value: number | undefined, fallback: number
4
4
  export declare function clampScore(value: number | undefined): number;
5
5
  export declare function slug(value: string): string;
6
6
  export declare function hashId(prefix: string, parts: string[]): string;
7
- export declare function inferSubject(text: string, subjectHint: string | undefined): string;
7
+ /**
8
+ * The subject a predicate binds when the caller names none. An explicit
9
+ * subjectHint wins, then the subject_key of the subject fact the requirement
10
+ * already constrains. The keyword heuristics only apply to free text: for a
11
+ * requirement without a subject fact the subject stays a placeholder, so the
12
+ * agent binds it instead of getting a demo subject such as editor.annotation.
13
+ */
14
+ export declare function inferSubject(text: string, subjectHint: string | undefined, requirement?: Readonly<{
15
+ requirementId?: string | undefined;
16
+ subjectKey?: string | undefined;
17
+ }>): string;
8
18
  export declare function inferTrigger(text: string): string;
9
19
  export declare function inferScope(text: string): string;
10
20
  export declare function normalizePredicateToken(value: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"predicate-utils.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-utils.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQlD;AAGD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,MAAM,GAAG,SAAS,CAGpB;AAGD,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,MAAM,CAIR;AAGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAM5D;AAGD,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM1C;AAGD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAO9D;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EAAE,MAAM,GACd,OAAO,CAOT;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMtD;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMlD;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAclD;AAGD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAGD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM9C;AAGD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI9C;AAGD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG/C"}
@@ -42,11 +42,23 @@ export function hashId(prefix, parts) {
42
42
  .toUpperCase();
43
43
  return `${prefix}-${digest}`;
44
44
  }
45
- // implements REQ-mcp-suggest-predicates
46
- export function inferSubject(text, subjectHint) {
45
+ /**
46
+ * The subject a predicate binds when the caller names none. An explicit
47
+ * subjectHint wins, then the subject_key of the subject fact the requirement
48
+ * already constrains. The keyword heuristics only apply to free text: for a
49
+ * requirement without a subject fact the subject stays a placeholder, so the
50
+ * agent binds it instead of getting a demo subject such as editor.annotation.
51
+ */
52
+ // implements REQ-mcp-suggest-predicates, REQ-model-predicates-requirement-subject
53
+ export function inferSubject(text, subjectHint, requirement) {
47
54
  const explicit = normalizeOptionalString(subjectHint);
48
55
  if (explicit)
49
56
  return explicit;
57
+ const grounded = normalizeOptionalString(requirement?.subjectKey);
58
+ if (grounded)
59
+ return grounded;
60
+ if (normalizeOptionalString(requirement?.requirementId))
61
+ return "requirement.subject";
50
62
  const lower = text.toLowerCase();
51
63
  if (lower.includes("annotation"))
52
64
  return "editor.annotation";
@@ -60,7 +72,7 @@ export function inferSubject(text, subjectHint) {
60
72
  return "user";
61
73
  return "requirement.subject";
62
74
  }
63
- // implements REQ-mcp-suggest-predicates
75
+ // implements REQ-mcp-suggest-predicates, REQ-model-predicates-closed-vocabularies
64
76
  export function inferTrigger(text) {
65
77
  const lower = text.toLowerCase();
66
78
  if (lower.includes("navigate"))
@@ -71,6 +83,10 @@ export function inferTrigger(text) {
71
83
  return "cancel";
72
84
  if (lower.includes("submit"))
73
85
  return "submit";
86
+ if (/\bclick/.test(lower))
87
+ return "click";
88
+ if (/\b(?:times?|timed)[\s-]?out\b/.test(lower))
89
+ return "timeout";
74
90
  return "unspecified_trigger";
75
91
  }
76
92
  // implements REQ-mcp-suggest-predicates