@source-repo/rpc-cli 4.5.0 → 5.0.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 (55) hide show
  1. package/README.md +1 -0
  2. package/dist/console.d.ts +15 -2
  3. package/dist/console.d.ts.map +1 -1
  4. package/dist/console.js +49 -15
  5. package/dist/console.js.map +1 -1
  6. package/dist/console.types.json +483 -0
  7. package/dist/credentials.d.ts +77 -0
  8. package/dist/credentials.d.ts.map +1 -0
  9. package/dist/credentials.js +118 -0
  10. package/dist/credentials.js.map +1 -0
  11. package/dist/enrolment.d.ts +91 -0
  12. package/dist/enrolment.d.ts.map +1 -0
  13. package/dist/enrolment.js +94 -0
  14. package/dist/enrolment.js.map +1 -0
  15. package/dist/extract.d.ts.map +1 -1
  16. package/dist/extract.js +97 -3
  17. package/dist/extract.js.map +1 -1
  18. package/dist/grants.d.ts +25 -0
  19. package/dist/grants.d.ts.map +1 -0
  20. package/dist/grants.js +62 -0
  21. package/dist/grants.js.map +1 -0
  22. package/dist/index.js +254 -41
  23. package/dist/index.js.map +1 -1
  24. package/dist/mcp.d.ts +5 -0
  25. package/dist/mcp.d.ts.map +1 -1
  26. package/dist/mcp.js +329 -2
  27. package/dist/mcp.js.map +1 -1
  28. package/dist/network.d.ts +47 -1
  29. package/dist/network.d.ts.map +1 -1
  30. package/dist/network.js +17 -1
  31. package/dist/network.js.map +1 -1
  32. package/dist/node.d.ts +15 -0
  33. package/dist/node.d.ts.map +1 -1
  34. package/dist/node.js +14 -1
  35. package/dist/node.js.map +1 -1
  36. package/dist/pairing.d.ts +52 -0
  37. package/dist/pairing.d.ts.map +1 -0
  38. package/dist/pairing.js +57 -0
  39. package/dist/pairing.js.map +1 -0
  40. package/dist/scripting.d.ts +10 -0
  41. package/dist/scripting.d.ts.map +1 -1
  42. package/dist/scripting.js +2 -2
  43. package/dist/scripting.js.map +1 -1
  44. package/dist/scripts.d.ts +27 -3
  45. package/dist/scripts.d.ts.map +1 -1
  46. package/dist/scripts.js +31 -8
  47. package/dist/scripts.js.map +1 -1
  48. package/dist/tasks.d.ts +189 -0
  49. package/dist/tasks.d.ts.map +1 -0
  50. package/dist/tasks.js +485 -0
  51. package/dist/tasks.js.map +1 -0
  52. package/dist/web/app.css +1 -1
  53. package/dist/web/app.js +12 -12
  54. package/dist/web/app.js.map +1 -1
  55. package/package.json +7 -5
@@ -162,6 +162,16 @@
162
162
  }
163
163
  }
164
164
  },
165
+ "elevated": {
166
+ "type": {
167
+ "kind": "array",
168
+ "items": {
169
+ "kind": "ref",
170
+ "name": "RpcElevation"
171
+ }
172
+ },
173
+ "optional": true
174
+ },
165
175
  "host": {
166
176
  "type": {
167
177
  "kind": "object",
@@ -919,6 +929,16 @@
919
929
  "type": {
920
930
  "kind": "number"
921
931
  }
932
+ },
933
+ "resources": {
934
+ "type": {
935
+ "kind": "array",
936
+ "items": {
937
+ "kind": "ref",
938
+ "name": "RpcDataResource"
939
+ }
940
+ },
941
+ "optional": true
922
942
  }
923
943
  }
924
944
  },
@@ -1233,6 +1253,400 @@
1233
1253
  }
1234
1254
  }
1235
1255
  },
