@wowok/skills 1.0.6 → 1.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.
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: wowok-guard
3
3
  description: |
4
4
  WoWok Guard design mastery — comprehensive reference for the recursive,
@@ -264,7 +264,7 @@ Decide what data the Guard needs:
264
264
  - Use `query` + `identifier` patterns for data fetching
265
265
  - Use comparison nodes for validation
266
266
 
267
- ### Step 5: Create Guard (Dry-Run First)
267
+ ### Step 5: Create Guard
268
268
  ```
269
269
  onchain_operations({
270
270
  operation_type: "guard",
@@ -274,17 +274,18 @@ onchain_operations({
274
274
  table: [...],
275
275
  root: { type: "node", node: { type: "logic_and", nodes: [...] } }
276
276
  }
277
- // NO submission → dry run
278
277
  })
279
278
  ```
280
279
 
280
+ Guard creation is a **one-step** operation — the `guard` operation type has no `submission` field. It either succeeds (returns transaction) or fails (returns error).
281
+
281
282
  ### Step 6: Export for Review
282
283
  ```
283
284
  guard2file({ guard: "my_guard", file_path: "./my_guard.json", format: "json" })
284
285
  ```
285
286
 
286
- ### Step 7: Execute
287
- Add `submission` after confirming the dry-run result.
287
+ ### Step 7: Use Guard in Operations
288
+ The Guard is now ready to be referenced by other operations (service, machine, progress, etc.) via their `submission` field. See [Guard Submission Mechanism](../schemas/onchain_operations/_index.md) for how Guards participate in the two-step submission flow.
288
289
 
289
290
  ---
290
291
 
@@ -371,4 +372,54 @@ Add `submission` after confirming the dry-run result.
371
372
  | "type mismatch" | Wrong ValueType in table | Match table type to actual value type |
372
373
  | "table field required" | Missing table array | Guards MUST have `table[]` |
373
374
  | "guard validation failed" | Logic error | Export with `guard2file`, review logic |
374
- | "object not found" | Wrong query object | Verify object addresses/identifiers |
375
+ | "object not found" | Wrong query object | Verify object addresses/identifiers |
376
+
377
+ ---
378
+
379
+ ## Query Witness Conversion Types
380
+
381
+ When using a `query` node's `convert_witness` field, the following numeric IDs allow cross-object type conversion — accessing a related object from the current context:
382
+
383
+ | Conversion | ID | Description |
384
+ |-----------|-----|-------------|
385
+ | TypeOrderProgress | 100 | From Order, get its Progress |
386
+ | TypeOrderMachine | 101 | From Order, get its Machine |
387
+ | TypeOrderService | 102 | From Order, get its Service |
388
+ | TypeProgressMachine | 103 | From Progress, get its Machine |
389
+ | TypeArbOrder | 104 | From Arb, get its Order |
390
+ | TypeArbArbitration | 105 | From Arb, get its Arbitration |
391
+ | TypeArbProgress | 106 | From Arb, get its Progress |
392
+ | TypeArbMachine | 107 | From Arb, get its Machine |
393
+ | TypeArbService | 108 | From Arb, get its Service |
394
+
395
+ **Example**: To verify that an Order's Progress is at a specific node, query the Order with `convert_witness: 100` (TypeOrderProgress) to fetch the Progress object, then query the Progress's current node name.
396
+
397
+ ---
398
+
399
+ ## Discovering Query Instructions via `wowok_buildin_info`
400
+
401
+ Before using `query` nodes, discover available query instructions and their signatures:
402
+
403
+ ```typescript
404
+ // Query all Guard instructions and object queries
405
+ {
406
+ info: "guard instructions",
407
+ filter: {
408
+ scope: "all", // "instruct" | "object query" | "all"
409
+ objectType?: string, // Filter by object type (for object queries)
410
+ returnType?: string, // Filter by return type
411
+ paramCount?: number, // Filter by parameter count
412
+ name?: string // Case-insensitive name filter
413
+ }
414
+ }
415
+ ```
416
+
417
+ This returns a list of all available operations with:
418
+ - `id`: Numeric operation ID
419
+ - `name`: Human-readable name (e.g., "machine.description")
420
+ - `objectType`: Target object type
421
+ - `parameters`: Array of expected parameter types
422
+ - `return`: Return value type
423
+ - `description`: Detailed usage description
424
+
425
+ Always query `guard instructions` before designing complex Guards to ensure correct IDs, parameter types, and return types.
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: wowok-machine
3
3
  description: |
4
4
  WoWok Machine workflow design — defines multi-step workflows (state machines)
@@ -510,3 +510,50 @@ Designing a Machine workflow?
510
510
  | Time-lock | `prev_node: "X"` | 1 | time guard | Auto-complete after duration |
