@agentvault/agentvault 0.16.0 → 0.17.1

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.
package/README.md CHANGED
@@ -1,119 +1,274 @@
1
1
  # @agentvault/agentvault
2
2
 
3
- The security infrastructure layer for AI agents — cryptographic identity, earned trust, and Signal-grade encrypted communications natively integrated with OpenClaw.
3
+ The security infrastructure layer for AI agents — cryptographic identity, earned trust, and Signal-grade encrypted communications natively integrated with [OpenClaw](https://openclaw.ai).
4
4
 
5
- Connect your agent to its owner with XChaCha20-Poly1305 encryption, Double Ratchet forward secrecy, and W3C Decentralized Identifiers (DIDs).
5
+ Connect your agent to its owner with XChaCha20-Poly1305 encryption, Double Ratchet forward secrecy, and W3C Decentralized Identifiers (DIDs). No plaintext ever touches the server.
6
6
 
7
- ## What's New in v0.14.30 (Gen2)
7
+ ## What's New in v0.17.0
8
8
 
9
- * **OpenClaw Native Plugin:** AgentVault now integrates directly into OpenClaw as a first-class channel (`agentvault`).
10
- * **W3C Decentralized Identifiers (DIDs):** Agents are now addressed using cryptographic identities (`did:hub:<address>`).
11
- * **Room Cryptography & Sender Keys:** Advanced group chat encryption using sender key distribution, automatic force rekeying, and robust ratchet state snapshot/restore mechanisms.
12
- * **Trust Scoring & Telemetry:** Native OpenTelemetry (OTel) auto-instrumentation to compute real-time trust scores.
13
- * **Skill Permission Tokens (SPTs):** Support for explicit-deny authorization and cryptographic capability access grants.
9
+ * **Policy Enforcer:** 5-stage policy pipeline (Parse Validate Enforce Log → Report) with tool blocklists, model routing rules, and telemetry emission.
10
+ * **SKILL.md `agentVault` Namespace:** Extended skill metadata supporting certification tiers, integrity declarations, runtime capabilities, and model routing.
11
+ * **Unified Delivery Protocol:** Single `deliver()` dispatcher for all outbound messages text, decisions, approvals, policy alerts, and artifacts.
12
+ * **20 OTel Span Types:** Full observability with `av.*`-prefixed spans for policy violations, decisions, A2A, scans, rooms, trust, and more.
13
+ * **W3C TraceContext:** All telemetry spans carry `traceparent` and `tracestate` for cross-agent trace correlation.
14
14
 
15
- ---
16
-
17
- ## Installation & Quick Start
15
+ ## Installation
18
16
 
19
- ### 1. OpenClaw Channel Integration (Recommended)
20
-
21
- To install AgentVault globally as an OpenClaw channel plugin:
17
+ ### OpenClaw Plugin (Recommended)
22
18
 
23
19
  ```bash
24
- # Using pnpm (adjust path to your global installation)
25
- PNPM_HOME=~/Library/pnpm /opt/homebrew/bin/pnpm add -g @agentvault/agentvault@latest
20
+ openclaw plugins install @agentvault/agentvault
26
21
  ```
27
22
 
28
- After installation, configure the channel with your invite token from the AgentVault dashboard:
23
+ Then enroll your agent with an invite token from the [AgentVault dashboard](https://app.agentvault.chat):
29
24
 
30
25
  ```bash
31
26
  npx @agentvault/agentvault setup --token=YOUR_INVITE_TOKEN
32
27
  ```
33
28
 
34
- ⚠️ **CRITICAL WARNING FOR UPGRADES:**
35
- > There is currently a known bug in `setup.js` where running `setup` on an already enrolled agent will wipe the existing account configuration. **Always back up your `agentvault.json` and `agentvault-data` directories before updating the plugin or re-running setup.**
36
-
37
- ### 2. Standalone CLI Usage
38
-
39
- If you are not using OpenClaw, you can run AgentVault as a standalone interactive CLI:
29
+ ### Standalone CLI
40
30
 
41
31
  ```bash
42
32
  npx @agentvault/agentvault setup --token=YOUR_INVITE_TOKEN
43
33
  npx @agentvault/agentvault
44
34
  ```
45
35
 
46
- The CLI will:
47
- 1. Generate an Ed25519 identity keypair
48
- 2. Enroll your agent with the server (anchoring a `did:hub` identity)
49
- 3. Wait for owner approval
50
- 4. Establish an end-to-end encrypted channel
36
+ The CLI will generate an Ed25519 identity keypair, enroll with the server (anchoring a `did:hub` identity), wait for owner approval, and establish an E2E encrypted channel.
51
37
 
52
- ---
38
+ ## CLI Commands
39
+
40
+ | Command | Description |
41
+ |---------|-------------|
42
+ | `setup --token=TOKEN` | Enroll a new agent with an invite token |
43
+ | `create --name=NAME` | Create a new agent account in OpenClaw |
44
+ | `send --text="..."` | Send a message through the gateway |
45
+ | `status` | Check gateway connection and agent status |
46
+ | `skills` | List loaded skills from SKILL.md files |
47
+ | `doctor [--fix]` | Diagnose and fix LaunchAgent / gateway issues |
48
+ | `version` | Print the installed version |
53
49
 
54
- ## Programmatic SDK Integration
50
+ ## Programmatic Usage
55
51
 
56
- You can easily integrate AgentVault directly into custom Node.js/TypeScript agent architectures.
52
+ ### SecureChannel
57
53
 
58
- ```ts
54
+ The core class for establishing an E2E encrypted channel between your agent and its owner.
55
+
56
+ ```typescript
59
57
  import { SecureChannel } from "@agentvault/agentvault";
60
58
 
61
59
  const channel = new SecureChannel({
62
60
  inviteToken: process.env.AGENTVAULT_INVITE_TOKEN,
63
61
  dataDir: "./agentvault-data",
64
62
  apiUrl: "https://api.agentvault.chat",
65
- agentName: "My Custom Agent",
63
+ agentName: "My Agent",
66
64
  });
67
65
 
68
66
  channel.on("message", (text, metadata) => {
69
- console.log(`[AgentVault] Received: ${text}`);
70
- // Execute agent logic, then send response:
71
- channel.send(`Task complete. Result: ${text}`);
67
+ console.log(`Owner says: ${text}`);
68
+ console.log(`Type: ${metadata.messageType}`);
72
69
  });
73
70
 
74
71
  channel.on("ready", () => {
75
- console.log(`Secure channel established! Routing address: did:hub:${channel.deviceId}`);
72
+ console.log(`Secure channel established: did:hub:${channel.deviceId}`);
76
73
  });
77
74
 
78
75
  await channel.start();
79
76
  ```
80
77
 
81
- ### Advanced: Telemetry & OTel
82
- To enable behavioral trust scoring, configure the telemetry exporter:
78
+ ### Gateway Send Helpers
79
+
80
+ Send messages from your agent code without managing the channel directly:
81
+
82
+ ```typescript
83
+ import { sendToOwner, sendToRoom, sendToTarget, listTargets } from "@agentvault/agentvault";
84
+
85
+ // Send to the agent owner
86
+ await sendToOwner("Task complete — 3 files processed");
87
+
88
+ // Send to a multi-agent room
89
+ await sendToRoom("room_abc123", "Ready for review");
90
+
91
+ // Send to any target (auto-resolves owner, room, or A2A)
92
+ await sendToTarget("did:hub:other_agent", "Handoff data");
93
+
94
+ // List available targets
95
+ const targets = await listTargets();
96
+ ```
97
+
98
+ ### Structured Messages
83
99
 
84
- ```ts
85
- // Telemetry is automatically routed through the established E2E channel
86
- channel.enableTelemetry({
87
- serviceName: "my-custom-agent",
88
- exportIntervalMs: 5000
100
+ ```typescript
101
+ import { sendDecisionToOwner } from "@agentvault/agentvault";
102
+
103
+ // Decision request — ask the owner to choose
104
+ await sendDecisionToOwner({
105
+ question: "Which database should I use?",
106
+ options: [
107
+ { label: "PostgreSQL", value: "postgres" },
108
+ { label: "SQLite", value: "sqlite" },
109
+ ],
110
+ urgency: "medium",
89
111
  });
90
112
  ```
91
113
 
114
+ All 8 message types are supported: `text`, `decision_request`, `decision_response`, `approval_request`, `approval_response`, `policy_alert`, `artifact_share`.
115
+
116
+ ### Skill Management
117
+
118
+ Define skills using SKILL.md frontmatter:
119
+
120
+ ```markdown
121
+ ---
122
+ name: code-review
123
+ version: "1.0.0"
124
+ description: Reviews code for issues
125
+ tags: [code-review, typescript]
126
+ sla:
127
+ p95_latency_ms: 5000
128
+ max_error_rate: 0.05
129
+ schema:
130
+ type: object
131
+ properties:
132
+ code:
133
+ type: string
134
+ required: [code]
135
+ agentVault:
136
+ certification: certified
137
+ integrity:
138
+ algorithm: XChaCha20-Poly1305
139
+ hashChain: SHA-256
140
+ requiredPolicies: ["network: agentvault"]
141
+ runtime:
142
+ capabilities: [file.read, web.fetch]
143
+ forbidden: [shell.exec]
144
+ model:
145
+ allowed: [gpt-4, claude-sonnet-4-20250514]
146
+ default: claude-sonnet-4-20250514
92
147
  ---
148
+ # Code Review Skill
93
149
 
94
- ## Security Architecture
150
+ Review the provided code for bugs, security issues, and style violations...
151
+ ```
95
152
 
96
- AgentVault is a **zero-knowledge** platform. The server only routes ciphertext and NEVER sees your data in plaintext.
153
+ Load and use skills programmatically:
97
154
 
98
- * **Identity:** Ed25519 dual-key model (Owner Key + Operational Key) linked to a `did:hub` identifier.
99
- * **Encryption:** XChaCha20-Poly1305 symmetric encryption with 192-bit nonces (eliminating nonce reuse risk).
100
- * **Forward Secrecy:** Double Ratchet protocol and X3DH key agreement. Old keys are mathematically destroyed.
101
- * **Group Cryptography:** Sender key distribution with automatic force rekeying (`room_message_sk`) for multi-agent rooms.
102
- * **Audit Trails:** All operations are chained using BLAKE2b hashes and W3C TraceContext traceparents.
155
+ ```typescript
156
+ import { parseSkillMd, loadSkillsFromDirectory, invokeSkill } from "@agentvault/agentvault";
103
157
 
104
- ## Webhook Notifications
158
+ // Load all SKILL.md files from a directory
159
+ const manifest = await loadSkillsFromDirectory("./skills");
105
160
 
106
- Enable HTTP POST webhooks when a new message arrives for offline-capable agents:
161
+ // Invoke a skill with policy enforcement
162
+ const result = await invokeSkill("code-review", {
163
+ args: { code: "function foo() { eval(input); }" },
164
+ });
165
+ ```
107
166
 
108
- ```ts
109
- const channel = new SecureChannel({
110
- // ...
111
- webhookUrl: "https://your-server.com/webhook/agentvault",
167
+ ### Policy Enforcement
168
+
169
+ The PolicyEnforcer validates skill invocations against a 5-stage pipeline:
170
+
171
+ ```typescript
172
+ import { PolicyEnforcer } from "@agentvault/agentvault";
173
+
174
+ const enforcer = new PolicyEnforcer();
175
+
176
+ // Register a skill with its policy constraints
177
+ enforcer.registerSkill({
178
+ name: "code-review",
179
+ toolsAllowed: ["file.read"],
180
+ toolsDenied: ["shell.exec", "network.raw"],
181
+ modelRouting: { allowed: ["gpt-4", "claude-sonnet-4-20250514"] },
182
+ });
183
+
184
+ // Evaluate before execution
185
+ const result = enforcer.evaluate({
186
+ skillName: "code-review",
187
+ toolName: "shell.exec",
188
+ model: "gpt-4",
112
189
  });
190
+
191
+ if (!result.allowed) {
192
+ console.log("Blocked:", result.violations);
193
+ // [{ ruleId: "tool_deny", scope: "tool", message: "shell.exec is forbidden" }]
194
+ }
195
+
196
+ // Get aggregate metrics
197
+ const metrics = enforcer.getMetrics();
198
+ // { totalEvaluations: 42, totalBlocks: 3, bySkill: {...}, byRule: {...} }
113
199
  ```
114
- *Verify incoming webhooks using the HMAC-SHA256 signature provided in the `X-AgentVault-Signature` header.*
115
200
 
116
- ---
201
+ ### MCP Server (Embedded)
202
+
203
+ Expose your agent's skills as MCP tools:
204
+
205
+ ```typescript
206
+ import { AgentVaultMcpServer } from "@agentvault/agentvault";
207
+
208
+ const mcpServer = new AgentVaultMcpServer({
209
+ skills: manifest.skills,
210
+ channel, // SecureChannel instance for message relay
211
+ enforcer, // PolicyEnforcer for pre-execution checks
212
+ });
213
+ ```
214
+
215
+ ### Telemetry
216
+
217
+ The plugin auto-instruments all message operations with OTel-shaped telemetry spans. Spans are exported to `https://api.agentvault.chat/api/v1/otel/push` and feed the trust scoring engine and observability dashboard.
218
+
219
+ ```typescript
220
+ import { wrapSkillExecution, reportSkillInvocation } from "@agentvault/agentvault";
221
+
222
+ // Wrap a skill execution to auto-emit spans
223
+ const result = await wrapSkillExecution("code-review", async () => {
224
+ // Your skill logic here
225
+ return { issues: 3 };
226
+ });
227
+ ```
228
+
229
+ ## OpenClaw Integration
230
+
231
+ When installed as an OpenClaw plugin, AgentVault registers as the `agentvault` channel:
232
+
233
+ ```json
234
+ {
235
+ "channels": {
236
+ "agentvault": {
237
+ "accountId": "your-agent-account-id"
238
+ }
239
+ }
240
+ }
241
+ ```
242
+
243
+ The plugin hooks into OpenClaw's lifecycle:
244
+
245
+ - **Channel gateway** — routes inbound/outbound messages through the E2E encrypted channel
246
+ - **Heartbeat wake** — keeps the agent alive via OpenClaw's heartbeat system
247
+ - **Agent events** — listens for session start/end and transcript updates
248
+ - **Managed HTTP routes** — `/send`, `/status`, `/targets`, `/action`, `/decision`
249
+ - **MCP serving** — exposes skills as MCP tools via `/mcp` route
250
+
251
+ ## Security Architecture
252
+
253
+ AgentVault is a **zero-knowledge** platform. The server routes ciphertext and NEVER sees plaintext.
254
+
255
+ | Layer | Technology |
256
+ |-------|-----------|
257
+ | Identity | Ed25519 keypairs linked to `did:hub` identifiers |
258
+ | Encryption | XChaCha20-Poly1305 with 192-bit nonces |
259
+ | Forward Secrecy | Double Ratchet protocol + X3DH key agreement |
260
+ | Group Crypto | Sender Key distribution with automatic force rekeying |
261
+ | Audit | BLAKE2b hash-chained entries with W3C TraceContext |
262
+ | Policy | 5-stage pipeline: Parse → Validate → Enforce → Log → Report |
263
+
264
+ ## Related Packages
265
+
266
+ | Package | Description |
267
+ |---------|-------------|
268
+ | [`@agentvault/sdk`](https://www.npmjs.com/package/@agentvault/sdk) | SDK for third-party agent integration (API key auth + E2E) |
269
+ | [`@agentvault/mcp-server`](https://www.npmjs.com/package/@agentvault/mcp-server) | Standalone MCP server for any MCP-compatible host |
270
+ | [`@agentvault/crypto`](https://www.npmjs.com/package/@agentvault/crypto) | Cryptographic primitives (Double Ratchet, X3DH, XChaCha20, telemetry) |
271
+ | [`@agentvault/verify`](https://www.npmjs.com/package/@agentvault/verify) | Lightweight agent verification SDK |
117
272
 
118
273
  ## License
119
274
 
@@ -1 +1 @@
1
- {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,OAAO,EAWL,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAMZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,QAAQ,EAER,UAAU,EAEV,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,UAAU,EACX,MAAM,YAAY,CAAC;AA6DpB,qBAAa,aAAc,SAAQ,YAAY;IAkEjC,OAAO,CAAC,MAAM;IAjE1B,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,sBAAsB,CAAc;IAC5C,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,SAAS,CAGH;IACd,OAAO,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AAS;IAejB,OAAO,CAAC,kBAAkB;IA2H1B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,YAAY;IAKpB;;;OAGG;YACW,aAAa;IAyB3B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;CAqB9B"}
package/dist/cli.js CHANGED
@@ -45963,6 +45963,9 @@ function buildEvalSpan(opts) {
45963
45963
  status: { code: 0 }
45964
45964
  };
45965
45965
  }
45966
+ function buildTraceparent(span) {
45967
+ return `00-${span.traceId}-${span.spanId}-01`;
45968
+ }
45966
45969
  var init_telemetry = __esm({
45967
45970
  "../crypto/dist/telemetry.js"() {
45968
45971
  "use strict";
@@ -45985,6 +45988,9 @@ function toOtlpAttributes(attrs) {
45985
45988
  });
45986
45989
  }
45987
45990
  function spanToOtlp(span) {
45991
+ const enrichedAttrs = { ...span.attributes };
45992
+ enrichedAttrs["w3c.traceparent"] = buildTraceparent(span);
45993
+ enrichedAttrs["w3c.tracestate"] = `av=s:${span.spanId}`;
45988
45994
  const otlp = {
45989
45995
  traceId: span.traceId,
45990
45996
  spanId: span.spanId,
@@ -45992,7 +45998,7 @@ function spanToOtlp(span) {
45992
45998
  kind: span.kind,
45993
45999
  startTimeUnixNano: String(span.startTime * 1e6),
45994
46000
  endTimeUnixNano: String(span.endTime * 1e6),
45995
- attributes: toOtlpAttributes(span.attributes)
46001
+ attributes: toOtlpAttributes(enrichedAttrs)
45996
46002
  };
45997
46003
  if (span.parentSpanId !== void 0) {
45998
46004
  otlp.parentSpanId = span.parentSpanId;
@@ -46169,6 +46175,14 @@ var init_backup = __esm({
46169
46175
  }
46170
46176
  });
46171
46177
 
46178
+ // ../crypto/dist/approval.js
46179
+ var init_approval = __esm({
46180
+ async "../crypto/dist/approval.js"() {
46181
+ "use strict";
46182
+ await init_did();
46183
+ }
46184
+ });
46185
+
46172
46186
  // ../crypto/dist/index.js
46173
46187
  var init_dist = __esm({
46174
46188
  async "../crypto/dist/index.js"() {
@@ -46186,6 +46200,7 @@ var init_dist = __esm({
46186
46200
  init_telemetry();
46187
46201
  init_telemetry_reporter();
46188
46202
  await init_backup();
46203
+ await init_approval();
46189
46204
  }
46190
46205
  });
46191
46206
 
@@ -48480,10 +48495,11 @@ var init_channel = __esm({
48480
48495
  }
48481
48496
  if (data.event === "hub_identity_sync") {
48482
48497
  if (this._persisted && data.data?.hub_id) {
48483
- const changed = this._persisted.hubId !== data.data.hub_id;
48498
+ const changed = this._persisted.hubId !== data.data.hub_id || this._persisted.agentRole !== (data.data.agent_role ?? "peer");
48484
48499
  this._persisted.hubAddress = data.data.hub_address;
48485
48500
  this._persisted.hubId = data.data.hub_id;
48486
48501
  this._persisted.agentHubId = data.data.hub_id;
48502
+ this._persisted.agentRole = data.data.agent_role ?? "peer";
48487
48503
  if (changed) this._persistState();
48488
48504
  if (!this._telemetryReporter && this._persisted.deviceJwt && this._persisted.hubId) {
48489
48505
  this._telemetryReporter = new TelemetryReporter({
@@ -48505,6 +48521,14 @@ var init_channel = __esm({
48505
48521
  }
48506
48522
  this.emit("hub_identity_assigned", data.data);
48507
48523
  }
48524
+ if (data.event === "hub_identity_role_changed") {
48525
+ if (this._persisted && data.data?.agent_role) {
48526
+ this._persisted.agentRole = data.data.agent_role;
48527
+ this._persistState();
48528
+ console.log(`[SecureChannel] Agent role changed to: ${data.data.agent_role}`);
48529
+ }
48530
+ this.emit("hub_identity_role_changed", data.data);
48531
+ }
48508
48532
  if (data.event === "hub_identity_removed") {
48509
48533
  if (this._persisted) {
48510
48534
  delete this._persisted.hubAddress;
@@ -49171,6 +49195,9 @@ ${messageText}`;
49171
49195
  _resolveWorkspaceDir() {
49172
49196
  const homedir = process.env.HOME ?? process.env.USERPROFILE ?? "/tmp";
49173
49197
  const agentName = this.config.agentName;
49198
+ if (this._persisted?.agentRole === "lead") {
49199
+ return join3(homedir, ".openclaw", "workspace");
49200
+ }
49174
49201
  try {
49175
49202
  const configPath = join3(homedir, ".openclaw", "openclaw.json");
49176
49203
  const raw = __require("node:fs").readFileSync(configPath, "utf-8");
@@ -70821,7 +70848,7 @@ function parseSkillMd(content) {
70821
70848
  if (!frontmatter.name) return null;
70822
70849
  const instructionLines = lines.slice(endIdx + 1);
70823
70850
  const instructions = instructionLines.join("\n").trim();
70824
- return {
70851
+ const skill = {
70825
70852
  name: frontmatter.name,
70826
70853
  version: frontmatter.version,
70827
70854
  description: frontmatter.description,
@@ -70830,82 +70857,76 @@ function parseSkillMd(content) {
70830
70857
  slaDefinition: frontmatter.sla,
70831
70858
  instructions: instructions || void 0
70832
70859
  };
70860
+ if (frontmatter.agentVault) {
70861
+ const av = frontmatter.agentVault;
70862
+ if (av.certification) skill.certificationTier = av.certification;
70863
+ if (av.runtime?.capabilities) skill.toolsAllowed = av.runtime.capabilities;
70864
+ if (av.runtime?.forbidden) skill.toolsDenied = av.runtime.forbidden;
70865
+ if (av.runtime?.output_schema) skill.outputSchema = av.runtime.output_schema;
70866
+ if (av.model?.routing) skill.modelRouting = av.model.routing;
70867
+ if (av.model?.allowed) skill.allowedModels = av.model.allowed;
70868
+ if (av.model?.default) skill.defaultModel = av.model.default;
70869
+ if (av.integrity) skill.integrity = av.integrity;
70870
+ if (av.requiredPolicies) skill.requiredPolicies = av.requiredPolicies;
70871
+ }
70872
+ return skill;
70833
70873
  }
70834
70874
  function parseSimpleYaml(yaml) {
70835
70875
  const result = {};
70836
70876
  const lines = yaml.split("\n");
70837
- let currentKey = "";
70838
- let currentIndent = 0;
70839
- let nestedObj = null;
70877
+ const stack = [];
70878
+ let currentObj = result;
70879
+ function parseValue(raw) {
70880
+ const value = raw.replace(/^["']|["']$/g, "");
70881
+ const num = Number(value);
70882
+ if (!isNaN(num) && value !== "") return num;
70883
+ if (value === "true") return true;
70884
+ if (value === "false") return false;
70885
+ return value;
70886
+ }
70840
70887
  for (const line of lines) {
70841
70888
  const trimmed = line.trim();
70842
70889
  if (!trimmed || trimmed.startsWith("#")) continue;
70843
70890
  const indent = line.length - line.trimStart().length;
70844
- const inlineArrayMatch = trimmed.match(/^(\w[\w-]*)\s*:\s*\[(.+)\]$/);
70891
+ while (stack.length > 0 && indent <= stack[stack.length - 1].indent) {
70892
+ const popped = stack.pop();
70893
+ currentObj = stack.length > 0 ? stack[stack.length - 1].obj : result;
70894
+ currentObj[popped.key] = popped.obj;
70895
+ }
70896
+ const inlineArrayMatch = trimmed.match(/^(\w[\w_-]*)\s*:\s*\[(.+)\]$/);
70845
70897
  if (inlineArrayMatch) {
70846
70898
  const key = inlineArrayMatch[1];
70847
70899
  const values = inlineArrayMatch[2].split(",").map((v2) => v2.trim().replace(/^["']|["']$/g, ""));
70848
- if (nestedObj && indent > currentIndent) {
70849
- nestedObj[key] = values;
70900
+ if (stack.length > 0) {
70901
+ stack[stack.length - 1].obj[key] = values;
70850
70902
  } else {
70851
- if (nestedObj && currentKey) {
70852
- result[currentKey] = nestedObj;
70853
- nestedObj = null;
70854
- }
70855
- result[key] = values;
70903
+ currentObj[key] = values;
70856
70904
  }
70857
70905
  continue;
70858
70906
  }
70859
- const kvMatch = trimmed.match(/^(\w[\w-]*)\s*:\s*(.+)$/);
70860
- if (kvMatch && indent === 0) {
70861
- if (nestedObj && currentKey) {
70862
- result[currentKey] = nestedObj;
70863
- nestedObj = null;
70864
- }
70907
+ const kvMatch = trimmed.match(/^(\w[\w_-]*)\s*:\s*(.+)$/);
70908
+ if (kvMatch) {
70865
70909
  const key = kvMatch[1];
70866
- const value = kvMatch[2].replace(/^["']|["']$/g, "");
70867
- const num = Number(value);
70868
- if (!isNaN(num) && value !== "") {
70869
- result[key] = num;
70870
- } else if (value === "true") {
70871
- result[key] = true;
70872
- } else if (value === "false") {
70873
- result[key] = false;
70910
+ const val = parseValue(kvMatch[2]);
70911
+ if (stack.length > 0) {
70912
+ stack[stack.length - 1].obj[key] = val;
70874
70913
  } else {
70875
- result[key] = value;
70914
+ currentObj[key] = val;
70876
70915
  }
70877
70916
  continue;
70878
70917
  }
70879
- const nestedMatch = trimmed.match(/^(\w[\w-]*)\s*:$/);
70880
- if (nestedMatch && indent === 0) {
70881
- if (nestedObj && currentKey) {
70882
- result[currentKey] = nestedObj;
70883
- }
70884
- currentKey = nestedMatch[1];
70885
- currentIndent = indent;
70886
- nestedObj = {};
70918
+ const nestedMatch = trimmed.match(/^(\w[\w_-]*)\s*:$/);
70919
+ if (nestedMatch) {
70920
+ const key = nestedMatch[1];
70921
+ const newObj = {};
70922
+ stack.push({ key, obj: newObj, indent });
70887
70923
  continue;
70888
70924
  }
70889
- if (nestedObj && indent > 0) {
70890
- const nestedKv = trimmed.match(/^(\w[\w-]*)\s*:\s*(.+)$/);
70891
- if (nestedKv) {
70892
- const key = nestedKv[1];
70893
- const value = nestedKv[2].replace(/^["']|["']$/g, "");
70894
- const num = Number(value);
70895
- if (!isNaN(num) && value !== "") {
70896
- nestedObj[key] = num;
70897
- } else if (value === "true") {
70898
- nestedObj[key] = true;
70899
- } else if (value === "false") {
70900
- nestedObj[key] = false;
70901
- } else {
70902
- nestedObj[key] = value;
70903
- }
70904
- }
70905
- }
70906
70925
  }
70907
- if (nestedObj && currentKey) {
70908
- result[currentKey] = nestedObj;
70926
+ while (stack.length > 0) {
70927
+ const popped = stack.pop();
70928
+ const parent = stack.length > 0 ? stack[stack.length - 1].obj : result;
70929
+ parent[popped.key] = popped.obj;
70909
70930
  }
70910
70931
  return result;
70911
70932
  }
@@ -70930,6 +70951,14 @@ var init_skill_telemetry = __esm({
70930
70951
  }
70931
70952
  });
70932
70953
 
70954
+ // src/policy-enforcer.ts
70955
+ var init_policy_enforcer = __esm({
70956
+ async "src/policy-enforcer.ts"() {
70957
+ "use strict";
70958
+ await init_dist();
70959
+ }
70960
+ });
70961
+
70933
70962
  // src/index.ts
70934
70963
  var VERSION;
70935
70964
  var init_index = __esm({
@@ -70948,6 +70977,7 @@ var init_index = __esm({
70948
70977
  init_skill_manifest();
70949
70978
  init_skill_invoker();
70950
70979
  await init_skill_telemetry();
70980
+ await init_policy_enforcer();
70951
70981
  VERSION = "0.14.1";
70952
70982
  }
70953
70983
  });