1256
+ "RpcDataResource": {
1257
+ "kind": "object",
1258
+ "fields": {
1259
+ "path": {
1260
+ "type": {
1261
+ "kind": "array",
1262
+ "items": {
1263
+ "kind": "string"
1264
+ }
1265
+ }
1266
+ },
1267
+ "row": {
1268
+ "type": {
1269
+ "kind": "union",
1270
+ "options": [
1271
+ {
1272
+ "kind": "object",
1273
+ "fields": {
1274
+ "kind": {
1275
+ "type": {
1276
+ "kind": "literal",
1277
+ "value": "any"
1278
+ }
1279
+ }
1280
+ }
1281
+ },
1282
+ {
1283
+ "kind": "object",
1284
+ "fields": {
1285
+ "kind": {
1286
+ "type": {
1287
+ "kind": "literal",
1288
+ "value": "null"
1289
+ }
1290
+ }
1291
+ }
1292
+ },
1293
+ {
1294
+ "kind": "object",
1295
+ "fields": {
1296
+ "kind": {
1297
+ "type": {
1298
+ "kind": "literal",
1299
+ "value": "boolean"
1300
+ }
1301
+ }
1302
+ }
1303
+ },
1304
+ {
1305
+ "kind": "object",
1306
+ "fields": {
1307
+ "kind": {
1308
+ "type": {
1309
+ "kind": "literal",
1310
+ "value": "number"
1311
+ }
1312
+ },
1313
+ "integer": {
1314
+ "type": {
1315
+ "kind": "boolean"
1316
+ },
1317
+ "optional": true
1318
+ },
1319
+ "min": {
1320
+ "type": {
1321
+ "kind": "number"
1322
+ },
1323
+ "optional": true
1324
+ },
1325
+ "max": {
1326
+ "type": {
1327
+ "kind": "number"
1328
+ },
1329
+ "optional": true
1330
+ }
1331
+ }
1332
+ },
1333
+ {
1334
+ "kind": "object",
1335
+ "fields": {
1336
+ "kind": {
1337
+ "type": {
1338
+ "kind": "literal",
1339
+ "value": "string"
1340
+ }
1341
+ },
1342
+ "pattern": {
1343
+ "type": {
1344
+ "kind": "string"
1345
+ },
1346
+ "optional": true
1347
+ },
1348
+ "minLength": {
1349
+ "type": {
1350
+ "kind": "number"
1351
+ },
1352
+ "optional": true
1353
+ },
1354
+ "maxLength": {
1355
+ "type": {
1356
+ "kind": "number"
1357
+ },
1358
+ "optional": true
1359
+ }
1360
+ }
1361
+ },
1362
+ {
1363
+ "kind": "object",
1364
+ "fields": {
1365
+ "kind": {
1366
+ "type": {
1367
+ "kind": "literal",
1368
+ "value": "bytes"
1369
+ }
1370
+ },
1371
+ "maxBytes": {
1372
+ "type": {
1373
+ "kind": "number"
1374
+ },
1375
+ "optional": true
1376
+ }
1377
+ }
1378
+ },
1379
+ {
1380
+ "kind": "object",
1381
+ "fields": {
1382
+ "kind": {
1383
+ "type": {
1384
+ "kind": "literal",
1385
+ "value": "date"
1386
+ }
1387
+ }
1388
+ }
1389
+ },
1390
+ {
1391
+ "kind": "object",
1392
+ "fields": {
1393
+ "kind": {
1394
+ "type": {
1395
+ "kind": "literal",
1396
+ "value": "literal"
1397
+ }
1398
+ },
1399
+ "value": {
1400
+ "type": {
1401
+ "kind": "union",
1402
+ "options": [
1403
+ {
1404
+ "kind": "null"
1405
+ },
1406
+ {
1407
+ "kind": "string"
1408
+ },
1409
+ {
1410
+ "kind": "number"
1411
+ },
1412
+ {
1413
+ "kind": "literal",
1414
+ "value": false
1415
+ },
1416
+ {
1417
+ "kind": "literal",
1418
+ "value": true
1419
+ }
1420
+ ]
1421
+ },
1422
+ "optional": true
1423
+ }
1424
+ }
1425
+ },
1426
+ {
1427
+ "kind": "object",
1428
+ "fields": {
1429
+ "kind": {
1430
+ "type": {
1431
+ "kind": "literal",
1432
+ "value": "array"
1433
+ }
1434
+ },
1435
+ "items": {
1436
+ "type": {
1437
+ "kind": "ref",
1438
+ "name": "TypeNode"
1439
+ }
1440
+ },
1441
+ "maxItems": {
1442
+ "type": {
1443
+ "kind": "number"
1444
+ },
1445
+ "optional": true
1446
+ }
1447
+ }
1448
+ },
1449
+ {
1450
+ "kind": "object",
1451
+ "fields": {
1452
+ "kind": {
1453
+ "type": {
1454
+ "kind": "literal",
1455
+ "value": "tuple"
1456
+ }
1457
+ },
1458
+ "items": {
1459
+ "type": {
1460
+ "kind": "array",
1461
+ "items": {
1462
+ "kind": "ref",
1463
+ "name": "TypeNode"
1464
+ }
1465
+ }
1466
+ }
1467
+ }
1468
+ },
1469
+ {
1470
+ "kind": "object",
1471
+ "fields": {
1472
+ "kind": {
1473
+ "type": {
1474
+ "kind": "literal",
1475
+ "value": "object"
1476
+ }
1477
+ },
1478
+ "fields": {
1479
+ "type": {
1480
+ "kind": "record",
1481
+ "values": {
1482
+ "kind": "ref",
1483
+ "name": "FieldNode"
1484
+ }
1485
+ }
1486
+ },
1487
+ "additional": {
1488
+ "type": {
1489
+ "kind": "boolean"
1490
+ },
1491
+ "optional": true
1492
+ }
1493
+ }
1494
+ },
1495
+ {
1496
+ "kind": "object",
1497
+ "fields": {
1498
+ "kind": {
1499
+ "type": {
1500
+ "kind": "literal",
1501
+ "value": "record"
1502
+ }
1503
+ },
1504
+ "values": {
1505
+ "type": {
1506
+ "kind": "ref",
1507
+ "name": "TypeNode"
1508
+ }
1509
+ },
1510
+ "keyPattern": {
1511
+ "type": {
1512
+ "kind": "string"
1513
+ },
1514
+ "optional": true
1515
+ },
1516
+ "maxEntries": {
1517
+ "type": {
1518
+ "kind": "number"
1519
+ },
1520
+ "optional": true
1521
+ }
1522
+ }
1523
+ },
1524
+ {
1525
+ "kind": "object",
1526
+ "fields": {
1527
+ "kind": {
1528
+ "type": {
1529
+ "kind": "literal",
1530
+ "value": "union"
1531
+ }
1532
+ },
1533
+ "options": {
1534
+ "type": {
1535
+ "kind": "array",
1536
+ "items": {
1537
+ "kind": "ref",
1538
+ "name": "TypeNode"
1539
+ }
1540
+ }
1541
+ }
1542
+ }
1543
+ },
1544
+ {
1545
+ "kind": "object",
1546
+ "fields": {
1547
+ "kind": {
1548
+ "type": {
1549
+ "kind": "literal",
1550
+ "value": "ref"
1551
+ }
1552
+ },
1553
+ "name": {
1554
+ "type": {
1555
+ "kind": "string"
1556
+ }
1557
+ }
1558
+ }
1559
+ }
1560
+ ]
1561
+ },
1562
+ "optional": true
1563
+ },
1564
+ "verbs": {
1565
+ "type": {
1566
+ "kind": "array",
1567
+ "items": {
1568
+ "kind": "ref",
1569
+ "name": "RpcDataMethod"
1570
+ }
1571
+ }
1572
+ },
1573
+ "shape": {
1574
+ "type": {
1575
+ "kind": "union",
1576
+ "options": [
1577
+ {
1578
+ "kind": "literal",
1579
+ "value": "list"
1580
+ },
1581
+ {
1582
+ "kind": "literal",
1583
+ "value": "tree"
1584
+ }
1585
+ ]
1586
+ },
1587
+ "optional": true
1588
+ },
1589
+ "label": {
1590
+ "type": {
1591
+ "kind": "string"
1592
+ },
1593
+ "optional": true
1594
+ },
1595
+ "actions": {
1596
+ "type": {
1597
+ "kind": "array",
1598
+ "items": {
1599
+ "kind": "ref",
1600
+ "name": "RpcDataAction"
1601
+ }
1602
+ },
1603
+ "optional": true
1604
+ }
1605
+ }
1606
+ },
1607
+ "RpcDataMethod": {
1608
+ "kind": "union",
1609
+ "options": [
1610
+ {
1611
+ "kind": "literal",
1612
+ "value": "getList"
1613
+ },
1614
+ {
1615
+ "kind": "literal",
1616
+ "value": "getOne"
1617
+ },
1618
+ {
1619
+ "kind": "literal",
1620
+ "value": "getMany"
1621
+ },
1622
+ {
1623
+ "kind": "literal",
1624
+ "value": "getManyReference"
1625
+ }
1626
+ ]
1627
+ },
1628
+ "RpcDataAction": {
1629
+ "kind": "object",
1630
+ "fields": {
1631
+ "method": {
1632
+ "type": {
1633
+ "kind": "string"
1634
+ }
1635
+ },
1636
+ "label": {
1637
+ "type": {
1638
+ "kind": "string"
1639
+ },
1640
+ "optional": true
1641
+ },
1642
+ "confirm": {
1643
+ "type": {
1644
+ "kind": "boolean"
1645
+ },
1646
+ "optional": true
1647
+ }
1648
+ }
1649
+ },
1236
1650
  "DescribedTopology": {
1237
1651
  "kind": "object",
1238
1652
  "fields": {
@@ -1940,6 +2354,36 @@
1940
2354
  },
1941
2355
  "optional": true
1942
2356
  },
