@huddle-marketplace/skills 0.2.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 (86) hide show
  1. package/README.md +256 -0
  2. package/dist/adapters/openclaw.d.ts +42 -0
  3. package/dist/adapters/openclaw.d.ts.map +1 -0
  4. package/dist/adapters/openclaw.js +94 -0
  5. package/dist/adapters/openclaw.js.map +1 -0
  6. package/dist/base.d.ts +26 -0
  7. package/dist/base.d.ts.map +1 -0
  8. package/dist/base.js +97 -0
  9. package/dist/base.js.map +1 -0
  10. package/dist/compose.d.ts +87 -0
  11. package/dist/compose.d.ts.map +1 -0
  12. package/dist/compose.js +119 -0
  13. package/dist/compose.js.map +1 -0
  14. package/dist/index.d.ts +104 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +167 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/jurisdictions/ca-bc/index.d.ts +49 -0
  19. package/dist/jurisdictions/ca-bc/index.d.ts.map +1 -0
  20. package/dist/jurisdictions/ca-bc/index.js +212 -0
  21. package/dist/jurisdictions/ca-bc/index.js.map +1 -0
  22. package/dist/jurisdictions/ca-ns/index.d.ts +27 -0
  23. package/dist/jurisdictions/ca-ns/index.d.ts.map +1 -0
  24. package/dist/jurisdictions/ca-ns/index.js +127 -0
  25. package/dist/jurisdictions/ca-ns/index.js.map +1 -0
  26. package/dist/jurisdictions/ca-on/index.d.ts +26 -0
  27. package/dist/jurisdictions/ca-on/index.d.ts.map +1 -0
  28. package/dist/jurisdictions/ca-on/index.js +109 -0
  29. package/dist/jurisdictions/ca-on/index.js.map +1 -0
  30. package/dist/jurisdictions/ca-qc/index.d.ts +75 -0
  31. package/dist/jurisdictions/ca-qc/index.d.ts.map +1 -0
  32. package/dist/jurisdictions/ca-qc/index.js +232 -0
  33. package/dist/jurisdictions/ca-qc/index.js.map +1 -0
  34. package/dist/jurisdictions/canadian-template.d.ts +49 -0
  35. package/dist/jurisdictions/canadian-template.d.ts.map +1 -0
  36. package/dist/jurisdictions/canadian-template.js +228 -0
  37. package/dist/jurisdictions/canadian-template.js.map +1 -0
  38. package/dist/jurisdictions/lifecycle/active-tenancy.d.ts +55 -0
  39. package/dist/jurisdictions/lifecycle/active-tenancy.d.ts.map +1 -0
  40. package/dist/jurisdictions/lifecycle/active-tenancy.js +227 -0
  41. package/dist/jurisdictions/lifecycle/active-tenancy.js.map +1 -0
  42. package/dist/jurisdictions/lifecycle/homeownership-readiness.d.ts +60 -0
  43. package/dist/jurisdictions/lifecycle/homeownership-readiness.d.ts.map +1 -0
  44. package/dist/jurisdictions/lifecycle/homeownership-readiness.js +401 -0
  45. package/dist/jurisdictions/lifecycle/homeownership-readiness.js.map +1 -0
  46. package/dist/jurisdictions/us-ca/index.d.ts +65 -0
  47. package/dist/jurisdictions/us-ca/index.d.ts.map +1 -0
  48. package/dist/jurisdictions/us-ca/index.js +265 -0
  49. package/dist/jurisdictions/us-ca/index.js.map +1 -0
  50. package/dist/jurisdictions/us-cftc/index.d.ts +48 -0
  51. package/dist/jurisdictions/us-cftc/index.d.ts.map +1 -0
  52. package/dist/jurisdictions/us-cftc/index.js +192 -0
  53. package/dist/jurisdictions/us-cftc/index.js.map +1 -0
  54. package/dist/jurisdictions/us-fl/index.d.ts +43 -0
  55. package/dist/jurisdictions/us-fl/index.d.ts.map +1 -0
  56. package/dist/jurisdictions/us-fl/index.js +129 -0
  57. package/dist/jurisdictions/us-fl/index.js.map +1 -0
  58. package/dist/jurisdictions/us-ny/index.d.ts +77 -0
  59. package/dist/jurisdictions/us-ny/index.d.ts.map +1 -0
  60. package/dist/jurisdictions/us-ny/index.js +344 -0
  61. package/dist/jurisdictions/us-ny/index.js.map +1 -0
  62. package/dist/jurisdictions/us-state-factory.d.ts +79 -0
  63. package/dist/jurisdictions/us-state-factory.d.ts.map +1 -0
  64. package/dist/jurisdictions/us-state-factory.js +425 -0
  65. package/dist/jurisdictions/us-state-factory.js.map +1 -0
  66. package/dist/jurisdictions/us-tx/index.d.ts +43 -0
  67. package/dist/jurisdictions/us-tx/index.d.ts.map +1 -0
  68. package/dist/jurisdictions/us-tx/index.js +160 -0
  69. package/dist/jurisdictions/us-tx/index.js.map +1 -0
  70. package/dist/mcp/index.d.ts +49 -0
  71. package/dist/mcp/index.d.ts.map +1 -0
  72. package/dist/mcp/index.js +211 -0
  73. package/dist/mcp/index.js.map +1 -0
  74. package/dist/registry/index.d.ts +27 -0
  75. package/dist/registry/index.d.ts.map +1 -0
  76. package/dist/registry/index.js +47 -0
  77. package/dist/registry/index.js.map +1 -0
  78. package/dist/traiga/index.d.ts +24 -0
  79. package/dist/traiga/index.d.ts.map +1 -0
  80. package/dist/traiga/index.js +67 -0
  81. package/dist/traiga/index.js.map +1 -0
  82. package/dist/types/index.d.ts +814 -0
  83. package/dist/types/index.d.ts.map +1 -0
  84. package/dist/types/index.js +150 -0
  85. package/dist/types/index.js.map +1 -0
  86. package/package.json +77 -0
