@suveren/gateway 0.13.0 → 0.14.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 (32) hide show
  1. package/README.md +19 -3
  2. package/bin/suveren-gateway.js +5 -0
  3. package/dist/control-plane/index.mjs +146 -114
  4. package/dist/mcp-server/http.mjs +162 -118
  5. package/dist/ui/assets/{index-CmLqzgqA.js → index-Cg6VaGKb.js} +12 -12
  6. package/dist/ui/index.html +1 -1
  7. package/lib/autostart-templates.mjs +15 -7
  8. package/node_modules/@hap/core/dist/index.d.mts +49 -1
  9. package/node_modules/@hap/core/dist/index.d.ts +49 -1
  10. package/node_modules/@hap/core/dist/index.js +50 -0
  11. package/node_modules/@hap/core/dist/index.mjs +49 -0
  12. package/node_modules/@hap/core/package.json +1 -1
  13. package/node_modules/@hap/core/src/frame.ts +63 -1
  14. package/node_modules/@hap/core/src/gatekeeper.ts +37 -0
  15. package/node_modules/@hap/core/src/types.ts +29 -1
  16. package/node_modules/hono/dist/cjs/hono-base.js +2 -0
  17. package/node_modules/hono/dist/cjs/middleware/language/language.js +1 -1
  18. package/node_modules/hono/dist/cjs/middleware/mount/index.js +71 -0
  19. package/node_modules/hono/dist/cjs/request.js +4 -4
  20. package/node_modules/hono/dist/hono-base.js +2 -0
  21. package/node_modules/hono/dist/middleware/mount/index.js +70 -0
  22. package/node_modules/hono/dist/request.js +4 -4
  23. package/node_modules/hono/dist/types/hono-base.d.ts +2 -0
  24. package/node_modules/hono/dist/types/jsx/base.d.ts +1 -1
  25. package/node_modules/hono/dist/types/middleware/mount/index.d.ts +46 -0
  26. package/node_modules/hono/dist/types/request.d.ts +4 -4
  27. package/node_modules/hono/package.json +9 -1
  28. package/package.json +2 -2
  29. package/profiles/index.json +3 -1
  30. package/profiles/purchase/0.6.profile.json +234 -0
  31. package/profiles/sales/0.3.profile.json +290 -0
  32. package/server.js +6 -3