2357
+ "effect": {
2358
+ "type": {
2359
+ "kind": "union",
2360
+ "options": [
2361
+ {
2362
+ "kind": "literal",
2363
+ "value": "observe"
2364
+ },
2365
+ {
2366
+ "kind": "literal",
2367
+ "value": "operate"
2368
+ },
2369
+ {
2370
+ "kind": "literal",
2371
+ "value": "program"
2372
+ },
2373
+ {
2374
+ "kind": "literal",
2375
+ "value": "security-admin"
2376
+ }
2377
+ ]
2378
+ },
2379
+ "optional": true
2380
+ },
2381
+ "sets": {
2382
+ "type": {
2383
+ "kind": "string"
2384
+ },
2385
+ "optional": true
2386
+ },
1943
2387
  "requiresAuthority": {
1944
2388
  "type": {
1945
2389
  "kind": "boolean"
@@ -1973,6 +2417,40 @@
1973
2417
  }
1974
2418
  }
1975
2419
  },
2420
+ "RpcElevation": {
2421
+ "kind": "object",
2422
+ "fields": {
2423
+ "capability": {
2424
+ "type": {
2425
+ "kind": "string"
2426
+ }
2427
+ },
2428
+ "reason": {
2429
+ "type": {
2430
+ "kind": "string"
2431
+ },
2432
+ "optional": true
2433
+ },
2434
+ "since": {
2435
+ "type": {
2436
+ "kind": "number"
2437
+ },
2438
+ "optional": true
2439
+ },
2440
+ "until": {
2441
+ "type": {
2442
+ "kind": "number"
2443
+ },
2444
+ "optional": true
2445
+ },
2446
+ "grantedBy": {
2447
+ "type": {
2448
+ "kind": "string"
2449
+ },
2450
+ "optional": true
2451
+ }
2452
+ }
2453
+ },
1976
2454
  "RpcTopologyCapabilities": {
1977
2455
  "kind": "object",
1978
2456
  "fields": {
@@ -2070,6 +2548,11 @@
2070
2548
  "kind": "string"
2071
2549
  }
2072
2550
  }