@@ -0,0 +1,119 @@
1
+ /**
2
+ * @huddle-marketplace/skills — Composition Engine
3
+ *
4
+ * Stack multiple jurisdiction skills for layered validation.
5
+ *
6
+ * Typical patterns:
7
+ * Federal + State: composeSkills(["US-CFTC", "US-TX"], input, registry)
8
+ * Multi-state: composeSkills(["US-CA", "US-NY"], input, registry)
9
+ * Cross-border: composeSkills(["US-CFTC", "CA-FINTRAC", "CA-ON"], input, registry)
10
+ *
11
+ * Architecture:
12
+ * - Layers run in PARALLEL (Promise.all) — O(1) latency regardless of layer count
13
+ * - Federal checks first in output by convention (pass them first in the array)
14
+ * - Each check is prefixed with its source jurisdiction for full traceability
15
+ * - Citations are deduplicated by statute+section across layers
16
+ * - compliant = ALL layers compliant (strict mode, default)
17
+ *
18
+ * Web3-native: When US-CFTC is composed with a state skill, the federal layer validates
19
+ * bond structure (wBTC reserve ratio, non-custodial architecture, TRAIGA logging).
20
+ * The state layer adds local statutory rules (deposit cap, return timeline, late fee limits).
21
+ * Together they form a complete, TRAIGA-ready compliance proof for any Huddle transaction.
22
+ */
23
+ // ============================================================================
24
+ // CORE FUNCTION
25
+ // ============================================================================
26
+ /**
27
+ * Compose multiple jurisdiction skills into a single layered validation result.
28
+ *
29
+ * Designed for Web3-native use: the federal CFTC layer validates the bond structure,
30
+ * the state layer validates local statutory rules — together they form a complete
31
+ * compliance proof anchored on-chain via TRAIGA.
32
+ *
33
+ * NOTE: This is the low-level function that requires an explicit registry.
34
+ * Use the `composeSkills()` export from the main package entry which uses the
35
+ * default registry automatically.
36
+ *
37
+ * @param jurisdictions - Ordered list of jurisdiction codes (federal first by convention)
38
+ * @param input - Skill input shared across all layers (amounts in CENTS)
39
+ * @param registry - Registry instance to resolve skills from
40
+ * @param options - Composition options
41
+ */
42
+ export async function composeSkillsWithRegistry(jurisdictions, input, registry, options = {}) {
43
+ const { mode = "strict", criticalJurisdictions } = options;
44
+ if (jurisdictions.length === 0) {
45
+ throw new Error("composeSkills: at least one jurisdiction code is required");
46
+ }
47
+ // ── Run all layers in parallel ──────────────────────────────────────────────
48
+ const layerPromises = jurisdictions.map(async (jcode) => {
49
+ const skill = registry.get(jcode);
50
+ if (!skill) {
51
+ return {
52
+ compliant: false,
53
+ confidence: 0,
54
+ jurisdiction: jcode,
55
+ skillId: `unknown::${jcode}`,
56
+ skillVersion: "0.0.0",
57
+ checks: [{
58
+ name: "jurisdiction-lookup",
59
+ passed: false,
60
+ confidence: 1.0,
61
+ note: `Jurisdiction not registered: "${jcode}". Add it to the SkillRegistry or check the code spelling.`,
62
+ }],
63
+ remediation: [{
64
+ action: "register_jurisdiction",
65
+ description: `Register a skill for jurisdiction "${jcode}" in the SkillRegistry before composing.`,
66
+ urgency: "required",
67
+ automatable: false,
68
+ }],
69
+ timestamp: Date.now(),
70
+ };
71
+ }
72
+ return skill.validate(input);
73
+ });
74
+ const layers = await Promise.all(layerPromises);
75
+ // ── Merge checks — prefix with source jurisdiction for full traceability ────
76
+ const checks = layers.flatMap((layer, i) => layer.checks.map((c) => ({
77
+ ...c,
78
+ name: `[${jurisdictions[i]}] ${c.name}`,
79
+ })));
80
+ // ── Merge citations — deduplicate by statute+section ───────────────────────
81
+ const citationKey = (c) => `${c.statute}::${c.section}`;
82
+ const citationMap = new Map();
83
+ for (const layer of layers) {
84
+ for (const c of layer.citations ?? []) {
85
+ // First occurrence wins — federal citations take precedence if listed first
86
+ if (!citationMap.has(citationKey(c))) {
87
+ citationMap.set(citationKey(c), c);
88
+ }
89
+ }
90
+ }
91
+ const citations = [...citationMap.values()];
92
+ // ── Merge remediation ──────────────────────────────────────────────────────
93
+ const remediation = layers.flatMap((l) => l.remediation ?? []);
94
+ // ── Compute overall compliance ─────────────────────────────────────────────
95
+ let compliant;
96
+ if (mode === "strict") {
97
+ compliant = layers.every((l) => l.compliant);
98
+ }
99
+ else {
100
+ const critical = criticalJurisdictions ?? jurisdictions.map(String);
101
+ compliant = layers
102
+ .filter((_, i) => critical.includes(String(jurisdictions[i])))
103
+ .every((l) => l.compliant);
104
+ }
105
+ const confidence = layers.length > 0
106
+ ? Math.min(...layers.map((l) => l.confidence))
107
+ : 0;
108
+ return {
109
+ compliant,
110
+ confidence,
111
+ jurisdictions: layers.map((l) => l.jurisdiction),
112
+ layers,
113
+ checks,
114
+ citations,
115
+ remediation,
116
+ timestamp: Date.now(),
117
+ };
118
+ }
119
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAsEH,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,aAA4C,EAC5C,KAAiB,EACjB,QAAyB,EACzB,UAA0B,EAAE;IAE5B,MAAM,EAAE,IAAI,GAAG,QAAQ,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC;IAE3D,IAAI,aAAa,CAAC,MA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C7D,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC;QAClC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC,CAAC;IAEN,OAAO;QACL,SAAS;QACT,UAAU;QACV,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;QAChD,MAAM;QACN,MAAM;QACN,SAAS;QACT,WAAW;QACX,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * @huddle-marketplace/skills — 63-Jurisdiction Rental Compliance for Autonomous AI Agents
3
+ *
4
+ * The definitive skill package for the renter-to-homeowner journey.
5
+ * OpenClaw, MCP, LangChain, and CrewAI compatible.
6
+ *
7
+ * Usage:
8
+ * import { registry, validate } from "@huddle-marketplace/skills";
9
+ *
10
+ * // Validate a deposit in Texas
11
+ * const result = await validate("US-TX", {
12
+ * type: "deposit-validation",
13
+ * depositAmountCents: 150000,
14
+ * monthlyRentCents: 200000,
15
+ * currency: "USD",
16
+ * });
17
+ *
18
+ * console.log(result.compliant); // true
19
+ * console.log(result.confidence); // 0.9
20
+ * console.log(result.citations); // [{ statute: "Texas SB-38", ... }]
21
+ */
22
+ export * from "./types/index.js";
23
+ export { BaseSkill } from "./base.js";
24
+ export { SkillRegistry, createRegistry } from "./registry/index.js";
25
+ export { withTraiga, withTraigaAll, ConsoleTraigaAdapter } from "./traiga/index.js";
26
+ export { getMCPToolDefinitions, handleMCPRequest } from "./mcp/index.js";
27
+ export { toOpenClawSkill, toOpenClawSkills, generateSkillMd } from "./adapters/openclaw.js";
28
+ import { SkillRegistry } from "./registry/index.js";
29
+ import type { HuddleSkill, SkillInput, SkillResult, JurisdictionCode } from "./types/index.js";
30
+ export type { ComposedResult, ComposeOptions } from "./compose.js";
31
+ /**
32
+ * All jurisdiction skills registered in the default registry.
33
+ *
34
+ * NOTE: Lifecycle skills (homeownershipReadinessSkill, activeTenancySkill) are NOT
35
+ * included here because they use "US-CFTC" as their jurisdiction (a design limitation)
36
+ * which would overwrite the real federal CFTC skill in the registry.
37
+ * Use them directly via their named exports instead.
38
+ */
39
+ export declare const allSkills: HuddleSkill[];
40
+ /** Pre-loaded registry with all 63+ jurisdictions */
41
+ export declare const registry: SkillRegistry;
42
+ /**
43
+ * Quick validation helper — validate input against a jurisdiction.
44
+ *
45
+ * @param jurisdiction - Jurisdiction code (e.g., "US-TX", "CA-BC")
46
+ * @param input - Skill input to validate
47
+ * @returns Validation result
48
+ * @throws Error if jurisdiction is not supported
49
+ */
50
+ export declare function validate(jurisdiction: JurisdictionCode | string, input: SkillInput): Promise<SkillResult>;
51
+ /**
52
+ * Get human-readable explanation for a validation result.
53
+ */
54
+ export declare function explain(jurisdiction: JurisdictionCode | string, result: SkillResult): string;
55
+ /**
56
+ * Compose multiple jurisdiction skills into a single layered validation.
57
+ *
58
+ * Stacks federal + state validation into one compliance proof.
59
+ * Federal checks (US-CFTC) validate the wBTC bond structure; state checks add
60
+ * local statutory rules (deposit caps, return timelines, late fee limits).
61
+ * Results are merged with full citation deduplication and TRAIGA-ready audit trails.
62
+ *
63
+ * Layers run in parallel — O(1) latency regardless of stack depth.
64
+ * All checks are prefixed with source jurisdiction for full traceability.
65
+ *
66
+ * @example
67
+ * // wBTC bond in Texas: federal preemption + state deposit rules
68
+ * const result = await composeSkills(["US-CFTC", "US-TX"], {
69
+ * type: "deposit-validation",
70
+ * depositAmountCents: 200000,
71
+ * monthlyRentCents: 200000,
72
+ * currency: "USDC",
73
+ * collateralType: "wbtc",
74
+ * instrumentType: "collateralized_lease_guarantee",
75
+ * wbtcUsdcRatio: 1.05,
76
+ * custodyType: "smart_contract",
77
+ * sentinelMonitoring: true,
78
+ * sentinelMode: "CO_PILOT",
79
+ * lastSentinelCheckMs: Date.now() - 60000,
80
+ * auditLogEnabled: true,
81
+ * lastDecisionReasoning: "LTV nominal",
82
+ * });
83
+ *
84
+ * result.compliant // true
85
+ * result.confidence // 0.9 (min across both layers)
86
+ * result.layers.length // 2 — [US-CFTC result, US-TX result]
87
+ * result.checks[0].name // "[US-CFTC] federal-preemption"
88
+ * result.citations // merged + deduplicated across both layers
89
+ */
90
+ export declare function composeSkills(jurisdictions: (JurisdictionCode | string)[], input: SkillInput, options?: import("./compose.js").ComposeOptions): Promise<import("./compose.js").ComposedResult>;
91
+ export { usCftcSkill } from "./jurisdictions/us-cftc/index.js";
92
+ export { usTxSkill } from "./jurisdictions/us-tx/index.js";
93
+ export { usFlSkill } from "./jurisdictions/us-fl/index.js";
94
+ export { usCaSkill } from "./jurisdictions/us-ca/index.js";
95
+ export { usNySkill } from "./jurisdictions/us-ny/index.js";
96
+ export { caBcSkill } from "./jurisdictions/ca-bc/index.js";
97
+ export { caOnSkill } from "./jurisdictions/ca-on/index.js";
98
+ export { caQcSkill } from "./jurisdictions/ca-qc/index.js";
99
+ export { caNsSkill } from "./jurisdictions/ca-ns/index.js";
100
+ export { usStateSkillsArray, getUSStateSkill } from "./jurisdictions/us-state-factory.js";
101
+ export { canadianTemplateSkills } from "./jurisdictions/canadian-template.js";
102
+ export { homeownershipReadinessSkill } from "./jurisdictions/lifecycle/homeownership-readiness.js";
103
+ export { activeTenancySkill, ActiveTenancySkill, activeTenancySkills } from "./jurisdictions/lifecycle/active-tenancy.js";
104
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,cAAc,kBAAkB,CAAC;AAGjC,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AAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,167 @@
1
+ /**
2
+ * @huddle-marketplace/skills — 63-Jurisdiction Rental Compliance for Autonomous AI Agents
3
+ *
4
+ * The definitive skill package for the renter-to-homeowner journey.
5
+ * OpenClaw, MCP, LangChain, and CrewAI compatible.
6
+ *
7
+ * Usage:
8
+ * import { registry, validate } from "@huddle-marketplace/skills";
9
+ *
10
+ * // Validate a deposit in Texas
11
+ * const result = await validate("US-TX", {
12
+ * type: "deposit-validation",
13
+ * depositAmountCents: 150000,
14
+ * monthlyRentCents: 200000,
15
+ * currency: "USD",
16
+ * });
17
+ *
18
+ * console.log(result.compliant); // true
19
+ * console.log(result.confidence); // 0.9
20
+ * console.log(result.citations); // [{ statute: "Texas SB-38", ... }]
21
+ */
22
+ // Re-export all types
23
+ export * from "./types/index.js";
24
+ // Re-export base class
25
+ export { BaseSkill } from "./base.js";
26
+ // Re-export registry
27
+ export { SkillRegistry, createRegistry } from "./registry/index.js";
28
+ // Re-export TRAIGA
29
+ export { withTraiga, withTraigaAll, ConsoleTraigaAdapter } from "./traiga/index.js";
30
+ // Re-export MCP
31
+ export { getMCPToolDefinitions, handleMCPRequest } from "./mcp/index.js";
32
+ // Re-export OpenClaw adapter
33
+ export { toOpenClawSkill, toOpenClawSkills, generateSkillMd } from "./adapters/openclaw.js";
34
+ // ============================================================================
35
+ // Import all jurisdiction skills
36
+ // ============================================================================
37
+ // Federal
38
+ import { usCftcSkill } from "./jurisdictions/us-cftc/index.js";
39
+ // US States with custom implementations
40
+ import { usTxSkill } from "./jurisdictions/us-tx/index.js";
41
+ import { usFlSkill } from "./jurisdictions/us-fl/index.js";
42
+ import { usCaSkill } from "./jurisdictions/us-ca/index.js";
43
+ import { usNySkill } from "./jurisdictions/us-ny/index.js";
44
+ // US States from factory (46 states — TX, FL, CA, NY have custom skills)
45
+ import { usStateSkillsArray } from "./jurisdictions/us-state-factory.js";
46
+ // Canadian provinces with custom implementations
47
+ import { caBcSkill } from "./jurisdictions/ca-bc/index.js";
48
+ import { caOnSkill } from "./jurisdictions/ca-on/index.js";
49
+ import { caQcSkill } from "./jurisdictions/ca-qc/index.js";
50
+ import { caNsSkill } from "./jurisdictions/ca-ns/index.js";
51
+ // Canadian provinces from template
52
+ import { canadianTemplateSkills } from "./jurisdictions/canadian-template.js";
53
+ // ============================================================================
54
+ // Build and export the default registry
55
+ // ============================================================================
56
+ import { SkillRegistry } from "./registry/index.js";
57
+ import { composeSkillsWithRegistry } from "./compose.js";
58
+ /**
59
+ * All jurisdiction skills registered in the default registry.
60
+ *
61
+ * NOTE: Lifecycle skills (homeownershipReadinessSkill, activeTenancySkill) are NOT
62
+ * included here because they use "US-CFTC" as their jurisdiction (a design limitation)
63
+ * which would overwrite the real federal CFTC skill in the registry.
64
+ * Use them directly via their named exports instead.
65
+ */
66
+ export const allSkills = [
67
+ // Federal
68
+ usCftcSkill,
69
+ // US custom (Tier 1 high-traffic states)
70
+ usTxSkill,
71
+ usFlSkill,
72
+ usCaSkill,
73
+ usNySkill,
74
+ // US factory (46 remaining states)
75
+ ...usStateSkillsArray.filter((s) => !["US-TX", "US-FL", "US-CA", "US-NY"].includes(s.jurisdiction)),
76
+ // CA custom
77
+ caBcSkill,
78
+ caOnSkill,
79
+ caQcSkill,
80
+ caNsSkill,
81
+ // CA template (9 provinces)
82
+ ...canadianTemplateSkills,
83
+ ];
84
+ /** Pre-loaded registry with all 63+ jurisdictions */
85
+ export const registry = new SkillRegistry();
86
+ for (const skill of allSkills) {
87
+ registry.register(skill);
88
+ }
89
+ /**
90
+ * Quick validation helper — validate input against a jurisdiction.
91
+ *
92
+ * @param jurisdiction - Jurisdiction code (e.g., "US-TX", "CA-BC")
93
+ * @param input - Skill input to validate
94
+ * @returns Validation result
95
+ * @throws Error if jurisdiction is not supported
96
+ */
97
+ export async function validate(jurisdiction, input) {
98
+ const skill = registry.get(jurisdiction);
99
+ if (!skill) {
100
+ throw new Error(`Unsupported jurisdiction: ${jurisdiction}. ` +
101
+ `Supported: ${registry.jurisdictions().join(", ")}`);
102
+ }
103
+ return skill.validate(input);
104
+ }
105
+ /**
106
+ * Get human-readable explanation for a validation result.
107
+ */
108
+ export function explain(jurisdiction, result) {
109
+ const skill = registry.get(jurisdiction);
110
+ if (!skill) {
111
+ throw new Error(`Unsupported jurisdiction: ${jurisdiction}`);
112
+ }
113
+ return skill.explain(result);
114
+ }
115
+ /**
116
+ * Compose multiple jurisdiction skills into a single layered validation.
117
+ *
118
+ * Stacks federal + state validation into one compliance proof.
119
+ * Federal checks (US-CFTC) validate the wBTC bond structure; state checks add
120
+ * local statutory rules (deposit caps, return timelines, late fee limits).
121
+ * Results are merged with full citation deduplication and TRAIGA-ready audit trails.
122
+ *
123
+ * Layers run in parallel — O(1) latency regardless of stack depth.
124
+ * All checks are prefixed with source jurisdiction for full traceability.
125
+ *
126
+ * @example
127
+ * // wBTC bond in Texas: federal preemption + state deposit rules
128
+ * const result = await composeSkills(["US-CFTC", "US-TX"], {
129
+ * type: "deposit-validation",
130
+ * depositAmountCents: 200000,
131
+ * monthlyRentCents: 200000,
132
+ * currency: "USDC",
133
+ * collateralType: "wbtc",
134
+ * instrumentType: "collateralized_lease_guarantee",
135
+ * wbtcUsdcRatio: 1.05,
136
+ * custodyType: "smart_contract",
137
+ * sentinelMonitoring: true,
138
+ * sentinelMode: "CO_PILOT",
139
+ * lastSentinelCheckMs: Date.now() - 60000,
140
+ * auditLogEnabled: true,
141
+ * lastDecisionReasoning: "LTV nominal",
142
+ * });
143
+ *
144
+ * result.compliant // true
145
+ * result.confidence // 0.9 (min across both layers)
146
+ * result.layers.length // 2 — [US-CFTC result, US-TX result]
147
+ * result.checks[0].name // "[US-CFTC] federal-preemption"
148
+ * result.citations // merged + deduplicated across both layers
149
+ */
150
+ export async function composeSkills(jurisdictions, input, options) {
151
+ return composeSkillsWithRegistry(jurisdictions, input, registry, options);
152
+ }
153
+ // Re-export individual skills for direct access
154
+ export { usCftcSkill } from "./jurisdictions/us-cftc/index.js";
155
+ export { usTxSkill } from "./jurisdictions/us-tx/index.js";
156
+ export { usFlSkill } from "./jurisdictions/us-fl/index.js";
157
+ export { usCaSkill } from "./jurisdictions/us-ca/index.js";
158
+ export { usNySkill } from "./jurisdictions/us-ny/index.js";
159
+ export { caBcSkill } from "./jurisdictions/ca-bc/index.js";
160
+ export { caOnSkill } from "./jurisdictions/ca-on/index.js";
161
+ export { caQcSkill } from "./jurisdictions/ca-qc/index.js";
162
+ export { caNsSkill } from "./jurisdictions/ca-ns/index.js";
163
+ export { usStateSkillsArray, getUSStateSkill } from "./jurisdictions/us-state-factory.js";
164
+ export { canadianTemplateSkills } from "./jurisdictions/canadian-template.js";
165
+ export { homeownershipReadinessSkill } from "./jurisdictions/lifecycle/homeownership-readiness.js";
166
+ export { activeTenancySkill, ActiveTenancySkill, activeTenancySkills } from "./jurisdictions/lifecycle/active-tenancy.js";
167
+ //# sourceMappingURL=index.js.map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C"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * CA-BC — British Columbia Residential Tenancy Act
3
+ *
4
+ * BC has stringent tenant protection laws:
5
+ * - Security deposits limited to 50% of monthly rent (RTA s.19(1))
6
+ * - Mutual written consent required for deposit investment (RTA s.19)
7
+ * - 100% principal protection required at all times (RTA s.20)
8
+ * - Tenants entitled to interest on deposits (RTA s.19(3))
9
+ * - RTB (Residential Tenancy Branch) compliance required
10
+ * - Dispute resolution must be available
11
+ */
12
+ import { BaseSkill } from "../../base.js";
13
+ import type { SkillInput, SkillResult, SkillCheck, SkillCapability, RemediationStep } from "../../types/index.js";
14
+ export declare class CABCSkill extends BaseSkill {
15
+ readonly id = "huddle-compliance-ca-bc";
16
+ readonly name = "British Columbia Residential Tenancy Act";
17
+ readonly jurisdiction: "CA-BC";
18
+ readonly version = "1.0.0";
19
+ readonly capabilities: SkillCapability[];
20
+ validate(input: SkillInput): Promise<SkillResult>;
21
+ /**
22
+ * BC RTA Section 19: Mutual Assent Requirement
23
+ * Both landlord and tenant must explicitly consent to deposit investment
24
+ */
25
+ private checkMutualAssent;
26
+ /**
27
+ * BC RTA Section 20: Principal Protection Guarantee
28
+ * Full deposit value must be available for return at all times
29
+ */
30
+ private checkPrincipalProtection;
31
+ /**
32
+ * BC RTA Section 19(1): Deposit Limit
33
+ * Security deposit cannot exceed 50% of monthly rent
34
+ */
35
+ private checkDepositLimit;
36
+ /**
37
+ * BC RTA Section 19(3): Interest Sharing
38
+ * Tenants are entitled to interest earned on deposits
39
+ */
40
+ private checkInterestSharing;
41
+ /**
42
+ * BC RTB Compliance
43
+ * Agreement must comply with RTB standards and provide dispute resolution
44
+ */
45
+ private checkRTBCompliance;
46
+ protected checkToRemediation(check: SkillCheck): RemediationStep;
47
+ }
48
+ export declare const caBcSkill: CABCSkill;
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jurisdictions/ca-bc/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,eAAe,EAEf,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,SAAU,SAAQ,SAAS;IACtC,QAAQ,CAAC,EAAE,6BAA6B;IACxC,QAAQ,CAAC,IAAI,8CAA8C;IAC3D,QAAQ,CAAC,YAAY,EAAG,OAAO,CAAU;IACzC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,YAAY,EAAE,eAAe,EAAE,CAItC;IAEI,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;IAsBvD;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IA8BzB;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IA0BhC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IA2B5B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;cAqBP,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,eAAe;CA2B1E;AAED,eAAO,MAAM,SAAS,WAAkB,CAAC"}