@kya-os/contracts 1.3.3 → 1.3.5

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 (66) hide show
  1. package/package.json +3 -2
  2. package/README.md +0 -130
  3. package/dist/agentshield-api/endpoints.d.ts +0 -21
  4. package/dist/agentshield-api/endpoints.js +0 -20
  5. package/dist/agentshield-api/index.d.ts +0 -5
  6. package/dist/agentshield-api/index.js +0 -27
  7. package/dist/agentshield-api/schemas.d.ts +0 -9846
  8. package/dist/agentshield-api/schemas.js +0 -92
  9. package/dist/agentshield-api/types.d.ts +0 -92
  10. package/dist/agentshield-api/types.js +0 -12
  11. package/dist/config/base.d.ts +0 -19
  12. package/dist/config/base.js +0 -2
  13. package/dist/config/delegation.d.ts +0 -46
  14. package/dist/config/delegation.js +0 -2
  15. package/dist/config/identity.d.ts +0 -22
  16. package/dist/config/identity.js +0 -2
  17. package/dist/config/index.d.ts +0 -17
  18. package/dist/config/index.js +0 -2
  19. package/dist/config/proofing.d.ts +0 -26
  20. package/dist/config/proofing.js +0 -2
  21. package/dist/config/tool-protection.d.ts +0 -36
  22. package/dist/config/tool-protection.js +0 -2
  23. package/dist/delegation/constraints.d.ts +0 -726
  24. package/dist/delegation/constraints.js +0 -103
  25. package/dist/delegation/index.d.ts +0 -2
  26. package/dist/delegation/index.js +0 -18
  27. package/dist/delegation/schemas.d.ts +0 -8042
  28. package/dist/delegation/schemas.js +0 -232
  29. package/dist/did/index.d.ts +0 -3
  30. package/dist/did/index.js +0 -19
  31. package/dist/did/resolve-contract.d.ts +0 -53
  32. package/dist/did/resolve-contract.js +0 -12
  33. package/dist/did/schemas.d.ts +0 -33
  34. package/dist/did/schemas.js +0 -80
  35. package/dist/did/types.d.ts +0 -38
  36. package/dist/did/types.js +0 -37
  37. package/dist/env/constants.d.ts +0 -13
  38. package/dist/env/constants.js +0 -15
  39. package/dist/env/index.d.ts +0 -1
  40. package/dist/env/index.js +0 -17
  41. package/dist/proof/index.d.ts +0 -2
  42. package/dist/proof/index.js +0 -18
  43. package/dist/proof/proof-record.d.ts +0 -728
  44. package/dist/proof/proof-record.js +0 -60
  45. package/dist/proof/signing-spec.d.ts +0 -73
  46. package/dist/proof/signing-spec.js +0 -52
  47. package/dist/runtime/errors.d.ts +0 -179
  48. package/dist/runtime/errors.js +0 -51
  49. package/dist/runtime/headers.d.ts +0 -34
  50. package/dist/runtime/headers.js +0 -52
  51. package/dist/runtime/index.d.ts +0 -2
  52. package/dist/runtime/index.js +0 -18
  53. package/dist/tlkrc/index.d.ts +0 -1
  54. package/dist/tlkrc/index.js +0 -17
  55. package/dist/tlkrc/rotation.d.ts +0 -168
  56. package/dist/tlkrc/rotation.js +0 -55
  57. package/dist/tool-protection/index.d.ts +0 -129
  58. package/dist/tool-protection/index.js +0 -80
  59. package/dist/vc/index.d.ts +0 -2
  60. package/dist/vc/index.js +0 -18
  61. package/dist/vc/schemas.d.ts +0 -1888
  62. package/dist/vc/schemas.js +0 -116
  63. package/dist/vc/statuslist.d.ts +0 -292
  64. package/dist/vc/statuslist.js +0 -61
  65. package/dist/well-known/index.d.ts +0 -248
  66. package/dist/well-known/index.js +0 -104