2551
+ },
2552
+ "owner": {
2553
+ "type": {
2554
+ "kind": "string"
2555
+ }
2073
2556
  }
2074
2557
  }
2075
2558
  },
@@ -0,0 +1,77 @@
1
+ import type { ServerOptions as TlsServerOptions } from 'node:https';
2
+ import { type MessageSigner, type MessageVerifier, type TokenGrant } from '@source-repo/rpc';
3
+ export interface SigningKeys {
4
+ name?: string;
5
+ secret: string;
6
+ peers?: {
7
+ [peer: string]: string;
8
+ };
9
+ }
10
+ export interface Signing {
11
+ keys: SigningKeys;
12
+ sign: MessageSigner;
13
+ verify?: MessageVerifier;
14
+ }
15
+ export interface LoadedSigningKeys extends Signing {
16
+ readableByOthers: boolean;
17
+ }
18
+ /**
19
+ * Whether anyone but the owner can read a file holding secrets.
20
+ *
21
+ * Reported rather than refused: a mode nobody can read is not always achievable - a mounted config
22
+ * map, a Windows filesystem - and a command that stopped there would be a command nobody could run
23
+ * in those places. Saying it once is what makes the ordinary case, where the mode is simply wrong,
24
+ * visible to whoever started it.
25
+ */
26
+ export declare const readableByOthers: (path: string) => boolean;
27
+ /**
28
+ * The signer and verifier for one identity, wherever its secrets were written down.
29
+ *
30
+ * `where` names that place in the errors - a key file's path, or the task the keys are written
31
+ * inside - because the reader has to go and edit it, and "has no secret" without an address is a
32
+ * message that sends someone looking through every file they have.
33
+ */
34
+ export declare const signingFrom: (value: unknown, where: string) => Signing;
35
+ /** Read and validate one peer's HMAC identity without deciding how a command reports failures. */
36
+ export declare const loadSigningKeys: (path: string) => LoadedSigningKeys;
37
+ /**
38
+ * The certificate and key a server serves TLS with.
39
+ *
40
+ * Paths rather than contents wherever this is configured, and both halves together: a PEM on a
41
+ * command line would be in `ps` and in the shell history, and a certificate without its key opens a
42
+ * port that listens and then fails every handshake.
43
+ */
44
+ export declare const loadTls: (certPath: string, keyPath: string) => TlsServerOptions;
45
+ export interface AuthFile {
46
+ token?: string;
47
+ tokens?: {
48
+ [token: string]: TokenGrant;
49
+ };
50
+ /**
51
+ * This node's own signing secret, for minting credentials for the scripts it starts. Present on
52
+ * a node; the bus that should accept those credentials lists the same secret under `issuers`.
53
+ */
54
+ derive?: string;
55
+ /**
56
+ * Issuer peer name -> the secret it mints with. Present on a bus: it says which nodes this bus
57
+ * lets speak for the programs they start, which is a decision about nodes rather than programs.
58
+ */
59
+ issuers?: {
60
+ [issuer: string]: string;
61
+ };
62
+ }
63
+ export interface LoadedAuth {
64
+ auth: AuthFile;
65
+ readableByOthers: boolean;
66
+ }
67
+ /** Read the credentials a command presents, or the grants a bus accepts, from a file. */
68
+ export declare const loadAuthFile: (path: string) => LoadedAuth;
69
+ /**
70
+ * Mints each script its own short-lived credential, or nothing when this peer holds no `derive`
71
+ * secret - in which case scripts start unauthenticated rather than borrowing the node's identity.
72
+ */
73
+ export declare const scriptCredentials: (auth: Pick<AuthFile, 'token' | 'tokens' | 'derive' | 'issuers'>, issuer: string, warning?: (message: string) => void) => ((script: string) => Promise<{
74
+ name: string;
75
+ token: string;
76
+ }>) | undefined;
77
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EAIH,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK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