@wowok/agent-mcp 2.3.16 → 2.4.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/dist/customer/index.d.ts +9 -0
- package/dist/customer/index.js +9 -0
- package/dist/customer/industry-risks.d.ts +4 -0
- package/dist/customer/industry-risks.js +45 -31
- package/dist/customer/order-monitor.js +57 -57
- package/dist/customer/order-strategy.js +89 -89
- package/dist/customer/post-purchase.js +97 -97
- package/dist/customer/reminder-system.js +26 -26
- package/dist/customer/risk-assessment.js +46 -46
- package/dist/customer/types.d.ts +4 -4
- package/dist/customer/types.js +4 -4
- package/dist/customer/user-preferences.d.ts +3 -0
- package/dist/customer/user-preferences.js +59 -50
- package/dist/experience/intent-distill.js +6 -6
- package/dist/experience/realtime-feedback.js +17 -0
- package/dist/index.js +360 -273
- package/dist/knowledge/acquisition-flywheel.d.ts +3 -0
- package/dist/knowledge/acquisition-flywheel.js +73 -64
- package/dist/knowledge/arbitration-trust.js +10 -10
- package/dist/knowledge/demand-matching.js +8 -8
- package/dist/knowledge/dynamic-pricing.js +18 -18
- package/dist/knowledge/flywheel-loop.js +11 -11
- package/dist/knowledge/glossary.js +22 -22
- package/dist/knowledge/guard-ledger.d.ts +19 -0
- package/dist/knowledge/guard-ledger.js +246 -0
- package/dist/knowledge/guard-lint.d.ts +76 -0
- package/dist/knowledge/guard-lint.js +590 -0
- package/dist/knowledge/guard-puzzle.d.ts +188 -0
- package/dist/knowledge/guard-puzzle.js +804 -0
- package/dist/knowledge/guard-risk.d.ts +67 -0
- package/dist/knowledge/guard-risk.js +1046 -0
- package/dist/knowledge/guard-templates.d.ts +37 -0
- package/dist/knowledge/guard-templates.js +329 -0
- package/dist/knowledge/guard-translation.d.ts +58 -0
- package/dist/knowledge/guard-translation.js +1118 -0
- package/dist/knowledge/index.d.ts +17 -0
- package/dist/knowledge/index.js +17 -0
- package/dist/knowledge/industry-evolution.js +29 -29
- package/dist/knowledge/industry-generalizer.js +52 -52
- package/dist/knowledge/industry-registry.d.ts +1 -2
- package/dist/knowledge/industry-registry.js +43 -36
- package/dist/knowledge/intent-metrics.js +67 -67
- package/dist/knowledge/process-model.js +80 -80
- package/dist/knowledge/reputation-rules.js +9 -9
- package/dist/knowledge/reward-templates.js +51 -51
- package/dist/knowledge/safety-rules.js +63 -2
- package/dist/knowledge/tool-constraints.js +17 -11
- package/dist/knowledge/trust-metrics.js +26 -26
- package/dist/safety/confirm-gate.d.ts +4 -2
- package/dist/safety/confirm-gate.js +48 -4
- package/dist/schema/call/allocation.d.ts +24 -14
- package/dist/schema/call/arbitration.d.ts +142 -132
- package/dist/schema/call/base.d.ts +901 -43
- package/dist/schema/call/base.js +77 -13
- package/dist/schema/call/bridge-handler.js +15 -2
- package/dist/schema/call/bridge.d.ts +795 -27
- package/dist/schema/call/bridge.js +37 -0
- package/dist/schema/call/contact.d.ts +10 -0
- package/dist/schema/call/demand.d.ts +94 -84
- package/dist/schema/call/guard.d.ts +229 -46
- package/dist/schema/call/guard.js +50 -0
- package/dist/schema/call/handler.js +46 -14
- package/dist/schema/call/machine.d.ts +158 -138
- package/dist/schema/call/order.d.ts +10 -0
- package/dist/schema/call/payment.d.ts +10 -0
- package/dist/schema/call/permission.d.ts +314 -304
- package/dist/schema/call/personal.d.ts +10 -0
- package/dist/schema/call/progress.d.ts +10 -0
- package/dist/schema/call/proof.d.ts +20 -0
- package/dist/schema/call/repository.d.ts +32 -22
- package/dist/schema/call/reward.d.ts +10 -0
- package/dist/schema/call/semantic.d.ts +9 -2
- package/dist/schema/call/semantic.js +617 -25
- package/dist/schema/call/service.d.ts +20 -10
- package/dist/schema/call/treasury.d.ts +10 -0
- package/dist/schema/config/index.d.ts +18 -0
- package/dist/schema/config/index.js +17 -0
- package/dist/schema/index.d.ts +6 -0
- package/dist/schema/index.js +5 -0
- package/dist/schema/local/index.d.ts +9 -9
- package/dist/schema/local/index.js +9 -0
- package/dist/schema/local/wip.d.ts +39 -19
- package/dist/schema/local/wip.js +5 -5
- package/dist/schema/messenger/index.d.ts +376 -55
- package/dist/schema/messenger/index.js +19 -19
- package/dist/schema/operations.d.ts +1881 -681
- package/dist/schema/operations.js +91 -96
- package/dist/schema/project/index.d.ts +21 -0
- package/dist/schema/project/index.js +32 -0
- package/dist/schema/query/index.d.ts +1074 -168
- package/dist/schema/query/index.js +8 -8
- package/dist/schema/schema-query/index.d.ts +33 -0
- package/dist/schema/schema-query/index.js +36 -0
- package/dist/schema/schema-version.d.ts +25 -0
- package/dist/schema/schema-version.js +76 -0
- package/dist/schema/trust/index.d.ts +407 -0
- package/dist/schema/trust/index.js +113 -0
- package/dist/schema/utils/guard-parser.js +4 -4
- package/dist/schema/utils/node-parser.js +14 -14
- package/dist/schemas/bridge_operation.output.json +233 -9
- package/dist/schemas/bridge_operation.schema.json +67 -8
- package/dist/schemas/config_operation.output.json +18 -0
- package/dist/schemas/config_operation.schema.json +34 -0
- package/dist/schemas/guard-node-schema.json +82 -0
- package/dist/schemas/guard2file.schema.json +8 -0
- package/dist/schemas/index.json +19 -1
- package/dist/schemas/machineNode2file.schema.json +8 -0
- package/dist/schemas/messenger_operation.output.json +236 -10
- package/dist/schemas/onchain_events.output.json +718 -0
- package/dist/schemas/onchain_operations.output.json +286 -11
- package/dist/schemas/onchain_operations.schema.json +19 -16
- package/dist/schemas/onchain_operations_allocation.schema.json +8 -0
- package/dist/schemas/onchain_operations_arbitration.schema.json +8 -0
- package/dist/schemas/onchain_operations_contact.schema.json +8 -0
- package/dist/schemas/onchain_operations_demand.schema.json +8 -0
- package/dist/schemas/onchain_operations_gen_passport.schema.json +16 -0
- package/dist/schemas/onchain_operations_guard.schema.json +11 -16
- package/dist/schemas/onchain_operations_machine.schema.json +8 -0
- package/dist/schemas/onchain_operations_order.schema.json +8 -0
- package/dist/schemas/onchain_operations_payment.schema.json +8 -0
- package/dist/schemas/onchain_operations_permission.schema.json +8 -0
- package/dist/schemas/onchain_operations_personal.schema.json +8 -0
- package/dist/schemas/onchain_operations_progress.schema.json +8 -0
- package/dist/schemas/onchain_operations_repository.schema.json +8 -0
- package/dist/schemas/onchain_operations_reward.schema.json +8 -0
- package/dist/schemas/onchain_operations_service.schema.json +8 -0
- package/dist/schemas/onchain_operations_treasury.schema.json +8 -0
- package/dist/schemas/onchain_table_data.output.json +718 -0
- package/dist/schemas/project_operation.output.json +18 -0
- package/dist/schemas/project_operation.schema.json +42 -0
- package/dist/schemas/query_toolkit.schema.json +360 -368
- package/dist/schemas/schema_query.schema.json +6 -3
- package/dist/schemas/trust_score.output.json +327 -0
- package/dist/schemas/trust_score.schema.json +46 -0
- package/dist/schemas/wip_file.output.json +24 -1
- package/package.json +2 -2
|
@@ -15,6 +15,12 @@ import { DEFAULT_TRAITS, inferTraitsFromDescription, synthesizeProfile, findSimi
|
|
|
15
15
|
import { INDUSTRY_EVOLUTION_THRESHOLDS, aggregateIndustryMetrics, evaluateIndustryHealth, suggestIndustryUpdate, applyIndustryUpdate, runIndustryHealthPipeline, type IndustryMetrics, type OrderRawDataPoint, type IndustryHealthReport, type TraitDrift, type IndustryUpdateSuggestion } from "./industry-evolution.js";
|
|
16
16
|
import { FLYWHEEL_LOOP_VERSION, FLYWHEEL_LOOP_MIN_SIGNALS, EVOLUTION_STATE_VERSION, recordIndustrySignal, updateIndustryCognition, injectEvolutionContext, getIndustryEvolutionStatus, getIndustrySignalCount, getIndustrySignals, listIndustriesWithSignals, getPendingSuggestions, recordDecisionContext, queryDecisionsByIndustry, queryDecisionsByNode, backfillDecisionOutcome, setEvolutionSchedule, getEvolutionSchedule, setIndustryIntent, getIndustryIntent, saveEvolutionState, loadEvolutionState, hasPersistedEvolutionState, type IndustrySignal, type DecisionContext, type CognitionUpdateResult, type EvolutionContext, type IndustryEvolutionStatus, type EvolutionScheduleConfig, type EvolutionScheduleMode } from "./flywheel-loop.js";
|
|
17
17
|
import { BUILTIN_INTENT_SPECS, registerIntentProfile, getIntentProfile, listIntents, evaluateIndustryHealthByIntent, suggestIndustryUpdateByIntent, evaluateIndustryHealthMultiIntent, getRoleAdvice, filterSuggestionsByRole, type BusinessIntent, type MetricDimension, type IntentMetricSpec, type IntentSuggestionTrigger, type AdviceRole } from "./intent-metrics.js";
|
|
18
|
+
import { GUARD_SCENES, findScene, inferSceneFromAction, getImmutableScenes, getNumericIdentifierScenes, type GuardScene } from "./guard-ledger.js";
|
|
19
|
+
import { SEMANTIC_TO_SCHEMA_RULES, SCHEMA_TO_SEMANTIC_RULES, GUARD_CONSTRAINT_RULES, matchSemanticPattern, explainNode, explainWitness, getConstraintsByCategory, type SemanticToSchemaRule, type SchemaToSemanticRule, type GuardConstraintRule } from "./guard-translation.js";
|
|
20
|
+
import { checkPuzzleCompleteness, generateConfirmationText, initPuzzleFromIntent, inferBindingFromAction, emptyDataSources, getWitnessInfo, WITNESS_NAME_MAP, type GuardPuzzle, type IntentPuzzle, type BindingPuzzle, type DataSourcePuzzle, type OnChainConstantEntry, type WitnessDerivedEntry, type SubmittedObjectEntry, type SubmittedValueEntry, type SystemContextEntry, type QueryPuzzle, type LogicNodePuzzle, type ConstraintChecklist, type PuzzleCompleteness, type PuzzleDimension } from "./guard-puzzle.js";
|
|
21
|
+
import { assessGuardRisks, assessGuardRisksForOperation, getRiskSummary, getRiskRulesByDataSourceClass, getAllRiskRules, getRiskRulesCount, type GuardRisk, type GuardRiskAssessment, type GuardStakeholder, type RiskLevel, type RiskCategory, type DataSourceClass, type RiskRule } from "./guard-risk.js";
|
|
22
|
+
import { GUARD_TEMPLATES, GUARD_TEMPLATES_VERSION, GUARD_TEMPLATES_COUNT, getTemplatesByScene, getTemplateById, getTemplatesByIndustry, getTemplatesByPattern, listGuardTemplates, suggestTemplateForScene, getTemplateParameters, validateTemplateParams, type GuardTemplate, type GuardTemplateParam, type TemplateParamType } from "./guard-templates.js";
|
|
23
|
+
import { lintGuard, autoFixGuard, isGuardReady, getGuardErrors, formatLintResult, type GuardJsonInput, type GuardLintResult, type GuardDiagnostic, type DiagnosticSeverity, type DiagnosticSource, type AutoFixAction } from "./guard-lint.js";
|
|
18
24
|
export { CONCEPT_GLOSSARY, CONCEPT_GLOSSARY_VERSION, resolveTerm, lookupEntry, validateText, auditSchemaFields, type GlossaryEntry, type GlossaryCategory, type GlossaryDrift, };
|
|
19
25
|
export { CONFIRMATION_RULES, SAFETY_RULES_VERSION, type ConfirmationRule, type OperationPreview, type ConfirmLevel, };
|
|
20
26
|
export { TOOL_CONSTRAINTS, TOOL_CONSTRAINTS_VERSION, validateOperation, hasBlockingViolations, getWarningViolations, type ConstraintSeverity, type FieldConstraint, type OperationConstraint, type ConstraintViolation, };
|
|
@@ -32,6 +38,10 @@ export { DEFAULT_TRAITS, inferTraitsFromDescription, synthesizeProfile, findSimi
|
|
|
32
38
|
export { INDUSTRY_EVOLUTION_THRESHOLDS, aggregateIndustryMetrics, evaluateIndustryHealth, suggestIndustryUpdate, applyIndustryUpdate, runIndustryHealthPipeline, type IndustryMetrics, type OrderRawDataPoint, type IndustryHealthReport, type TraitDrift, type IndustryUpdateSuggestion, };
|
|
33
39
|
export { FLYWHEEL_LOOP_VERSION, FLYWHEEL_LOOP_MIN_SIGNALS, EVOLUTION_STATE_VERSION, recordIndustrySignal, updateIndustryCognition, injectEvolutionContext, getIndustryEvolutionStatus, getIndustrySignalCount, getIndustrySignals, listIndustriesWithSignals, getPendingSuggestions, recordDecisionContext, queryDecisionsByIndustry, queryDecisionsByNode, backfillDecisionOutcome, setEvolutionSchedule, getEvolutionSchedule, setIndustryIntent, getIndustryIntent, saveEvolutionState, loadEvolutionState, hasPersistedEvolutionState, type IndustrySignal, type DecisionContext, type CognitionUpdateResult, type EvolutionContext, type IndustryEvolutionStatus, type EvolutionScheduleConfig, type EvolutionScheduleMode, };
|
|
34
40
|
export { BUILTIN_INTENT_SPECS, registerIntentProfile, getIntentProfile, listIntents, evaluateIndustryHealthByIntent, suggestIndustryUpdateByIntent, evaluateIndustryHealthMultiIntent, getRoleAdvice, filterSuggestionsByRole, type BusinessIntent, type MetricDimension, type IntentMetricSpec, type IntentSuggestionTrigger, type AdviceRole, };
|
|
41
|
+
export { GUARD_SCENES, findScene, inferSceneFromAction, getImmutableScenes, getNumericIdentifierScenes, type GuardScene, };
|
|
42
|
+
export { SEMANTIC_TO_SCHEMA_RULES, SCHEMA_TO_SEMANTIC_RULES, GUARD_CONSTRAINT_RULES, matchSemanticPattern, explainNode, explainWitness, getConstraintsByCategory, type SemanticToSchemaRule, type SchemaToSemanticRule, type GuardConstraintRule, };
|
|
43
|
+
export { checkPuzzleCompleteness, generateConfirmationText, initPuzzleFromIntent, inferBindingFromAction, emptyDataSources, getWitnessInfo, WITNESS_NAME_MAP, type GuardPuzzle, type IntentPuzzle, type BindingPuzzle, type DataSourcePuzzle, type OnChainConstantEntry, type WitnessDerivedEntry, type SubmittedObjectEntry, type SubmittedValueEntry, type SystemContextEntry, type QueryPuzzle, type LogicNodePuzzle, type ConstraintChecklist, type PuzzleCompleteness, type PuzzleDimension, };
|
|
44
|
+
export { assessGuardRisks, assessGuardRisksForOperation, getRiskSummary, getRiskRulesByDataSourceClass, getAllRiskRules, getRiskRulesCount, type GuardRisk, type GuardRiskAssessment, type GuardStakeholder, type RiskLevel, type RiskCategory, type DataSourceClass, type RiskRule, GUARD_TEMPLATES, GUARD_TEMPLATES_VERSION, GUARD_TEMPLATES_COUNT, getTemplatesByScene, getTemplateById, getTemplatesByIndustry, getTemplatesByPattern, listGuardTemplates, suggestTemplateForScene, getTemplateParameters, validateTemplateParams, type GuardTemplate, type GuardTemplateParam, type TemplateParamType, lintGuard, autoFixGuard, isGuardReady, getGuardErrors, formatLintResult, type GuardJsonInput, type GuardLintResult, type GuardDiagnostic, type DiagnosticSeverity, type DiagnosticSource, type AutoFixAction, };
|
|
35
45
|
export declare function getKnowledgeBase(): {
|
|
36
46
|
version: {
|
|
37
47
|
glossary: number;
|
|
@@ -61,4 +71,11 @@ export declare function getKnowledgeBase(): {
|
|
|
61
71
|
industry_flywheels_count: number;
|
|
62
72
|
industry_registry_count: number;
|
|
63
73
|
intent_count: number;
|
|
74
|
+
guard_scenes_count: number;
|
|
75
|
+
guard_semantic_rules_count: number;
|
|
76
|
+
guard_schema_rules_count: number;
|
|
77
|
+
guard_constraint_rules_count: number;
|
|
78
|
+
guard_risk_rules_count: number;
|
|
79
|
+
guard_templates_count: number;
|
|
80
|
+
guard_lint_enabled: boolean;
|
|
64
81
|
};
|
package/dist/knowledge/index.js
CHANGED
|
@@ -15,6 +15,12 @@ import { DEFAULT_TRAITS, inferTraitsFromDescription, synthesizeProfile, findSimi
|
|
|
15
15
|
import { INDUSTRY_EVOLUTION_THRESHOLDS, aggregateIndustryMetrics, evaluateIndustryHealth, suggestIndustryUpdate, applyIndustryUpdate, runIndustryHealthPipeline, } from "./industry-evolution.js";
|
|
16
16
|
import { FLYWHEEL_LOOP_VERSION, FLYWHEEL_LOOP_MIN_SIGNALS, EVOLUTION_STATE_VERSION, recordIndustrySignal, updateIndustryCognition, injectEvolutionContext, getIndustryEvolutionStatus, getIndustrySignalCount, getIndustrySignals, listIndustriesWithSignals, getPendingSuggestions, recordDecisionContext, queryDecisionsByIndustry, queryDecisionsByNode, backfillDecisionOutcome, setEvolutionSchedule, getEvolutionSchedule, setIndustryIntent, getIndustryIntent, saveEvolutionState, loadEvolutionState, hasPersistedEvolutionState, } from "./flywheel-loop.js";
|
|
17
17
|
import { BUILTIN_INTENT_SPECS, registerIntentProfile, getIntentProfile, listIntents, evaluateIndustryHealthByIntent, suggestIndustryUpdateByIntent, evaluateIndustryHealthMultiIntent, getRoleAdvice, filterSuggestionsByRole, } from "./intent-metrics.js";
|
|
18
|
+
import { GUARD_SCENES, findScene, inferSceneFromAction, getImmutableScenes, getNumericIdentifierScenes, } from "./guard-ledger.js";
|
|
19
|
+
import { SEMANTIC_TO_SCHEMA_RULES, SCHEMA_TO_SEMANTIC_RULES, GUARD_CONSTRAINT_RULES, matchSemanticPattern, explainNode, explainWitness, getConstraintsByCategory, } from "./guard-translation.js";
|
|
20
|
+
import { checkPuzzleCompleteness, generateConfirmationText, initPuzzleFromIntent, inferBindingFromAction, emptyDataSources, getWitnessInfo, WITNESS_NAME_MAP, } from "./guard-puzzle.js";
|
|
21
|
+
import { assessGuardRisks, assessGuardRisksForOperation, getRiskSummary, getRiskRulesByDataSourceClass, getAllRiskRules, getRiskRulesCount, } from "./guard-risk.js";
|
|
22
|
+
import { GUARD_TEMPLATES, GUARD_TEMPLATES_VERSION, GUARD_TEMPLATES_COUNT, getTemplatesByScene, getTemplateById, getTemplatesByIndustry, getTemplatesByPattern, listGuardTemplates, suggestTemplateForScene, getTemplateParameters, validateTemplateParams, } from "./guard-templates.js";
|
|
23
|
+
import { lintGuard, autoFixGuard, isGuardReady, getGuardErrors, formatLintResult, } from "./guard-lint.js";
|
|
18
24
|
export { CONCEPT_GLOSSARY, CONCEPT_GLOSSARY_VERSION, resolveTerm, lookupEntry, validateText, auditSchemaFields, };
|
|
19
25
|
export { CONFIRMATION_RULES, SAFETY_RULES_VERSION, };
|
|
20
26
|
export { TOOL_CONSTRAINTS, TOOL_CONSTRAINTS_VERSION, validateOperation, hasBlockingViolations, getWarningViolations, };
|
|
@@ -32,6 +38,10 @@ export { DEFAULT_TRAITS, inferTraitsFromDescription, synthesizeProfile, findSimi
|
|
|
32
38
|
export { INDUSTRY_EVOLUTION_THRESHOLDS, aggregateIndustryMetrics, evaluateIndustryHealth, suggestIndustryUpdate, applyIndustryUpdate, runIndustryHealthPipeline, };
|
|
33
39
|
export { FLYWHEEL_LOOP_VERSION, FLYWHEEL_LOOP_MIN_SIGNALS, EVOLUTION_STATE_VERSION, recordIndustrySignal, updateIndustryCognition, injectEvolutionContext, getIndustryEvolutionStatus, getIndustrySignalCount, getIndustrySignals, listIndustriesWithSignals, getPendingSuggestions, recordDecisionContext, queryDecisionsByIndustry, queryDecisionsByNode, backfillDecisionOutcome, setEvolutionSchedule, getEvolutionSchedule, setIndustryIntent, getIndustryIntent, saveEvolutionState, loadEvolutionState, hasPersistedEvolutionState, };
|
|
34
40
|
export { BUILTIN_INTENT_SPECS, registerIntentProfile, getIntentProfile, listIntents, evaluateIndustryHealthByIntent, suggestIndustryUpdateByIntent, evaluateIndustryHealthMultiIntent, getRoleAdvice, filterSuggestionsByRole, };
|
|
41
|
+
export { GUARD_SCENES, findScene, inferSceneFromAction, getImmutableScenes, getNumericIdentifierScenes, };
|
|
42
|
+
export { SEMANTIC_TO_SCHEMA_RULES, SCHEMA_TO_SEMANTIC_RULES, GUARD_CONSTRAINT_RULES, matchSemanticPattern, explainNode, explainWitness, getConstraintsByCategory, };
|
|
43
|
+
export { checkPuzzleCompleteness, generateConfirmationText, initPuzzleFromIntent, inferBindingFromAction, emptyDataSources, getWitnessInfo, WITNESS_NAME_MAP, };
|
|
44
|
+
export { assessGuardRisks, assessGuardRisksForOperation, getRiskSummary, getRiskRulesByDataSourceClass, getAllRiskRules, getRiskRulesCount, GUARD_TEMPLATES, GUARD_TEMPLATES_VERSION, GUARD_TEMPLATES_COUNT, getTemplatesByScene, getTemplateById, getTemplatesByIndustry, getTemplatesByPattern, listGuardTemplates, suggestTemplateForScene, getTemplateParameters, validateTemplateParams, lintGuard, autoFixGuard, isGuardReady, getGuardErrors, formatLintResult, };
|
|
35
45
|
export function getKnowledgeBase() {
|
|
36
46
|
return {
|
|
37
47
|
version: {
|
|
@@ -62,5 +72,12 @@ export function getKnowledgeBase() {
|
|
|
62
72
|
industry_flywheels_count: INDUSTRY_FLYWHEELS.length,
|
|
63
73
|
industry_registry_count: getRegistrySize(),
|
|
64
74
|
intent_count: listIntents().length,
|
|
75
|
+
guard_scenes_count: GUARD_SCENES.length,
|
|
76
|
+
guard_semantic_rules_count: SEMANTIC_TO_SCHEMA_RULES.length,
|
|
77
|
+
guard_schema_rules_count: SCHEMA_TO_SEMANTIC_RULES.length,
|
|
78
|
+
guard_constraint_rules_count: GUARD_CONSTRAINT_RULES.length,
|
|
79
|
+
guard_risk_rules_count: getRiskRulesCount(),
|
|
80
|
+
guard_templates_count: GUARD_TEMPLATES_COUNT,
|
|
81
|
+
guard_lint_enabled: true,
|
|
65
82
|
};
|
|
66
83
|
}
|
|
@@ -72,19 +72,19 @@ export function aggregateIndustryMetrics(industry, rawData, timeWindowDays = 30)
|
|
|
72
72
|
const refundRate = refundCount / sample_size;
|
|
73
73
|
if (sample_size >= 20) {
|
|
74
74
|
if (milestoneRate(filtered) > 0.4) {
|
|
75
|
-
emerging_patterns.push("
|
|
75
|
+
emerging_patterns.push("Milestone delivery share rising (>=40% of orders use milestone nodes)");
|
|
76
76
|
}
|
|
77
77
|
if (repeatBuyerRate > 0.25) {
|
|
78
|
-
emerging_patterns.push(
|
|
78
|
+
emerging_patterns.push(`Repeat buyer rate rose to ${Math.round(repeatBuyerRate * 100)}%`);
|
|
79
79
|
}
|
|
80
80
|
if (disputeRate > THRESHOLDS.stressed_dispute_rate) {
|
|
81
|
-
anomalies.push(
|
|
81
|
+
anomalies.push(`Dispute rate spiked to ${Math.round(disputeRate * 100)}% (threshold ${THRESHOLDS.stressed_dispute_rate * 100}%)`);
|
|
82
82
|
}
|
|
83
83
|
if (refundRate > 0.2) {
|
|
84
|
-
anomalies.push(
|
|
84
|
+
anomalies.push(`Refund rate spiked to ${Math.round(refundRate * 100)}%`);
|
|
85
85
|
}
|
|
86
86
|
if (avgCycleHours > 24 * 30) {
|
|
87
|
-
anomalies.push(
|
|
87
|
+
anomalies.push(`Average completion cycle too long (${Math.round(avgCycleHours / 24)} days)`);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
return {
|
|
@@ -114,47 +114,47 @@ export function evaluateIndustryHealth(industry, metrics) {
|
|
|
114
114
|
const weaknesses = [];
|
|
115
115
|
const recommendations = [];
|
|
116
116
|
if (metrics.sample_size < THRESHOLDS.min_sample_size) {
|
|
117
|
-
weaknesses.push(
|
|
118
|
-
recommendations.push("
|
|
117
|
+
weaknesses.push(`Insufficient sample size (${metrics.sample_size} < ${THRESHOLDS.min_sample_size}), low evaluation confidence`);
|
|
118
|
+
recommendations.push("Continue accumulating order data to improve evaluation accuracy");
|
|
119
119
|
}
|
|
120
120
|
const completedScore = metrics.completed_rate * 35;
|
|
121
121
|
if (metrics.completed_rate >= THRESHOLDS.thriving_completed_rate) {
|
|
122
|
-
strengths.push(
|
|
122
|
+
strengths.push(`High completion rate (${Math.round(metrics.completed_rate * 100)}%)`);
|
|
123
123
|
}
|
|
124
124
|
else if (metrics.completed_rate < THRESHOLDS.healthy_completed_rate) {
|
|
125
|
-
weaknesses.push(
|
|
126
|
-
recommendations.push("
|
|
125
|
+
weaknesses.push(`Low completion rate (${Math.round(metrics.completed_rate * 100)}%)`);
|
|
126
|
+
recommendations.push("Investigate root cause of incomplete orders; recommend strengthening Messenger communication and milestone acceptance");
|
|
127
127
|
}
|
|
128
128
|
const disputeScore = (1 - Math.min(1, metrics.dispute_rate)) * 25;
|
|
129
129
|
if (metrics.dispute_rate <= THRESHOLDS.thriving_dispute_rate) {
|
|
130
|
-
strengths.push(
|
|
130
|
+
strengths.push(`Low dispute rate (${Math.round(metrics.dispute_rate * 100)}%)`);
|
|
131
131
|
}
|
|
132
132
|
else if (metrics.dispute_rate > THRESHOLDS.stressed_dispute_rate) {
|
|
133
|
-
weaknesses.push(
|
|
134
|
-
recommendations.push("
|
|
133
|
+
weaknesses.push(`High dispute rate (${Math.round(metrics.dispute_rate * 100)}%)`);
|
|
134
|
+
recommendations.push("Dispute rate exceeds threshold; recommend mandatory arbitration + compensation fund + delivery Guard");
|
|
135
135
|
}
|
|
136
136
|
const refundScore = (1 - Math.min(1, metrics.refund_rate)) * 15;
|
|
137
137
|
if (metrics.refund_rate > 0.2) {
|
|
138
|
-
weaknesses.push(
|
|
139
|
-
recommendations.push("
|
|
138
|
+
weaknesses.push(`High refund rate (${Math.round(metrics.refund_rate * 100)}%)`);
|
|
139
|
+
recommendations.push("Abnormal refund rate; recommend checking delivery quality or product description consistency");
|
|
140
140
|
}
|
|
141
141
|
const repeatScore = Math.min(1, metrics.repeat_buyer_rate) * 15;
|
|
142
142
|
if (metrics.repeat_buyer_rate >= THRESHOLDS.thriving_repeat_rate) {
|
|
143
|
-
strengths.push(
|
|
143
|
+
strengths.push(`High repeat buyer rate (${Math.round(metrics.repeat_buyer_rate * 100)}%)`);
|
|
144
144
|
}
|
|
145
145
|
else if (metrics.repeat_buyer_rate < THRESHOLDS.healthy_repeat_rate && metrics.sample_size >= 20) {
|
|
146
|
-
weaknesses.push(
|
|
147
|
-
recommendations.push("
|
|
146
|
+
weaknesses.push(`Low repeat buyer rate (${Math.round(metrics.repeat_buyer_rate * 100)}%)`);
|
|
147
|
+
recommendations.push("Low repeat buyer rate; recommend setting up loyalty Reward + referral cashback flywheel");
|
|
148
148
|
}
|
|
149
149
|
const cycleScore = metrics.avg_cycle_hours > 0
|
|
150
150
|
? Math.max(0, Math.min(10, 10 * (1 - (metrics.avg_cycle_hours / 24 - 7) / 23)))
|
|
151
151
|
: 0;
|
|
152
152
|
if (metrics.avg_cycle_hours > 0 && metrics.avg_cycle_hours <= 24 * 7) {
|
|
153
|
-
strengths.push(
|
|
153
|
+
strengths.push(`Short delivery cycle (${Math.round(metrics.avg_cycle_hours)} hours)`);
|
|
154
154
|
}
|
|
155
155
|
else if (metrics.avg_cycle_hours > 24 * 30) {
|
|
156
|
-
weaknesses.push(
|
|
157
|
-
recommendations.push("
|
|
156
|
+
weaknesses.push(`Delivery cycle too long (${Math.round(metrics.avg_cycle_hours / 24)} days)`);
|
|
157
|
+
recommendations.push("Delivery cycle too long; recommend optimizing Machine node splitting");
|
|
158
158
|
}
|
|
159
159
|
const healthScore = Math.round(completedScore + disputeScore + refundScore + repeatScore + cycleScore);
|
|
160
160
|
let level;
|
|
@@ -208,13 +208,13 @@ export function suggestIndustryUpdate(industry, metrics) {
|
|
|
208
208
|
industry,
|
|
209
209
|
suggestion_type: "add_risk_check",
|
|
210
210
|
field: "risk_checks",
|
|
211
|
-
current_value: "
|
|
211
|
+
current_value: "(no extra check for high-dispute industry)",
|
|
212
212
|
suggested_value: {
|
|
213
213
|
id: `auto_dispute_check_${industry}`,
|
|
214
|
-
description: "
|
|
214
|
+
description: "High-dispute industry: mandatory arbitration + compensation fund",
|
|
215
215
|
weight: 30,
|
|
216
216
|
},
|
|
217
|
-
evidence: `dispute_rate=${(metrics.dispute_rate * 100).toFixed(1)}%
|
|
217
|
+
evidence: `dispute_rate=${(metrics.dispute_rate * 100).toFixed(1)}% exceeds threshold ${THRESHOLDS.healthy_dispute_rate * 100}%`,
|
|
218
218
|
confidence: Math.min(0.95, 0.5 + metrics.dispute_rate),
|
|
219
219
|
priority: metrics.dispute_rate > THRESHOLDS.stressed_dispute_rate ? "high" : "medium",
|
|
220
220
|
});
|
|
@@ -227,7 +227,7 @@ export function suggestIndustryUpdate(industry, metrics) {
|
|
|
227
227
|
field: "preference_template.max_acceptable_cycle",
|
|
228
228
|
current_value: currentCycleDays,
|
|
229
229
|
suggested_value: Math.max(7, Math.floor(currentCycleDays * 0.8)),
|
|
230
|
-
evidence: `completed_rate=${(metrics.completed_rate * 100).toFixed(1)}% < ${THRESHOLDS.healthy_completed_rate * 100}
|
|
230
|
+
evidence: `completed_rate=${(metrics.completed_rate * 100).toFixed(1)}% < ${THRESHOLDS.healthy_completed_rate * 100}%; avg_cycle=${currentCycleDays} days`,
|
|
231
231
|
confidence: 0.7,
|
|
232
232
|
priority: "medium",
|
|
233
233
|
});
|
|
@@ -237,9 +237,9 @@ export function suggestIndustryUpdate(industry, metrics) {
|
|
|
237
237
|
industry,
|
|
238
238
|
suggestion_type: "update_flywheel",
|
|
239
239
|
field: "flywheel.rewardStrategy",
|
|
240
|
-
current_value: "
|
|
241
|
-
suggested_value: "
|
|
242
|
-
evidence: `repeat_buyer_rate=${(metrics.repeat_buyer_rate * 100).toFixed(1)}%
|
|
240
|
+
current_value: "(current Reward strategy)",
|
|
241
|
+
suggested_value: "Strengthen loyalty Reward + tiered repeat-buyer rewards",
|
|
242
|
+
evidence: `repeat_buyer_rate=${(metrics.repeat_buyer_rate * 100).toFixed(1)}% >= ${THRESHOLDS.thriving_repeat_rate * 100}%`,
|
|
243
243
|
confidence: 0.75,
|
|
244
244
|
priority: "low",
|
|
245
245
|
});
|
|
@@ -252,7 +252,7 @@ export function suggestIndustryUpdate(industry, metrics) {
|
|
|
252
252
|
field: `traits.${d.trait}`,
|
|
253
253
|
current_value: d.template_value,
|
|
254
254
|
suggested_value: d.observed_value,
|
|
255
|
-
evidence:
|
|
255
|
+
evidence: `Template assumes ${d.trait}=${d.template_value}, but actual data observed ${d.observed_value} (drift_severity=${d.drift_severity})`,
|
|
256
256
|
confidence: d.drift_severity === "high" ? 0.8 : 0.65,
|
|
257
257
|
priority: d.drift_severity === "high" ? "high" : "medium",
|
|
258
258
|
});
|
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
import { getIndustryProfile, listIndustries, registerIndustry, } from "./industry-registry.js";
|
|
2
2
|
const TRAIT_INFERENCE_RULES = [
|
|
3
|
-
{ keywords: ["
|
|
3
|
+
{ keywords: ["logistics", "shipping", "delivery", "express", "shipment", "delivery", "shipping", "logistics", "ship"],
|
|
4
4
|
trait: "has_logistics", value: true, weight: 0.85 },
|
|
5
|
-
{ keywords: ["
|
|
5
|
+
{ keywords: ["digital", "online", "cloud", "online", "digital", "online", "cloud"],
|
|
6
6
|
trait: "has_logistics", value: false, weight: 0.7 },
|
|
7
|
-
{ keywords: ["
|
|
7
|
+
{ keywords: ["consulting", "communication", "requirement-confirmation", "revision-rounds", "consult", "communication", "negotiate"],
|
|
8
8
|
trait: "communication_heavy", value: true, weight: 0.8 },
|
|
9
|
-
{ keywords: ["
|
|
9
|
+
{ keywords: ["standard-product", "in-stock", "one-click-order", "standard", "instant"],
|
|
10
10
|
trait: "communication_heavy", value: false, weight: 0.7 },
|
|
11
|
-
{ keywords: ["
|
|
11
|
+
{ keywords: ["digital", "file", "code", "design-draft", "electronic", "online", "digital", "file", "online"],
|
|
12
12
|
trait: "pure_digital", value: true, weight: 0.8 },
|
|
13
|
-
{ keywords: ["
|
|
13
|
+
{ keywords: ["physical", "hardware", "equipment", "physical", "hardware", "equipment"],
|
|
14
14
|
trait: "pure_digital", value: false, weight: 0.75 },
|
|
15
|
-
{ keywords: ["
|
|
15
|
+
{ keywords: ["course", "semester", "long-cycle", "long-term", "project-based", "course", "semester", "long-term", "project"],
|
|
16
16
|
trait: "long_cycle", value: true, weight: 0.75 },
|
|
17
|
-
{ keywords: ["
|
|
17
|
+
{ keywords: ["instant", "in-stock", "same-day", "instant", "same-day", "immediate"],
|
|
18
18
|
trait: "long_cycle", value: false, weight: 0.8 },
|
|
19
|
-
{ keywords: ["
|
|
19
|
+
{ keywords: ["rental", "rent", "deposit", "rental", "rent", "deposit", "lease"],
|
|
20
20
|
trait: "deposit_required", value: true, weight: 0.9 },
|
|
21
|
-
{ keywords: ["
|
|
21
|
+
{ keywords: ["purchase", "buyout", "purchase", "buy"],
|
|
22
22
|
trait: "deposit_required", value: false, weight: 0.6 },
|
|
23
|
-
{ keywords: ["
|
|
23
|
+
{ keywords: ["multi-party", "segmented", "multi-stage", "multi-vendor", "itinerary", "multi-party", "segment", "multi-vendor"],
|
|
24
24
|
trait: "multi_tier_allocation", value: true, weight: 0.75 },
|
|
25
|
-
{ keywords: ["
|
|
25
|
+
{ keywords: ["medical", "legal", "financial", "insurance", "pharmaceutical", "medical", "legal", "finance", "insurance", "pharma"],
|
|
26
26
|
trait: "regulatory_intensity", value: "high", weight: 0.9 },
|
|
27
|
-
{ keywords: ["
|
|
27
|
+
{ keywords: ["education", "food", "construction", "education", "food", "construction"],
|
|
28
28
|
trait: "regulatory_intensity", value: "medium", weight: 0.7 },
|
|
29
|
-
{ keywords: ["
|
|
29
|
+
{ keywords: ["entertainment", "gaming", "digital", "entertainment", "game", "digital"],
|
|
30
30
|
trait: "regulatory_intensity", value: "low", weight: 0.6 },
|
|
31
|
-
{ keywords: ["
|
|
31
|
+
{ keywords: ["custom", "high-value", "customized", "custom", "high-value", "bespoke"],
|
|
32
32
|
trait: "trust_sensitivity", value: "high", weight: 0.8 },
|
|
33
|
-
{ keywords: ["
|
|
33
|
+
{ keywords: ["standard-product", "small-ticket", "standard", "low-value"],
|
|
34
34
|
trait: "trust_sensitivity", value: "low", weight: 0.7 },
|
|
35
|
-
{ keywords: ["
|
|
35
|
+
{ keywords: ["subscription", "membership", "recurring", "subscription", "membership", "recurring"],
|
|
36
36
|
trait: "consumption_frequency", value: "frequent", weight: 0.85 },
|
|
37
|
-
{ keywords: ["
|
|
37
|
+
{ keywords: ["course", "semester", "education", "course", "education"],
|
|
38
38
|
trait: "consumption_frequency", value: "one_time", weight: 0.75 },
|
|
39
|
-
{ keywords: ["
|
|
39
|
+
{ keywords: ["daily", "frequent", "common", "daily", "frequent"],
|
|
40
40
|
trait: "consumption_frequency", value: "frequent", weight: 0.75 },
|
|
41
|
-
{ keywords: ["
|
|
41
|
+
{ keywords: ["small-ticket", "daily", "convenience-store", "micro", "small-ticket"],
|
|
42
42
|
trait: "avg_ticket_size", value: "micro", weight: 0.7 },
|
|
43
|
-
{ keywords: ["
|
|
43
|
+
{ keywords: ["retail", "commodity", "standard-product", "retail", "commodity"],
|
|
44
44
|
trait: "avg_ticket_size", value: "small", weight: 0.7 },
|
|
45
|
-
{ keywords: ["
|
|
45
|
+
{ keywords: ["custom", "project", "outsourcing", "custom", "project"],
|
|
46
46
|
trait: "avg_ticket_size", value: "medium", weight: 0.7 },
|
|
47
|
-
{ keywords: ["
|
|
47
|
+
{ keywords: ["real-estate", "automobile", "high-value", "luxury", "realestate", "luxury", "car"],
|
|
48
48
|
trait: "avg_ticket_size", value: "large", weight: 0.85 },
|
|
49
49
|
];
|
|
50
50
|
export const DEFAULT_TRAITS = {
|
|
@@ -128,91 +128,91 @@ const FALLBACK_RISK_CHECK_RULES = [
|
|
|
128
128
|
{
|
|
129
129
|
trait_key: "deposit_required", trait_value: true,
|
|
130
130
|
check: {
|
|
131
|
-
id: "fb_deposit_lock", description: "
|
|
131
|
+
id: "fb_deposit_lock", description: "Deposit lock-period safety (deposit cannot be withdrawn by merchant at any time)",
|
|
132
132
|
weight: 30,
|
|
133
133
|
passed: (p) => p?.fund_safety?.lock_duration_safe ?? false,
|
|
134
|
-
advice: "⚠️
|
|
134
|
+
advice: "⚠️ Lock period unsafe: deposit may be withdrawn at any time; recommend requiring a lock period ≥ 7 days.",
|
|
135
135
|
},
|
|
136
136
|
need: {
|
|
137
137
|
id: "need_deposit_lock", tier: "personalized",
|
|
138
|
-
description: "
|
|
138
|
+
description: "Deposit lock-period safety",
|
|
139
139
|
satisfied: (p) => p?.fund_safety?.lock_duration_safe ?? false,
|
|
140
|
-
advice: "
|
|
140
|
+
advice: "Deposit lock-period unsafe.",
|
|
141
141
|
},
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
trait_key: "has_logistics", trait_value: true,
|
|
145
145
|
check: {
|
|
146
|
-
id: "fb_logistics_track", description: "
|
|
146
|
+
id: "fb_logistics_track", description: "Logistics Guard configuration (shipping/receipt verification)",
|
|
147
147
|
weight: 25,
|
|
148
148
|
passed: (p) => p?.workflow_analysis?.has_milestone_nodes ?? false,
|
|
149
|
-
advice: "⚠️
|
|
149
|
+
advice: "⚠️ No logistics Guard: shipping and receipt status are not verified by a third party.",
|
|
150
150
|
},
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
trait_key: "pure_digital", trait_value: true,
|
|
154
154
|
check: {
|
|
155
|
-
id: "fb_wip_verified", description: "WIP hash
|
|
155
|
+
id: "fb_wip_verified", description: "WIP hash verification (digital deliverables traceable)",
|
|
156
156
|
weight: 25,
|
|
157
157
|
passed: (p) => p?.service_basics?.wip_verified === true,
|
|
158
|
-
advice: "⚠️ WIP
|
|
158
|
+
advice: "⚠️ WIP not verified: digital deliverables cannot be traced.",
|
|
159
159
|
},
|
|
160
160
|
},
|
|
161
161
|
{
|
|
162
162
|
trait_key: "long_cycle", trait_value: true,
|
|
163
163
|
check: {
|
|
164
|
-
id: "fb_milestone", description: "
|
|
164
|
+
id: "fb_milestone", description: "Milestone nodes (phased acceptance)",
|
|
165
165
|
weight: 25,
|
|
166
166
|
passed: (p) => p?.workflow_analysis?.has_milestone_nodes ?? false,
|
|
167
|
-
advice: "⚠️
|
|
167
|
+
advice: "⚠️ No milestone nodes: long-cycle projects lack phased acceptance.",
|
|
168
168
|
},
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
trait_key: "regulatory_intensity", trait_value: "high",
|
|
172
172
|
check: {
|
|
173
|
-
id: "fb_compliance", description: "
|
|
173
|
+
id: "fb_compliance", description: "Compliance configuration (arbitration + compensation fund)",
|
|
174
174
|
weight: 30,
|
|
175
175
|
passed: (p) => (p?.workflow_analysis?.has_arbitration_path ?? false) &&
|
|
176
176
|
(p?.service_basics?.compensation_fund_balance ?? 0n) > 0n,
|
|
177
|
-
advice: "🔴
|
|
177
|
+
advice: "🔴 Compliance requirement not met: highly regulated industries must configure arbitration and a compensation fund.",
|
|
178
178
|
},
|
|
179
179
|
},
|
|
180
180
|
{
|
|
181
181
|
trait_key: "multi_tier_allocation", trait_value: true,
|
|
182
182
|
check: {
|
|
183
|
-
id: "fb_multi_tier_fair", description: "
|
|
183
|
+
id: "fb_multi_tier_fair", description: "Multi-tier allocation fairness (each segment has a corresponding Allocator)",
|
|
184
184
|
weight: 20,
|
|
185
185
|
passed: (p) => (p?.workflow_analysis?.total_nodes ?? 0) >= 3,
|
|
186
|
-
advice: "⚠️
|
|
186
|
+
advice: "⚠️ Multi-tier allocation requires corresponding nodes and Allocators, otherwise fund distribution is opaque.",
|
|
187
187
|
},
|
|
188
188
|
},
|
|
189
189
|
];
|
|
190
190
|
function buildFallbackFlywheel(name, traits) {
|
|
191
|
-
const sellingPoints = ["
|
|
191
|
+
const sellingPoints = ["Fund escrow + process transparency"];
|
|
192
192
|
if (traits.deposit_required)
|
|
193
|
-
sellingPoints.push("
|
|
193
|
+
sellingPoints.push("Deposit escrow + lock-period guarantee");
|
|
194
194
|
if (traits.has_logistics)
|
|
195
|
-
sellingPoints.push("
|
|
195
|
+
sellingPoints.push("Logistics Guard verification");
|
|
196
196
|
if (traits.pure_digital)
|
|
197
|
-
sellingPoints.push("WIP
|
|
197
|
+
sellingPoints.push("WIP digital deliverable traceability");
|
|
198
198
|
if (traits.regulatory_intensity === "high")
|
|
199
|
-
sellingPoints.push("
|
|
199
|
+
sellingPoints.push("Compliant arbitration + compensation fund guarantee");
|
|
200
200
|
const keyActions = [
|
|
201
|
-
{ action: "
|
|
202
|
-
{ action: "
|
|
201
|
+
{ action: "Set first-order Reward", purpose: "Attract new customers", mutableField: "rewards", metricToWatch: "New customer order rate" },
|
|
202
|
+
{ action: "Configure compensation_fund", purpose: "Improve trust score", mutableField: "compensation_fund", metricToWatch: "Trust score" },
|
|
203
203
|
];
|
|
204
204
|
if (traits.long_cycle) {
|
|
205
|
-
keyActions.push({ action: "
|
|
205
|
+
keyActions.push({ action: "Milestone Reward", purpose: "Incentivize completion of long-cycle projects", mutableField: "rewards", metricToWatch: "Completion rate" });
|
|
206
206
|
}
|
|
207
207
|
if (traits.consumption_frequency === "frequent") {
|
|
208
|
-
keyActions.push({ action: "
|
|
208
|
+
keyActions.push({ action: "Loyalty Reward", purpose: "Improve repurchase", mutableField: "rewards", metricToWatch: "Repurchase rate" });
|
|
209
209
|
}
|
|
210
210
|
return {
|
|
211
211
|
industry: name,
|
|
212
212
|
trustSellingPoints: sellingPoints,
|
|
213
213
|
keyActions,
|
|
214
|
-
rewardStrategy: "
|
|
215
|
-
discountStrategy: traits.long_cycle ? "
|
|
214
|
+
rewardStrategy: "First-order reward + referral cashback" + (traits.consumption_frequency === "frequent" ? " + loyalty reward" : ""),
|
|
215
|
+
discountStrategy: traits.long_cycle ? "Long-term cooperation discount + tiered discount" : "First-order discount + spend-threshold discount",
|
|
216
216
|
trustDescription: sellingPoints.join(" + "),
|
|
217
217
|
};
|
|
218
218
|
}
|
|
@@ -234,7 +234,7 @@ export function synthesizeProfile(traits, name) {
|
|
|
234
234
|
? getIndustryProfile(bestMatch.industry)
|
|
235
235
|
: undefined;
|
|
236
236
|
const industryName = name ?? `custom_${Date.now().toString(36)}`;
|
|
237
|
-
const displayName = name ??
|
|
237
|
+
const displayName = name ?? `Custom Industry`;
|
|
238
238
|
const flywheel = reuseBasis
|
|
239
239
|
? { ...reuseBasis.flywheel, industry: industryName }
|
|
240
240
|
: buildFallbackFlywheel(industryName, traits);
|
|
@@ -263,10 +263,10 @@ export function synthesizeProfile(traits, name) {
|
|
|
263
263
|
riskChecks.push({
|
|
264
264
|
id: "fb_basic_arbitration",
|
|
265
265
|
industry: industryName,
|
|
266
|
-
description: "
|
|
266
|
+
description: "Configure arbitration (basic dispute resolution)",
|
|
267
267
|
weight: 100,
|
|
268
268
|
passed: (p) => p?.workflow_analysis?.has_arbitration_path ?? false,
|
|
269
|
-
advice: "⚠️
|
|
269
|
+
advice: "⚠️ No arbitration configured: basic disputes have no resolution channel.",
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
272
|
return {
|
|
@@ -348,7 +348,7 @@ export function composeIndustries(names, newName) {
|
|
|
348
348
|
};
|
|
349
349
|
const composed = {
|
|
350
350
|
name: newNameResolved,
|
|
351
|
-
display_name: newName ??
|
|
351
|
+
display_name: newName ?? `Composed Industry (${names.join("+")})`,
|
|
352
352
|
traits: composedTraits,
|
|
353
353
|
source: "composed",
|
|
354
354
|
version: "v1",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { AcquisitionFlywheel } from "./acquisition-flywheel.js";
|
|
2
|
-
import type { IndustryRiskCheck, IndustryNeed } from "../customer/
|
|
3
|
-
import type { IndustryTemplate } from "../customer/user-preferences.js";
|
|
2
|
+
import type { IndustryRiskCheck, IndustryNeed, IndustryTemplate } from "../customer/index.js";
|
|
4
3
|
export interface IndustryTraits {
|
|
5
4
|
has_logistics: boolean;
|
|
6
5
|
communication_heavy: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { getFlywheelForIndustry, listIndustries as listFlywheelIndustries } from "./acquisition-flywheel.js";
|
|
2
|
-
import { getIndustryRiskChecks, getIndustryNeeds } from "../customer/
|
|
3
|
-
import {
|
|
1
|
+
import { getFlywheelForIndustry, listIndustries as listFlywheelIndustries, _setRegistryLookup as setFlywheelLookup } from "./acquisition-flywheel.js";
|
|
2
|
+
import { getIndustryRiskChecks, getIndustryNeeds, getIndustryTemplate, SUPPORTED_INDUSTRIES } from "../customer/index.js";
|
|
3
|
+
import { _setRegistryLookup as setRisksLookup } from "../customer/industry-risks.js";
|
|
4
|
+
import { _setRegistryLookup as setPreferencesLookup } from "../customer/user-preferences.js";
|
|
4
5
|
const BUILTIN_TRAITS = {
|
|
5
6
|
freelance: {
|
|
6
7
|
has_logistics: false, communication_heavy: true, pure_digital: true,
|
|
@@ -40,49 +41,36 @@ const BUILTIN_TRAITS = {
|
|
|
40
41
|
},
|
|
41
42
|
};
|
|
42
43
|
const BUILTIN_DISPLAY_NAMES = {
|
|
43
|
-
freelance: "
|
|
44
|
-
rental: "
|
|
45
|
-
education: "
|
|
46
|
-
travel: "
|
|
47
|
-
subscription: "
|
|
48
|
-
retail: "
|
|
49
|
-
general: "
|
|
50
|
-
custom: "
|
|
44
|
+
freelance: "Freelance",
|
|
45
|
+
rental: "Rental",
|
|
46
|
+
education: "Education",
|
|
47
|
+
travel: "Travel",
|
|
48
|
+
subscription: "Subscription",
|
|
49
|
+
retail: "Retail",
|
|
50
|
+
general: "General",
|
|
51
|
+
custom: "Custom",
|
|
51
52
|
};
|
|
52
53
|
const INDUSTRY_ALIASES = {
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"咨询": "freelance",
|
|
58
|
-
"租赁": "rental",
|
|
59
|
-
"租用": "rental",
|
|
60
|
-
"出租": "rental",
|
|
61
|
-
"教育": "education",
|
|
62
|
-
"课程": "education",
|
|
63
|
-
"培训": "education",
|
|
64
|
-
"旅行": "travel",
|
|
65
|
-
"旅游": "travel",
|
|
66
|
-
"行程": "travel",
|
|
67
|
-
"订阅": "subscription",
|
|
68
|
-
"会员": "subscription",
|
|
69
|
-
"零售": "retail",
|
|
70
|
-
"电商": "retail",
|
|
71
|
-
"商品": "retail",
|
|
72
|
-
"通用": "general",
|
|
73
|
-
"自定义": "custom",
|
|
74
|
-
"freelancer": "freelance",
|
|
75
|
-
"gig": "freelance",
|
|
54
|
+
"outsourcing": "freelance",
|
|
55
|
+
"design": "freelance",
|
|
56
|
+
"development": "freelance",
|
|
57
|
+
"consulting": "freelance",
|
|
76
58
|
"rent": "rental",
|
|
77
59
|
"lease": "rental",
|
|
78
60
|
"course": "education",
|
|
61
|
+
"training": "education",
|
|
62
|
+
"tourism": "travel",
|
|
63
|
+
"itinerary": "travel",
|
|
64
|
+
"membership": "subscription",
|
|
65
|
+
"ecommerce": "retail",
|
|
66
|
+
"goods": "retail",
|
|
67
|
+
"freelancer": "freelance",
|
|
68
|
+
"gig": "freelance",
|
|
79
69
|
"edu": "education",
|
|
80
70
|
"trip": "travel",
|
|
81
71
|
"tour": "travel",
|
|
82
72
|
"subscribe": "subscription",
|
|
83
|
-
"membership": "subscription",
|
|
84
73
|
"shop": "retail",
|
|
85
|
-
"ecommerce": "retail",
|
|
86
74
|
"general_industry": "general",
|
|
87
75
|
};
|
|
88
76
|
export const INDUSTRY_REGISTRY_VERSION = 1;
|
|
@@ -118,6 +106,21 @@ function seedBuiltinIndustries() {
|
|
|
118
106
|
}
|
|
119
107
|
}
|
|
120
108
|
seedBuiltinIndustries();
|
|
109
|
+
injectRegistryLookup();
|
|
110
|
+
function injectRegistryLookup() {
|
|
111
|
+
setFlywheelLookup((industry) => {
|
|
112
|
+
const p = registry.get(industry);
|
|
113
|
+
return p ? { flywheel: p.flywheel } : undefined;
|
|
114
|
+
});
|
|
115
|
+
setRisksLookup((industry) => {
|
|
116
|
+
const p = registry.get(industry);
|
|
117
|
+
return p ? { risk_checks: p.risk_checks, needs: p.needs } : undefined;
|
|
118
|
+
});
|
|
119
|
+
setPreferencesLookup((industry) => {
|
|
120
|
+
const p = registry.get(industry);
|
|
121
|
+
return p ? { preference_template: p.preference_template } : undefined;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
121
124
|
export function getIndustryProfile(name) {
|
|
122
125
|
const p = registry.get(name);
|
|
123
126
|
return p ? JSON.parse(JSON.stringify(p)) : undefined;
|
|
@@ -160,7 +163,11 @@ export function getRegistrySize() {
|
|
|
160
163
|
}
|
|
161
164
|
export function _resetRegistryForTest() {
|
|
162
165
|
registry.clear();
|
|
166
|
+
setFlywheelLookup(null);
|
|
167
|
+
setRisksLookup(null);
|
|
168
|
+
setPreferencesLookup(null);
|
|
163
169
|
seedBuiltinIndustries();
|
|
170
|
+
injectRegistryLookup();
|
|
164
171
|
}
|
|
165
172
|
export function listBuiltinIndustryNames() {
|
|
166
173
|
return listFlywheelIndustries();
|