@agentic-kit/harness 0.1.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 (87) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +176 -0
  3. package/blueprint/blueprint-defaults.d.ts +2 -0
  4. package/blueprint/blueprint-defaults.js +123 -0
  5. package/blueprint/blueprint-schema.d.ts +138 -0
  6. package/blueprint/blueprint-schema.js +86 -0
  7. package/blueprint/field-type.d.ts +25 -0
  8. package/blueprint/field-type.js +99 -0
  9. package/blueprint/internal-policies.d.ts +2 -0
  10. package/blueprint/internal-policies.js +14 -0
  11. package/blueprint/policy-provisioning.d.ts +79 -0
  12. package/blueprint/policy-provisioning.js +570 -0
  13. package/esm/blueprint/blueprint-defaults.d.ts +2 -0
  14. package/esm/blueprint/blueprint-defaults.js +120 -0
  15. package/esm/blueprint/blueprint-schema.d.ts +138 -0
  16. package/esm/blueprint/blueprint-schema.js +83 -0
  17. package/esm/blueprint/field-type.d.ts +25 -0
  18. package/esm/blueprint/field-type.js +94 -0
  19. package/esm/blueprint/internal-policies.d.ts +2 -0
  20. package/esm/blueprint/internal-policies.js +10 -0
  21. package/esm/blueprint/policy-provisioning.d.ts +79 -0
  22. package/esm/blueprint/policy-provisioning.js +553 -0
  23. package/esm/gating/confirm-gate.d.ts +46 -0
  24. package/esm/gating/confirm-gate.js +55 -0
  25. package/esm/gating/decline-guard.d.ts +7 -0
  26. package/esm/gating/decline-guard.js +48 -0
  27. package/esm/gating/preview.d.ts +37 -0
  28. package/esm/gating/preview.js +5 -0
  29. package/esm/gating/prompts.d.ts +8 -0
  30. package/esm/gating/prompts.js +175 -0
  31. package/esm/index.d.ts +20 -0
  32. package/esm/index.js +20 -0
  33. package/esm/skills/fetch.d.ts +31 -0
  34. package/esm/skills/fetch.js +84 -0
  35. package/esm/skills/frontmatter.d.ts +7 -0
  36. package/esm/skills/frontmatter.js +28 -0
  37. package/esm/skills/integrity.d.ts +8 -0
  38. package/esm/skills/integrity.js +28 -0
  39. package/esm/skills/manifest.d.ts +39 -0
  40. package/esm/skills/manifest.js +36 -0
  41. package/esm/skills/materialize.d.ts +13 -0
  42. package/esm/skills/materialize.js +26 -0
  43. package/esm/skills/overlay.d.ts +11 -0
  44. package/esm/skills/overlay.js +25 -0
  45. package/esm/skills/registry.d.ts +36 -0
  46. package/esm/skills/registry.js +30 -0
  47. package/esm/skills/source.d.ts +21 -0
  48. package/esm/skills/source.js +51 -0
  49. package/esm/skills/update-check.d.ts +36 -0
  50. package/esm/skills/update-check.js +74 -0
  51. package/esm/stash.d.ts +20 -0
  52. package/esm/stash.js +19 -0
  53. package/esm/types.d.ts +60 -0
  54. package/esm/types.js +8 -0
  55. package/gating/confirm-gate.d.ts +46 -0
  56. package/gating/confirm-gate.js +58 -0
  57. package/gating/decline-guard.d.ts +7 -0
  58. package/gating/decline-guard.js +52 -0
  59. package/gating/preview.d.ts +37 -0
  60. package/gating/preview.js +6 -0
  61. package/gating/prompts.d.ts +8 -0
  62. package/gating/prompts.js +179 -0
  63. package/index.d.ts +20 -0
  64. package/index.js +36 -0
  65. package/package.json +42 -0
  66. package/skills/fetch.d.ts +31 -0
  67. package/skills/fetch.js +122 -0
  68. package/skills/frontmatter.d.ts +7 -0
  69. package/skills/frontmatter.js +31 -0
  70. package/skills/integrity.d.ts +8 -0
  71. package/skills/integrity.js +64 -0
  72. package/skills/manifest.d.ts +39 -0
  73. package/skills/manifest.js +40 -0
  74. package/skills/materialize.d.ts +13 -0
  75. package/skills/materialize.js +62 -0
  76. package/skills/overlay.d.ts +11 -0
  77. package/skills/overlay.js +28 -0
  78. package/skills/registry.d.ts +36 -0
  79. package/skills/registry.js +34 -0
  80. package/skills/source.d.ts +21 -0
  81. package/skills/source.js +88 -0
  82. package/skills/update-check.d.ts +36 -0
  83. package/skills/update-check.js +110 -0
  84. package/stash.d.ts +20 -0
  85. package/stash.js +55 -0
  86. package/types.d.ts +60 -0
  87. package/types.js +9 -0
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fieldTypeToTypeName = fieldTypeToTypeName;
4
+ exports.toFieldType = toFieldType;
5
+ exports.toFieldDefault = toFieldDefault;
6
+ const SQL_KEYWORDS = new Set([
7
+ 'CURRENT_TIMESTAMP',
8
+ 'CURRENT_DATE',
9
+ 'CURRENT_TIME',
10
+ 'LOCALTIME',
11
+ 'LOCALTIMESTAMP',
12
+ 'CURRENT_ROLE',
13
+ 'CURRENT_USER',
14
+ 'SESSION_USER',
15
+ 'USER',
16
+ 'CURRENT_CATALOG',
17
+ 'CURRENT_SCHEMA',
18
+ ]);
19
+ function fieldTypeToTypeName(t) {
20
+ if (t == null)
21
+ return '';
22
+ if (typeof t === 'string')
23
+ return t;
24
+ if (typeof t === 'object') {
25
+ const obj = t;
26
+ if (typeof obj.name === 'string') {
27
+ const dims = typeof obj.array_dimensions === 'number' && obj.array_dimensions > 0
28
+ ? obj.array_dimensions
29
+ : 0;
30
+ return obj.name + '[]'.repeat(dims);
31
+ }
32
+ }
33
+ return '';
34
+ }
35
+ function toFieldType(typeName) {
36
+ const raw = (typeName ?? '').trim();
37
+ let base = raw;
38
+ let dims = 0;
39
+ while (base.endsWith('[]')) {
40
+ base = base.slice(0, -2);
41
+ dims += 1;
42
+ }
43
+ base = base.trim();
44
+ const result = { name: base };
45
+ if (dims > 0)
46
+ result.array_dimensions = dims;
47
+ return result;
48
+ }
49
+ function parseScalarLiteral(token) {
50
+ const t = token.trim();
51
+ if (t === '')
52
+ return '';
53
+ if (t === 'true')
54
+ return true;
55
+ if (t === 'false')
56
+ return false;
57
+ if (t.toLowerCase() === 'null')
58
+ return null;
59
+ if (/^-?\d+(\.\d+)?$/.test(t))
60
+ return Number(t);
61
+ if ((t.startsWith("'") && t.endsWith("'")) || (t.startsWith('"') && t.endsWith('"'))) {
62
+ return t.slice(1, -1);
63
+ }
64
+ return t;
65
+ }
66
+ function toFieldDefault(def) {
67
+ if (def === undefined || def === null)
68
+ return undefined;
69
+ const raw = String(def).trim();
70
+ if (raw === '')
71
+ return undefined;
72
+ if (SQL_KEYWORDS.has(raw.toUpperCase())) {
73
+ return { sql_keyword: raw.toUpperCase() };
74
+ }
75
+ const fnMatch = raw.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*\(([\s\S]*)\)$/);
76
+ if (fnMatch) {
77
+ const fnName = fnMatch[1];
78
+ const argsRaw = fnMatch[2].trim();
79
+ const result = {
80
+ function: fnName,
81
+ };
82
+ if (argsRaw !== '') {
83
+ const args = argsRaw.split(',').map((a) => parseScalarLiteral(a));
84
+ if (args.length > 0)
85
+ result.args = args;
86
+ }
87
+ return result;
88
+ }
89
+ if (raw === 'true')
90
+ return { value: true };
91
+ if (raw === 'false')
92
+ return { value: false };
93
+ if (/^-?\d+(\.\d+)?$/.test(raw))
94
+ return { value: Number(raw) };
95
+ if ((raw.startsWith("'") && raw.endsWith("'")) || (raw.startsWith('"') && raw.endsWith('"'))) {
96
+ return { value: raw.slice(1, -1) };
97
+ }
98
+ return { value: raw };
99
+ }
@@ -0,0 +1,2 @@
1
+ export declare function isInternalPolicy(policyType: string | null | undefined): boolean;
2
+ export declare function filterInternalPolicies(policyTypes: string[]): string[];
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isInternalPolicy = isInternalPolicy;
4
+ exports.filterInternalPolicies = filterInternalPolicies;
5
+ // System-managed policies that the platform attaches automatically; they are
6
+ // noise in a schema overview and not something the agent can act on, so they
7
+ // are hidden from both the agent's tool output and the UI policy pills.
8
+ const INTERNAL_POLICY_TYPES = new Set(['AuthzNotReadOnly']);
9
+ function isInternalPolicy(policyType) {
10
+ return !policyType || INTERNAL_POLICY_TYPES.has(policyType);
11
+ }
12
+ function filterInternalPolicies(policyTypes) {
13
+ return policyTypes.filter((type) => !isInternalPolicy(type));
14
+ }
@@ -0,0 +1,79 @@
1
+ /**
2
+ * VENDORED — verbatim from @constructive-io/data (workspace-only, unpublished):
3
+ * constructive-client/packages/data/src/policy-provisioning.ts
4
+ *
5
+ * Zero-import pure-config module. Vendored because the package is not published
6
+ * to npm. Keep in sync with the upstream source. Do not edit by hand except to
7
+ * re-sync from upstream.
8
+ */
9
+ export declare const MEMBERSHIP_TYPES: {
10
+ readonly APP: 1;
11
+ readonly ORGANIZATION: 2;
12
+ readonly GROUP: 3;
13
+ };
14
+ export type PolicyFieldType = 'string' | 'boolean' | 'integer' | 'uuid' | 'uuid[]';
15
+ export type PolicyFieldComponent = 'table-select' | 'membership-type-select' | 'permission-select';
16
+ export type PolicyProvisioningCategory = 'has-module' | 'needs-fields' | 'needs-table' | 'no-fields';
17
+ export interface PolicyFieldOverride {
18
+ type?: PolicyFieldType;
19
+ component?: PolicyFieldComponent;
20
+ label?: string;
21
+ placeholder?: string;
22
+ description?: string;
23
+ defaultValue?: unknown;
24
+ required?: boolean;
25
+ hidden?: boolean;
26
+ pgType?: 'uuid' | 'uuid[]' | 'timestamptz' | 'boolean';
27
+ dependsOn?: string;
28
+ options?: {
29
+ value: string;
30
+ label: string;
31
+ description?: string;
32
+ }[];
33
+ }
34
+ export interface PolicyProvisioningConfig {
35
+ category: PolicyProvisioningCategory;
36
+ hasDataNode: boolean;
37
+ dataNodeType?: string;
38
+ fieldOverrides?: Record<string, PolicyFieldOverride>;
39
+ disabled?: boolean;
40
+ }
41
+ export interface GeneratedField {
42
+ name: string;
43
+ type: string;
44
+ nullable: boolean;
45
+ description: string;
46
+ }
47
+ export type CrudOperation = 'create' | 'read' | 'update' | 'delete';
48
+ export interface CrudOperationPolicyConfig {
49
+ roleName: string;
50
+ isPermissive: boolean;
51
+ }
52
+ export interface GroupedCrudPrivileges {
53
+ roleName: string;
54
+ isPermissive: boolean;
55
+ privileges: string[];
56
+ }
57
+ export declare const CRUD_OPERATIONS: CrudOperation[];
58
+ export declare const CRUD_TO_PRIVILEGE: Record<CrudOperation, string>;
59
+ export declare const DEFAULT_CRUD_GRANT_PRIVILEGES: Record<string, unknown>[];
60
+ export declare const POLICY_PROVISIONING_CONFIG: Record<string, PolicyProvisioningConfig>;
61
+ export declare const DATA_NODE_GENERATED_FIELDS: Record<string, GeneratedField[]>;
62
+ export declare function getPolicyProvisioningConfig(policyType: string): PolicyProvisioningConfig | undefined;
63
+ export declare function getPolicyCategory(policyType: string): PolicyProvisioningCategory;
64
+ export declare function getDataNodeForPolicy(policyType: string): string | undefined;
65
+ export declare function policyRequiresDataNode(policyType: string): boolean;
66
+ export declare function policyCanBeNodeless(policyType: string): boolean;
67
+ export declare function getGeneratedFields(dataNodeType: string): GeneratedField[];
68
+ export declare function hasGeneratedFields(dataNodeType: string): boolean;
69
+ export declare function getPolicyFieldDefaults(policyType: string): Record<string, unknown>;
70
+ export declare function getFieldsRequiringColumns(policyType: string): {
71
+ key: string;
72
+ defaultName: string | string[];
73
+ pgType: NonNullable<PolicyFieldOverride['pgType']>;
74
+ }[];
75
+ export declare function sanitizePolicyData(data: Record<string, unknown>): Record<string, unknown>;
76
+ export declare function injectSchemaFields(policyData: Record<string, unknown>, schemaId: string, policyType: string): Record<string, unknown>;
77
+ export declare function buildNodeDataForDataNodeType(dataNodeType: string | undefined, policyData: Record<string, unknown>): Record<string, unknown>;
78
+ export declare function buildNodeData(policyType: string, policyData: Record<string, unknown>): Record<string, unknown>;
79
+ export declare function groupCrudOperationsByConfig<T extends string>(enabledOperations: T[], operations: Record<T, CrudOperationPolicyConfig>, privilegeMap: Record<T, string>): GroupedCrudPrivileges[];