@wowok/agent-mcp 2.6.0 → 2.6.3
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 +5 -3
- package/dist/customer/info-puzzle.d.ts +1 -1
- package/dist/customer/info-puzzle.js +4 -2
- package/dist/customer/risk-assessment.js +26 -4
- package/dist/customer/types.d.ts +2 -0
- package/dist/examples/guard-template-balance-check.json +38 -0
- package/dist/examples/guard-template-time-lock.json +39 -0
- package/dist/examples/machine-template-7node-rental.json +114 -0
- package/dist/examples/rental-ziroom-machine-create.json +137 -0
- package/dist/examples/rental-ziroom-permission-create.json +35 -0
- package/dist/examples/rental-ziroom-service-create.json +80 -0
- package/dist/examples/retail-myshop-service-create.json +88 -0
- package/dist/extensions/capability-manifest.d.ts +125 -0
- package/dist/extensions/capability-manifest.js +594 -0
- package/dist/extensions/constraint-registry.d.ts +24 -0
- package/dist/extensions/constraint-registry.js +196 -0
- package/dist/extensions/index.d.ts +12 -0
- package/dist/extensions/index.js +6 -0
- package/dist/extensions/metric-registry.d.ts +26 -0
- package/dist/extensions/metric-registry.js +257 -0
- package/dist/extensions/mode-evaluator.d.ts +15 -0
- package/dist/extensions/mode-evaluator.js +170 -0
- package/dist/extensions/modes.d.ts +2 -0
- package/dist/extensions/modes.js +493 -0
- package/dist/extensions/registry.d.ts +50 -0
- package/dist/extensions/registry.js +662 -0
- package/dist/extensions/types.d.ts +219 -0
- package/dist/extensions/types.js +1 -0
- package/dist/index.js +50 -0
- package/dist/knowledge/deployment-scanner.d.ts +3 -0
- package/dist/knowledge/deployment-scanner.js +64 -3
- package/dist/knowledge/fund-layer.d.ts +72 -0
- package/dist/knowledge/fund-layer.js +420 -0
- package/dist/knowledge/guard-render.d.ts +57 -0
- package/dist/knowledge/guard-render.js +700 -0
- package/dist/knowledge/guard-risk.d.ts +13 -0
- package/dist/knowledge/guard-risk.js +57 -0
- package/dist/knowledge/guard-submission-prompt.d.ts +31 -0
- package/dist/knowledge/guard-submission-prompt.js +171 -0
- package/dist/knowledge/guard-templates.js +278 -0
- package/dist/knowledge/machine-ledger.js +1 -1
- package/dist/knowledge/machine-render.d.ts +41 -0
- package/dist/knowledge/machine-render.js +565 -0
- package/dist/knowledge/machine-templates.js +24 -5
- package/dist/knowledge/reward-confirm.js +2 -2
- package/dist/knowledge/reward-puzzle.js +1 -1
- package/dist/knowledge/reward-risk.js +9 -9
- package/dist/knowledge/reward-templates.js +2 -2
- package/dist/knowledge/service-confirm.d.ts +15 -6
- package/dist/knowledge/service-confirm.js +119 -11
- package/dist/knowledge/service-context.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-risk.d.ts +1 -1
- package/dist/knowledge/service-risk.js +3 -3
- package/dist/knowledge/service-templates.js +2 -2
- package/dist/knowledge/service-translation.d.ts +1 -1
- package/dist/knowledge/service-translation.js +7 -7
- package/dist/knowledge/tool-constraints.js +6 -2
- package/dist/project/deployment-bridge.d.ts +1 -1
- package/dist/project/deployment-bridge.js +31 -7
- package/dist/project/deployment-doc.d.ts +3 -0
- package/dist/project/deployment-doc.js +76 -14
- package/dist/project/edit-planner.d.ts +123 -0
- package/dist/project/edit-planner.js +1371 -0
- package/dist/project/evaluation.d.ts +2 -0
- package/dist/project/evaluation.js +873 -88
- package/dist/project/graph-builder.d.ts +4 -1
- package/dist/project/graph-builder.js +132 -62
- package/dist/project/graph.d.ts +1 -0
- package/dist/project/handlers.d.ts +317 -6
- package/dist/project/handlers.js +1171 -19
- package/dist/project/stage-gate.d.ts +4 -0
- package/dist/project/stage-gate.js +64 -5
- package/dist/project/task-tracker.d.ts +26 -0
- package/dist/project/task-tracker.js +78 -0
- package/dist/safety/preview.js +16 -0
- package/dist/schema/call/allocation.d.ts +16 -16
- package/dist/schema/call/allocation.js +2 -2
- package/dist/schema/call/arbitration.js +19 -6
- package/dist/schema/call/base.d.ts +21 -13
- package/dist/schema/call/base.js +27 -6
- package/dist/schema/call/bridge.d.ts +5 -5
- package/dist/schema/call/bridge.js +3 -1
- package/dist/schema/call/contact.js +2 -2
- package/dist/schema/call/demand.d.ts +23 -31
- package/dist/schema/call/demand.js +2 -2
- package/dist/schema/call/guard.js +2 -2
- package/dist/schema/call/machine.d.ts +1976 -752
- package/dist/schema/call/machine.js +50 -4
- package/dist/schema/call/order.d.ts +149 -228
- package/dist/schema/call/order.js +4 -3
- package/dist/schema/call/payment.d.ts +183 -3
- package/dist/schema/call/payment.js +21 -3
- package/dist/schema/call/permission.js +2 -2
- package/dist/schema/call/personal.d.ts +241 -52
- package/dist/schema/call/progress.d.ts +53 -61
- package/dist/schema/call/progress.js +18 -4
- package/dist/schema/call/repository.d.ts +23 -31
- package/dist/schema/call/repository.js +2 -2
- package/dist/schema/call/reward.js +3 -3
- package/dist/schema/call/semantic.d.ts +1 -1
- package/dist/schema/call/semantic.js +37 -2
- package/dist/schema/call/service.d.ts +275 -127
- package/dist/schema/call/service.js +89 -13
- package/dist/schema/call/treasury.js +3 -3
- package/dist/schema/common/index.d.ts +13 -2
- package/dist/schema/common/index.js +80 -15
- package/dist/schema/local/index.d.ts +32 -35
- package/dist/schema/local/index.js +28 -6
- package/dist/schema/messenger/index.d.ts +274 -46
- package/dist/schema/operations.d.ts +1264 -544
- package/dist/schema/operations.js +65 -7
- package/dist/schema/project/index.d.ts +2846 -167
- package/dist/schema/project/index.js +570 -16
- package/dist/schema/query/index.d.ts +922 -349
- package/dist/schema/query/index.js +205 -42
- package/dist/schema/schema-query/index.d.ts +65 -3
- package/dist/schema/schema-query/index.js +38 -5
- package/dist/schema/utils/node-parser.js +20 -4
- package/dist/schema/utils/object-type-utils.d.ts +12 -0
- package/dist/schema/utils/object-type-utils.js +35 -0
- package/dist/schema/utils/permission-machine-check.d.ts +49 -0
- package/dist/schema/utils/permission-machine-check.js +121 -0
- package/dist/schema/utils/skills-recommendation.d.ts +2 -0
- package/dist/schema/utils/skills-recommendation.js +76 -0
- package/dist/schema-query/index.d.ts +20 -1
- package/dist/schema-query/index.js +306 -4
- package/dist/schemas/account_operation.output.json +7 -1
- package/dist/schemas/account_operation.schema.json +3 -3
- package/dist/schemas/bridge_operation.output.json +6 -0
- package/dist/schemas/bridge_operation.schema.json +1 -1
- package/dist/schemas/guard-templates.json +379 -0
- package/dist/schemas/guard2file.schema.json +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/local_info_operation.output.json +6 -0
- package/dist/schemas/local_mark_operation.output.json +7 -1
- package/dist/schemas/local_mark_operation.schema.json +1 -1
- package/dist/schemas/machineNode2file.schema.json +1 -1
- package/dist/schemas/messenger_operation.schema.json +4 -4
- package/dist/schemas/onchain_events.output.json +1 -1
- package/dist/schemas/onchain_operations.output.json +2820 -0
- package/dist/schemas/onchain_operations.schema.json +444 -330
- package/dist/schemas/onchain_operations_allocation.schema.json +37 -28
- package/dist/schemas/onchain_operations_arbitration.schema.json +16 -14
- package/dist/schemas/onchain_operations_contact.schema.json +10 -10
- package/dist/schemas/onchain_operations_demand.schema.json +10 -10
- package/dist/schemas/onchain_operations_gen_passport.schema.json +16 -16
- package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -2
- package/dist/schemas/onchain_operations_guard.schema.json +2 -2
- package/dist/schemas/onchain_operations_machine.schema.json +43 -35
- package/dist/schemas/onchain_operations_order.schema.json +72 -78
- package/dist/schemas/onchain_operations_payment.schema.json +141 -111
- package/dist/schemas/onchain_operations_permission.schema.json +3 -3
- package/dist/schemas/onchain_operations_personal.schema.json +7 -7
- package/dist/schemas/onchain_operations_progress.schema.json +9 -9
- package/dist/schemas/onchain_operations_proof.schema.json +8 -8
- package/dist/schemas/onchain_operations_repository.schema.json +10 -10
- package/dist/schemas/onchain_operations_reward.schema.json +14 -14
- package/dist/schemas/onchain_operations_service.schema.json +119 -48
- package/dist/schemas/onchain_operations_treasury.schema.json +11 -11
- package/dist/schemas/onchain_table_data.output.json +33 -25
- package/dist/schemas/onchain_table_data.schema.json +22 -21
- package/dist/schemas/project_operation.output.json +2194 -23
- package/dist/schemas/project_operation.schema.json +84 -6
- package/dist/schemas/query_toolkit.output.json +108 -80
- package/dist/schemas/query_toolkit.schema.json +12 -12
- package/dist/schemas/schema_query.output.json +70 -3
- package/dist/schemas/schema_query.schema.json +18 -3
- package/dist/schemas/wowok_buildin_info.output.json +81 -8
- package/dist/schemas/wowok_buildin_info.schema.json +46 -2
- package/dist/tools/handlers/local.js +20 -5
- package/dist/tools/handlers/onchain.js +594 -6
- package/dist/tools/handlers/project.js +76 -4
- package/dist/tools/handlers/query.js +27 -0
- package/dist/tools/handlers/schema-query.js +43 -1
- package/dist/tools/handlers/task-status.d.ts +170 -0
- package/dist/tools/handlers/task-status.js +55 -0
- package/dist/tools/handlers/wip.js +47 -1
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.js +387 -12
- package/dist/tools/retry.d.ts +8 -0
- package/dist/tools/retry.js +85 -0
- package/dist/tools/wip-deploy-assist.d.ts +28 -0
- package/dist/tools/wip-deploy-assist.js +278 -0
- package/package.json +2 -2
- package/dist/schemas/guard-node-examples.md +0 -199
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import type { GuardScene } from "./guard-ledger.js";
|
|
2
|
+
export declare const GUARD_COGNITIVE_PRINCIPLES: readonly [{
|
|
3
|
+
readonly id: "P1";
|
|
4
|
+
readonly title: "Guard validation always precedes the operation";
|
|
5
|
+
readonly statement: string;
|
|
6
|
+
readonly code_evidence: string;
|
|
7
|
+
readonly legitimate_exception: string;
|
|
8
|
+
readonly scope: "Applies when a Guard queries state of the SAME object the operation mutates.";
|
|
9
|
+
}, {
|
|
10
|
+
readonly id: "P2";
|
|
11
|
+
readonly title: "Guard is CREATE-only and immutable";
|
|
12
|
+
readonly statement: string;
|
|
13
|
+
readonly scope: "Applies to all Guard lifecycle decisions.";
|
|
14
|
+
}];
|
|
2
15
|
export type GuardStakeholder = "customer" | "provider" | "arbitrator" | "claimant" | "system";
|
|
3
16
|
export type RiskLevel = "critical" | "high" | "medium" | "low";
|
|
4
17
|
export type DataSourceClass = "type1_onchain_constant" | "type2_witness_derived" | "type3_submitted_object" | "type4_system_context" | "cross_type";
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import { GUARDQUERY } from "@wowok/wowok";
|
|
2
|
+
export const GUARD_COGNITIVE_PRINCIPLES = [
|
|
3
|
+
{
|
|
4
|
+
id: "P1",
|
|
5
|
+
title: "Guard validation always precedes the operation",
|
|
6
|
+
statement: "Guard validation ALWAYS occurs BEFORE the operation it guards. " +
|
|
7
|
+
"A Guard must NOT depend on data that the current operation will modify.",
|
|
8
|
+
code_evidence: "progress.move next_with_passport_imp: result_for_guard (line 471) " +
|
|
9
|
+
"runs before session_accomplish (line 481) which sets self.current (line 443).",
|
|
10
|
+
legitimate_exception: "Querying progress.current of a DIFFERENT Progress object (cross-machine) " +
|
|
11
|
+
"is safe and reasonable — that progress is not modified by the current operation.",
|
|
12
|
+
scope: "Applies when a Guard queries state of the SAME object the operation mutates.",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: "P2",
|
|
16
|
+
title: "Guard is CREATE-only and immutable",
|
|
17
|
+
statement: "After creation, Guard table/root/rely cannot be modified. " +
|
|
18
|
+
"To change logic, create a new Guard and rebind references.",
|
|
19
|
+
scope: "Applies to all Guard lifecycle decisions.",
|
|
20
|
+
},
|
|
21
|
+
];
|
|
2
22
|
function rootStr(ctx) {
|
|
3
23
|
return JSON.stringify(ctx.root).toLowerCase();
|
|
4
24
|
}
|
|
@@ -1681,6 +1701,43 @@ const RISK_RULES = [
|
|
|
1681
1701
|
};
|
|
1682
1702
|
},
|
|
1683
1703
|
},
|
|
1704
|
+
{
|
|
1705
|
+
id: "R-X1-15",
|
|
1706
|
+
data_source_class: "cross_type",
|
|
1707
|
+
trigger: "Guard root contains a progress.current query (id=1253 or name='progress.current'); " +
|
|
1708
|
+
"if bound to a forward of the SAME Progress object, the guard evaluates before state transition",
|
|
1709
|
+
check: (ctx) => {
|
|
1710
|
+
const queryIds = extractQueryIds(ctx.root);
|
|
1711
|
+
if (!queryIds.includes(1253))
|
|
1712
|
+
return null;
|
|
1713
|
+
return {
|
|
1714
|
+
id: "R-X1-15",
|
|
1715
|
+
data_source_class: "cross_type",
|
|
1716
|
+
level: "medium",
|
|
1717
|
+
category: "logic_gap",
|
|
1718
|
+
title: "Guard queries progress.current — verify it is NOT the same Progress object the hosting operation mutates",
|
|
1719
|
+
description: "Cognitive Principle P1: Guard validation ALWAYS occurs BEFORE the operation. " +
|
|
1720
|
+
"This Guard contains a progress.current query. If this Guard is bound to a forward " +
|
|
1721
|
+
"of the SAME Progress object it queries, the Guard will see the PRE-transition value " +
|
|
1722
|
+
"(source node, not target node) and may always fail. " +
|
|
1723
|
+
"Querying a DIFFERENT Progress object (e.g. another Machine's progress) is a valid " +
|
|
1724
|
+
"and reasonable design pattern — the principle does not apply in that case. " +
|
|
1725
|
+
"Allocator-bound guards are also unaffected because allocation.alloc() runs AFTER " +
|
|
1726
|
+
"the state transition completes.",
|
|
1727
|
+
affected_stakeholders: ["provider"],
|
|
1728
|
+
scenario: "Forward guard checks progress.current == target_node of the same Progress — " +
|
|
1729
|
+
"always fails because guard runs before session_accomplish sets the new current node",
|
|
1730
|
+
mitigation: "1) If this Guard queries the SAME Progress object the forward operates on: " +
|
|
1731
|
+
"remove the guard from the forward, bind it ONLY to the Allocator (which runs after transition); " +
|
|
1732
|
+
"OR change the check to verify the SOURCE node instead of the target node. " +
|
|
1733
|
+
"2) If this Guard queries a DIFFERENT Progress object (cross-machine): no action needed — " +
|
|
1734
|
+
"this is a legitimate pattern. " +
|
|
1735
|
+
"3) Refer to GUARD_COGNITIVE_PRINCIPLES P1 for the full principle and code evidence.",
|
|
1736
|
+
evidence: `Root contains progress.current query (id=1253). ` +
|
|
1737
|
+
`Query IDs detected: [${queryIds.join(", ")}].`,
|
|
1738
|
+
};
|
|
1739
|
+
},
|
|
1740
|
+
},
|
|
1684
1741
|
];
|
|
1685
1742
|
function deriveStakeholders(sceneId) {
|
|
1686
1743
|
switch (sceneId) {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface SubmissionFieldPrompt {
|
|
2
|
+
identifier: number;
|
|
3
|
+
name: string;
|
|
4
|
+
value_type: string;
|
|
5
|
+
required: boolean;
|
|
6
|
+
suggested_value?: string;
|
|
7
|
+
suggestion_reason?: string;
|
|
8
|
+
description: string;
|
|
9
|
+
}
|
|
10
|
+
export interface GuardSubmissionPrompt {
|
|
11
|
+
guard_address: string;
|
|
12
|
+
guard_name?: string;
|
|
13
|
+
operation: string;
|
|
14
|
+
required_fields: SubmissionFieldPrompt[];
|
|
15
|
+
context: string;
|
|
16
|
+
fill_example: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SubmissionContext {
|
|
19
|
+
operation: string;
|
|
20
|
+
network?: string;
|
|
21
|
+
signer?: string;
|
|
22
|
+
progress_address?: string;
|
|
23
|
+
progress_current?: string;
|
|
24
|
+
order_address?: string;
|
|
25
|
+
service_address?: string;
|
|
26
|
+
machine_address?: string;
|
|
27
|
+
allocation_address?: string;
|
|
28
|
+
extra?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
export declare function generateGuardSubmissionPrompt(guardRef: string, ctx: SubmissionContext): Promise<GuardSubmissionPrompt | undefined>;
|
|
31
|
+
export declare function formatSubmissionPrompt(prompt: GuardSubmissionPrompt): string;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { query_objects, LocalMark } from "@wowok/wowok";
|
|
2
|
+
function inferValue(fieldName, valueType, ctx) {
|
|
3
|
+
const name = fieldName.toLowerCase();
|
|
4
|
+
if (name.includes("order") || name.includes("task")) {
|
|
5
|
+
if (ctx.order_address) {
|
|
6
|
+
return { value: ctx.order_address, reason: "Inferred from operation's order_address context" };
|
|
7
|
+
}
|
|
8
|
+
if (ctx.progress_address) {
|
|
9
|
+
return { value: ctx.progress_address, reason: "Progress.task is typically the order — query Progress to get the actual task address" };
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (name.includes("signer") || name.includes("sender") || name.includes("caller")) {
|
|
13
|
+
if (ctx.signer) {
|
|
14
|
+
return { value: ctx.signer, reason: "Inferred from env.account (the signing account)" };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (name.includes("service")) {
|
|
18
|
+
if (ctx.service_address) {
|
|
19
|
+
return { value: ctx.service_address, reason: "Inferred from operation's service_address context" };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (name.includes("machine")) {
|
|
23
|
+
if (ctx.machine_address) {
|
|
24
|
+
return { value: ctx.machine_address, reason: "Inferred from operation's machine_address context" };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (name.includes("progress") || name.includes("node") || name.includes("current")) {
|
|
28
|
+
if (ctx.progress_current) {
|
|
29
|
+
return { value: ctx.progress_current, reason: "Inferred from Progress.current node name" };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (name.includes("allocation") || name.includes("allocator")) {
|
|
33
|
+
if (ctx.allocation_address) {
|
|
34
|
+
return { value: ctx.allocation_address, reason: "Inferred from operation's allocation_address context" };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (ctx.extra) {
|
|
38
|
+
for (const [key, val] of Object.entries(ctx.extra)) {
|
|
39
|
+
if (name.includes(key.toLowerCase())) {
|
|
40
|
+
return { value: val, reason: `Inferred from extra context: ${key}` };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
function describeField(name, valueType) {
|
|
47
|
+
const n = name.toLowerCase();
|
|
48
|
+
if (n.includes("order"))
|
|
49
|
+
return `Order object address (type: ${valueType})`;
|
|
50
|
+
if (n.includes("signer") || n.includes("sender"))
|
|
51
|
+
return `Transaction signer address (type: ${valueType})`;
|
|
52
|
+
if (n.includes("service"))
|
|
53
|
+
return `Service object address (type: ${valueType})`;
|
|
54
|
+
if (n.includes("machine"))
|
|
55
|
+
return `Machine object address (type: ${valueType})`;
|
|
56
|
+
if (n.includes("progress"))
|
|
57
|
+
return `Progress object address (type: ${valueType})`;
|
|
58
|
+
if (n.includes("node") || n.includes("current"))
|
|
59
|
+
return `Current node name (type: ${valueType})`;
|
|
60
|
+
if (n.includes("amount") || n.includes("price") || n.includes("balance"))
|
|
61
|
+
return `Amount in smallest unit (type: ${valueType})`;
|
|
62
|
+
if (n.includes("allocation"))
|
|
63
|
+
return `Allocation object address (type: ${valueType})`;
|
|
64
|
+
return `Field "${name}" (type: ${valueType})`;
|
|
65
|
+
}
|
|
66
|
+
export async function generateGuardSubmissionPrompt(guardRef, ctx) {
|
|
67
|
+
let guardAddress = guardRef;
|
|
68
|
+
let guardName;
|
|
69
|
+
if (!guardRef.startsWith("0x")) {
|
|
70
|
+
try {
|
|
71
|
+
const mark = await LocalMark.Instance().get(guardRef);
|
|
72
|
+
if (mark?.address) {
|
|
73
|
+
guardAddress = mark.address;
|
|
74
|
+
guardName = guardRef;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
let guardObj;
|
|
85
|
+
try {
|
|
86
|
+
const result = await query_objects({
|
|
87
|
+
objects: [guardAddress],
|
|
88
|
+
network: ctx.network,
|
|
89
|
+
});
|
|
90
|
+
guardObj = result?.objects?.[0];
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
if (!guardObj)
|
|
96
|
+
return undefined;
|
|
97
|
+
const table = guardObj.table ?? guardObj.b_table ?? [];
|
|
98
|
+
if (!Array.isArray(table) || table.length === 0)
|
|
99
|
+
return undefined;
|
|
100
|
+
const submissionItems = table.filter((item) => item.b_submission === true);
|
|
101
|
+
if (submissionItems.length === 0)
|
|
102
|
+
return undefined;
|
|
103
|
+
const requiredFields = submissionItems.map((item) => {
|
|
104
|
+
const fieldName = item.name ?? `identifier_${item.identifier}`;
|
|
105
|
+
const valueType = typeof item.value_type === "number"
|
|
106
|
+
? ValueTypeNames[item.value_type] ?? String(item.value_type)
|
|
107
|
+
: String(item.value_type);
|
|
108
|
+
const inferred = inferValue(fieldName, valueType, ctx);
|
|
109
|
+
return {
|
|
110
|
+
identifier: item.identifier,
|
|
111
|
+
name: fieldName,
|
|
112
|
+
value_type: valueType,
|
|
113
|
+
required: true,
|
|
114
|
+
suggested_value: inferred?.value,
|
|
115
|
+
suggestion_reason: inferred?.reason,
|
|
116
|
+
description: describeField(fieldName, valueType),
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
const fillLines = requiredFields.map((f) => {
|
|
120
|
+
const val = f.suggested_value ?? `<${f.value_type}_value>`;
|
|
121
|
+
return ` { identifier: ${f.identifier}, name: "${f.name}", value_type: "${f.value_type}", value: ${val} }`;
|
|
122
|
+
});
|
|
123
|
+
const fillExample = `submission: {
|
|
124
|
+
guard: "${guardName ?? guardAddress}",
|
|
125
|
+
submission: [
|
|
126
|
+
${fillLines.join(",\n")}
|
|
127
|
+
]
|
|
128
|
+
}`;
|
|
129
|
+
return {
|
|
130
|
+
guard_address: guardAddress,
|
|
131
|
+
guard_name: guardName,
|
|
132
|
+
operation: ctx.operation,
|
|
133
|
+
required_fields: requiredFields,
|
|
134
|
+
context: `Operation "${ctx.operation}" requires Guard "${guardName ?? guardAddress}" verification. ` +
|
|
135
|
+
`The Guard has ${requiredFields.length} field(s) that need submission data (b_submission=true). ` +
|
|
136
|
+
`Fill the submission with the required values and retry the operation using call_with_submission. ` +
|
|
137
|
+
`Each field has an identifier (number), name, and expected value_type. ` +
|
|
138
|
+
`The suggested_value (if provided) is inferred from the operation context — verify before using.`,
|
|
139
|
+
fill_example: fillExample,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export function formatSubmissionPrompt(prompt) {
|
|
143
|
+
const lines = [];
|
|
144
|
+
lines.push("GUARD SUBMISSION REQUIRED — operation cannot proceed without submission data.");
|
|
145
|
+
lines.push(`Guard: ${prompt.guard_name ?? prompt.guard_address} (${prompt.guard_address})`);
|
|
146
|
+
lines.push(`Operation: ${prompt.operation}`);
|
|
147
|
+
lines.push("");
|
|
148
|
+
lines.push("Required fields (fill these in the submission):");
|
|
149
|
+
for (const f of prompt.required_fields) {
|
|
150
|
+
lines.push(` [${f.identifier}] ${f.name} (${f.value_type}) — ${f.description}`);
|
|
151
|
+
if (f.suggested_value) {
|
|
152
|
+
lines.push(` Suggested: ${f.suggested_value} (${f.suggestion_reason})`);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
lines.push(` No suggestion — derive value from context or ask user.`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
lines.push("");
|
|
159
|
+
lines.push("Fill example (use in the next call with submission):");
|
|
160
|
+
lines.push(prompt.fill_example);
|
|
161
|
+
return lines.join("\n");
|
|
162
|
+
}
|
|
163
|
+
const ValueTypeNames = {
|
|
164
|
+
0: "Bool",
|
|
165
|
+
1: "Address",
|
|
166
|
+
2: "U64",
|
|
167
|
+
3: "String",
|
|
168
|
+
4: "Vec",
|
|
169
|
+
5: "U256",
|
|
170
|
+
6: "Object",
|
|
171
|
+
};
|
|
@@ -740,6 +740,284 @@ export const GUARD_TEMPLATES = [
|
|
|
740
740
|
example_use_case: "Food delivery: if delivery delayed > 30min at node 'delayed' (history count=5), restaurant Treasury auto-compensates $5 to customer with PaymentInfo(for_object=order, for_guard=this, index=5, remark='delayed'). Customer submits Payment via Passport, guard verifies index matches current history count AND remark matches current node name.",
|
|
741
741
|
verifier_constraint_level: "level3_scene_combined",
|
|
742
742
|
},
|
|
743
|
+
{
|
|
744
|
+
id: "tpl_forward_content_subscription_deliver",
|
|
745
|
+
scene_id: "machine_forward_guard",
|
|
746
|
+
name: "Content subscription delivery verification (Substack-style)",
|
|
747
|
+
description: "Forward guard for content subscription delivery flow. Verifies that (1) the order is at the expected pre-delivery node " +
|
|
748
|
+
"(e.g. 'Ordered'), AND (2) the Signer holds the author's permission index on the bound Permission object. " +
|
|
749
|
+
"Prevents unauthorized parties from publishing content on behalf of the author. " +
|
|
750
|
+
"Designed for Substack-style content subscription: Paid → ContentPublished → Completed (success path), " +
|
|
751
|
+
"with Cancelled and Disputed branches using separate guards (tpl_forward_content_subscription_cancel, " +
|
|
752
|
+
"tpl_forward_content_subscription_refund).",
|
|
753
|
+
recommended_patterns: ["P06", "P09"],
|
|
754
|
+
parameters: [
|
|
755
|
+
{
|
|
756
|
+
name: "expected_pre_delivery_node",
|
|
757
|
+
type: "string",
|
|
758
|
+
description: "Expected current node name BEFORE delivery (e.g. 'Ordered')",
|
|
759
|
+
required: true,
|
|
760
|
+
default: "Ordered",
|
|
761
|
+
constraint: "Must exactly match the name defined in Machine nodes (case-sensitive). This is the node from which the 'Deliver' forward advances.",
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
name: "permission_object",
|
|
765
|
+
type: "address",
|
|
766
|
+
description: "Permission object address bound to the Machine (author role lives here)",
|
|
767
|
+
required: true,
|
|
768
|
+
constraint: "Must be the same Permission object bound to the Machine. Use name (not address) if Permission is not yet created.",
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
name: "author_permission_index",
|
|
772
|
+
type: "number",
|
|
773
|
+
description: "Permission index reserved for the author role (who can publish content)",
|
|
774
|
+
required: true,
|
|
775
|
+
default: "1000",
|
|
776
|
+
constraint: "Must match the index configured in the Permission object. Substack convention: 1000=author, 1500=arbitrator, reader uses namedOperator='' (no specific operator).",
|
|
777
|
+
},
|
|
778
|
+
],
|
|
779
|
+
example_table: [
|
|
780
|
+
{
|
|
781
|
+
identifier: 0,
|
|
782
|
+
b_submission: true,
|
|
783
|
+
value_type: "Address",
|
|
784
|
+
object_type: "Order",
|
|
785
|
+
name: "Order object address (submitted by verifier at runtime)",
|
|
786
|
+
binding_constraint: "Must be an Order belonging to the bound Service; progress.current must match expected_pre_delivery_node",
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
identifier: 1,
|
|
790
|
+
b_submission: false,
|
|
791
|
+
value_type: "String",
|
|
792
|
+
value: "${expected_pre_delivery_node}",
|
|
793
|
+
name: "Expected pre-delivery node name (e.g. 'Ordered')",
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
identifier: 2,
|
|
797
|
+
b_submission: false,
|
|
798
|
+
value_type: "Address",
|
|
799
|
+
value: "${permission_object}",
|
|
800
|
+
name: "Permission object address (bound to Machine, holds author role)",
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
identifier: 3,
|
|
804
|
+
b_submission: false,
|
|
805
|
+
value_type: "U64",
|
|
806
|
+
value: "${author_permission_index}",
|
|
807
|
+
name: "Author permission index (e.g. 1000)",
|
|
808
|
+
},
|
|
809
|
+
],
|
|
810
|
+
example_root: {
|
|
811
|
+
type: "logic_and",
|
|
812
|
+
nodes: [
|
|
813
|
+
{
|
|
814
|
+
type: "logic_string_nocase_equal",
|
|
815
|
+
nodes: [
|
|
816
|
+
{ type: "query", query: "progress.current", object: { identifier: 0, convert_witness: "OrderProgress" }, parameters: [] },
|
|
817
|
+
{ type: "identifier", identifier: 1 },
|
|
818
|
+
],
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
type: "logic_equal",
|
|
822
|
+
nodes: [
|
|
823
|
+
{ type: "context", context: "Signer" },
|
|
824
|
+
{
|
|
825
|
+
type: "query",
|
|
826
|
+
query: "permission.permitted",
|
|
827
|
+
object: { identifier: 2 },
|
|
828
|
+
parameters: [{ type: "context", context: "Signer" }, { type: "identifier", identifier: 3 }],
|
|
829
|
+
},
|
|
830
|
+
],
|
|
831
|
+
},
|
|
832
|
+
],
|
|
833
|
+
},
|
|
834
|
+
applicable_industries: ["subscription", "content", "newsletter", "media"],
|
|
835
|
+
relevant_risks: ["R-C2-01", "R-C2-03", "R-X1-08"],
|
|
836
|
+
creation_notes: [
|
|
837
|
+
"VERIFIED QUERY NAMES: progress.current (id 1253, String) — current node name; permission.permitted (Permission object query, returns Address of permitted operator for the given index)",
|
|
838
|
+
"SUBSTACK DEPLOYMENT: this guard was used in Substack v2 Service. Original v1 Service was published without arbitrations — had to be recreated as v2 with arbitrations bound BEFORE publish (F-S-21).",
|
|
839
|
+
"AUTHOR ROLE: permission index 1000 = author (publish + cancel). namedOperator='' for reader role (open — any subscriber). Arbitrator uses index 1500.",
|
|
840
|
+
"FORWARD DESIGN: 'Deliver' forward advances from 'Ordered' → 'ContentPublished'. Threshold=1, weight=1, permissionIndex=1000 (author only).",
|
|
841
|
+
"GUARD-FIRST-WINS: when 'Ordered' has competing forwards (Deliver|Cancel|Dispute), each with its own guard, the first guard to verify wins. Subscribers cannot double-claim by triggering multiple forwards.",
|
|
842
|
+
"IMMUTABILITY: Forward.guard cannot be modified after Machine publish. Verify all 3 guards (deliver/cancel/refund) are correctly bound BEFORE publishing the Machine.",
|
|
843
|
+
"CIRCULAR REF: if Permission is not yet created, use its name (not address) in value field — Guard resolves names at evaluation time, not at creation time.",
|
|
844
|
+
],
|
|
845
|
+
example_use_case: "Substack newsletter: subscriber pays $5/month. Author publishes content → 'Deliver' forward advances Ordered→ContentPublished. " +
|
|
846
|
+
"This guard verifies (1) order is at 'Ordered' node (not already delivered), AND (2) Signer holds permission index 1000 on author's Permission object. " +
|
|
847
|
+
"Prevents a malicious party from publishing fake content. Subscriber cannot trigger 'Deliver' (lacks permission).",
|
|
848
|
+
verifier_constraint_level: "level2_identity_set",
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
id: "tpl_forward_content_subscription_cancel",
|
|
852
|
+
scene_id: "machine_forward_guard",
|
|
853
|
+
name: "Content subscription cancel verification (Substack-style)",
|
|
854
|
+
description: "Forward guard for content subscription cancel flow. Verifies that (1) the order is at the expected pre-cancel node " +
|
|
855
|
+
"(e.g. 'Ordered'), AND (2) the Signer is the order owner (subscriber). Allows subscriber to cancel within grace period " +
|
|
856
|
+
"for full refund. Designed for Substack-style: Paid → Cancelled (terminal-cancel), with refund via Allocation template.",
|
|
857
|
+
recommended_patterns: ["P06", "P09"],
|
|
858
|
+
parameters: [
|
|
859
|
+
{
|
|
860
|
+
name: "expected_pre_cancel_node",
|
|
861
|
+
type: "string",
|
|
862
|
+
description: "Expected current node name BEFORE cancel (e.g. 'Ordered')",
|
|
863
|
+
required: true,
|
|
864
|
+
default: "Ordered",
|
|
865
|
+
constraint: "Must exactly match the name defined in Machine nodes (case-sensitive).",
|
|
866
|
+
},
|
|
867
|
+
],
|
|
868
|
+
example_table: [
|
|
869
|
+
{
|
|
870
|
+
identifier: 0,
|
|
871
|
+
b_submission: true,
|
|
872
|
+
value_type: "Address",
|
|
873
|
+
object_type: "Order",
|
|
874
|
+
name: "Order object address (submitted by verifier at runtime)",
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
identifier: 1,
|
|
878
|
+
b_submission: false,
|
|
879
|
+
value_type: "String",
|
|
880
|
+
value: "${expected_pre_cancel_node}",
|
|
881
|
+
name: "Expected pre-cancel node name (e.g. 'Ordered')",
|
|
882
|
+
},
|
|
883
|
+
],
|
|
884
|
+
example_root: {
|
|
885
|
+
type: "logic_and",
|
|
886
|
+
nodes: [
|
|
887
|
+
{
|
|
888
|
+
type: "logic_string_nocase_equal",
|
|
889
|
+
nodes: [
|
|
890
|
+
{ type: "query", query: "progress.current", object: { identifier: 0, convert_witness: "OrderProgress" }, parameters: [] },
|
|
891
|
+
{ type: "identifier", identifier: 1 },
|
|
892
|
+
],
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
type: "logic_equal",
|
|
896
|
+
nodes: [
|
|
897
|
+
{ type: "context", context: "Signer" },
|
|
898
|
+
{ type: "query", query: "order.owner", object: { identifier: 0 }, parameters: [] },
|
|
899
|
+
],
|
|
900
|
+
},
|
|
901
|
+
],
|
|
902
|
+
},
|
|
903
|
+
applicable_industries: ["subscription", "content", "newsletter", "media"],
|
|
904
|
+
relevant_risks: ["R-C2-01", "R-C2-03"],
|
|
905
|
+
creation_notes: [
|
|
906
|
+
"VERIFIED QUERY NAMES: progress.current (id 1253, String); order.owner (id 1202, Address) — order holder (subscriber).",
|
|
907
|
+
"SUBSCRIBER-ONLY: only the order owner can cancel — prevents third-party griefing. Author cannot cancel on behalf of subscriber.",
|
|
908
|
+
"GRACE PERIOD: this guard does NOT enforce a time window. If a grace period is needed (e.g. cancel within 24h of payment), add a third condition: context(Clock) <= order.time + grace_period.",
|
|
909
|
+
"REFUND ALLOCATION: pair this guard with an Allocation template that refunds 100% to the subscriber (order.owner). Trigger node = 'Cancelled'.",
|
|
910
|
+
"GUARD-FIRST-WINS: when 'Ordered' has competing forwards (Deliver|Cancel|Dispute), each with its own guard, the first guard to verify wins.",
|
|
911
|
+
],
|
|
912
|
+
example_use_case: "Substack newsletter: subscriber pays $5, then changes mind before content is published. 'Cancel' forward advances Ordered→Cancelled. " +
|
|
913
|
+
"This guard verifies (1) order is at 'Ordered' (not yet delivered), AND (2) Signer is the order owner. " +
|
|
914
|
+
"Author cannot cancel on behalf of subscriber. Refund triggers automatically via Allocation on 'Cancelled' node.",
|
|
915
|
+
verifier_constraint_level: "level2_identity_set",
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
id: "tpl_forward_content_subscription_refund",
|
|
919
|
+
scene_id: "machine_forward_guard",
|
|
920
|
+
name: "Content subscription refund verification (Substack-style, arbitration-triggered)",
|
|
921
|
+
description: "Forward guard for content subscription dispute/refund flow. Verifies that (1) the order is at the expected pre-dispute node " +
|
|
922
|
+
"(e.g. 'Disputed'), AND (2) the Signer holds the arbitrator's permission index on the bound Permission object. " +
|
|
923
|
+
"Only the arbitrator can advance Disputed→Refunded, ensuring dispute resolution is impartial. " +
|
|
924
|
+
"Designed for Substack-style: Paid → Disputed → Refunded (terminal-dispute).",
|
|
925
|
+
recommended_patterns: ["P06", "P09"],
|
|
926
|
+
parameters: [
|
|
927
|
+
{
|
|
928
|
+
name: "expected_pre_refund_node",
|
|
929
|
+
type: "string",
|
|
930
|
+
description: "Expected current node name BEFORE refund (e.g. 'Disputed')",
|
|
931
|
+
required: true,
|
|
932
|
+
default: "Disputed",
|
|
933
|
+
constraint: "Must exactly match the name defined in Machine nodes (case-sensitive).",
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
name: "permission_object",
|
|
937
|
+
type: "address",
|
|
938
|
+
description: "Permission object address bound to the Machine (arbitrator role lives here)",
|
|
939
|
+
required: true,
|
|
940
|
+
constraint: "Must be the same Permission object bound to the Machine. Use name (not address) if Permission is not yet created.",
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
name: "arbitrator_permission_index",
|
|
944
|
+
type: "number",
|
|
945
|
+
description: "Permission index reserved for the arbitrator role (who can resolve disputes)",
|
|
946
|
+
required: true,
|
|
947
|
+
default: "1500",
|
|
948
|
+
constraint: "Must match the index configured in the Permission object. Substack convention: 1000=author, 1500=arbitrator.",
|
|
949
|
+
},
|
|
950
|
+
],
|
|
951
|
+
example_table: [
|
|
952
|
+
{
|
|
953
|
+
identifier: 0,
|
|
954
|
+
b_submission: true,
|
|
955
|
+
value_type: "Address",
|
|
956
|
+
object_type: "Order",
|
|
957
|
+
name: "Order object address (submitted by verifier at runtime)",
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
identifier: 1,
|
|
961
|
+
b_submission: false,
|
|
962
|
+
value_type: "String",
|
|
963
|
+
value: "${expected_pre_refund_node}",
|
|
964
|
+
name: "Expected pre-refund node name (e.g. 'Disputed')",
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
identifier: 2,
|
|
968
|
+
b_submission: false,
|
|
969
|
+
value_type: "Address",
|
|
970
|
+
value: "${permission_object}",
|
|
971
|
+
name: "Permission object address (bound to Machine, holds arbitrator role)",
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
identifier: 3,
|
|
975
|
+
b_submission: false,
|
|
976
|
+
value_type: "U64",
|
|
977
|
+
value: "${arbitrator_permission_index}",
|
|
978
|
+
name: "Arbitrator permission index (e.g. 1500)",
|
|
979
|
+
},
|
|
980
|
+
],
|
|
981
|
+
example_root: {
|
|
982
|
+
type: "logic_and",
|
|
983
|
+
nodes: [
|
|
984
|
+
{
|
|
985
|
+
type: "logic_string_nocase_equal",
|
|
986
|
+
nodes: [
|
|
987
|
+
{ type: "query", query: "progress.current", object: { identifier: 0, convert_witness: "OrderProgress" }, parameters: [] },
|
|
988
|
+
{ type: "identifier", identifier: 1 },
|
|
989
|
+
],
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
type: "logic_equal",
|
|
993
|
+
nodes: [
|
|
994
|
+
{ type: "context", context: "Signer" },
|
|
995
|
+
{
|
|
996
|
+
type: "query",
|
|
997
|
+
query: "permission.permitted",
|
|
998
|
+
object: { identifier: 2 },
|
|
999
|
+
parameters: [{ type: "context", context: "Signer" }, { type: "identifier", identifier: 3 }],
|
|
1000
|
+
},
|
|
1001
|
+
],
|
|
1002
|
+
},
|
|
1003
|
+
],
|
|
1004
|
+
},
|
|
1005
|
+
applicable_industries: ["subscription", "content", "newsletter", "media"],
|
|
1006
|
+
relevant_risks: ["R-C2-01", "R-C2-03", "R-X1-08"],
|
|
1007
|
+
creation_notes: [
|
|
1008
|
+
"VERIFIED QUERY NAMES: progress.current (id 1253, String); permission.permitted (Permission object query, returns Address of permitted operator for the given index).",
|
|
1009
|
+
"ARBITRATOR-ONLY: only the arbitrator (permission index 1500) can advance Disputed→Refunded. Neither author nor subscriber can self-resolve.",
|
|
1010
|
+
"ARBITRATIONS BINDING: Service MUST have arbitrations bound BEFORE publish (F-S-21 — post-publish immutable). ConfirmGate C-S-19 + QS11 will warn if publish is attempted without arbitrations.",
|
|
1011
|
+
"DISPUTE ENTRY: 'Dispute' forward (Ordered→Disputed) is triggered by subscriber (order.owner). After Disputed, only arbitrator can resolve.",
|
|
1012
|
+
"REFUND ALLOCATION: pair this guard with an Allocation template that refunds 100% to the subscriber (order.owner). Trigger node = 'Refunded'.",
|
|
1013
|
+
"GUARD-FIRST-WINS: when 'Disputed' has competing forwards (Resolve-Refund|Resolve-Reject), each with its own guard. First guard to verify wins.",
|
|
1014
|
+
],
|
|
1015
|
+
example_use_case: "Substack newsletter: subscriber disputes content quality. Subscriber triggers 'Dispute' forward (Ordered→Disputed). " +
|
|
1016
|
+
"Arbitrator reviews evidence and triggers 'Resolve-Refund' forward (Disputed→Refunded). " +
|
|
1017
|
+
"This guard verifies (1) order is at 'Disputed' (dispute properly opened), AND (2) Signer holds arbitrator permission index 1500. " +
|
|
1018
|
+
"Author cannot self-resolve. Subscriber cannot self-refund.",
|
|
1019
|
+
verifier_constraint_level: "level2_identity_set",
|
|
1020
|
+
},
|
|
743
1021
|
];
|
|
744
1022
|
export function getTemplatesByScene(sceneId) {
|
|
745
1023
|
return GUARD_TEMPLATES.filter((t) => t.scene_id === sceneId);
|
|
@@ -284,7 +284,7 @@ export function inferSceneFromFlow(description) {
|
|
|
284
284
|
if (lower.includes("wonder") || lower.includes("praise") || lower.includes("complain")
|
|
285
285
|
|| lower.includes("thumbs_up") || lower.includes("thumbs_down")
|
|
286
286
|
|| lower.includes("rating") || lower.includes("feedback")
|
|
287
|
-
|| lower.includes("
|
|
287
|
+
|| lower.includes("praise") || lower.includes("complaint")) {
|
|
288
288
|
return findScene("wonder_feedback");
|
|
289
289
|
}
|
|
290
290
|
if (lower.includes("reward") || lower.includes("incentive")) {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface MachineNodeForRender {
|
|
2
|
+
name: string;
|
|
3
|
+
description?: string | null;
|
|
4
|
+
}
|
|
5
|
+
export interface MachineForwardForRender {
|
|
6
|
+
name: string;
|
|
7
|
+
weight: number;
|
|
8
|
+
named_operator?: string | null;
|
|
9
|
+
permission_index?: number | null;
|
|
10
|
+
guard?: string | null;
|
|
11
|
+
retained_submission?: number[] | string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface MachineEdgeForRender {
|
|
14
|
+
from: string;
|
|
15
|
+
to: string;
|
|
16
|
+
threshold: number;
|
|
17
|
+
forwards: MachineForwardForRender[];
|
|
18
|
+
}
|
|
19
|
+
export interface MachineRenderInput {
|
|
20
|
+
nodes: MachineNodeForRender[];
|
|
21
|
+
edges: MachineEdgeForRender[];
|
|
22
|
+
machineName?: string | null;
|
|
23
|
+
machineAddress?: string | null;
|
|
24
|
+
published?: boolean | null;
|
|
25
|
+
paused?: boolean | null;
|
|
26
|
+
}
|
|
27
|
+
export declare function sanitizeMermaidNodeId(name: string): string;
|
|
28
|
+
export declare function renderMachineMermaid(nodes: MachineNodeForRender[], edges: MachineEdgeForRender[], options?: {
|
|
29
|
+
colored?: boolean;
|
|
30
|
+
}): string;
|
|
31
|
+
export declare function renderMachineTreeIndented(input: MachineRenderInput): string;
|
|
32
|
+
export declare function parseMachineTreeIndented(text: string): {
|
|
33
|
+
success: boolean;
|
|
34
|
+
data?: {
|
|
35
|
+
nodes: MachineNodeForRender[];
|
|
36
|
+
edges: MachineEdgeForRender[];
|
|
37
|
+
};
|
|
38
|
+
errors: string[];
|
|
39
|
+
};
|
|
40
|
+
export declare function renderMachineAscii(input: MachineRenderInput): string;
|
|
41
|
+
export declare function renderMachineMarkmap(input: MachineRenderInput): string;
|