511
511
  | Guarded | `prev_node: "X"` | 1 | condition guard | Weather check, Merkle root, etc. |
512
512
  | Sub-order | `prev_node: "X"` | 1 | guard + forward_to | Create order on another Service |
513
+
514
+ ---
515
+
516
+ ## Privacy & Consensus via Messenger
517
+
518
+ Sensitive logistics and customer data flow through Messenger's end-to-end encryption (never on-chain). Guard consensus follows: **who performs the key action, submits the proof; the other party confirms**.
519
+
520
+ | Scenario | Action | Proof Submission |
521
+ |----------|--------|------------------|
522
+ | Merchant ships | Receives address via Messenger, replies tracking number | Merchant submits Merkle Root to Guard |
523
+ | Customer returns | Sends return tracking via Messenger | Customer submits Merkle Root to Guard |
524
+ | Mutual confirmation | Both parties sign | Both submit confirmation proofs |
525
+
526
+ This pattern is used in Machine workflows where off-chain actions (shipping, delivery) need on-chain verification via Guard proofs.
527
+
528
+ ---
529
+
530
+ ## Forward Permission Model
531
+
532
+ Each forward must specify either `permissionIndex` or `namedOperator`:
533
+
534
+ | Field | Scope | Typical Use |
535
+ |-------|-------|-------------|
536
+ | `permissionIndex` | Shared across all Progress instances | Internal roles (merchant operators, admins) |
537
+ | `namedOperator` | Per-Progress namespace | External roles per order instance |
538
+
539
+ **Order user operations** MUST use `namedOperator("")` — this maps to the order's owner (customer).
540
+
541
+ ---
542
+
543
+ ## Guard in Forwards — Use Cases
544
+
545
+ The optional `guard` field in a Forward validates critical operation results before allowing the forward to complete:
546
+
547
+ - **Repository submission validation**: Verify that required data was successfully submitted to a specified Repository object
548
+ - **Supply chain commitment validation**: Confirm that sub-order commitments in the supply chain were fulfilled
549
+ - **External condition checks**: Validate any external state or conditions that must be met before proceeding
550
+
551
+ When a forward has a Guard, the Guard's logic is evaluated when a user attempts to execute that forward. If the Guard returns `false`, the forward cannot be completed.
552
+
553
+ ---
554
+
555
+ ## Progress Advancement Rules
556
+
557
+ - Sum of completed forward weights ≥ threshold → session moves to history, next node becomes current
558
+ - Order users advance via `Order` object
559
+ - Non-order users advance via `Progress` object directly
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: wowok-order
3
3
  description: |
4
4
  WoWok order lifecycle management — covers the complete order flow from
@@ -18,6 +18,30 @@ when_to_use:
18
18
 
19
19
  # WoWok Order Lifecycle Management
20
20
 
21
+ ## Runtime Objects Overview
22
+
23
+ After a Service is published (see [wowok-build](../wowok-build/SKILL.md)), users interact with it creating runtime objects:
24
+
25
+ | Object | Created By | Purpose |
26
+ |--------|-----------|---------|
27
+ | **Order** | User purchase | Order management and escrow |
28
+ | **Progress** | Order creation | Workflow state tracking |
29
+ | **Allocation** | Order completion | Fund distribution per consensus |
30
+ | **Arb(s)** | Dispute request | Arbitration for compensation |
31
+
32
+ ```
33
+ User Purchase
34
+
35
+ Service ──→ Order ──→ Progress ──→ Allocation
36
+ ↓ ↓
37
+ Payment Node Transitions
38
+ (escrow) (Guard validated)
39
+
40
+ Completion
41
+
42
+ Fund Distribution
43
+ ```
44
+
21
45
  ## Order Lifecycle Overview
22
46
 
23
47
  ```
@@ -497,3 +521,13 @@ The Insurance Service must already be deployed and published before the Travel S
497
521
  6. DISPUTE RESOLUTION (if needed)
498
522
  Arbitration → arb_confirm/arb_objection → resolution
499
523
  ```
524
+
525
+ ---
526
+
527
+ ## Payments & Refunds Rules
528
+
529
+ - **Service purchase**: Always pay through `Service`. Name the generated `Order`, `Progress`, and `Allocation` via `namedNew*` fields for easy management.
530
+ - **Order operations**: All order user operations MUST go through the `Order` object — do not operate on `Progress` directly for order-related actions.
531
+ - **Refunds/withdrawals**: Users satisfy `Allocation` Guard conditions to withdraw instantly.
532
+ - **Arbitration claims**: Compensation payouts go through `Order`.
533
+ - **Alternative payments**: `account_operation (transfer)` for direct wallet-to-wallet, or `onchain_operations (payment)` for commercial features (purpose tracking, Guard validation).