@@ -1,103 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAX_WINDOW_DURATION_SEC = exports.MAX_BUDGET_CAP = exports.SUPPORTED_MATCHERS = exports.SUPPORTED_CURRENCIES = exports.DelegationConstraintsSchema = exports.CrispScopeSchema = exports.ScopeMatcherSchema = exports.CrispBudgetSchema = exports.BudgetWindowSchema = exports.WindowKindSchema = exports.CurrencySchema = void 0;
4
- exports.validateDelegationConstraints = validateDelegationConstraints;
5
- exports.hasValidTimeRange = hasValidTimeRange;
6
- exports.areChildConstraintsValid = areChildConstraintsValid;
7
- exports.doesResourceMatchScope = doesResourceMatchScope;
8
- const zod_1 = require("zod");
9
- exports.CurrencySchema = zod_1.z.enum(['USD', 'ops', 'points']);
10
- exports.WindowKindSchema = zod_1.z.enum(['rolling', 'fixed']);
11
- exports.BudgetWindowSchema = zod_1.z.object({
12
- kind: exports.WindowKindSchema,
13
- durationSec: zod_1.z.number().int().positive(),
14
- });
15
- exports.CrispBudgetSchema = zod_1.z.object({
16
- unit: exports.CurrencySchema,
17
- cap: zod_1.z.number().nonnegative(),
18
- window: exports.BudgetWindowSchema.optional(),
19
- });
20
- exports.ScopeMatcherSchema = zod_1.z.enum(['exact', 'prefix', 'regex']);
21
- exports.CrispScopeSchema = zod_1.z.object({
22
- resource: zod_1.z.string().min(1),
23
- matcher: exports.ScopeMatcherSchema,
24
- constraints: zod_1.z.record(zod_1.z.any()).optional(),
25
- });
26
- exports.DelegationConstraintsSchema = zod_1.z.object({
27
- notBefore: zod_1.z.number().int().optional(),
28
- notAfter: zod_1.z.number().int().optional(),
29
- scopes: zod_1.z.array(zod_1.z.string()).optional(),
30
- crisp: zod_1.z.object({
31
- budget: exports.CrispBudgetSchema.optional(),
32
- scopes: zod_1.z.array(exports.CrispScopeSchema).min(1),
33
- }).passthrough().optional(),
34
- }).passthrough();
35
- function validateDelegationConstraints(constraints) {
36
- return exports.DelegationConstraintsSchema.safeParse(constraints);
37
- }
38
- function hasValidTimeRange(constraints) {
39
- if (constraints.notBefore === undefined && constraints.notAfter === undefined) {
40
- return true;
41
- }
42
- if (constraints.notBefore !== undefined && constraints.notAfter !== undefined) {
43
- return constraints.notBefore < constraints.notAfter;
44
- }
45
- return true;
46
- }
47
- function areChildConstraintsValid(parent, child) {
48
- if (parent.notBefore !== undefined && child.notBefore !== undefined) {
49
- if (child.notBefore < parent.notBefore) {
50
- return false;
51
- }
52
- }
53
- if (parent.notAfter !== undefined && child.notAfter !== undefined) {
54
- if (child.notAfter > parent.notAfter) {
55
- return false;
56
- }
57
- }
58
- if (parent.crisp?.budget &&
59
- child.crisp?.budget &&
60
- parent.crisp.budget.unit === child.crisp.budget.unit) {
61
- if (child.crisp.budget.cap > parent.crisp.budget.cap) {
62
- return false;
63
- }
64
- }
65
- if (parent.crisp && child.crisp) {
66
- const parentResources = new Set(parent.crisp.scopes.map((s) => s.resource));
67
- const allChildResourcesInParent = child.crisp.scopes.every((childScope) => {
68
- return parent.crisp.scopes.some((parentScope) => {
69
- if (parentScope.matcher === 'exact') {
70
- return parentScope.resource === childScope.resource;
71
- }
72
- if (parentScope.matcher === 'prefix') {
73
- return childScope.resource.startsWith(parentScope.resource);
74
- }
75
- return true;
76
- });
77
- });
78
- return allChildResourcesInParent;
79
- }
80
- return true;
81
- }
82
- function doesResourceMatchScope(resource, scope) {
83
- switch (scope.matcher) {
84
- case 'exact':
85
- return resource === scope.resource;
86
- case 'prefix':
87
- return resource.startsWith(scope.resource);
88
- case 'regex':
89
- try {
90
- const regex = new RegExp(scope.resource);
91
- return regex.test(resource);
92
- }
93
- catch {
94
- return false;
95
- }
96
- default:
97
- return false;
98
- }
99
- }
100
- exports.SUPPORTED_CURRENCIES = ['USD', 'ops', 'points'];
101
- exports.SUPPORTED_MATCHERS = ['exact', 'prefix', 'regex'];
102
- exports.MAX_BUDGET_CAP = Number.MAX_SAFE_INTEGER;
103
- exports.MAX_WINDOW_DURATION_SEC = 10 * 365 * 24 * 60 * 60;
@@ -1,2 +0,0 @@
1
- export * from './schemas.js';
2
- export * from './constraints.js';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./schemas.js"), exports);
18
- __exportStar(require("./constraints.js"), exports);