@@ -0,0 +1,290 @@
1
+ {
2
+ "id": "github.com/humanagencyprotocol/hap-profiles/sales@0.3",
3
+ "name": "Sales",
4
+ "version": "0.3",
5
+ "description": "Sales authority — governs quote-to-order in an ERP: draft quotes, send quotes to customers, convert quotes to orders. No invoicing, delivery, payments or master data.",
6
+ "boundsSchema": {
7
+ "actionTypes": [
8
+ "quote",
9
+ "send",
10
+ "order",
11
+ "setup"
12
+ ],
13
+ "keyOrder": [
14
+ "profile",
15
+ "read_access",
16
+ "value_max",
17
+ "discount_max",
18
+ "order_value_daily_max",
19
+ "quote_daily_max",
20
+ "send_daily_max",
21
+ "order_daily_max",
22
+ "setup_daily_max"
23
+ ],
24
+ "fields": {
25
+ "profile": {
26
+ "type": "string",
27
+ "required": true
28
+ },
29
+ "read_access": {
30
+ "type": "string",
31
+ "required": true,
32
+ "displayName": "Read access",
33
+ "description": "Allow the agent to look up items, stock, list prices, customers (incl. credit limit and open balance), quotes and orders.",
34
+ "boundType": {
35
+ "kind": "enum",
36
+ "values": [
37
+ "unlimited",
38
+ "none"
39
+ ]
40
+ },
41
+ "toolsDescription": "list_items, get_item, find_customers, get_customer, list_quotes, get_quote, list_orders, get_order",
42
+ "default": "unlimited"
43
+ },
44
+ "value_max": {
45
+ "type": "number",
46
+ "required": true,
47
+ "displayName": "Max value per quote or order",
48
+ "description": "Maximum net document total of a single quote or order, in currency units. The connector recalculates the total from the lines and refuses a call whose declared value does not match.",
49
+ "unit": "currency:EUR",
50
+ "boundType": {
51
+ "kind": "per_transaction",
52
+ "of": "value",
53
+ "requiredFor": [
54
+ "quote",
55
+ "order"
56
+ ]
57
+ }
58
+ },
59
+ "discount_max": {
60
+ "type": "number",
61
+ "required": true,
62
+ "displayName": "Max discount",
63
+ "description": "Maximum document discount against list price, in percent. 0 means list price only. The connector recalculates the discount from list prices and refuses a call whose declared discount does not match.",
64
+ "unit": "percent",
65
+ "boundType": {
66
+ "kind": "per_transaction",
67
+ "of": "discount_pct",
68
+ "requiredFor": [
69
+ "quote",
70
+ "order"
71
+ ]
72
+ }
73
+ },
74
+ "order_value_daily_max": {
75
+ "type": "number",
76
+ "required": true,
77
+ "displayName": "Daily order value",
78
+ "description": "Maximum cumulative net value of orders created per day, in currency units.",
79
+ "unit": "currency:EUR",
80
+ "boundType": {
81
+ "kind": "cumulative_sum",
82
+ "of": "value",
83
+ "window": "daily"
84
+ },
85
+ "appliesTo": [
86
+ "order"
87
+ ]
88
+ },
89
+ "quote_daily_max": {
90
+ "type": "number",
91
+ "required": true,
92
+ "displayName": "Quotes per day",
93
+ "description": "Maximum draft quotes created or edited per day",
94
+ "unit": "count",
95
+ "boundType": {
96
+ "kind": "cumulative_count",
97
+ "window": "daily"
98
+ },
99
+ "appliesTo": [
100
+ "quote"
101
+ ]
102
+ },
103
+ "send_daily_max": {
104
+ "type": "number",
105
+ "required": true,
106
+ "displayName": "Quotes sent per day",
107
+ "description": "Maximum quotes sent to customers per day. Sending a quote is a binding offer.",
108
+ "unit": "count",
109
+ "boundType": {
110
+ "kind": "cumulative_count",
111
+ "window": "daily"
112
+ },
113
+ "appliesTo": [
114
+ "send"
115
+ ]
116
+ },
117
+ "order_daily_max": {
118
+ "type": "number",
119
+ "required": true,
120
+ "displayName": "Orders per day",
121
+ "description": "Maximum quotes converted to orders per day. An order reserves stock and commits a delivery date.",
122
+ "unit": "count",
123
+ "boundType": {
124
+ "kind": "cumulative_count",
125
+ "window": "daily"
126
+ },
127
+ "appliesTo": [
128
+ "order"
129
+ ]
130
+ },
131
+ "setup_daily_max": {
132
+ "type": "number",
133
+ "required": true,
134
+ "displayName": "Test-data loads per day",
135
+ "description": "How many times per day the simulated system may be loaded with a simulation package (load_simulation). Only works while the connector runs in simulation mode, and only into an empty system — a load cannot edit or replace existing test data. 0 = not allowed. Grant it only in a separate setup mandate, never in the mandate the AI uses for its work.",
136
+ "unit": "count",
137
+ "boundType": {
138
+ "kind": "cumulative_count",
139
+ "window": "daily"
140
+ },
141
+ "appliesTo": [
142
+ "setup"
143
+ ],
144
+ "default": 0
145
+ }
146
+ }
147
+ },
148
+ "contextSchema": {
149
+ "keyOrder": [
150
+ "currency"
151
+ ],
152
+ "fields": {
153
+ "currency": {
154
+ "type": "string",
155
+ "required": true,
156
+ "displayName": "Currency",
157
+ "description": "Permitted document currency",
158
+ "constraint": {
159
+ "type": "string",
160
+ "enforceable": [
161
+ "enum"
162
+ ]
163
+ },
164
+ "enum": [
165
+ "EUR",
166
+ "CHF",
167
+ "USD",
168
+ "GBP"
169
+ ]
170
+ }
171
+ }
172
+ },
173
+ "executionContextSchema": {
174
+ "fields": {
175
+ "value": {
176
+ "source": "declared",
177
+ "description": "Net document total in currency units (verified by the connector against the lines)",
178
+ "required": true,
179
+ "constraint": {
180
+ "type": "number",
181
+ "enforceable": [
182
+ "max"
183
+ ]
184
+ }
185
+ },
186
+ "discount_pct": {
187
+ "source": "declared",
188
+ "description": "Document discount against list price in percent (verified by the connector against list prices)",
189
+ "required": true,
190
+ "constraint": {
191
+ "type": "number",
192
+ "enforceable": [
193
+ "max"
194
+ ]
195
+ }
196
+ },
197
+ "currency": {
198
+ "source": "declared",
199
+ "description": "Document currency",
200
+ "required": true,
201
+ "constraint": {
202
+ "type": "string",
203
+ "enforceable": [
204
+ "enum"
205
+ ]
206
+ }
207
+ },
208
+ "order_value_daily": {
209
+ "source": "cumulative",
210
+ "description": "Running daily order value (resolved from execution log)",
211
+ "required": true,
212
+ "constraint": {
213
+ "type": "number",
214
+ "enforceable": [
215
+ "max"
216
+ ]
217
+ },
218
+ "cumulativeField": "value",
219
+ "window": "daily"
220
+ },
221
+ "quote_count_daily": {
222
+ "source": "cumulative",
223
+ "description": "Running daily quote count",
224
+ "required": true,
225
+ "constraint": {
226
+ "type": "number",
227
+ "enforceable": [
228
+ "max"
229
+ ]
230
+ },
231
+ "cumulativeField": "_count",
232
+ "window": "daily"
233
+ },
234
+ "send_count_daily": {
235
+ "source": "cumulative",
236
+ "description": "Running daily send count",
237
+ "required": true,
238
+ "constraint": {
239
+ "type": "number",
240
+ "enforceable": [
241
+ "max"
242
+ ]
243
+ },
244
+ "cumulativeField": "_count",
245
+ "window": "daily"
246
+ },
247
+ "order_count_daily": {
248
+ "source": "cumulative",
249
+ "description": "Running daily order count",
250
+ "required": true,
251
+ "constraint": {
252
+ "type": "number",
253
+ "enforceable": [
254
+ "max"
255
+ ]
256
+ },
257
+ "cumulativeField": "_count",
258
+ "window": "daily"
259
+ },
260
+ "setup_count_daily": {
261
+ "source": "cumulative",
262
+ "cumulativeField": "_count",
263
+ "window": "daily",
264
+ "description": "Running daily count of test-data loads",
265
+ "required": true,
266
+ "constraint": {
267
+ "type": "number",
268
+ "enforceable": [
269
+ "max"
270
+ ]
271
+ }
272
+ }
273
+ }
274
+ },
275
+ "requiredGates": [
276
+ "bounds",
277
+ "intent",
278
+ "commitment",
279
+ "decision_owner"
280
+ ],
281
+ "ttl": {
282
+ "default": 86400,
283
+ "max": 2592000
284
+ },
285
+ "retention_minimum": 7776000,
286
+ "content_binding": {
287
+ "version": "1",
288
+ "kind": "jcs"
289
+ }
290
+ }
package/server.js CHANGED
@@ -95,7 +95,7 @@ if (savedCaFile && !process.env.SUVEREN_CA_REEXEC_DONE) {
95
95
  const child = spawn(
96
96
  process.execPath,
97
97
  [THIS_FILE, ...process.argv.slice(2)],
98
- { env: { ...process.env, NODE_EXTRA_CA_CERTS: effectiveCaFile, SUVEREN_CA_REEXEC_DONE: '1' }, stdio: 'inherit' },
98
+ { env: { ...process.env, NODE_EXTRA_CA_CERTS: effectiveCaFile, SUVEREN_CA_REEXEC_DONE: '1' }, stdio: 'inherit', windowsHide: true },
99
99
  );
100
100
  child.on('exit', (code, signal) => {
101
101
  if (combinedDirToClean) {
@@ -206,13 +206,16 @@ const env = {
206
206
  const cp = spawn(
207
207
  process.execPath,
208
208
  [join(__dirname, 'dist', 'control-plane', 'index.mjs')],
209
- { env, stdio: 'inherit' },
209
+ // windowsHide: on Windows 11 ARM (x64 emulation) these children otherwise got
210
+ // their own visible console windows even under a hidden parent — seen in CI
211
+ // and in a real ARM VM. No effect on macOS/Linux; output still goes to stdio.
212
+ { env, stdio: 'inherit', windowsHide: true },
210
213
  );
211
214
 
212
215
  const mcp = spawn(
213
216
  process.execPath,
214
217
  [join(__dirname, 'dist', 'mcp-server', 'http.mjs')],
215
- { env, stdio: 'inherit' },
218
+ { env, stdio: 'inherit', windowsHide: true },
216
219
  );
217
220
 
218
221
  const children = [